diff --git a/Application.cpp b/Application.cpp index f2062ae..af3d189 100644 --- a/Application.cpp +++ b/Application.cpp @@ -56,6 +56,7 @@ PartInstance* Application::makePart() Application::Application(HWND parentWindow) { //: GApp(settings,window) { + std::string tempPath = ((std::string)getenv("temp")) + "/"+g_PlaceholderName; CreateDirectory(tempPath.c_str(), NULL); @@ -585,7 +586,13 @@ void Application::onGraphics(RenderDevice* rd) { rd->beforePrimitive(); CoordinateFrame forDraw = rd->getObjectToWorldMatrix(); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_NORMAL_ARRAY); _dataModel->getWorkspace()->render(rd); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); rd->setObjectToWorldMatrix(forDraw); rd->afterPrimitive(); diff --git a/Instance.cpp b/Instance.cpp index a6ece35..02f4d69 100644 --- a/Instance.cpp +++ b/Instance.cpp @@ -26,17 +26,10 @@ Instance::Instance(const Instance &oinst) void Instance::render(RenderDevice* rd) { - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_NORMAL_ARRAY); - for(size_t i = 0; i < children.size(); i++) { - children.at(i)->render(rd); + children[i]->render(rd); } - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); } void Instance::update() diff --git a/PartInstance.cpp b/PartInstance.cpp index 5f1bc9b..ff52c76 100644 --- a/PartInstance.cpp +++ b/PartInstance.cpp @@ -194,7 +194,7 @@ bool PartInstance::collides(Box box) { return CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(getBox(), box); } - +#ifdef NEW_BOX_RENDER void PartInstance::addVertex(Vector3 vertexPos,Color3 color) { _vertices.push_back(vertexPos.x); @@ -265,15 +265,15 @@ bool PartInstance::isUniqueVertex(Vector3 pos) return true; } -#ifdef NEW_BOX_RENDER - void PartInstance::render(RenderDevice* rd) { - if(nameShown) - postRenderStack.push_back(this); + //if(nameShown) + //postRenderStack.push_back(this); if (changed) { + getBox(); _vertices.clear(); + //std::vector(_vertices).swap(_vertices); //Clear the memory Vector3 renderSize = size/2; // Front addTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,renderSize.z), diff --git a/PartInstance.h b/PartInstance.h index 094e4ed..4a97cba 100644 --- a/PartInstance.h +++ b/PartInstance.h @@ -2,7 +2,7 @@ #include "PVInstance.h" #include "Enum.h" -#define NEW_BOX_RENDER +//#define NEW_BOX_RENDER class PartInstance : public PVInstance { @@ -38,6 +38,7 @@ public: bool collides(Box); virtual std::vector getProperties(); virtual void PropUpdate(LPPROPGRIDITEM &pItem); + #ifdef NEW_BOX_RENDER void addVertex(Vector3 vertexPos,Color3 color); void addNormals(Vector3 normal); void addSingularNormal(Vector3 normal); @@ -45,6 +46,7 @@ public: void debugPrintVertexIDs(RenderDevice* rd, GFontRef font, Matrix3 camRot); void makeFace(int vertex1, int vertex2, int vertex3); bool isUniqueVertex(Vector3 pos); + #endif private: Vector3 position; Vector3 size;