本文整理了Java中com.jme3.scene.Geometry.updateModelBound()
方法的一些代码示例,展示了Geometry.updateModelBound()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.updateModelBound()
方法的具体详情如下:
包路径:com.jme3.scene.Geometry
类名称:Geometry
方法名:updateModelBound
[英]Updates the bounding volume of the mesh. Should be called when the mesh has been modified.
[中]更新网格的边界体积。应在修改网格后调用。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void setParent(Node node) {
for(int i = 0; i < geometries.size(); ++i) {
Geometry geom = geometries.get(i);
geom.setName(node.getName() + (i > 0 ? "-" + i : ""));
geom.updateModelBound();
node.attachChild(geom);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private static Geometry createDebugShape(CollisionShape shape) {
Geometry geom = new Geometry();
geom.setMesh(DebugShapeFactory.getDebugMesh(shape));
// geom.setLocalScale(shape.getScale());
geom.updateModelBound();
return geom;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Create a geometry for visualizing the specified shape.
*
* @param shape (not null, unaffected)
* @return a new geometry (not null)
*/
private static Geometry createDebugShape(CollisionShape shape) {
Geometry geom = new Geometry();
geom.setMesh(DebugShapeFactory.getDebugMesh(shape));
// geom.setLocalScale(shape.getScale());
geom.updateModelBound();
return geom;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* This method returns the bounding box of the given geometries.
*
* @param geometries
* the list of geometries
* @return bounding box of the given geometries
*/
public static BoundingBox getBoundingBox(Geometry... geometries) {
BoundingBox result = null;
for (Geometry geometry : geometries) {
geometry.updateModelBound();
BoundingVolume bv = geometry.getModelBound();
if (bv instanceof BoundingBox) {
return (BoundingBox) bv;
} else if (bv instanceof BoundingSphere) {
BoundingSphere bs = (BoundingSphere) bv;
float r = bs.getRadius();
return new BoundingBox(bs.getCenter(), r, r, r);
} else {
throw new IllegalStateException("Unknown bounding volume type: " + bv.getClass().getName());
}
}
return result;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* This method returns the bounding sphere of the given geometries.
*
* @param geometries
* the list of geometries
* @return bounding sphere of the given geometries
*/
/* package */static BoundingSphere getBoundingSphere(Geometry... geometries) {
BoundingSphere result = null;
for (Geometry geometry : geometries) {
geometry.updateModelBound();
BoundingVolume bv = geometry.getModelBound();
if (bv instanceof BoundingBox) {
BoundingBox bb = (BoundingBox) bv;
float r = Math.max(bb.getXExtent(), bb.getYExtent());
r = Math.max(r, bb.getZExtent());
return new BoundingSphere(r, bb.getCenter());
} else if (bv instanceof BoundingSphere) {
return (BoundingSphere) bv;
} else {
throw new IllegalStateException("Unknown bounding volume type: " + bv.getClass().getName());
}
}
return result;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
out.updateModelBound();
retVal.add(out);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void updateBoneMesh(Geometry geom, Vector3f start, Vector3f[] ends) {
if (geom.getMesh() instanceof ArmatureInterJointsWire) {
((ArmatureInterJointsWire) geom.getMesh()).updatePoints(start, ends);
} else if (geom.getMesh() instanceof Line) {
((Line) geom.getMesh()).updatePoints(start, ends[0]);
}
geom.updateModelBound();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
batch.geometry.updateModelBound();
batches.add(batch);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
geom.updateModelBound();
geomArray[index] = geom;
index++;
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void updateSubBatch(Geometry bg) {
Batch batch = batchesByGeom.get(bg);
if (batch != null) {
Mesh mesh = batch.geometry.getMesh();
Mesh origMesh = bg.getMesh();
VertexBuffer pvb = mesh.getBuffer(VertexBuffer.Type.Position);
VertexBuffer nvb = mesh.getBuffer(VertexBuffer.Type.Normal);
VertexBuffer tvb = mesh.getBuffer(VertexBuffer.Type.Tangent);
VertexBuffer opvb = origMesh.getBuffer(VertexBuffer.Type.Position);
VertexBuffer onvb = origMesh.getBuffer(VertexBuffer.Type.Normal);
VertexBuffer otvb = origMesh.getBuffer(VertexBuffer.Type.Tangent);
FloatBuffer posBuf = getFloatBuffer(pvb);
FloatBuffer normBuf = getFloatBuffer(nvb);
FloatBuffer tanBuf = getFloatBuffer(tvb);
FloatBuffer oposBuf = getFloatBuffer(opvb);
FloatBuffer onormBuf = getFloatBuffer(onvb);
FloatBuffer otanBuf = getFloatBuffer(otvb);
Matrix4f transformMat = getTransformMatrix(bg);
doTransforms(oposBuf, onormBuf, otanBuf, posBuf, normBuf, tanBuf, bg.startIndex, bg.startIndex + bg.getVertexCount(), transformMat);
pvb.updateData(posBuf);
if (nvb != null) {
nvb.updateData(normBuf);
}
if (tvb != null) {
tvb.updateData(tanBuf);
}
batch.geometry.updateModelBound();
}
}
代码示例来源:origin: org.jmonkeyengine/jme3-plugins
public void setParent(Node node) {
for(int i = 0; i < geometries.size(); ++i) {
Geometry geom = geometries.get(i);
geom.setName(node.getName() + (i > 0 ? "-" + i : ""));
geom.updateModelBound();
node.attachChild(geom);
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
private static Geometry createDebugShape(CollisionShape shape) {
Geometry geom = new Geometry();
geom.setMesh(DebugShapeFactory.getDebugMesh(shape));
// geom.setLocalScale(shape.getScale());
geom.updateModelBound();
return geom;
}
代码示例来源:origin: org.jmonkeyengine/jme3-jbullet
private static Geometry createDebugShape(CollisionShape shape) {
Geometry geom = new Geometry();
geom.setMesh(DebugShapeFactory.getDebugMesh(shape));
// geom.setLocalScale(shape.getScale());
geom.updateModelBound();
return geom;
}
代码示例来源:origin: org.jmonkeyengine/jme3-bullet
private static Geometry createDebugShape(CollisionShape shape) {
Geometry geom = new Geometry();
geom.setMesh(DebugShapeFactory.getDebugMesh(shape));
// geom.setLocalScale(shape.getScale());
geom.updateModelBound();
return geom;
}
代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-plugins
if(rootNode != null) {
geom.setName(rootNode.getName() + "-mesh");
geom.updateModelBound();
rootNode.attachChild(geom);
break;
代码示例来源:origin: tonihele/OpenKeeper
geom.updateModelBound();
代码示例来源:origin: org.jmonkeyengine/jme3-dae
public void setCurrentSequence(String name)
{
currentSequence = findSequence(name);
currentIndex = 0;
if (geometry.getMesh() == null)
{
geometry.setMesh(currentSequence[currentIndex]);
geometry.setModelBound(new BoundingBox());
geometry.updateModelBound();
setModelBound(new BoundingBox());
updateModelBound();
}
else if (currentSequence != null)
{
geometry.setMesh(currentSequence[currentIndex]);
}
else
{
System.err.println("Can't play animation " + name);
return;
}
if (totalAnimationTime != 0)
{
animationFrameTime = totalAnimationTime / currentSequence.length;
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
batch.geometry.updateModelBound();
batch.geometry.updateWorldBound();
batch.needMeshUpdate = false;
代码示例来源:origin: org.jmonkeyengine/jme3-core
protected void updateSubBatch(Geometry bg) {
Batch batch = batchesByGeom.get(bg);
if (batch != null) {
Mesh mesh = batch.geometry.getMesh();
Mesh origMesh = bg.getMesh();
VertexBuffer pvb = mesh.getBuffer(VertexBuffer.Type.Position);
VertexBuffer nvb = mesh.getBuffer(VertexBuffer.Type.Normal);
VertexBuffer tvb = mesh.getBuffer(VertexBuffer.Type.Tangent);
VertexBuffer opvb = origMesh.getBuffer(VertexBuffer.Type.Position);
VertexBuffer onvb = origMesh.getBuffer(VertexBuffer.Type.Normal);
VertexBuffer otvb = origMesh.getBuffer(VertexBuffer.Type.Tangent);
FloatBuffer posBuf = getFloatBuffer(pvb);
FloatBuffer normBuf = getFloatBuffer(nvb);
FloatBuffer tanBuf = getFloatBuffer(tvb);
FloatBuffer oposBuf = getFloatBuffer(opvb);
FloatBuffer onormBuf = getFloatBuffer(onvb);
FloatBuffer otanBuf = getFloatBuffer(otvb);
Matrix4f transformMat = getTransformMatrix(bg);
doTransforms(oposBuf, onormBuf, otanBuf, posBuf, normBuf, tanBuf, bg.startIndex, bg.startIndex + bg.getVertexCount(), transformMat);
pvb.updateData(posBuf);
if (nvb != null) {
nvb.updateData(normBuf);
}
if (tvb != null) {
tvb.updateData(tanBuf);
}
batch.geometry.updateModelBound();
}
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!