Skip to content
Permalink
Browse files

sc_light_remove(ENTITY* ent) added

sc_light_remove(ENTITY* ent) added. This function removes the shade-c light and frees all the memory stuff.
  • Loading branch information...
oliver2s committed Feb 6, 2014
1 parent 20f7013 commit 9b813c774afcda92bd9353170a46a29fb59e53c9
Showing with 35 additions and 1 deletion.
  1. +35 −1 examples/shadec/sc_lights.c
@@ -4,6 +4,40 @@

// Light handling functions

void sc_light_remove(ENTITY* ent)
{
if(ent==NULL){ return; }
if(!ent.SC_SKILL){ return; }

SC_OBJECT* myData = (SC_OBJECT*)ent.SC_SKILL;

if(myData.light!=NULL)
{
if(myData.light.view!=NULL)
{
if(myData.light.view.stage!=NULL)
{
if(myData.light.view.stage.material!=NULL){ ptr_remove(myData.light.view.stage.material); }
ptr_remove(myData.light.view.stage);
}

if(myData.light.view.material!=NULL){ ptr_remove(myData.light.view.material); }
if(myData.light.view.bmap!=NULL){ bmap_purge(myData.light.view.bmap); ptr_remove(myData.light.view.bmap); }

ptr_remove(myData.light.view);
}
if(myData.light.shadowMap!=NULL){ bmap_purge(myData.light.shadowMap); ptr_remove(myData.light.shadowMap); }
if(myData.light.matrix!=NULL){sys_free(myData.light.matrix);}

sys_free(myData.light);
}

sys_free(myData.data);
sys_free(myData);

ptr_remove(ent);
}

void sc_light_updatePointMtx(ENTITY* inLight)
{
//static D3DXMATRIX testmtx;
@@ -1359,4 +1393,4 @@ void sc_lights_frmSun(SC_SCREEN* screen)


}
}
}

2 comments on commit 9b813c7

@infinitehmp

This comment has been minimized.

Copy link

replied Feb 22, 2014

Removes Lightsdata and gets cache Free for new lights 👍

@1234David

This comment has been minimized.

Copy link

replied Feb 16, 2015

I've found a bug (if not already seen): If no model, which has a "shade-c"-material, is rendering on the screen, the hole screen is painted into a blue color. F.E.: If I watch away with my camera, where no model is to see. :(

Please sign in to comment.
You can’t perform that action at this time.