/** * Creates and returns a new instance of this spatial. Used for instanced rendering. All instances visible on the * screen will be drawn in one draw call. The new instance will share all data (meshData and renderStates) with the * current mesh and all other instances created from this spatial. * * @return an instanced copy of this node */ public Spatial makeInstanced() { final Spatial spat = duplicate(); // copy basic spatial info spat.setName(getName()); spat._sceneHints = _sceneHints; spat.setTransform(_localTransform); // copy local render states spat._renderStateList = _renderStateList; // copy controllers if (_controllers != null) { for (final SpatialController<?> sc : _controllers) { spat.addController(sc); } } return spat; }
/** * Creates and returns a new instance of this spatial. Used for instanced rendering. All instances visible on the * screen will be drawn in one draw call. The new instance will share all data (meshData and renderStates) with the * current mesh and all other instances created from this spatial. * * @return an instanced copy of this node */ public Spatial makeInstanced() { final Spatial spat = duplicate(); // copy basic spatial info spat.setName(getName()); spat._sceneHints = _sceneHints; spat.setTransform(_localTransform); // copy local render states spat._renderStateList = _renderStateList; // copy controllers if (_controllers != null) { for (final SpatialController<?> sc : _controllers) { spat.addController(sc); } } return spat; }
/** * Create a copy of this spatial. * * @param shareGeometricData * if true, reuse any data fields describing the geometric shape of the spatial, as applicable. * @return the copy as described. */ public Spatial makeCopy(final boolean shareGeometricData) { final Spatial spat = duplicate(); // copy basic spatial info spat.setName(getName()); spat.getSceneHints().set(_sceneHints); spat.setTransform(_localTransform); // copy local render states for (final StateType type : _renderStateList.keySet()) { final RenderState state = _renderStateList.get(type); if (state != null) { spat.setRenderState(state); } } // copy controllers if (_controllers != null) { for (final SpatialController<?> sc : _controllers) { spat.addController(sc); } } return spat; }
/** * Create a copy of this spatial. * * @param shareGeometricData * if true, reuse any data fields describing the geometric shape of the spatial, as applicable. * @return the copy as described. */ public Spatial makeCopy(final boolean shareGeometricData) { final Spatial spat = duplicate(); // copy basic spatial info spat.setName(getName()); spat.getSceneHints().set(_sceneHints); spat.setTransform(_localTransform); // copy local render states for (final StateType type : _renderStateList.keySet()) { final RenderState state = _renderStateList.get(type); if (state != null) { spat.setRenderState(state); } } // copy controllers if (_controllers != null) { for (final SpatialController<?> sc : _controllers) { spat.addController(sc); } } return spat; }