forked from Mirrorlandia_minetest/minetest
Remove IrrlichtDevice unused pointer from ClientActiveObject class & childs (#6010)
This commit is contained in:
parent
6eb03c135f
commit
4a78949083
@ -458,7 +458,7 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
|
|||||||
infostream<<"ClientEnvironment::addActiveObject(): "
|
infostream<<"ClientEnvironment::addActiveObject(): "
|
||||||
<<"added (id="<<object->getId()<<")"<<std::endl;
|
<<"added (id="<<object->getId()<<")"<<std::endl;
|
||||||
m_active_objects[object->getId()] = object;
|
m_active_objects[object->getId()] = object;
|
||||||
object->addToScene(m_smgr, m_texturesource, m_irr);
|
object->addToScene(m_smgr, m_texturesource);
|
||||||
{ // Update lighting immediately
|
{ // Update lighting immediately
|
||||||
u8 light = 0;
|
u8 light = 0;
|
||||||
bool pos_ok;
|
bool pos_ok;
|
||||||
|
@ -39,8 +39,7 @@ public:
|
|||||||
ClientActiveObject(u16 id, Client *client, ClientEnvironment *env);
|
ClientActiveObject(u16 id, Client *client, ClientEnvironment *env);
|
||||||
virtual ~ClientActiveObject();
|
virtual ~ClientActiveObject();
|
||||||
|
|
||||||
virtual void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
virtual void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc) {};
|
||||||
IrrlichtDevice *irr){}
|
|
||||||
virtual void removeFromScene(bool permanent) {}
|
virtual void removeFromScene(bool permanent) {}
|
||||||
// 0 <= light_at_pos <= LIGHT_SUN
|
// 0 <= light_at_pos <= LIGHT_SUN
|
||||||
virtual void updateLight(u8 light_at_pos){}
|
virtual void updateLight(u8 light_at_pos){}
|
||||||
|
@ -128,8 +128,7 @@ public:
|
|||||||
|
|
||||||
static ClientActiveObject* create(Client *client, ClientEnvironment *env);
|
static ClientActiveObject* create(Client *client, ClientEnvironment *env);
|
||||||
|
|
||||||
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc);
|
||||||
IrrlichtDevice *irr);
|
|
||||||
void removeFromScene(bool permanent);
|
void removeFromScene(bool permanent);
|
||||||
void updateLight(u8 light_at_pos);
|
void updateLight(u8 light_at_pos);
|
||||||
v3s16 getLightPosition();
|
v3s16 getLightPosition();
|
||||||
@ -165,8 +164,7 @@ ClientActiveObject* TestCAO::create(Client *client, ClientEnvironment *env)
|
|||||||
return new TestCAO(client, env);
|
return new TestCAO(client, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
void TestCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc)
|
||||||
IrrlichtDevice *irr)
|
|
||||||
{
|
{
|
||||||
if(m_node != NULL)
|
if(m_node != NULL)
|
||||||
return;
|
return;
|
||||||
@ -272,8 +270,7 @@ public:
|
|||||||
|
|
||||||
static ClientActiveObject* create(Client *client, ClientEnvironment *env);
|
static ClientActiveObject* create(Client *client, ClientEnvironment *env);
|
||||||
|
|
||||||
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc);
|
||||||
IrrlichtDevice *irr);
|
|
||||||
void removeFromScene(bool permanent);
|
void removeFromScene(bool permanent);
|
||||||
void updateLight(u8 light_at_pos);
|
void updateLight(u8 light_at_pos);
|
||||||
v3s16 getLightPosition();
|
v3s16 getLightPosition();
|
||||||
@ -329,8 +326,7 @@ ClientActiveObject* ItemCAO::create(Client *client, ClientEnvironment *env)
|
|||||||
return new ItemCAO(client, env);
|
return new ItemCAO(client, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
void ItemCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc)
|
||||||
IrrlichtDevice *irr)
|
|
||||||
{
|
{
|
||||||
if(m_node != NULL)
|
if(m_node != NULL)
|
||||||
return;
|
return;
|
||||||
@ -721,11 +717,9 @@ void GenericCAO::removeFromScene(bool permanent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericCAO::addToScene(scene::ISceneManager *smgr,
|
void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc)
|
||||||
ITextureSource *tsrc, IrrlichtDevice *irr)
|
|
||||||
{
|
{
|
||||||
m_smgr = smgr;
|
m_smgr = smgr;
|
||||||
m_irr = irr;
|
|
||||||
|
|
||||||
if (getSceneNode() != NULL) {
|
if (getSceneNode() != NULL) {
|
||||||
return;
|
return;
|
||||||
@ -1034,7 +1028,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_visuals_expired && m_smgr && m_irr){
|
if (m_visuals_expired && m_smgr) {
|
||||||
m_visuals_expired = false;
|
m_visuals_expired = false;
|
||||||
|
|
||||||
// Attachments, part 1: All attached objects must be unparented first,
|
// Attachments, part 1: All attached objects must be unparented first,
|
||||||
@ -1056,7 +1050,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeFromScene(false);
|
removeFromScene(false);
|
||||||
addToScene(m_smgr, m_client->tsrc(), m_irr);
|
addToScene(m_smgr, m_client->tsrc());
|
||||||
|
|
||||||
// Attachments, part 2: Now that the parent has been refreshed, put its attachments back
|
// Attachments, part 2: Now that the parent has been refreshed, put its attachments back
|
||||||
for (std::vector<u16>::size_type i = 0; i < m_children.size(); i++) {
|
for (std::vector<u16>::size_type i = 0; i < m_children.size(); i++) {
|
||||||
|
@ -65,7 +65,6 @@ private:
|
|||||||
ObjectProperties m_prop;
|
ObjectProperties m_prop;
|
||||||
//
|
//
|
||||||
scene::ISceneManager *m_smgr = nullptr;
|
scene::ISceneManager *m_smgr = nullptr;
|
||||||
IrrlichtDevice *m_irr = nullptr;
|
|
||||||
Client *m_client = nullptr;
|
Client *m_client = nullptr;
|
||||||
aabb3f m_selection_box = aabb3f(-BS/3.,-BS/3.,-BS/3., BS/3.,BS/3.,BS/3.);
|
aabb3f m_selection_box = aabb3f(-BS/3.,-BS/3.,-BS/3., BS/3.,BS/3.,BS/3.);
|
||||||
scene::IMeshSceneNode *m_meshnode = nullptr;
|
scene::IMeshSceneNode *m_meshnode = nullptr;
|
||||||
@ -169,8 +168,7 @@ public:
|
|||||||
|
|
||||||
void removeFromScene(bool permanent);
|
void removeFromScene(bool permanent);
|
||||||
|
|
||||||
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc);
|
||||||
IrrlichtDevice *irr);
|
|
||||||
|
|
||||||
inline void expireVisuals()
|
inline void expireVisuals()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user