本文整理汇总了Java中com.jme3.material.MatParam.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java MatParam.getValue方法的具体用法?Java MatParam.getValue怎么用?Java MatParam.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.material.MatParam
的用法示例。
在下文中一共展示了MatParam.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDiffuse
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Get a diffuse texture of the level.
*
* @param layer the layer.
* @return the diffuse texture or null.
*/
@FromAnyThread
public @Nullable Texture getDiffuse(final int layer) {
final Function<Integer, String> layerToDiffuseName = getLayerToDiffuseName();
if (layerToDiffuseName == null) return null;
final Terrain terrain = getTerrain();
final Material material = terrain.getMaterial();
final MatParam matParam = material.getParam(layerToDiffuseName.apply(layer));
if (matParam == null || matParam.getValue() == null) {
return null;
}
return (Texture) matParam.getValue();
}
示例2: setDiffuse
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Set a new diffuse texture to a level.
*
* @param texture the new texture.
* @param layer the layer.
*/
@FromAnyThread
public void setDiffuse(@Nullable final Texture texture, final int layer) {
final Function<Integer, String> layerToDiffuseName = getLayerToDiffuseName();
if (layerToDiffuseName == null) return;
final Terrain terrain = getTerrain();
final Material material = terrain.getMaterial();
final String paramName = layerToDiffuseName.apply(layer);
final MatParam matParam = material.getParam(paramName);
final Texture current = matParam == null ? null : (Texture) matParam.getValue();
if (texture != null) {
texture.setWrap(Texture.WrapMode.Repeat);
}
final PropertyOperation<ChangeConsumer, Node, Texture> operation =
new PropertyOperation<>(getTerrainNode(), TERRAIN_PARAM, texture, current);
operation.setApplyHandler((node, newTexture) ->
NodeUtils.visitGeometry(node, geometry -> updateTexture(newTexture, paramName, geometry)));
final ModelChangeConsumer changeConsumer = editingComponent.getChangeConsumer();
changeConsumer.execute(operation);
}
示例3: getNormal
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Get a diffuse normal of the level.
*
* @param layer the layer.
* @return the normal texture or null.
*/
@FromAnyThread
public @Nullable Texture getNormal(final int layer) {
final Function<Integer, String> layerToNormalName = getLayerToNormalName();
if (layerToNormalName == null) return null;
final Terrain terrain = getTerrain();
final Material material = terrain.getMaterial();
final MatParam matParam = material.getParam(layerToNormalName.apply(layer));
if (matParam == null || matParam.getValue() == null) {
return null;
}
return (Texture) matParam.getValue();
}
示例4: setNormal
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Set a new normal texture to a level.
*
* @param texture the normal texture.
* @param layer the layer.
*/
@FromAnyThread
public void setNormal(@Nullable final Texture texture, final int layer) {
final Function<Integer, String> layerToNormalName = getLayerToNormalName();
if (layerToNormalName == null) return;
final Terrain terrain = getTerrain();
final Material material = terrain.getMaterial();
final String paramName = layerToNormalName.apply(layer);
final MatParam matParam = material.getParam(paramName);
final Texture current = matParam == null ? null : (Texture) matParam.getValue();
if (texture != null) {
texture.setWrap(Texture.WrapMode.Repeat);
}
final PropertyOperation<ChangeConsumer, Node, Texture> operation =
new PropertyOperation<>(getTerrainNode(), TERRAIN_PARAM, texture, current);
operation.setApplyHandler((node, newTexture) ->
NodeUtils.visitGeometry(node, geometry -> updateTexture(newTexture, paramName, geometry)));
final ModelChangeConsumer changeConsumer = editingComponent.getChangeConsumer();
changeConsumer.execute(operation);
}
示例5: getAlpha
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Get a alpha texture of the level.
*
* @param layer the layer.
* @return the alpha texture or null.
*/
@FromAnyThread
public @Nullable Texture getAlpha(final int layer) {
final Function<Integer, String> layerToAlphaName = getLayerToAlphaName();
if (layerToAlphaName == null) return null;
final Terrain terrain = getTerrain();
final Material material = terrain.getMaterial();
final MatParam matParam = material.getParam(layerToAlphaName.apply(layer));
if (matParam == null || matParam.getValue() == null) {
return null;
}
return (Texture) matParam.getValue();
}
示例6: changePaintControlShininess
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Change the shininess value.
*/
@FromAnyThread
private void changePaintControlShininess(@NotNull final Float newValue) {
if (isIgnoreListeners()) return;
final TerrainQuad processedObject = getProcessedObject();
final Material mat = processedObject.getMaterial();
final MatParam param = mat.getParam("Shininess");
final float shininess = param == null ? 0F : (float) param.getValue();
final PropertyOperation<ChangeConsumer, TerrainQuad, Float> operation =
new PropertyOperation<>(processedObject, TERRAIN_PARAM, newValue, shininess);
operation.setApplyHandler((terrainQuad, value) -> {
NodeUtils.visitGeometry(terrainQuad, geometry -> {
final Material material = geometry.getMaterial();
material.setFloat("Shininess", value);
});
});
final ModelChangeConsumer changeConsumer = getChangeConsumer();
changeConsumer.execute(operation);
}
示例7: getAlphaTexture
import com.jme3.material.MatParam; //导入方法依赖的package包/类
private Texture getAlphaTexture(Terrain terrain, int alphaLayer) {
if (terrain == null)
return null;
MatParam matParam = null;
if (alphaLayer == 0)
matParam = terrain.getMaterial(null).getParam("AlphaMap");
else if(alphaLayer == 1)
matParam = terrain.getMaterial(null).getParam("AlphaMap_1");
else if(alphaLayer == 2)
matParam = terrain.getMaterial(null).getParam("AlphaMap_2");
if (matParam == null || matParam.getValue() == null) {
return null;
}
Texture tex = (Texture) matParam.getValue();
return tex;
}
示例8: doGetAlphaTexture
import com.jme3.material.MatParam; //导入方法依赖的package包/类
public final static Texture doGetAlphaTexture(Terrain terrain, int alphaLayer) {
if (terrain == null)
return null;
MatParam matParam = null;
if (alphaLayer == 0)
matParam = terrain.getMaterial().getParam("AlphaMap");
else if(alphaLayer == 1)
matParam = terrain.getMaterial().getParam("AlphaMap_1");
else if(alphaLayer == 2)
matParam = terrain.getMaterial().getParam("AlphaMap_2");
if (matParam == null || matParam.getValue() == null) {
return null;
}
Texture tex = (Texture) matParam.getValue();
return tex;
}
示例9: getDiffuseTexture
import com.jme3.material.MatParam; //导入方法依赖的package包/类
public final static Texture getDiffuseTexture(Terrain terrain, int layer) {
if (terrain == null)
return null;
MatParam matParam;
if (layer == 0)
matParam = terrain.getMaterial().getParam("DiffuseMap");
else
matParam = terrain.getMaterial().getParam("DiffuseMap_"+ layer);
if (matParam == null || matParam.getValue() == null) {
return null;
}
Texture tex = (Texture) matParam.getValue();
return tex;
}
示例10: controlRenderHardware
import com.jme3.material.MatParam; //导入方法依赖的package包/类
private void controlRenderHardware() {
offsetMatrices = skeleton.computeSkinningMatrices();
for (Material m : materials) {
MatParam currentParam = m.getParam("BoneMatrices");
if (currentParam != null) {
if (currentParam.getValue() != offsetMatrices) {
// Check to see if other SkeletonControl
// is operating on this material, in that case, user
// is sharing materials between models which is NOT allowed
// when hardware skinning used.
// throw new UnsupportedOperationException(
// "Material instances cannot be shared when hardware skinning is used. " +
// "Ensure all models use unique material instances : " + m.getName()
// );
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Material instances cannot be shared when hardware skinning is used. " +
"Ensure all models use unique material instances : " + m.getName());
}
}
m.setParam("BoneMatrices", VarType.Matrix4Array, offsetMatrices);
}
}
示例11: doGetDiffuseTexture
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Get the diffuse texture at the specified layer.
* Run this on the GL thread!
*/
private Texture doGetDiffuseTexture(int layer) {
Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null)
return null;
MatParam matParam = null;
if (layer == 0)
matParam = terrain.getMaterial().getParam("DiffuseMap");
else
matParam = terrain.getMaterial().getParam("DiffuseMap_"+layer);
if (matParam == null || matParam.getValue() == null) {
return null;
}
Texture tex = (Texture) matParam.getValue();
return tex;
}
示例12: doGetAlphaTexture
import com.jme3.material.MatParam; //导入方法依赖的package包/类
private Texture doGetAlphaTexture(Terrain terrain, int alphaLayer) {
if (terrain == null)
return null;
MatParam matParam = null;
if (alphaLayer == 0)
matParam = terrain.getMaterial().getParam("AlphaMap");
else if(alphaLayer == 1)
matParam = terrain.getMaterial().getParam("AlphaMap_1");
else if(alphaLayer == 2)
matParam = terrain.getMaterial().getParam("AlphaMap_2");
if (matParam == null || matParam.getValue() == null) {
return null;
}
Texture tex = (Texture) matParam.getValue();
return tex;
}
示例13: doGetNormalMap
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Get the normal map texture at the specified layer.
* Run this on the GL thread!
*/
private Texture doGetNormalMap(int layer) {
Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null)
return null;
MatParam matParam = null;
if (layer == 0)
matParam = terrain.getMaterial().getParam("NormalMap");
else
matParam = terrain.getMaterial().getParam("NormalMap_"+layer);
if (matParam == null || matParam.getValue() == null) {
return null;
}
Texture tex = (Texture) matParam.getValue();
return tex;
}
示例14: getAlphaTexture
import com.jme3.material.MatParam; //导入方法依赖的package包/类
private Texture getAlphaTexture(Terrain terrain, int alphaLayer) {
if (terrain == null)
return null;
MatParam matParam = null;
if (alphaLayer == 0)
matParam = terrain.getMaterial().getParam("AlphaMap");
else if(alphaLayer == 1)
matParam = terrain.getMaterial().getParam("AlphaMap_1");
else if(alphaLayer == 2)
matParam = terrain.getMaterial().getParam("AlphaMap_2");
if (matParam == null || matParam.getValue() == null) {
return null;
}
Texture tex = (Texture) matParam.getValue();
return tex;
}
示例15: getTextureScale
import com.jme3.material.MatParam; //导入方法依赖的package包/类
/**
* Get a texture scale of the level.
*
* @param layer the layer.
* @return the texture scale or -1.
*/
@FromAnyThread
public float getTextureScale(final int layer) {
final Function<Integer, String> layerToScaleName = getLayerToScaleName();
if (layerToScaleName == null) return -1F;
final Terrain terrain = getTerrain();
final Material material = terrain.getMaterial();
final MatParam matParam = material.getParam(layerToScaleName.apply(layer));
return matParam == null ? -1F : (float) matParam.getValue();
}