public final boolean isBatch(Spatial s) { for (Batch batch : batches.getArray()) { if (batch.geometry == s) { return true; } } return false; }
protected AppState[] getInitializing() { synchronized (states){ return initializing.getArray(); } }
protected AppState[] getStates(){ synchronized (states){ return states.getArray(); } }
public int hashCode() { // Exactly the hash code described in the List interface, basically E[] array = getArray(); int result = 1; for( E e : array ) { result = 31 * result + (e == null ? 0 : e.hashCode()); } return result; }
public <T> T[] toArray(T[] a) { E[] array = getArray(); if (a.length < array.length) { return (T[])Arrays.copyOf(array, array.length, a.getClass()); } System.arraycopy( array, 0, a, 0, array.length ); if (a.length > array.length) { a[array.length] = null; } return a; }
/** * Indicates to the GPU that this mesh will not be modified (a hint). * Sets the usage mode to {@link Usage#Static} * for all {@link VertexBuffer vertex buffers} on this Mesh. */ public void setStatic() { for (VertexBuffer vb : buffersList.getArray()){ vb.setUsage(Usage.Static); } }
/** * Indicates to the GPU that this mesh will be modified every frame (a hint). * Sets the usage mode to {@link Usage#Stream} * for all {@link VertexBuffer vertex buffers} on this Mesh. */ public void setStreamed(){ for (VertexBuffer vb : buffersList.getArray()){ vb.setUsage(Usage.Stream); } }
@Override public void updateModelBound() { if(children != null) { for (Spatial child : children.getArray()) { child.updateModelBound(); } } } @Override
/** * Indicates to the GPU that this mesh will be modified occasionally (a hint). * Sets the usage mode to {@link Usage#Dynamic} * for all {@link VertexBuffer vertex buffers} on this Mesh. */ public void setDynamic() { for (VertexBuffer vb : buffersList.getArray()){ vb.setUsage(Usage.Dynamic); } }
@Override public int collideWith(Collidable other, CollisionResults results) { int total = 0; for (Spatial child : children.getArray()) { if (!isBatch(child)) { total += child.collideWith(other, results); } } return total; } }
@Override public void setLodLevel(int lod){ super.setLodLevel(lod); for (Spatial child : children.getArray()) { child.setLodLevel(lod); } }
/** * Updates world transforms for this bone and it's children. */ public final void update() { this.updateModelTransforms(); for (Joint child : children.getArray()) { child.update(); } }
@Override protected void setTransformRefresh(){ super.setTransformRefresh(); for (Spatial child : children.getArray()){ if ((child.refreshFlags & RF_TRANSFORM) != 0) continue; child.setTransformRefresh(); } }
@Override public void setModelBound(BoundingVolume modelBound) { if(children != null) { for (Spatial child : children.getArray()) { child.setModelBound(modelBound != null ? modelBound.clone(null) : null); } } }
private void runControlUpdate(float tpf) { if (controls.isEmpty()) { return; } for (Control c : controls.getArray()) { c.update(tpf); } }
@Override protected void setTransformRefresh() { refreshFlags |= RF_TRANSFORM; setBoundRefresh(); for (Batch batch : batches.getArray()) { batch.geometry.setTransformRefresh(); } } private Matrix4f cachedLocalMat = new Matrix4f();
@Override protected void setLightListRefresh(){ super.setLightListRefresh(); for (Spatial child : children.getArray()){ if ((child.refreshFlags & RF_LIGHTLIST) != 0) continue; child.setLightListRefresh(); } }
/** * Batch this batchNode * every geometry of the sub scene graph of this node will be batched into a single mesh that will be rendered in one call */ public void batch() { doBatch(); //we set the batch geometries to ignore transforms to avoid transforms of parent nodes to be applied twice for (Batch batch : batches.getArray()) { batch.geometry.setIgnoreTransform(true); batch.geometry.setUserData(UserData.JME_PHYSICSIGNORE, true); } }
public void postQueue(RenderQueue rq) { for (Filter filter : filters.getArray()) { if (filter.isEnabled()) { if (prof != null) prof.spStep(SpStep.ProcPostQueue, FPP, filter.getName()); filter.postQueue(rq); } } }
public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); numSamples = ic.readInt("numSamples", 0); filters = new SafeArrayList<Filter>(Filter.class, ic.readSavableArrayList("filters", null)); for (Filter filter : filters.getArray()) { filter.setProcessor(this); setFilterState(filter, filter.isEnabled()); } assetManager = im.getAssetManager(); }