Package com.jme3.util
Class MaterialDebugAppState
java.lang.Object
com.jme3.app.state.AbstractAppState
com.jme3.util.MaterialDebugAppState
- All Implemented Interfaces:
- AppState
This appState is for debug purpose only, and was made to provide an easy way 
 to test shaders, with a live update capability.
 
 This class provides and easy way to reload a material and catches compilation
 errors when needed and displays the error in the console.
 
 If no error occur on compilation, the material is reloaded in the scene.
 
 You can either trigger the reload when pressing a key (or whatever input is 
 supported by Triggers you can attach to the input manager), or trigger it 
 when a specific file (the shader source) has been changed on the hard drive.
 
 Usage : 
 
 MaterialDebugAppState matDebug = new MaterialDebugAppState();
 stateManager.attach(matDebug);
 matDebug.registerBinding(new KeyTrigger(KeyInput.KEY_R), whateverGeometry);  
 
 this will reload the material of whateverGeometry when pressing the R key.
 
 matDebug.registerBinding("Shaders/distort.frag", whateverGeometry); 
 
 this will reload the material of whateverGeometry when the given file is 
 changed on the hard drive.
 
 you can also register bindings to the appState with a post process Filter
- 
Field SummaryFields inherited from class com.jme3.app.state.AbstractAppStateinitialized
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidinitialize(AppStateManager stateManager, Application app) Called byAppStateManagerwhen transitioning thisAppStatefrom initializing to running.
 This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)was called.voidregisterBinding(Trigger trigger, Filter filter) Will reload the filter's materials whenever the trigger is fired.voidregisterBinding(Trigger trigger, Spatial spat) Will reload the spatial's materials whenever the trigger is firedvoidregisterBinding(String shaderName, Filter filter) Will reload the filter's materials whenever the shader file is changed on the hard drivevoidregisterBinding(String shaderName, Spatial spat) Will reload the spatial's materials whenever the shader file is changed on the hard drivereloadMaterial(Material mat) voidupdate(float tpf) Called to update theAppState.Methods inherited from class com.jme3.app.state.AbstractAppStatecleanup, getId, isEnabled, isInitialized, postRender, render, setEnabled, setId, stateAttached, stateDetached
- 
Constructor Details- 
MaterialDebugAppStatepublic MaterialDebugAppState()
 
- 
- 
Method Details- 
initializeDescription copied from interface:AppStateCalled byAppStateManagerwhen transitioning thisAppStatefrom initializing to running.
 This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)was called.AppStateManagerwill call this only from the update loop inside the rendering thread. This means is it safe to modify the scene graph from this method.- Specified by:
- initializein interface- AppState
- Overrides:
- initializein class- AbstractAppState
- Parameters:
- stateManager- The state manager
- app- The application
 
- 
registerBindingWill reload the spatial's materials whenever the trigger is fired- Parameters:
- trigger- the trigger
- spat- the spatial to reload
 
- 
registerBindingWill reload the filter's materials whenever the trigger is fired.- Parameters:
- trigger- the trigger
- filter- the filter to reload
 
- 
registerBindingWill reload the filter's materials whenever the shader file is changed on the hard drive- Parameters:
- shaderName- the shader name (relative path to the asset folder or to a registered asset path)
- filter- the filter to reload
 
- 
registerBindingWill reload the spatial's materials whenever the shader file is changed on the hard drive- Parameters:
- shaderName- the shader name (relative path to the asset folder or to a registered asset path)
- spat- the spatial to reload
 
- 
reloadMaterial
- 
updatepublic void update(float tpf) Description copied from interface:AppStateCalled to update theAppState. This method will be called every render pass if theAppStateis both attached and enabled.- Specified by:
- updatein interface- AppState
- Overrides:
- updatein class- AbstractAppState
- Parameters:
- tpf- Time since the last call to update(), in seconds.
 
 
-