Selaa lähdekoodia

Scene view now uses a separate render target instead of GUIViewport

Marko Pintera 12 vuotta sitten
vanhempi
sitoutus
42ba0b9198

+ 3 - 3
CamelotClient/Source/BsMainEditorWindow.cpp

@@ -29,9 +29,9 @@ namespace BansheeEditor
 		HSceneObject sceneCameraGO = SceneObject::create("SceneCamera");
 		HCamera sceneCamera = sceneCameraGO->addComponent<Camera>();
 
-		//RenderTexturePtr sceneRenderTarget = RenderTexture::create(TEX_TYPE_2D, 800, 600);
+		RenderTexturePtr sceneRenderTarget = RenderTexture::create(TEX_TYPE_2D, 800, 600);
 
-		sceneCamera->initialize(mCamera->getViewport()->getTarget(), 0.0f, 0.0f, 1.0f, 1.0f, 0);
+		sceneCamera->initialize(sceneRenderTarget, 0.0f, 0.0f, 1.0f, 1.0f, 0);
 		sceneCamera->setPriority(-1);
 		sceneCameraGO->setPosition(Vector3(0,50,1240));
 		sceneCameraGO->lookAt(Vector3(0,50,-300));
@@ -43,7 +43,7 @@ namespace BansheeEditor
 		GameObjectHandle<TestTextSprite> textSprite = mSceneObject->addComponent<TestTextSprite>();
 		textSprite->initialize(mCamera->getViewport().get(), renderWindow.get());
 
-		textSprite->init(sceneCamera, "Testing in a new row, does this work?", nullptr);
+		textSprite->init(sceneCamera, "Testing in a new row, does this work?", sceneRenderTarget);
 
 		//DrawHelper2D::instance().drawQuad(sceneCamera, FRect(0.0f, 0.2f, 0.75f, 0.5f), Color::White, DebugDrawCoordType::Normalized, 250.0f);
 		//DrawHelper2D::instance().drawQuad(sceneCamera, FRect(50.0f, 50.0f, 100.0f, 50.0f), Color::Blue, DebugDrawCoordType::Pixel, 250.0f);

+ 2 - 2
CamelotClient/Source/CmTestTextSprite.cpp

@@ -36,8 +36,8 @@ namespace CamelotFramework
 
 		GUIArea* area = GUIArea::createStretchedXY(*this, 0, 0, 0, 0);
 
-		//SpriteTexturePtr spriteTex = std::make_shared<SpriteTexture>(sceneView->getBindableColorTexture());
-		area->getLayout().addElement(GUIViewport::create(*this, GUILayoutOptions::fixed(800, 600), camera, camera->getAspectRatio(), camera->getHorzFOV()));
+		SpriteTexturePtr spriteTex = std::make_shared<SpriteTexture>(sceneView->getBindableColorTexture());
+		area->getLayout().addElement(GUITexture::create(*this, GUILayoutOptions::fixed(800, 600), spriteTex));
 	}
 
 	void TestTextSprite::update()

+ 15 - 2
EditorWindowDock.txt

@@ -25,8 +25,21 @@ Drag and drop manager currently ignores the provided icon, but it should use it
 Prevent docking if available size is less than 20 pixels, otherwise there might be some weirdness
 
 GUIViewport:
- - MAJOR TODO - Don't forget to update GUIViewport is to also gets updated when only mesh is dirty!
- - In DX11 it is not possible to clear just a sub-region of a render target
+ - MAJOR TODO - GUIViewport updateRenderElementsInternal only gets called when contents change, but viewport should update even if 
+    only its offset changes (normally that just marks the mesh as modified, which doesn't result in a call to updateRenderElementsInternal)
+
+ Make the drop overlays a transparent gray
+ - Their opacity increases when highlighted
+ - Make their borders use polygon AA (or line AA with a different color)
+
+Figure out how to render the overlay on top of all viewports, even when main window viewport gets rendered first.
+ - I'm guessing the DockManager will require its own Camera (doesn't make sense it would require camera, but it's fairly lightweight so it would be an okay solution)
+ - Then the camera viewport and target change as the dock overlay moves
+ - OR
+ - Have the inner camera viewport render first onto a render target, and then draw the main GUI
+   - This MIGHT be the proper way to do it. Otherwise my game viewport is always limited to whatever format is the main window render target set to.
+ - OR
+ - Render inner camera viewport first, and use stencil to mark the area as non-renderable?
 
 ------------------------