This commit is contained in:
andreja6
2019-11-07 21:13:03 -08:00
parent 4d13650c6d
commit ae174c1fdc
9 changed files with 85 additions and 4 deletions

View File

@@ -603,7 +603,15 @@ void Application::onGraphics(RenderDevice* rd) {
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_NORMAL_ARRAY);
_dataModel->getWorkspace()->render(rd);
for (unsigned int i = 0; i < _dataModel->getWorkspace()->__pvVector.size(); i++)
{
_dataModel->getWorkspace()->__pvVector[i]->render(rd);
}
//_dataModel->getWorkspace()->render(rd);
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);
@@ -846,7 +854,7 @@ void Application::run() {
cursorOvrid = cursorOvr->openGLID(); cursorOvrid = cursorOvr->openGLID();
RealTime now=0, lastTime=0; RealTime now=0, lastTime=0;
double simTimeRate = 1.0f; double simTimeRate = 1.0f;
float fps=30.0f; float fps=3000.0f;
RealTime desiredFrameDuration=1.0/fps; RealTime desiredFrameDuration=1.0/fps;
onInit(); onInit();

View File

@@ -17,6 +17,8 @@ GroupInstance::~GroupInstance(void)
{ {
} }
std::vector<PROPGRIDITEM> GroupInstance::getProperties() std::vector<PROPGRIDITEM> GroupInstance::getProperties()
{ {
std::vector<PROPGRIDITEM> properties = PVInstance::getProperties(); std::vector<PROPGRIDITEM> properties = PVInstance::getProperties();

View File

@@ -10,4 +10,5 @@ public:
GroupInstance(const GroupInstance &oinst); GroupInstance(const GroupInstance &oinst);
virtual std::vector<PROPGRIDITEM> getProperties(); virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem); virtual void PropUpdate(LPPROPGRIDITEM &pItem);
}; };

View File

@@ -114,6 +114,21 @@ std::vector<Instance* > Instance::getAllChildren()
return children; return children;
} }
std::vector<Instance* > Instance::compileAndGetPVVector()
{
std::vector<Instance* > totalchildren;
if(!children.empty())
{
for(size_t i = 0; i < children.size(); i++)
{
std::vector<Instance* > subchildren = children.at(i)->compileAndGetPVVector();
if(!subchildren.empty())
totalchildren.insert(totalchildren.end(), subchildren.begin(), subchildren.end());
}
}
return totalchildren;
}
void Instance::setParent(Instance* newParent) void Instance::setParent(Instance* newParent)
{ {
if(parent != NULL) if(parent != NULL)

View File

@@ -12,12 +12,12 @@ public:
std::string name; std::string name;
virtual void render(RenderDevice*); virtual void render(RenderDevice*);
virtual void update(); virtual void update();
std::vector<Instance*> children; // All children.
std::string getClassName(); std::string getClassName();
Instance* findFirstChild(std::string); Instance* findFirstChild(std::string);
std::vector<Instance* > getChildren(); std::vector<Instance* > getChildren();
std::vector<Instance* > getAllChildren(); std::vector<Instance* > getAllChildren();
void setParent(Instance*); std::vector<Instance* > compileAndGetPVVector();
virtual void setParent(Instance*);
void setName(std::string newName); void setName(std::string newName);
void addChild(Instance*); void addChild(Instance*);
void removeChild(Instance*); void removeChild(Instance*);
@@ -28,6 +28,7 @@ public:
virtual void PropUpdate(LPPROPGRIDITEM &pItem); virtual void PropUpdate(LPPROPGRIDITEM &pItem);
int listicon; int listicon;
protected: protected:
std::vector<Instance*> children; // All children.
std::string className; std::string className;
Instance* parent; // Another pointer. Instance* parent; // Another pointer.
PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type, TCHAR choices[] = NULL); PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type, TCHAR choices[] = NULL);

View File

@@ -1,4 +1,5 @@
#include "PVInstance.h" #include "PVInstance.h"
#include "WorkspaceInstance.h"
PVInstance::PVInstance(void) PVInstance::PVInstance(void)
{ {
@@ -21,6 +22,43 @@ void PVInstance::postRender(RenderDevice* rd)
{ {
} }
void PVInstance::render(RenderDevice* rd)
{
}
void PVInstance::setParent(Instance* newParent)
{
if(parent != NULL)
{
Instance* workspace = parent;
while(workspace != NULL)
{
if(WorkspaceInstance* wsp = dynamic_cast<WorkspaceInstance*>(workspace))
{
wsp->removeFromPVector(this);
break;
}
workspace = workspace->getParent();
}
parent->removeChild(this);
}
parent = newParent;
if(newParent != NULL)
{
Instance* workspace = parent;
while(workspace != NULL)
{
if(WorkspaceInstance* wsp = dynamic_cast<WorkspaceInstance*>(workspace))
{
wsp->addToPVector(this);
break;
}
workspace = workspace->getParent();
}
newParent->addChild(this);
}
}
std::vector<PROPGRIDITEM> PVInstance::getProperties() std::vector<PROPGRIDITEM> PVInstance::getProperties()
{ {
std::vector<PROPGRIDITEM> properties = Instance::getProperties(); std::vector<PROPGRIDITEM> properties = Instance::getProperties();

View File

@@ -9,7 +9,9 @@ public:
~PVInstance(void); ~PVInstance(void);
PVInstance(const PVInstance &oinst); PVInstance(const PVInstance &oinst);
virtual void postRender(RenderDevice* rd); virtual void postRender(RenderDevice* rd);
virtual void setParent(Instance* newParent);
virtual std::vector<PROPGRIDITEM> getProperties(); virtual std::vector<PROPGRIDITEM> getProperties();
virtual void PropUpdate(LPPROPGRIDITEM &pItem); virtual void PropUpdate(LPPROPGRIDITEM &pItem);
virtual void render(RenderDevice* rd);
bool nameShown; bool nameShown;
}; };

View File

@@ -12,3 +12,12 @@ WorkspaceInstance::WorkspaceInstance(void)
WorkspaceInstance::~WorkspaceInstance(void) WorkspaceInstance::~WorkspaceInstance(void)
{ {
} }
void WorkspaceInstance::removeFromPVector(PVInstance * instance)
{
__pvVector.erase(std::remove(__pvVector.begin(), __pvVector.end(), instance), __pvVector.end());
}
void WorkspaceInstance::addToPVector(PVInstance * instance)
{
__pvVector.push_back(instance);
}

View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include "GroupInstance.h" #include "GroupInstance.h"
#include <set>
class WorkspaceInstance : class WorkspaceInstance :
public GroupInstance public GroupInstance
@@ -7,4 +8,8 @@ class WorkspaceInstance :
public: public:
WorkspaceInstance(void); WorkspaceInstance(void);
~WorkspaceInstance(void); ~WorkspaceInstance(void);
void removeFromPVector(PVInstance *);
void addToPVector(PVInstance *);
std::vector<PVInstance*> __pvVector;
std::vector<PVInstance*>* getPVVector();
}; };