root.attachChild(particleMesh); root.updateRenderState();
for (int ii = 0; ii < RenderState.RS_MAX_STATE; ii++) { RenderState rs = omesh.getRenderState(ii); if (rs != null) { particleMesh.setRenderState(rs); } }  particleNode.attachChild(particleMesh); particleNode.updateRenderState();
    public void resetManager(int particles) {        root.detachChild(particleMesh);        particleMesh = ParticleFactory.buildParticles("particles", particles);        ColorRGBA rgba = makeColorRGBA(startColorPanel.getBackground());        rgba.a = (Integer.parseInt(startAlphaSpinner.getValue().toString()) / 255f);        particleMesh.setStartColor(rgba);        rgba = makeColorRGBA(endColorPanel.getBackground());        rgba.a = (Integer.parseInt(endAlphaSpinner.getValue().toString()) / 255f);        particleMesh.setEndColor(rgba);        int val = startSizeSlider.getValue();        particleMesh.setStartSize(val / 10f);        val = endSizeSlider.getValue();        particleMesh.setEndSize(val / 10f);        val = minAgeSlider.getValue();        particleMesh.setMinimumLifeTime((float) val);        val = maxAgeSlider.getValue();        particleMesh.setMaximumLifeTime((float) val);        val = speedSlider.getValue();        particleMesh.getParticleController().setSpeed((float) val * .1f);        val = gravXSlider.getValue();        particleMesh.getGravityForce().x = (float) val * 0.001f;        val = gravYSlider.getValue();        particleMesh.getGravityForce().y = (float) val * 0.001f;        val = gravZSlider.getValue();        particleMesh.getGravityForce().z = (float) val * 0.001f;        val = emitXSlider.getValue();        particleMesh.getEmissionDirection().x = (float) val * .1f;        val = emitYSlider.getValue();        particleMesh.getEmissionDirection().y = (float) val * .1f;        val = emitZSlider.getValue();        particleMesh.getEmissionDirection().z = (float) val * .1f;        particleMesh.updateRotationMatrix();        val = angleSlider.getValue();        particleMesh.setMaximumAngle((float) val                * FastMath.DEG_TO_RAD);        val = minAngleSlider.getValue();        particleMesh.setMinimumAngle((float) val                * FastMath.DEG_TO_RAD);        val = randomSlider.getValue();        particleMesh.setRandomMod((float) val * .1f);        val = rateSlider.getValue();        particleMesh.setReleaseRate(val);        val = rateVarSlider.getValue();        particleMesh.setReleaseVariance((float) val * .01f);        particleMesh.getParticleController()                .setRepeatType(spawnBox.isSelected() ? Controller.RT_WRAP                        : Controller.RT_CLAMP);        particleMesh.getParticleController().setControlFlow(rateBox.isSelected());        rateSlider.setMaximum(particles * 5);        rateSlider.setValue(particles);        val = velocitySlider.getValue();        particleMesh.setInitialVelocity((float) val * .01f);        updateVelocityLabels();        val = spinSlider.getValue();        particleMesh.setParticleSpinSpeed((float) val * .01f);        updateSpinLabels();        root.attachChild(particleMesh);        root.updateRenderState();        regenCode();        validate();    }