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) {
|
Application::Application(HWND parentWindow) { //: GApp(settings,window) {
|
||||||
|
|
||||||
|
|
||||||
std::string tempPath = ((std::string)getenv("temp")) + "/"+g_PlaceholderName;
|
std::string tempPath = ((std::string)getenv("temp")) + "/"+g_PlaceholderName;
|
||||||
CreateDirectory(tempPath.c_str(), NULL);
|
CreateDirectory(tempPath.c_str(), NULL);
|
||||||
|
|
||||||
@@ -585,7 +586,13 @@ void Application::onGraphics(RenderDevice* rd) {
|
|||||||
|
|
||||||
rd->beforePrimitive();
|
rd->beforePrimitive();
|
||||||
CoordinateFrame forDraw = rd->getObjectToWorldMatrix();
|
CoordinateFrame forDraw = rd->getObjectToWorldMatrix();
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
_dataModel->getWorkspace()->render(rd);
|
_dataModel->getWorkspace()->render(rd);
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_NORMAL_ARRAY);
|
||||||
rd->setObjectToWorldMatrix(forDraw);
|
rd->setObjectToWorldMatrix(forDraw);
|
||||||
rd->afterPrimitive();
|
rd->afterPrimitive();
|
||||||
|
|
||||||
|
|||||||
@@ -26,17 +26,10 @@ Instance::Instance(const Instance &oinst)
|
|||||||
|
|
||||||
void Instance::render(RenderDevice* rd)
|
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++)
|
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()
|
void Instance::update()
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ bool PartInstance::collides(Box box)
|
|||||||
{
|
{
|
||||||
return CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(getBox(), box);
|
return CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(getBox(), box);
|
||||||
}
|
}
|
||||||
|
#ifdef NEW_BOX_RENDER
|
||||||
void PartInstance::addVertex(Vector3 vertexPos,Color3 color)
|
void PartInstance::addVertex(Vector3 vertexPos,Color3 color)
|
||||||
{
|
{
|
||||||
_vertices.push_back(vertexPos.x);
|
_vertices.push_back(vertexPos.x);
|
||||||
@@ -265,15 +265,15 @@ bool PartInstance::isUniqueVertex(Vector3 pos)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NEW_BOX_RENDER
|
|
||||||
|
|
||||||
void PartInstance::render(RenderDevice* rd) {
|
void PartInstance::render(RenderDevice* rd) {
|
||||||
if(nameShown)
|
//if(nameShown)
|
||||||
postRenderStack.push_back(this);
|
//postRenderStack.push_back(this);
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
|
|
||||||
getBox();
|
getBox();
|
||||||
_vertices.clear();
|
_vertices.clear();
|
||||||
|
//std::vector<GLfloat>(_vertices).swap(_vertices); //Clear the memory
|
||||||
Vector3 renderSize = size/2;
|
Vector3 renderSize = size/2;
|
||||||
// Front
|
// Front
|
||||||
addTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,renderSize.z),
|
addTriangle(Vector3(renderSize.x-_bevelSize,renderSize.y-_bevelSize,renderSize.z),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "PVInstance.h"
|
#include "PVInstance.h"
|
||||||
#include "Enum.h"
|
#include "Enum.h"
|
||||||
|
|
||||||
#define NEW_BOX_RENDER
|
//#define NEW_BOX_RENDER
|
||||||
|
|
||||||
class PartInstance : public PVInstance
|
class PartInstance : public PVInstance
|
||||||
{
|
{
|
||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
bool collides(Box);
|
bool collides(Box);
|
||||||
virtual std::vector<PROPGRIDITEM> getProperties();
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
|
#ifdef NEW_BOX_RENDER
|
||||||
void addVertex(Vector3 vertexPos,Color3 color);
|
void addVertex(Vector3 vertexPos,Color3 color);
|
||||||
void addNormals(Vector3 normal);
|
void addNormals(Vector3 normal);
|
||||||
void addSingularNormal(Vector3 normal);
|
void addSingularNormal(Vector3 normal);
|
||||||
@@ -45,6 +46,7 @@ public:
|
|||||||
void debugPrintVertexIDs(RenderDevice* rd, GFontRef font, Matrix3 camRot);
|
void debugPrintVertexIDs(RenderDevice* rd, GFontRef font, Matrix3 camRot);
|
||||||
void makeFace(int vertex1, int vertex2, int vertex3);
|
void makeFace(int vertex1, int vertex2, int vertex3);
|
||||||
bool isUniqueVertex(Vector3 pos);
|
bool isUniqueVertex(Vector3 pos);
|
||||||
|
#endif
|
||||||
private:
|
private:
|
||||||
Vector3 position;
|
Vector3 position;
|
||||||
Vector3 size;
|
Vector3 size;
|
||||||
|
|||||||
Reference in New Issue
Block a user