Added basic shape stuff

This commit is contained in:
andreja6
2018-10-24 20:49:26 -07:00
parent d2e0b29051
commit c50d2a8166
4 changed files with 21 additions and 1 deletions

6
Enum.h
View File

@@ -6,4 +6,10 @@ namespace Enum
Smooth, Bumps, Welds, Glue Smooth, Bumps, Welds, Glue
}; };
} }
namespace Shape
{
enum Value {
Block, Sphere, Cylinder
};
}
} }

View File

@@ -20,6 +20,7 @@ PartInstance::PartInstance(void)
back = Enum::SurfaceType::Smooth; back = Enum::SurfaceType::Smooth;
left = Enum::SurfaceType::Smooth; left = Enum::SurfaceType::Smooth;
bottom = Enum::SurfaceType::Smooth; bottom = Enum::SurfaceType::Smooth;
shape = Enum::Shape::Block;
} }
PartInstance::PartInstance(const PartInstance &oinst) PartInstance::PartInstance(const PartInstance &oinst)
@@ -42,6 +43,7 @@ PartInstance::PartInstance(const PartInstance &oinst)
back = oinst.back; back = oinst.back;
left = oinst.left; left = oinst.left;
bottom = oinst.bottom; bottom = oinst.bottom;
shape = oinst.shape;
} }
void PartInstance::setSize(Vector3 newSize) void PartInstance::setSize(Vector3 newSize)
@@ -67,6 +69,16 @@ void PartInstance::setSize(Vector3 newSize)
if(sizez > 512) if(sizez > 512)
sizez = 512; sizez = 512;
if(shape != Enum::Shape::Block)
{
int max = sizex;
if(sizey > max)
max = sizey;
if(sizez > max)
max = sizez;
sizex = sizey = sizez = max;
}
size = Vector3(sizex, sizey, sizez); size = Vector3(sizex, sizey, sizez);

View File

@@ -17,6 +17,7 @@ public:
Enum::SurfaceType::Value back; Enum::SurfaceType::Value back;
Enum::SurfaceType::Value left; Enum::SurfaceType::Value left;
Enum::SurfaceType::Value bottom; Enum::SurfaceType::Value bottom;
Enum::Shape::Value shape;
CoordinateFrame cFrame; CoordinateFrame cFrame;
Color3 color; Color3 color;
Vector3 getPosition(); Vector3 getPosition();

View File

@@ -1266,6 +1266,7 @@ void Demo::onGraphics(RenderDevice* rd) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren(); std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
currentcursorid = cursorid;
for(size_t i = 0; i < instances.size(); i++) for(size_t i = 0; i < instances.size(); i++)
{ {
if(PartInstance* test = dynamic_cast<PartInstance*>(instances.at(i))) if(PartInstance* test = dynamic_cast<PartInstance*>(instances.at(i)))
@@ -1277,7 +1278,7 @@ void Demo::onGraphics(RenderDevice* rd) {
currentcursorid = cursorOvrid; currentcursorid = cursorOvrid;
break; break;
} }
else currentcursorid = cursorid;
} }
} }