com.jme3.texture.Texture.WrapMode Java Examples
The following examples show how to use
com.jme3.texture.Texture.WrapMode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TerrainEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void doSetNormalMap(int layer, Texture tex) { Terrain terrain = (Terrain) getTerrain(null); if (terrain == null) return; if (tex == null) { // remove the texture if it is null if (layer == 0) terrain.getMaterial().clearParam("NormalMap"); else terrain.getMaterial().clearParam("NormalMap_"+layer); return; } tex.setWrap(WrapMode.Repeat); if (layer == 0) terrain.getMaterial().setTexture("NormalMap", tex); else terrain.getMaterial().setTexture("NormalMap_"+layer, tex); setNeedsSave(true); }
Example #2
Source File: HelloPhysics.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
/** Initialize the materials used in this scene. */ public void initMaterials() { wall_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); wall_mat.setTexture("ColorMap", tex); stone_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); stone_mat.setTexture("ColorMap", tex2); floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); floor_mat.setTexture("ColorMap", tex3); }
Example #3
Source File: TestSpotLight.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void setupFloor(){ Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); // mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setFloat("Shininess",3); // mat.setBoolean("VertexLighting", true); Box floor = new Box(Vector3f.ZERO, 50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #4
Source File: TestBrickWall.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void initMaterial() { mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); mat.setTexture("ColorMap", tex); mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); mat3.setTexture("ColorMap", tex3); }
Example #5
Source File: TestBrickTower.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void initMaterial() { mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); mat.setTexture("ColorMap", tex); mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); mat3.setTexture("ColorMap", tex3); }
Example #6
Source File: TestParallax.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void setupFloor() { mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall2.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setFloat("Shininess", 0); Node floorGeom = (Node) assetManager.loadAsset("Models/WaterTest/WaterTest.mesh.xml"); Geometry g = ((Geometry) floorGeom.getChild(0)); g.getMesh().scaleTextureCoordinates(new Vector2f(10, 10)); TangentBinormalGenerator.generate(floorGeom); floorGeom.setLocalTranslation(0, 22, 0); floorGeom.setLocalScale(100); floorGeom.setMaterial(mat); rootNode.attachChild(floorGeom); }
Example #7
Source File: TerrainEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void doSetDiffuseTexture(int layer, String texturePath) { if (texturePath == null || texturePath.equals("")) texturePath = DEFAULT_TERRAIN_TEXTURE; Texture tex = SceneApplication.getApplication().getAssetManager().loadTexture(texturePath); tex.setWrap(WrapMode.Repeat); Terrain terrain = (Terrain) getTerrain(null); if (layer == 0) terrain.getMaterial().setTexture("DiffuseMap", tex); else terrain.getMaterial().setTexture("DiffuseMap_"+layer, tex); doSetTextureScale(layer, DEFAULT_TEXTURE_SCALE); setNeedsSave(true); }
Example #8
Source File: FbxTexture.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public FbxTexture(SceneLoader scene, FbxElement element) { super(scene, element); for(FbxElement e : element.children) { switch(e.id) { case "Type": bindType = (String) e.properties.get(0); break; case "FileName": filename = (String) e.properties.get(0); break; } } texture = new Texture2D(); texture.setName(name); texture.setWrap(WrapMode.Repeat); // Default FBX wrapping. TODO: Investigate where this is stored (probably, in material) }
Example #9
Source File: TestBatchNodeTower.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void initMaterial() { mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); mat.setTexture("ColorMap", tex); mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); mat3.setTexture("ColorMap", tex3); }
Example #10
Source File: TestBatchNodeTower.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void initMaterial() { mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); mat.setTexture("ColorMap", tex); mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); mat3.setTexture("ColorMap", tex3); }
Example #11
Source File: TestBrickTower.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void initMaterial() { mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); mat.setTexture("ColorMap", tex); mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); mat3.setTexture("ColorMap", tex3); }
Example #12
Source File: TestBrickWall.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void initMaterial() { mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); mat.setTexture("ColorMap", tex); mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); mat3.setTexture("ColorMap", tex3); }
Example #13
Source File: TestBatchedTower.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void initMaterial() { mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); mat.setTexture("ColorMap", tex); mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); mat3.setTexture("ColorMap", tex3); }
Example #14
Source File: TestSpotLight.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void setupFloor(){ Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); // mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setFloat("Shininess",3); // mat.setBoolean("VertexLighting", true); Box floor = new Box(50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #15
Source File: TestSpotLightShadows.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void setupFloor() { Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setBoolean("UseMaterialColors", true); mat.setColor("Diffuse", ColorRGBA.White.clone()); mat.setColor("Ambient", ColorRGBA.White.clone()); // mat.setColor("Specular", ColorRGBA.White.clone()); // mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat); mat.setFloat("Shininess", 0); // mat.setBoolean("VertexLighting", true); Box floor = new Box(50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #16
Source File: HelloPhysics.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** Initialize the materials used in this scene. */ public void initMaterials() { wall_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg"); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); wall_mat.setTexture("ColorMap", tex); stone_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG"); key2.setGenerateMips(true); Texture tex2 = assetManager.loadTexture(key2); stone_mat.setTexture("ColorMap", tex2); floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); floor_mat.setTexture("ColorMap", tex3); }
Example #17
Source File: TerrainEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void doSetNormalMap(int layer, String texturePath) { Terrain terrain = (Terrain) getTerrain(null); if (terrain == null) return; if (texturePath == null) { // remove the texture if it is null if (layer == 0) terrain.getMaterial().clearParam("NormalMap"); else terrain.getMaterial().clearParam("NormalMap_"+layer); } else { Texture tex = SceneApplication.getApplication().getAssetManager().loadTexture(texturePath); tex.setWrap(WrapMode.Repeat); if (layer == 0) terrain.getMaterial().setTexture("NormalMap", tex); else terrain.getMaterial().setTexture("NormalMap_"+layer, tex); } enableTextureButtons(); setNeedsSave(true); }
Example #18
Source File: TestEverything.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void setupFloor(){ Material mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat); Box floor = new Box(Vector3f.ZERO, 50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #19
Source File: MaterialLoader.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void readTextureUnitStatement(Statement statement){ String[] split = statement.getLine().split(" ", 2); String keyword = split[0]; if (keyword.equals("texture")){ readTextureImage(split[1]); }else if (keyword.equals("tex_address_mode")){ String mode = split[1]; if (mode.equals("wrap")){ textures[texUnit].setWrap(WrapMode.Repeat); }else if (mode.equals("clamp")){ textures[texUnit].setWrap(WrapMode.Clamp); }else if (mode.equals("mirror")){ textures[texUnit].setWrap(WrapMode.MirroredRepeat); }else if (mode.equals("border")){ textures[texUnit].setWrap(WrapMode.BorderClamp); } }else if (keyword.equals("filtering")){ // ignored.. only anisotropy is considered }else if (keyword.equals("tex_coord_set")){ int texCoord = Integer.parseInt(split[1]); if (texCoord == 1){ separateTexCoord = true; } }else if (keyword.equals("max_anisotropy")){ int amount = Integer.parseInt(split[1]); textures[texUnit].setAnisotropicFilter(amount); }else{ logger.log(Level.WARNING, "Unsupported texture_unit directive: {0}", keyword); } }
Example #20
Source File: TestPostFilters.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void setupFloor() { Material mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m"); mat.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("NormalMap").getTextureValue().setWrap(WrapMode.Repeat); mat.getTextureParam("ParallaxMap").getTextureValue().setWrap(WrapMode.Repeat); Box floor = new Box(Vector3f.ZERO, 50, 1f, 50); TangentBinormalGenerator.generate(floor); floor.scaleTextureCoordinates(new Vector2f(5, 5)); Geometry floorGeom = new Geometry("Floor", floor); floorGeom.setMaterial(mat); floorGeom.setShadowMode(ShadowMode.Receive); rootNode.attachChild(floorGeom); }
Example #21
Source File: MTLLoader.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
protected Texture loadTexture(String path){ String[] split = path.trim().split("\\p{javaWhitespace}+"); // will crash if path is an empty string path = split[split.length-1]; String name = new File(path).getName(); TextureKey key = new TextureKey(folderName + name); key.setGenerateMips(true); Texture texture = assetManager.loadTexture(key); if (texture != null){ texture.setWrap(WrapMode.Repeat); } return texture; }
Example #22
Source File: WaterFilter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Sets the foam texture * @param foamTexture */ public void setFoamTexture(Texture2D foamTexture) { this.foamTexture = foamTexture; foamTexture.setWrap(WrapMode.Repeat); if (material != null) { material.setTexture("FoamMap", foamTexture); } }
Example #23
Source File: WaterFilter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Sets the height texture * @param heightTexture */ public void setHeightTexture(Texture2D heightTexture) { this.heightTexture = heightTexture; heightTexture.setWrap(WrapMode.Repeat); if (material != null) { material.setTexture("HeightMap", heightTexture); } }
Example #24
Source File: WaterFilter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Sets the normal Texture * @param normalTexture */ public void setNormalTexture(Texture2D normalTexture) { this.normalTexture = normalTexture; normalTexture.setWrap(WrapMode.Repeat); if (material != null) { material.setTexture("NormalMap", normalTexture); } }
Example #25
Source File: MaterialManager.java From OpenRTS with MIT License | 5 votes |
public static Material getLightingTexture(String texturePath) { // We first check if the requested texture exist in the material map if (texturesMap.containsKey(texturePath)) { return texturesMap.get(texturePath); } // At this point, we know that the texture doesn't exist. // We must create a new material, add it to the map and return it. Material res = new Material(am, "Common/MatDefs/Light/Lighting.j3md"); Texture t = am.loadTexture(texturePath); t.setWrap(WrapMode.Repeat); t.setAnisotropicFilter(8); res.setTexture("DiffuseMap", t); res.setFloat("Shininess", 10f); // [0,128] // test for envmap // TextureCubeMap envmap = new TextureCubeMap(assetManager.loadTexture("Textures/cubemap_reflec.dds").getImage()); // res.setTexture("EnvMap", envmap); // res.setVector3("FresnelParams", new Vector3f(0.05f, 0.18f, 0.11f)); // res.setVector3("FresnelParams", new Vector3f(0.05f, 0.05f, 0.05f)); // normal map loading // String normalPath = texturePath.replaceAll(".jpg", "norm.jpg");; // try { // Texture normalMap = assetManager.loadTexture(normalPath); // normalMap.setWrap(WrapMode.Repeat); // normalMap.setAnisotropicFilter(8); // res.setTexture("NormalMap", normalMap); // }catch (Exception e) { // LogUtil.logger.info("No normal map found for "+texturePath); // } texturesMap.put(texturePath, res); return res; }
Example #26
Source File: MatParam.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
private String getWrapMode(Texture texVal, Texture.WrapAxis axis) { WrapMode mode = WrapMode.EdgeClamp; try{ mode = texVal.getWrap(axis); }catch (IllegalArgumentException e){ //this axis doesn't exist on the texture return ""; } if(mode != WrapMode.EdgeClamp){ return"Wrap"+ mode.name() + "_" + axis.name() + " "; } return ""; }
Example #27
Source File: WaterFilter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Sets the normal texture. * * @param normalTexture the normal texture. */ public void setNormalTexture(Texture2D normalTexture) { this.normalTexture = normalTexture; normalTexture.setWrap(WrapMode.Repeat); if (material != null) { material.setTexture("NormalMap", normalTexture); } }
Example #28
Source File: WaterFilter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Sets the height texture * * @param heightTexture */ public void setHeightTexture(Texture2D heightTexture) { this.heightTexture = heightTexture; heightTexture.setWrap(WrapMode.Repeat); if (material != null) { material.setTexture("HeightMap", heightTexture); } }
Example #29
Source File: WaterFilter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Sets the foam texture. * * @param foamTexture the foam texture. */ public void setFoamTexture(Texture2D foamTexture) { this.foamTexture = foamTexture; foamTexture.setWrap(WrapMode.Repeat); if (material != null) { material.setTexture("FoamMap", foamTexture); } }
Example #30
Source File: MaterialLoader.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void readTextureUnitStatement(Statement statement){ String[] split = statement.getLine().split(" ", 2); String keyword = split[0]; if (keyword.equals("texture")){ if (split.length < 2) { logger.log(Level.WARNING, "Invalid texture directive, no image specified at [{0}]", statement.getLineNumber()); return; } readTextureImage(split[1]); }else if (keyword.equals("tex_address_mode")){ String mode = split[1]; if (mode.equals("wrap")){ textures[texUnit].setWrap(WrapMode.Repeat); }else if (mode.equals("clamp")){ textures[texUnit].setWrap(WrapMode.EdgeClamp); }else if (mode.equals("mirror")){ textures[texUnit].setWrap(WrapMode.MirroredRepeat); }else if (mode.equals("border")){ textures[texUnit].setWrap(WrapMode.BorderClamp); } }else if (keyword.equals("filtering")){ // ignored.. only anisotropy is considered }else if (keyword.equals("tex_coord_set")){ int texCoord = Integer.parseInt(split[1]); if (texCoord == 1){ separateTexCoord = true; } }else if (keyword.equals("max_anisotropy")){ int amount = Integer.parseInt(split[1]); textures[texUnit].setAnisotropicFilter(amount); }else{ logger.log(Level.WARNING, "Unsupported texture_unit directive: {0}", keyword); } }