com.jme3.renderer.queue.RenderQueue.Bucket Java Examples
The following examples show how to use
com.jme3.renderer.queue.RenderQueue.Bucket.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestBitmapText3D.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleInitApp() { Quad q = new Quad(6, 3); Geometry g = new Geometry("quad", q); g.setLocalTranslation(0, -3, -0.0001f); g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(g); BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); BitmapText txt = new BitmapText(fnt, false); txt.setBox(new Rectangle(0, 0, 6, 3)); txt.setQueueBucket(Bucket.Transparent); txt.setSize( 0.5f ); txt.setText(txtB); rootNode.attachChild(txt); }
Example #2
Source File: Spatial.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); name = ic.readString("name", null); worldBound = (BoundingVolume) ic.readSavable("world_bound", null); cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit); batchHint = ic.readEnum("batch_hint", BatchHint.class, BatchHint.Inherit); queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class, RenderQueue.Bucket.Inherit); shadowMode = ic.readEnum("shadow_mode", ShadowMode.class, ShadowMode.Inherit); localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY); localLights = (LightList) ic.readSavable("lights", null); localLights.setOwner(this); //changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split //the AnimControl creates the SkeletonControl for old files and add it to the spatial. //The SkeletonControl must be the last in the stack so we add the list of all other control before it. //When backward compatibility won't be needed anymore this can be replaced by : //controls = ic.readSavableArrayList("controlsList", null)); controls.addAll(0, ic.readSavableArrayList("controlsList", null)); userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null); }
Example #3
Source File: SelectionIndicator.java From Lemur with BSD 3-Clause "New" or "Revised" License | 6 votes |
protected void setupIndicator() { indicator = new Node("Indicator"); indicator.setQueueBucket(Bucket.Translucent); root.attachChild(indicator); // Just in case the root node has been moved indicator.setLocalTranslation(root.getLocalTranslation().negate()); indicator.setLocalRotation(root.getLocalRotation().inverse()); // Setup the indicator material this.material = GuiGlobals.getInstance().createMaterial(color, false).getMaterial(); material.getAdditionalRenderState().setWireframe(true); material.getAdditionalRenderState().setDepthFunc(TestFunction.Always); // Find all of the geometry children of our spatial spatial.depthFirstTraversal( new SceneGraphVisitorAdapter() { @Override public void visit( Geometry geom ) { // Make a copy of it Geometry copy = cloneGeometry(geom); indicator.attachChild(copy); } }); }
Example #4
Source File: StatsView.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public StatsView(String name, AssetManager manager, Statistics stats){ super(name); setQueueBucket(Bucket.Gui); setCullHint(CullHint.Never); statistics = stats; statLabels = statistics.getLabels(); statData = new int[statLabels.length]; labels = new BitmapText[statLabels.length]; BitmapFont font = manager.loadFont("Interface/Fonts/Console.fnt"); for (int i = 0; i < labels.length; i++){ labels[i] = new BitmapText(font); labels[i].setLocalTranslation(0, labels[i].getLineHeight() * (i+1), 0); attachChild(labels[i]); } addControl(this); }
Example #5
Source File: Spatial.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
public void write(JmeExporter ex) throws IOException { OutputCapsule capsule = ex.getCapsule(this); capsule.write(name, "name", null); capsule.write(worldBound, "world_bound", null); capsule.write(cullHint, "cull_mode", CullHint.Inherit); capsule.write(batchHint, "batch_hint", BatchHint.Inherit); capsule.write(queueBucket, "queue", RenderQueue.Bucket.Inherit); capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit); capsule.write(localTransform, "transform", Transform.IDENTITY); capsule.write(localLights, "lights", null); capsule.writeSavableArrayList(new ArrayList(localOverrides), "overrides", null); // Shallow clone the controls array to convert its type. capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null); capsule.writeStringSavableMap(userData, "user_data", null); }
Example #6
Source File: WelcomeScreen.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void setupSkyBox() { Mesh sphere = new Sphere(32, 32, 10f); sphere.setStatic(); skyBox = new Geometry("SkyBox", sphere); skyBox.setQueueBucket(Bucket.Sky); skyBox.setShadowMode(ShadowMode.Off); Image cube = SceneApplication.getApplication().getAssetManager().loadTexture("Textures/blue-glow-1024.dds").getImage(); TextureCubeMap cubemap = new TextureCubeMap(cube); Material mat = new Material(SceneApplication.getApplication().getAssetManager(), "Common/MatDefs/Misc/Sky.j3md"); mat.setBoolean("SphereMap", false); mat.setTexture("Texture", cubemap); mat.setVector3("NormalScale", new Vector3f(1, 1, 1)); skyBox.setMaterial(mat); ((Node) SceneApplication.getApplication().getViewPort().getScenes().get(0)).attachChild(skyBox); }
Example #7
Source File: TestPostWater.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void createBox() { //creating a transluscent box box = new Geometry("box", new Box(50, 50, 50)); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", new ColorRGBA(1.0f, 0, 0, 0.3f)); mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); //mat.getAdditionalRenderState().setDepthWrite(false); //mat.getAdditionalRenderState().setDepthTest(false); box.setMaterial(mat); box.setQueueBucket(Bucket.Translucent); //creating a post view port // ViewPort post=renderManager.createPostView("transpPost", cam); // post.setClearFlags(false, true, true); box.setLocalTranslation(-600, 0, 300); //attaching the box to the post viewport //Don't forget to updateGeometricState() the box in the simpleUpdate // post.attachScene(box); rootNode.attachChild(box); }
Example #8
Source File: TestPostWater.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void createFire() { /** * Uses Texture from jme3-test-data library! */ ParticleEmitter fire = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30); Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat_red.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); fire.setMaterial(mat_red); fire.setImagesX(2); fire.setImagesY(2); // 2x2 texture animation fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f)); // red fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0)); fire.setStartSize(10f); fire.setEndSize(1f); fire.setGravity(0, 0, 0); fire.setLowLife(0.5f); fire.setHighLife(1.5f); fire.getParticleInfluencer().setVelocityVariation(0.3f); fire.setLocalTranslation(-600, 50, 300); fire.setQueueBucket(Bucket.Translucent); rootNode.attachChild(fire); }
Example #9
Source File: TestPostWater.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void createFire() { /** Uses Texture from jme3-test-data library! */ ParticleEmitter fire = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30); Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat_red.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); fire.setMaterial(mat_red); fire.setImagesX(2); fire.setImagesY(2); // 2x2 texture animation fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f)); // red fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0)); fire.setStartSize(10f); fire.setEndSize(1f); fire.setGravity(0, 0, 0); fire.setLowLife(0.5f); fire.setHighLife(1.5f); fire.getParticleInfluencer().setVelocityVariation(0.3f); fire.setLocalTranslation(-350, 40, 430); fire.setQueueBucket(Bucket.Transparent); rootNode.attachChild(fire); }
Example #10
Source File: TestBitmapText3D.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { Quad q = new Quad(6, 3); Geometry g = new Geometry("quad", q); g.setLocalTranslation(0, -3, -0.0001f); g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(g); BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); BitmapText txt = new BitmapText(fnt, false); txt.setBox(new Rectangle(0, 0, 6, 3)); txt.setQueueBucket(Bucket.Transparent); txt.setSize( 0.5f ); txt.setText(txtB); rootNode.attachChild(txt); }
Example #11
Source File: TestPostWater.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void createBox() { //creating a transluscent box box = new Geometry("box", new Box(new Vector3f(0, 0, 0), 50, 50, 50)); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", new ColorRGBA(1.0f, 0, 0, 0.3f)); mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); //mat.getAdditionalRenderState().setDepthWrite(false); //mat.getAdditionalRenderState().setDepthTest(false); box.setMaterial(mat); box.setQueueBucket(Bucket.Translucent); //creating a post view port // ViewPort post=renderManager.createPostView("transpPost", cam); // post.setClearFlags(false, true, true); box.setLocalTranslation(-600, 0, 300); //attaching the box to the post viewport //Don't forget to updateGeometricState() the box in the simpleUpdate // post.attachScene(box); rootNode.attachChild(box); }
Example #12
Source File: SkeletonControl.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void showSkeleton(boolean flag) { if (flag) { Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Green); mat.getAdditionalRenderState().setDepthTest(false); SkeletonWire sw = new SkeletonWire(skeleton); Geometry skeletonWireGeom = new Geometry("skeletonWire", sw); model.attachChild(skeletonWireGeom); skeletonWireGeom.setMaterial(mat); skeletonWireGeom.setQueueBucket(Bucket.Transparent); } else { if (skeletonLineNode != null) { skeletonLineNode.removeFromParent(); skeletonLineNode = null; } } }
Example #13
Source File: SkeletonDebugger.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates a debugger with bone lengths data. If the data is supplied then the wires will show each full bone (from head to tail), * the points will display both heads and tails of the bones and dotted lines between bones will be seen. * @param name * the name of the debugger's node * @param skeleton * the skeleton that will be shown * @param boneLengths * a map between the bone's index and the bone's length */ public SkeletonDebugger(String name, Skeleton skeleton, Map<Integer, Float> boneLengths) { super(name); wires = new SkeletonWire(skeleton, boneLengths); points = new SkeletonPoints(skeleton, boneLengths); this.attachChild(new Geometry(name + "_wires", wires)); this.attachChild(new Geometry(name + "_points", points)); if (boneLengths != null) { interBoneWires = new SkeletonInterBoneWire(skeleton, boneLengths); this.attachChild(new Geometry(name + "_interwires", interBoneWires)); } this.setQueueBucket(Bucket.Transparent); }
Example #14
Source File: StatsView.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public StatsView(String name, AssetManager manager, Statistics stats){ super(name); setQueueBucket(Bucket.Gui); setCullHint(CullHint.Never); statistics = stats; statistics.setEnabled(enabled); statLabels = statistics.getLabels(); statData = new int[statLabels.length]; BitmapFont font = manager.loadFont("Interface/Fonts/Console.fnt"); statText = new BitmapText(font); statText.setLocalTranslation(0, statText.getLineHeight() * statLabels.length, 0); attachChild(statText); addControl(this); }
Example #15
Source File: Spatial.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override @SuppressWarnings("unchecked") public void write(JmeExporter ex) throws IOException { OutputCapsule capsule = ex.getCapsule(this); capsule.write(name, "name", null); capsule.write(worldBound, "world_bound", null); capsule.write(cullHint, "cull_mode", CullHint.Inherit); capsule.write(batchHint, "batch_hint", BatchHint.Inherit); capsule.write(queueBucket, "queue", RenderQueue.Bucket.Inherit); capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit); capsule.write(localTransform, "transform", Transform.IDENTITY); capsule.write(localLights, "lights", null); capsule.writeSavableArrayList(new ArrayList(localOverrides), "overrides", null); // Shallow clone the controls array to convert its type. capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null); capsule.writeStringSavableMap(userData, "user_data", null); }
Example #16
Source File: SkeletonDebugger.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public SkeletonDebugger(String name, Skeleton skeleton){ super(name); this.skeleton = skeleton; wires = new SkeletonWire(skeleton); points = new SkeletonPoints(skeleton); attachChild(new Geometry(name+"_wires", wires)); attachChild(new Geometry(name+"_points", points)); setQueueBucket(Bucket.Transparent); }
Example #17
Source File: SceneComposerToolController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
protected AudioMarker(AudioNode audio) { this.audio = audio; Quad q = new Quad(0.5f, 0.5f); this.setMesh(q); this.setMaterial(getAudioMarkerMaterial()); this.addControl(new AudioMarkerControl()); this.setQueueBucket(Bucket.Transparent); }
Example #18
Source File: MeshLoader.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void applyMaterial(Geometry geom, String matName) { Material mat = null; if (matName.endsWith(".j3m")) { // load as native jme3 material instance try { mat = assetManager.loadMaterial(matName); } catch (AssetNotFoundException ex) { // Warning will be raised (see below) if (!ex.getMessage().equals(matName)) { throw ex; } } } else { if (materialList != null) { mat = materialList.get(matName); } } if (mat == null) { logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{matName, key}); mat = PlaceholderAssets.getPlaceholderMaterial(assetManager); //mat.setKey(new MaterialKey(matName)); } if (mat.isTransparent()) { geom.setQueueBucket(Bucket.Transparent); } geom.setMaterial(mat); }
Example #19
Source File: Spatial.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void write(JmeExporter ex) throws IOException { OutputCapsule capsule = ex.getCapsule(this); capsule.write(name, "name", null); capsule.write(worldBound, "world_bound", null); capsule.write(cullHint, "cull_mode", CullHint.Inherit); capsule.write(batchHint, "batch_hint", BatchHint.Inherit); capsule.write(queueBucket, "queue", RenderQueue.Bucket.Inherit); capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit); capsule.write(localTransform, "transform", Transform.IDENTITY); capsule.write(localLights, "lights", null); // Shallow clone the controls array to convert its type. capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null); capsule.writeStringSavableMap(userData, "user_data", null); }
Example #20
Source File: SimpleApplication.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void initialize() { super.initialize(); guiNode.setQueueBucket(Bucket.Gui); guiNode.setCullHint(CullHint.Never); loadFPSText(); loadStatsView(); viewPort.attachScene(rootNode); guiViewPort.attachScene(guiNode); if (inputManager != null) { flyCam = new FlyByCamera(cam); flyCam.setMoveSpeed(1f); flyCam.registerWithInput(inputManager); if (context.getType() == Type.Display) { inputManager.addMapping(INPUT_MAPPING_EXIT, new KeyTrigger(KeyInput.KEY_ESCAPE)); } inputManager.addMapping(INPUT_MAPPING_CAMERA_POS, new KeyTrigger(KeyInput.KEY_C)); inputManager.addMapping(INPUT_MAPPING_MEMORY, new KeyTrigger(KeyInput.KEY_M)); inputManager.addMapping(INPUT_MAPPING_HIDE_STATS, new KeyTrigger(KeyInput.KEY_F5)); inputManager.addListener(actionListener, INPUT_MAPPING_EXIT, INPUT_MAPPING_CAMERA_POS, INPUT_MAPPING_MEMORY, INPUT_MAPPING_HIDE_STATS); } // call user code simpleInitApp(); }
Example #21
Source File: Spatial.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Returns this spatial's renderqueue bucket. If the mode is set to inherit, * then the spatial gets its renderqueue bucket from its parent. * * @return The spatial's current renderqueue mode. */ public RenderQueue.Bucket getQueueBucket() { if (queueBucket != RenderQueue.Bucket.Inherit) { return queueBucket; } else if (parent != null) { return parent.getQueueBucket(); } else { return RenderQueue.Bucket.Opaque; } }
Example #22
Source File: AndroidApplication.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void initialize() { // Create a default Android assetmanager before Application can create one in super.initialize(); assetManager = JmeSystem.newAssetManager(null); super.initialize(); guiNode.setQueueBucket(Bucket.Gui); guiNode.setCullHint(CullHint.Never); loadFPSText(); viewPort.attachScene(rootNode); guiViewPort.attachScene(guiNode); inputManager.addMapping("TouchEscape", new TouchTrigger(TouchInput.KEYCODE_BACK)); inputManager.addListener(this, new String[]{"TouchEscape"}); // call user code init(); // Start thread for async load Thread t = new Thread(new Runnable() { @Override public void run () { try { // call user code asyncload(); } catch (Exception e) { handleError("AsyncLoad failed", e); } loadingFinished.set(true); } }); t.setDaemon(true); t.start(); }
Example #23
Source File: TestColoredTexture.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { Quad quadMesh = new Quad(512,512); Geometry quad = new Geometry("Quad", quadMesh); quad.setQueueBucket(Bucket.Gui); mat = new Material(assetManager, "Common/MatDefs/Misc/ColoredTextured.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png")); quad.setMaterial(mat); guiNode.attachChildAt(quad, 0); nextColor = ColorRGBA.randomColor(); prevColor = ColorRGBA.Black; }
Example #24
Source File: ParticleEmitter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public ParticleEmitter(String name, Type type, int numParticles) { super(name); // ignore world transform, unless user sets inLocalSpace this.setIgnoreTransform(true); // particles neither receive nor cast shadows this.setShadowMode(ShadowMode.Off); // particles are usually transparent this.setQueueBucket(Bucket.Transparent); meshType = type; // Must create clone of shape/influencer so that a reference to a static is // not maintained shape = shape.deepClone(); particleInfluencer = particleInfluencer.clone(); control = new ParticleEmitterControl(this); controls.add(control); switch (meshType) { case Point: particleMesh = new ParticlePointMesh(); this.setMesh(particleMesh); break; case Triangle: particleMesh = new ParticleTriMesh(); this.setMesh(particleMesh); break; default: throw new IllegalStateException("Unrecognized particle type: " + meshType); } this.setNumParticles(numParticles); // particleMesh.initParticleData(this, particles.length); }
Example #25
Source File: PMDLoaderGLSLSkinning2.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
void setupMaterial(PMDMaterial m, PMDGeometry geom) { Material mat; if (false /*geom.getMesh() instanceof PMDSkinMesh*/) { // mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat = createMaterial(m, false); geom.setMaterial(mat); geom.setGlslSkinningMaterial(mat); geom.setNoSkinningMaterial(mat); } else { // PMDMesh mesh = (PMDMesh)geom.getMesh(); mat = createMaterial(m, true); geom.setMaterial(mat); geom.setGlslSkinningMaterial(mat); // mat.setInt("NumBones", mesh.boneIndexArray.length); mat = createMaterial(m, false); geom.setNoSkinningMaterial(mat); } geom.setPmdMaterial(m); if (m.getMaterial().getFaceColor().getAlpha() < 1f) { geom.setQueueBucket(Bucket.Transparent); } else { if (m.getTextureFileName().length() > 0) { geom.setQueueBucket(Bucket.Transparent); } else { geom.setQueueBucket(Bucket.Inherit); } } }
Example #26
Source File: OpenRTSApplication.java From OpenRTS with MIT License | 5 votes |
@Override public void initialize() { bulletAppState = new BulletAppState(); bulletAppState.startPhysics(); super.initialize(); guiNode.setQueueBucket(Bucket.Gui); guiNode.setCullHint(CullHint.Never); initTexts(); loadStatsView(); viewPort.attachScene(rootNode); guiViewPort.attachScene(guiNode); if (inputManager != null) { flyCam = new AzertyFlyByCamera(cam); flyCam.setMoveSpeed(1f); flyCam.registerWithInput(inputManager); if (context.getType() == Type.Display) { inputManager.addMapping("SIMPLEAPP_Exit", new KeyTrigger(KeyInput.KEY_ESCAPE)); } inputManager.addMapping("SIMPLEAPP_CameraPos", new KeyTrigger(KeyInput.KEY_C)); inputManager.addMapping("SIMPLEAPP_Memory", new KeyTrigger(KeyInput.KEY_M)); inputManager.addListener(actionListener, "SIMPLEAPP_Exit", "SIMPLEAPP_CameraPos", "SIMPLEAPP_Memory"); } // call user code simpleInitApp(); stateManager.attach(bulletAppState); getPhysicsSpace().addTickListener(this); }
Example #27
Source File: MyParticleEmitter.java From OpenRTS with MIT License | 5 votes |
public MyParticleEmitter(String name, Type type, int numParticles) { super(); this.name = name; setBatchHint(BatchHint.Never); // ignore world transform, unless user sets inLocalSpace this.setIgnoreTransform(true); // particles neither receive nor cast shadows this.setShadowMode(ShadowMode.Off); // particles are usually transparent this.setQueueBucket(Bucket.Transparent); meshType = type; // Must create clone of shape/influencer so that a reference to a static is // not maintained shape = shape.deepClone(); particleInfluencer = particleInfluencer.clone(); control = new MyParticleEmitter.ParticleEmitterControl(this); controls.add(control); switch (meshType) { case Point: particleMesh = new ParticlePointMesh(); this.setMesh(particleMesh); break; case Triangle: particleMesh = new ParticlePointMesh(); this.setMesh(particleMesh); break; default: throw new IllegalStateException("Unrecognized particle type: " + meshType); } this.setNumParticles2(numParticles); // particleMesh.initParticleData(this, particles.length); }
Example #28
Source File: ParticleEmitter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
public ParticleEmitter(String name, Type type, int numParticles) { super(name); setBatchHint(BatchHint.Never); // ignore world transform, unless user sets inLocalSpace this.setIgnoreTransform(true); // particles neither receive nor cast shadows this.setShadowMode(ShadowMode.Off); // particles are usually transparent this.setQueueBucket(Bucket.Transparent); meshType = type; // Must create clone of shape/influencer so that a reference to a static is // not maintained shape = shape.deepClone(); particleInfluencer = particleInfluencer.clone(); control = new ParticleEmitterControl(this); controls.add(control); switch (meshType) { case Point: particleMesh = new ParticlePointMesh(); this.setMesh(particleMesh); break; case Triangle: particleMesh = new ParticleTriMesh(); this.setMesh(particleMesh); break; default: throw new IllegalStateException("Unrecognized particle type: " + meshType); } this.setNumParticles(numParticles); // particleMesh.initParticleData(this, particles.length); }
Example #29
Source File: SceneComposerToolController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
protected LightMarker(Light light) { this.light = light; Quad q = new Quad(0.5f, 0.5f); this.setMesh(q); this.setMaterial(getLightMarkerMaterial()); this.addControl(new LightMarkerControl()); this.setQueueBucket(Bucket.Transparent); }
Example #30
Source File: Octnode.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void renderBounds(RenderQueue rq, Matrix4f transform, WireBox box, Material mat){ int numChilds = 0; for (int i = 0; i < 8; i++){ if (children[i] != null){ numChilds ++; break; } } if (geoms != null && numChilds == 0){ BoundingBox bbox2 = new BoundingBox(bbox); bbox.transform(transform, bbox2); // WireBox box = new WireBox(bbox2.getXExtent(), bbox2.getYExtent(), // bbox2.getZExtent()); // WireBox box = new WireBox(1,1,1); Geometry geom = new Geometry("bound", box); geom.setLocalTranslation(bbox2.getCenter()); geom.setLocalScale(bbox2.getXExtent(), bbox2.getYExtent(), bbox2.getZExtent()); geom.updateGeometricState(); geom.setMaterial(mat); rq.addToQueue(geom, Bucket.Opaque); box = null; geom = null; } for (int i = 0; i < 8; i++){ if (children[i] != null){ children[i].renderBounds(rq, transform, box, mat); } } }