Package com.jme3.texture

Examples of com.jme3.texture.Texture


//
//        // ALPHA map (for splat textures)
//        matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alpha1.png"));
//
//        // HEIGHTMAP image (for the terrain heightmap)
        Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
//
//        // GRASS texture
//        Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
//        grass.setWrap(WrapMode.Repeat);
//        matTerrain.setTexture("DiffuseMap_0", grass);
//        matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
//
//        // DIRT texture
//        Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
//        dirt.setWrap(WrapMode.Repeat);
//        matTerrain.setTexture("DiffuseMap_1", dirt);
//        matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
//
//        // ROCK texture
//        Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
//        rock.setWrap(WrapMode.Repeat);
//        matTerrain.setTexture("DiffuseMap_2", rock);
//        matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
//
//        // BRICK texture
//        Texture brick = assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg");
//        brick.setWrap(WrapMode.Repeat);
//        matTerrain.setTexture("DiffuseMap_3", brick);
//        matTerrain.setFloat("DiffuseMap_3_scale", brickScale);
//
//        Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.jpg");
//        normalMap0.setWrap(WrapMode.Repeat);
//        Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png");
//        normalMap1.setWrap(WrapMode.Repeat);
//        Texture normalMap2 = assetManager.loadTexture("Textures/Terrain/splat/road_normal.png");
//        normalMap2.setWrap(WrapMode.Repeat);
//        matTerrain.setTexture("NormalMap_0", normalMap0);
//        matTerrain.setTexture("NormalMap_1", normalMap1);
//        matTerrain.setTexture("NormalMap_2", normalMap2);
//        matTerrain.setTexture("NormalMap_3", normalMap2);


        createSky();

        // CREATE HEIGHTMAP
        AbstractHeightMap heightmap = null;
        try {
            //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);

            heightmap = new ImageBasedHeightMap(heightMapImage.getImage(), 1f);
            heightmap.load();

        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here


    private void setupKeys() {
        flyCam.setMoveSpeed(50);
    }

    private void createSky() {
        Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
        Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
        Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
        Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
        Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
        Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");

        Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
        rootNode.attachChild(sky);
    }
View Full Code Here

      @Override
      public void simpleInitApp() {

          Material material = new Material(assetManager, "com/l2client/materials/LightingScrolling.j3md");

          Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
          grass.setWrap(WrapMode.Repeat);
          material.setTexture("DiffuseMap", grass);
          Texture normal = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.jpg");
          normal.setWrap(WrapMode.Repeat);
          material.setTexture("NormalMap", normal);
          material.setFloat("ScrollSpeed", 0.1f);
          material.setVector2("ScrollDirection", new Vector2f(0.1f,0.3f));

          // CREATE HEIGHTMAP
          AbstractHeightMap heightmap = null;
          try {
              //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
            Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
              heightmap = new ImageBasedHeightMap(heightMapImage.getImage(), 1f);
              heightmap.load();

          } catch (Exception e) {
              e.printStackTrace();
          }
View Full Code Here

      // ALPHA map (for splat textures) Red = dif0, Green= dif1, Blue=dif2 Alpha=dif3
      matTerrain.setTexture("AlphaMap", assetManager.loadTexture("com/l2client/test/material/splat.png"));

      // GRASS texture
      Texture grass = assetManager.loadTexture("com/l2client/test/material/chterraindirt01.dds");
      grass.setWrap(WrapMode.Repeat);
      matTerrain.setTexture("DiffuseMap_0", grass);
      matTerrain.setFloat("DiffuseMap_0_scale", grassScale);

      // DIRT texture
      Texture dirt = assetManager.loadTexture("com/l2client/test/material/jmrock01.dds");
      dirt.setWrap(WrapMode.Repeat);
      matTerrain.setTexture("DiffuseMap_1", dirt);
      matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);

      // ROCK texture
      Texture rock = assetManager.loadTexture("com/l2client/test/material/chterraingrass01.dds");
      rock.setWrap(WrapMode.Repeat);
      matTerrain.setTexture("DiffuseMap_2", rock);
      matTerrain.setFloat("DiffuseMap_2_scale", rockScale);

      // BRICK texture
      Texture brick = assetManager.loadTexture("com/l2client/test/material/cobblestone01.dds");
      brick.setWrap(WrapMode.Repeat);
      matTerrain.setTexture("DiffuseMap_3", brick);
      matTerrain.setFloat("DiffuseMap_3_scale", brickScale);

      Texture normalMap0 = assetManager.loadTexture("com/l2client/test/material/chterraindirt01_n.dds");
      normalMap0.setWrap(WrapMode.Repeat);
      Texture normalMap1 = assetManager.loadTexture("com/l2client/test/material/jmrock01_n.dds");
      normalMap1.setWrap(WrapMode.Repeat);
      Texture normalMap2 = assetManager.loadTexture("com/l2client/test/material/chterraingrass01_n.dds");
      normalMap2.setWrap(WrapMode.Repeat);
      Texture normalMap3 = assetManager.loadTexture("com/l2client/test/material/cobblestone01_n.dds");
      normalMap3.setWrap(WrapMode.Repeat);
      matTerrain.setTexture("NormalMap_0", normalMap0);
      matTerrain.setTexture("NormalMap_1", normalMap1);
      matTerrain.setTexture("NormalMap_2", normalMap2);
      matTerrain.setTexture("NormalMap_3", normalMap3);

        createSky();

       
boolean old = false;

if(old){
      // HEIGHTMAP image (for the terrain heightmap)
      Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
        // CREATE HEIGHTMAP
        AbstractHeightMap heightmap = null;
        try {
            //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);

            heightmap = new ImageBasedHeightMap(heightMapImage.getImage(), .5f);
            heightmap.load();

        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

    private void setupKeys() {
        flyCam.setMoveSpeed(50);
    }

    private void createSky() {
        Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
        Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
        Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
        Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
        Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
        Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");

        Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
        rootNode.attachChild(sky);

    }
View Full Code Here

    // ALPHA map (for splat textures)
    material.setTexture("Alpha", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));

    // HEIGHTMAP image (for the terrain heightmap)
    Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
       
    // GRASS texture
    Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
    grass.setWrap(WrapMode.Repeat);
    material.setTexture("Tex1", grass);
    material.setFloat("Tex1Scale", 64f);

    // DIRT texture
    Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
    dirt.setWrap(WrapMode.Repeat);
    material.setTexture("Tex2", dirt);
    material.setFloat("Tex2Scale", 16f);

    // ROCK texture
    Texture rock = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
    rock.setWrap(WrapMode.Repeat);
    material.setTexture("Tex3", rock);
    material.setFloat("Tex3Scale", 128f);
  }
View Full Code Here

      int channelId, int clusters) {
    Node spatNode = (Node) spatial;
    Node grassLayer = new Node("grass_" + spatial.getName());
    grassLayer.setModelBound(new BoundingBox());

    Texture tex = assetManager.loadTexture(texturePath);
    Material faceMat = new Material(assetManager,
        "/com/l2client/materials/LightingGrass.j3md");
    faceMat.getAdditionalRenderState().setBlendMode(
        RenderState.BlendMode.Alpha);
    faceMat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
View Full Code Here

    MatParam matParam = terrain.getMaterial().getParam("AlphaMap");
    if (matParam == null)// try to get the default one..
      matParam = terrain.getMaterial().getParam("DiffuseMap");
    if (matParam == null)
      return false;
    Texture tex = (Texture) matParam.getValue();
    Image image = tex.getImage();
    Vector2f uv = getPointPercentagePosition(terrain, pos, scaledWidth);

    ByteBuffer buf = image.getData(0);
    int width = image.getWidth();
    int height = image.getHeight();

    int x = (int) (uv.x * width);
    int y = (int) (uv.y * height);

    if (((TextureKey) tex.getKey()).isFlipY())
      y = height - y;
    // compute bytes of image
    int bytes = image.getFormat().getBitsPerPixel() / 8;
    int position = (y * width + x) * bytes;// image dependent..
    position += channelId;// move on by channel id offset
View Full Code Here

    selectionMarker.setLocalTranslation(-0.5f*size, 0.2f, 0.5f*size);
    selectionMarker.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));

      com.jme3.asset.AssetManager am = Singleton.get().getAssetManager().getJmeAssetMan();
      Material mat = new Material(am, "Common/MatDefs/Light/Lighting.j3md");
      Texture sel = am.loadTexture("models/textures/flare4.png");
      sel.setWrap(WrapMode.Repeat);
      mat.setTexture("DiffuseMap", sel);
      mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
      mat.getAdditionalRenderState().setDepthWrite(false);
      selectionMarker.setMaterial(mat);
      selectionMarker.setQueueBucket(Bucket.Transparent);
View Full Code Here

    public static Spatial createSky(AssetManager assetManager, String textureName, boolean sphereMap) {
        TextureKey key = new TextureKey(textureName, true);
        key.setGenerateMips(true);
        key.setAsCube(!sphereMap);
        Texture tex = assetManager.loadTexture(key);
        return createSky(assetManager, tex, sphereMap);
    }
View Full Code Here

TOP

Related Classes of com.jme3.texture.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.