Jelajahi Sumber

Render textures are now rendered in correct order (scene view before main window)

Marko Pintera 12 tahun lalu
induk
melakukan
a2b4c80b20

+ 7 - 0
BansheeEngine/Include/BsCamera.h

@@ -422,6 +422,13 @@ namespace BansheeEngine {
 		bool getIgnoreSceneRenderables() const { return mIgnoreSceneRenderables; }
 
 		CM::INT32 getPriority() const { return mPriority; }
+
+		/**
+		 * @brief	Sets a priority that determines in which orders the cameras are rendered to.
+		 * 			This only applies to cameras rendering to the same render target. 
+		 *
+		 * @param	priority	The priority. Higher value means the camera will be rendered sooner.
+		 */
 		void setPriority(CM::INT32 priority) { mPriority = priority; }
 
 		CM::UINT64 getLayers() const { return mLayers; }

+ 2 - 1
CamelotClient/Source/BsMainEditorWindow.cpp

@@ -48,9 +48,10 @@ namespace BansheeEditor
 		HCamera sceneCamera = sceneCameraGO->addComponent<Camera>();
 
 		RenderTexturePtr sceneRenderTarget = RenderTexture::create(TEX_TYPE_2D, 800, 600);
+		sceneRenderTarget->setPriority(1);
 
 		sceneCamera->initialize(sceneRenderTarget, 0.0f, 0.0f, 1.0f, 1.0f);
-		sceneCamera->setPriority(-1);
+		sceneCamera->setPriority(1);
 		sceneCameraGO->setPosition(Vector3(0,50,1240));
 		sceneCameraGO->lookAt(Vector3(0,50,-300));
 		sceneCamera->setNearClipDistance(5);

+ 6 - 0
CamelotCore/Include/CmRenderTarget.h

@@ -81,6 +81,12 @@ namespace CamelotFramework
 		virtual void setActive(bool state) { mActive = state; }
 
 		INT32 getPriority() const { return mPriority; }
+
+		/**
+		 * @brief	Sets a priority that determines in which orders the render targets the processed.
+		 * 			
+		 * @param	priority	The priority. Higher value means the target will be rendered to sooner.
+		 */
 		void setPriority(INT32 priority) { mPriority = priority; }
 
         /**

+ 0 - 1
TODO.txt

@@ -14,7 +14,6 @@ PROFILER:
   - Complex way would be to edit Timer and remove all the excess crap from it and just leave basic begin/end queries
  - When rendering GUI in front of scene view it seems to be rendering before the actual scene
   - This probably because the render texture alpha is less than 1, which makes it blend with the surface below it
- - In OpenGL rendering GUI to texture doesn't seem to work!?
  - Main window renders before the GUI render texture!
 
 TODO: Viewport can be modified from the sim thread, but is used on the core thread without any syncronization mechanisms. Maybe add a method that returns VIEWPORT_DATA, and have that used on the core thread.