Package com.jme.scene.state

Examples of com.jme.scene.state.TextureState


   
    this.setModelBound( new BoundingBox() );
    this.updateModelBound();
    this.updateWorldBound();
   
    TextureState ts = (TextureState) this.getRenderState( RenderState.RS_TEXTURE );
    if( ts == null ) {
      ts = TileGame.getDisplay().getRenderer().createTextureState();
    }
   
    ts.setTexture( baseTexture );
    this.getBatch( 0 ).setRenderState( ts );
    this.getBatch( 0 ).updateRenderState();
  //  this.getBatch( 0 ).draw( r );
       
    if( overTextureCoord != null ) {
      TextureState ts2 = TileGame.getDisplay().getRenderer().createTextureState();
      AlphaState as = (AlphaState) this.getRenderState( RenderState.RS_ALPHA );
      if( as == null ) {
        as = TileGame.getDisplay().getRenderer().createAlphaState();
        as.setBlendEnabled( true );
        as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
        as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
        as.setTestEnabled(true);
        as.setTestFunction(AlphaState.TF_GREATER);
        this.getBatch( 1 ).setRenderState( as );
      }

      ts2.setTexture( overTexture );
      this.getBatch( 1 ).setRenderState( ts2 );
      this.getBatch( 1 ).setTextureBuffer( overTextureBuffer,  0);
      this.getBatch( 1 ).updateRenderState();
    }
View Full Code Here


  private Node createObjects() {
    Node objects = new Node( "objects" );

    //Torus torus = new Torus( "Torus", 50, 50, 10, 20 );
    //torus.setLocalTranslation( new Vector3f( 50, -5, 20 ) );
    TextureState ts = display.getRenderer().createTextureState();
    Texture t0 = TextureManager.loadTexture(
        TestQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    Texture t1 = TextureManager.loadTexture(
        TestQuadWater.class.getClassLoader().getResource(
            "jmetest/data/texture/north.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t1.setEnvironmentalMapMode( Texture.EM_SPHERE );
    ts.setTexture( t0, 0 );
    ts.setTexture( t1, 1 );
    ts.setEnabled( true );
    //torus.setRenderState( ts );
    //objects.attachChild( torus );

    ts = display.getRenderer().createTextureState();
    t0 = TextureManager.loadTexture(
        TestQuadWater.class.getClassLoader().getResource(
            "jmetest/data/texture/wall.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    Box box = new Box( "box1", new Vector3f( -10, -10, -10 ), new Vector3f( 10, 10, 10 ) );
    box.setLocalTranslation( new Vector3f( 0, -7, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box2", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 15, 10, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box3", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 0, -10, 15 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box4", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 20, 0, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    ts = display.getRenderer().createTextureState();
    t0 = TextureManager.loadTexture(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    box = new Box( "box5", new Vector3f( -50, -2, -50 ), new Vector3f( 50, 2, 50 ) );
    box.setLocalTranslation( new Vector3f( 0, -15, 0 ) );
    box.setRenderState( ts );
    box.setModelBound( new BoundingBox() );
View Full Code Here

       
    Quad debugQuad = new Quad( "reflectionQuad", quadWidth, quadHeight );
    debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
    debugQuad.setCullMode( SceneElement.CULL_NEVER );
    debugQuad.setLightCombineMode( LightState.OFF );
    TextureState ts = display.getRenderer().createTextureState();
    ts.setTexture( waterEffectRenderPass.getTextureReflect() );
    debugQuad.setRenderState( ts );
    debugQuad.updateRenderState();
    debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 1.0f, 1.0f );
    debugQuadsNode.attachChild( debugQuad );

    if( waterEffectRenderPass.getTextureRefract() != null ) {
      debugQuad = new Quad( "refractionQuad", quadWidth, quadHeight );
      debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
      debugQuad.setCullMode( SceneElement.CULL_NEVER );
      debugQuad.setLightCombineMode( LightState.OFF );
      ts = display.getRenderer().createTextureState();
      ts.setTexture( waterEffectRenderPass.getTextureRefract() );
      debugQuad.setRenderState( ts );
      debugQuad.updateRenderState();
      debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 2.1f, 1.0f );
      debugQuadsNode.attachChild( debugQuad );
    }

        if( waterEffectRenderPass.getTextureDepth() != null ) {
            debugQuad = new Quad( "refractionQuad", quadWidth, quadHeight );
            debugQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );
            debugQuad.setCullMode( SceneElement.CULL_NEVER );
            debugQuad.setLightCombineMode( LightState.OFF );
            ts = display.getRenderer().createTextureState();
            ts.setTexture( waterEffectRenderPass.getTextureDepth() );
            debugQuad.setRenderState( ts );
            debugQuad.updateRenderState();
            debugQuad.getLocalTranslation().set( quadWidth * 0.6f, quadHeight * 3.2f, 1.0f );
            debugQuadsNode.attachChild( debugQuad );
        }
View Full Code Here

    as1.setTestEnabled(true);
    as1.setTestFunction(AlphaState.TF_GREATER);
    as1.setEnabled(true);

    // Now setup font texture
    TextureState font = display.getRenderer().createTextureState();
    /* The texture is loaded from fontLocation */
    font.setTexture(TextureManager.loadTexture(TankGameState.class
        .getClassLoader().getResource("com/jme/app/defaultfont.tga"),
        Texture.MM_LINEAR, Texture.FM_LINEAR));
    font.setEnabled(true);

    // Then our font Text object.

    /** This is what will actually have the text at the bottom. */
    fps = new Text("FPS label", "");
View Full Code Here

            "jmetest/data/texture/highest.jpg")), 100, 200, 380);

        pt.createTexture(512);

        // assign the texture to the terrain
        TextureState ts1 = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();

        ts1.setEnabled(true);

        Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),MinificationFilter.NearestNeighborLinearMipMap,MagnificationFilter.NearestNeighbor,
                       
                        ts1.getMaxAnisotropic(), true);

        Texture t2 = TextureManager.loadTexture(new ImageIcon(
                getClass().getClassLoader().getResource(
                "jmetest/data/texture/Detail.jpg")).getImage(),
                MinificationFilter.NearestNeighborLinearMipMap,MagnificationFilter.NearestNeighbor, true);  
      
        t2.setWrap(WrapMode.Repeat);

        ts1.setTexture(t1, 0);
        ts1.setTexture(t2, 1);

        tb.setRenderState(ts1);

        tb.setDetailTexture(1, 128);
    }
