Basic meshlet generation algorithm
This commit is contained in:
@@ -15,29 +15,8 @@ using namespace Seele;
|
||||
Scene::Scene(Gfx::PGraphics graphics)
|
||||
: graphics(graphics)
|
||||
, physics(registry)
|
||||
, lightEnv(new LightEnvironment(graphics))
|
||||
{
|
||||
ShaderBufferCreateInfo structInfo = {
|
||||
.resourceData = {
|
||||
.size = sizeof(Component::DirectionalLight) * MAX_DIRECTIONAL_LIGHTS,
|
||||
.data = nullptr,
|
||||
},
|
||||
.stride = sizeof(Component::DirectionalLight),
|
||||
.bDynamic = true,
|
||||
};
|
||||
lightEnv.directionalLights = graphics->createShaderBuffer(structInfo);
|
||||
structInfo.resourceData.size = sizeof(Component::PointLight) * MAX_POINT_LIGHTS;
|
||||
structInfo.stride = sizeof(Component::PointLight);
|
||||
lightEnv.pointLights = graphics->createShaderBuffer(structInfo);
|
||||
|
||||
UniformBufferCreateInfo uniformInfo = {
|
||||
.resourceData = {
|
||||
.size = sizeof(uint32),
|
||||
.data = nullptr
|
||||
},
|
||||
.bDynamic = true
|
||||
};
|
||||
lightEnv.numDirectional = graphics->createUniformBuffer(uniformInfo);
|
||||
lightEnv.numPoints = graphics->createUniformBuffer(uniformInfo);
|
||||
}
|
||||
|
||||
Scene::~Scene()
|
||||
@@ -49,35 +28,3 @@ void Scene::update(float deltaTime)
|
||||
physics.update(deltaTime);
|
||||
}
|
||||
|
||||
LightEnv Scene::getLightBuffer()
|
||||
{
|
||||
StaticArray<Component::DirectionalLight, MAX_DIRECTIONAL_LIGHTS> dirLights;
|
||||
uint32 numDirLights = 0;
|
||||
for(auto&& [entity, light] : registry.view<Component::DirectionalLight>().each())
|
||||
{
|
||||
dirLights[numDirLights++] = light;
|
||||
}
|
||||
lightEnv.directionalLights->updateContents({
|
||||
.size = sizeof(Component::DirectionalLight) * numDirLights,
|
||||
.data = (uint8*)dirLights.data(),
|
||||
});
|
||||
lightEnv.numDirectional->updateContents({
|
||||
.size = sizeof(uint32),
|
||||
.data = (uint8*)&numDirLights,
|
||||
});
|
||||
StaticArray<Component::PointLight, MAX_POINT_LIGHTS> pointLights;
|
||||
uint32 numPointLights = 0;
|
||||
for(auto&& [entity, light] : registry.view<Component::PointLight>().each())
|
||||
{
|
||||
pointLights[numPointLights++] = light;
|
||||
}
|
||||
lightEnv.pointLights->updateContents({
|
||||
.size = sizeof(Component::PointLight) * numPointLights,
|
||||
.data = (uint8*)pointLights.data(),
|
||||
});
|
||||
lightEnv.numPoints->updateContents({
|
||||
.size = sizeof(uint32),
|
||||
.data = (uint8*)&numPointLights,
|
||||
});
|
||||
return lightEnv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user