Package com.jme3.texture

Examples of com.jme3.texture.Texture2D


     * objects behind it to appear through. If false, the transparent
     * portions will be the image's color at that pixel.
     */
    public void setImage(AssetManager assetManager, String imgName, boolean useAlpha){
        TextureKey key = new TextureKey(imgName, true);
        Texture2D tex = (Texture2D) assetManager.loadTexture(key);
        setTexture(assetManager, tex, useAlpha);
    }
View Full Code Here


            if (tex != null){
                if (repeat){
                    tex.setWrap(WrapMode.Repeat);
                }
            }else{
                tex = new Texture2D(PlaceholderAssets.getPlaceholderImage());
                if (repeat){
                    tex.setWrap(WrapMode.Repeat);
                }
                tex.setKey(texKey);
            }
View Full Code Here

        if (images == null) {
            return null;
        }
        byte[] image = images.get(mapName);
        if (image != null) {
            Texture2D tex = new Texture2D(new Image(format, atlasWidth, atlasHeight, BufferUtils.createByteBuffer(image)));
            tex.setMagFilter(Texture.MagFilter.Bilinear);
            tex.setMinFilter(Texture.MinFilter.BilinearNearestMipMap);
            tex.setWrap(Texture.WrapMode.Clamp);
            return tex;
        }
        return null;
    }
View Full Code Here

                resultUVS.set(entry.getKey().faceIndex * 3 + 1, uvs[1]);
                resultUVS.set(entry.getKey().faceIndex * 3 + 2, uvs[2]);
            }

            Image resultImage = new Image(format, resultImageWidth, resultImageHeight, BufferUtils.createByteBuffer(resultImageWidth * resultImageHeight * (format.getBitsPerPixel() >> 3)));
            resultTexture = new Texture2D(resultImage);
            for (Entry<TriangleTextureElement, Integer[]> entry : imageLayoutData.entrySet()) {
                if (!duplicatedFaceIndexes.contains(entry.getKey().faceIndex)) {
                    this.draw(resultImage, entry.getKey().image, entry.getValue()[0], entry.getValue()[1]);
                }
            }
View Full Code Here

            try {
                tex = assetManager.loadTexture(texKey);
                tex.setWrap(WrapMode.Repeat);
            } catch (AssetNotFoundException ex){
                logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key});
                tex = new Texture2D( PlaceholderAssets.getPlaceholderImage() );
                tex.setWrap(WrapMode.Repeat);
                tex.setKey(texKey);
            }
           
            material.setTexture(jmeParamName, tex);
View Full Code Here

            texName = split[1];
        }else{
            texName = null;
        }

        textures[texUnit] = new Texture2D();
        for (Statement texUnitStat : statement.getContents()){
            readTextureUnitStatement(texUnitStat);
        }
        if (textures[texUnit].getImage() != null){
            texUnit++;
View Full Code Here

        try {
            texture = assetManager.loadTexture(texKey);
            texture.setWrap(WrapMode.Repeat);
        } catch (AssetNotFoundException ex){
            logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key});
            texture = new Texture2D(PlaceholderAssets.getPlaceholderImage());
            texture.setWrap(WrapMode.Repeat);
            texture.setKey(key);
        }
        return texture;
    }
View Full Code Here

                FileBlockHeader dataFileBlock = blenderContext.getFileBlock(pData.getOldMemoryAddress());
                blenderContext.getInputStream().setPosition(dataFileBlock.getBlockPosition());
                ImageLoader imageLoader = new ImageLoader();

                // Should the texture be flipped? It works for sinbad ..
                result = new Texture2D(imageLoader.loadImage(blenderContext.getInputStream(), dataFileBlock.getBlockPosition(), true));
            }
        } else {
            result = new Texture2D(im);
        }
        return result;
    }
View Full Code Here

    AWTLoader loader = new AWTLoader();
    Image sideImg = loader.load(sides, false);
    Image topImg = loader.load(top, false);
    Image bottomImg = loader.load(bottom, false);
    Texture2D sideTex = new Texture2D(sideImg);
    Texture2D topTex = new Texture2D(topImg);
    Texture2D bottomTex = new Texture2D(bottomImg);

    return SkyFactory.createSky(assetManager, sideTex, sideTex, sideTex, sideTex, topTex, bottomTex);
  }
View Full Code Here

    private void generateImageQuad() {
        try {
            plane = new Quad(xSize, ySize, true);
            screen = new Geometry("My " + imageType + " plane", plane);
            //  1920x1080
            imageToProject = new Texture2D(imageX, imageY, jmeformat);
            defaultMat = new Material(gameClient.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
            defaultMat.setTexture("ColorMap", imageToProject);
            screen.setMaterial(defaultMat);
            gameClient.getRoot().attachChild(screen);
        } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of com.jme3.texture.Texture2D

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.