Polymorphic Map and threadpool

This commit is contained in:
2021-11-01 20:25:16 +01:00
parent 9c48c48f8c
commit 1b7ab9b1f1
20 changed files with 1442 additions and 1280 deletions
+85 -85
View File
@@ -8,49 +8,49 @@
using namespace Seele;
Seele::SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreateInfo &createInfo)
: View(graphics, owner, createInfo)
, activeCamera(new CameraActor())
, depthPrepass(DepthPrepass(graphics, viewport, activeCamera))
, lightCullingPass(LightCullingPass(graphics, viewport, activeCamera))
, basePass(BasePass(graphics, viewport, activeCamera))
: View(graphics, owner, createInfo)
, activeCamera(new CameraActor())
, depthPrepass(DepthPrepass(graphics, viewport, activeCamera))
, lightCullingPass(LightCullingPass(graphics, viewport, activeCamera))
, basePass(BasePass(graphics, viewport, activeCamera))
{
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);*/
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, 0));
ayaka->setWorldScale(Vector(10, 10, 10));
scene->addPrimitiveComponent(ayaka);
AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Ely\\Ely.fbx");
AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Cube\\cube.obj");
AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Plane\\plane.fbx");
PPrimitiveComponent plane = new PrimitiveComponent(AssetRegistry::findMesh("plane"));
plane->setWorldScale(Vector(100, 100, 100));
PPrimitiveComponent arissa = new PrimitiveComponent(AssetRegistry::findMesh("Ely"));
arissa->addWorldTranslation(Vector(0, 0, 100));
arissa->setWorldScale(Vector(0.1f, 0.1f, 0.1f));
scene->addPrimitiveComponent(plane);
scene->addPrimitiveComponent(arissa);
/*AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Ely\\Ely.fbx");
AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Cube\\cube.obj");
AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Plane\\plane.fbx");
PPrimitiveComponent plane = new PrimitiveComponent(AssetRegistry::findMesh("plane"));
plane->setWorldScale(Vector(100, 100, 100));
PPrimitiveComponent arissa = new PrimitiveComponent(AssetRegistry::findMesh("Ely"));
arissa->addWorldTranslation(Vector(0, 0, 100));
arissa->setWorldScale(Vector(0.1f, 0.1f, 0.1f));
scene->addPrimitiveComponent(plane);
scene->addPrimitiveComponent(arissa);*/
PRenderGraphResources resources = new RenderGraphResources();
depthPrepass.setResources(resources);
lightCullingPass.setResources(resources);
basePass.setResources(resources);
PRenderGraphResources resources = new RenderGraphResources();
depthPrepass.setResources(resources);
lightCullingPass.setResources(resources);
basePass.setResources(resources);
depthPrepass.publishOutputs();
lightCullingPass.publishOutputs();
basePass.publishOutputs();
depthPrepass.publishOutputs();
lightCullingPass.publishOutputs();
basePass.publishOutputs();
depthPrepass.createRenderPass();
lightCullingPass.createRenderPass();
basePass.createRenderPass();
depthPrepass.createRenderPass();
lightCullingPass.createRenderPass();
basePass.createRenderPass();
}
Seele::SceneView::~SceneView()
@@ -59,8 +59,8 @@ Seele::SceneView::~SceneView()
void SceneView::beginUpdate()
{
View::beginUpdate();
scene->tick(Gfx::currentFrameDelta);
View::beginUpdate();
scene->tick(Gfx::currentFrameDelta);
}
void SceneView::update()
@@ -69,81 +69,81 @@ void SceneView::update()
void SceneView::commitUpdate()
{
depthPrepassData.staticDrawList = scene->getStaticMeshes();
lightCullingPassData.lightEnv = scene->getLightBuffer();
basePassData.staticDrawList = scene->getStaticMeshes();
depthPrepassData.staticDrawList = scene->getStaticMeshes();
lightCullingPassData.lightEnv = scene->getLightBuffer();
basePassData.staticDrawList = scene->getStaticMeshes();
}
void SceneView::prepareRender()
{
depthPrepass.updateViewFrame(depthPrepassData);
lightCullingPass.updateViewFrame(lightCullingPassData);
basePass.updateViewFrame(basePassData);
depthPrepass.updateViewFrame(depthPrepassData);
lightCullingPass.updateViewFrame(lightCullingPassData);
basePass.updateViewFrame(basePassData);
}
void SceneView::render()
{
depthPrepass.beginFrame();
lightCullingPass.beginFrame();
basePass.beginFrame();
depthPrepass.beginFrame();
lightCullingPass.beginFrame();
basePass.beginFrame();
depthPrepass.render();
lightCullingPass.render();
basePass.render();
depthPrepass.render();
lightCullingPass.render();
basePass.render();
depthPrepass.endFrame();
lightCullingPass.endFrame();
basePass.endFrame();
depthPrepass.endFrame();
lightCullingPass.endFrame();
basePass.endFrame();
}
void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier)
{
if(action != InputAction::RELEASE)
{
if(code == KeyCode::KEY_W)
{
activeCamera->getCameraComponent()->moveOrigin(1);
}
if(code == KeyCode::KEY_S)
{
activeCamera->getCameraComponent()->moveOrigin(-1);
}
}
if(action != InputAction::RELEASE)
{
if(code == KeyCode::KEY_W)
{
activeCamera->getCameraComponent()->moveOrigin(1);
}
if(code == KeyCode::KEY_S)
{
activeCamera->getCameraComponent()->moveOrigin(-1);
}
}
}
static bool mouseDown = false;
void SceneView::mouseMoveCallback(double xPos, double yPos)
{
static double prevXPos = 0.0f, prevYPos = 0.0f;
double deltaX = prevXPos - xPos;
double deltaY = prevYPos - yPos;
prevXPos = xPos;
prevYPos = yPos;
if(mouseDown)
{
activeCamera->getCameraComponent()->mouseMove((float)deltaX, (float)deltaY);
}
static double prevXPos = 0.0f, prevYPos = 0.0f;
double deltaX = prevXPos - xPos;
double deltaY = prevYPos - yPos;
prevXPos = xPos;
prevYPos = yPos;
if(mouseDown)
{
activeCamera->getCameraComponent()->mouseMove((float)deltaX, (float)deltaY);
}
}
void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier)
{
if(button == MouseButton::MOUSE_BUTTON_1 && action != InputAction::RELEASE)
{
mouseDown = true;
}
else
{
mouseDown = false;
}
if(button == MouseButton::MOUSE_BUTTON_1 && action != InputAction::RELEASE)
{
mouseDown = true;
}
else
{
mouseDown = false;
}
}
void SceneView::scrollCallback(double, double yOffset)
{
activeCamera->getCameraComponent()->mouseScroll(yOffset);
activeCamera->getCameraComponent()->mouseScroll(yOffset);
}
void SceneView::fileCallback(int, const char**)
{
}