Trying new meshlet gen approach

This commit is contained in:
Dynamitos
2024-04-05 10:41:59 +02:00
parent 7eedaf61ba
commit 505e7d6547
19 changed files with 219 additions and 216 deletions
+1 -1
+1 -1
View File
@@ -31,5 +31,5 @@ float4 fragmentMain(in FragmentParameter params) : SV_Target
uint lightIndex = pLightCullingData.lightIndexList[startOffset + i];
result += pLightEnv.pointLights[lightIndex].illuminate(lightingParams, brdf);
}
return float4(result, 1.0f);
return float4(params.vertexColor, 1.0f);
}
+2 -2
View File
@@ -101,10 +101,10 @@ void cullLights(ComputeShaderInput in)
{
PointLight light = pLightEnv.pointLights[i];
float3 light_VS = mul(viewMatrix, float4(light.position_WS.xyz, 1.0f)).xyz;
//if(light.insideFrustum(groupFrustum, light_VS, nearClipVS, maxDepthVS))
if(light.insideFrustum(groupFrustum, light_VS, nearClipVS, maxDepthVS))
{
tAppendLight(i);
//if(!light.insidePlane(minPlane, light_VS))
if(!light.insidePlane(minPlane, light_VS))
{
oAppendLight(i);
}
+6 -5
View File
@@ -29,10 +29,10 @@ void taskMain(
localToView = mul(pViewParams.viewMatrix, instance.transformMatrix);
float3 origin = float3(0, 0, 0);
float3 corners[4] = {
screenToView(float4(pViewParams.screenDimensions, -1.0f, 1.0f)).xyz,
screenToView(float4(pViewParams.screenDimensions, -1.0f, 1.0f)).xyz,
screenToView(float4(pViewParams.screenDimensions, -1.0f, 1.0f)).xyz,
screenToView(float4(pViewParams.screenDimensions, -1.0f, 1.0f)).xyz
screenToView(float4(100.0f, 100.0f, -1.0f, 1.0f)).xyz,
screenToView(float4(pViewParams.screenDimensions.x - 100.0f, 100.0f, -1.0f, 1.0f)).xyz,
screenToView(float4(100.0f, pViewParams.screenDimensions.y - 100.0f, -1.0f, 1.0f)).xyz,
screenToView(float4(pViewParams.screenDimensions - float2(100.0f, 100.0f), -1.0f, 1.0f)).xyz
};
viewFrustum.sides[0] = computePlane(origin, corners[2], corners[0]);
viewFrustum.sides[1] = computePlane(origin, corners[1], corners[3]);
@@ -47,7 +47,7 @@ void taskMain(
{
uint m = mesh.meshletOffset + i;
MeshletDescription meshlet = pScene.meshletInfos[m];
//if(meshlet.bounding.insideFrustum(localToView, viewFrustum))
if(meshlet.bounding.insideFrustum(localToView, viewFrustum))
{
uint index;
InterlockedAdd(head, 1, index);
@@ -99,6 +99,7 @@ void meshMain(
uint vertexIndex = pScene.vertexIndices[m.vertexOffset + v];
VertexAttributes attr = pVertexData.getAttributes(md.indicesOffset + vertexIndex);
vertices[v] = attr.getParameter(inst.transformMatrix);
vertices[v].vertexColor = m.color;
}
}
}
+2 -2
View File
@@ -19,7 +19,7 @@ struct BoundingSphere
bool result = true;
for(int i = 0; i < 4 && result; ++i)
{
if(dot(frustum.sides[i].n, transformed) - frustum.sides[i].d < scaledRange)
if(dot(frustum.sides[i].n, transformed) - frustum.sides[i].d < -scaledRange)
{
result = false;
}
@@ -48,7 +48,7 @@ struct AABB
for(int i = 0; i < 8; ++i)
{
float3 adjusted = corners[i].xyz / corners[i].w;
if(frustum.pointInside(corners[i].xyz))
if(frustum.pointInside(adjusted))
{
return true;
}
+2 -2
View File
@@ -38,7 +38,7 @@ struct Plane
float d;
bool pointInside(float3 point)
{
return dot(n, point) - d < 0.0f;
return dot(n, point) - d > 0.0f;
}
};
@@ -49,7 +49,7 @@ struct Frustum
{
for(int p = 0; p < 4; ++p)
{
if(sides[p].pointInside(point))
if(!sides[p].pointInside(point))
{
return false;
}
+5 -7
View File
@@ -15,16 +15,14 @@ using namespace Seele::Editor;
SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreateInfo &createInfo)
: View(graphics, owner, createInfo, "SceneView")
, scene(new Scene(graphics))
, renderGraph(RenderGraphBuilder::build(
DepthPrepass(graphics, scene),
LightCullingPass(graphics, scene),
BasePass(graphics, scene)
))
, cameraSystem(createInfo.dimensions, Vector(0, 0, 10))
{
cameraSystem.update(viewportCamera, static_cast<float>(Gfx::getCurrentFrameDelta()));
renderGraph.updateViewport(viewport);
renderGraph.addPass(new DepthPrepass(graphics, scene));
renderGraph.addPass(new LightCullingPass(graphics, scene));
renderGraph.addPass(new BasePass(graphics, scene));
renderGraph.setViewport(viewport);
renderGraph.createRenderPass();
}
SceneView::~SceneView()
+1 -4
View File
@@ -29,10 +29,7 @@ private:
OScene scene;
Component::Camera viewportCamera;
RenderGraph<
DepthPrepass,
LightCullingPass,
BasePass> renderGraph;
RenderGraph renderGraph;
ThreadPool pool;
ViewportControl cameraSystem;
+46 -36
View File
@@ -13,7 +13,7 @@ private:
Node(Node* prev, Node* next, const T& data)
: prev(prev)
, next(next)
, data(std::move(data))
, data(data)
{}
Node(Node* prev, Node* next, T&& data)
: prev(prev)
@@ -133,7 +133,7 @@ public:
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
List()
constexpr List()
: root(nullptr)
, tail(nullptr)
, beginIt(Iterator(root))
@@ -142,7 +142,7 @@ public:
, allocator(Allocator())
{
}
explicit List(const Allocator& alloc)
constexpr explicit List(const Allocator& alloc)
: root(nullptr)
, tail(nullptr)
, beginIt(Iterator(root))
@@ -151,7 +151,7 @@ public:
, allocator(alloc)
{
}
List(size_type count, const T& value = T(), const Allocator& alloc = Allocator())
constexpr List(size_type count, const T& value = T(), const Allocator& alloc = Allocator())
: List(alloc)
{
for(size_type i = 0; i < count; ++i)
@@ -159,7 +159,7 @@ public:
add(value);
}
}
List(size_type count, const Allocator& alloc = Allocator())
constexpr List(size_type count, const Allocator& alloc = Allocator())
: List(alloc)
{
for(size_type i = 0; i < count; ++i)
@@ -167,7 +167,7 @@ public:
add(T());
}
}
List(const List& other)
constexpr List(const List& other)
: List(std::allocator_traits<allocator_type>::select_on_container_copy_construction(other.allocator))
{
//TODO: improve
@@ -177,7 +177,7 @@ public:
}
}
List(const List& other, const Allocator& alloc)
constexpr List(const List& other, const Allocator& alloc)
: List(alloc)
{
//TODO: improve
@@ -186,7 +186,7 @@ public:
add(it);
}
}
List(List&& other)
constexpr List(List&& other)
: root(std::move(other.root))
, tail(std::move(other.tail))
, beginIt(std::move(other.beginIt))
@@ -196,7 +196,7 @@ public:
{
other._size = 0;
}
List(List&& other, const Allocator& alloc)
constexpr List(List&& other, const Allocator& alloc)
: root(std::move(other.root))
, tail(std::move(other.tail))
, beginIt(std::move(other.beginIt))
@@ -206,11 +206,11 @@ public:
{
other._size = 0;
}
~List()
constexpr ~List()
{
clear();
}
List& operator=(const List& other)
constexpr List& operator=(const List& other)
{
if(this != &other)
{
@@ -232,7 +232,7 @@ public:
}
return *this;
}
List& operator=(List&& other)
constexpr List& operator=(List&& other)
{
if(this != &other)
{
@@ -252,15 +252,15 @@ public:
return *this;
}
reference front()
constexpr reference front()
{
return root->data;
}
reference back()
constexpr reference back()
{
return tail->prev->data;
}
void clear()
constexpr void clear()
{
if (empty())
{
@@ -279,17 +279,17 @@ public:
_size = 0;
}
//Insert at the end
iterator add(const T &value)
constexpr iterator add(const T &value)
{
return addInternal(value);
}
iterator add(T&& value)
constexpr iterator add(T&& value)
{
return addInternal(std::move(value));
}
// takes all elements from other and move-inserts them into
// this, clearing other in the process
void moveElements(List&& other)
constexpr void moveElements(List&& other)
{
tail->prev->next = other.root;
other.root->prev = tail->prev;
@@ -326,13 +326,13 @@ public:
return insertedElement;
}
// front + popFront
value_type retrieve()
constexpr value_type retrieve()
{
value_type temp = std::move(root->data);
popFront();
return temp;
}
iterator remove(iterator pos)
constexpr iterator remove(iterator pos)
{
_size--;
Node *prev = pos.node->prev;
@@ -358,17 +358,27 @@ public:
markIteratorDirty();
return Iterator(next);
}
void popBack()
constexpr void popBack()
{
assert(_size > 0);
remove(Iterator(tail->prev));
}
void popFront()
constexpr void pop_back()
{
assert(_size > 0);
remove(Iterator(tail->prev));
}
constexpr void popFront()
{
assert(_size > 0);
remove(Iterator(root));
}
iterator insert(iterator pos, const T &value)
constexpr void pop_front()
{
assert(_size > 0);
remove(Iterator(root));
}
constexpr iterator insert(iterator pos, const T &value)
{
_size++;
if (root == nullptr)
@@ -393,7 +403,7 @@ public:
markIteratorDirty();
return Iterator(newNode);
}
iterator find(const T &value)
constexpr iterator find(const T &value)
{
for (Node *i = root; i != tail; i = i->next)
{
@@ -404,33 +414,33 @@ public:
}
return endIt;
}
bool empty() const
constexpr bool empty() const
{
return _size == 0;
}
size_type size() const
constexpr size_type size() const
{
return _size;
}
iterator begin()
constexpr iterator begin()
{
return beginIt;
}
const_iterator begin() const
constexpr const_iterator begin() const
{
return cbeginIt;
}
iterator end()
constexpr iterator end()
{
return endIt;
}
const_iterator end() const
constexpr const_iterator end() const
{
return cendIt;
}
private:
Node* allocateNode()
constexpr Node* allocateNode()
{
Node* node = allocator.allocate(1);
assert(node != nullptr);
@@ -439,7 +449,7 @@ private:
return node;
}
template<typename Type>
void initializeNode(Node* node, Type&& data)
constexpr void initializeNode(Node* node, Type&& data)
{
std::allocator_traits<NodeAllocator>::construct(allocator,
node,
@@ -447,16 +457,16 @@ private:
node->next,
std::forward<Type>(data));
}
void destroyNode(Node* node)
constexpr void destroyNode(Node* node)
{
std::allocator_traits<NodeAllocator>::destroy(allocator, node);
}
void deallocateNode(Node* node)
constexpr void deallocateNode(Node* node)
{
allocator.deallocate(node, 1);
}
template<typename ValueType>
iterator addInternal(ValueType&& value)
constexpr iterator addInternal(ValueType&& value)
{
if (root == nullptr)
{
@@ -474,7 +484,7 @@ private:
_size++;
return insertedElement;
}
void markIteratorDirty()
constexpr void markIteratorDirty()
{
beginIt = Iterator(root);
endIt = Iterator(tail);
+58 -25
View File
@@ -5,13 +5,13 @@
using namespace Seele;
void Meshlet::build(const Array<Vector>& positions, const Array<uint32>& indices, Array<Meshlet>& meshlets)
struct Triangle
{
StaticArray<uint32, 3> indices;
};
int findIndex(Meshlet& current, uint32 index)
{
Meshlet current = {
.numVertices = 0,
.numPrimitives = 0,
};
auto findIndex = [&current](uint32 index) -> int {
for (uint32 i = 0; i < current.numVertices; ++i)
{
if (current.uniqueVertices[i] == index)
@@ -24,31 +24,31 @@ void Meshlet::build(const Array<Vector>& positions, const Array<uint32>& indices
return -1;
}
current.uniqueVertices[current.numVertices] = index;
return current.numVertices++;
};
auto completeMeshlet = [&positions, &meshlets, &current]() {
for (uint32 i = 0; i < current.numVertices; ++i)
{
current.boundingBox.adjust(positions[current.uniqueVertices[i]]);
}
}
void completeMeshlet(Array<Meshlet>& meshlets, Meshlet& current)
{
meshlets.add(current);
current = {
.numVertices = 0,
.numPrimitives = 0,
};
};
for (size_t faceIndex = 0; faceIndex < indices.size() / 3; ++faceIndex)
{
int f1 = findIndex(indices[faceIndex * 3 + 0]);
int f2 = findIndex(indices[faceIndex * 3 + 1]);
int f3 = findIndex(indices[faceIndex * 3 + 2]);
}
void addTriangle(Array<Meshlet>& meshlets, Meshlet& current, Triangle tri)
{
int f1 = findIndex(current, tri.indices[0]);
int f2 = findIndex(current, tri.indices[1]);
int f3 = findIndex(current, tri.indices[2]);
if (f1 == -1 || f2 == -1 || f3 == -1)
{
completeMeshlet();
f1 = findIndex(indices[faceIndex * 3 + 0]);
f2 = findIndex(indices[faceIndex * 3 + 1]);
f3 = findIndex(indices[faceIndex * 3 + 2]);
completeMeshlet(meshlets, current);
f1 = findIndex(current, tri.indices[0]);
f2 = findIndex(current, tri.indices[1]);
f3 = findIndex(current, tri.indices[2]);
}
current.primitiveLayout[current.numPrimitives * 3 + 0] = uint8(f1);
current.primitiveLayout[current.numPrimitives * 3 + 1] = uint8(f2);
@@ -56,11 +56,44 @@ void Meshlet::build(const Array<Vector>& positions, const Array<uint32>& indices
current.numPrimitives++;
if (current.numPrimitives == Gfx::numPrimitivesPerMeshlet)
{
completeMeshlet();
completeMeshlet(meshlets, current);
}
}
void Meshlet::build(const Array<Vector>& positions, const Array<uint32>& indices, Array<Meshlet>& meshlets)
{
Meshlet current = {
.numVertices = 0,
.numPrimitives = 0,
};
Array<Triangle> triangles(indices.size() / 3);
for (size_t i = 0; i < triangles.size(); ++i)
{
triangles[i].indices[0] = indices[i * 3 + 0];
triangles[i].indices[1] = indices[i * 3 + 1];
triangles[i].indices[2] = indices[i * 3 + 2];
}
if (current.numVertices > 0)
while (!triangles.empty())
{
uint32 best = 0;
float lowestSurface = std::numeric_limits<float>::max();
AABB newAABB;
for (uint32 i = 0; i < triangles.size(); ++i)
{
AABB adjusted = current.boundingBox;
adjusted.adjust(positions[triangles[i].indices[0]]);
adjusted.adjust(positions[triangles[i].indices[1]]);
adjusted.adjust(positions[triangles[i].indices[2]]);
float surface = adjusted.surfaceArea();
if (surface < lowestSurface)
{
completeMeshlet();
lowestSurface = surface;
best = i;
newAABB = adjusted;
}
}
current.boundingBox = newAABB;
addTriangle(meshlets, current, triangles[best]);
triangles.removeAt(best);
}
}
+1 -1
View File
@@ -194,7 +194,7 @@ void BasePass::publishOutputs()
void BasePass::createRenderPass()
{
depthAttachment = resources->requestRenderTarget("DEPTHPREPASS_DEPTH");
depthAttachment.setLoadOp(Gfx::SE_ATTACHMENT_LOAD_OP_LOAD);
depthAttachment.setLoadOp(Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR);
depthAttachment.setInitialLayout(Gfx::SE_IMAGE_LAYOUT_GENERAL);
depthAttachment.setFinalLayout(Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
Gfx::RenderTargetLayout layout = Gfx::RenderTargetLayout{
@@ -177,6 +177,14 @@ void DepthPrepass::createRenderPass()
.dstStage = Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
.srcAccess = Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
.dstAccess = Gfx::SE_ACCESS_SHADER_READ_BIT,
},
{
.srcSubpass = 0,
.dstSubpass = ~0U,
.srcStage = Gfx::SE_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT,
.dstStage = Gfx::SE_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT,
.srcAccess = Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
.dstAccess = Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT,
}
};
renderPass = graphics->createRenderPass(std::move(layout), dependency, viewport);
+30 -69
View File
@@ -3,93 +3,54 @@
namespace Seele
{
template<typename... RenderPasses>
class RenderGraph;
template<>
class RenderGraph<>
class RenderGraph
{
public:
RenderGraph(PRenderGraphResources) {}
void updatePassData() {}
protected:
void setViewport(Gfx::PViewport) {}
void createRenderPass() {}
void beginFrame(const Component::Camera&) {}
void render() {}
void endFrame() {}
};
template<typename This, typename... Rest>
class RenderGraph<This, Rest...> : private RenderGraph<Rest...>
{
public:
RenderGraph(PRenderGraphResources resources, This pass, Rest... rest)
: RenderGraph<Rest...>(resources, std::move(rest)...)
, resources(resources)
, rp(std::move(pass))
RenderGraph()
{
rp.setResources(resources);
res = new RenderGraphResources();
}
template<typename PassData, typename... OtherData>
void updatePassData(PassData passData, OtherData... otherData)
void addPass(ORenderPass pass)
{
rp.updateViewFrame(std::move(passData));
RenderGraph<Rest...>::updatePassData(otherData...);
pass->setResources(res);
passes.add(std::move(pass));
}
void updateViewport(Gfx::PViewport viewport)
{
setViewport(viewport);
createRenderPass();
}
void render(const Component::Camera& cam)
{
beginFrame(cam);
render();
endFrame();
}
protected:
void setViewport(Gfx::PViewport viewport)
{
rp.setViewport(viewport);
RenderGraph<Rest...>::setViewport(viewport);
for (auto& pass : passes)
{
pass->setViewport(viewport);
}
}
void createRenderPass()
{
rp.createRenderPass();
RenderGraph<Rest...>::createRenderPass();
}
void beginFrame(const Component::Camera& cam)
for (auto& pass : passes)
{
rp.beginFrame(cam);
RenderGraph<Rest...>::beginFrame(cam);
pass->publishOutputs();
}
void render()
for (auto& pass : passes)
{
rp.render();
RenderGraph<Rest...>::render();
pass->createRenderPass();
}
void endFrame()
}
void render(const Component::Camera& cam)
{
rp.endFrame();
RenderGraph<Rest...>::endFrame();
for (auto& pass : passes)
{
pass->beginFrame(cam);
}
for (auto& pass : passes)
{
pass->render();
}
for (auto& pass : passes)
{
pass->endFrame();
}
}
private:
PRenderGraphResources resources;
This rp;
};
class RenderGraphBuilder
{
public:
template<typename... RenderPasses>
static RenderGraph<RenderPasses...> build(RenderPasses... renderPasses)
{
PRenderGraphResources resources = new RenderGraphResources();
return RenderGraph<RenderPasses...>(resources, std::move(renderPasses)...);
}
private:
RenderGraphBuilder() = delete;
PRenderGraphResources res;
List<ORenderPass> passes;
};
} // namespace Seele
@@ -44,6 +44,7 @@ protected:
Gfx::PViewport viewport;
PScene scene;
};
DEFINE_REF(RenderPass)
template<typename RP>
concept RenderPassType = std::derived_from<RP, RenderPass>;
+8 -8
View File
@@ -80,17 +80,17 @@ public:
constexpr void setStencilStoreOp(SeAttachmentStoreOp val) { stencilStoreOp = val; }
constexpr void setInitialLayout(SeImageLayout val) { initialLayout = val; }
constexpr void setFinalLayout(SeImageLayout val) { finalLayout = val; }
SeClearValue clear;
SeColorComponentFlags componentFlags;
SeClearValue clear = { 0 };
SeColorComponentFlags componentFlags = 0;
protected:
PTexture2D texture = nullptr;
PViewport viewport = nullptr;
SeImageLayout initialLayout;
SeImageLayout finalLayout;
SeAttachmentLoadOp loadOp;
SeAttachmentStoreOp storeOp;
SeAttachmentLoadOp stencilLoadOp;
SeAttachmentStoreOp stencilStoreOp;
SeImageLayout initialLayout = SE_IMAGE_LAYOUT_BEGIN_RANGE;
SeImageLayout finalLayout = SE_IMAGE_LAYOUT_BEGIN_RANGE;
SeAttachmentLoadOp loadOp = SE_ATTACHMENT_LOAD_OP_BEGIN_RANGE;
SeAttachmentStoreOp storeOp = SE_ATTACHMENT_STORE_OP_BEGIN_RANGE;
SeAttachmentLoadOp stencilLoadOp = SE_ATTACHMENT_LOAD_OP_BEGIN_RANGE;
SeAttachmentStoreOp stencilStoreOp = SE_ATTACHMENT_STORE_OP_BEGIN_RANGE;
};
struct RenderTargetLayout
+8 -8
View File
@@ -50,8 +50,8 @@ DEFINE_REF(ShaderExpression)
DECLARE_NAME_REF(Gfx, DescriptorSet)
struct ShaderParameter : public ShaderExpression
{
uint32 byteOffset;
uint32 binding;
uint32 byteOffset = 0;
uint32 binding = 0;
ShaderParameter() {}
ShaderParameter(std::string name, uint32 byteOffset, uint32 binding);
virtual ~ShaderParameter();
@@ -67,7 +67,7 @@ DEFINE_REF(ShaderParameter)
struct FloatParameter : public ShaderParameter
{
static constexpr uint64 IDENTIFIER = 0x01;
float data;
float data = 0.0f;
FloatParameter() {}
FloatParameter(std::string name, uint32 byteOffset, uint32 binding);
virtual ~FloatParameter();
@@ -81,7 +81,7 @@ DEFINE_REF(FloatParameter)
struct VectorParameter : public ShaderParameter
{
static constexpr uint64 IDENTIFIER = 0x02;
Vector data;
Vector data = Vector();
VectorParameter() {}
VectorParameter(std::string name, uint32 byteOffset, uint32 binding);
virtual ~VectorParameter();
@@ -95,7 +95,7 @@ DEFINE_REF(VectorParameter)
struct TextureParameter : public ShaderParameter
{
static constexpr uint64 IDENTIFIER = 0x04;
PTextureAsset data;
PTextureAsset data = nullptr;
TextureParameter() {}
TextureParameter(std::string name, uint32 byteOffset, uint32 binding);
virtual ~TextureParameter();
@@ -110,7 +110,7 @@ DECLARE_NAME_REF(Gfx, Sampler)
struct SamplerParameter : public ShaderParameter
{
static constexpr uint64 IDENTIFIER = 0x08;
Gfx::OSampler data;
Gfx::OSampler data = nullptr;
SamplerParameter() {}
SamplerParameter(std::string name, uint32 byteOffset, uint32 binding);
virtual ~SamplerParameter();
@@ -124,8 +124,8 @@ DEFINE_REF(SamplerParameter)
struct CombinedTextureParameter : public ShaderParameter
{
static constexpr uint64 IDENTIFIER = 0x10;
PTextureAsset data;
Gfx::PSampler sampler;
PTextureAsset data = nullptr;
Gfx::PSampler sampler = nullptr;
CombinedTextureParameter() {}
CombinedTextureParameter(std::string name, uint32 byteOffset, uint32 binding);
virtual ~CombinedTextureParameter();
+1
View File
@@ -1,4 +1,5 @@
#include "Transform.h"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/quaternion.hpp>
#include "Transform.h"
+8 -9
View File
@@ -16,16 +16,15 @@ GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreate
: View(graphics, window, createInfo, "Game")
, scene(new Scene(graphics))
, gameInterface(dllPath)
, renderGraph(RenderGraphBuilder::build(
DepthPrepass(graphics, scene),
LightCullingPass(graphics, scene),
BasePass(graphics, scene),
DebugPass(graphics, scene)
//SkyboxRenderPass(graphics, scene)
))
{
reloadGame();
renderGraph.updateViewport(viewport);
renderGraph.addPass(new DepthPrepass(graphics, scene));
renderGraph.addPass(new LightCullingPass(graphics, scene));
renderGraph.addPass(new BasePass(graphics, scene));
//renderGraph.addPass(new DebugPass(graphics, scene));
//renderGraph.addPass(new SkyboxRenderPass(graphics, scene));
renderGraph.setViewport(viewport);
renderGraph.createRenderPass();
}
GameView::~GameView()
@@ -77,7 +76,7 @@ void GameView::render()
void GameView::applyArea(URect)
{
renderGraph.updateViewport(viewport);
renderGraph.setViewport(viewport);
}
void GameView::reloadGame()
+1 -7
View File
@@ -32,13 +32,7 @@ protected:
virtual void applyArea(URect rect) override;
OScene scene;
GameInterface gameInterface;
RenderGraph<
DepthPrepass,
LightCullingPass,
BasePass,
DebugPass
//SkyboxRenderPass
> renderGraph;
RenderGraph renderGraph;
PSystemGraph systemGraph;
System::PKeyboardInput keyboardSystem;