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

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

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

Mesh.setStatic介绍

[英]Indicates to the GPU that this mesh will not be modified (a hint). Sets the usage mode to Usage#Staticfor all VertexBuffer on this Mesh.
[中]向GPU指示此网格不会被修改(提示)。将此网格上所有VertexBuffer的使用模式设置为“使用#静态”。

代码示例

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

/**
 * Locks the mesh (sets it static) to improve performance.
 * But it it not editable then. Set unlock to make it editable.
 */
public void lockMesh() {
  getMesh().setStatic();
}

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

m.setStatic();
m.updateBound();
m.updateCounts();

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

mesh.setStatic();

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

Mesh newMesh = mesh.clone();
  newMesh.setBuffer(VertexBuffer.Type.Index, 3, toArray(indexes.toArray(new Integer[indexes.size()])));
  newMesh.setStatic();
  newMesh.updateBound();
  newMesh.updateCounts();
mesh.setStatic();
mesh.updateBound();
mesh.updateCounts();

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

jmeMesh.setStatic();

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

public Mesh createMesh(Vector3f scale, Vector2f tcScale, boolean center){
  FloatBuffer pb = writeVertexArray(null, scale, center);
  FloatBuffer tb = writeTexCoordArray(null, Vector2f.ZERO, tcScale);
  FloatBuffer nb = writeNormalArray(null, scale);
  IntBuffer ib = writeIndexArray(null);
  Mesh m = new Mesh();
  m.setBuffer(Type.Position, 3, pb);
  m.setBuffer(Type.Normal, 3, nb);
  m.setBuffer(Type.TexCoord, 2, tb);
  m.setBuffer(Type.Index, 3, ib);
  m.setStatic();
  m.updateBound();
  return m;
}

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

lineMesh.setBuffer(Type.Color, 4, lineColor);
lineMesh.setStatic();

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

distortionMesh.setBuffer(VertexBuffer.Type.TexCoord2, 2, texcoordG);
distortionMesh.setBuffer(VertexBuffer.Type.TexCoord3, 2, texcoordB);
distortionMesh.setStatic();
return distortionMesh;

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

distortionMesh.setBuffer(VertexBuffer.Type.TexCoord2, 2, texcoordG);
distortionMesh.setBuffer(VertexBuffer.Type.TexCoord3, 2, texcoordB);
distortionMesh.setStatic();
return distortionMesh;

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

lineMesh.setBuffer(Type.Color, 4, lineColor);
lineMesh.setStatic();

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

public Mesh createMesh(Vector3f scale, Vector2f tcScale, Vector2f tcOffset, float offsetAmount, int totalSize, boolean center, int lod, boolean rightLod, boolean topLod, boolean leftLod, boolean bottomLod) {
  FloatBuffer pb = writeVertexArray(null, scale, center);
  FloatBuffer texb = writeTexCoordArray(null, tcOffset, tcScale, offsetAmount, totalSize);
  FloatBuffer nb = writeNormalArray(null, scale);
  Buffer ib;
  IndexBuffer idxB = writeIndexArrayLodDiff(lod, rightLod, topLod, leftLod, bottomLod, totalSize);
  if (idxB.getBuffer() instanceof IntBuffer)
    ib = (IntBuffer)idxB.getBuffer();
  else
    ib = (ShortBuffer)idxB.getBuffer();
  FloatBuffer bb = BufferUtils.createFloatBuffer(getWidth() * getHeight() * 3);
  FloatBuffer tanb = BufferUtils.createFloatBuffer(getWidth() * getHeight() * 3);
  writeTangentArray(nb, tanb, bb, texb, scale);
  Mesh m = new Mesh();
  m.setMode(Mode.TriangleStrip);
  m.setBuffer(Type.Position, 3, pb);
  m.setBuffer(Type.Normal, 3, nb);
  m.setBuffer(Type.Tangent, 3, tanb);
  m.setBuffer(Type.Binormal, 3, bb);
  m.setBuffer(Type.TexCoord, 2, texb);
  if (ib instanceof IntBuffer)
    m.setBuffer(Type.Index, 3, (IntBuffer)ib);
  else if (ib instanceof ShortBuffer)
    m.setBuffer(Type.Index, 3, (ShortBuffer)ib);
  m.setStatic();
  m.updateBound();
  return m;
}

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

lightMdl.getMesh().setStatic();
rootNode.attachChild(lightMdl);

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

lightMdl.getMesh().setStatic();
rootNode.attachChild(lightMdl);

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

lightMdl.getMesh().setStatic();
rootNode.attachChild(lightMdl);

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

lightMdl.getMesh().setStatic();
rootNode.attachChild(lightMdl);

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

/**
 * Locks the mesh (sets it static) to improve performance.
 * But it it not editable then. Set unlock to make it editable.
 */
public void lockMesh() {
  getMesh().setStatic();
}

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

