com.jme3.scene.Geometry.setCullHint()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中com.jme3.scene.Geometry.setCullHint()方法的一些代码示例,展示了Geometry.setCullHint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.setCullHint()方法的具体详情如下:
包路径:com.jme3.scene.Geometry
类名称:Geometry
方法名:setCullHint

Geometry.setCullHint介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void setDisplayFps(boolean show) {
  showFps = show;
  if (fpsText != null) {
    fpsText.setCullHint(show ? CullHint.Never : CullHint.Always);
    if (darkenFps != null) {
      darkenFps.setCullHint(showFps && darkenBehind ? CullHint.Never : CullHint.Always);
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void setDisplayStatView(boolean show) {
  showStats = show;
  if (statsView != null ) {
    statsView.setEnabled(show);
    statsView.setCullHint(show ? CullHint.Never : CullHint.Always);
    if (darkenStats != null) {
      darkenStats.setCullHint(showStats && darkenBehind ? CullHint.Never : CullHint.Always);
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void setEnabled(boolean enabled) {
  super.setEnabled(enabled);
  if (enabled) {
    fpsText.setCullHint(showFps ? CullHint.Never : CullHint.Always);
    darkenFps.setCullHint(showFps && darkenBehind ? CullHint.Never : CullHint.Always);
    statsView.setEnabled(showStats);
    statsView.setCullHint(showStats ? CullHint.Never : CullHint.Always);
    darkenStats.setCullHint(showStats && darkenBehind ? CullHint.Never : CullHint.Always);
  } else {
    fpsText.setCullHint(CullHint.Always);
    darkenFps.setCullHint(CullHint.Always);
    statsView.setEnabled(false);
    statsView.setCullHint(CullHint.Always);
    darkenStats.setCullHint(CullHint.Always);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
  public void visit(Geometry g) {
    Mesh m = g.getMesh();
    Geometry debug = new Geometry(
        "debug tangents geom",
        TangentBinormalGenerator.genNormalLines(m, 0.1f)
    );
    debug.setMaterial(debugMat);
    debug.setCullHint(Spatial.CullHint.Never);
    debug.setLocalTransform(g.getWorldTransform());
    debugTangents.attachChild(debug);
  }
});

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private void createDebugTangents(Geometry geom) {
    Geometry debug = new Geometry(
        "Debug " + geom.getName(),
        TangentBinormalGenerator.genTbnLines(geom.getMesh(), 0.8f)
    );
    Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m");
    debug.setMaterial(debugMat);
    debug.setCullHint(Spatial.CullHint.Never);
    debug.getLocalTranslation().set(geom.getWorldTranslation());
    debugNode.attachChild(debug);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void loadDarken() {
  Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setColor("Color", new ColorRGBA(0,0,0,0.5f));
  mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
  darkenFps = new Geometry("StatsDarken", new Quad(200, fpsText.getLineHeight()));
  darkenFps.setMaterial(mat);
  darkenFps.setLocalTranslation(0, 0, -1);
  darkenFps.setCullHint(showFps && darkenBehind ? CullHint.Never : CullHint.Always);
  guiNode.attachChild(darkenFps);
  darkenStats = new Geometry("StatsDarken", new Quad(200, statsView.getHeight()));
  darkenStats.setMaterial(mat);
  darkenStats.setLocalTranslation(0, fpsText.getHeight(), -1);
  darkenStats.setCullHint(showStats && darkenBehind ? CullHint.Never : CullHint.Always);
  guiNode.attachChild(darkenStats);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void generateDebugTangents(Material mat) {
  for (int x = children.size(); --x >= 0;) {
    Spatial child = children.get(x);
    if (child instanceof TerrainQuad) {
      ((TerrainQuad)child).generateDebugTangents(mat);
    } else if (child instanceof TerrainPatch) {
      Geometry debug = new Geometry( "Debug " + name,
        TangentBinormalGenerator.genTbnLines( ((TerrainPatch)child).getMesh(), 0.8f));
      attachChild(debug);
      debug.setLocalTranslation(child.getLocalTranslation());
      debug.setCullHint(CullHint.Never);
      debug.setMaterial(mat);
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
      public void visit(Geometry g){
        Mesh m = g.getMesh();
        Material mat = g.getMaterial();
        
//                if (mat.getParam("DiffuseMap") != null){
//                    mat.setTexture("DiffuseMap", null);
//                }
        TangentBinormalGenerator.generate(m);
        
        Geometry debug = new Geometry(
          "debug tangents geom",
          TangentBinormalGenerator.genTbnLines(g.getMesh(), 0.2f)
        );
        debug.setMaterial(debugMat);
        debug.setCullHint(Spatial.CullHint.Never);
        debug.setLocalTransform(g.getWorldTransform());
        debugTangents.attachChild(debug);
      }
    });

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private void addMesh(String name, Mesh mesh, Vector3f translation) {
  TangentBinormalGenerator.generate(mesh);
  Geometry testGeom = new Geometry(name, mesh);
  Material mat = assetManager.loadMaterial("Textures/BumpMapTest/Tangent.j3m");
  testGeom.setMaterial(mat);
  testGeom.getLocalTranslation().set(translation);
  rootNode.attachChild(testGeom);
  Geometry debug = new Geometry(
      "Debug " + name,
      TangentBinormalGenerator.genTbnLines(mesh, 0.08f)
  );
  Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m");
  debug.setMaterial(debugMat);
  debug.setCullHint(Spatial.CullHint.Never);
  debug.getLocalTranslation().set(translation);
  rootNode.attachChild(debug);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

sky.setCullHint(Spatial.CullHint.Never);
sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private Geometry createFrustum(Vector3f[] pts, int i) {
  WireFrustum frustum = new WireFrustum(pts);
  Geometry frustumMdl = new Geometry("f", frustum);
  frustumMdl.setCullHint(Spatial.CullHint.Never);
  frustumMdl.setShadowMode(ShadowMode.Off);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat.getAdditionalRenderState().setWireframe(true);
  frustumMdl.setMaterial(mat);
  switch (i) {
    case 0:
      frustumMdl.getMaterial().setColor("Color", ColorRGBA.Pink);
      break;
    case 1:
      frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red);
      break;
    case 2:
      frustumMdl.getMaterial().setColor("Color", ColorRGBA.Green);
      break;
    case 3:
      frustumMdl.getMaterial().setColor("Color", ColorRGBA.Blue);
      break;
    default:
      frustumMdl.getMaterial().setColor("Color", ColorRGBA.White);
      break;
  }
  frustumMdl.updateGeometricState();
  return frustumMdl;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

WireFrustum frustum = new WireFrustum(pts);
Geometry frustumMdl = new Geometry("f", frustum);
frustumMdl.setCullHint(Spatial.CullHint.Never);
frustumMdl.setShadowMode(ShadowMode.Off);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

WireFrustum frustum = new WireFrustum(pts);
Geometry frustumMdl = new Geometry("f", frustum);
frustumMdl.setCullHint(Spatial.CullHint.Never);
frustumMdl.setShadowMode(ShadowMode.Off);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m");
debug.setMaterial(debugMat);
debug.setCullHint(Spatial.CullHint.Never);
debug.getLocalTranslation().set(teapot.getLocalTranslation());
debug.getLocalScale().set(teapot.getLocalScale());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

frustum = new WireFrustum(points);
frustumMdl = new Geometry("f", frustum);
frustumMdl.setCullHint(Spatial.CullHint.Never);
frustumMdl.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
frustumMdl.getMaterial().getAdditionalRenderState().setWireframe(true);

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * Batch this geometry, should only be called by the BatchNode.
 * @param node the batchNode
 * @param startIndex the starting index of this geometry in the batched mesh
 */
protected void batch(BatchNode node, int startIndex) {
  this.batchNode = node;
  this.startIndex = startIndex;       
  setCullHint(CullHint.Always);
}

代码示例来源:origin: jMonkeyEngine-Contributions/Lemur

protected void resetCursorState() {
  if( isAttached() && focused && cursorVisible ) {
    cursor.setCullHint(CullHint.Inherit);
  } else {
    cursor.setCullHint(CullHint.Always);
  }
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * unBatch this geometry. 
 */
protected void unBatch() {
  this.startIndex = 0;
  //once the geometry is removed from the screnegraph the batchNode needs to be rebatched.
  if (batchNode != null) {
    this.batchNode.setNeedsFullRebatch(true);
    this.batchNode = null;
  }
  setCullHint(CullHint.Dynamic);
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

public void setDisplayFps(boolean show) {
  showFps = show;
  if (fpsText != null) {
    fpsText.setCullHint(show ? CullHint.Never : CullHint.Always);
    if (darkenFps != null) {
      darkenFps.setCullHint(showFps && darkenBehind ? CullHint.Never : CullHint.Always);
    }
  }
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

public void setDisplayStatView(boolean show) {
  showStats = show;
  if (statsView != null ) {
    statsView.setEnabled(show);
    statsView.setCullHint(show ? CullHint.Never : CullHint.Always);
    if (darkenStats != null) {
      darkenStats.setCullHint(showStats && darkenBehind ? CullHint.Never : CullHint.Always);
    }
  }
}

相关文章