本文整理了Java中com.jme3.scene.Spatial.setLodLevel()
方法的一些代码示例,展示了Spatial.setLodLevel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.setLodLevel()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:setLodLevel
[英]Sets the level of detail to use when rendering this Spatial, this call propagates to all geometries under this Spatial.
[中]设置渲染此空间时要使用的详细级别,此调用将传播到此空间下的所有几何体。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void setLodLevel(int lod){
super.setLodLevel(lod);
for (Spatial child : children.getArray()) {
child.setLodLevel(lod);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void controlRender(RenderManager rm, ViewPort vp) {
BoundingVolume bv = spatial.getWorldBound();
Camera cam = vp.getCamera();
float atanNH = FastMath.atan(cam.getFrustumNear() * cam.getFrustumTop());
float ratio = (FastMath.PI / (8f * atanNH));
float newDistance = bv.distanceTo(vp.getCamera().getLocation()) / ratio;
int level;
if (Math.abs(newDistance - lastDistance) <= distTolerance) {
level = lastLevel; // we haven't moved relative to the model, send the old measurement back.
} else if (lastDistance > newDistance && lastLevel == 0) {
level = lastLevel; // we're already at the lowest setting and we just got closer to the model, no need to keep trying.
} else if (lastDistance < newDistance && lastLevel == numLevels - 1) {
level = lastLevel; // we're already at the highest setting and we just got further from the model, no need to keep trying.
} else {
lastDistance = newDistance;
// estimate area of polygon via bounding volume
float area = AreaUtils.calcScreenArea(bv, lastDistance, cam.getWidth());
float trisToDraw = area * trisPerPixel;
level = numLevels - 1;
for (int i = numLevels; --i >= 0;) {
if (trisToDraw - numTris[i] < 0) {
break;
}
level = i;
}
lastLevel = level;
}
spatial.setLodLevel(level);
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
@Override
public void setLodLevel(int lod){
super.setLodLevel(lod);
for (Spatial child : children.getArray()) {
child.setLodLevel(lod);
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
@Override
public void setLodLevel(int lod){
super.setLodLevel(lod);
for (Spatial child : children.getArray()) {
child.setLodLevel(lod);
}
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
protected void controlRender(RenderManager rm, ViewPort vp) {
BoundingVolume bv = spatial.getWorldBound();
Camera cam = vp.getCamera();
float atanNH = FastMath.atan(cam.getFrustumNear() * cam.getFrustumTop());
float ratio = (FastMath.PI / (8f * atanNH));
float newDistance = bv.distanceTo(vp.getCamera().getLocation()) / ratio;
int level;
if (Math.abs(newDistance - lastDistance) <= distTolerance) {
level = lastLevel; // we haven't moved relative to the model, send the old measurement back.
} else if (lastDistance > newDistance && lastLevel == 0) {
level = lastLevel; // we're already at the lowest setting and we just got closer to the model, no need to keep trying.
} else if (lastDistance < newDistance && lastLevel == numLevels - 1) {
level = lastLevel; // we're already at the highest setting and we just got further from the model, no need to keep trying.
} else {
lastDistance = newDistance;
// estimate area of polygon via bounding volume
float area = AreaUtils.calcScreenArea(bv, lastDistance, cam.getWidth());
float trisToDraw = area * trisPerPixel;
level = numLevels - 1;
for (int i = numLevels; --i >= 0;) {
if (trisToDraw - numTris[i] < 0) {
break;
}
level = i;
}
lastLevel = level;
}
spatial.setLodLevel(level);
}
代码示例来源:origin: info.projectkyoto/mms-engine
protected void controlRender(RenderManager rm, ViewPort vp){
BoundingVolume bv = spatial.getWorldBound();
Camera cam = vp.getCamera();
float atanNH = FastMath.atan(cam.getFrustumNear() * cam.getFrustumTop());
float ratio = (FastMath.PI / (8f * atanNH));
float newDistance = bv.distanceTo(vp.getCamera().getLocation()) / ratio;
int level;
if (Math.abs(newDistance - lastDistance) <= distTolerance)
level = lastLevel; // we haven't moved relative to the model, send the old measurement back.
else if (lastDistance > newDistance && lastLevel == 0)
level = lastLevel; // we're already at the lowest setting and we just got closer to the model, no need to keep trying.
else if (lastDistance < newDistance && lastLevel == numLevels - 1)
level = lastLevel; // we're already at the highest setting and we just got further from the model, no need to keep trying.
else{
lastDistance = newDistance;
// estimate area of polygon via bounding volume
float area = AreaUtils.calcScreenArea(bv, lastDistance, cam.getWidth());
float trisToDraw = area * trisPerPixel;
level = numLevels - 1;
for (int i = numLevels; --i >= 0;){
if (trisToDraw - numTris[i] < 0){
break;
}
level = i;
}
lastLevel = level;
}
spatial.setLodLevel(level);
}
内容来源于网络,如有侵权,请联系作者删除!