Added surfaces

This commit is contained in:
andreja6
2018-06-10 20:26:33 -07:00
parent 54b19ba659
commit 1926dfa686
4 changed files with 46 additions and 0 deletions

View File

@@ -335,6 +335,10 @@
RelativePath=".\resource.h" RelativePath=".\resource.h"
> >
</File> </File>
<File
RelativePath=".\Surface.h"
>
</File>
<File <File
RelativePath=".\win32Defines.h" RelativePath=".\win32Defines.h"
> >

View File

@@ -6,6 +6,12 @@ Vector3 position;
Vector3 velocity; Vector3 velocity;
Vector3 rotVelocity; Vector3 rotVelocity;
GLfloat vertecies[96]; GLfloat vertecies[96];
Surface top;
Surface front;
Surface right;
Surface back;
Surface left;
Surface bottom;
CoordinateFrame cFrame; CoordinateFrame cFrame;
Color3 color; Color3 color;
bool changed = true; bool changed = true;
@@ -24,6 +30,12 @@ PhysicalInstance::PhysicalInstance(void)
color = Color3::gray(); color = Color3::gray();
velocity = Vector3(0,0,0); velocity = Vector3(0,0,0);
rotVelocity = Vector3(0,0,0); rotVelocity = Vector3(0,0,0);
top = Snaps;
front = Smooth;
right = Smooth;
back = Smooth;
left = Smooth;
bottom = Inlets;
} }
void PhysicalInstance::setSize(Vector3 newSize) void PhysicalInstance::setSize(Vector3 newSize)
{ {
@@ -122,6 +134,24 @@ void PhysicalInstance::render(RenderDevice* rd)
glBegin(GL_QUADS); glBegin(GL_QUADS);
for(int i = 0; i < 96; i+=16) for(int i = 0; i < 96; i+=16)
{ {
if(i == 0)//Back
{
}
if(i == 16)//Right
{
}
if(i == 32)//Front
{
}
else if(i == 48)//Top
{
}
else if(i == 64)//Left
{
}
else if(i == 80)//Bottom
{
}
Vector3 v0 = Vector3(vertecies[i], vertecies[i+1], vertecies[i+2]), v1 = Vector3(vertecies[i+3], vertecies[i+4], vertecies[i+5]), v3 = Vector3(vertecies[i+9], vertecies[i+10], vertecies[i+11]); Vector3 v0 = Vector3(vertecies[i], vertecies[i+1], vertecies[i+2]), v1 = Vector3(vertecies[i+3], vertecies[i+4], vertecies[i+5]), v3 = Vector3(vertecies[i+9], vertecies[i+10], vertecies[i+11]);
glNormal3fv((v1 - v0).cross(v3 - v0).direction()); glNormal3fv((v1 - v0).cross(v3 - v0).direction());
glVertex3fv(v0); glVertex3fv(v0);

View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include "instance.h" #include "instance.h"
#include "Surface.h"
class PhysicalInstance : class PhysicalInstance :
public Instance public Instance
@@ -10,6 +11,12 @@ public:
virtual void render(RenderDevice*); virtual void render(RenderDevice*);
Vector3 velocity; Vector3 velocity;
Vector3 rotvelocity; Vector3 rotvelocity;
Surface top;
Surface front;
Surface right;
Surface back;
Surface left;
Surface bottom;
CoordinateFrame cFrame; CoordinateFrame cFrame;
Color3 color; Color3 color;
Vector3 getPosition(); Vector3 getPosition();
@@ -17,6 +24,7 @@ public:
CoordinateFrame getCFrame(); CoordinateFrame getCFrame();
void setCFrame(CoordinateFrame); void setCFrame(CoordinateFrame);
Box getBox(); Box getBox();
Box getScaledBox();
CoordinateFrame getCFrameRenderBased(); CoordinateFrame getCFrameRenderBased();
Vector3 getSize(); Vector3 getSize();
void setSize(Vector3); void setSize(Vector3);

4
Surface.h Normal file
View File

@@ -0,0 +1,4 @@
#ifndef SURFACE_H
#define SURFACE_H
enum Surface {Smooth, Snaps, Inlets, Glue, Weld, Hinge, Motor};
#endif