/** * Will reload the filter's materials whenever the shader file is changed * on the hard drive * @param shaderName the shader name (relative path to the asset folder or * to a registered asset path) * @param filter the filter to reload */ public void registerBinding(String shaderName, final Filter filter) { registerBinding(new FileChangedTrigger(shaderName), filter); }
@Override protected void deleteNativeBuffers() { super.deleteNativeBuffers(); if (previousData != null) { BufferUtils.destroyDirectBuffer(previousData); previousData = null; } }
/** * Direct buffers are garbage collected by using a phantom reference and a * reference queue. Every once a while, the JVM checks the reference queue * and cleans the direct buffers. However, as this doesn't happen * immediately after discarding all references to a direct buffer, it's easy * to OutOfMemoryError yourself using direct buffers. **/ public static void destroyDirectBuffer(Buffer toBeDestroyed) { if (!isDirect(toBeDestroyed)) { return; } allocator.destroyDirectBuffer(toBeDestroyed); }
@Override public void simpleUpdate(float tpf) { ByteBuffer buf = BufferUtils.createByteBuffer(500000); BufferUtils.destroyDirectBuffer(buf); FloatBuffer buf2 = BufferUtils.createFloatBuffer(500000); BufferUtils.destroyDirectBuffer(buf2); }
public ListIterator<E> listIterator(int index) { return new ArrayIterator<E>(getArray(), index); }
/** * * <code>getChild</code> returns a child at a given index. * * @param i * the index to retrieve the child from. * @return the child at a specified index. */ public Spatial getChild(int i) { return children.get(i); }
protected void updateMatParamOverrides() { refreshFlags &= ~RF_MATPARAM_OVERRIDE; worldOverrides.clear(); if (parent == null) { worldOverrides.addAll(localOverrides); } else { assert (parent.refreshFlags & RF_MATPARAM_OVERRIDE) == 0; worldOverrides.addAll(parent.worldOverrides); worldOverrides.addAll(localOverrides); } }
/** * Create a sky using the given cubemap or spheremap texture. * * @param assetManager from which to load materials * @param texture to use * @param envMapType see {@link EnvMapType} * @return a new spatial representing the sky, ready to be attached to the * scene graph */ public static Spatial createSky(AssetManager assetManager, Texture texture, EnvMapType envMapType) { return createSky(assetManager, texture, Vector3f.UNIT_XYZ, envMapType); }
/** * Returns true if this spatial requires updateLogicalState() to * be called, either because setRequiresUpdate(true) has been called * or because the spatial has controls. This is package private to * avoid exposing it to the public API since it is only used by Node. */ boolean requiresUpdates() { return requiresUpdates | !controls.isEmpty(); } /**
/** * Remove a forced material parameter previously added. * * @param override The override to remove. * @see #addForcedMatParam(com.jme3.material.MatParamOverride) */ public void removeForcedMatParam(MatParamOverride override) { forcedOverrides.remove(override); }
/** * Sorts the elements in the list according to their Comparator. */ public void sort() { if (size > 1) { // sort the spatial list using the comparator if(listSort.getLength() != size){ listSort.allocateStack(size); } listSort.sort(geometries,comparator); } }
/** * Clears all {@link RawInputListener}s. * * @see InputManager#addRawInputListener(com.jme3.input.RawInputListener) */ public void clearRawInputListeners() { rawListeners.clear(); }
/** * Removes a buffer block by the name. * * @param name the buffer block's name. */ public void removeBufferBlock(final String name){ bufferBlocks.remove(name); }
/** * Quick sorts the supplied array using the specified comparator. */ public static void qsort(Object[] a, Comparator comp) { qsort(a, 0, a.length - 1, comp); }
/** * Merge sort */ public static void msort(Object[] src, Object[] dest, Comparator comp){ msort(src, dest, 0, src.length - 1, comp); }
/** * Initializes the GeometryList to use the given {@link GeometryComparator} * to use for comparing geometries. * * @param comparator The comparator to use. */ public GeometryList(GeometryComparator comparator) { size = 0; geometries = new Geometry[DEFAULT_SIZE]; this.comparator = comparator; listSort = new ListSort<Geometry>(); }
@Override public Quaternion getOrientation() { VRUtil.convertMatrix4toQuat(hmdPose, rotStore); return rotStore; }
/** * Will reload the spatials's materials whenever the shader file is changed * on the hard drive * @param shaderName the shader name (relative path to the asset folder or * to a registered asset path) * @param spat the spatial to reload */ public void registerBinding(String shaderName, final Spatial spat) { registerBinding(new FileChangedTrigger(shaderName), spat); }