-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCube.h
55 lines (46 loc) · 1.7 KB
/
Cube.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _CUBE_3D_H
#define _CUBE_3D_H
#include <GL/freeglut.h>
#include <math.h>
#include <stdio.h>
#include "Vector3D.h"
#include "Vector4D.h"
#include "Object3D.h"
namespace GLScene
{
/**
* TCube class
* Params: size of the cube or the 3 size of a parallelepiped over x, y and z
* Params: position (default (0,0,0))
* The cube is centered to it's position and initial direction is (0,0,1)
*/
class TCube : public TObject3D
{
private:
GLfloat size;
TVector3D size3D;
bool IsCube;
GLfloat angle;
TVector3D axe_angle;
TVector3D reduced_pos;
void ComputeParameters(void);
protected:
public:
TCube(GLfloat _size, TVector3D *pos = NULL);
TCube(TVector3D _size, TVector3D *pos = NULL);
TCube(GLfloat _size, const TVector3D &pos);
TCube(TVector3D _size, const TVector3D &pos);
virtual ~TCube();
void SetPosition(const TVector3D *pos) { position = *pos; ComputeParameters(); }
void SetPosition(GLfloat pos[]) { position = pos; ComputeParameters(); }
void SetPosition(std::initializer_list<GLfloat> list);
void SetPosition(GLfloat x, GLfloat y, GLfloat z) { position = {x, y, z}; ComputeParameters(); }
void SetDirection(const TVector3D *pos) { direction = *pos; ComputeParameters(); }
void SetDirection(GLfloat pos[]) { direction = pos; ComputeParameters(); }
void SetDirection(std::initializer_list<GLfloat> list);
void SetDirection(GLfloat x, GLfloat y, GLfloat z) { direction = {x, y, z}; ComputeParameters(); }
void DoDisplay(TDisplayMode mode = dmRender);
};
} // namespace GLScene
//---------------------------------------------------------------------------
#endif // _CUBE_3D_H