Tried to fix clearing children but failed miserably

This commit is contained in:
Vulpovile
2021-03-14 13:43:12 -07:00
parent 2a6d90ad66
commit 816a67a40b
6 changed files with 17 additions and 11 deletions

View File

@@ -216,7 +216,7 @@ void renderShape(const Enum::Shape::Value& shape, const Vector3& size, const Col
glPopMatrix();
/*Plusses, can possibly integrate into cylinder code later on*/
glVertexPointer(2, GL_FLOAT,0, square_arr);
glColor(Color3(127,127,127));
glColor3f(127,127,127);
glPushMatrix();
glRotatef(90,0,1,0);
glTranslatef(0,0,-(size.z+0.001F));

View File

@@ -8,5 +8,6 @@ class WorkspaceInstance :
public:
WorkspaceInstance(void);
~WorkspaceInstance(void);
void clearChildren();
std::vector<PartInstance *> partObjects;
};

View File

@@ -6,6 +6,8 @@
#include <sstream>
#include <commdlg.h>
#include "ErrorFunctions.h"
#include "Globals.h"
#include "Application.h"
using namespace std;
using namespace rapidxml;
@@ -60,6 +62,7 @@ void DataModelInstance::modXMLLevel(float modY)
void DataModelInstance::clearLevel()
{
workspace->clearChildren();
g_usableApp->_propWindow->UpdateSelected(this);
}
PartInstance* DataModelInstance::makePart()
{

View File

@@ -140,6 +140,10 @@ void Instance::addChild(Instance* newChild)
void Instance::clearChildren()
{
for (size_t i = 0; i < children.size(); i++)
{
delete children.at(i);
}
children.clear();
}
void Instance::removeChild(Instance* oldChild)

View File

@@ -245,19 +245,11 @@ bool PartInstance::collides(Box box)
void PartInstance::render(RenderDevice* rd) {
if (changed)
{
changed=false;
Vector3 renderSize = size/2;
glNewList(glList, GL_COMPILE_AND_EXECUTE);
glColor(this->color);
glNewList(glList, GL_COMPILE);
renderShape(this->shape, renderSize, color);
glEndList();
changed = false;
return;
changed=false;
}
rd->setObjectToWorldMatrix(cFrame);
glCallList(glList);

View File

@@ -9,6 +9,12 @@ WorkspaceInstance::WorkspaceInstance(void)
canDelete = false;
}
void WorkspaceInstance::clearChildren()
{
children.clear();
Instance::clearChildren();
}
WorkspaceInstance::~WorkspaceInstance(void)
{
}