add some cleanup to lights example

This commit is contained in:
aap
2021-03-03 02:15:38 +01:00
parent 0921a2b003
commit d13bd898fe
5 changed files with 73 additions and 1 deletions

View File

@@ -100,10 +100,33 @@ CreateSpotSoftLight(void)
return light;
}
void
DestroyLight(rw::Light **light)
{
if(*light == nil)
return;
rw::World *world = (*light)->world;
if(world)
world->removeLight(*light);
rw::Frame *frame = (*light)->getFrame();
if(frame){
(*light)->setFrame(nil);
frame->destroy();
}
(*light)->destroy();
*light = nil;
}
void
LightsDestroy(void)
{
// TODO
DestroyLight(&SpotSoftLight);
DestroyLight(&SpotLight);
DestroyLight(&PointLight);
DestroyLight(&DirectLight);
DestroyLight(&AmbientLight);
DestroyLight(&BaseAmbientLight);
}
void