Storing texture path as its name.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7732 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
6b44f3fcc9
commit
3f352ea5de
@ -1562,11 +1562,11 @@ public class TextureHelper extends AbstractBlenderHelper {
|
|||||||
public Texture getTextureFromImage(Structure image, DataRepository dataRepository) throws BlenderFileException {
|
public Texture getTextureFromImage(Structure image, DataRepository dataRepository) throws BlenderFileException {
|
||||||
Texture result = (Texture) dataRepository.getLoadedFeature(image.getOldMemoryAddress(), LoadedFeatureDataType.LOADED_FEATURE);
|
Texture result = (Texture) dataRepository.getLoadedFeature(image.getOldMemoryAddress(), LoadedFeatureDataType.LOADED_FEATURE);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
String texturePath = image.getFieldValue("name").toString();
|
||||||
Pointer pPackedFile = (Pointer) image.getFieldValue("packedfile");
|
Pointer pPackedFile = (Pointer) image.getFieldValue("packedfile");
|
||||||
if (pPackedFile.isNull()) {
|
if (pPackedFile.isNull()) {
|
||||||
LOGGER.info("Reading texture from file!");
|
LOGGER.info("Reading texture from file!");
|
||||||
String imagePath = image.getFieldValue("name").toString();
|
result = this.loadTextureFromFile(texturePath, dataRepository);
|
||||||
result = this.loadTextureFromFile(imagePath, dataRepository);
|
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("Packed texture. Reading directly from the blend file!");
|
LOGGER.info("Packed texture. Reading directly from the blend file!");
|
||||||
Structure packedFile = pPackedFile.fetchData(dataRepository.getInputStream()).get(0);
|
Structure packedFile = pPackedFile.fetchData(dataRepository.getInputStream()).get(0);
|
||||||
@ -1582,6 +1582,7 @@ public class TextureHelper extends AbstractBlenderHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
result.setName(texturePath);
|
||||||
result.setWrap(Texture.WrapMode.Repeat);
|
result.setWrap(Texture.WrapMode.Repeat);
|
||||||
dataRepository.addLoadedFeatures(image.getOldMemoryAddress(), image.getName(), image, result);
|
dataRepository.addLoadedFeatures(image.getOldMemoryAddress(), image.getName(), image, result);
|
||||||
}
|
}
|
||||||
@ -1860,20 +1861,4 @@ public class TextureHelper extends AbstractBlenderHelper {
|
|||||||
return super.clone();
|
return super.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GeneratedTextureData {
|
|
||||||
public ByteBuffer luminanceData;
|
|
||||||
public ByteBuffer rgbData;
|
|
||||||
public Format rgbFormat;
|
|
||||||
public int width;
|
|
||||||
public int height;
|
|
||||||
|
|
||||||
public GeneratedTextureData(ByteBuffer luminanceData, ByteBuffer rgbData, Format rgbFormat, int width, int height) {
|
|
||||||
this.luminanceData = luminanceData;
|
|
||||||
this.rgbData = rgbData;
|
|
||||||
this.rgbFormat = rgbFormat;
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user