@Override public void setModelBound(BoundingVolume modelBound) { if(children != null) { for (Spatial child : children.getArray()) { child.setModelBound(modelBound != null ? modelBound.clone(null) : null); } } }
/** * Create a shallow clone of this Mesh. The {@link VertexBuffer vertex * buffers} are shared between this and the clone mesh, the rest * of the data is cloned. * * @return A shallow clone of the mesh */ @Override public Mesh clone() { try { Mesh clone = (Mesh) super.clone(); clone.meshBound = meshBound.clone(); clone.collisionTree = collisionTree != null ? collisionTree : null; clone.buffers = buffers.clone(); clone.buffersList = new SafeArrayList<>(VertexBuffer.class, buffersList); clone.vertexArrayID = -1; if (elementLengths != null) { clone.elementLengths = elementLengths.clone(); } if (modeStart != null) { clone.modeStart = modeStart.clone(); } return clone; } catch (CloneNotSupportedException ex) { throw new AssertionError(); } }
@Override protected void updateWorldBound() { refreshFlags &= ~RF_BOUND; BoundingVolume resultBound = null; for (int i = 0; i < firstUnusedIndex; i++) { Geometry geom = geometries[i]; if (geom != null) { if (resultBound != null) { // merge current world bound with child world bound resultBound.mergeLocal(geom.getWorldBound()); } else { // set world bound to first non-null child world bound if (geom.getWorldBound() != null) { resultBound = geom.getWorldBound().clone(this.worldBound); } } } } this.worldBound = resultBound; }
/** * <code>updateWorldBound</code> updates the bounding volume that contains * this geometry. The location of the geometry is based on the location of * all this node's parents. * * @see Spatial#updateWorldBound() */ @Override protected void updateWorldBound() { super.updateWorldBound(); if (mesh == null) { throw new NullPointerException("Geometry: " + getName() + " has null mesh"); } if (mesh.getBound() != null) { if (ignoreTransform) { // we do not transform the model bound by the world transform, // just use the model bound as-is worldBound = mesh.getBound().clone(worldBound); } else { worldBound = mesh.getBound().transform(worldTransform, worldBound); } } }
try{ Mesh clone = (Mesh) super.clone(); clone.meshBound = meshBound != null ? meshBound.clone() : null;
@Override protected void updateWorldBound(){ super.updateWorldBound(); // for a node, the world bound is a combination of all its children // bounds BoundingVolume resultBound = null; for (Spatial child : children.getArray()) { // child bound is assumed to be updated assert (child.refreshFlags & RF_BOUND) == 0; if (resultBound != null) { // merge current world bound with child world bound resultBound.mergeLocal(child.getWorldBound()); } else { // set world bound to first non-null child world bound if (child.getWorldBound() != null) { resultBound = child.getWorldBound().clone(this.worldBound); } } } if (resultBound == null) { resultBound = new BoundingBox(getWorldTranslation(), 0f, 0f, 0f); } this.worldBound = resultBound; }
@Override public void setModelBound(BoundingVolume modelBound) { if(children != null) { for (Spatial child : children.getArray()) { child.setModelBound(modelBound != null ? modelBound.clone(null) : null); } } }
@Override public void setModelBound(BoundingVolume modelBound) { if(children != null) { for (Spatial child : children.getArray()) { child.setModelBound(modelBound != null ? modelBound.clone(null) : null); } } }
/** * Create a shallow clone of this Mesh. The {@link VertexBuffer vertex * buffers} are shared between this and the clone mesh, the rest * of the data is cloned. * * @return A shallow clone of the mesh */ @Override public Mesh clone() { try { Mesh clone = (Mesh) super.clone(); clone.meshBound = meshBound.clone(); clone.collisionTree = collisionTree != null ? collisionTree : null; clone.buffers = buffers.clone(); clone.buffersList = new SafeArrayList<VertexBuffer>(VertexBuffer.class,buffersList); clone.vertexArrayID = -1; if (elementLengths != null) { clone.elementLengths = elementLengths.clone(); } if (modeStart != null) { clone.modeStart = modeStart.clone(); } return clone; } catch (CloneNotSupportedException ex) { throw new AssertionError(); } }
/** * Create a shallow clone of this Mesh. The {@link VertexBuffer vertex * buffers} are shared between this and the clone mesh, the rest * of the data is cloned. * * @return A shallow clone of the mesh */ @Override public Mesh clone() { try { Mesh clone = (Mesh) super.clone(); clone.meshBound = meshBound.clone(); clone.collisionTree = collisionTree != null ? collisionTree : null; clone.buffers = buffers.clone(); clone.buffersList = new SafeArrayList<VertexBuffer>(VertexBuffer.class,buffersList); clone.vertexArrayID = -1; if (elementLengths != null) { clone.elementLengths = elementLengths.clone(); } if (modeStart != null) { clone.modeStart = modeStart.clone(); } return clone; } catch (CloneNotSupportedException ex) { throw new AssertionError(); } }
@Override protected void updateWorldBound() { refreshFlags &= ~RF_BOUND; BoundingVolume resultBound = null; for (int i = 0; i < firstUnusedIndex; i++) { Geometry geom = geometries[i]; if (geom != null) { if (resultBound != null) { // merge current world bound with child world bound resultBound.mergeLocal(geom.getWorldBound()); } else { // set world bound to first non-null child world bound if (geom.getWorldBound() != null) { resultBound = geom.getWorldBound().clone(this.worldBound); } } } } this.worldBound = resultBound; }
/** * <code>updateWorldBound</code> updates the bounding volume that contains * this geometry. The location of the geometry is based on the location of * all this node's parents. * * @see Spatial#updateWorldBound() */ @Override protected void updateWorldBound() { super.updateWorldBound(); if (mesh == null) { throw new NullPointerException("Geometry: " + getName() + " has null mesh"); } if (mesh.getBound() != null) { if (ignoreTransform) { // we do not transform the model bound by the world transform, // just use the model bound as-is worldBound = mesh.getBound().clone(worldBound); } else { worldBound = mesh.getBound().transform(worldTransform, worldBound); } } }
/** * <code>updateWorldBound</code> updates the bounding volume that contains * this geometry. The location of the geometry is based on the location of * all this node's parents. * * @see Spatial#updateWorldBound() */ @Override protected void updateWorldBound() { super.updateWorldBound(); if (mesh == null) { throw new NullPointerException("Geometry: " + getName() + " has null mesh"); } if (mesh.getBound() != null) { if (ignoreTransform) { // we do not transform the model bound by the world transform, // just use the model bound as-is worldBound = mesh.getBound().clone(worldBound); } else { worldBound = mesh.getBound().transform(worldTransform, worldBound); } } }
@Override protected void updateWorldBound(){ super.updateWorldBound(); // for a node, the world bound is a combination of all its children // bounds BoundingVolume resultBound = null; for (Spatial child : children.getArray()) { // child bound is assumed to be updated assert (child.refreshFlags & RF_BOUND) == 0; if (resultBound != null) { // merge current world bound with child world bound resultBound.mergeLocal(child.getWorldBound()); } else { // set world bound to first non-null child world bound if (child.getWorldBound() != null) { resultBound = child.getWorldBound().clone(this.worldBound); } } } this.worldBound = resultBound; }
@Override protected void updateWorldBound(){ super.updateWorldBound(); // for a node, the world bound is a combination of all it's children // bounds BoundingVolume resultBound = null; for (Spatial child : children.getArray()) { // child bound is assumed to be updated assert (child.refreshFlags & RF_BOUND) == 0; if (resultBound != null) { // merge current world bound with child world bound resultBound.mergeLocal(child.getWorldBound()); } else { // set world bound to first non-null child world bound if (child.getWorldBound() != null) { resultBound = child.getWorldBound().clone(this.worldBound); } } } this.worldBound = resultBound; }
try{ Mesh clone = (Mesh) super.clone(); clone.meshBound = meshBound != null ? meshBound.clone() : null;
try{ Mesh clone = (Mesh) super.clone(); clone.meshBound = meshBound != null ? meshBound.clone() : null;
/** * Compute bounds of a geomList * @param list * @param mat * @return */ public static BoundingBox computeUnionBound(GeometryList list, Matrix4f mat) { BoundingBox bbox = new BoundingBox(); BoundingVolume store = null; for (int i = 0; i < list.size(); i++) { BoundingVolume vol = list.get(i).getWorldBound(); store = vol.clone().transform(mat, null); //Nehon : prevent NaN and infinity values to screw the final bounding box if (store.getCenter().x != Float.NaN && store.getCenter().x != Float.POSITIVE_INFINITY && store.getCenter().x != Float.NEGATIVE_INFINITY) { bbox.mergeLocal(store); } } return bbox; }
Spatial clone = (Spatial) super.clone(); if (worldBound != null) { clone.worldBound = worldBound.clone();
Spatial clone = (Spatial) super.clone(); if (worldBound != null) { clone.worldBound = worldBound.clone();