Package org.jdesktop.mtgame

Examples of org.jdesktop.mtgame.RenderManager


  }
       
        DirectionalLight directionalLight = (DirectionalLight)lightNode.getLight();

        rootNode = new Node("Light Viewer Node");
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        RenderComponent rc = rm.createRenderComponent(rootNode);
        this.addComponent(RenderComponent.class, rc);
       
        // Set the Z-buffer state on the root node
        ZBufferState zbuf = (ZBufferState)rm.createRendererState(StateType.ZBuffer);
        zbuf.setEnabled(true);
        zbuf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
       
        rootNode.setRenderState(zbuf);

        // Set the wireframe state on the root node
//        WireframeState wf = (WireframeState)rm.createRendererState(StateType.Wireframe);
//        wf.setEnabled(true);
//        rootNode.setRenderState(wf);
        MaterialState ms = (MaterialState)rm.createRendererState(StateType.Material);
        ms.setAmbient(new ColorRGBA(0.25f, 0, 0.5f, 0.40f));
        ms.setDiffuse(new ColorRGBA(0.25f, 0, 0.5f, 0.40f));
        ms.setMaterialFace(MaterialState.MaterialFace.FrontAndBack);;
        //ms.setSpecular(new ColorRGBA(1f, 1, 1f, 1f));
       
        ms.setEnabled(true);
        rootNode.setRenderState(ms);
       
        BlendState bs = (BlendState)rm.createRendererState(StateType.Blend);
        bs.setEnabled(true);
        bs.setBlendEnabled(true);
        bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
        bs.setTestEnabled(true);
View Full Code Here


        t.setSolidColor(color);

        // Create the main node and set the material state on the node so the
        // color shows up. Attach the tube to the node.
        Node n = new Node();
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        MaterialState matState3 = (MaterialState)
                rm.createRendererState(RenderState.StateType.Material);
        matState3.setDiffuse(color);
        n.setRenderState(matState3);
        n.attachChild(t);

        // Set the bound on the tube and update it
View Full Code Here

        a2.setSolidColor(color);

        // Create the main node and set the material state on the node so the
        // color shows up
        Node n = new Node();
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        MaterialState matState3 = (MaterialState)rm.createRendererState(StateType.Material);
        matState3.setDiffuse(color);
        n.setRenderState(matState3);

        // Create a sub-node to hold the first arrow. We must translate it up,
        // so that the end is at (0, 0, 0) in the local coordinate space of
View Full Code Here

        String shaderCheck = System.getProperty("avatar.shaderCheck");
        boolean shaderPass = true;

        // Check to see if the system supports OpenGL 2.0. If not, then
        // always use the low-detail avatar character
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        if (shaderCheck != null && shaderCheck.equals("true")) {
            shaderPass = rm.getContextCaps().GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB >= 512;
        }

        // Issue 1114: make sure the system is telling the truth about what
        // it supports by trying a mock shader program
        boolean uniformsPass = shaderPass && ShaderTest.getInstance().testShaders();

        logger.warning("Checking avatar detail level.  OpenGL20: " +
                       rm.supportsOpenGL20() + " ShaderCheck: " + shaderPass +
                       " UniformsCheck: " + uniformsPass);

        // OWL issue #110 -- ignore the value of supportsOpenGL20() here. This
        // is known to report false negatives on at least one graphics card.
        // Our shader test should do an adequate job determining whether a
        // graphics card supports the OpenGL 2.0 features we use.
       
        // Update: fixed version of supportsOpenGL20 should properly detect
        // version.
       
        return rm.supportsOpenGL20() && shaderPass && uniformsPass;
    }
View Full Code Here

     * Sets the Z-buffer state on the given node.
     *
     * NOTE: This method assumes it is being called in a MT-Safe manner.
     */
    private void setZBufferState(Node node) {
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        ZBufferState zbuf = (ZBufferState)rm.createRendererState(RenderState.StateType.ZBuffer);
        zbuf.setEnabled(true);
        zbuf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
        node.setRenderState(zbuf);
    }
View Full Code Here

        Node sphereNode = new Node();
        Sphere sphere = new Sphere(name, 30, 30, radius);
        sphereNode.attachChild(sphere);

        // Set the color to black and the transparency
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        sphere.setSolidColor(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f));
        sphereNode.setRenderState(zbuf);
        MaterialState matState = (MaterialState)rm.createRendererState(StateType.Material);
        sphereNode.setRenderState(matState);
        matState.setDiffuse(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f));
        matState.setAmbient(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f));
        matState.setShininess(128.0f);
        matState.setEmissive(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f));
        matState.setEnabled(true);

        BlendState alphaState = (BlendState)rm.createRendererState(StateType.Blend);
        alphaState.setBlendEnabled(true);
        alphaState.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        alphaState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
        alphaState.setTestEnabled(true);
        alphaState.setTestFunction(BlendState.TestFunction.GreaterThan);
        alphaState.setEnabled(true);
        sphere.setRenderState(alphaState);

        // Remove the back faces of the object so transparency works properly
        CullState cullState = (CullState)rm.createRendererState(StateType.Cull);
        cullState.setCullFace(CullState.Face.Back);
        sphereNode.setRenderState(cullState);

        // Set the bound so this node can be pickable
        sphere.setModelBound(new BoundingSphere());
View Full Code Here

        super(name);

        // Create the root node of the cell and the render component to attach
        // to the Entity with the node
        rootNode = new Node();
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        RenderComponent rc = rm.createRenderComponent(rootNode);
        this.addComponent(RenderComponent.class, rc);
    }
View Full Code Here

     * Adds an Entity with its root node to the scene graph, using the super-
     * class Entity as the parent
     */
    protected void addSubEntity(Entity subEntity, Node subNode) {
        // Create the render component that associates the node with the Entity
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        RenderComponent thisRC = rm.createRenderComponent(subNode);
        subEntity.addComponent(RenderComponent.class, thisRC);

        // Add this Entity to the parent Entity
        RenderComponent parentRC = this.getComponent(RenderComponent.class);
        thisRC.setAttachPoint(parentRC.getSceneRoot());
View Full Code Here

        rootBG.attachChild(modelBG);

        WorldManager wm = ClientContextJME.getWorldManager();

        RenderManager renderManager = wm.getRenderManager();
        ZBufferState buf = (ZBufferState) renderManager.createRendererState(
                RenderState.RS_ZBUFFER);
        buf.setEnabled(true);
        buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);

        MaterialState matState =
                (MaterialState) renderManager.createRendererState(
                RenderState.RS_MATERIAL);
//        matState.setDiffuse(color);
        rootBG.setRenderState(matState);
        rootBG.setRenderState(buf);

        Entity entity = new Entity(loadedModel.getWonderlandName());
        RenderComponent scene = renderManager.createRenderComponent(rootBG);
        entity.addComponent(RenderComponent.class, scene);

        scene.setLightingEnabled(loadedModel.getImportSettings().isLightingEnabled());

        entity.addComponent(TransformProcessorComponent.class,
View Full Code Here

        JScene js = character.getJScene();

        Node attachNode =
                js.getExternalKidsRoot(ExternalKidsType.UNTRANSFORMED);

        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();

        RenderComponent rc = rm.createRenderComponent(this);
        rc.setAttachPoint(attachNode);
        e.addComponent(RenderComponent.class, rc);

        JMECollisionSystem collisionSystem = (JMECollisionSystem) ClientContextJME.getWorldManager().
                getCollisionManager().loadCollisionSystem(JMECollisionSystem.class);
View Full Code Here

TOP

Related Classes of org.jdesktop.mtgame.RenderManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.