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

x33g5p2x  于2022-01-25 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(85)

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

Mesh.getNumLodLevels介绍

暂无

代码示例

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

/**
 * Sets the LOD level to use when rendering the mesh of this geometry.
 * Level 0 indicates that the default index buffer should be used,
 * levels [1, LodLevels + 1] represent the levels set on the mesh
 * with {@link Mesh#setLodLevels(com.jme3.scene.VertexBuffer[]) }.
 *
 * @param lod The lod level to set
 */
@Override
public void setLodLevel(int lod) {
  if (mesh.getNumLodLevels() == 0) {
    throw new IllegalStateException("LOD levels are not set on this mesh");
  }
  if (lod < 0 || lod >= mesh.getNumLodLevels()) {
    throw new IllegalArgumentException("LOD level is out of range: " + lod);
  }
  lodLevel = lod;
  if (isGrouped()) {
    groupNode.onMeshChange(this);
  }
}

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

@Override
public void setSpatial(Spatial spatial) {
  if (spatial != null && !(spatial instanceof Geometry)) {
    throw new IllegalArgumentException("LodControl can only be attached to Geometry!");
  }
  super.setSpatial(spatial);
  
  if(spatial != null) {
    Geometry geom = (Geometry) spatial;
    Mesh mesh = geom.getMesh();
    numLevels = mesh.getNumLodLevels();
    numTris = new int[numLevels];
    for (int i = numLevels - 1; i >= 0; i--) {
      numTris[i] = mesh.getTriangleCount(i);
    }
  } else {
    numLevels = 0;
    numTris = null;
  }
}

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

private int computeNbTri() {
  int nbTri = 0;
  for (Geometry geometry : listGeoms) {
    if (geometry.getMesh().getNumLodLevels() > 0) {
      nbTri += geometry.getMesh().getLodLevel(lodLevel).getNumElements();
    } else {
      nbTri += geometry.getMesh().getTriangleCount();
    }
  }
  return nbTri;
}

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

