Fix crash if scene not set
This commit is contained in:
parent
8ce8f8a0dd
commit
cc9a582717
@ -186,6 +186,7 @@ int start() {
|
|||||||
cb.second(kekData.window);
|
cb.second(kekData.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(kekData.activeScene) {
|
||||||
kekData.shader->use();
|
kekData.shader->use();
|
||||||
|
|
||||||
glm::mat4 view = kekData.activeCamera->transformationMatrix();
|
glm::mat4 view = kekData.activeCamera->transformationMatrix();
|
||||||
@ -265,7 +266,8 @@ int start() {
|
|||||||
glUniform1i(glGetUniformLocation(kekData.shader->id, "numSpotLights"), numSpotLights);
|
glUniform1i(glGetUniformLocation(kekData.shader->id, "numSpotLights"), numSpotLights);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(kekData.activeScene) kekData.activeScene->draw(kekData.shader);
|
kekData.activeScene->draw(kekData.shader);
|
||||||
|
}
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
@ -32,6 +32,8 @@ void destroy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void step(float deltaT) {
|
void step(float deltaT) {
|
||||||
|
if(!kekData.activeScene) return;
|
||||||
|
|
||||||
for(GameObject *obj : kekData.activeScene->objects) {
|
for(GameObject *obj : kekData.activeScene->objects) {
|
||||||
if(obj->physics) {
|
if(obj->physics) {
|
||||||
obj->physics->body->getWorldTransform().setOrigin(fromGLM(obj->getPosition()));
|
obj->physics->body->getWorldTransform().setOrigin(fromGLM(obj->getPosition()));
|
||||||
|
Loading…
Reference in New Issue
Block a user