Package com.jme3.texture

Examples of com.jme3.texture.TextureCubeMap


   * main for testing
   *
   * @param args
   */
  public static void main(String[] args) {
        AppSettings settings = new AppSettings(true);
        PolluxSettingsDialog.show(settings);
        System.out.println(settings.toString());
        System.exit(0);
  }
View Full Code Here


    }

    @Override
    public void start() {
     
        setSettings(new AppSettings(true));
        PolluxSettingsDialog.show(settings);
       
        super.start();
    }
View Full Code Here

    */
    Geometry g = new Geometry("Bubble", b);
    g.rotate(FastMath.HALF_PI, 0, FastMath.HALF_PI);
    //g.scale(1, 1, -1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Texture tex = assetManager.loadTexture("Textures/test3.png");
    mat.setTexture("ColorMap", tex);
    //mat.setColor("Color", ColorRGBA.Blue);
    //mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    g.setMaterial(mat);
   
View Full Code Here

    sphere.setQueueBucket(Bucket.Sky);
    Material sky = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
    TextureKey key = new TextureKey("Textures/Sky/Stars.dds", true);
    key.setGenerateMips(true);
    key.setAsCube(true);
    Texture tex = assetManager.loadTexture(key);
    sky.setTexture("m_Texture", tex);
    sky.setVector3("m_NormalScale", Vector3f.UNIT_XYZ);
    sphere.setMaterial(sky);
    sphere.setCullHint(Spatial.CullHint.Never);
    bgNode.attachChild(sphere);
View Full Code Here

        if (sphereMap) {
            skyMat.setBoolean("SphereMap", sphereMap);
        } else if (!(texture instanceof TextureCubeMap)) {
            // make sure its a cubemap
            Image img = texture.getImage();
            texture = new TextureCubeMap();
            texture.setImage(img);
        }
        skyMat.setTexture("Texture", texture);
        sky.setMaterial(skyMat);
View Full Code Here

            efficientData.add(southImg.getEfficentData());
            efficientData.add(northImg.getEfficentData());
            cubeImage.setEfficentData(efficientData);
        }

        TextureCubeMap cubeMap = new TextureCubeMap(cubeImage);
        cubeMap.setAnisotropicFilter(0);
        cubeMap.setMagFilter(Texture.MagFilter.Bilinear);
        cubeMap.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
        cubeMap.setWrap(Texture.WrapMode.EdgeClamp);

        Material skyMat = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
        skyMat.setTexture("Texture", cubeMap);
        skyMat.setVector3("NormalScale", normalScale);
        sky.setMaterial(skyMat);
View Full Code Here

        if (size < 0) {
            size = blenderContext.getBlenderKey().getSkyGeneratedTextureSize();
        }
        LOGGER.log(Level.FINE, "The sky texture size will be: {0}x{0}.", size);

        TextureCubeMap result = null;
        for (TextureData textureData : textureDatas) {
            TextureCubeMap texture = null;
            if (textureData.texture instanceof GeneratedTexture) {
                texture = ((GeneratedTexture) textureData.texture).generateSkyTexture(size, horizontalColor, zenithColor, blenderContext);
            } else {
                // first create a grayscale version of the image
                Image image = textureData.texture.getImage();
                if (image.getWidth() != image.getHeight() || image.getWidth() != size) {
                    image = ImageUtils.resizeTo(image, size, size);
                }
                Image grayscaleImage = ImageUtils.convertToGrayscaleTexture(image);

                // add the sky colors to the image
                PixelInputOutput sourcePixelIO = PixelIOFactory.getPixelIO(grayscaleImage.getFormat());
                PixelInputOutput targetPixelIO = PixelIOFactory.getPixelIO(image.getFormat());
                TexturePixel texturePixel = new TexturePixel();
                for (int x = 0; x < image.getWidth(); ++x) {
                    for (int y = 0; y < image.getHeight(); ++y) {
                        sourcePixelIO.read(grayscaleImage, 0, texturePixel, x, y);
                        texturePixel.intensity = texturePixel.red;// no matter which factor we use here, in grayscale they are all equal
                        ImageUtils.color(texturePixel, horizontalColor, zenithColor);
                        targetPixelIO.write(image, 0, texturePixel, x, y);
                    }
                }

                // create the cubemap texture from the coloured image
                ByteBuffer sourceData = image.getData(0);
                ArrayList<ByteBuffer> data = new ArrayList<ByteBuffer>(6);
                for (int i = 0; i < 6; ++i) {
                    data.add(BufferUtils.clone(sourceData));
                }
                texture = new TextureCubeMap(new Image(image.getFormat(), image.getWidth(), image.getHeight(), 6, data));
            }

            if (result == null) {
                result = texture;
            } else {
                ImageUtils.mix(result.getImage(), texture.getImage());
            }
        }
        return result;
    }
