private void setupTable(final Mesh mesh) { _lookupTable = new int[mesh.getMeshData().getVertexCount()]; for (int x = 0; x < _lookupTable.length; x++) { _lookupTable[x] = x; } }
private void setupTable(final Mesh mesh) { _lookupTable = new int[mesh.getMeshData().getVertexCount()]; for (int x = 0; x < _lookupTable.length; x++) { _lookupTable[x] = x; } }
public FloatBuffer getTextureCoords() { return mesh.getMeshData().getTextureBuffer(textureIndex); }
public void visit(final Spatial spatial) { if (spatial instanceof Mesh) { final Mesh mesh = (Mesh) spatial; final MeshData meshData = mesh.getMeshData(); for (final Entry<String, AbstractBufferData<? extends Buffer>> entry : meshData.listDataItems()) { _utils.deleteBuffer(entry.getValue()); } } } }
public void render(final Renderer renderer) { if (isVisible()) { render(renderer, getMeshData()); } }
@Override public boolean render(final Renderer renderer) { if (isVisible()) { return render(renderer, getMeshData()); } return false; }
public Vector3 randomEmissionPoint(final Vector3 store) { Vector3 rVal = store; if (rVal == null) { rVal = new Vector3(); } if (_onlyVertices) { getSource().getMeshData().randomVertex(rVal); } else { getSource().getMeshData().randomPointOnPrimitives(rVal); } return rVal; }
public Vector3 randomEmissionPoint(final Vector3 store) { Vector3 rVal = store; if (rVal == null) { rVal = new Vector3(); } if (_onlyVertices) { getSource().getMeshData().randomVertex(rVal); } else { getSource().getMeshData().randomPointOnPrimitives(rVal); } return rVal; }
public Spatial copy(final Spatial source, final AtomicBoolean recurse) { recurse.set(false); if (source instanceof Node) { recurse.set(true); return clone((Node) source); } else if (source instanceof Mesh) { final Mesh result = clone((Mesh) source); result.setMeshData(((Mesh) source).getMeshData()); result.updateModelBound(); return result; } return null; }
public Spatial copy(final Spatial source, final AtomicBoolean recurse) { recurse.set(false); if (source instanceof Node) { recurse.set(true); return clone((Node) source); } else if (source instanceof Mesh) { final Mesh result = clone((Mesh) source); result.setMeshData(((Mesh) source).getMeshData()); result.updateModelBound(); return result; } return null; }
private final boolean prepareForInstancing(final Spatial spatial) { boolean skipRenderQueue = false; if (spatial instanceof Mesh) { final Mesh mesh = (Mesh) spatial; final InstancingManager instancing = mesh.getMeshData().getInstancingManager(); // Only one instance needs to be added to the render queue if (instancing != null) { skipRenderQueue = instancing.isAddedToRenderQueue(); instancing.registerMesh(mesh); } } return skipRenderQueue; }
private final boolean prepareForInstancing(final Spatial spatial) { boolean skipRenderQueue = false; if (spatial instanceof Mesh) { final Mesh mesh = (Mesh) spatial; final InstancingManager instancing = mesh.getMeshData().getInstancingManager(); // Only one instance needs to be added to the render queue if (instancing != null) { skipRenderQueue = instancing.isAddedToRenderQueue(); instancing.registerMesh(mesh); } } return skipRenderQueue; }
private static Mesh createMesh() { final Mesh mesh = new Mesh(); mesh.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(4)); mesh.getMeshData().setColorBuffer(BufferUtils.createColorBuffer(4)); mesh.getMeshData().setIndexMode(IndexMode.TriangleFan); final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setSourceFunction(SourceFunction.SourceAlpha); blend.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha); mesh.setRenderState(blend); mesh.updateWorldRenderStates(false); return mesh; } }
public AreaEntry(final int maxSamples, final StatType type) { this.maxSamples = maxSamples; area = new Mesh("a"); area.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(maxSamples * 2)); area.getSceneHints().setRenderBucketType(RenderBucketType.Ortho); area.getMeshData().setIndexMode(IndexMode.LineStrip); area.setDefaultColor(getColorConfig(type, ConfigKeys.Color.name(), new ColorRGBA(ColorRGBA.LIGHT_GRAY))); if (!getBooleanConfig(type, ConfigKeys.ShowAreas.name(), true)) { area.getSceneHints().setCullHint(CullHint.Always); } } }
public AreaEntry(final int maxSamples, final StatType type) { this.maxSamples = maxSamples; area = new Mesh("a"); area.getMeshData().setVertexBuffer(BufferUtils.createVector3Buffer(maxSamples * 2)); area.getSceneHints().setRenderBucketType(RenderBucketType.OrthoOrder); area.getMeshData().setIndexMode(IndexMode.LineStrip); area.setDefaultColor(getColorConfig(type, ConfigKeys.Color.name(), new ColorRGBA(ColorRGBA.LIGHT_GRAY))); if (!getBooleanConfig(type, ConfigKeys.ShowAreas.name(), true)) { area.getSceneHints().setCullHint(CullHint.Always); } } }
public void killParticle() { setStatus(Status.Dead); final Vector3 tempVec3 = Vector3.fetchTempInstance(); final FloatBuffer vertexBuffer = parent.getParticleGeometry().getMeshData().getVertexBuffer(); BufferUtils.populateFromBuffer(tempVec3, vertexBuffer, startIndex); final int verts = ParticleSystem.getVertsForParticleType(type); for (int x = 1; x < verts; x++) { BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + x); } Vector3.releaseTempInstance(tempVec3); }
public void killParticle() { setStatus(Status.Dead); final Vector3 tempVec3 = Vector3.fetchTempInstance(); final FloatBuffer vertexBuffer = parent.getParticleGeometry().getMeshData().getVertexBuffer(); BufferUtils.populateFromBuffer(tempVec3, vertexBuffer, startIndex); final int verts = ParticleSystem.getVertsForParticleType(type); for (int x = 1; x < verts; x++) { BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + x); } Vector3.releaseTempInstance(tempVec3); }
public ParticleMesh(final String name, final Mesh sourceMesh) { super(name, 0, ParticleSystem.ParticleType.GeomMesh); _numParticles = sourceMesh.getMeshData().getTotalPrimitiveCount(); setParticleEmitter(new MeshEmitter(sourceMesh, false)); getSceneHints().setRenderBucketType(RenderBucketType.Transparent); getSceneHints().setLightCombineMode(LightCombineMode.Off); getSceneHints().setTextureCombineMode(TextureCombineMode.Replace); initializeParticles(_numParticles); }
public ParticleMesh(final String name, final Mesh sourceMesh) { super(name, 0, ParticleSystem.ParticleType.GeomMesh); _numParticles = sourceMesh.getMeshData().getTotalPrimitiveCount(); setParticleEmitter(new MeshEmitter(sourceMesh, false)); getSceneHints().setRenderBucketType(RenderBucketType.Transparent); getSceneHints().setLightCombineMode(LightCombineMode.Off); getSceneHints().setTextureCombineMode(TextureCombineMode.Replace); initializeParticles(_numParticles); }
protected Mesh createSelectionMesh() { final Mesh mesh = new Mesh("selectionMesh"); final MeshData mData = mesh.getMeshData(); mData.setVertexBuffer(BufferUtils.createVector3Buffer(6)); mData.setIndexMode(IndexMode.Triangles); final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setSourceFunction(SourceFunction.SourceAlpha); blend.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha); mesh.setRenderState(blend); mesh.updateWorldRenderStates(false); mesh.setDefaultColor(ColorRGBA.LIGHT_GRAY); return mesh; }