@ -115,6 +115,11 @@ public class BlenderKey extends ModelKey {
protected float skyGeneratedTextureRadius = 1 ;
protected float skyGeneratedTextureRadius = 1 ;
/** The shape against which the generated texture for the sky will be created. */
/** The shape against which the generated texture for the sky will be created. */
protected SkyGeneratedTextureShape skyGeneratedTextureShape = SkyGeneratedTextureShape . SPHERE ;
protected SkyGeneratedTextureShape skyGeneratedTextureShape = SkyGeneratedTextureShape . SPHERE ;
/ * *
* This field tells if the importer should optimise the use of textures or not . If set to true , then textures of the same mapping type will be merged together
* and textures that in the final result will never be visible - will be discarded .
* /
protected boolean optimiseTextures ;
/ * *
/ * *
* Constructor used by serialization mechanisms .
* Constructor used by serialization mechanisms .
@ -420,6 +425,23 @@ public class BlenderKey extends ModelKey {
this . skyGeneratedTextureShape = skyGeneratedTextureShape ;
this . skyGeneratedTextureShape = skyGeneratedTextureShape ;
}
}
/ * *
* If set to true , then textures of the same mapping type will be merged together
* and textures that in the final result will never be visible - will be discarded .
* @param optimiseTextures
* the variable that tells if the textures should be optimised or not
* /
public void setOptimiseTextures ( boolean optimiseTextures ) {
this . optimiseTextures = optimiseTextures ;
}
/ * *
* @return the variable that tells if the textures should be optimised or not ( by default the optimisation is disabled )
* /
public boolean isOptimiseTextures ( ) {
return optimiseTextures ;
}
/ * *
/ * *
* This mehtod sets the name of the WORLD data block taht should be used during file loading . By default the name is
* This mehtod sets the name of the WORLD data block taht should be used during file loading . By default the name is
* not set . If no name is set or the given name does not occur in the file - the first WORLD data block will be used
* not set . If no name is set or the given name does not occur in the file - the first WORLD data block will be used
@ -474,6 +496,7 @@ public class BlenderKey extends ModelKey {
oc . write ( skyGeneratedTextureSize , "sky-generated-texture-size" , 1000 ) ;
oc . write ( skyGeneratedTextureSize , "sky-generated-texture-size" , 1000 ) ;
oc . write ( skyGeneratedTextureRadius , "sky-generated-texture-radius" , 1f ) ;
oc . write ( skyGeneratedTextureRadius , "sky-generated-texture-radius" , 1f ) ;
oc . write ( skyGeneratedTextureShape , "sky-generated-texture-shape" , SkyGeneratedTextureShape . SPHERE ) ;
oc . write ( skyGeneratedTextureShape , "sky-generated-texture-shape" , SkyGeneratedTextureShape . SPHERE ) ;
oc . write ( optimiseTextures , "optimise-textures" , false ) ;
}
}
@Override
@Override
@ -494,6 +517,7 @@ public class BlenderKey extends ModelKey {
skyGeneratedTextureSize = ic . readInt ( "sky-generated-texture-size" , 1000 ) ;
skyGeneratedTextureSize = ic . readInt ( "sky-generated-texture-size" , 1000 ) ;
skyGeneratedTextureRadius = ic . readFloat ( "sky-generated-texture-radius" , 1f ) ;
skyGeneratedTextureRadius = ic . readFloat ( "sky-generated-texture-radius" , 1f ) ;
skyGeneratedTextureShape = ic . readEnum ( "sky-generated-texture-shape" , SkyGeneratedTextureShape . class , SkyGeneratedTextureShape . SPHERE ) ;
skyGeneratedTextureShape = ic . readEnum ( "sky-generated-texture-shape" , SkyGeneratedTextureShape . class , SkyGeneratedTextureShape . SPHERE ) ;
optimiseTextures = ic . readBoolean ( "optimise-textures" , false ) ;
}
}
@Override
@Override
@ -507,14 +531,15 @@ public class BlenderKey extends ModelKey {
result = prime * result + ( fixUpAxis ? 1231 : 1237 ) ;
result = prime * result + ( fixUpAxis ? 1231 : 1237 ) ;
result = prime * result + fps ;
result = prime * result + fps ;
result = prime * result + generatedTexturePPU ;
result = prime * result + generatedTexturePPU ;
result = prime * result + ( skyGeneratedTextureShape = = null ? 0 : skyGeneratedTextureShape . hashCode ( ) ) ;
result = prime * result + layersToLoad ;
result = prime * result + layersToLoad ;
result = prime * result + ( loadGeneratedTextures ? 1231 : 1237 ) ;
result = prime * result + ( loadGeneratedTextures ? 1231 : 1237 ) ;
result = prime * result + ( loadObjectProperties ? 1231 : 1237 ) ;
result = prime * result + ( loadObjectProperties ? 1231 : 1237 ) ;
result = prime * result + ( loadUnlinkedAssets ? 1231 : 1237 ) ;
result = prime * result + ( loadUnlinkedAssets ? 1231 : 1237 ) ;
result = prime * result + maxTextureSize ;
result = prime * result + maxTextureSize ;
result = prime * result + ( mipmapGenerationMethod = = null ? 0 : mipmapGenerationMethod . hashCode ( ) ) ;
result = prime * result + ( mipmapGenerationMethod = = null ? 0 : mipmapGenerationMethod . hashCode ( ) ) ;
result = prime * result + ( optimiseTextures ? 1231 : 1237 ) ;
result = prime * result + Float . floatToIntBits ( skyGeneratedTextureRadius ) ;
result = prime * result + Float . floatToIntBits ( skyGeneratedTextureRadius ) ;
result = prime * result + ( skyGeneratedTextureShape = = null ? 0 : skyGeneratedTextureShape . hashCode ( ) ) ;
result = prime * result + skyGeneratedTextureSize ;
result = prime * result + skyGeneratedTextureSize ;
result = prime * result + ( usedWorld = = null ? 0 : usedWorld . hashCode ( ) ) ;
result = prime * result + ( usedWorld = = null ? 0 : usedWorld . hashCode ( ) ) ;
return result ;
return result ;
@ -561,9 +586,6 @@ public class BlenderKey extends ModelKey {
if ( generatedTexturePPU ! = other . generatedTexturePPU ) {
if ( generatedTexturePPU ! = other . generatedTexturePPU ) {
return false ;
return false ;
}
}
if ( skyGeneratedTextureShape ! = other . skyGeneratedTextureShape ) {
return false ;
}
if ( layersToLoad ! = other . layersToLoad ) {
if ( layersToLoad ! = other . layersToLoad ) {
return false ;
return false ;
}
}
@ -582,9 +604,15 @@ public class BlenderKey extends ModelKey {
if ( mipmapGenerationMethod ! = other . mipmapGenerationMethod ) {
if ( mipmapGenerationMethod ! = other . mipmapGenerationMethod ) {
return false ;
return false ;
}
}
if ( optimiseTextures ! = other . optimiseTextures ) {
return false ;
}
if ( Float . floatToIntBits ( skyGeneratedTextureRadius ) ! = Float . floatToIntBits ( other . skyGeneratedTextureRadius ) ) {
if ( Float . floatToIntBits ( skyGeneratedTextureRadius ) ! = Float . floatToIntBits ( other . skyGeneratedTextureRadius ) ) {
return false ;
return false ;
}
}
if ( skyGeneratedTextureShape ! = other . skyGeneratedTextureShape ) {
return false ;
}
if ( skyGeneratedTextureSize ! = other . skyGeneratedTextureSize ) {
if ( skyGeneratedTextureSize ! = other . skyGeneratedTextureSize ) {
return false ;
return false ;
}
}
@ -598,6 +626,8 @@ public class BlenderKey extends ModelKey {
return true ;
return true ;
}
}
/ * *
/ * *
* This enum tells the importer if the mipmaps for textures will be generated by jme . < li > NEVER_GENERATE and ALWAYS_GENERATE are quite understandable < li > GENERATE_WHEN_NEEDED is an option that checks if the texture had ' Generate mipmaps ' option set in blender , mipmaps are generated only when the option is set
* This enum tells the importer if the mipmaps for textures will be generated by jme . < li > NEVER_GENERATE and ALWAYS_GENERATE are quite understandable < li > GENERATE_WHEN_NEEDED is an option that checks if the texture had ' Generate mipmaps ' option set in blender , mipmaps are generated only when the option is set
* @author Marcin Roguski ( Kaelthas )
* @author Marcin Roguski ( Kaelthas )