@Test public void testForcedColorSpace(){ Image img=new Image(Format.RGBA8,2,2,BufferUtils.createByteBuffer(16),null,ColorSpace.sRGB); Image img2=new Image(Format.RGBA8,2,2,BufferUtils.createByteBuffer(16),null,ColorSpace.sRGB); Texture2D tx=new Texture2D(img); Texture2D tx2=new Texture2D(img2); assertTrue(tx2.getImage().getColorSpace()==ColorSpace.sRGB); assertTrue(tx2.getImage().getColorSpace()==ColorSpace.sRGB); AssetManager assetManager = TestUtil.createAssetManager(); MaterialDef def=new MaterialDef(assetManager,"test"); def.addMaterialParamTexture(VarType.Texture2D, "ColorMap",ColorSpace.Linear, null); Material mat=new Material(def); mat.setTexture("ColorMap",tx); assertTrue(tx.getImage().getColorSpace()==ColorSpace.Linear); mat.setTexture("ColorMap",tx2); assertTrue(tx2.getImage().getColorSpace()==ColorSpace.Linear); }
public void setTexture(String name, Texture value) { if (value == null) { clearParam(name); return; } VarType paramType = null; switch (value.getType()) { case TwoDimensional: paramType = VarType.Texture2D; break; case TwoDimensionalArray: paramType = VarType.TextureArray; break; case ThreeDimensional: paramType = VarType.Texture3D; break; case CubeMap: paramType = VarType.TextureCubeMap; break; default: throw new UnsupportedOperationException("Unknown texture type: " + value.getType()); } setTextureParam(name, paramType, value); }
Material implements CloneableSmartAsset, Cloneable, Savable { public void setTexture(String name, Texture value) { if (value == null) { clearParam(name); return; } VarType paramType = null; switch (value.getType()) { case TwoDimensional: paramType = VarType.Texture2D; break; case TwoDimensionalArray: paramType = VarType.TextureArray; break; case ThreeDimensional: paramType = VarType.Texture3D; break; case CubeMap: paramType = VarType.TextureCubeMap; break; default: throw new UnsupportedOperationException("Unknown texture type: " + value.getType()); } setTextureParam(name, paramType, value); } }
Material implements CloneableSmartAsset, Cloneable, Savable { public void setTexture(String name, Texture value) { if (value == null) { clearParam(name); return; } VarType paramType = null; switch (value.getType()) { case TwoDimensional: paramType = VarType.Texture2D; break; case TwoDimensionalArray: paramType = VarType.TextureArray; break; case ThreeDimensional: paramType = VarType.Texture3D; break; case CubeMap: paramType = VarType.TextureCubeMap; break; default: throw new UnsupportedOperationException("Unknown texture type: " + value.getType()); } setTextureParam(name, paramType, value); } Material(MaterialDef def);  Material(AssetManager contentMan, String defName);  Material(); }
Material implements CloneableSmartAsset, Cloneable, Savable { public void setTexture(String name, Texture value) { if (value == null) { clearParam(name); return; } VarType paramType = null; switch (value.getType()) { case TwoDimensional: paramType = VarType.Texture2D; break; case TwoDimensionalArray: paramType = VarType.TextureArray; break; case ThreeDimensional: paramType = VarType.Texture3D; break; case CubeMap: paramType = VarType.TextureCubeMap; break; default: throw new UnsupportedOperationException("Unknown texture type: " + value.getType()); } setTextureParam(name, paramType, value); } Material(MaterialDef def);  Material(AssetManager contentMan, String defName);  Material(); String getAssetName(); String getName(); void setName(String name); @Override void setKey(AssetKey key); @Override AssetKey getKey(); int getSortId(); @Override Material clone(); boolean contentEquals(Object otherObj); int contentHashCode(); Technique getActiveTechnique(); boolean isTransparent(); void setTransparent(boolean transparent); boolean isReceivesShadows(); void setReceivesShadows(boolean receivesShadows); RenderState getAdditionalRenderState(); MaterialDef getMaterialDef(); MatParam getParam(String name); @SuppressWarnings("unchecked") T getParamValue(final String name); MatParamTexture getTextureParam(String name); Collection<MatParam> getParams(); ListMap<String, MatParam> getParamsMap(); void setParam(String name, VarType type, Object value); void clearParam(String name); void setTextureParam(String name, VarType type, Texture value); void setTexture(String name, Texture value); void setMatrix4(String name, Matrix4f value); void setBoolean(String name, boolean value); void setFloat(String name, float value); void setFloat(String name, Float value); void setInt(String name, int value); void setColor(String name, ColorRGBA value); void setUniformBufferObject(final String name, final BufferObject value); void setShaderStorageBufferObject(final String name, final BufferObject value); void setVector2(String name, Vector2f value); void setVector3(String name, Vector3f value); void setVector4(String name, Vector4f value); void selectTechnique(String name, final RenderManager renderManager); void preload(RenderManager renderManager, Geometry geometry); void render(Geometry geometry, LightList lights, RenderManager renderManager); void render(Geometry geom, RenderManager rm); @Override void write(JmeExporter ex); @Override String toString(); @Override @SuppressWarnings("unchecked") void read(JmeImporter im); }
Material implements CloneableSmartAsset, Cloneable, Savable { public void setTexture(String name, Texture value) { if (value == null) { clearParam(name); return; } VarType paramType = null; switch (value.getType()) { case TwoDimensional: paramType = VarType.Texture2D; break; case TwoDimensionalArray: paramType = VarType.TextureArray; break; case ThreeDimensional: paramType = VarType.Texture3D; break; case CubeMap: paramType = VarType.TextureCubeMap; break; default: throw new UnsupportedOperationException("Unknown texture type: " + value.getType()); } setTextureParam(name, paramType, value); } Material(MaterialDef def);  Material(AssetManager contentMan, String defName);  Material(); String getAssetName(); String getName(); void setName(String name); @Override void setKey(AssetKey key); @Override AssetKey getKey(); int getSortId(); @Override Material clone(); boolean contentEquals(Object otherObj); int contentHashCode(); Technique getActiveTechnique(); boolean isTransparent(); void setTransparent(boolean transparent); boolean isReceivesShadows(); void setReceivesShadows(boolean receivesShadows); RenderState getAdditionalRenderState(); MaterialDef getMaterialDef(); MatParam getParam(String name); @SuppressWarnings("unchecked") T getParamValue(final String name); MatParamTexture getTextureParam(String name); Collection<MatParam> getParams(); ListMap<String, MatParam> getParamsMap(); void setParam(String name, VarType type, Object value); void clearParam(String name); void setTextureParam(String name, VarType type, Texture value); void setTexture(String name, Texture value); void setMatrix4(String name, Matrix4f value); void setBoolean(String name, boolean value); void setFloat(String name, float value); void setFloat(String name, Float value); void setInt(String name, int value); void setColor(String name, ColorRGBA value); void setUniformBufferObject(final String name, final BufferObject value); void setShaderStorageBufferObject(final String name, final BufferObject value); void setVector2(String name, Vector2f value); void setVector3(String name, Vector3f value); void setVector4(String name, Vector4f value); void selectTechnique(String name, final RenderManager renderManager); void preload(RenderManager renderManager, Geometry geometry); void render(Geometry geometry, LightList lights, RenderManager renderManager); void render(Geometry geom, RenderManager rm); @Override void write(JmeExporter ex); @Override String toString(); @Override @SuppressWarnings("unchecked") void read(JmeImporter im); static final int SAVABLE_VERSION; }