|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectcom.jme3.material.Material
public class Material
Material
describes the rendering style for a given
Geometry
.
A material is essentially a list of {
コンストラクタの概要 | |
---|---|
Material()
Do not use this constructor. |
|
Material(AssetManager contentMan,
java.lang.String defName)
|
|
Material(MaterialDef def)
|
メソッドの概要 | |
---|---|
void |
clearParam(java.lang.String name)
Clear a parameter from this material. |
Material |
clone()
Clones this material. |
int |
compareTo(Material m)
Uses the sorting ID for each material to compare them. |
Technique |
getActiveTechnique()
Returns the currently active technique. |
RenderState |
getAdditionalRenderState()
Acquire the additional render state to apply
for this material. |
java.lang.String |
getAssetName()
Returns the asset key name of the asset from which this material was loaded. |
AssetKey |
getKey()
|
MaterialDef |
getMaterialDef()
Get the material definition (j3md file info) that this
material is implementing. |
MatParam |
getParam(java.lang.String name)
Returns the parameter set on this material with the given name, returns null if the parameter is not set. |
java.util.Collection<MatParam> |
getParams()
Returns a collection of all parameters set on this material. |
int |
getSortId()
Returns the sorting ID or sorting index for this material. |
MatParamTexture |
getTextureParam(java.lang.String name)
Returns the texture parameter set on this material with the given name, returns null if the parameter is not set. |
boolean |
isReceivesShadows()
Check if the material should receive shadows or not. |
boolean |
isTransparent()
Check if the transparent value marker is set on this material. |
void |
preload(RenderManager rm)
Preloads this material for the given render manager. |
void |
read(JmeImporter im)
|
void |
render(Geometry geom,
RenderManager rm)
Called by RenderManager to render the geometry by
using this material. |
void |
selectTechnique(java.lang.String name,
RenderManager renderManager)
Select the technique to use for rendering this material. |
void |
setBoolean(java.lang.String name,
boolean value)
Pass a boolean to the material shader. |
void |
setColor(java.lang.String name,
ColorRGBA value)
Pass a Color to the material shader. |
void |
setFloat(java.lang.String name,
float value)
Pass a float to the material shader. |
void |
setInt(java.lang.String name,
int value)
Pass an int to the material shader. |
void |
setKey(AssetKey key)
|
void |
setMatrix4(java.lang.String name,
Matrix4f value)
Pass a Matrix4f to the material shader. |
void |
setParam(java.lang.String name,
VarType type,
java.lang.Object value)
Pass a parameter to the material shader. |
void |
setReceivesShadows(boolean receivesShadows)
Set if the material should receive shadows or not. |
void |
setTexture(java.lang.String name,
Texture value)
Pass a texture to the material shader. |
void |
setTextureParam(java.lang.String name,
VarType type,
Texture value)
Set a texture parameter. |
void |
setTransparent(boolean transparent)
Set the transparent value marker. |
void |
setVector2(java.lang.String name,
Vector2f value)
Pass a Vector2f to the material shader. |
void |
setVector3(java.lang.String name,
Vector3f value)
Pass a Vector3f to the material shader. |
void |
setVector4(java.lang.String name,
Vector4f value)
Pass a Vector4f to the material shader. |
void |
write(JmeExporter ex)
|
クラス java.lang.Object から継承されたメソッド |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
コンストラクタの詳細 |
---|
public Material(MaterialDef def)
public Material(AssetManager contentMan, java.lang.String defName)
public Material()
メソッドの詳細 |
---|
public java.lang.String getAssetName()
This value will be null
unless this material was loaded
from a .j3m file.
public void setKey(AssetKey key)
Asset
内の setKey
public AssetKey getKey()
Asset
内の getKey
public int getSortId()
The sorting ID is used internally by the system to sort rendering of geometries. It sorted to reduce shader switches, if the shaders are equal, then it is sorted by textures.
public int compareTo(Material m)
java.lang.Comparable<Material>
内の compareTo
m
- The other material to compare to.
this
has a lower sorting ID than m
,
otherwise returns a positive value.public Material clone()
java.lang.Object
内の clone
public Technique getActiveTechnique()
The technique is selected automatically by the RenderManager
based on system capabilities. Users may select their own
technique by using
selectTechnique(java.lang.String, com.jme3.renderer.RenderManager)
.
selectTechnique(java.lang.String, com.jme3.renderer.RenderManager)
public boolean isTransparent()
setTransparent(boolean)
public void setTransparent(boolean transparent)
This value is merely a marker, by itself it does nothing.
Generally model loaders will use this marker to indicate further
up that the material is transparent and therefore any geometries
using it should be put into the transparent
bucket
.
transparent
- the transparent value marker.public boolean isReceivesShadows()
setReceivesShadows(boolean)
public void setReceivesShadows(boolean receivesShadows)
This value is merely a marker, by itself it does nothing.
Generally model loaders will use this marker to indicate
the material should receive shadows and therefore any
geometries using it should have the RenderQueue.ShadowMode.Receive
set
on them.
receivesShadows
- if the material should receive shadows or not.public RenderState getAdditionalRenderState()
render state
to apply
for this material.
The first call to this method will create an additional render state which can be modified by the user to apply any render states in addition to the ones used by the renderer. Only render states which are modified in the additional render state will be applied.
public MaterialDef getMaterialDef()
this
material is implementing.
public MatParam getParam(java.lang.String name)
null
if the parameter is not set.
name
- The parameter name to look up.
public MatParamTexture getTextureParam(java.lang.String name)
null
if the parameter is not set.
name
- The parameter name to look up.
public java.util.Collection<MatParam> getParams()
setParam(java.lang.String, com.jme3.shader.VarType, java.lang.Object)
public void setParam(java.lang.String name, VarType type, java.lang.Object value)
name
- the name of the parameter defined in the material definition (j3md)type
- the type of the parameter VarType
value
- the value of the parameterpublic void clearParam(java.lang.String name)
name
- the name of the parameter to clearpublic void setTextureParam(java.lang.String name, VarType type, Texture value)
name
- The name of the parametertype
- The variable type VarType
value
- The texture value of the parameter.
java.lang.IllegalArgumentException
- is value is nullpublic void setTexture(java.lang.String name, Texture value)
name
- the name of the texture defined in the material definition
(j3md) (for example Texture for Lighting.j3md)value
- the Texture object previously loaded by the asset managerpublic void setMatrix4(java.lang.String name, Matrix4f value)
name
- the name of the matrix defined in the material definition (j3md)value
- the Matrix4f objectpublic void setBoolean(java.lang.String name, boolean value)
name
- the name of the boolean defined in the material definition (j3md)value
- the boolean valuepublic void setFloat(java.lang.String name, float value)
name
- the name of the float defined in the material definition (j3md)value
- the float valuepublic void setInt(java.lang.String name, int value)
name
- the name of the int defined in the material definition (j3md)value
- the int valuepublic void setColor(java.lang.String name, ColorRGBA value)
name
- the name of the color defined in the material definition (j3md)value
- the ColorRGBA valuepublic void setVector2(java.lang.String name, Vector2f value)
name
- the name of the Vector2f defined in the material definition (j3md)value
- the Vector2f valuepublic void setVector3(java.lang.String name, Vector3f value)
name
- the name of the Vector3f defined in the material definition (j3md)value
- the Vector3f valuepublic void setVector4(java.lang.String name, Vector4f value)
name
- the name of the Vector4f defined in the material definition (j3md)value
- the Vector4f valuepublic void selectTechnique(java.lang.String name, RenderManager renderManager)
If name
is "Default", then one of the
default techniques
on the material will be selected. Otherwise, the named technique
will be found in the material definition.
Any candidate technique for selection (either default or named)
must be verified to be compatible with the system, for that, the
renderManager
is queried for capabilities.
name
- The name of the technique to select, pass "Default" to
select one of the default techniques.renderManager
- The render manager
to query for capabilities.
java.lang.IllegalArgumentException
- If "Default" is passed and no default
techniques are available on the material definition, or if a name
is passed but there's no technique by that name.
java.lang.UnsupportedOperationException
- If no candidate technique supports
the system capabilities.public void preload(RenderManager rm)
Preloading the material can ensure that when the material is first used for rendering, there won't be any delay since the material has been already been setup for rendering.
rm
- The render manager to preload forpublic void render(Geometry geom, RenderManager rm)
RenderManager
to render the geometry by
using this material.
geom
- The geometry to renderrm
- The render manager requesting the renderingpublic void write(JmeExporter ex) throws java.io.IOException
Savable
内の write
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
Savable
内の read
java.io.IOException
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |