Made it possible to switch between legacy renderer and new renderer in code
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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<GLfloat>(_vertices).swap(_vertices); //Clear the memory
|
||||
Vector3 renderSize = size/2;
|
||||
// Front
|
||||
addTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,renderSize.z),
|
||||
|
||||
@@ -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<PROPGRIDITEM> 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;
|
||||
|
||||
Reference in New Issue
Block a user