Skip to content

Commit

Permalink
Fix adding point lights cause seg fault
Browse files Browse the repository at this point in the history
  • Loading branch information
enginmanap committed Dec 30, 2024
1 parent ba53485 commit dba18c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ void World::renderSky(const std::shared_ptr<GraphicsProgram>& renderProgram, con
void World::renderLight(unsigned int lightIndex, unsigned int renderLayer, const std::shared_ptr<GraphicsProgram> &renderProgram, const std::vector<HashUtil::HashedString> &tags) const {
renderProgram->setUniform("renderLightIndex", (int) lightIndex);
renderProgram->setUniform("renderLightLayer", (int) renderLayer);
Light* selectedLight = lights[lightIndex];
Light* selectedLight = activeLights[lightIndex];
Camera* lightCamera = selectedLight->getCameras()[renderLayer];
std::unordered_map<std::vector<uint64_t>, RenderList, VisibilityRequest::uint64_vector_hasher>* cullingResult = cullingResults.at(lightCamera);
for (const auto& iterator:*cullingResult) {
Expand Down
2 changes: 1 addition & 1 deletion src/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class World {

void createNodeGraph();

std::vector<size_t> getLightIndexes(Light::LightTypes lightType) {
std::vector<size_t> getLightIndexes(Light::LightTypes lightType) const {
std::vector<size_t> lights;
for (unsigned int i = 0; i < activeLights.size(); ++i) {
if(activeLights[i]->getLightType() != lightType) {
Expand Down

0 comments on commit dba18c2

Please sign in to comment.