本文整理了Java中com.jme3.material.RenderState.setPolyOffset
方法的一些代码示例,展示了RenderState.setPolyOffset
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RenderState.setPolyOffset
方法的具体详情如下:
包路径:com.jme3.material.RenderState
类名称:RenderState
方法名:setPolyOffset
[英]Offsets the on-screen z-order of the material's polygons, to combat visual artefacts like stitching, bleeding and z-fighting for overlapping polygons. Factor and units are summed to produce the depth offset. This offset is applied in screen space, typically with positive Z pointing into the screen. Typical values are (1.0f, 1.0f) or (-1.0f, -1.0f)
[中]偏移材质多边形在屏幕上的z顺序,以对抗重叠多边形的缝合、出血和z战斗等视觉伪影。将因子和单位相加以生成深度偏移。该偏移量应用于屏幕空间,通常正Z指向屏幕。典型值为(1.0f,1.0f)或(-1.0f,-1.0f)
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Set to true if you want back faces shadows on geometries.
* Note that back faces shadows will be blended over dark lighten areas and may produce overly dark lighting.
*
* Also note that setting this parameter will override this parameter for ALL materials in the scene.
* You can alternatively change this parameter on a single material using {@link Material#setBoolean(String, boolean)}
*
* This also will automatically adjust the faceCullMode and the PolyOffset of the pre shadow pass.
* You can modify them by using {@link #getPreShadowForcedRenderState()}
*
* @param renderBackFacesShadows true or false.
*/
public void setRenderBackFacesShadows(Boolean renderBackFacesShadows) {
this.renderBackFacesShadows = renderBackFacesShadows;
if(renderBackFacesShadows) {
getPreShadowForcedRenderState().setPolyOffset(5, 3);
getPreShadowForcedRenderState().setFaceCullMode(RenderState.FaceCullMode.Back);
}else{
getPreShadowForcedRenderState().setPolyOffset(0, 0);
getPreShadowForcedRenderState().setFaceCullMode(RenderState.FaceCullMode.Front);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Set to true if you want back faces shadows on geometries.
* Note that back faces shadows will be blended over dark lighten areas and may produce overly dark lighting.
*
* Also note that setting this parameter will override this parameter for ALL materials in the scene.
* You can alternatively change this parameter on a single material using {@link Material#setBoolean(String, boolean)}
*
* This also will automatically adjust the faceCullMode and the PolyOffset of the pre shadow pass.
* You can modify them by using {@link #getPreShadowForcedRenderState()}
*
* @param renderBackFacesShadows true or false.
*/
public void setRenderBackFacesShadows(Boolean renderBackFacesShadows) {
this.renderBackFacesShadows = renderBackFacesShadows;
if(renderBackFacesShadows) {
getPreShadowForcedRenderState().setPolyOffset(5, 3);
getPreShadowForcedRenderState().setFaceCullMode(RenderState.FaceCullMode.Back);
}else{
getPreShadowForcedRenderState().setPolyOffset(0, 0);
getPreShadowForcedRenderState().setFaceCullMode(RenderState.FaceCullMode.Front);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
float factor = Float.parseFloat(split[1]);
float units = Float.parseFloat(split[2]);
renderState.setPolyOffset(factor, units);
}else if (split[0].equals("ColorWrite")){
renderState.setColorWrite(parseBoolean(split[1]));
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public PreDepthProcessor(AssetManager assetManager){
this.assetManager = assetManager;
preDepth = new Material(assetManager, "Common/MatDefs/Shadow/PreShadow.j3md");
preDepth.getAdditionalRenderState().setPolyOffset(0, 0);
preDepth.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back);
forcedRS = new RenderState();
forcedRS.setDepthTest(true);
forcedRS.setDepthWrite(false);
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* Set to true if you want back faces shadows on geometries.
* Note that back faces shadows will be blended over dark lighten areas and may produce overly dark lighting.
*
* Also note that setting this parameter will override this parameter for ALL materials in the scene.
* You can alternatively change this parameter on a single material using {@link Material#setBoolean(String, boolean)}
*
* This also will automatically adjust the faceCullMode and the PolyOffset of the pre shadow pass.
* You can modify them by using {@link #getPreShadowForcedRenderState()}
*
* @param renderBackFacesShadows true or false.
*/
public void setRenderBackFacesShadows(Boolean renderBackFacesShadows) {
this.renderBackFacesShadows = renderBackFacesShadows;
if(renderBackFacesShadows) {
getPreShadowForcedRenderState().setPolyOffset(5, 3);
getPreShadowForcedRenderState().setFaceCullMode(RenderState.FaceCullMode.Back);
}else{
getPreShadowForcedRenderState().setPolyOffset(0, 0);
getPreShadowForcedRenderState().setFaceCullMode(RenderState.FaceCullMode.Front);
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
private void readRenderStateStatement(String statement) throws IOException{
String[] split = statement.split(whitespacePattern);
if (split[0].equals("Wireframe")){
renderState.setWireframe(parseBoolean(split[1]));
}else if (split[0].equals("FaceCull")){
renderState.setFaceCullMode(FaceCullMode.valueOf(split[1]));
}else if (split[0].equals("DepthWrite")){
renderState.setDepthWrite(parseBoolean(split[1]));
}else if (split[0].equals("DepthTest")){
renderState.setDepthTest(parseBoolean(split[1]));
}else if (split[0].equals("Blend")){
renderState.setBlendMode(BlendMode.valueOf(split[1]));
}else if (split[0].equals("AlphaTestFalloff")){
renderState.setAlphaTest(true);
renderState.setAlphaFallOff(Float.parseFloat(split[1]));
}else if (split[0].equals("PolyOffset")){
float factor = Float.parseFloat(split[1]);
float units = Float.parseFloat(split[2]);
renderState.setPolyOffset(factor, units);
}else if (split[0].equals("ColorWrite")){
renderState.setColorWrite(parseBoolean(split[1]));
}else if (split[0].equals("PointSprite")){
renderState.setPointSprite(parseBoolean(split[1]));
}else{
throwIfNequal(null, split[0]);
}
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
float factor = Float.parseFloat(split[1]);
float units = Float.parseFloat(split[2]);
renderState.setPolyOffset(factor, units);
}else if (split[0].equals("ColorWrite")){
renderState.setColorWrite(parseBoolean(split[1]));
代码示例来源:origin: org.jmonkeyengine/jme3-core
public PreDepthProcessor(AssetManager assetManager){
this.assetManager = assetManager;
preDepth = new Material(assetManager, "Common/MatDefs/Shadow/PreShadow.j3md");
preDepth.getAdditionalRenderState().setPolyOffset(0, 0);
preDepth.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back);
forcedRS = new RenderState();
forcedRS.setDepthTest(true);
forcedRS.setDepthWrite(false);
}
代码示例来源:origin: info.projectkyoto/mms-engine
public PreDepthProcessor(AssetManager assetManager){
this.assetManager = assetManager;
preDepth = new Material(assetManager, "Common/MatDefs/Shadow/PreShadow.j3md");
preDepth.getAdditionalRenderState().setPolyOffset(0, 0);
preDepth.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back);
forcedRS = new RenderState();
forcedRS.setDepthTest(true);
forcedRS.setDepthWrite(false);
}
内容来源于网络,如有侵权,请联系作者删除!