code.append("ParticleMesh particles = ParticleFactory.buildParticles(\"myParticles\", " + particleMesh.getNumParticles() + ");\n"); code.append("particles.setGravityForce(" + codeString(particleMesh.getGravityForce()) + ");\n"); code.append("particles.setEmissionDirection(" + codeString(particleMesh.getEmissionDirection()) + ");\n"); code.append("particles.setMaximumAngle(" + particleMesh.getMaximumAngle() + "f);\n"); code.append("particles.setMinimumAngle(" + particleMesh.getMinimumAngle() + "f);\n"); code.append("particles.setSpeed(" + particleMesh.getParticleController().getSpeed() + "f);\n"); code.append("particles.setMinimumLifeTime(" + particleMesh.getMinimumLifeTime() + "f);\n"); code.append("particles.setMaximumLifeTime(" + particleMesh.getMaximumLifeTime() + "f);\n"); code.append("particles.setStartSize(" + particleMesh.getStartSize() + "f);\n"); code.append("particles.setEndSize(" + particleMesh.getEndSize() + "f);\n"); code.append("particles.setStartColor(" + codeString(particleMesh.getStartColor()) + ");\n"); code.append("particles.setEndColor(" + codeString(particleMesh.getEndColor()) + ");\n"); code.append("particles.setRandomMod(" + particleMesh.getRandomMod() + "f);\n"); code.append("particles.setControlFlow(" + particleMesh.getParticleController().getControlFlow() + ");\n"); code.append("particles.setReleaseRate(" + particleMesh.getReleaseRate() + ");\n"); code.append("particles.setReleaseVariance(" + particleMesh.getReleaseVariance() + "f);\n"); code.append("particles.setInitialVelocity(" + particleMesh.getInitialVelocity() + "f);\n"); code.append("particles.setParticleSpinSpeed(" + particleMesh.getParticleSpinSpeed() + "f);\n"); code.append("\n"); code.append("particles.warmUp(1000);\n"); code.append("\n"); code.append("particles.setRenderState(YOUR TEXTURE STATE);\n"); code.append("particles.setRenderState(YOUR ALPHA STATE);\n");
int quantity = particleNode.getQuantity(); if (quantity > 1) { code.append("Node particleNode = new Node(\"myParticles\");\n\n"); } for (int ii = 0; ii < quantity; ii++) { ParticleMesh pmesh = (ParticleMesh)particleNode.getChild(ii); if (ii == 0) { code.append("ParticleMesh "); } code.append("particles = ParticleFactory.buildParticles(\"" + (quantity > 1 ? pmesh.getName() : "myParticles") + "\", " + pmesh.getNumParticles() + ");\n"); code.append("particles.setGravityForce(" + codeString(pmesh.getGravityForce()) + ");\n"); code.append("particles.setEmissionDirection(" + codeString(pmesh.getEmissionDirection()) + ");\n"); code.append("particles.setMaximumAngle(" + pmesh.getMaximumAngle() + "f);\n"); code.append("particles.setMinimumAngle(" + pmesh.getMinimumAngle() + "f);\n"); code.append("particles.setSpeed(" + pmesh.getParticleController().getSpeed() + "f);\n"); code.append("particles.setMinimumLifeTime(" + pmesh.getMinimumLifeTime() + "f);\n"); code.append("particles.setMaximumLifeTime(" + pmesh.getMaximumLifeTime() + "f);\n"); code.append("particles.setStartSize(" + pmesh.getStartSize() + "f);\n"); code.append("particles.setEndSize(" + pmesh.getEndSize() + "f);\n"); code.append("particles.setStartColor(" + codeString(pmesh.getStartColor()) + ");\n"); code.append("particles.setEndColor(" + codeString(pmesh.getEndColor()) + ");\n"); code.append("particles.setRandomMod(" + pmesh.getRandomMod() + "f);\n"); code.append("particles.setControlFlow(" + pmesh.getParticleController().getControlFlow() + ");\n"); code.append("particles.setReleaseRate(" + pmesh.getReleaseRate() + ");\n"); code.append("particles.setReleaseVariance(" + pmesh.getReleaseVariance() + "f);\n"); code.append("particles.setInitialVelocity(" + pmesh.getInitialVelocity() + "f);\n"); code.append("particles.setParticleSpinSpeed(" + pmesh.getParticleSpinSpeed() + "f);\n"); code.append("\n"); code.append("particles.warmUp(1000);\n"); code.append("\n"); code.append("particles.setRenderState(YOUR TEXTURE STATE);\n"); if (quantity > 1) { code.append("\nparticleNode.attachChild(particles);\n\n"); } } String name = (quantity > 1) ? "particleNode" : "particles"; code.append(name + ".setRenderState(YOUR ALPHA STATE);\n");
    private void regenCode() {        StringBuffer code = new StringBuffer();        if (particleMesh == null) {            codeTextArea.setText("");            return;        }        code.append("ParticleMesh particles = ParticleFactory.buildParticles(\"myParticles\", "                + particleMesh.getNumParticles()                + ");\n");        code.append("particles.setGravityForce("                + codeString(particleMesh.getGravityForce())                + ");\n");        code.append("particles.setEmissionDirection("                + codeString(particleMesh.getEmissionDirection())                + ");\n");        code.append("particles.setMaximumAngle("                + particleMesh.getMaximumAngle()                + "f);\n");        code.append("particles.setMinimumAngle("                + particleMesh.getMinimumAngle()                + "f);\n");        code.append("particles.setSpeed(" + particleMesh.getParticleController().getSpeed()                + "f);\n");        code.append("particles.setMinimumLifeTime("                + particleMesh.getMinimumLifeTime()                + "f);\n");        code.append("particles.setMaximumLifeTime("                + particleMesh.getMaximumLifeTime()                + "f);\n");        code.append("particles.setStartSize("                + particleMesh.getStartSize() + "f);\n");        code.append("particles.setEndSize("                + particleMesh.getEndSize() + "f);\n");        code.append("particles.setStartColor("                + codeString(particleMesh.getStartColor())                + ");\n");        code.append("particles.setEndColor("                + codeString(particleMesh.getEndColor()) + ");\n");        code.append("particles.setRandomMod("                + particleMesh.getRandomMod() + "f);\n");        code.append("particles.setControlFlow("                + particleMesh.getParticleController().getControlFlow() + ");\n");        code.append("particles.setReleaseRate("                + particleMesh.getReleaseRate() + ");\n");        code.append("particles.setReleaseVariance("                + particleMesh.getReleaseVariance() + "f);\n");        code.append("particles.setInitialVelocity("                + particleMesh.getInitialVelocity() + "f);\n");        code.append("particles.setParticleSpinSpeed("                + particleMesh.getParticleSpinSpeed() + "f);\n");        code.append("\n");        code.append("particles.warmUp(1000);\n");        code.append("\n");        code.append("particles.setRenderState(YOUR TEXTURE STATE);\n");        code.append("particles.setRenderState(YOUR ALPHA STATE);\n");        code.append("ZBufferState zstate = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();\n");        code.append("zstate.setEnabled(false);\n");        code.append("particles.setRenderState(zstate);\n");        codeTextArea.setText(code.toString());        codeTextArea.setCaretPosition(0);    }