public Mesh createMesh(Vector3f scale, Vector2f tcScale, boolean center){
  FloatBuffer pb = writeVertexArray(null, scale, center);
  FloatBuffer tb = writeTexCoordArray(null, Vector2f.ZERO, tcScale);
  FloatBuffer nb = writeNormalArray(null, scale);
  IntBuffer ib = writeIndexArray(null);
  Mesh m = new Mesh();
  m.setBuffer(Type.Position, 3, pb);
  m.setBuffer(Type.Normal, 3, nb);
  m.setBuffer(Type.TexCoord, 2, tb);
  m.setBuffer(Type.Index, 3, ib);
  m.setStatic();
  m.updateBound();
  return m;
}

代码示例来源:origin: us.ihmc/SensorProcessing

protected Node generatePointCloudGraphFrom(FloatBuffer pointCoordinates3d, FloatBuffer colorsRGBA, FloatBuffer sizes, float size)
{
 Node result = new Node("Autogenerated Point Cloud Node");
 Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
 mat.getAdditionalRenderState().setPointSprite(true);
 mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
 mat.setBoolean("PointSprite", true);
 mat.setFloat("Quadratic", size);
 Mesh m = new Mesh();
 m.setMode(Mode.Points);
 m.setBuffer(VertexBuffer.Type.Position, 3, pointCoordinates3d);
 m.setBuffer(VertexBuffer.Type.Color, 4, colorsRGBA);
 m.setBuffer(VertexBuffer.Type.Size, 1, sizes);
 m.setStatic();
 m.updateBound();
 Geometry g = new Geometry("AutoGenerated Point Cloud", m);
 g.setShadowMode(ShadowMode.Off);
 g.setQueueBucket(Bucket.Transparent);
 g.setMaterial(mat);
 g.updateModelBound();
 g.setCullHint(CullHint.Never);
 result.attachChild(g);
 result.updateModelBound();
 return result;
}

代码示例来源:origin: tonihele/OpenKeeper

public static Mesh genNormalLines(Mesh mesh, float scale) {
  FloatBuffer vertexBuffer = (FloatBuffer) mesh.getBuffer(Type.Position).getData();
  FloatBuffer normalBuffer = (FloatBuffer) mesh.getBuffer(Type.Normal).getData();
  ColorRGBA originColor = ColorRGBA.White;
  ColorRGBA normalColor = ColorRGBA.Blue;
  Mesh lineMesh = new Mesh();
  lineMesh.setMode(Mesh.Mode.Lines);
  Vector3f origin = new Vector3f();
  Vector3f point = new Vector3f();
  FloatBuffer lineVertex = BufferUtils.createFloatBuffer(vertexBuffer.limit() * 2);
  FloatBuffer lineColor = BufferUtils.createFloatBuffer(vertexBuffer.limit() / 3 * 4 * 2);
  for (int i = 0; i < vertexBuffer.limit() / 3; i++) {
    populateFromBuffer(origin, vertexBuffer, i);
    populateFromBuffer(point, normalBuffer, i);
    int index = i * 2;
    setInBuffer(origin, lineVertex, index);
    setInBuffer(originColor, lineColor, index);
    point.multLocal(scale);
    point.addLocal(origin);
    setInBuffer(point, lineVertex, index + 1);
    setInBuffer(normalColor, lineColor, index + 1);
  }
  lineMesh.setBuffer(Type.Position, 3, lineVertex);
  lineMesh.setBuffer(Type.Color, 4, lineColor);
  lineMesh.setStatic();
  //lineMesh.setInterleaved();
  return lineMesh;
}

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

public Mesh createMesh(Vector3f scale, Vector2f tcScale, Vector2f tcOffset, float offsetAmount, int totalSize, boolean center, int lod, boolean rightLod, boolean topLod, boolean leftLod, boolean bottomLod) {
  FloatBuffer pb = writeVertexArray(null, scale, center);
  FloatBuffer texb = writeTexCoordArray(null, tcOffset, tcScale, offsetAmount, totalSize);
  FloatBuffer nb = writeNormalArray(null, scale);
  Buffer ib;
  IndexBuffer idxB = writeIndexArrayLodDiff(lod, rightLod, topLod, leftLod, bottomLod, totalSize);
  if (idxB.getBuffer() instanceof IntBuffer)
    ib = (IntBuffer)idxB.getBuffer();
  else
    ib = (ShortBuffer)idxB.getBuffer();
  FloatBuffer bb = BufferUtils.createFloatBuffer(getWidth() * getHeight() * 3);
  FloatBuffer tanb = BufferUtils.createFloatBuffer(getWidth() * getHeight() * 3);
  writeTangentArray(nb, tanb, bb, texb, scale);
  Mesh m = new Mesh();
  m.setMode(Mode.TriangleStrip);
  m.setBuffer(Type.Position, 3, pb);
  m.setBuffer(Type.Normal, 3, nb);
  m.setBuffer(Type.Tangent, 3, tanb);
  m.setBuffer(Type.Binormal, 3, bb);
  m.setBuffer(Type.TexCoord, 2, texb);
  if (ib instanceof IntBuffer)
    m.setBuffer(Type.Index, 3, (IntBuffer)ib);
  else if (ib instanceof ShortBuffer)
    m.setBuffer(Type.Index, 3, (ShortBuffer)ib);
  m.setStatic();
  m.updateBound();
  return m;
}

相关文章