/** * 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); } }
/** * 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); } }
protected void loadTextures(AssetManager manager) { normalTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/water_normalmap.png"); dudvTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/dudv_map.jpg"); normalTexture.setWrap(WrapMode.Repeat); dudvTexture.setWrap(WrapMode.Repeat); }
/** * 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); } }
public Texture2D readTexture(JsonObject texture, boolean flip) throws IOException { if (texture == null) { return null; } Integer textureIndex = getAsInteger(texture, "index"); assertNotNull(textureIndex, "Texture as no index"); assertNotNull(textures, "There are no textures, yet one is referenced by a material"); JsonObject textureData = textures.get(textureIndex).getAsJsonObject(); Integer sourceIndex = getAsInteger(textureData, "source"); Integer samplerIndex = getAsInteger(textureData, "sampler"); Texture2D texture2d = readImage(sourceIndex, flip); if (samplerIndex != null) { texture2d = readSampler(samplerIndex, texture2d); } else { texture2d.setWrap(Texture.WrapMode.Repeat); } texture2d = customContentManager.readExtensionAndExtras("texture", texture, texture2d); return texture2d; }
public Texture2D readSampler(int samplerIndex, Texture2D texture) throws IOException { if (samplers == null) { throw new AssetLoadException("No samplers defined"); } JsonObject sampler = samplers.get(samplerIndex).getAsJsonObject(); Texture.MagFilter magFilter = getMagFilter(getAsInteger(sampler, "magFilter")); Texture.MinFilter minFilter = getMinFilter(getAsInteger(sampler, "minFilter")); Texture.WrapMode wrapS = getWrapMode(getAsInteger(sampler, "wrapS")); Texture.WrapMode wrapT = getWrapMode(getAsInteger(sampler, "wrapT")); if (magFilter != null) { texture.setMagFilter(magFilter); } if (minFilter != null) { texture.setMinFilter(minFilter); } texture.setWrap(Texture.WrapAxis.S, wrapS); texture.setWrap(Texture.WrapAxis.T, wrapT); texture = customContentManager.readExtensionAndExtras("texture.sampler", sampler, texture); return texture; }
/** * Creates a new atlas texture for the given map name. * @param mapName * @return the atlas texture */ public Texture getAtlasTexture(String mapName) { if (images == null) { return null; } byte[] image = images.get(mapName); if (image != null) { //TODO check if color space shouldn't be sRGB Texture2D tex = new Texture2D(new Image(format, atlasWidth, atlasHeight, BufferUtils.createByteBuffer(image), null, ColorSpace.Linear)); tex.setMagFilter(Texture.MagFilter.Bilinear); tex.setMinFilter(Texture.MinFilter.BilinearNearestMipMap); tex.setWrap(Texture.WrapMode.EdgeClamp); return tex; } return null; }
@Override protected Texture toJmeObject() { Image image = null; TextureKey key = null; if (media != null) { image = (Image) media.getJmeObject(); key = media.getTextureKey(); } if (image == null) { image = PlaceholderAssets.getPlaceholderImage(assetManager); } Texture2D tex = new Texture2D(image); if (key != null) { tex.setKey(key); tex.setName(key.getName()); tex.setAnisotropicFilter(key.getAnisotropy()); } tex.setMinFilter(MinFilter.Trilinear); tex.setMagFilter(MagFilter.Bilinear); if (wrapModeU == 0) { tex.setWrap(WrapAxis.S, WrapMode.Repeat); } if (wrapModeV == 0) { tex.setWrap(WrapAxis.T, WrapMode.Repeat); } return tex; }
protected void loadTextures(AssetManager manager) { normalTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/water_normalmap.png"); dudvTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/dudv_map.jpg"); normalTexture.setWrap(WrapMode.Repeat); dudvTexture.setWrap(WrapMode.Repeat); }
/** * 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); } }
/** * 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); } }
protected void loadTextures(AssetManager manager) { normalTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/water_normalmap.png"); dudvTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/dudv_map.jpg"); normalTexture.setWrap(WrapMode.Repeat); dudvTexture.setWrap(WrapMode.Repeat); }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
protected void loadTextures(AssetManager manager) { normalTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/water_normalmap.png"); dudvTexture = (Texture2D) manager.loadTexture("Common/MatDefs/Water/Textures/dudv_map.jpg"); normalTexture.setWrap(WrapMode.Repeat); dudvTexture.setWrap(WrapMode.Repeat); }