just remove baseplate

This commit is contained in:
floralrainfall 2023-07-22 05:15:29 -04:00
parent 9948586dc8
commit ce12c8f208
5 changed files with 16 additions and 9 deletions

View File

@ -54,6 +54,7 @@ namespace RNR
std::string mesh_id; std::string mesh_id;
public: public:
PartInstance(); PartInstance();
~PartInstance();
void updateMatrix(); void updateMatrix();
PartSurfaceInfo& getSurface(NormalId normal) { return m_surfaces[normal]; }; PartSurfaceInfo& getSurface(NormalId normal) { return m_surfaces[normal]; };

View File

@ -25,6 +25,7 @@ namespace RNR
public: public:
Workspace(); Workspace();
WorkspaceBatchingMode getBatchMode() { return m_batchMode; }
virtual std::string getClassName() { return "Workspace"; } virtual std::string getClassName() { return "Workspace"; }
virtual void onDescendantAdded(RNR::Instance* childAdded); virtual void onDescendantAdded(RNR::Instance* childAdded);
virtual void onDescendantRemoved(RNR::Instance* childRemoved); virtual void onDescendantRemoved(RNR::Instance* childRemoved);

View File

@ -66,6 +66,11 @@ namespace RNR
updateMatrix(); updateMatrix();
} }
PartInstance::~PartInstance()
{
getNode()->removeAndDestroyAllChildren();
}
void PartInstance::updateMatrix() void PartInstance::updateMatrix()
{ {
m_matrix = m_cframe.getMatrix(); m_matrix = m_cframe.getMatrix();

View File

@ -84,7 +84,14 @@ namespace RNR
{ {
PartInstance* part = dynamic_cast<PartInstance*>(childRemoved); PartInstance* part = dynamic_cast<PartInstance*>(childRemoved);
if(part) if(part)
{
if(m_batchMode == BATCH_INSTANCED)
{
Ogre::InstancedEntity* entity = (Ogre::InstancedEntity*)part->getObject();
world->getOgreSceneManager()->destroyInstancedEntity(entity);
}
world->getComPlicitNgine()->deletePhysicsPart(part); world->getComPlicitNgine()->deletePhysicsPart(part);
}
m_geomDirty = true; m_geomDirty = true;
} }

View File

@ -56,13 +56,13 @@ namespace RNR
start_cam->setParent(m_workspace); start_cam->setParent(m_workspace);
m_workspace->setCurrentCamera(start_cam); m_workspace->setCurrentCamera(start_cam);
PartInstance* baseplate = new PartInstance(); /*PartInstance* baseplate = new PartInstance();
baseplate->setName("Baseplate"); baseplate->setName("Baseplate");
baseplate->getCFrame().setPosition(Ogre::Vector3(0, -64, 0)); baseplate->getCFrame().setPosition(Ogre::Vector3(0, -64, 0));
baseplate->setSize(Ogre::Vector3(512, 1, 512)); baseplate->setSize(Ogre::Vector3(512, 1, 512));
baseplate->setBrickColor(2); baseplate->setBrickColor(2);
baseplate->setAnchored(true); baseplate->setAnchored(true);
baseplate->setParent(m_workspace); baseplate->setParent(m_workspace);*/
} }
World::~World() World::~World()
@ -109,13 +109,6 @@ namespace RNR
{ {
m_refs.clear(); m_refs.clear();
Instance* baseplate = m_workspace->findFirstChild("Baseplate");
if(baseplate)
{
baseplate->setParent(NULL);
delete baseplate;
}
JointsService* joints = (JointsService*)m_datamodel->getService("JointsService"); JointsService* joints = (JointsService*)m_datamodel->getService("JointsService");
Camera* old_camera = m_workspace->getCurrentCamera(); Camera* old_camera = m_workspace->getCurrentCamera();
if(old_camera) if(old_camera)