From 059136a6887587ba7d2d0be8a70c70b6541dfe3b Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 8 Sep 2024 20:33:13 +0300 Subject: [PATCH] removing lights by pointer --- node.cpp | 12 ++++++++++++ node.h | 1 + 2 files changed, 13 insertions(+) diff --git a/node.cpp b/node.cpp index 3560121..ce478d9 100755 --- a/node.cpp +++ b/node.cpp @@ -253,6 +253,18 @@ namespace vb01{ } + void Node::removeLight(Light *light){ + for(int i = 0; i < lights.size(); i++) + if(lights[i] == light){ + lights.erase(lights.begin() + i); + + Root::getSingleton()->shiftNumLights(false); + updateShaders(); + + break; + } + } + void Node::removeLight(int id){ Root::getSingleton()->shiftNumLights(false); Light *light = lights[id]; diff --git a/node.h b/node.h index bce352c..46aec28 100755 --- a/node.h +++ b/node.h @@ -31,6 +31,7 @@ namespace vb01{ void attachChild(Node*); void dettachChild(Node*); void addLight(Light*); + void removeLight(Light*); void removeLight(int); void addText(Text*); virtual void lookAt(Vector3, Vector3);