Depth rendering of terrain works

This commit is contained in:
Dynamitos
2023-11-10 19:18:09 +01:00
parent effb0c6214
commit c30619d07d
28 changed files with 298 additions and 502 deletions
+2 -5
View File
@@ -4,7 +4,6 @@ if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif() endif()
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
# Handle superbuild first # Handle superbuild first
option (USE_SUPERBUILD "Whether or not a superbuild should be invoked" ON) option (USE_SUPERBUILD "Whether or not a superbuild should be invoked" ON)
@@ -59,10 +58,6 @@ endif()
if(WIN32) if(WIN32)
add_compile_definitions(USE_EXTENSIONS) add_compile_definitions(USE_EXTENSIONS)
endif() endif()
if(CMAKE_DEBUG_POSTFIX)
add_compile_definitions(ENABLE_VALIDATION)
add_compile_definitions(SEELE_DEBUG)
endif()
add_library(Engine SHARED "") add_library(Engine SHARED "")
@@ -127,6 +122,8 @@ else()
target_compile_options(Engine PUBLIC -g -Wall -Wextra -Wno-error -pedantic -std=c++20 -Wno-missing-field-initializers -Wno-unused-function) target_compile_options(Engine PUBLIC -g -Wall -Wextra -Wno-error -pedantic -std=c++20 -Wno-missing-field-initializers -Wno-unused-function)
target_compile_options(Editor PUBLIC -g -Wall -Wextra -Wno-error -pedantic -std=c++20) target_compile_options(Editor PUBLIC -g -Wall -Wextra -Wno-error -pedantic -std=c++20)
endif() endif()
target_compile_options(Engine PUBLIC "$<$<CONFIG:DEBUG>:-DENABLE_VALIDATION>")
target_compile_options(Engine PUBLIC "$<$<CONFIG:DEBUG>:-DSEELE_DEBUG>")
add_subdirectory(src/) add_subdirectory(src/)
+2 -1
View File
@@ -1,3 +1,4 @@
import Common;
import VertexData; import VertexData;
import MaterialParameter; import MaterialParameter;
@@ -10,7 +11,7 @@ struct Scene
{ {
StructuredBuffer<InstanceData> instances; StructuredBuffer<InstanceData> instances;
} }
layout(set=2)
ParameterBlock<Scene> pScene; ParameterBlock<Scene> pScene;
[shader("vertex")] [shader("vertex")]
+1
View File
@@ -9,6 +9,7 @@ struct ViewParameter
float4 cameraPos_WS; float4 cameraPos_WS;
float2 screenDimensions; float2 screenDimensions;
} }
layout(set = 0)
ParameterBlock<ViewParameter> pViewParams; ParameterBlock<ViewParameter> pViewParams;
+10 -10
View File
@@ -8,22 +8,22 @@ struct StaticMeshVertexData : IVertexData
{ {
VertexAttributes attributes; VertexAttributes attributes;
MaterialParameter params; MaterialParameter params;
float4 localPos = float4(positions[index], 1); float4 localPos = float4(positions[3 * index + 0], positions[3 * index + 1], positions[3 * index + 2], 1);
float4 worldPos = mul(transform, localPos); float4 worldPos = mul(transform, localPos);
float4 viewPos = mul(pViewParams.viewMatrix, worldPos); float4 viewPos = mul(pViewParams.viewMatrix, worldPos);
float4 clipPos = mul(pViewParams.projectionMatrix, viewPos); float4 clipPos = mul(pViewParams.projectionMatrix, viewPos);
params.worldPosition = worldPos.xyz; params.worldPosition = worldPos.xyz;
params.texCoords = texCoords[index]; params.texCoords = float2(texCoords[2 * index + 0], texCoords[2 * index + 1]);
params.normal = normals[index]; params.normal = float3(normals[3 * index + 0], normals[3 * index + 1], normals[3 * index + 2]);
params.tangent = tangents[index]; params.tangent = float3(tangents[3 * index + 0], tangents[3 * index + 1], tangents[3 * index + 2]);
params.biTangent = biTangents[index]; params.biTangent = float3(biTangents[3 * index + 0], biTangents[3 * index + 1], biTangents[3 * index + 2]);
attributes.parameter = params; attributes.parameter = params;
attributes.clipPosition = clipPos; attributes.clipPosition = clipPos;
return attributes; return attributes;
} }
StructuredBuffer<float3> positions; StructuredBuffer<float> positions;
StructuredBuffer<float2> texCoords; StructuredBuffer<float> texCoords;
StructuredBuffer<float3> normals; StructuredBuffer<float> normals;
StructuredBuffer<float3> tangents; StructuredBuffer<float> tangents;
StructuredBuffer<float3> biTangents; StructuredBuffer<float> biTangents;
}; };
+1
View File
@@ -4,4 +4,5 @@ interface IVertexData
{ {
VertexAttributes getAttributes(uint index, float4x4 transform); VertexAttributes getAttributes(uint index, float4x4 transform);
}; };
layout(set = 1)
ParameterBlock<IVertexData> pVertexData; ParameterBlock<IVertexData> pVertexData;
+118 -322
View File
@@ -1,114 +1,45 @@
#version 450 #version 450
#extension GL_EXT_samplerless_texture_functions : require
layout(row_major) uniform; layout(row_major) uniform;
layout(row_major) buffer; layout(row_major) buffer;
#line 11 0 #line 5 0
struct CullingParams_0 struct InstanceData_0
{ {
uvec3 numThreadGroups_0; mat4x4 transformMatrix_0;
uint pad0_0;
uvec3 numThreads_0;
uint pad1_0;
}; };
#line 35 1
layout(binding = 0, set = 1)
layout(std140) uniform _S1
{
uvec3 numThreadGroups_0;
uint pad0_0;
uvec3 numThreads_0;
uint pad1_0;
}gCullingParams_0;
#line 2113 2
layout(binding = 1, set = 1)
uniform texture2D gCullingParams_depthTextureVS_0;
#line 11 0
layout(std430, binding = 2, set = 1) buffer StructuredBuffer_uint_t_0 {
uint _data[];
} gCullingParams_oLightIndexCounter_0;
#line 11
layout(std430, binding = 3, set = 1) buffer StructuredBuffer_uint_t_1 {
uint _data[];
} gCullingParams_tLightIndexCounter_0;
#line 11
layout(std430, binding = 4, set = 1) buffer StructuredBuffer_uint_t_2 {
uint _data[];
} gCullingParams_oLightIndexList_0;
#line 11
layout(std430, binding = 5, set = 1) buffer StructuredBuffer_uint_t_3 {
uint _data[];
} gCullingParams_tLightIndexList_0;
#line 1572 2
layout(rg32ui)
layout(binding = 6, set = 1)
uniform uimage2D gCullingParams_oLightGrid_0;
#line 1572
layout(rg32ui)
layout(binding = 7, set = 1)
uniform uimage2D gCullingParams_tLightGrid_0;
#line 26 1
struct Plane_0
{
vec3 n_0;
float d_0;
};
struct Frustum_0
{
Plane_0 sides_0[4];
Plane_0 basePlane_0;
};
#line 11 0
layout(std430, binding = 8, set = 1) readonly buffer StructuredBuffer_Frustum_t_0 {
Frustum_0 _data[];
} gCullingParams_frustums_0;
#line 64 3
struct LightEnv_0
{
uint numDirectionalLights_0;
uint numPointLights_0;
};
#line 25
layout(binding = 0, set = 2)
layout(std140) uniform _S2
{
uint numDirectionalLights_0;
uint numPointLights_0;
}gLightEnv_0;
#line 22 #line 22
struct PointLight_0 layout(std430, binding = 0) readonly buffer StructuredBuffer_InstanceData_t_0 {
{ InstanceData_0 _data[];
vec4 position_WS_0; } pScene_instances_0;
vec4 colorRange_0;
};
#line 64
layout(std430, binding = 2, set = 2) readonly buffer StructuredBuffer_PointLight_t_0 {
PointLight_0 _data[];
} gLightEnv_pointLights_0;
#line 5 1 #line 5 1
layout(std430, binding = 0, set = 2) readonly buffer StructuredBuffer_float3_t_0 {
vec3 _data[];
} pVertexData_positions_0;
#line 5
layout(std430, binding = 1, set = 2) readonly buffer StructuredBuffer_float2_t_0 {
vec2 _data[];
} pVertexData_texCoords_0;
#line 5
layout(std430, binding = 2, set = 2) readonly buffer StructuredBuffer_float3_t_1 {
vec3 _data[];
} pVertexData_normals_0;
#line 5
layout(std430, binding = 3, set = 2) readonly buffer StructuredBuffer_float3_t_2 {
vec3 _data[];
} pVertexData_tangents_0;
#line 5
layout(std430, binding = 4, set = 2) readonly buffer StructuredBuffer_float3_t_3 {
vec3 _data[];
} pVertexData_biTangents_0;
#line 5 2
struct ViewParameter_0 struct ViewParameter_0
{ {
mat4x4 viewMatrix_0; mat4x4 viewMatrix_0;
@@ -117,266 +48,131 @@ struct ViewParameter_0
vec2 screenDimensions_0; vec2 screenDimensions_0;
}; };
layout(binding = 0)
layout(std140) uniform _S3 #line 12
layout(binding = 0, set = 1)
layout(std140) uniform _S1
{ {
mat4x4 viewMatrix_0; mat4x4 viewMatrix_0;
mat4x4 projectionMatrix_0; mat4x4 projectionMatrix_0;
vec4 cameraPos_WS_0; vec4 cameraPos_WS_0;
vec2 screenDimensions_0; vec2 screenDimensions_0;
}viewParams_0; }pViewParams_0;
#line 39 0 #line 4206 3
shared uint uMinDepth_0; layout(location = 0)
out vec3 _S2;
#line 40 #line 4206
shared uint uMaxDepth_0; layout(location = 1)
out vec3 _S3;
#line 4206
shared uint oLightCount_0; layout(location = 2)
out vec2 _S4;
#line 4206
shared uint tLightCount_0; layout(location = 3)
out vec3 _S5;
#line 42 #line 4206
shared Frustum_0 groupFrustum_0; layout(location = 4)
out vec3 _S6;
#line 50 #line 4206
shared uint tLightList_0[1024]; layout(location = 5)
out vec3 _S7;
#line 63 #line 4206
void tAppendLight_0(uint lightIndex_0) layout(location = 6)
out vec3 _S8;
#line 1 4
struct MaterialParameter_0
{ {
uint index_0; vec3 position_TS_0;
((index_0) = atomicAdd((tLightCount_0), (1U))); vec3 worldPosition_0;
if(index_0 < 1024U) vec2 texCoords_0;
{ vec3 normal_0;
tLightList_0[index_0] = lightIndex_0; vec3 tangent_0;
vec3 biTangent_0;
vec3 viewDir_TS_0;
};
#line 67 struct VertexAttributes_0
} {
MaterialParameter_0 parameter_0;
vec4 clipPosition_0;
};
#line 9 1
VertexAttributes_0 StaticMeshVertexData_getAttributes_0(uint _S9, mat4x4 _S10)
{
return; vec4 worldPos_0 = (((vec4(pVertexData_positions_0._data[_S9], 1.0)) * (_S10)));
vec4 clipPos_0 = ((((((worldPos_0) * (pViewParams_0.viewMatrix_0)))) * (pViewParams_0.projectionMatrix_0)));
#line 10
MaterialParameter_0 params_0;
#line 15
params_0.worldPosition_0 = worldPos_0.xyz;
params_0.texCoords_0 = pVertexData_texCoords_0._data[_S9];
params_0.normal_0 = pVertexData_normals_0._data[_S9];
params_0.tangent_0 = pVertexData_tangents_0._data[_S9];
params_0.biTangent_0 = pVertexData_biTangents_0._data[_S9];
#line 9
VertexAttributes_0 attributes_0;
#line 20
attributes_0.parameter_0 = params_0;
attributes_0.clipPosition_0 = clipPos_0;
return attributes_0;
} }
#line 58 3 #line 18 0
vec3 PointLight_getViewPos_0(PointLight_0 this_0)
{
return (((this_0.position_WS_0) * (viewParams_0.viewMatrix_0))).xyz;
}
#line 36
bool PointLight_insidePlane_0(PointLight_0 this_1, Plane_0 plane_0)
{
return dot(plane_0.n_0, PointLight_getViewPos_0(this_1).xyz) - plane_0.d_0 < - this_1.colorRange_0.w;
}
#line 46 0
shared uint oLightList_0[1024];
#line 53
void oAppendLight_0(uint lightIndex_1)
{
uint index_1;
((index_1) = atomicAdd((oLightCount_0), (1U)));
if(index_1 < 1024U)
{
oLightList_0[index_1] = lightIndex_1;
#line 57
}
return;
}
#line 45
shared uint oLightIndexStartOffset_0;
shared uint tLightIndexStartOffset_0;
#line 75
layout(local_size_x = 32, local_size_y = 32, local_size_z = 1) in;
void main() void main()
{ {
ivec3 _S4 = ivec3(ivec2(gl_GlobalInvocationID.xy), 0);
uint uDepth_0 = floatBitsToUint((texelFetch((gCullingParams_depthTextureVS_0), ((_S4)).xy, ((_S4)).z)).x); #line 18
bool _S5 = gl_LocalInvocationIndex == 0U; VertexAttributes_0 _S11 = StaticMeshVertexData_getAttributes_0(uint(gl_VertexIndex), pScene_instances_0._data[uint(gl_InstanceIndex)].transformMatrix_0);
#line 81 #line 18
if(_S5) _S2 = _S11.parameter_0.position_TS_0;
{
uMinDepth_0 = 4294967295U;
uMaxDepth_0 = 0U;
oLightCount_0 = 0U;
tLightCount_0 = 0U;
groupFrustum_0 = gCullingParams_frustums_0._data[gl_WorkGroupID.x + gl_WorkGroupID.y * gCullingParams_0.numThreadGroups_0.x];
#line 81 #line 18
} _S3 = _S11.parameter_0.worldPosition_0;
#line 90 #line 18
barrier(); _S4 = _S11.parameter_0.texCoords_0;
atomicMin((uMinDepth_0), (uDepth_0)); #line 18
atomicMax((uMaxDepth_0), (uDepth_0)); _S5 = _S11.parameter_0.normal_0;
barrier(); #line 18
_S6 = _S11.parameter_0.tangent_0;
#line 104 #line 18
Plane_0 _S6 = { vec3(0.0, 0.0, -1.0), - uintBitsToFloat(uMinDepth_0) }; _S7 = _S11.parameter_0.biTangent_0;
#line 125 #line 18
uvec2 _S7 = gl_WorkGroupID.xy; _S8 = _S11.parameter_0.viewDir_TS_0;
#line 125 #line 18
uint i_0 = gl_LocalInvocationIndex; gl_Position = _S11.clipPosition_0;
#line 125 #line 18
for(;;)
{
#line 106
if(i_0 < gLightEnv_0.numPointLights_0)
{
}
else
{
#line 106
break;
}
PointLight_0 light_0 = gLightEnv_pointLights_0._data[i_0];
tAppendLight_0(i_0);
if(!PointLight_insidePlane_0(light_0, _S6))
{
oAppendLight_0(i_0);
#line 113
}
#line 106
i_0 = i_0 + 1024U;
#line 106
}
#line 120
barrier();
if(_S5)
{
((oLightIndexStartOffset_0) = atomicAdd((gCullingParams_oLightIndexCounter_0._data[0U]), (oLightCount_0)));
imageStore((gCullingParams_oLightGrid_0), ivec2((_S7)), uvec4(uvec2(oLightIndexStartOffset_0, oLightCount_0), uint(0), uint(0)));
((tLightIndexStartOffset_0) = atomicAdd((gCullingParams_tLightIndexCounter_0._data[0U]), (tLightCount_0)));
imageStore((gCullingParams_tLightGrid_0), ivec2((_S7)), uvec4(uvec2(tLightIndexStartOffset_0, tLightCount_0), uint(0), uint(0)));
#line 122
}
#line 130
barrier();
#line 130
uint k_0;
#line 130
if(gl_LocalInvocationIndex < oLightCount_0)
{
#line 130
k_0 = gl_LocalInvocationIndex;
#line 130
for(;;)
{
gCullingParams_oLightIndexList_0._data[oLightIndexStartOffset_0 + k_0] = oLightList_0[k_0];
#line 132
uint j_0 = k_0 + 1024U;
#line 132
if(j_0 < oLightCount_0)
{
}
else
{
#line 132
break;
}
#line 132
k_0 = j_0;
#line 132
}
#line 132
}
#line 132
if(gl_LocalInvocationIndex < tLightCount_0)
{
#line 132
k_0 = gl_LocalInvocationIndex;
#line 132
for(;;)
{
#line 140
gCullingParams_tLightIndexList_0._data[tLightIndexStartOffset_0 + k_0] = tLightList_0[k_0];
#line 138
uint k_1 = k_0 + 1024U;
#line 138
if(k_1 < tLightCount_0)
{
}
else
{
#line 138
break;
}
#line 138
k_0 = k_1;
#line 138
}
#line 138
}
#line 144
return; return;
} }
+4
View File
@@ -239,6 +239,10 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, const Array<PMaterialIns
completeMeshlet(); completeMeshlet();
} }
} }
if (!uniqueVertices.empty())
{
completeMeshlet();
}
vertexData->loadMesh(id, meshlets); vertexData->loadMesh(id, meshlets);
+7 -5
View File
@@ -8,7 +8,9 @@ template<typename... Types>
struct Dependencies; struct Dependencies;
template<> template<>
struct Dependencies<> struct Dependencies<>
{}; {
int x;
};
template<typename This, typename... Rest> template<typename This, typename... Rest>
struct Dependencies<This, Rest...> : public Dependencies<Rest...> struct Dependencies<This, Rest...> : public Dependencies<Rest...>
{ {
@@ -17,6 +19,7 @@ struct Dependencies<This, Rest...> : public Dependencies<Rest...>
{ {
return Dependencies<This, Rest..., Right...>(); return Dependencies<This, Rest..., Right...>();
} }
int x;
}; };
namespace Component namespace Component
@@ -24,16 +27,15 @@ namespace Component
template<typename Comp> template<typename Comp>
static int accessComponent(Comp& comp); static int accessComponent(Comp& comp);
} }
template<typename Comp>
template<typename T, typename... Deps> concept has_dependencies = requires(Comp) { Comp::dependencies; };
concept is_component = std::same_as<decltype(T::dependencies), Dependencies<Deps...>>;
#define REQUIRE_COMPONENT(x) \ #define REQUIRE_COMPONENT(x) \
private: \ private: \
x& get##x() { return *tl_##x; } \ x& get##x() { return *tl_##x; } \
const x& get##x() const { return *tl_##x; }; \ const x& get##x() const { return *tl_##x; }; \
public: \ public: \
static Dependencies<x> dependencies; constexpr static Dependencies<x> dependencies;
#define DECLARE_COMPONENT(x) \ #define DECLARE_COMPONENT(x) \
thread_local extern x* tl_##x; \ thread_local extern x* tl_##x; \
-10
View File
@@ -8,53 +8,43 @@ DEFINE_COMPONENT(Transform)
void Transform::setPosition(Vector pos) void Transform::setPosition(Vector pos)
{ {
transform.setPosition(pos); transform.setPosition(pos);
dirty = true;
} }
void Transform::setRotation(Quaternion quat) void Transform::setRotation(Quaternion quat)
{ {
transform.setRotation(quat); transform.setRotation(quat);
dirty = true;
} }
void Transform::setScale(Vector scale) void Transform::setScale(Vector scale)
{ {
transform.setScale(scale); transform.setScale(scale);
dirty = true;
} }
void Transform::setRelativeLocation(Vector location) void Transform::setRelativeLocation(Vector location)
{ {
transform = Math::Transform(location, transform.getRotation(), transform.getScale()); transform = Math::Transform(location, transform.getRotation(), transform.getScale());
dirty = true;
} }
void Transform::setRelativeRotation(Vector rotation) void Transform::setRelativeRotation(Vector rotation)
{ {
transform = Math::Transform(transform.getPosition(), Quaternion(rotation), transform.getScale()); transform = Math::Transform(transform.getPosition(), Quaternion(rotation), transform.getScale());
dirty = true;
} }
void Transform::setRelativeRotation(Quaternion rotation) void Transform::setRelativeRotation(Quaternion rotation)
{ {
transform = Math::Transform(transform.getPosition(), rotation, transform.getScale()); transform = Math::Transform(transform.getPosition(), rotation, transform.getScale());
dirty = true;
} }
void Transform::setRelativeScale(Vector scale) void Transform::setRelativeScale(Vector scale)
{ {
transform = Math::Transform(transform.getPosition(), transform.getRotation(), scale); transform = Math::Transform(transform.getPosition(), transform.getRotation(), scale);
dirty = true;
} }
void Transform::addRelativeLocation(Vector translation) void Transform::addRelativeLocation(Vector translation)
{ {
transform = Math::Transform(transform.getPosition() + translation, transform.getRotation(), transform.getScale()); transform = Math::Transform(transform.getPosition() + translation, transform.getRotation(), transform.getScale());
dirty = true;
} }
void Transform::addRelativeRotation(Vector rotation) void Transform::addRelativeRotation(Vector rotation)
{ {
transform = Math::Transform(transform.getPosition(), transform.getRotation() * Quaternion(rotation), transform.getScale()); transform = Math::Transform(transform.getPosition(), transform.getRotation() * Quaternion(rotation), transform.getScale());
dirty = true;
} }
void Transform::addRelativeRotation(Quaternion rotation) void Transform::addRelativeRotation(Quaternion rotation)
{ {
transform = Math::Transform(transform.getPosition(), transform.getRotation() * rotation, transform.getScale()); transform = Math::Transform(transform.getPosition(), transform.getRotation() * rotation, transform.getScale());
dirty = true;
} }
-4
View File
@@ -18,9 +18,6 @@ struct Transform
Matrix4 toMatrix() const { return transform.toMatrix(); } Matrix4 toMatrix() const { return transform.toMatrix(); }
bool isDirty() const { return dirty; }
void clean() { dirty = false; }
void setPosition(Vector pos); void setPosition(Vector pos);
void setRotation(Quaternion quat); void setRotation(Quaternion quat);
void setScale(Vector scale); void setScale(Vector scale);
@@ -34,7 +31,6 @@ struct Transform
void addRelativeRotation(Quaternion rotation); void addRelativeRotation(Quaternion rotation);
void addRelativeRotation(Vector rotation); void addRelativeRotation(Vector rotation);
private: private:
bool dirty = true;
Math::Transform transform; Math::Transform transform;
}; };
DECLARE_COMPONENT(Transform) DECLARE_COMPONENT(Transform)
+1 -1
View File
@@ -115,7 +115,7 @@ struct ShaderCreateInfo
Array<std::string> additionalModules; Array<std::string> additionalModules;
std::string name; // Debug info std::string name; // Debug info
std::string entryPoint; std::string entryPoint;
Array<const char*> typeParameter; Array<Pair<const char*, const char*>> typeParameter;
Map<const char*, const char*> defines; Map<const char*, const char*> defines;
}; };
@@ -30,6 +30,7 @@ private:
PCameraActor source; PCameraActor source;
Gfx::OPipelineLayout basePassLayout; Gfx::OPipelineLayout basePassLayout;
// Set 0: viewParameter, provided by renderpass // Set 0: viewParameter, provided by renderpass
static constexpr uint32 INDEX_VIEW_PARAMS = 0;
// Set 1: light environment, provided by lightenv // Set 1: light environment, provided by lightenv
static constexpr uint32 INDEX_LIGHT_ENV = 1; static constexpr uint32 INDEX_LIGHT_ENV = 1;
// Set 2: light culling data // Set 2: light culling data
@@ -49,9 +49,10 @@ void DepthPrepass::render()
permutation.setVertexFile("LegacyBasePass"); permutation.setVertexFile("LegacyBasePass");
} }
graphics->beginRenderPass(renderPass); graphics->beginRenderPass(renderPass);
Array<Gfx::PRenderCommand> commands;
for (VertexData* vertexData : VertexData::getList()) for (VertexData* vertexData : VertexData::getList())
{ {
std::strncpy(permutation.vertexDataName, vertexData->getTypeName().c_str(), sizeof(permutation.vertexDataName)); permutation.setVertexData(vertexData->getTypeName());
const auto& materials = vertexData->getMaterialData(); const auto& materials = vertexData->getMaterialData();
for (const auto& [_, materialData] : materials) for (const auto& [_, materialData] : materials)
{ {
@@ -64,6 +65,7 @@ void DepthPrepass::render()
Gfx::PermutationId id(permutation); Gfx::PermutationId id(permutation);
Gfx::PRenderCommand command = graphics->createRenderCommand("DepthRender"); Gfx::PRenderCommand command = graphics->createRenderCommand("DepthRender");
command->setViewport(viewport);
Gfx::OPipelineLayout layout = graphics->createPipelineLayout(depthPrepassLayout); Gfx::OPipelineLayout layout = graphics->createPipelineLayout(depthPrepassLayout);
//layout->addDescriptorLayout(INDEX_MATERIAL, materialData.material->getDescriptorLayout()); //layout->addDescriptorLayout(INDEX_MATERIAL, materialData.material->getDescriptorLayout());
layout->addDescriptorLayout(INDEX_VERTEX_DATA, vertexData->getVertexDataLayout()); layout->addDescriptorLayout(INDEX_VERTEX_DATA, vertexData->getVertexDataLayout());
@@ -122,11 +124,14 @@ void DepthPrepass::render()
{ {
command->draw(vertexData->getMeshVertexCount(mesh.id), 1, vertexOffset, instanceOffset); command->draw(vertexData->getMeshVertexCount(mesh.id), 1, vertexOffset, instanceOffset);
} }
instanceOffset+=mesh.meshes;
} }
} }
} }
commands.add(command);
} }
} }
graphics->executeCommands(commands);
graphics->endRenderPass(); graphics->endRenderPass();
} }
@@ -25,7 +25,8 @@ private:
Gfx::OPipelineLayout depthPrepassLayout; Gfx::OPipelineLayout depthPrepassLayout;
// Set 0: viewParameter // Set 0: viewParameter
// Set 1: vertices, from VertexData static constexpr uint32 INDEX_VIEW_PARAMS = 0;
// Set 0: vertices, from VertexData
constexpr static uint32 INDEX_VERTEX_DATA = 1; constexpr static uint32 INDEX_VERTEX_DATA = 1;
// Set 2: mesh data, either index buffer or meshlet data // Set 2: mesh data, either index buffer or meshlet data
constexpr static uint32 INDEX_SCENE_DATA = 2; constexpr static uint32 INDEX_SCENE_DATA = 2;
@@ -36,7 +36,6 @@ protected:
Vector2 pad0; Vector2 pad0;
} viewParams; } viewParams;
PRenderGraphResources resources; PRenderGraphResources resources;
static constexpr uint32 INDEX_VIEW_PARAMS = 0;
Gfx::ODescriptorLayout viewParamsLayout; Gfx::ODescriptorLayout viewParamsLayout;
Gfx::OUniformBuffer viewParamsBuffer; Gfx::OUniformBuffer viewParamsBuffer;
Gfx::PDescriptorSet viewParamsSet; Gfx::PDescriptorSet viewParamsSet;
+2 -2
View File
@@ -87,12 +87,12 @@ ShaderCollection& ShaderCompiler::createShaders(ShaderPermutation permutation)
ShaderCollection collection; ShaderCollection collection;
ShaderCreateInfo createInfo; ShaderCreateInfo createInfo;
createInfo.typeParameter = { permutation.vertexDataName }; createInfo.typeParameter = { Pair<const char*, const char*>("IVertexData", permutation.vertexDataName) };
createInfo.name = std::format("Material {0}", permutation.materialName); createInfo.name = std::format("Material {0}", permutation.materialName);
if (std::strlen(permutation.materialName) > 0) if (std::strlen(permutation.materialName) > 0)
{ {
createInfo.additionalModules.add(permutation.materialName); createInfo.additionalModules.add(permutation.materialName);
createInfo.typeParameter.add(permutation.materialName); createInfo.typeParameter.add(Pair<const char*, const char*>("IMaterial", permutation.materialName));
} }
createInfo.additionalModules.add(permutation.vertexDataName); createInfo.additionalModules.add(permutation.vertexDataName);
createInfo.additionalModules.add(permutation.vertexMeshFile); createInfo.additionalModules.add(permutation.vertexMeshFile);
+51 -49
View File
@@ -36,6 +36,54 @@ void VertexData::updateMesh(const Component::Transform& transform, PMesh mesh)
matInstanceData.numMeshes += meshData[mesh->id].size(); matInstanceData.numMeshes += meshData[mesh->id].size();
} }
void VertexData::createDescriptors()
{
instanceDataLayout->reset();
for (const auto& [_, mat] : materialData)
{
for (auto& [_, matInst] : mat.instances)
{
Array<InstanceData> instanceData;
Array<MeshData> meshes;
for (auto& inst : matInst.meshes)
{
inst.meshes = 0;
for (const auto& mesh : meshData[inst.id])
{
instanceData.add(inst.instance);
meshes.add(mesh);
inst.meshes++;
}
}
matInst.instanceBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
.sourceData = {
.size = sizeof(InstanceData) * instanceData.size(),
.data = (uint8*)instanceData.data(),
},
.stride = sizeof(InstanceData)
});
matInst.descriptorSet = instanceDataLayout->allocateDescriptorSet();
matInst.descriptorSet->updateBuffer(0, matInst.instanceBuffer);
if (graphics->supportMeshShading())
{
matInst.meshDataBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
.sourceData = {
.size = sizeof(MeshData) * meshes.size(),
.data = (uint8*)meshes.data(),
},
.stride = sizeof(MeshData)
});
matInst.descriptorSet->updateBuffer(1, matInst.meshDataBuffer);
matInst.descriptorSet->updateBuffer(2, meshletBuffer);
matInst.descriptorSet->updateBuffer(3, primitiveIndicesBuffer);
matInst.descriptorSet->updateBuffer(4, vertexIndicesBuffer);
}
matInst.descriptorSet->writeChanges();
matInst.numMeshes = meshes.size();
}
}
}
void VertexData::loadMesh(MeshId id, Array<Meshlet> loadedMeshlets) void VertexData::loadMesh(MeshId id, Array<Meshlet> loadedMeshlets)
{ {
meshData[id].clear(); meshData[id].clear();
@@ -68,7 +116,7 @@ void VertexData::loadMesh(MeshId id, Array<Meshlet> loadedMeshlets)
}); });
currentMesh += numMeshlets; currentMesh += numMeshlets;
} }
meshletBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo { meshletBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
.sourceData = { .sourceData = {
.size = sizeof(MeshletDescription) * meshlets.size(), .size = sizeof(MeshletDescription) * meshlets.size(),
.data = (uint8*)meshlets.data() .data = (uint8*)meshlets.data()
@@ -76,7 +124,7 @@ void VertexData::loadMesh(MeshId id, Array<Meshlet> loadedMeshlets)
.stride = sizeof(MeshletDescription), .stride = sizeof(MeshletDescription),
.dynamic = true, .dynamic = true,
}); });
vertexIndicesBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo { vertexIndicesBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
.sourceData = { .sourceData = {
.size = sizeof(uint32) * vertexIndices.size(), .size = sizeof(uint32) * vertexIndices.size(),
.data = (uint8*)vertexIndices.data(), .data = (uint8*)vertexIndices.data(),
@@ -84,7 +132,7 @@ void VertexData::loadMesh(MeshId id, Array<Meshlet> loadedMeshlets)
.stride = sizeof(uint32), .stride = sizeof(uint32),
.dynamic = true, .dynamic = true,
}); });
primitiveIndicesBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo { primitiveIndicesBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
.sourceData = { .sourceData = {
.size = sizeof(uint8) * primitiveIndices.size(), .size = sizeof(uint8) * primitiveIndices.size(),
.data = (uint8*)primitiveIndices.data(), .data = (uint8*)primitiveIndices.data(),
@@ -94,52 +142,6 @@ void VertexData::loadMesh(MeshId id, Array<Meshlet> loadedMeshlets)
}); });
} }
void VertexData::createDescriptors()
{
for (const auto& [_, mat] : materialData)
{
for (auto& [_, matInst] : mat.instances)
{
Array<InstanceData> instanceData;
Array<MeshData> meshes;
for (const auto& inst : matInst.meshes)
{
for (const auto& mesh : meshData[inst.id])
{
instanceData.add(inst.instance);
meshes.add(mesh);
}
}
matInst.instanceBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
.sourceData = {
.size = sizeof(InstanceData) * instanceData.size(),
.data = (uint8*)instanceData.data(),
},
.stride = sizeof(InstanceData)
});
instanceDataLayout->reset();
matInst.descriptorSet = instanceDataLayout->allocateDescriptorSet();
matInst.descriptorSet->updateBuffer(0, matInst.instanceBuffer);
if (graphics->supportMeshShading())
{
matInst.meshDataBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
.sourceData = {
.size = sizeof(MeshData) * meshes.size(),
.data = (uint8*)meshes.data(),
},
.stride = sizeof(MeshData)
});
matInst.descriptorSet->updateBuffer(1, matInst.meshDataBuffer);
matInst.descriptorSet->updateBuffer(2, meshletBuffer);
matInst.descriptorSet->updateBuffer(3, primitiveIndicesBuffer);
matInst.descriptorSet->updateBuffer(4, vertexIndicesBuffer);
}
matInst.descriptorSet->writeChanges();
matInst.numMeshes = meshes.size();
}
}
}
MeshId VertexData::allocateVertexData(uint64 numVertices) MeshId VertexData::allocateVertexData(uint64 numVertices)
{ {
MeshId res{ idCounter++ }; MeshId res{ idCounter++ };
+2 -1
View File
@@ -39,6 +39,7 @@ public:
MeshId id; MeshId id;
InstanceData instance; InstanceData instance;
Gfx::PIndexBuffer indexBuffer; Gfx::PIndexBuffer indexBuffer;
uint32 meshes;
}; };
struct MaterialInstanceData struct MaterialInstanceData
{ {
@@ -62,8 +63,8 @@ public:
}; };
void resetMeshData(); void resetMeshData();
void updateMesh(const Component::Transform& transform, PMesh mesh); void updateMesh(const Component::Transform& transform, PMesh mesh);
void loadMesh(MeshId id, Array<Meshlet> meshlets);
void createDescriptors(); void createDescriptors();
void loadMesh(MeshId id, Array<Meshlet> meshlets);
MeshId allocateVertexData(uint64 numVertices); MeshId allocateVertexData(uint64 numVertices);
uint64 getMeshOffset(MeshId id); uint64 getMeshOffset(MeshId id);
uint64 getMeshVertexCount(MeshId id); uint64 getMeshVertexCount(MeshId id);
+4 -2
View File
@@ -265,9 +265,10 @@ uint32 Allocator::findMemoryType(uint32 typeFilter, VkMemoryPropertyFlags proper
throw std::runtime_error("error finding memory"); throw std::runtime_error("error finding memory");
} }
StagingBuffer::StagingBuffer(OSubAllocation allocation, VkBuffer buffer, VkBufferUsageFlags usage, uint8 readable) StagingBuffer::StagingBuffer(OSubAllocation allocation, VkBuffer buffer, VkDeviceSize size, VkBufferUsageFlags usage, uint8 readable)
: allocation(std::move(allocation)) : allocation(std::move(allocation))
, buffer(buffer) , buffer(buffer)
, size(size)
, usage(usage) , usage(usage)
, readable(readable) , readable(readable)
{ {
@@ -306,7 +307,7 @@ VkDeviceSize StagingBuffer::getOffset() const
uint64 StagingBuffer::getSize() const uint64 StagingBuffer::getSize() const
{ {
return allocation->getSize(); return size;
} }
StagingManager::StagingManager(PGraphics graphics, PAllocator allocator) StagingManager::StagingManager(PGraphics graphics, PAllocator allocator)
@@ -368,6 +369,7 @@ OStagingBuffer StagingManager::allocateStagingBuffer(uint64 size, VkBufferUsageF
OStagingBuffer stagingBuffer = new StagingBuffer( OStagingBuffer stagingBuffer = new StagingBuffer(
allocator->allocate(memReqs, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | (readable ? VK_MEMORY_PROPERTY_HOST_COHERENT_BIT : VK_MEMORY_PROPERTY_HOST_CACHED_BIT), buffer), allocator->allocate(memReqs, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | (readable ? VK_MEMORY_PROPERTY_HOST_COHERENT_BIT : VK_MEMORY_PROPERTY_HOST_CACHED_BIT), buffer),
buffer, buffer,
size,
usage, usage,
readable readable
); );
+2 -1
View File
@@ -154,7 +154,7 @@ DECLARE_REF(StagingManager)
class StagingBuffer class StagingBuffer
{ {
public: public:
StagingBuffer(OSubAllocation allocation, VkBuffer buffer, VkBufferUsageFlags usage, uint8 readable); StagingBuffer(OSubAllocation allocation, VkBuffer buffer, VkDeviceSize size, VkBufferUsageFlags usage, uint8 readable);
~StagingBuffer(); ~StagingBuffer();
void* getMappedPointer(); void* getMappedPointer();
void flushMappedMemory(); void flushMappedMemory();
@@ -179,6 +179,7 @@ public:
private: private:
OSubAllocation allocation; OSubAllocation allocation;
VkBuffer buffer; VkBuffer buffer;
VkDeviceSize size;
VkBufferUsageFlags usage; VkBufferUsageFlags usage;
uint8 readable; uint8 readable;
}; };
+19 -27
View File
@@ -49,7 +49,7 @@ void Shader::create(const ShaderCreateInfo& createInfo)
sessionDesc.preprocessorMacroCount = macros.size(); sessionDesc.preprocessorMacroCount = macros.size();
sessionDesc.preprocessorMacros = macros.data(); sessionDesc.preprocessorMacros = macros.data();
slang::TargetDesc vulkan; slang::TargetDesc vulkan;
vulkan.profile = globalSession->findProfile("glsl_vk"); vulkan.profile = globalSession->findProfile("sm_6_6");
vulkan.format = SLANG_SPIRV; vulkan.format = SLANG_SPIRV;
sessionDesc.targetCount = 1; sessionDesc.targetCount = 1;
sessionDesc.targets = &vulkan; sessionDesc.targets = &vulkan;
@@ -85,29 +85,14 @@ void Shader::create(const ShaderCreateInfo& createInfo)
mainModule->findEntryPointByName(createInfo.entryPoint.c_str(), entrypoint.writeRef()); mainModule->findEntryPointByName(createInfo.entryPoint.c_str(), entrypoint.writeRef());
modules.add(entrypoint); modules.add(entrypoint);
slang::IComponentType* moduleComposition; Slang::ComPtr<slang::IComponentType> moduleComposition;
session->createCompositeComponentType(modules.data(), modules.size(), &moduleComposition, diagnostics.writeRef()); session->createCompositeComponentType(modules.data(), modules.size(), moduleComposition.writeRef(), diagnostics.writeRef());
if(diagnostics) if(diagnostics)
{ {
std::cout << (const char*)diagnostics->getBufferPointer() << std::endl; std::cout << (const char*)diagnostics->getBufferPointer() << std::endl;
} }
/*slang::ProgramLayout* layout = moduleComposition->getLayout();
for(auto typeParam : createInfo.typeParameter)
{
Slang::ComPtr<slang::ITypeConformance> typeConformance;
session->createTypeConformanceComponentType(layout->findTypeByName(typeParam), layout->findTypeByName("IMaterial"), typeConformance.writeRef(), -1, diagnostics.writeRef());
modules.add(typeConformance);
if(diagnostics)
{
std::cout << (const char*)diagnostics->getBufferPointer() << std::endl;
}
}
Slang::ComPtr<slang::IComponentType> conformingModule;
session->createCompositeComponentType(modules.data(), modules.size(), conformingModule.writeRef(), diagnostics.writeRef());
*/
Slang::ComPtr<slang::IComponentType> linkedProgram; Slang::ComPtr<slang::IComponentType> linkedProgram;
moduleComposition->link(linkedProgram.writeRef(), diagnostics.writeRef()); moduleComposition->link(linkedProgram.writeRef(), diagnostics.writeRef());
if(diagnostics) if(diagnostics)
@@ -122,9 +107,9 @@ void Shader::create(const ShaderCreateInfo& createInfo)
} }
Array<slang::SpecializationArg> specialization; Array<slang::SpecializationArg> specialization;
for(auto typeArg : createInfo.typeParameter) for(const auto& [key, value] : createInfo.typeParameter)
{ {
specialization.add(slang::SpecializationArg::fromType(reflection->findTypeByName(typeArg))); specialization.add(slang::SpecializationArg::fromType(reflection->findTypeByName(value)));
} }
Slang::ComPtr<slang::IComponentType> specializedComponent; Slang::ComPtr<slang::IComponentType> specializedComponent;
linkedProgram->specialize(specialization.data(), specialization.size(), specializedComponent.writeRef(), diagnostics.writeRef()); linkedProgram->specialize(specialization.data(), specialization.size(), specializedComponent.writeRef(), diagnostics.writeRef());
@@ -143,13 +128,20 @@ void Shader::create(const ShaderCreateInfo& createInfo)
{ {
std::cout << (const char*)diagnostics->getBufferPointer() << std::endl; std::cout << (const char*)diagnostics->getBufferPointer() << std::endl;
} }
for (uint32 i = 0; i < reflection->getParameterCount(); ++i)
VkShaderModuleCreateInfo moduleInfo; {
moduleInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; slang::VariableLayoutReflection* varLayout = reflection->getParameterByIndex(i);
moduleInfo.pNext = nullptr; std::cout << varLayout->getName() << " in space " << varLayout->getBindingSpace() << " index " << varLayout->getBindingIndex() << std::endl;
moduleInfo.flags = 0; }
moduleInfo.codeSize = kernelBlob->getBufferSize(); std::cout << reflection->getGlobalConstantBufferSize() << std::endl;
moduleInfo.pCode = (uint32_t*)kernelBlob->getBufferPointer(); VkShaderModuleCreateInfo moduleInfo =
{
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
.codeSize = kernelBlob->getBufferSize(),
.pCode = (uint32_t*)kernelBlob->getBufferPointer(),
};
VK_CHECK(vkCreateShaderModule(graphics->getDevice(), &moduleInfo, nullptr, &module)); VK_CHECK(vkCreateShaderModule(graphics->getDevice(), &moduleInfo, nullptr, &module));
hash = CRC::Calculate(entryPointName.data(), entryPointName.size(), CRC::CRC_32()); hash = CRC::Calculate(entryPointName.data(), entryPointName.size(), CRC::CRC_32());
+8 -47
View File
@@ -43,53 +43,14 @@ Transform::~Transform()
} }
Matrix4 Transform::toMatrix() const Matrix4 Transform::toMatrix() const
{ {
Matrix4 mat; // TODO: actual calculations, SIMD
Matrix4 result = Matrix4(1);
mat[3][0] = position.x; result = glm::scale(result, Vector(scale));
mat[3][1] = position.y; result = glm::toMat4(rotation) * result;
mat[3][2] = position.z; result[3][0] = position.x;
result[3][1] = position.y;
const float x2 = rotation.x + rotation.x; result[3][2] = position.z;
const float y2 = rotation.y + rotation.y; return result;
const float z2 = rotation.z + rotation.z;
{
const float xx2 = rotation.x * x2;
const float yy2 = rotation.y * y2;
const float zz2 = rotation.z * z2;
mat[0][0] = (1.0f - (yy2 + zz2)) * scale.x;
mat[1][1] = (1.0f - (xx2 + zz2)) * scale.y;
mat[2][2] = (1.0f - (xx2 + yy2)) * scale.z;
}
{
const float yz2 = rotation.y * z2;
const float wx2 = rotation.w * x2;
mat[2][1] = (yz2 - wx2) * scale.z;
mat[1][2] = (yz2 + wx2) * scale.y;
}
{
const float xy2 = rotation.x * y2;
const float wz2 = rotation.w * z2;
mat[1][0] = (xy2 - wz2) * scale.y;
mat[0][1] = (xy2 + wz2) * scale.x;
}
{
const float xz2 = rotation.x * z2;
const float wy2 = rotation.w * y2;
mat[2][0] = (xz2 + wy2) * scale.z;
mat[0][2] = (xz2 - wy2) * scale.x;
}
mat[0][3] = 0.0f;
mat[1][3] = 0.0f;
mat[2][3] = 0.0f;
mat[3][3] = 1.0f;
return mat;
} }
Vector Transform::transformPosition(const Vector &v) const Vector Transform::transformPosition(const Vector &v) const
+7 -7
View File
@@ -33,8 +33,8 @@ namespace Serialization
} }
static void load(ArchiveBuffer& buffer, IVector2& vec) static void load(ArchiveBuffer& buffer, IVector2& vec)
{ {
save(buffer, vec.x); load(buffer, vec.x);
save(buffer, vec.y); load(buffer, vec.y);
} }
static void save(ArchiveBuffer& buffer, const Vector2& vec) static void save(ArchiveBuffer& buffer, const Vector2& vec)
{ {
@@ -43,8 +43,8 @@ namespace Serialization
} }
static void load(ArchiveBuffer& buffer, Vector2& vec) static void load(ArchiveBuffer& buffer, Vector2& vec)
{ {
save(buffer, vec.x); load(buffer, vec.x);
save(buffer, vec.y); load(buffer, vec.y);
} }
static void save(ArchiveBuffer& buffer, const Vector& vec) static void save(ArchiveBuffer& buffer, const Vector& vec)
{ {
@@ -54,9 +54,9 @@ namespace Serialization
} }
static void load(ArchiveBuffer& buffer, Vector& vec) static void load(ArchiveBuffer& buffer, Vector& vec)
{ {
save(buffer, vec.x); load(buffer, vec.x);
save(buffer, vec.y); load(buffer, vec.y);
save(buffer, vec.z); load(buffer, vec.z);
} }
template<enumeration T> template<enumeration T>
static void save(ArchiveBuffer& buffer, const T& type) static void save(ArchiveBuffer& buffer, const T& type)
+3
View File
@@ -1,5 +1,7 @@
target_sources(Engine target_sources(Engine
PRIVATE PRIVATE
CameraUpdater.h
CameraUpdater.cpp
ComponentSystem.h ComponentSystem.h
Executor.h Executor.h
Executor.cpp Executor.cpp
@@ -14,6 +16,7 @@ target_sources(Engine
target_sources(Engine target_sources(Engine
PUBLIC FILE_SET HEADERS PUBLIC FILE_SET HEADERS
FILES FILES
CameraUpdater.h
ComponentSystem.h ComponentSystem.h
Executor.h Executor.h
LightGather.h LightGather.h
+18
View File
@@ -0,0 +1,18 @@
#include "CameraUpdater.h"
using namespace Seele;
using namespace Seele::System;
CameraUpdater::CameraUpdater(PScene scene)
: ComponentSystem(scene)
{
}
CameraUpdater::~CameraUpdater()
{
}
void CameraUpdater::update(Component::Camera& camera)
{
camera.buildViewMatrix();
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include "ComponentSystem.h"
#include "Component/Camera.h"
namespace Seele
{
namespace System
{
class CameraUpdater : public ComponentSystem<Component::Camera>
{
public:
CameraUpdater(PScene scene);
virtual ~CameraUpdater();
virtual void update(Component::Camera& camera);
private:
};
}
}
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "SystemBase.h" #include "SystemBase.h"
#include "Component/Component.h" #include "Component/Component.h"
#include "Component/Camera.h"
namespace Seele namespace Seele
{ {
@@ -12,7 +13,7 @@ class ComponentSystem : public SystemBase
public: public:
ComponentSystem(PScene scene) : SystemBase(scene) {} ComponentSystem(PScene scene) : SystemBase(scene) {}
virtual ~ComponentSystem() {} virtual ~ComponentSystem() {}
template<is_component Comp> template<has_dependencies Comp>
auto getDependencies() auto getDependencies()
{ {
return Comp::dependencies; return Comp::dependencies;
+2
View File
@@ -6,6 +6,7 @@
#include "Asset/AssetRegistry.h" #include "Asset/AssetRegistry.h"
#include "System/LightGather.h" #include "System/LightGather.h"
#include "System/MeshUpdater.h" #include "System/MeshUpdater.h"
#include "System/CameraUpdater.h"
using namespace Seele; using namespace Seele;
@@ -76,6 +77,7 @@ void GameView::reloadGame()
gameInterface.getGame()->setupScene(scene, systemGraph); gameInterface.getGame()->setupScene(scene, systemGraph);
systemGraph->addSystem(new System::LightGather(scene)); systemGraph->addSystem(new System::LightGather(scene));
systemGraph->addSystem(new System::MeshUpdater(scene)); systemGraph->addSystem(new System::MeshUpdater(scene));
systemGraph->addSystem(new System::CameraUpdater(scene));
} }
void GameView::keyCallback(KeyCode code, InputAction action, KeyModifier) void GameView::keyCallback(KeyCode code, InputAction action, KeyModifier)