瀏覽代碼

Minor fixes. Add script bindings and documentation for the new renderpath command.

Lasse Öörni 9 年之前
父節點
當前提交
4279990ea8

+ 2 - 0
Docs/Reference.dox

@@ -1483,6 +1483,7 @@ The available commands are:
 - forwardlights: Render per-pixel forward lighting for opaque objects with the specified pass name. Shadow maps are also rendered as necessary.
 - lightvolumes: Render deferred light volumes using the specified shaders. G-buffer textures can be bound as necessary.
 - renderui: Render the UI into the output rendertarget. Using this will cause the default %UI render to the backbuffer to be skipped.
+- sendevent: Send an event with a specified string parameter ("event name"). This can be used to call custom code,typically custom low-level rendering, in the middle of the renderpath execution.
 
 A render path can be loaded from a main XML file by calling \ref RenderPath::Load "Load()", after which other XML files (for example one for each post-processing effect) can be appended to it by calling \ref RenderPath::Append "Append()". Rendertargets and commands can be enabled or disabled by calling \ref RenderPath::SetEnabled "SetEnabled()" to switch eg. a post-processing effect on or off. To aid in this, both can be identified by tag names, for example the bloom effect uses the tag "Bloom" for all of its rendertargets and commands.
 
@@ -1510,6 +1511,7 @@ The render path XML definition looks like this:
         <texture unit="unit" name="viewport|RTName|TextureName" />
     </command>
     <command type="renderui" output="viewport|RTName" depthstencil="DSName" />
+    <command type="sendevent" name="EventName" />
 </renderpath>
 \endcode
 

+ 2 - 0
Source/Urho3D/AngelScript/GraphicsAPI.cpp

@@ -316,6 +316,7 @@ static void RegisterRenderPath(asIScriptEngine* engine)
     engine->RegisterEnumValue("RenderCommandType", "CMD_FORWARDLIGHTS", CMD_FORWARDLIGHTS);
     engine->RegisterEnumValue("RenderCommandType", "CMD_LIGHTVOLUMES", CMD_LIGHTVOLUMES);
     engine->RegisterEnumValue("RenderCommandType", "CMD_RENDERUI", CMD_RENDERUI);
+    engine->RegisterEnumValue("RenderCommandType", "CMD_SENDEVENT", CMD_SENDEVENT);
 
     engine->RegisterEnum("RenderCommandSortMode");
     engine->RegisterEnumValue("RenderCommandSortMode", "SORT_FRONTTOBACK", SORT_FRONTTOBACK);
@@ -408,6 +409,7 @@ static void RegisterRenderPath(asIScriptEngine* engine)
     engine->RegisterObjectProperty("RenderPathCommand", "String pixelShaderName", offsetof(RenderPathCommand, pixelShaderName_));
     engine->RegisterObjectProperty("RenderPathCommand", "String vertexShaderDefines", offsetof(RenderPathCommand, vertexShaderDefines_));
     engine->RegisterObjectProperty("RenderPathCommand", "String pixelShaderDefines", offsetof(RenderPathCommand, pixelShaderDefines_));
+    engine->RegisterObjectProperty("RenderPathCommand", "String eventName", offsetof(RenderPathCommand, eventName_));
 
     RegisterRefCounted<RenderPath>(engine, "RenderPath");
     engine->RegisterObjectBehaviour("RenderPath", asBEHAVE_FACTORY, "RenderPath@+ f()", asFUNCTION(ConstructRenderPath), asCALL_CDECL);

+ 1 - 1
Source/Urho3D/Graphics/GraphicsEvents.h

@@ -100,7 +100,7 @@ URHO3D_EVENT(E_ENDVIEWRENDER, EndViewRender)
     URHO3D_PARAM(P_CAMERA, Camera);                // Camera pointer
 }
 
-/// A render path event has occured.
+/// A render path event has occurred.
 URHO3D_EVENT(E_RENDERPATHEVENT, RenderPathEvent)
 {
     URHO3D_PARAM(P_NAME, Name);                    // String

+ 1 - 1
Source/Urho3D/Graphics/RenderPath.h

@@ -200,7 +200,7 @@ struct URHO3D_API RenderPathCommand
     bool useLitBase_;
     /// Vertex lights flag.
     bool vertexLights_;
-    /// Event name
+    /// Event name.
     String eventName_;
 };
 

+ 3 - 1
Source/Urho3D/LuaScript/pkgs/Graphics/RenderPath.pkg

@@ -8,7 +8,8 @@ enum RenderCommandType
     CMD_QUAD,
     CMD_FORWARDLIGHTS,
     CMD_LIGHTVOLUMES,
-    CMD_RENDERUI
+    CMD_RENDERUI,
+    CMD_SENDEVENT
 };
 
 enum RenderCommandSortMode
@@ -82,6 +83,7 @@ struct RenderPathCommand
     bool markToStencil_ @ markToStencil;
     bool useLitBase_ @ useLitBase;
     bool vertexLights_ @ vertexLights;
+    String eventName_ @ eventName;
 };
 
 class RenderPath