lodLevels = Math.min(lodLevels, g.getMesh().getNumLodLevels());
for (Geometry g : geometries) {
  if (lodLevels == 0) {
    lodLevels = g.getMesh().getNumLodLevels();

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

private void renderMeshVertexArray(Mesh mesh, int lod, int count, VertexBuffer instanceData) {
    if (mesh.getId() == -1) {
      updateVertexArray(mesh, instanceData);
    } else {
      // TODO: Check if it was updated
    }

    if (context.boundVertexArray != mesh.getId()) {
      gl3.glBindVertexArray(mesh.getId());
      context.boundVertexArray = mesh.getId();
    }

//        IntMap<VertexBuffer> buffers = mesh.getBuffers();
    VertexBuffer indices;
    if (mesh.getNumLodLevels() > 0) {
      indices = mesh.getLodLevel(lod);
    } else {
      indices = mesh.getBuffer(Type.Index);
    }
    if (indices != null) {
      drawTriangleList(indices, mesh, count);
    } else {
      drawTriangleArray(mesh.getMode(), count, mesh.getVertexCount());
    }
    clearVertexAttribs();
  }

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

if (mesh.getNumLodLevels() > 0) {
  indices = mesh.getLodLevel(lod);
} else {

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

totalVerts += geom.getVertexCount();
totalTris += geom.getTriangleCount();
totalLodLevels = Math.min(totalLodLevels, geom.getMesh().getNumLodLevels());
if (maxVertCount < geom.getVertexCount()) {
  maxVertCount = geom.getVertexCount();

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

totalVerts += geom.getVertexCount();
totalTris += geom.getTriangleCount();
totalLodLevels = Math.min(totalLodLevels, geom.getMesh().getNumLodLevels());

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

/**
 * Sets the LOD level to use when rendering the mesh of this geometry.
 * Level 0 indicates that the default index buffer should be used,
 * levels [1, LodLevels + 1] represent the levels set on the mesh
 * with {@link Mesh#setLodLevels(com.jme3.scene.VertexBuffer[]) }.
 * 
 * @param lod The lod level to set
 */
@Override
public void setLodLevel(int lod) {
  if (mesh.getNumLodLevels() == 0) {
    throw new IllegalStateException("LOD levels are not set on this mesh");
  }
  if (lod < 0 || lod >= mesh.getNumLodLevels()) {
    throw new IllegalArgumentException("LOD level is out of range: " + lod);
  }
  lodLevel = lod;
}

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

/**
 * Sets the LOD level to use when rendering the mesh of this geometry.
 * Level 0 indicates that the default index buffer should be used,
 * levels [1, LodLevels + 1] represent the levels set on the mesh
 * with {@link Mesh#setLodLevels(com.jme3.scene.VertexBuffer[]) }.
 *
 * @param lod The lod level to set
 */
@Override
public void setLodLevel(int lod) {
  if (mesh.getNumLodLevels() == 0) {
    throw new IllegalStateException("LOD levels are not set on this mesh");
  }
  if (lod < 0 || lod >= mesh.getNumLodLevels()) {
    throw new IllegalArgumentException("LOD level is out of range: " + lod);
  }
  lodLevel = lod;
  if (isGrouped()) {
    groupNode.onMeshChange(this);
  }
}

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

@Override
public void setSpatial(Spatial spatial){
  if (!(spatial instanceof Geometry))
    throw new IllegalArgumentException("LodControl can only be attached to Geometry!");
  super.setSpatial(spatial);
  Geometry geom = (Geometry) spatial;
  Mesh mesh = geom.getMesh();
  numLevels = mesh.getNumLodLevels();
  numTris = new int[numLevels];
  for (int i = numLevels - 1; i >= 0; i--)
    numTris[i] = mesh.getTriangleCount(i);
}

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

@Override
public void setSpatial(Spatial spatial) {
  if (spatial != null && !(spatial instanceof Geometry)) {
    throw new IllegalArgumentException("LodControl can only be attached to Geometry!");
  }
  super.setSpatial(spatial);
  
  if(spatial != null) {
    Geometry geom = (Geometry) spatial;
    Mesh mesh = geom.getMesh();
    numLevels = mesh.getNumLodLevels();
    numTris = new int[numLevels];
    for (int i = numLevels - 1; i >= 0; i--) {
      numTris[i] = mesh.getTriangleCount(i);
    }
  } else {
    numLevels = 0;
    numTris = null;
  }
}

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

lodLevels = Math.min(lodLevels, g.getMesh().getNumLodLevels());
for (Geometry g : geometries) {
  if (lodLevels == 0) {
    lodLevels = g.getMesh().getNumLodLevels();

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

for (Geometry g : geometries) {
  if (lodLevels == 0) {
    lodLevels = g.getMesh().getNumLodLevels();

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

private void renderMeshVertexArray(Mesh mesh, int lod, int count, VertexBuffer instanceData) {
    if (mesh.getId() == -1) {
      updateVertexArray(mesh, instanceData);
    } else {
      // TODO: Check if it was updated
    }

    if (context.boundVertexArray != mesh.getId()) {
      gl3.glBindVertexArray(mesh.getId());
      context.boundVertexArray = mesh.getId();
    }

//        IntMap<VertexBuffer> buffers = mesh.getBuffers();
    VertexBuffer indices;
    if (mesh.getNumLodLevels() > 0) {
      indices = mesh.getLodLevel(lod);
    } else {
      indices = mesh.getBuffer(Type.Index);
    }
    if (indices != null) {
      drawTriangleList(indices, mesh, count);
    } else {
      drawTriangleArray(mesh.getMode(), count, mesh.getVertexCount());
    }
    clearVertexAttribs();
  }

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

private void renderMeshVertexArray(Mesh mesh, int lod, int count, VertexBuffer instanceData) {
    if (mesh.getId() == -1) {
      updateVertexArray(mesh, instanceData);
    } else {
      // TODO: Check if it was updated
    }

    if (context.boundVertexArray != mesh.getId()) {
      glBindVertexArray(mesh.getId());
      context.boundVertexArray = mesh.getId();
    }

//        IntMap<VertexBuffer> buffers = mesh.getBuffers();
    VertexBuffer indices;
    if (mesh.getNumLodLevels() > 0) {
      indices = mesh.getLodLevel(lod);
    } else {
      indices = mesh.getBuffer(Type.Index);
    }
    if (indices != null) {
      drawTriangleList(indices, mesh, count);
    } else {
      drawTriangleArray(mesh.getMode(), count, mesh.getVertexCount());
    }
    clearVertexAttribs();
    clearTextureUnits();
  }

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

if (mesh.getNumLodLevels() > 0) {
  indices = mesh.getLodLevel(lod);
} else {

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

if (mesh.getNumLodLevels() > 0) {
  indices = mesh.getLodLevel(lod);
} else {

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

totalVerts += geom.getVertexCount();
totalTris += geom.getTriangleCount();
totalLodLevels = Math.min(totalLodLevels, geom.getMesh().getNumLodLevels());

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

totalVerts += geom.getVertexCount();
totalTris += geom.getTriangleCount();
totalLodLevels = Math.min(totalLodLevels, geom.getMesh().getNumLodLevels());

相关文章