Added basic shape stuff
This commit is contained in:
6
Enum.h
6
Enum.h
@@ -6,4 +6,10 @@ namespace Enum
|
||||
Smooth, Bumps, Welds, Glue
|
||||
};
|
||||
}
|
||||
namespace Shape
|
||||
{
|
||||
enum Value {
|
||||
Block, Sphere, Cylinder
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ PartInstance::PartInstance(void)
|
||||
back = Enum::SurfaceType::Smooth;
|
||||
left = Enum::SurfaceType::Smooth;
|
||||
bottom = Enum::SurfaceType::Smooth;
|
||||
shape = Enum::Shape::Block;
|
||||
}
|
||||
|
||||
PartInstance::PartInstance(const PartInstance &oinst)
|
||||
@@ -42,6 +43,7 @@ PartInstance::PartInstance(const PartInstance &oinst)
|
||||
back = oinst.back;
|
||||
left = oinst.left;
|
||||
bottom = oinst.bottom;
|
||||
shape = oinst.shape;
|
||||
}
|
||||
|
||||
void PartInstance::setSize(Vector3 newSize)
|
||||
@@ -67,6 +69,16 @@ void PartInstance::setSize(Vector3 newSize)
|
||||
if(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);
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
Enum::SurfaceType::Value back;
|
||||
Enum::SurfaceType::Value left;
|
||||
Enum::SurfaceType::Value bottom;
|
||||
Enum::Shape::Value shape;
|
||||
CoordinateFrame cFrame;
|
||||
Color3 color;
|
||||
Vector3 getPosition();
|
||||
|
||||
3
main.cpp
3
main.cpp
@@ -1266,6 +1266,7 @@ void Demo::onGraphics(RenderDevice* rd) {
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
||||
currentcursorid = cursorid;
|
||||
for(size_t i = 0; i < instances.size(); i++)
|
||||
{
|
||||
if(PartInstance* test = dynamic_cast<PartInstance*>(instances.at(i)))
|
||||
@@ -1277,7 +1278,7 @@ void Demo::onGraphics(RenderDevice* rd) {
|
||||
currentcursorid = cursorOvrid;
|
||||
break;
|
||||
}
|
||||
else currentcursorid = cursorid;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user