|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jme.scene.state.RenderState
public abstract class RenderState
RenderState is the base class for all states that affect the
rendering of a piece of geometry. They aren't created directly, but are
created for users from the renderer. The renderstate of a parent affects its
children and it is OK to assign to more than one Spatial the same render
state.
| Field Summary | |
|---|---|
static boolean[] |
QUICK_COMPARE
If false, each renderstate of that type is always applied in the renderer and only field by field checks are done to minimize jni overhead. |
static int |
RS_BLEND
The value returned by getType() for BlendState. |
static int |
RS_CLIP
The value returned by getType() for ClipState. |
static int |
RS_COLORMASK_STATE
The value returned by getType() for ColorMaskState. |
static int |
RS_CULL
The value returned by getType() for CullState. |
static int |
RS_FOG
The value returned by getType() for FogState. |
static int |
RS_FRAGMENT_PROGRAM
The value returned by getType() for FragmentProgramState. |
static int |
RS_GLSL_SHADER_OBJECTS
The value returned by getType() for ShaderObjectsState. |
static int |
RS_LIGHT
The value returned by getType() for LightState. |
static int |
RS_MATERIAL
The value returend by getType() for MaterialState. |
static int |
RS_MAX_STATE
The total number of diffrent types of RenderState. |
static int |
RS_SHADE
The value returned by getType() for ShadeState. |
static int |
RS_STENCIL
The value returned by getType() for StencilState. |
static int |
RS_TEXTURE
The value returned by getType() for TextureState. |
static int |
RS_VERTEX_PROGRAM
The value returned by getType() for VertexProgramState. |
static int |
RS_WIREFRAME
The value returned by getType() for WireframeState. |
static int |
RS_ZBUFFER
The value returned by getType() for ZBufferState. |
| Constructor Summary | |
|---|---|
RenderState()
Construts a new RenderState. |
|
| Method Summary | |
|---|---|
abstract void |
apply()
This function is defined in the RenderState that is actually used by the Renderer. |
abstract StateRecord |
createStateRecord()
|
RenderState |
extract(Stack stack,
Spatial spat)
Extracts from the stack the correct renderstate that should apply to the given spatial. |
Class |
getClassTag()
|
abstract int |
getType()
Defined by the subclass, this returns an int identifying the renderstate. |
boolean |
isEnabled()
Returns if this render state is enabled during rendering. |
boolean |
needsRefresh()
|
void |
read(JMEImporter e)
|
void |
setEnabled(boolean value)
Sets if this render state is enabled during rendering. |
void |
setNeedsRefresh(boolean refresh)
This should be called by states when it knows internal data has been altered. |
static void |
setQuickCompares(boolean enabled)
|
void |
write(JMEExporter e)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int RS_BLEND
public static final int RS_FOG
public static final int RS_LIGHT
public static final int RS_MATERIAL
public static final int RS_SHADE
public static final int RS_TEXTURE
public static final int RS_WIREFRAME
public static final int RS_ZBUFFER
public static final int RS_CULL
public static final int RS_VERTEX_PROGRAM
public static final int RS_FRAGMENT_PROGRAM
public static final int RS_STENCIL
public static final int RS_GLSL_SHADER_OBJECTS
public static final int RS_COLORMASK_STATE
public static final int RS_CLIP
public static final int RS_MAX_STATE
public static boolean[] QUICK_COMPARE
If false, each renderstate of that type is always applied in the renderer and only field by field checks are done to minimize jni overhead. This is slower than setting to true, but relieves the programmer from situations where he has to remember to update the needsRefresh field of a state.
If true, each renderstate of that type is checked for == with the last applied renderstate of the same type. If same and the state's needsRefresh method returns false, then application of the renderstate is skipped. This can be much faster than setting false, but in certain circumstances, the programmer must manually set needsRefresh (for example, in a FogState, if you call getFogColor().set(....) to change the color, the fogstate will not set the needsRefresh field. In non-quick compare mode, this is not a problem because it will go into the apply method and do an actual check of the current fog color in opengl vs. the color in the state being applied.)
DEFAULTS:
| Constructor Detail |
|---|
public RenderState()
| Method Detail |
|---|
public abstract int getType()
public boolean isEnabled()
public void setEnabled(boolean value)
value - False if the state is to be disabled, true otherwise.public abstract void apply()
public RenderState extract(Stack stack,
Spatial spat)
stack - The stack to extract render states from.spat - The spatial to apply the render states too.
public void write(JMEExporter e)
throws IOException
write in interface SavableIOException
public void read(JMEImporter e)
throws IOException
read in interface SavableIOExceptionpublic Class getClassTag()
getClassTag in interface Savablepublic abstract StateRecord createStateRecord()
public boolean needsRefresh()
public void setNeedsRefresh(boolean refresh)
refresh - true if we should apply this state even if we think it is the
current state of its type in the current context.public static void setQuickCompares(boolean enabled)
enabled - QUICK_COMPARE
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||