View Full Code Here

        lightState.attach(light);
        lightState.attach(light2);

        rootNode.setRenderState(lightState);

        TextureState ts = display.getRenderer().createTextureState();
        ts.setEnabled(true);
        ts.setTexture(TextureManager.loadTexture(TestBoxColor.class.getResource("/textures/earth_small/earthmap1k.jpg"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear));
        rootNode.setRenderState(ts);

        Random random = new Random();
        for (int i = 0; i < 2000; i++) {
            Sphere sphere = new Sphere("sphere_" + i, new Vector3f(random.nextInt(500) - 250, random.nextInt(500) - 250, random.nextInt(500) - 250), 12, 12, random.nextInt(5) + 4);
View Full Code Here

        return node;
    }

    public static TextureState createUsualTS(Texture texture, Texture... textures) {
        TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        ts.setTexture(texture, 0);
        for (int i = 0; i < textures.length; i++) {
            ts.setTexture(textures[i], i + 1);
        }
        return ts;
    }
View Full Code Here

        List<Texture> textures = new ArrayList<Texture>();
        Texture t = texture(texturePath);
        for (int i = 0; i < texturesPath.length; i++) {
            textures.add(texture(texturesPath[i]));
        }
        TextureState ts;
        if (textures.size() == 0){
            ts = createUsualTS(t);
        } else {
            ts = createUsualTS(t, textures.toArray(new Texture[textures.size()]));
        }
View Full Code Here

        }
        return ts;
    }

    public static TextureState createUsualTS(HudTextures hudTexture, HudTextures... hudTextures) {
        TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        ts.setTexture(hudTexture.getTexture(), 0);
        for (int i = 0; i < hudTextures.length; i++) {
            ts.setTexture(hudTextures[i].getTexture(), i + 1);
        }
        return ts;
    }
View Full Code Here

        SceneMonitor.getMonitor().registerNode(node, "COCKIP");

        node.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
        ZBufferState zs = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
        node.setRenderState(zs);
        TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        node.setRenderState(ts);
        node.setRenderState(rootNode.getRenderState(RenderState.StateType.Light));

        node.attachChild(ModelLoader.loadSpatial("/model/max3ds/cockpit.3DS"));
       
View Full Code Here

TOP

Related Classes of com.jme.scene.state.TextureState

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.