View Full Code Here

            sideS = FastMath.clamp(sideS - delta, 0, 1);
            forwardU = FastMath.clamp(forwardU - delta, 0, 1);
        }
        tempVars.release();

        return new TextureCubeMap(image);
    }
View Full Code Here

            loadedTextures = textureHelper.readTextureData(worldStructure, new float[] { horizontalColor.r, horizontalColor.g, horizontalColor.b, horizontalColor.a }, true);
        } finally {
            blenderContext.getBlenderKey().setLoadGeneratedTextures(loadGeneratedTextures);
        }

        TextureCubeMap texture = null;
        if (loadedTextures != null && loadedTextures.size() > 0) {
            if (loadedTextures.size() > 1) {
                throw new IllegalStateException("There should be only one combined texture for sky!");
            }
            CombinedTexture combinedTexture = loadedTextures.get(0);
            texture = combinedTexture.generateSkyTexture(horizontalColor, zenithColor, blenderContext);
        } else {
            LOGGER.fine("Preparing colors for colorband.");
            int colorbandType = ColorBand.IPO_CARDINAL;
            List<ColorRGBA> colorbandColors = new ArrayList<ColorRGBA>(3);
            colorbandColors.add(horizontalColor);
            if ((skytype & SKYTYPE_BLEND) != 0) {
                if ((skytype & SKYTYPE_PAPER) != 0) {
                    colorbandType = ColorBand.IPO_LINEAR;
                }
                if ((skytype & SKYTYPE_REAL) != 0) {
                    colorbandColors.add(0, zenithColor);
                }
                colorbandColors.add(zenithColor);
            }

            int size = blenderContext.getBlenderKey().getSkyGeneratedTextureSize();

            List<Integer> positions = new ArrayList<Integer>(colorbandColors.size());
            positions.add(0);
            if (colorbandColors.size() == 2) {
                positions.add(size - 1);
            } else if (colorbandColors.size() == 3) {
                positions.add(size / 2);
                positions.add(size - 1);
            }

            LOGGER.fine("Generating sky texture.");
            float[][] values = new ColorBand(colorbandType, colorbandColors, positions, size).computeValues();

            Image image = ImageUtils.createEmptyImage(Format.RGB8, size, size, 6);
            PixelInputOutput pixelIO = PixelIOFactory.getPixelIO(image.getFormat());
            TexturePixel pixel = new TexturePixel();

            LOGGER.fine("Creating side textures.");
            int[] sideImagesIndexes = new int[] { 0, 1, 4, 5 };
            for (int i : sideImagesIndexes) {
                for (int y = 0; y < size; ++y) {
                    pixel.red = values[y][0];
                    pixel.green = values[y][1];
                    pixel.blue = values[y][2];

                    for (int x = 0; x < size; ++x) {
                        pixelIO.write(image, i, pixel, x, y);
                    }
                }
            }

            LOGGER.fine("Creating top texture.");
            pixelIO.read(image, 0, pixel, 0, image.getHeight() - 1);
            for (int y = 0; y < size; ++y) {
                for (int x = 0; x < size; ++x) {
                    pixelIO.write(image, 3, pixel, x, y);
                }
            }

            LOGGER.fine("Creating bottom texture.");
            pixelIO.read(image, 0, pixel, 0, 0);
            for (int y = 0; y < size; ++y) {
                for (int x = 0; x < size; ++x) {
                    pixelIO.write(image, 2, pixel, x, y);
                }
            }

            texture = new TextureCubeMap(image);
        }

        LOGGER.fine("Sky texture created. Creating sky.");
        return SkyFactory.createSky(blenderContext.getAssetManager(), texture, false);
    }
View Full Code Here

  public void initialize(AppStateManager stateManager, Application app){
    super.initialize(stateManager, app);
    assetManager = app.getAssetManager();
    settings = app.getContext().getSettings();
   
    Picture pic = new Picture("HUD Picture");
    pic.setImage(assetManager, "Hud/InfoBox2.png", true);
    pic.setHeight(settings.getHeight());
    pic.setWidth(settings.getHeight()/2);
    pic.setPosition(settings.getWidth()-settings.getHeight()/2, 0);
    menuNode.attachChild(pic);
   
   
    /*Quad q = new Quad(6, 3);
        Geometry g = new Geometry("quad", q);
View Full Code Here

TOP

Related Classes of com.jme3.texture.TextureCubeMap

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.