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

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

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

Mesh.updateCounts介绍

[英]Update the #getVertexCount() and #getTriangleCount() counts for this mesh based on the current data. This method should be called after the Buffer#capacity() of the mesh's VertexBuffer has been altered.
[中]基于当前数据更新此网格的#getVertexCount()和#GetTriangelCount()计数。此方法应在网格的VertexBuffer的缓冲区#capacity()更改后调用。

代码示例

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

/**
 * Change the Mesh's mode. By default the mode is {@link Mode#Triangles}.
 *
 * @param mode The new mode to set
 *
 * @see Mode
 */
public void setMode(Mode mode) {
  this.mode = mode;
  updateCounts();
}

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

/**
 * Unsets the {@link VertexBuffer} set on this mesh
 * with the given type. Does nothing if the vertex buffer type is not set
 * initially.
 *
 * @param type The buffer type to remove
 */
public void clearBuffer(VertexBuffer.Type type){
  VertexBuffer vb = buffers.remove(type.ordinal());
  if (vb != null){
    buffersList.remove(vb);
    updateCounts();
  }
}

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

makeLods(geomsForMat, mesh);
mesh.updateCounts();

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

m.updateCounts();

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

newMesh.setStatic();
  newMesh.updateBound();
  newMesh.updateCounts();
  Geometry geom = new Geometry();
  geom.setMesh(newMesh);
mesh.setStatic();
mesh.updateBound();
mesh.updateCounts();
Geometry geom = new Geometry();
geom.setMesh(mesh);

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

public static Mesh convert(IndexedMesh mesh) {
  Mesh jmeMesh = new Mesh();
  jmeMesh.setBuffer(Type.Index, 3, BufferUtils.createShortBuffer(mesh.numTriangles * 3));
  jmeMesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(mesh.numVertices * 3));
  IndexBuffer indicess = jmeMesh.getIndexBuffer();
  FloatBuffer vertices = jmeMesh.getFloatBuffer(Type.Position);
  for (int i = 0; i < mesh.numTriangles * 3; i++) {
    indicess.put(i, mesh.triangleIndexBase.getInt(i * 4));
  }
  for (int i = 0; i < mesh.numVertices * 3; i++) {
    vertices.put(i, mesh.vertexBase.getFloat(i * 4));
  }
  jmeMesh.updateCounts();
  jmeMesh.updateBound();
  jmeMesh.getFloatBuffer(Type.Position).clear();
  return jmeMesh;
}

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

mesh.updateCounts();

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

/**
 * Sets the {@link VertexBuffer} on the mesh.
 * This will update the vertex/triangle counts if needed.
 *
 * @param vb The buffer to set
 * @throws IllegalArgumentException If the buffer type is already set
 */
public void setBuffer(VertexBuffer vb){
  if (buffers.containsKey(vb.getBufferType().ordinal())) {
    throw new IllegalArgumentException("Buffer type already set: " + vb.getBufferType());
  }
  buffers.put(vb.getBufferType().ordinal(), vb);
  buffersList.add(vb);
  updateCounts();
}

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

jmeMesh.updateCounts();
jmeMesh.updateBound();

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

/**
 * Creates a {@link VertexBuffer} for the mesh or modifies
 * the existing one per the parameters given.
 *
 * @param type The type of the buffer
 * @param components Number of components
 * @param format Data format
 * @param buf The buffer data
 *
 * @throws UnsupportedOperationException If the buffer already set is
 * incompatible with the parameters given.
 */
public void setBuffer(Type type, int components, Format format, Buffer buf){
  VertexBuffer vb = buffers.get(type.ordinal());
  if (vb == null){
    vb = new VertexBuffer(type);
    vb.setupData(Usage.Dynamic, components, format, buf);
    setBuffer(vb);
  }else{
    if (vb.getNumComponents() != components || vb.getFormat() != format){
      throw new UnsupportedOperationException("The buffer already set "
          + "is incompatible with the given parameters");
    }
    vb.updateData(buf);
    updateCounts();
  }
}

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

batch.geometry.getMesh().updateCounts();
batch.geometry.updateModelBound();
batches.add(batch);

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

ib.updateData(sib);
m.updateCounts();

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

mesh.updateCounts();

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

GeometryBatchFactory.mergeGeometries(geometries, mesh);
applyAtlasCoords(geometries, mesh, atlas);
mesh.updateCounts();
mesh.updateBound();
geom.setMesh(mesh);

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

public void render() {
 renderState.setBlendMode(convertBlend(blendMode));
 vertexPosBuffer.flip();
 vertexPos.updateData(vertexPosBuffer);
 vertexTexCoordBuffer.flip();
 vertexTexCoord.updateData(vertexTexCoordBuffer);
 vertexColorBuffer.flip();
 vertexColor.updateData(vertexColorBuffer);
 indexBufferBuffer.flip();
 indexBuffer.updateData(indexBufferBuffer);
 tempMat.loadIdentity();
 renderManager.setWorldMatrix(tempMat);
 renderManager.setForcedRenderState(renderState);
 material.setTexture("ColorMap", texture);
 mesh.updateCounts();
 material.render(meshGeometry, renderManager);
 renderManager.setForcedRenderState(null);
}

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

updateCounts();
updateBound();

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

@Override
public void simpleInitApp() {
  Mesh mesh = new Mesh();
  mesh.setBuffer(VertexBuffer.Type.Index, 1, BufferUtils.createIntBuffer(new int[]{1}));
  mesh.setBuffer(VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer(new float[]{0, 0, 0}));
  mesh.setMode(Mesh.Mode.Points);
  mesh.setBound(new BoundingBox(new Vector3f(0, 0, 0), 10, 10, 10));
  mesh.updateCounts();
  Geometry geometry = new Geometry("Test", mesh);
  geometry.updateGeometricState();
  geometry.setMaterial(new Material(assetManager, "Materials/Geom/SimpleGeom.j3md"));
  //geometry.getMaterial().getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
  //geometry.setMaterial(assetManager.loadMaterial("Materials/Geom/SimpleTess.j3md"));
  rootNode.attachChild(geometry);
  Geometry geometry1 = new Geometry("T1", new Sphere(10, 10, 1));
  geometry1.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
  rootNode.attachChild(geometry1);
}

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

/**
 * Change the Mesh's mode. By default the mode is {@link Mode#Triangles}.
 * 
 * @param mode The new mode to set
 * 
 * @see Mode
 */
public void setMode(Mode mode) {
  this.mode = mode;
  updateCounts();
}

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

/**
 * Change the Mesh's mode. By default the mode is {@link Mode#Triangles}.
 *
 * @param mode The new mode to set
 *
 * @see Mode
 */
public void setMode(Mode mode) {
  this.mode = mode;
  updateCounts();
}

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

public List<BatchedGeometry> batch(List<Geometry> geom) {
  if (mesh != null) {
    geom.add(0, this);
  }
  Mesh m = new Mesh();
  List<BatchedGeometry> l = mergeGeometries(m, geom);
  mesh = m;
  mesh.updateCounts();
  mesh.updateBound();
  return l;
}

相关文章