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

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

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

Mesh.computeNumElements介绍

暂无

代码示例

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

/**
 * Returns the triangle count for the given LOD level.
 *
 * @param lod The lod level to look up
 * @return The triangle count for that LOD level
 */
public int getTriangleCount(int lod){
  if (lodLevels != null){
    if (lod < 0) {
      throw new IllegalArgumentException("LOD level cannot be < 0");
    }
    if (lod >= lodLevels.length) {
      throw new IllegalArgumentException("LOD level " + lod + " does not exist!");
    }
    return computeNumElements(lodLevels[lod].getData().limit());
  }else if (lod == 0){
    return elementCount;
  }else{
    throw new IllegalArgumentException("There are no LOD levels on the mesh!");
  }
}

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

/**
 * Update the {@link #getVertexCount() vertex} and
 * {@link #getTriangleCount() triangle} counts for this mesh
 * based on the current data. This method should be called
 * after the {@link Buffer#capacity() capacities} of the mesh's
 * {@link VertexBuffer vertex buffers} has been altered.
 *
 * @throws IllegalStateException If this mesh is in
 * {@link #setInterleaved() interleaved} format.
 */
public void updateCounts(){
  if (getBuffer(Type.InterleavedData) != null) {
    throw new IllegalStateException("Should update counts before interleave");
  }
  VertexBuffer pb = getBuffer(Type.Position);
  VertexBuffer ib = getBuffer(Type.Index);
  if (pb != null){
    vertCount = pb.getData().limit() / pb.getNumComponents();
  }
  if (ib != null){
    elementCount = computeNumElements(ib.getData().limit());
  }else{
    elementCount = computeNumElements(vertCount);
  }
  instanceCount = computeInstanceCount();
}

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

/**
 * Returns the triangle count for the given LOD level.
 *
 * @param lod The lod level to look up
 * @return The triangle count for that LOD level
 */
public int getTriangleCount(int lod){
  if (lodLevels != null){
    if (lod < 0)
      throw new IllegalArgumentException("LOD level cannot be < 0");
    if (lod >= lodLevels.length)
      throw new IllegalArgumentException("LOD level "+lod+" does not exist!");
    return computeNumElements(lodLevels[lod].getData().limit());
  }else if (lod == 0){
    return elementCount;
  }else{
    throw new IllegalArgumentException("There are no LOD levels on the mesh!");
  }
}

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

/**
 * Returns the triangle count for the given LOD level.
 * 
 * @param lod The lod level to look up
 * @return The triangle count for that LOD level
 */
public int getTriangleCount(int lod){
  if (lodLevels != null){
    if (lod < 0)
      throw new IllegalArgumentException("LOD level cannot be < 0");
    if (lod >= lodLevels.length)
      throw new IllegalArgumentException("LOD level "+lod+" does not exist!");
    return computeNumElements(lodLevels[lod].getData().limit());
  }else if (lod == 0){
    return elementCount;
  }else{
    throw new IllegalArgumentException("There are no LOD levels on the mesh!");
  }
}

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

/**
 * Update the {@link #getVertexCount() vertex} and
 * {@link #getTriangleCount() triangle} counts for this mesh
 * based on the current data. This method should be called
 * after the {@link Buffer#capacity() capacities} of the mesh's
 * {@link VertexBuffer vertex buffers} has been altered.
 *
 * @throws IllegalStateException If this mesh is in
 * {@link #setInterleaved() interleaved} format.
 */
public void updateCounts(){
  if (getBuffer(Type.InterleavedData) != null)
    throw new IllegalStateException("Should update counts before interleave");
  VertexBuffer pb = getBuffer(Type.Position);
  VertexBuffer ib = getBuffer(Type.Index);
  if (pb != null){
    vertCount = pb.getData().limit() / pb.getNumComponents();
  }
  if (ib != null){
    elementCount = computeNumElements(ib.getData().limit());
  }else{
    elementCount = computeNumElements(vertCount);
  }
  instanceCount = computeInstanceCount();
}

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

/**
   * Update the {@link #getVertexCount() vertex} and 
   * {@link #getTriangleCount() triangle} counts for this mesh
   * based on the current data. This method should be called
   * after the {@link Buffer#capacity() capacities} of the mesh's
   * {@link VertexBuffer vertex buffers} has been altered.
   * 
   * @throws IllegalStateException If this mesh is in 
   * {@link #setInterleaved() interleaved} format.
   */
  public void updateCounts(){
//        if (getBuffer(Type.InterleavedData) != null)
//            throw new IllegalStateException("Should update counts before interleave");
    VertexBuffer pb = getBuffer(Type.Position);
    VertexBuffer ib = getBuffer(Type.Index);
    if (pb != null && pb.getData() != null){
      vertCount = pb.getData().capacity() / pb.getNumComponents();
    }
    if (ib != null){
      elementCount = computeNumElements(ib.getData().limit());
    }else{
      elementCount = computeNumElements(vertCount);
    }
  }

相关文章