Javadocs added and removed unused methods.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7566 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 14 years ago
parent c6be5633ce
commit c4270ad91f
  1. 52
      engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MaterialHelper.java

@ -40,7 +40,6 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.jme3.asset.BlenderKey.FeaturesToLoad; import com.jme3.asset.BlenderKey.FeaturesToLoad;
import com.jme3.asset.TextureKey;
import com.jme3.material.MatParam; import com.jme3.material.MatParam;
import com.jme3.material.Material; import com.jme3.material.Material;
import com.jme3.material.Material.MatParamTexture; import com.jme3.material.Material.MatParamTexture;
@ -259,12 +258,9 @@ public class MaterialHelper extends AbstractBlenderHelper {
result.setBoolean("UseMaterialColors", Boolean.FALSE); result.setBoolean("UseMaterialColors", Boolean.FALSE);
// blending the texture with material color and texture's defined color // blending the texture with material color and texture's defined color
int blendType = ((Number) textureLink.getFieldValue("blendtype")).intValue(); int blendType = ((Number) textureLink.getFieldValue("blendtype")).intValue();
float[] color = new float[] { ((Number) textureLink.getFieldValue("r")).floatValue(), float[] color = new float[] { ((Number) textureLink.getFieldValue("r")).floatValue(), ((Number) textureLink.getFieldValue("g")).floatValue(), ((Number) textureLink.getFieldValue("b")).floatValue() };
((Number) textureLink.getFieldValue("g")).floatValue(),
((Number) textureLink.getFieldValue("b")).floatValue() };
float colfac = ((Number) textureLink.getFieldValue("colfac")).floatValue(); float colfac = ((Number) textureLink.getFieldValue("colfac")).floatValue();
texture = textureHelper.blendTexture(diffuseColor.getColorArray(), texture, color, colfac, blendType, texture = textureHelper.blendTexture(diffuseColor.getColorArray(), texture, color, colfac, blendType, negateTexture, dataRepository);
negateTexture, dataRepository);
texture.setWrap(WrapMode.Repeat); texture.setWrap(WrapMode.Repeat);
if (shadeless) { if (shadeless) {
result.setTexture(TEXTURE_TYPE_COLOR, texture); result.setTexture(TEXTURE_TYPE_COLOR, texture);
@ -315,8 +311,7 @@ public class MaterialHelper extends AbstractBlenderHelper {
* @return material without textures of a specified type * @return material without textures of a specified type
*/ */
public Material getNonTexturedMaterial(Material material, int imageType) { public Material getNonTexturedMaterial(Material material, int imageType) {
String[] textureParamNames = new String[] { TEXTURE_TYPE_DIFFUSE, TEXTURE_TYPE_NORMAL, TEXTURE_TYPE_GLOW, TEXTURE_TYPE_SPECULAR, String[] textureParamNames = new String[] { TEXTURE_TYPE_DIFFUSE, TEXTURE_TYPE_NORMAL, TEXTURE_TYPE_GLOW, TEXTURE_TYPE_SPECULAR, TEXTURE_TYPE_ALPHA };
TEXTURE_TYPE_ALPHA };
Map<String, Texture> textures = new HashMap<String, Texture>(textureParamNames.length); Map<String, Texture> textures = new HashMap<String, Texture>(textureParamNames.length);
for (String textureParamName : textureParamNames) { for (String textureParamName : textureParamNames) {
MatParamTexture matParamTexture = material.getTextureParam(textureParamName); MatParamTexture matParamTexture = material.getTextureParam(textureParamName);
@ -336,8 +331,7 @@ public class MaterialHelper extends AbstractBlenderHelper {
material.clearParam(textureParamName.getKey()); material.clearParam(textureParamName.getKey());
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
LOGGER.log(Level.WARNING, "The name of the texture does not contain the texture type value! {0} will not be removed!", LOGGER.log(Level.WARNING, "The name of the texture does not contain the texture type value! {0} will not be removed!", name);
name);
} }
} }
Material result = material.clone(); Material result = material.clone();
@ -353,8 +347,10 @@ public class MaterialHelper extends AbstractBlenderHelper {
* This method converts the given material into particles-usable material. * This method converts the given material into particles-usable material.
* The texture and glow color are being copied. * The texture and glow color are being copied.
* The method assumes it receives the Lighting type of material. * The method assumes it receives the Lighting type of material.
* @param material the source material * @param material
* @param dataRepository the data repository * the source material
* @param dataRepository
* the data repository
* @return material converted into particles-usable material * @return material converted into particles-usable material
*/ */
public Material getParticlesMaterial(Material material, Integer alphaMaskIndex, DataRepository dataRepository) { public Material getParticlesMaterial(Material material, Integer alphaMaskIndex, DataRepository dataRepository) {
@ -399,15 +395,6 @@ public class MaterialHelper extends AbstractBlenderHelper {
return result; return result;
} }
protected byte calculateAlpha(float x, float y) {
return (byte)255;
}
protected Texture loadParticleAlphaMapTexture(DataRepository dataRepository) {
TextureKey textureKey = new TextureKey(this.getClass().getPackage().getName().replace('.', '/') + "/particle_alpha_map.png");
return dataRepository.getAssetManager().loadTexture(textureKey);
}
/** /**
* This method indicates if the material has a texture of a specified type. * This method indicates if the material has a texture of a specified type.
* *
@ -565,8 +552,7 @@ public class MaterialHelper extends AbstractBlenderHelper {
materials = new Material[materialStructures.size()]; materials = new Material[materialStructures.size()];
int i = 0; int i = 0;
for (Structure s : materialStructures) { for (Structure s : materialStructures) {
Material material = (Material) dataRepository.getLoadedFeature(s.getOldMemoryAddress(), Material material = (Material) dataRepository.getLoadedFeature(s.getOldMemoryAddress(), LoadedFeatureDataType.LOADED_FEATURE);
LoadedFeatureDataType.LOADED_FEATURE);
if (material == null) { if (material == null) {
material = materialHelper.toMaterial(s, dataRepository); material = materialHelper.toMaterial(s, dataRepository);
} }
@ -688,8 +674,28 @@ public class MaterialHelper extends AbstractBlenderHelper {
} }
} }
/**
* An interface used in calculating alpha mask during particles' texture calculations.
* @author Marcin Roguski (Kaelthas)
*/
protected static interface IAlphaMask { protected static interface IAlphaMask {
/**
* This method sets the size of the texture's image.
* @param width
* the width of the image
* @param height
* the height of the image
*/
void setImageSize(int width, int height); void setImageSize(int width, int height);
/**
* This method returns the alpha value for the specified texture position.
* @param x
* the X coordinate of the texture position
* @param y
* the Y coordinate of the texture position
* @return the alpha value for the specified texture position
*/
byte getAlpha(float x, float y); byte getAlpha(float x, float y);
} }
} }

Loading…
Cancel
Save