本文整理了Java中com.jme3.scene.Mesh.updateBound()
方法的一些代码示例,展示了Mesh.updateBound()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mesh.updateBound()
方法的具体详情如下:
包路径:com.jme3.scene.Mesh
类名称:Mesh
方法名:updateBound
[英]Updates the bounding volume of this mesh. The method does nothing if the mesh has no Type#Position buffer. It is expected that the position buffer is a float buffer with 3 components.
[中]更新此网格的边界体积。如果网格没有类型#位置缓冲区,则该方法不会执行任何操作。预计位置缓冲器是一个由3个部件组成的浮动缓冲器。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Updates the bounding volume of the mesh. Should be called when the
* mesh has been modified.
*/
public void updateModelBound() {
mesh.updateBound();
setBoundRefresh();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private Mesh createTriangleStripMesh() {
Mesh strip = new Mesh();
strip.setMode(Mode.TriangleStrip);
FloatBuffer vb = BufferUtils.createFloatBuffer(3*3*3); // 3 rows * 3 columns * 3 floats
vb.rewind();
vb.put(new float[]{0,2,0}); vb.put(new float[]{1,2,0}); vb.put(new float[]{2,2,0});
vb.put(new float[]{0,1,0}); vb.put(new float[]{1,1,0}); vb.put(new float[]{2,1,0});
vb.put(new float[]{0,0,0}); vb.put(new float[]{1,0,0}); vb.put(new float[]{2,0,0});
FloatBuffer nb = BufferUtils.createFloatBuffer(3*3*3);
nb.rewind();
nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1});
nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1});
nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1}); nb.put(new float[]{0,0,1});
FloatBuffer tb = BufferUtils.createFloatBuffer(3*3*2);
tb.rewind();
tb.put(new float[]{0,0}); tb.put(new float[]{0.5f,0}); tb.put(new float[]{1,0});
tb.put(new float[]{0,0.5f}); tb.put(new float[]{0.5f,0.5f}); tb.put(new float[]{1,0.5f});
tb.put(new float[]{0,1}); tb.put(new float[]{0.5f,1}); tb.put(new float[]{1,1});
int[] indexes = new int[]{0,3,1,4,2,5, 5,3, 3,6,4,7,5,8};
IntBuffer ib = BufferUtils.createIntBuffer(indexes.length);
ib.put(indexes);
strip.setBuffer(Type.Position, 3, vb);
strip.setBuffer(Type.Normal, 3, nb);
strip.setBuffer(Type.TexCoord, 2, tb);
strip.setBuffer(Type.Index, 3, ib);
strip.updateBound();
return strip;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
mesh.updateBound();
mesh.setStatic();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
m.updateBound();
m.updateCounts();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
newMesh.setBuffer(VertexBuffer.Type.Index, 3, toArray(indexes.toArray(new Integer[indexes.size()])));
newMesh.setStatic();
newMesh.updateBound();
newMesh.updateCounts();
Geometry geom = new Geometry();
mesh.updateBound();
mesh.updateCounts();
Geometry geom = new Geometry();
代码示例来源: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
jmeMesh.updateBound();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
writeColorBuffer( vertices, cols, mesh);
mesh.updateBound();
mesh.updateCounts();
代码示例来源: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
m.setBuffer(Type.TexCoord, 3, BufferUtils.createFloatBuffer(texCoord));
m.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(indexes));
m.updateBound();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
m.setBuffer(Type.TexCoord, 3, BufferUtils.createFloatBuffer(texCoord));
m.setBuffer(Type.Index, 1, BufferUtils.createIntBuffer(indexes));
m.updateBound();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
q.setBuffer(Type.Index, 3, new int[]{ 0, 1, 2 });
q.setBound(new BoundingSphere());
q.updateBound();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
applyAtlasCoords(geometries, mesh, atlas);
mesh.updateCounts();
mesh.updateBound();
geom.setMesh(mesh);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
updateBound();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Attach a pair of parallel white lines in the z=1 plane.
*/
void createWhiteLines() {
Mesh lineMesh = new Mesh();
lineMesh.setMode(Mesh.Mode.Lines);
float[] corners = new float[]{
-1f, -1f, 0f,
-1f, 1f, 0f,
1f, 1f, 0f,
1f, -1f, 0f
};
lineMesh.setBuffer(VertexBuffer.Type.Position, 3, corners);
short[] indices = new short[]{0, 1, 2, 3};
lineMesh.setBuffer(VertexBuffer.Type.Index, 2, indices);
lineMesh.updateBound();
Geometry whiteLines = new Geometry("white lines", lineMesh);
Material white = assetManager.loadMaterial("Common/Materials/WhiteColor.j3m");
whiteLines.setMaterial(white);
whiteLines.move(0f, 0f, 1f);
rootNode.attachChild(whiteLines);
}
代码示例来源: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
m.setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(texCoord));
m.setBuffer(Type.Index, 1, BufferUtils.createShortBuffer(indexes));
m.updateBound();
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* Updates the bounding volume of the mesh. Should be called when the
* mesh has been modified.
*/
public void updateModelBound() {
mesh.updateBound();
setBoundRefresh();
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* Updates the bounding volume of the mesh. Should be called when the
* mesh has been modified.
*/
public void updateModelBound() {
mesh.updateBound();
setBoundRefresh();
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!