Preparing for Writeup
This commit is contained in:
@@ -5,7 +5,7 @@ using namespace Seele;
|
||||
|
||||
InspectorView::InspectorView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo)
|
||||
: View(graphics, window, createInfo)
|
||||
, renderGraph(UIPass(graphics, viewport, new Gfx::SwapchainAttachment(window->getGfxHandle())))
|
||||
, uiPass(UIPass(graphics, viewport, new Gfx::SwapchainAttachment(window->getGfxHandle())))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ InspectorView::~InspectorView()
|
||||
{
|
||||
}
|
||||
|
||||
void InspectorView::beginFrame()
|
||||
void InspectorView::beginUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void InspectorView::update()
|
||||
|
||||
}
|
||||
|
||||
void InspectorView::endFrame()
|
||||
void InspectorView::commitUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,15 @@ public:
|
||||
InspectorView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo);
|
||||
virtual ~InspectorView();
|
||||
|
||||
virtual void beginFrame() override;
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
virtual void endFrame() override;
|
||||
virtual void commitUpdate() override;
|
||||
|
||||
virtual void prepareRender() override;
|
||||
virtual void render() override;
|
||||
void selectActor();
|
||||
protected:
|
||||
UIPass renderGraph;
|
||||
UIPass uiPass;
|
||||
|
||||
UIPassData uiPassData;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "SceneView.h"
|
||||
#include "Scene/Scene.h"
|
||||
#include "Window.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Scene/Actor/CameraActor.h"
|
||||
#include "Scene/Components/CameraComponent.h"
|
||||
|
||||
@@ -15,15 +16,39 @@ Seele::SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const Viewpo
|
||||
{
|
||||
scene = new Scene(graphics);
|
||||
scene->addActor(activeCamera);
|
||||
AssetRegistry::importFile("/home/dynamitos/Assets/Ayaka/Avatar_Girl_Sword_Ayaka_Tex_Body_Diffuse.png");
|
||||
AssetRegistry::importFile("/home/dynamitos/Assets/Ayaka/Avatar_Girl_Sword_Ayaka_Tex_Body_Lightmap.png");
|
||||
AssetRegistry::importFile("/home/dynamitos/Assets/Ayaka/Avatar_Girl_Sword_Ayaka_Tex_Face_Diffuse.png");
|
||||
AssetRegistry::importFile("/home/dynamitos/Assets/Ayaka/Avatar_Girl_Sword_Ayaka_Tex_Hair_Diffuse.png");
|
||||
AssetRegistry::importFile("/home/dynamitos/Assets/Ayaka/Avatar_Girl_Sword_Ayaka_Tex_Hair_Lightmap.png");
|
||||
AssetRegistry::importFile("/home/dynamitos/Assets/Ayaka/Avatar_Girl_Tex_FaceLightmap.png");
|
||||
AssetRegistry::importFile("/home/dynamitos/Assets/Ayaka/Ayaka.fbx");
|
||||
PPrimitiveComponent ayaka = new PrimitiveComponent(AssetRegistry::findMesh("Ayaka"));
|
||||
ayaka->addWorldTranslation(Vector(0, 0, 100));
|
||||
ayaka->setWorldScale(Vector(0.1f, 0.1f, 0.1f));
|
||||
scene->addPrimitiveComponent(ayaka);
|
||||
|
||||
PRenderGraphResources resources = new RenderGraphResources();
|
||||
depthPrepass.setResources(resources);
|
||||
lightCullingPass.setResources(resources);
|
||||
basePass.setResources(resources);
|
||||
|
||||
depthPrepass.publishOutputs();
|
||||
lightCullingPass.publishOutputs();
|
||||
basePass.publishOutputs();
|
||||
|
||||
depthPrepass.createRenderPass();
|
||||
lightCullingPass.createRenderPass();
|
||||
basePass.createRenderPass();
|
||||
}
|
||||
|
||||
Seele::SceneView::~SceneView()
|
||||
{
|
||||
}
|
||||
|
||||
void SceneView::beginFrame()
|
||||
void SceneView::beginUpdate()
|
||||
{
|
||||
View::beginFrame();
|
||||
View::beginUpdate();
|
||||
scene->tick(Gfx::currentFrameDelta);
|
||||
}
|
||||
|
||||
@@ -31,7 +56,7 @@ void SceneView::update()
|
||||
{
|
||||
}
|
||||
|
||||
void SceneView::endFrame()
|
||||
void SceneView::commitUpdate()
|
||||
{
|
||||
depthPrepassData.staticDrawList = scene->getStaticMeshes();
|
||||
lightCullingPassData.lightEnv = scene->getLightBuffer();
|
||||
@@ -47,9 +72,17 @@ void SceneView::prepareRender()
|
||||
|
||||
void SceneView::render()
|
||||
{
|
||||
depthPrepass.beginFrame();
|
||||
lightCullingPass.beginFrame();
|
||||
basePass.beginFrame();
|
||||
|
||||
depthPrepass.render();
|
||||
lightCullingPass.render();
|
||||
basePass.render();
|
||||
|
||||
depthPrepass.endFrame();
|
||||
lightCullingPass.endFrame();
|
||||
basePass.endFrame();
|
||||
}
|
||||
|
||||
void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier)
|
||||
|
||||
@@ -13,9 +13,9 @@ class SceneView : public View
|
||||
public:
|
||||
SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreateInfo &createInfo);
|
||||
~SceneView();
|
||||
virtual void beginFrame() override;
|
||||
virtual void beginUpdate() override;
|
||||
virtual void update() override;
|
||||
virtual void endFrame() override;
|
||||
virtual void commitUpdate() override;
|
||||
|
||||
virtual void prepareRender() override;
|
||||
virtual void render() override;
|
||||
|
||||
@@ -14,7 +14,7 @@ View::~View()
|
||||
{
|
||||
}
|
||||
|
||||
void View::applyArea(URect area)
|
||||
void View::applyArea(URect)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ public:
|
||||
virtual ~View();
|
||||
|
||||
// These are called from the view thread, and handle updating game data
|
||||
virtual void beginFrame() {}
|
||||
virtual void beginUpdate() {}
|
||||
virtual void update() {}
|
||||
// End frame is called with a lock, so it is safe to write to shared memory
|
||||
virtual void endFrame() {}
|
||||
virtual void commitUpdate() {}
|
||||
|
||||
// These are called from the render thread
|
||||
// prepare render is also locked, so reading from shared memory is also safe
|
||||
|
||||
@@ -58,9 +58,9 @@ void Window::viewWorker(WindowView* windowView)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
windowView->view->beginFrame();
|
||||
windowView->view->beginUpdate();
|
||||
windowView->view->update();
|
||||
std::lock_guard lock(windowView->workerMutex);
|
||||
windowView->view->endFrame();
|
||||
windowView->view->commitUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user