Package com.jme.image

Examples of com.jme.image.Texture


    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(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    Texture t1 = TextureManager.loadTexture(
        TestSimpleQuadWater.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 );
View Full Code Here


        // 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);
View Full Code Here

        return ts;
    }
   
    public static TextureState createUsualTS(String texturePath, String... texturesPath) {
        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){
View Full Code Here

        // testovany box
        box = new Box("box", Vector3f.ZERO, 10, 10, 10);

        // texture state se dvemi texturami
        TextureState ts = display.getRenderer().createTextureState();
        Texture t01 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/rgb.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        Texture t02 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/mask.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        //jak se ty dve textury smichaji
        t01.setApply(ApplyMode.Combine);
        t02.setApply(ApplyMode.Combine);
      
        // jen na zkousku pootacim jednu z textur
        t01.setRotation(new Quaternion(new float[]{0.1f,0.5f,0.5f}));
        t01.setWrap(WrapMode.Repeat);
       
View Full Code Here

        // testovany box
        box = new Box("box", Vector3f.ZERO, 10, 10, 10);

        // texture state se dvemi texturami
        TextureState ts = display.getRenderer().createTextureState();
        Texture t01 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/rgb.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        Texture t02 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/mask.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        //jak se ty dve textury smichaji
        t01.setApply(ApplyMode.Combine);
        t02.setApply(ApplyMode.Combine);
      
        // jen na zkousku pootacim jednu z textur
        t01.setRotation(new Quaternion(new float[]{0.1f,0.5f,0.5f}));
        t01.setWrap(WrapMode.Repeat);
       
View Full Code Here

            return;
        }

        System.err.println("isEnabled = " + ts.isEnabled());

        Texture texture = ts.getTexture();
        printTexture(texture);
    }
View Full Code Here

            return;
        }

        logger.info("texid alloc: ts.getTexture() = " + ts.getTexture());

        Texture tex = ts.getTexture();
        if (tex != null) {
            if (tex.getTextureId() != 0) {
                // Don't allocate a texture ID if one is already allocated. This can happen,
                // for example, when a new view is created which shows the same texture as
                // an existing view. One such case is Apps-in-HUD.
                return;
            }
View Full Code Here

                384);
        pt.createTexture(32);
       
        // assign the texture to the terrain
        TextureState ts = getRenderer().createTextureState();
        Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),
                Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);
        ts.setTexture(t1, 0);
       
        //load a detail texture and set the combine modes for the two terrain textures.
        Texture t2 = TextureManager.loadTexture(
                TankApplet.class.getClassLoader().getResource(
                "jmetest/data/texture/Detail.jpg"),
                Texture.MM_LINEAR_LINEAR,
                Texture.FM_LINEAR);

        ts.setTexture(t2, 1);
        t2.setWrap(Texture.WM_WRAP_S_WRAP_T);

        t1.setApply(Texture.AM_COMBINE);
        t1.setCombineFuncRGB(Texture.ACF_MODULATE);
        t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);
        t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
        t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
        t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
        t1.setCombineScaleRGB(1.0f);

        t2.setApply(Texture.AM_COMBINE);
        t2.setCombineFuncRGB(Texture.ACF_ADD_SIGNED);
        t2.setCombineSrc0RGB(Texture.ACS_TEXTURE);
        t2.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
        t2.setCombineSrc1RGB(Texture.ACS_PREVIOUS);
        t2.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
        t2.setCombineScaleRGB(1.0f);

        tb.setRenderState(ts);
        //set the detail parameters.
        tb.setDetailTexture(1, 16);
        tb.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
View Full Code Here

                384);
        pt.createTexture(32);
       
        // assign the texture to the terrain
        TextureState ts = display.getRenderer().createTextureState();
        Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),
                Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);
        ts.setTexture(t1, 0);
       
        //load a detail texture and set the combine modes for the two terrain textures.
        Texture t2 = TextureManager.loadTexture(
                TestTerrain.class.getClassLoader().getResource(
                "jmetest/data/texture/Detail.jpg"),
                Texture.MM_LINEAR_LINEAR,
                Texture.FM_LINEAR);

        ts.setTexture(t2, 1);
        t2.setWrap(Texture.WM_WRAP_S_WRAP_T);

        t1.setApply(Texture.AM_COMBINE);
        t1.setCombineFuncRGB(Texture.ACF_MODULATE);
        t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);
        t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
        t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
        t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
        t1.setCombineScaleRGB(1.0f);

        t2.setApply(Texture.AM_COMBINE);
        t2.setCombineFuncRGB(Texture.ACF_ADD_SIGNED);
        t2.setCombineSrc0RGB(Texture.ACS_TEXTURE);
        t2.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
        t2.setCombineSrc1RGB(Texture.ACS_PREVIOUS);
        t2.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
        t2.setCombineScaleRGB(1.0f);

        tb.setRenderState(ts);
        //set the detail parameters.
        tb.setDetailTexture(1, 16);
        tb.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
View Full Code Here

            return null;
        }
        else
        {
            final TerrainBlock block = node.getNodeData();
            final Texture texture = block.getTexture();
            if ( block.hasCalculatedTextureImage() && texture != null )
            {
                // Found texture in current node, use it.
                myTempParentTextureToUse = texture;
                return WHOLE_TEXTURE;
View Full Code Here

TOP

Related Classes of com.jme.image.Texture

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.