Fix crash if scene not set

This commit is contained in:
MrLetsplay 2023-09-12 22:01:50 +02:00
parent 8ce8f8a0dd
commit cc9a582717
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
2 changed files with 69 additions and 65 deletions

View File

@ -186,6 +186,7 @@ int start() {
cb.second(kekData.window);
}
if(kekData.activeScene) {
kekData.shader->use();
glm::mat4 view = kekData.activeCamera->transformationMatrix();
@ -265,7 +266,8 @@ int start() {
glUniform1i(glGetUniformLocation(kekData.shader->id, "numSpotLights"), numSpotLights);
}
if(kekData.activeScene) kekData.activeScene->draw(kekData.shader);
kekData.activeScene->draw(kekData.shader);
}
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);

View File

@ -32,6 +32,8 @@ void destroy() {
}
void step(float deltaT) {
if(!kekData.activeScene) return;
for(GameObject *obj : kekData.activeScene->objects) {
if(obj->physics) {
obj->physics->body->getWorldTransform().setOrigin(fromGLM(obj->getPosition()));