Fixes to textures merging.
Adding logs to the image loading method. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8328 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
97a9b4ee00
commit
3969d34a03
@ -311,6 +311,9 @@ public class TextureHelper extends AbstractBlenderHelper {
|
|||||||
++lastTextureWithoutAlphaIndex;
|
++lastTextureWithoutAlphaIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(depth==0) {
|
||||||
|
depth = 1;
|
||||||
|
}
|
||||||
|
|
||||||
//remove textures before the one without alpha (they will be covered anyway)
|
//remove textures before the one without alpha (they will be covered anyway)
|
||||||
if(lastTextureWithoutAlphaIndex > 0 && lastTextureWithoutAlphaIndex<sources.size()-1) {
|
if(lastTextureWithoutAlphaIndex > 0 && lastTextureWithoutAlphaIndex<sources.size()-1) {
|
||||||
@ -341,11 +344,14 @@ public class TextureHelper extends AbstractBlenderHelper {
|
|||||||
resultPixel.clear();
|
resultPixel.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(depth==1) {
|
||||||
|
result = new Texture2D(new Image(Format.RGB8, width, height, data));
|
||||||
|
} else {
|
||||||
ArrayList<ByteBuffer> arrayData = new ArrayList<ByteBuffer>(1);
|
ArrayList<ByteBuffer> arrayData = new ArrayList<ByteBuffer>(1);
|
||||||
arrayData.add(data);
|
arrayData.add(data);
|
||||||
//TODO: add different texture types
|
|
||||||
result = new Texture3D(new Image(Format.RGB8, width, height, depth, arrayData));
|
result = new Texture3D(new Image(Format.RGB8, width, height, depth, arrayData));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,12 +756,13 @@ public class TextureHelper extends AbstractBlenderHelper {
|
|||||||
* this exception is thrown when the blend file structure is somehow invalid or corrupted
|
* this exception is thrown when the blend file structure is somehow invalid or corrupted
|
||||||
*/
|
*/
|
||||||
public Texture getTextureFromImage(Structure image, BlenderContext blenderContext) throws BlenderFileException {
|
public Texture getTextureFromImage(Structure image, BlenderContext blenderContext) throws BlenderFileException {
|
||||||
|
LOGGER.log(Level.FINE, "Fetching texture with OMA = {0}", image.getOldMemoryAddress());
|
||||||
Texture result = (Texture) blenderContext.getLoadedFeature(image.getOldMemoryAddress(), LoadedFeatureDataType.LOADED_FEATURE);
|
Texture result = (Texture) blenderContext.getLoadedFeature(image.getOldMemoryAddress(), LoadedFeatureDataType.LOADED_FEATURE);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
String texturePath = image.getFieldValue("name").toString();
|
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.log(Level.INFO, "Reading texture from file: {0}", texturePath);
|
||||||
result = this.loadTextureFromFile(texturePath, blenderContext);
|
result = this.loadTextureFromFile(texturePath, blenderContext);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("Packed texture. Reading directly from the blend file!");
|
LOGGER.info("Packed texture. Reading directly from the blend file!");
|
||||||
@ -774,6 +781,9 @@ public class TextureHelper extends AbstractBlenderHelper {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
result.setName(texturePath);
|
result.setName(texturePath);
|
||||||
result.setWrap(Texture.WrapMode.Repeat);
|
result.setWrap(Texture.WrapMode.Repeat);
|
||||||
|
if(LOGGER.isLoggable(Level.FINE)) {
|
||||||
|
LOGGER.log(Level.FINE, "Adding texture {0} to the loaded features with OMA = {1}", new Object[] {texturePath, image.getOldMemoryAddress()});
|
||||||
|
}
|
||||||
blenderContext.addLoadedFeatures(image.getOldMemoryAddress(), image.getName(), image, result);
|
blenderContext.addLoadedFeatures(image.getOldMemoryAddress(), image.getName(), image, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user