Redo of render paths
This commit is contained in:
@@ -3,4 +3,5 @@ target_sources(SeeleEngine
|
||||
Component.h
|
||||
Component.cpp
|
||||
PrimitiveComponent.cpp
|
||||
PrimitiveComponent.h)
|
||||
PrimitiveComponent.h
|
||||
PrimitiveUniformBufferLayout.h)
|
||||
@@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
#include "Component.h"
|
||||
#include "Graphics/GraphicsResources.h"
|
||||
#include "Graphics/Mesh.h"
|
||||
#include "Material/MaterialInstance.h"
|
||||
#include "Graphics/MeshBatch.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
@@ -14,9 +16,10 @@ public:
|
||||
Matrix4 getRenderMatrix();
|
||||
|
||||
private:
|
||||
PMaterialInstance instance;
|
||||
Gfx::PVertexBuffer vertexBuffer;
|
||||
Gfx::PIndexBuffer indexBuffer;
|
||||
Array<PMaterialInstance> materials;
|
||||
Gfx::PUniformBuffer uniformBuffer;
|
||||
Array<StaticMeshBatch> staticMeshes;
|
||||
PMesh mesh;
|
||||
friend class Scene;
|
||||
};
|
||||
DEFINE_REF(PrimitiveComponent);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "Graphics/GraphicsResources.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
struct PrimitiveUniformBuffer
|
||||
{
|
||||
Matrix4 localToWorld;
|
||||
Vector4 worldToLocal;
|
||||
Vector4 actorWorldPosition;
|
||||
};
|
||||
} // namespace Seele
|
||||
@@ -32,14 +32,15 @@ void Scene::addPrimitiveComponent(PPrimitiveComponent comp)
|
||||
primitives.add(comp);
|
||||
}
|
||||
|
||||
Map<PMaterial, DrawState> Scene::getMeshBatches()
|
||||
Map<PMaterial, MeshBatch> Scene::getMeshBatches()
|
||||
{
|
||||
meshBatches.clear();
|
||||
for (auto primitive : primitives)
|
||||
{
|
||||
PMaterialInstance matInstance = primitive->instance;
|
||||
/* Array<PMaterial> materials = primitive->materials;
|
||||
PMaterialInstance matInstance = primitive->;
|
||||
PMaterial mat = matInstance->getBaseMaterial();
|
||||
DrawInstance inst;
|
||||
MeshBatch inst;
|
||||
inst.instance = primitive->instance;
|
||||
inst.vertexBuffer = primitive->vertexBuffer;
|
||||
inst.indexBuffer = primitive->indexBuffer;
|
||||
@@ -47,15 +48,15 @@ Map<PMaterial, DrawState> Scene::getMeshBatches()
|
||||
|
||||
if (meshBatches.find(mat) != meshBatches.end())
|
||||
{
|
||||
DrawState &state = meshBatches[mat];
|
||||
MeshBatchElement &state = meshBatches[mat];
|
||||
state.instances.add(inst);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawState state;
|
||||
MeshBatchElement state;
|
||||
state.instances.add(inst);
|
||||
meshBatches[mat] = state;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return meshBatches;
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "Actor/Actor.h"
|
||||
#include "Graphics/GraphicsResources.h"
|
||||
#include "Components/PrimitiveComponent.h"
|
||||
#include "Graphics/MeshBatch.h"
|
||||
#include "Material/Material.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
@@ -18,11 +20,11 @@ public:
|
||||
void addPrimitiveComponent(PPrimitiveComponent comp);
|
||||
|
||||
private:
|
||||
Map<PMaterial, DrawState> meshBatches;
|
||||
Map<PMaterial, MeshBatch> meshBatches;
|
||||
Array<PActor> rootActors;
|
||||
Array<PPrimitiveComponent> primitives;
|
||||
|
||||
const static int constant = 10;
|
||||
public:
|
||||
Map<PMaterial, DrawState> getMeshBatches();
|
||||
Map<PMaterial, MeshBatch> getMeshBatches();
|
||||
};
|
||||
} // namespace Seele
|
||||
Reference in New Issue
Block a user