当前位置: 首页>>代码示例>>Java>>正文


Java MatParam.getValue方法代码示例

本文整理汇总了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();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:TextureLayerSettings.java

示例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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:32,代码来源:TextureLayerSettings.java

示例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();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:TextureLayerSettings.java

示例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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:32,代码来源:TextureLayerSettings.java

示例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();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:TextureLayerSettings.java

示例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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:TerrainEditingComponent.java

示例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;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:18,代码来源:PaintTerrainToolAction.java

示例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;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:18,代码来源:TerrainUtils.java

示例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;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:18,代码来源:TerrainUtils.java

示例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);
        }
    }
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:22,代码来源:SkeletonControl_31.java

示例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;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:22,代码来源:TerrainEditorController.java

示例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;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:18,代码来源:TerrainEditorController.java

示例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;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:21,代码来源:TerrainEditorController.java

示例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;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:18,代码来源:PaintTerrainToolAction.java

示例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();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:18,代码来源:TextureLayerSettings.java


注:本文中的com.jme3.material.MatParam.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。