<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE RENDER_MONKEY [
   <!ELEMENT RENDER_MONKEY
   (
      RmEffectWorkspace |
      RmRegistryBranch |
      RmClipboardNode
   )?>

   <!ELEMENT RmEffectWorkspace 
   (
      RmRegistryBranch?,
      RmPlugInData?,
      RmStringVariable*,
      (
         ( RmDirectXEffect, RmOpenGLEffect?, RmOpenGLESEffect? ) |
         ( RmOpenGLEffect, RmDirectXEffect?, RmOpenGLESEffect? ) |
         ( RmOpenGLESEffect, RmDirectXEffect?, RmOpenGLEffect? )
      )?,
      (
         RmBooleanVariable |
         RmIntegerVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmColorVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmRenderableTexture |
         RmStreamMap |
         RmModelData |
         RmEffectGroup
      )*
   )>

   <!ELEMENT RmEffectGroup
   ( 
      RmPlugInData?,
      (
         RmStringVariable |
         RmDirectXEffect |
         RmOpenGLEffect |
         RmOpenGLESEffect |
         RmBooleanVariable |
         RmIntegerVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmColorVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmRenderableTexture |
         RmStreamMap |
         RmModelData
      )*
   )>

   <!ELEMENT RmDirectXEffect
   ( 
      RmPlugInData?,
      (
         RmStringVariable |
         RmCamera |
         RmBooleanVariable |
         RmIntegerVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmColorVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmRenderableTexture |
         RmStreamMap |
         RmModelData |
         RmPass
      )*
   )>

   <!ELEMENT RmOpenGLEffect
   (
      RmPlugInData?,
      (
         RmStringVariable |
         RmCamera |
         RmBooleanVariable |
         RmIntegerVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmColorVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmRenderableTexture |
         RmStreamMap |
         RmModelData |
         RmGLPass
      )*
   )>
   
   <!ELEMENT RmOpenGLESEffect
   (
      RmPlugInData?,
      (
         RmStringVariable |
         RmCamera |
         RmBooleanVariable |
         RmIntegerVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmColorVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmRenderableTexture |
         RmStreamMap |
         RmModelData |
         RmGLESPass
      )*
   )>

   <!ELEMENT RmPass
   ( 
      RmPlugInData?,
      RmStringVariable*,
      RmCameraReference?,
      RmModelReference?,
      RmRenderStateBlock?,
      (
         (
         ( RmHLSLShader | RmShader ),
         ( RmShader | RmHLSLShader )?
         )
      )?,
      RmRenderTarget*,
      RmTessellationNode?,
      RmStreamMapReference?,
      (
         RmBooleanVariable |
         RmIntegerVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmColorVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmTextureObject |
         RmLightObject |
         RmMaterialObject
         )*
      )>
                                                                     
   <!ELEMENT RmGLPass
   ( 
      RmPlugInData?,
      RmStringVariable*,
      RmCameraReference?,
      RmModelReference?,
      RmRenderStateBlock?,
      (
         ( RmGLShader, RmGLShader? ) 
      )?,
      RmRenderTarget?,
      RmStreamMapReference?,
      (
         RmBooleanVariable |
         RmIntegerVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmColorVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmTextureObject |
         RmLightObject |
         RmMaterialObject |
         RmShaderConstant |
         RmSampler
         )*
      )>

   <!ELEMENT RmGLESPass
   ( 
      RmPlugInData?,
      RmStringVariable*,
      RmCameraReference?,
      RmModelReference?,
      RmRenderStateBlock?,
      (
         ( RmGLESShader, RmGLESShader? ) 
      )?,
      RmRenderTarget?,
      RmStreamMapReference?,
      (
         RmBooleanVariable |
         RmIntegerVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmColorVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmTextureObject |
         RmLightObject |
         RmMaterialObject |
         RmShaderConstant |
         RmSampler
         )*
      )>      
      
   <!ELEMENT RmShader
   ( 
      RmShaderCode,
      RmPlugInData?,
      (
      RmStringVariable |
      RmShaderConstant
      )*
   )>

   <!ELEMENT RmHLSLShader
   ( 
      RmShaderCode,
      RmPlugInData?,
      (
      RmStringVariable |
      RmShaderConstant |
      RmSampler
      )*
   )>

   <!ELEMENT RmGLShader
   ( 
      RmShaderCode,
      RmPlugInData?,
      (
      RmStringVariable
      )*
   )>

   <!ELEMENT RmGLESShader
   ( 
      RmShaderCode,
      RmPlugInData?,
      (
      RmStringVariable
      )*
   )>
   
   <!ELEMENT RmTextureObject
   (
      RmPlugInData?,
      RmStringVariable*,
      RmTextureReference?,
      RmState*
   )>

   <!ELEMENT RmLightObject
   (
      RmPlugInData?,
      RmStringVariable*,
      RmLightReference?
   )>
   
   <!ELEMENT RmMaterialObject
   (
      RmPlugInData?,
      RmStringVariable*,
      RmMaterialReference?
   )>
   
   <!ELEMENT RmRenderStateBlock
   (
      RmPlugInData?,
      (
         RmStringVariable |
         RmState 
      )*
   )>

   <!ELEMENT RmTessellationNode
   (
      RmPlugInData?,
      RmStringVariable*
   )>
   
   <!ELEMENT RmStreamMap
   (
      RmPlugInData?,
      (
         RmStringVariable |
         RmStream 
      )*
   )>

   <!ELEMENT RmStream               ( RmPlugInData?, RmStreamChannel* )>

   <!ELEMENT RmModelData            ( RmPlugInData?, RmStringVariable* )>  
   <!ELEMENT RmTextureReference     ( RmPlugInData?, RmStringVariable* )>
   <!ELEMENT RmLightReference       ( RmPlugInData?, RmStringVariable* )>
   <!ELEMENT RmMaterialReference    ( RmPlugInData?, RmStringVariable* )>
   <!ELEMENT RmCameraReference      ( RmPlugInData?, RmStringVariable* )>
   <!ELEMENT RmModelReference       ( RmPlugInData?, RmStringVariable* )>
   <!ELEMENT RmStreamMapReference   ( RmPlugInData?, RmStringVariable* )>   
   <!ELEMENT RmRenderableTexture    ( RmPlugInData?, RmStringVariable* )>   
   <!ELEMENT RmRenderTarget         ( RmPlugInData?, RmStringVariable* )>   
   <!ELEMENT RmBooleanVariable      ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT RmFloatVariable        ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT RmVectorVariable       ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT RmMatrixVariable       ( RmPlugInData?, RmStringVariable? )>   
   <!ELEMENT RmColorVariable        ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT RmIntegerVariable      ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT Rm2DTextureVariable    ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT RmCubemapVariable      ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT Rm3DTextureVariable    ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT RmLightVariable        ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT RmMaterialVariable     ( RmPlugInData?, RmStringVariable? )>
   <!ELEMENT RmCamera               ( RmPlugInData?, RmStringVariable* )>

   <!ELEMENT RmStringVariable       ( RmTextDataBlock, RmPlugInData? )>
   
   <!ELEMENT RmDynamicVariable
   (
      RmDynamicVariableValueContainer,
      RmPlugInData?,
      RmStringVariable?
   )>
   
   <!ELEMENT RmDynamicVariableValueContainer
   (
      RmPlugInData?,
      RmDynamicVariableValue*
   )>
   
   <!ELEMENT RmTextDataBlock        ( #PCDATA ) >
   
   <!ELEMENT RmRegistryBranch
   ( 
      RmTextDataBlock?,
      (
         RmRegistryBranch |
         RmStringVariable |
         RmIntegerVariable |
         RmBooleanVariable |
         RmFloatVariable
      )*      
   )>

   <!ELEMENT RmPlugInData
   ( 
      RmTextDataBlock?,
      (
         RmStringVariable |
         RmIntegerVariable |
         RmBooleanVariable |
         RmFloatVariable |
         RmVectorVariable
      )*      
   )>
   
   <!ELEMENT RmClipboardNode
   (
      RmTextDataBlock?,
      (
         RmEffectWorkspace |
         RmEffectGroup |
         RmDirectXEffect |
         RmOpenGLEffect |
         RmOpenGLESEffect |
         RmPass |
         RmGLPass |
         RmGLESPass |
         RmShader |
         RmHLSLShader |
         RmGLShader |
         RmGLESShader |
         RmShaderConstant |
         RmSampler |
         RmTextureObject |
         RmLightObject |
         RmMaterialObject |
         RmRenderStateBlock |
         RmState |
         RmStreamMap |
         RmStream |
         RmStreamChannel |
         RmModelData |
         RmTextureReference |
         RmLightReference |
         RmMaterialReference |
         RmModelReference |
         RmStreamMapReference |
         RmRenderableTexture |
         RmRenderTarget |
         RmBooleanVariable |
         RmFloatVariable |
         RmVectorVariable |
         RmMatrixVariable |
         RmDynamicVariable |
         RmDynamicVariableValue |
         RmColorVariable |
         RmIntegerVariable |
         RmStringVariable |
         Rm2DTextureVariable |
         RmCubemapVariable |
         Rm3DTextureVariable |
         RmLightVariable |
         RmMaterialVariable |
         RmRegistryBranch |
         RmPlugInData |
         RmCamera |
         RmCameraReference
      )*      
   )>
   
   <!ELEMENT RmStreamChannel        ( RmPlugInData? ) >
   <!ELEMENT RmShaderConstant       ( RmPlugInData? ) >
   <!ELEMENT RmSampler              ( RmPlugInData? ) >
   <!ELEMENT RmState                ( RmPlugInData? ) >
   <!ELEMENT RmDynamicVariableValue ( RmPlugInData? ) >
   
   <!ELEMENT RmShaderCode           ( #PCDATA ) >

   <!ATTLIST RmEffectWorkspace 
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ACTIVE_EFFECT                 CDATA #REQUIRED
      VALIDATION_STRING             CDATA #REQUIRED
      XML_VERSION                   CDATA #REQUIRED
   >                                 

   <!ATTLIST RmEffectGroup           
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
   >                                 

   <!ATTLIST RmDirectXEffect                
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ACTIVE_CAMERA                 CDATA #REQUIRED
   >                                 

   <!ATTLIST RmOpenGLEffect                
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ACTIVE_CAMERA                 CDATA #REQUIRED
   >                                 
   
   <!ATTLIST RmOpenGLESEffect                
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ACTIVE_CAMERA                 CDATA #REQUIRED
   >                                 

   <!ATTLIST RmPass                  
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      PASS_INDEX                    CDATA #REQUIRED
      ENABLED                       ( TRUE | FALSE ) #REQUIRED
   >                                 

   <!ATTLIST RmGLPass                  
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      PASS_INDEX                    CDATA #REQUIRED
      ENABLED                       ( TRUE | FALSE ) #REQUIRED
   >                                 
   
   <!ATTLIST RmGLESPass                  
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      PASS_INDEX                    CDATA #REQUIRED
      ENABLED                       ( TRUE | FALSE ) #REQUIRED
   >                                 
   
   <!ATTLIST RmShader        
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      PIXEL_SHADER                  CDATA #REQUIRED
   >                                 

   <!ATTLIST RmHLSLShader        
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      PIXEL_SHADER                  ( TRUE | FALSE ) #REQUIRED
      TARGET                        CDATA #REQUIRED
      ENTRY_POINT                   CDATA #REQUIRED
      COMPILER_FLAGS                CDATA #REQUIRED
   >  

   <!ATTLIST RmGLShader        
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      PIXEL_SHADER                  ( TRUE | FALSE ) #REQUIRED
   >  
   
   <!ATTLIST RmGLESShader        
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      PIXEL_SHADER                  ( TRUE | FALSE ) #REQUIRED
   >  

   <!ATTLIST RmShaderConstant
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      REGISTER                      CDATA #REQUIRED
   >                                 

   <!ATTLIST RmSampler               
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      REGISTER                      CDATA #REQUIRED
   >

   <!ATTLIST RmTextureObject
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      STATE_INDEX                   CDATA #REQUIRED
      VERTEX_TEXTURE                ( TRUE | FALSE ) #REQUIRED
   >

   <!ATTLIST RmLightObject
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      INDEX                         CDATA #REQUIRED
   >
   
   <!ATTLIST RmMaterialObject
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      INDEX                         CDATA #REQUIRED
   >
   
   <!ATTLIST RmRenderStateBlock
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
   >                                 

   <!ATTLIST RmState                 
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      STATE                         CDATA #REQUIRED
      VALUE                         CDATA #REQUIRED
      USAGE                         CDATA #REQUIRED
   >                               

   <!ATTLIST RmStreamMap           
     NAME                           CDATA #REQUIRED
     API                            CDATA #REQUIRED
   >                               

   <!ATTLIST RmStream              
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      STRIDE                        CDATA #REQUIRED
   >

   <!ATTLIST RmStreamChannel
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      DATA_SIZE                     CDATA #REQUIRED
      DATA_TYPE                     CDATA #REQUIRED
      REGISTER                      CDATA #REQUIRED
      USAGE                         CDATA #REQUIRED
      USAGE_INDEX                   CDATA #REQUIRED
      ATTRIBUTE_NAME                CDATA #REQUIRED
   >

   <!ATTLIST RmModelData
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      FILE_NAME                     CDATA #REQUIRED
      ORIENTATION                   CDATA #REQUIRED
   >

   <!ATTLIST RmTextureReference
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
   >

   <!ATTLIST RmLightReference
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
   >
   
   <!ATTLIST RmMaterialReference
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
   >
   
   <!ATTLIST RmModelReference
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
   >

   <!ATTLIST RmStreamMapReference
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
   >

   <!ATTLIST RmRenderableTexture
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      FILE_NAME                     CDATA #REQUIRED
      ORIGIN                        CDATA #REQUIRED
      WIDTH                         CDATA #REQUIRED
      HEIGHT                        CDATA #REQUIRED
      FORMAT                        CDATA #REQUIRED
      USE_VIEWPORT_DIMENSIONS       ( TRUE | FALSE ) #REQUIRED
      GENERATE_MIPMAPS              ( TRUE | FALSE ) #REQUIRED
      WIDTH_RATIO                   CDATA #REQUIRED
      HEIGHT_RATIO                  CDATA #REQUIRED
   >

   <!ATTLIST RmRenderTarget
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      INDEX                         CDATA #REQUIRED
      RENDER_TO_SCREEN              ( TRUE | FALSE ) #REQUIRED
      COLOR_CLEAR                   ( TRUE | FALSE ) #REQUIRED
      DEPTH_CLEAR                   ( TRUE | FALSE ) #REQUIRED
      CLEAR_COLOR_VALUE             CDATA #REQUIRED
      DEPTH_CLEAR_VALUE             CDATA #REQUIRED
   >
   
   <!ATTLIST RmBooleanVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      VALUE                         CDATA #REQUIRED
   >

   <!ATTLIST RmFloatVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      VALUE                         CDATA #REQUIRED
      MIN                           CDATA #REQUIRED
      MAX                           CDATA #REQUIRED
      CLAMP                         ( TRUE | FALSE ) #REQUIRED
   >

   <!ATTLIST RmVectorVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      VALUE_0                       CDATA #REQUIRED
      VALUE_1                       CDATA #REQUIRED
      VALUE_2                       CDATA #REQUIRED
      VALUE_3                       CDATA #REQUIRED
      MIN                           CDATA #REQUIRED
      MAX                           CDATA #REQUIRED
      CLAMP                         ( TRUE | FALSE ) #REQUIRED
      NORMALIZE                     ( TRUE | FALSE ) #REQUIRED
   >

   <!ATTLIST RmMatrixVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      VALUE_0                       CDATA #REQUIRED
      VALUE_1                       CDATA #REQUIRED
      VALUE_2                       CDATA #REQUIRED
      VALUE_3                       CDATA #REQUIRED
      VALUE_4                       CDATA #REQUIRED
      VALUE_5                       CDATA #REQUIRED
      VALUE_6                       CDATA #REQUIRED
      VALUE_7                       CDATA #REQUIRED
      VALUE_8                       CDATA #REQUIRED
      VALUE_9                       CDATA #REQUIRED
      VALUE_10                      CDATA #REQUIRED
      VALUE_11                      CDATA #REQUIRED
      VALUE_12                      CDATA #REQUIRED
      VALUE_13                      CDATA #REQUIRED
      VALUE_14                      CDATA #REQUIRED
      VALUE_15                      CDATA #REQUIRED
   >

   <!ATTLIST RmDynamicVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      VARIABLE_TYPE                 ( FLOAT | INTEGER | BOOLEAN ) #REQUIRED
      ROWS                          CDATA #REQUIRED
      COLUMNS                       CDATA #REQUIRED
      FIXED_SIZE                    ( TRUE | FALSE ) #REQUIRED
      MIN                           CDATA #REQUIRED
      MAX                           CDATA #REQUIRED
      CLAMP                         ( TRUE | FALSE ) #REQUIRED
      NORMALIZE                     ( TRUE | FALSE ) #REQUIRED
   >
   
   <!ATTLIST RmDynamicVariableValue
      ROW_INDEX                     CDATA #REQUIRED
      COLUMN_INDEX                  CDATA #REQUIRED
      VALUE                         CDATA #REQUIRED
   >
   
   <!ATTLIST RmColorVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      VALUE_0                       CDATA #REQUIRED
      VALUE_1                       CDATA #REQUIRED
      VALUE_2                       CDATA #REQUIRED
      VALUE_3                       CDATA #REQUIRED
   >

   <!ATTLIST RmIntegerVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      VALUE                         CDATA #REQUIRED
      MIN                           CDATA #REQUIRED
      MAX                           CDATA #REQUIRED
      CLAMP                         ( TRUE | FALSE ) #REQUIRED
   >
   
   <!ATTLIST RmStringVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
   >

   <!ATTLIST Rm2DTextureVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      FILE_NAME                     CDATA #REQUIRED
      ORIGIN                        CDATA #REQUIRED
   >

   <!ATTLIST RmCubemapVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      FILE_NAME                     CDATA #REQUIRED
      ORIGIN                        CDATA #REQUIRED
   >

   <!ATTLIST Rm3DTextureVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      FILE_NAME                     CDATA #REQUIRED
      ORIGIN                        CDATA #REQUIRED
   >

   <!ATTLIST RmLightVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      LIGHT_ENABLED                 ( TRUE | FALSE ) #REQUIRED
      LIGHT_TYPE                    ( POSITIONAL | DIRECTIONAL | SPOTLIGHT ) #REQUIRED
      AMBIENT_0                     CDATA #REQUIRED
      AMBIENT_1                     CDATA #REQUIRED
      AMBIENT_2                     CDATA #REQUIRED
      AMBIENT_3                     CDATA #REQUIRED
      DIFFUSE_0                     CDATA #REQUIRED
      DIFFUSE_1                     CDATA #REQUIRED
      DIFFUSE_2                     CDATA #REQUIRED
      DIFFUSE_3                     CDATA #REQUIRED
      SPECULAR_0                    CDATA #REQUIRED
      SPECULAR_1                    CDATA #REQUIRED
      SPECULAR_2                    CDATA #REQUIRED
      SPECULAR_3                    CDATA #REQUIRED
      POSITION_0                    CDATA #REQUIRED
      POSITION_1                    CDATA #REQUIRED
      POSITION_2                    CDATA #REQUIRED
      DIRECTION_0                   CDATA #REQUIRED
      DIRECTION_1                   CDATA #REQUIRED
      DIRECTION_2                   CDATA #REQUIRED
      ATTENUATION_0                 CDATA #REQUIRED
      ATTENUATION_1                 CDATA #REQUIRED
      ATTENUATION_2                 CDATA #REQUIRED
      SPOTLIGHT_THETA               CDATA #REQUIRED
      SPOTLIGHT_PHI                 CDATA #REQUIRED
      RANGE                         CDATA #REQUIRED
      FALLOFF                       CDATA #REQUIRED
   >
   
   <!ATTLIST RmMaterialVariable
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      ARTIST_EDITABLE               ( TRUE | FALSE ) #REQUIRED
      VARIABLE_SEMANTIC             CDATA #REQUIRED
      AMBIENT_0                     CDATA #REQUIRED
      AMBIENT_1                     CDATA #REQUIRED
      AMBIENT_2                     CDATA #REQUIRED
      AMBIENT_3                     CDATA #REQUIRED
      DIFFUSE_0                     CDATA #REQUIRED
      DIFFUSE_1                     CDATA #REQUIRED
      DIFFUSE_2                     CDATA #REQUIRED
      DIFFUSE_3                     CDATA #REQUIRED
      SPECULAR_0                    CDATA #REQUIRED
      SPECULAR_1                    CDATA #REQUIRED
      SPECULAR_2                    CDATA #REQUIRED
      SPECULAR_3                    CDATA #REQUIRED
      EMISSIVE_0                    CDATA #REQUIRED
      EMISSIVE_1                    CDATA #REQUIRED
      EMISSIVE_2                    CDATA #REQUIRED
      EMISSIVE_3                    CDATA #REQUIRED
      SPECULAR_POWER                CDATA #REQUIRED
   >
      
   <!ATTLIST RmRegistryBranch
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      XML_VERSION                   CDATA #REQUIRED
   >
   
   <!ATTLIST RmPlugInData
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      PLUGIN_GUID                   CDATA #REQUIRED
   >

   <!ATTLIST RmClipboardNode
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      XML_VERSION                   CDATA #REQUIRED
   >
   
   <!ATTLIST RmCamera                
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      CAMERA_POSITION_X             CDATA #REQUIRED
      CAMERA_POSITION_Y             CDATA #REQUIRED
      CAMERA_POSITION_Z             CDATA #REQUIRED
      LOOK_AT_VECTOR_X              CDATA #REQUIRED
      LOOK_AT_VECTOR_Y              CDATA #REQUIRED
      LOOK_AT_VECTOR_Z              CDATA #REQUIRED
      UP_VECTOR_X                   CDATA #REQUIRED
      UP_VECTOR_Y                   CDATA #REQUIRED
      UP_VECTOR_Z                   CDATA #REQUIRED
      FOV                           CDATA #REQUIRED
      NEAR_CLIP_PLANE               CDATA #REQUIRED
      FAR_CLIP_PLANE                CDATA #REQUIRED
   >                                 

   <!ATTLIST RmCameraReference                
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      USE_ACTIVE_CAMERA             ( TRUE | FALSE ) #REQUIRED
   >                               
   
   <!ATTLIST RmShaderCode                
      TYPE                          ( TEXT ) #REQUIRED
   >                               
   
   <!ATTLIST RmTextDataBlock                
      TYPE                          ( TEXT ) #REQUIRED
   >                               
   
   <!ATTLIST RmTessellationNode
      NAME                          CDATA #REQUIRED
      API                           CDATA #REQUIRED
      MIN_TESSELLATION_LEVEL        CDATA #REQUIRED
      MAX_TESSELLATION_LEVEL        CDATA #REQUIRED
   >
]>
<RENDER_MONKEY>
 <RmEffectWorkspace NAME="Effect Workspace" API="" ACTIVE_EFFECT="Effect Workspace.Relief Mapping | Phong Reflection Model" VALIDATION_STRING="" XML_VERSION="RenderMonkey 1.71">
  <RmRegistryBranch NAME="RM_REGISTRY" API="" XML_VERSION="RenderMonkey 1.71">
   <RmRegistryBranch NAME="RM_LOCAL" API="" XML_VERSION="RenderMonkey 1.71">
    <RmRegistryBranch NAME="RM_PLUGIN" API="" XML_VERSION="RenderMonkey 1.71"><RmTextDataBlock TYPE="TEXT"><![CDATA[
<DockingPaneLayouts><Application_Layout><Pane-1><Type>2</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><Horiz>1</Horiz><Pane-1>2</Pane-1><Pane-2>3</Pane-2><Pane-3>4</Pane-3><Pane-4>5</Pane-4><Pane-5>6</Pane-5><Pane-6>7</Pane-6><Pane-7>8</Pane-7><Pane-8>9</Pane-8><Pane-9>10</Pane-9><Pane-10>11</Pane-10><Panes>10</Panes></Pane-1><Pane-2><Type>1</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-2><Pane-3><Type>1</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-3><Pane-4><Type>1</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-4><Pane-5><Type>1</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-5><Pane-6><Type>1</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-6><Pane-7><Type>1</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-7><Pane-8><Type>1</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-8><Pane-9><Type>1</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-9><Pane-10><Type>1</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-10><Pane-11><Type>2</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><Horiz>0</Horiz><Pane-1>12</Pane-1><Pane-2>17</Pane-2><Panes>2</Panes></Pane-11><Pane-12><Type>2</Type><DockingCX>0</DockingCX><DockingCY>661</DockingCY><Horiz>1</Horiz><Pane-1>13</Pane-1><Pane-2>15</Pane-2><Pane-3>16</Pane-3><Panes>3</Panes></Pane-12><Pane-13><Type>1</Type><DockingCX>147</DockingCX><DockingCY>250</DockingCY><Selected>14</Selected><Panes>1</Panes><Pane-1>14</Pane-1></Pane-13><Pane-14><Type>0</Type><DockingCX>250</DockingCX><DockingCY>250</DockingCY><Title>Workspace</Title><ID>1000</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>13</DockingHolder><FloatingHolder>0</FloatingHolder><LastHolder>13</LastHolder></Pane-14><Pane-15><Type>4</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY></Pane-15><Pane-16><Type>1</Type><DockingCX>229</DockingCX><DockingCY>250</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-16><Pane-17><Type>1</Type><DockingCX>250</DockingCX><DockingCY>222</DockingCY><Selected>18</Selected><Panes>1</Panes><Pane-1>18</Pane-1></Pane-17><Pane-18><Type>0</Type><DockingCX>250</DockingCX><DockingCY>250</DockingCY><Title>Output</Title><ID>1002</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>17</DockingHolder><FloatingHolder>0</FloatingHolder><LastHolder>17</LastHolder></Pane-18><Pane-19><Type>5</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><Direction>3</Direction><Panes>0</Panes></Pane-19><Pane-20><Type>5</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><Direction>1</Direction><Pane-1>21</Pane-1><Panes>1</Panes></Pane-20><Pane-21><Type>1</Type><DockingCX>229</DockingCX><DockingCY>250</DockingCY><Selected>22</Selected><Panes>1</Panes><Pane-1>22</Pane-1></Pane-21><Pane-22><Type>0</Type><DockingCX>250</DockingCX><DockingCY>250</DockingCY><Title>Artist Editor</Title><ID>1001</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>16</DockingHolder><FloatingHolder>0</FloatingHolder><LastHolder>16</LastHolder></Pane-22><Pane-23><Type>0</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Title>myColor</Title><ID>1100</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>10</DockingHolder><FloatingHolder>26</FloatingHolder><LastHolder>26</LastHolder></Pane-23><Pane-24><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>25</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>332</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>201</WindowRectRightPos></Pane-24><Pane-25><Type>2</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Horiz>1</Horiz><Pane-1>26</Pane-1><Panes>1</Panes></Pane-25><Pane-26><Type>1</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-26><Pane-27><Type>0</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Title>TileFactor</Title><ID>1101</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>9</DockingHolder><FloatingHolder>30</FloatingHolder><LastHolder>30</LastHolder></Pane-27><Pane-28><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>29</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>200</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>339</WindowRectRightPos></Pane-28><Pane-29><Type>2</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Horiz>1</Horiz><Pane-1>30</Pane-1><Panes>1</Panes></Pane-29><Pane-30><Type>1</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-30><Pane-31><Type>0</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Title>DepthFactor</Title><ID>1102</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>8</DockingHolder><FloatingHolder>34</FloatingHolder><LastHolder>34</LastHolder></Pane-31><Pane-32><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>33</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>132</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>435</WindowRectRightPos></Pane-32><Pane-33><Type>2</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Horiz>1</Horiz><Pane-1>34</Pane-1><Panes>1</Panes></Pane-33><Pane-34><Type>1</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-34><Pane-35><Type>0</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Title>MaterialShininess</Title><ID>1103</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>7</DockingHolder><FloatingHolder>38</FloatingHolder><LastHolder>38</LastHolder></Pane-35><Pane-36><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>37</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>132</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>435</WindowRectRightPos></Pane-36><Pane-37><Type>2</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Horiz>1</Horiz><Pane-1>38</Pane-1><Panes>1</Panes></Pane-37><Pane-38><Type>1</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-38><Pane-39><Type>0</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Title>MaterialAmbient</Title><ID>1104</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>6</DockingHolder><FloatingHolder>42</FloatingHolder><LastHolder>42</LastHolder></Pane-39><Pane-40><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>41</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>332</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>201</WindowRectRightPos></Pane-40><Pane-41><Type>2</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Horiz>1</Horiz><Pane-1>42</Pane-1><Panes>1</Panes></Pane-41><Pane-42><Type>1</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-42><Pane-43><Type>0</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Title>MaterialSpecular</Title><ID>1105</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>5</DockingHolder><FloatingHolder>46</FloatingHolder><LastHolder>46</LastHolder></Pane-43><Pane-44><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>45</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>332</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>201</WindowRectRightPos></Pane-44><Pane-45><Type>2</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Horiz>1</Horiz><Pane-1>46</Pane-1><Panes>1</Panes></Pane-45><Pane-46><Type>1</Type><DockingCX>201</DockingCX><DockingCY>310</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-46><Pane-47><Type>0</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Title>LightPosition</Title><ID>1106</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>4</DockingHolder><FloatingHolder>50</FloatingHolder><LastHolder>50</LastHolder></Pane-47><Pane-48><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>49</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>200</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>339</WindowRectRightPos></Pane-48><Pane-49><Type>2</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Horiz>1</Horiz><Pane-1>50</Pane-1><Panes>1</Panes></Pane-49><Pane-50><Type>1</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-50><Pane-51><Type>0</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Title>TileFactor</Title><ID>1107</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>3</DockingHolder><FloatingHolder>54</FloatingHolder><LastHolder>54</LastHolder></Pane-51><Pane-52><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>53</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>200</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>339</WindowRectRightPos></Pane-52><Pane-53><Type>2</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Horiz>1</Horiz><Pane-1>54</Pane-1><Panes>1</Panes></Pane-53><Pane-54><Type>1</Type><DockingCX>339</DockingCX><DockingCY>178</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-54><Pane-55><Type>0</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Title>DepthFactor</Title><ID>1108</ID><IconID>-1</IconID><Options>0</Options><DockingHolder>2</DockingHolder><FloatingHolder>58</FloatingHolder><LastHolder>58</LastHolder></Pane-55><Pane-56><Type>3</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><TopContaner>57</TopContaner><WindowRectTopPos>22</WindowRectTopPos><WindowRectBottomPos>132</WindowRectBottomPos><WindowRectLeftPos>0</WindowRectLeftPos><WindowRectRightPos>435</WindowRectRightPos></Pane-56><Pane-57><Type>2</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Horiz>1</Horiz><Pane-1>58</Pane-1><Panes>1</Panes></Pane-57><Pane-58><Type>1</Type><DockingCX>435</DockingCX><DockingCY>110</DockingCY><Selected>0</Selected><Panes>0</Panes></Pane-58><Pane-59><Type>5</Type><DockingCX>0</DockingCX><DockingCY>0</DockingCY><Direction>0</Direction><Panes>0</Panes></Pane-59><Summary><TopContainer>1</TopContainer><Client>15</Client><Panes>59</Panes></Summary></Application_Layout></DockingPaneLayouts>
]]></RmTextDataBlock>
     <RmRegistryBranch NAME="RmPreviewDx9Window" API="" XML_VERSION="RenderMonkey 1.71"/>
     <RmRegistryBranch NAME="RmPreviewGLESWindow" API="" XML_VERSION="RenderMonkey 1.71"/>
     <RmRegistryBranch NAME="RmPreviewGLPreview" API="" XML_VERSION="RenderMonkey 1.71"/>
     <RmRegistryBranch NAME="RmPreviewGLWindow" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EffectPlacementRepository" API="" XML_VERSION="RenderMonkey 1.71">
       <RmRegistryBranch NAME="Effect Workspace.Relief Mapping | Phong Reflection Model" API="" XML_VERSION="RenderMonkey 1.71">
        <RmIntegerVariable NAME="X" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="570" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Y" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="108" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Width" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="438" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Height" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="442" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="ShowStatus" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Visible" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Minimized X" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="-1" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Minimized Y" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="-1" MIN="-10" MAX="10" CLAMP="FALSE"/>
       </RmRegistryBranch>
      </RmRegistryBranch>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmLightEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EditNodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="NoteEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EditNodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmRenderableTextureEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EditNodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmRenderTargetEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EditNodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmRenderStateBlockEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EditNodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmTextureObjectEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EditNodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
      <RmRegistryBranch NAME="NodeRepository" API="" XML_VERSION="RenderMonkey 1.71">
       <RmRegistryBranch NAME="Effect Workspace.Relief Mapping | Phong Reflection Model" API="" XML_VERSION="RenderMonkey 1.71">
        <RmIntegerVariable NAME="X" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="49" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Y" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="67" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Width" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="762" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Height" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="384" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="ShowStatus" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Visible" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="0" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Minimized X" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="-1" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmIntegerVariable NAME="Minimized Y" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="-1" MIN="-10" MAX="10" CLAMP="FALSE"/>
       </RmRegistryBranch>
      </RmRegistryBranch>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmTessellationNodeEditorDlg" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EditNodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmTextureGenerator" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="EditNodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmStreamEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="Effect Workspace.Relief Mapping.Stream Mapping" API="" XML_VERSION="RenderMonkey 1.71">
       <RmIntegerVariable NAME="X" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="258" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Y" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="114" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Width" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="641" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Height" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="254" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="ShowStatus" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Visible" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="0" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Minimized X" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="-1" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Minimized Y" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="-1" MIN="-10" MAX="10" CLAMP="FALSE"/>
      </RmRegistryBranch>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmShaderEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="Effect Workspace.Relief Mapping | Phong Reflection Model" API="" XML_VERSION="RenderMonkey 1.71">
       <RmRegistryBranch NAME="Disassembly" API="" XML_VERSION="RenderMonkey 1.71"/>
       <RmStringVariable NAME="Editing Shader" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC=""><RmTextDataBlock TYPE="TEXT"><![CDATA[
Fragment Program]]></RmTextDataBlock></RmStringVariable>
       <RmStringVariable NAME="Editing Pass" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC=""><RmTextDataBlock TYPE="TEXT"><![CDATA[
Object]]></RmTextDataBlock></RmStringVariable>
       <RmIntegerVariable NAME="Y" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="0" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Width" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="863" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Height" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="632" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="ShowStatus" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Visible" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Minimized X" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="-1" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="Minimized Y" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="-1" MIN="-10" MAX="10" CLAMP="FALSE"/>
       <RmIntegerVariable NAME="X" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1" MIN="-10" MAX="10" CLAMP="FALSE"/>
      </RmRegistryBranch>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmColorEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="NodeRepository" API="" XML_VERSION="RenderMonkey 1.71"/>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmDynamicVariableEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="NodeRepository" API="" XML_VERSION="RenderMonkey 1.71">
       <RmRegistryBranch NAME="Effect Workspace.Relief Mapping | Phong Reflection Model.LightPosition" API="" XML_VERSION="RenderMonkey 1.71">
        <RmIntegerVariable NAME="DockPaneID" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1106" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmBooleanVariable NAME="ShowSetup" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="TRUE"/>
       </RmRegistryBranch>
       <RmRegistryBranch NAME="Effect Workspace.Relief Mapping | Phong Reflection Model.Object.TileFactor" API="" XML_VERSION="RenderMonkey 1.71">
        <RmIntegerVariable NAME="DockPaneID" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1107" MIN="-10" MAX="10" CLAMP="FALSE"/>
        <RmBooleanVariable NAME="ShowSetup" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="TRUE"/>
       </RmRegistryBranch>
      </RmRegistryBranch>
     </RmRegistryBranch>
     <RmRegistryBranch NAME="RmScalarEditor" API="" XML_VERSION="RenderMonkey 1.71">
      <RmRegistryBranch NAME="NodeRepository" API="" XML_VERSION="RenderMonkey 1.71">
       <RmRegistryBranch NAME="Effect Workspace.Relief Mapping | Phong Reflection Model.Object.DepthFactor" API="" XML_VERSION="RenderMonkey 1.71">
        <RmIntegerVariable NAME="DockPaneID" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" VALUE="1108" MIN="-10" MAX="10" CLAMP="FALSE"/>
       </RmRegistryBranch>
      </RmRegistryBranch>
     </RmRegistryBranch>
    </RmRegistryBranch>
    <RmRegistryBranch NAME="WORKSPACE" API="" XML_VERSION="RenderMonkey 1.71">
     <RmStringVariable NAME="LAST_SAVE" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC=""><RmTextDataBlock TYPE="TEXT"><![CDATA[
6/5/2012 16:9:38]]></RmTextDataBlock></RmStringVariable>
     <RmStringVariable NAME="VERSION" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC=""><RmTextDataBlock TYPE="TEXT"><![CDATA[
RenderMonkey Version 1.82 (build 322)]]></RmTextDataBlock></RmStringVariable>
     <RmStringVariable NAME="XML_VERSION" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC=""><RmTextDataBlock TYPE="TEXT"><![CDATA[
RenderMonkey 1.71]]></RmTextDataBlock></RmStringVariable>
     <RmStringVariable NAME="BASE_WORKSPACE_PATH" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC=""><RmTextDataBlock TYPE="TEXT"><![CDATA[
C:\Users\Kohwalter\Desktop\RenderMonkeyFiles\]]></RmTextDataBlock></RmStringVariable>
    </RmRegistryBranch>
   </RmRegistryBranch>
  </RmRegistryBranch>
  <RmOpenGLEffect NAME="Relief Mapping | Phong Reflection Model" API="OpenGL" ACTIVE_CAMERA="">
   <RmMatrixVariable NAME="ModelViewProjectionMatrix" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="WorldViewProjection" VALUE_0="1.678352" VALUE_1="-0.018975" VALUE_2="-1.587463" VALUE_3="-0.000018" VALUE_4="-0.084766" VALUE_5="2.409817" VALUE_6="-0.118424" VALUE_7="-0.000009" VALUE_8="-0.686977" VALUE_9="-0.059822" VALUE_10="-0.725594" VALUE_11="199.199173" VALUE_12="-0.686290" VALUE_13="-0.059762" VALUE_14="-0.724869" VALUE_15="199.999985"/>
   <RmDynamicVariable NAME="LightPosition" API="" ARTIST_EDITABLE="TRUE" VARIABLE_SEMANTIC="" VARIABLE_TYPE="FLOAT" ROWS="3" COLUMNS="1" FIXED_SIZE="TRUE" MIN="-100.000000" MAX="100.000000" CLAMP="TRUE" NORMALIZE="FALSE">
    <RmDynamicVariableValueContainer>
     <RmDynamicVariableValue ROW_INDEX="0" COLUMN_INDEX="0" VALUE="100.000000"/>
     <RmDynamicVariableValue ROW_INDEX="1" COLUMN_INDEX="0" VALUE="100.000000"/>
     <RmDynamicVariableValue ROW_INDEX="2" COLUMN_INDEX="0" VALUE="100.000000"/>
    </RmDynamicVariableValueContainer>
   </RmDynamicVariable>
   <RmMatrixVariable NAME="ModelViewMatrix" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="WorldView" VALUE_0="0.726480" VALUE_1="-0.008213" VALUE_2="-0.687139" VALUE_3="-0.000008" VALUE_4="-0.035111" VALUE_5="0.998179" VALUE_6="-0.049053" VALUE_7="-0.000004" VALUE_8="0.686290" VALUE_9="0.059762" VALUE_10="0.724869" VALUE_11="-199.999985" VALUE_12="0.000000" VALUE_13="0.000000" VALUE_14="0.000000" VALUE_15="1.000000"/>
   <RmMatrixVariable NAME="ModelViewInverseTransposeMatrix" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="WorldViewInverseTranspose" VALUE_0="0.726480" VALUE_1="-0.008213" VALUE_2="-0.687138" VALUE_3="0.000000" VALUE_4="-0.035111" VALUE_5="0.998179" VALUE_6="-0.049053" VALUE_7="0.000000" VALUE_8="0.686290" VALUE_9="0.059762" VALUE_10="0.724868" VALUE_11="0.000000" VALUE_12="137.257980" VALUE_13="11.952456" VALUE_14="144.973679" VALUE_15="1.000000"/>
   <RmMatrixVariable NAME="ModelInverseMatrix" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="WorldInverse" VALUE_0="1.000000" VALUE_1="0.000000" VALUE_2="0.000000" VALUE_3="0.000000" VALUE_4="0.000000" VALUE_5="1.000000" VALUE_6="0.000000" VALUE_7="0.000000" VALUE_8="0.000000" VALUE_9="0.000000" VALUE_10="1.000000" VALUE_11="0.000000" VALUE_12="0.000000" VALUE_13="0.000000" VALUE_14="0.000000" VALUE_15="1.000000"/>
   <RmMatrixVariable NAME="ViewMatrix" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="View" VALUE_0="0.726480" VALUE_1="-0.008213" VALUE_2="-0.687139" VALUE_3="-0.000008" VALUE_4="-0.035111" VALUE_5="0.998179" VALUE_6="-0.049053" VALUE_7="-0.000004" VALUE_8="0.686290" VALUE_9="0.059762" VALUE_10="0.724869" VALUE_11="-199.999985" VALUE_12="0.000000" VALUE_13="0.000000" VALUE_14="0.000000" VALUE_15="1.000000"/>
   <RmColorVariable NAME="LightAmbientColor" API="" ARTIST_EDITABLE="TRUE" VARIABLE_SEMANTIC="" VALUE_0="0.596078" VALUE_1="0.597553" VALUE_2="0.597553" VALUE_3="1.000000"/>
   <RmColorVariable NAME="LightColor" API="" ARTIST_EDITABLE="TRUE" VARIABLE_SEMANTIC="" VALUE_0="1.000000" VALUE_1="1.000000" VALUE_2="1.000000" VALUE_3="1.000000"/>
   <Rm2DTextureVariable NAME="RockDiffuseTexture" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" FILE_NAME=".\Relief Textures\rockbump.jpg" ORIGIN="0"/>
   <Rm2DTextureVariable NAME="RockReliefTexture" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" FILE_NAME=".\Relief Textures\rockbump.tga" ORIGIN="0"/>
   <Rm2DTextureVariable NAME="RockWallReliefTexture" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" FILE_NAME=".\Relief Textures\rockwall.tga" ORIGIN="0"/>
   <Rm2DTextureVariable NAME="TileDiffuseTexture" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" FILE_NAME=".\Relief Textures\tile1.jpg" ORIGIN="0"/>
   <Rm2DTextureVariable NAME="TileReliefTexture" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" FILE_NAME=".\Relief Textures\tile1.tga" ORIGIN="0"/>
   <Rm2DTextureVariable NAME="RockWallDiffuseTexture" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" FILE_NAME=".\Relief Textures\rockwall.jpg" ORIGIN="0"/>
   <Rm2DTextureVariable NAME="BrickDiffuseTexture" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" FILE_NAME=".\Relief Textures\brickbump.jpg" ORIGIN="0"/>
   <Rm2DTextureVariable NAME="BrickReliefTexture" API="" ARTIST_EDITABLE="FALSE" VARIABLE_SEMANTIC="" FILE_NAME=".\Relief Textures\brickbump.tga" ORIGIN="0"/>
   <RmStreamMap NAME="Stream Mapping" API="">
    <RmStream NAME="Stream" API="" STRIDE="44">
     <RmStreamChannel NAME="Position_0" API="" DATA_SIZE="12" DATA_TYPE="2" REGISTER="0" USAGE="0" USAGE_INDEX="0" ATTRIBUTE_NAME="rm_Vertex"/>
     <RmStreamChannel NAME="Normal_0" API="" DATA_SIZE="12" DATA_TYPE="2" REGISTER="0" USAGE="3" USAGE_INDEX="0" ATTRIBUTE_NAME="rm_Normal"/>
     <RmStreamChannel NAME="TexCoord_0" API="" DATA_SIZE="8" DATA_TYPE="1" REGISTER="0" USAGE="5" USAGE_INDEX="0" ATTRIBUTE_NAME="rm_TexCoord0"/>
     <RmStreamChannel NAME="Tangent_0" API="" DATA_SIZE="12" DATA_TYPE="2" REGISTER="0" USAGE="6" USAGE_INDEX="0" ATTRIBUTE_NAME="rm_Tangent"/>
    </RmStream>
   </RmStreamMap>
   <RmModelData NAME="Teapot" API="" FILE_NAME="D:\Program Files\AMD\RenderMonkey 1.82\Examples\Media\Models\Teapot.3ds" ORIENTATION="1"/>
   <RmModelData NAME="Cube" API="" FILE_NAME="D:\Program Files\AMD\RenderMonkey 1.82\Examples\Media\Models\Cube.x" ORIENTATION="0"/>
   <RmModelData NAME="Sphere" API="" FILE_NAME="D:\Program Files\AMD\RenderMonkey 1.82\Examples\Media\Models\Sphere.3ds" ORIENTATION="1"/>
   <RmGLPass NAME="Object" API="OpenGL" PASS_INDEX="1" ENABLED="TRUE">
    <RmModelReference NAME="Cube" API=""/>
    <RmGLShader NAME="Vertex Program" API="OpenGL" PIXEL_SHADER="FALSE"><RmShaderCode TYPE="TEXT"><![CDATA[
/* Universidade Federal Fluminense
 * Programa de Pós-Graduação em Computação
 *
 * Tópicos Avançados em Computação Visual e Interfaces II (Técnicas Avançadas de Rendering)
 * Professor: Leandro Augusto Frata Fernandes
 *
 * Version: 2012.04.23-001
 */

// User-defined input matrices (from application).
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelViewInverseTransposeMatrix;
uniform mat4 ModelViewMatrix;
uniform mat4 ViewMatrix;

// User-define material attributes (from application).
uniform int TileFactor;

// User-defined light in Model Space (from application).
uniform vec3 LightPosition; // Model Space

// User-defined mesh attributes.
attribute vec3 rm_Tangent;

// User-defined output variables.
varying vec3 ViewDirection;  // Tangent Space
varying vec3 LightDirection; // Tangent Space

// The main method.
void main(void)
{
   // OCS to Homogeneous Clip Space.
   gl_Position = ModelViewProjectionMatrix * gl_Vertex;
   
   // Texture coordinates.
   gl_TexCoord[0].st = gl_MultiTexCoord0.st * float(TileFactor);
   
   // Compute directions in CCS.
   vec4 fvVertexPosition = ModelViewMatrix * gl_Vertex;
   
   vec3 fvLightLocation = (ViewMatrix * vec4(LightPosition, 1.0)).xyz;
   
   vec3 fvViewDirection = -fvVertexPosition.xyz;
   vec3 fvLightDirection = fvLightLocation - fvVertexPosition.xyz;
   
   // Map tangent, bitangent and normal from OCS to CCS.
   vec3 fvNormal = normalize((ModelViewInverseTransposeMatrix * vec4(gl_Normal, 0.0)).xyz);
   vec3 fvTangent = (ModelViewInverseTransposeMatrix * vec4(rm_Tangent, 0.0)).xyz;
   vec3 fvBitangent = normalize(cross(fvNormal, fvTangent));
   fvTangent = normalize(cross(fvBitangent, fvNormal));
   
   // Compute user-defined output variables.
   ViewDirection.x = dot(fvTangent, fvViewDirection);
   ViewDirection.y = dot(fvBitangent, fvViewDirection);
   ViewDirection.z = dot(fvNormal, fvViewDirection);
   
   LightDirection.x = dot(fvTangent, fvLightDirection);
   LightDirection.y = dot(fvBitangent, fvLightDirection);
   LightDirection.z = dot(fvNormal, fvLightDirection);
}]]></RmShaderCode></RmGLShader>
    <RmGLShader NAME="Fragment Program" API="OpenGL" PIXEL_SHADER="TRUE"><RmShaderCode TYPE="TEXT"><![CDATA[
/* Universidade Federal Fluminense
 * Programa de Pós-Graduação em Computação
 *
 * Tópicos Avançados em Computação Visual e Interfaces II (Técnicas Avançadas de Rendering)
 * Professor: Leandro Augusto Frata Fernandes
 *
 * Version: 2012.04.23-001
 */

// User-defined light (from application)
uniform vec4 LightColor;
uniform vec4 LightAmbientColor;

// User-defined material (from application)
uniform vec4 MaterialAmbient;
uniform vec4 MaterialSpecular;
uniform float MaterialShininess;

uniform sampler2D MaterialDiffuseMap;
uniform sampler2D MaterialReliefMap;

uniform float DepthFactor;

// User-defined input variables from vertex shader.
varying vec3 ViewDirection;  // Tangent Space
varying vec3 LightDirection; // Tangent Space

// Phong reflectance model.
vec4 phong(vec3 UnitNormal, vec3 UnitLightDirection, vec3 UnitViewDirection, vec4 LightAmbientColor, vec4 LightDiffuseColor, vec4 LightSpecularColor, vec4 MaterialAmbient, vec4 MaterialDiffuse, vec4 MaterialSpecular, float MaterialShininess)
{
   float fLDotN;
   vec4 fvTotalAmbient, fvTotalDiffuse, fvTotalSpecular;
   
   fvTotalAmbient = MaterialAmbient * LightAmbientColor;

   if ((fLDotN = dot(UnitLightDirection, UnitNormal)) > 0.0)   
   {
      fvTotalDiffuse = MaterialDiffuse * fLDotN * LightDiffuseColor;
      fvTotalSpecular = MaterialSpecular * pow(max(0.0, dot(normalize(UnitLightDirection - UnitViewDirection), UnitNormal)), MaterialShininess) * LightSpecularColor;
   }
   else
   {
      fvTotalDiffuse = fvTotalSpecular = vec4(0.0);
   }
  
   // Compute final color.
   return fvTotalAmbient + fvTotalDiffuse + fvTotalSpecular;
}

// Ray intersection with a heigh-field surface (linear search only).
vec3 ray_intersect_rm_linear(sampler2D ReliefMap, vec3 CurrentPoint, const vec3 Direction)
{
   /* TODO (1): Make it work. */
   int pass = 20;
   float delta = length(Direction) / pass;
      
   vec4 fvMaterialRelief = vec4(0.0,0.0,0.0,0.0);
   
   for(int i = 0; i < pass; i++)
   {
      CurrentPoint += (delta * Direction);
      fvMaterialRelief = texture2D(MaterialReliefMap, CurrentPoint.st);
      
      if(fvMaterialRelief.w < CurrentPoint.z)
      {
         break;
      }
   }
   
   return CurrentPoint;
}

// Ray intersection with a heigh-field surface (linear search + binary search).
vec3 ray_intersect_rm(sampler2D ReliefMap, vec3 CurrentPoint, const vec3 Direction)
{
   /* TODO (1): Make it work. */
   
   int pass = 20;
   float delta = length(Direction) / pass;
   
   vec3 inside = ray_intersect_rm_linear(ReliefMap, CurrentPoint, Direction);
   vec3 outside = inside - (delta * Direction);
   //binary
   
   CurrentPoint = (inside + outside) * 0.5;
   
   vec4 fvMaterialRelief = texture2D(MaterialReliefMap, CurrentPoint.st);
   
   for(int i = 0; i < 5; i++)
   {

      delta = delta * 0.5;
      if( CurrentPoint.z > fvMaterialRelief.w)
      {
         CurrentPoint -= (delta * Direction);
      }
      else
      {
         if( CurrentPoint.z < fvMaterialRelief.w)
         {
            CurrentPoint += (delta * Direction);
         }
         else
            break;
      }
      fvMaterialRelief = texture2D(MaterialReliefMap, CurrentPoint.st);
   }

   return CurrentPoint;
}

// The main method.
void main(void)
{
   // Normalize interpolated directions.
   //vec3 fvLightDirection = normalize(LightDirection);
   vec3 fvLightDirection = LightDirection;
   vec3 fvViewDirection = normalize(ViewDirection);
   
   // Compute starting point and direction for ray/height-field intersection from the viewer.
   vec3 fvStartingPoint = vec3(gl_TexCoord[0].st, 0.0);
   vec3 fvDirection = vec3(-(DepthFactor / fvViewDirection.z) * fvViewDirection.xy, 1.0);
   
   // Compute ray/height-field intersection from the viewer.
   vec3 fvViewerIntersection = ray_intersect_rm(MaterialReliefMap, fvStartingPoint, fvDirection);
   
   /* TODO (2): Compute the new light direction. */
   fvLightDirection = LightDirection - (fvViewerIntersection - fvStartingPoint);
   fvLightDirection = normalize(fvLightDirection);
   
   /* TODO (3): Include self-shadows. */
   
   fvDirection = vec3(-(DepthFactor / fvLightDirection.z) * fvLightDirection.xy, 1.0);
   fvStartingPoint = fvViewerIntersection - (fvDirection * fvViewerIntersection.z);
   
   vec3 ShadowIntersection = ray_intersect_rm_linear(MaterialReliefMap, fvStartingPoint, fvDirection);
   
   //shadow factor
   float shadow = 1.0;
   if (fvViewerIntersection.z  - 0.05 > ShadowIntersection.z)
      shadow = 0.33;
  
   // Get diffuse color from diffuse map.
   vec4 fvMaterialDiffuse = texture2D(MaterialDiffuseMap, fvViewerIntersection.st);

   // Get normal vector from relief map.
   vec4 fvMaterialRelief = texture2D(MaterialReliefMap, fvViewerIntersection.st);
   vec3 fvNormal = normalize(fvMaterialRelief.rgb - 0.5);

   // Compute final color.
   gl_FragColor = phong(fvNormal, fvLightDirection, fvViewDirection,
      LightAmbientColor, LightColor, LightColor,
      MaterialAmbient, fvMaterialDiffuse  * shadow, MaterialSpecular * shadow, MaterialShininess);
}]]></RmShaderCode></RmGLShader>
    <RmStreamMapReference NAME="Stream Mapping" API=""/>
    <RmFloatVariable NAME="MaterialShininess" API="" ARTIST_EDITABLE="TRUE" VARIABLE_SEMANTIC="" VALUE="128.000000" MIN="1.000000" MAX="200.000000" CLAMP="TRUE"/>
    <RmDynamicVariable NAME="TileFactor" API="" ARTIST_EDITABLE="TRUE" VARIABLE_SEMANTIC="" VARIABLE_TYPE="INTEGER" ROWS="1" COLUMNS="1" FIXED_SIZE="TRUE" MIN="1" MAX="32" CLAMP="TRUE" NORMALIZE="FALSE">
     <RmDynamicVariableValueContainer>
      <RmDynamicVariableValue ROW_INDEX="0" COLUMN_INDEX="0" VALUE="1"/>
     </RmDynamicVariableValueContainer>
    </RmDynamicVariable>
    <RmFloatVariable NAME="DepthFactor" API="" ARTIST_EDITABLE="TRUE" VARIABLE_SEMANTIC="" VALUE="0.065000" MIN="0.000000" MAX="0.500000" CLAMP="TRUE"/>
    <RmColorVariable NAME="MaterialSpecular" API="" ARTIST_EDITABLE="TRUE" VARIABLE_SEMANTIC="" VALUE_0="0.749020" VALUE_1="0.750000" VALUE_2="0.750000" VALUE_3="1.000000"/>
    <RmColorVariable NAME="MaterialAmbient" API="" ARTIST_EDITABLE="TRUE" VARIABLE_SEMANTIC="" VALUE_0="0.313726" VALUE_1="0.313726" VALUE_2="0.313726" VALUE_3="1.000000"/>
    <RmTextureObject NAME="MaterialDiffuseMap" API="OpenGL" STATE_INDEX="0" VERTEX_TEXTURE="FALSE">
     <RmTextureReference NAME="TileDiffuseTexture" API=""/>
     <RmState NAME="GL_TextureMinify" API="OpenGL" STATE="4" VALUE="6" USAGE="SAMPLER_STATE"/>
     <RmState NAME="GL_TextureMagnify" API="OpenGL" STATE="5" VALUE="1" USAGE="SAMPLER_STATE"/>
    </RmTextureObject>
    <RmTextureObject NAME="MaterialReliefMap" API="OpenGL" STATE_INDEX="1" VERTEX_TEXTURE="FALSE">
     <RmTextureReference NAME="TileReliefTexture" API=""/>
     <RmState NAME="GL_TextureMinify" API="OpenGL" STATE="4" VALUE="6" USAGE="SAMPLER_STATE"/>
     <RmState NAME="GL_TextureMagnify" API="OpenGL" STATE="5" VALUE="1" USAGE="SAMPLER_STATE"/>
    </RmTextureObject>
    <RmSampler NAME="MaterialDiffuseMap" API="" REGISTER="-1"/>
    <RmSampler NAME="MaterialReliefMap" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="LightColor" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="LightPosition" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="MaterialAmbient" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="DepthFactor" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="LightAmbientColor" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="MaterialShininess" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="MaterialSpecular" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="ModelViewInverseTransposeMatrix" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="ModelViewMatrix" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="ModelViewProjectionMatrix" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="TileFactor" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="ViewMatrix" API="" REGISTER="-1"/>
   </RmGLPass>
   <RmGLPass NAME="Light Point" API="OpenGL" PASS_INDEX="0" ENABLED="TRUE">
    <RmModelReference NAME="Sphere" API=""/>
    <RmGLShader NAME="Vertex Program" API="OpenGL" PIXEL_SHADER="FALSE"><RmShaderCode TYPE="TEXT"><![CDATA[
/* Universidade Federal Fluminense
 * Programa de Pós-Graduação em Computação
 *
 * Tópicos Avançados em Computação Visual e Interfaces II (Técnicas Avançadas de Rendering)
 * Professor: Leandro Augusto Frata Fernandes
 *
 * Version: 2012.04.23-001
 */
 
// User-defined input variables (from application).
uniform mat4 ModelViewProjectionMatrix;

// User-defined light in Model Space (from application).
uniform vec3 LightPosition; // Model Space

// The main method.
void main(void)
{
   // OCS to Homogeneous Clip Space.
   gl_Position = ModelViewProjectionMatrix * vec4((0.05 * gl_Vertex.xyz) + LightPosition, 1.0);
}]]></RmShaderCode></RmGLShader>
    <RmGLShader NAME="Fragment Program" API="OpenGL" PIXEL_SHADER="TRUE"><RmShaderCode TYPE="TEXT"><![CDATA[
/* Universidade Federal Fluminense
 * Programa de Pós-Graduação em Computação
 *
 * Tópicos Avançados em Computação Visual e Interfaces II (Técnicas Avançadas de Rendering)
 * Professor: Leandro Augusto Frata Fernandes
 *
 * Version: 2012.04.23-001
 */
 
// User-defined light (from application)
uniform vec4 LightColor;

// The main method.
void main(void)
{
   gl_FragColor = LightColor;
}]]></RmShaderCode></RmGLShader>
    <RmStreamMapReference NAME="Stream Mapping" API=""/>
    <RmShaderConstant NAME="LightColor" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="LightPosition" API="" REGISTER="-1"/>
    <RmShaderConstant NAME="ModelViewProjectionMatrix" API="" REGISTER="-1"/>
   </RmGLPass>
  </RmOpenGLEffect>
 </RmEffectWorkspace>
</RENDER_MONKEY>
