com.jme3.material.package.html Maven / Gradle / Ivy
Show all versions of jme3-core Show documentation
The com.jme3.material
package contains classes for manipulating
jMonkeyEngine materials.
Materials are applied to {@link com.jme3.scene.Geometry geometries} in the
scene.
Each geometry has a single material which is used to render that
geometry.
Materials (also known as material instances) are extended from
material definitions.
Material definitions
Material definitions provide the "logic" for the material. Usually a shader that
will handle drawing the object, and corresponding parameters that allow
configuration of the shader.
Material definitions can be created through J3MD files.
The J3MD file abstracts the shader and its configuration away from the user, allowing a
simple interface where one can simply set a few parameters on the material to change its
appearance and the way its handled.
Techniques
Techniques specify a specific way of rendering a material. Typically
a technique is used to implement the same material for each configuration
of the system. For GPUs that do not support shaders, a "fixed function pipeline"
technique could exist to take care of rendering for that configuration
Render states
See {@link com.jme3.material.RenderState}.
Example Usage
Creating a textured material
// Create a material instance
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
// Load the texture.
Texture tex = assetManager.loadTexture("Textures/Test/Test.jpg");
// Set the parameters
mat.setTexture("ColorMap", tex);