-
Notifications
You must be signed in to change notification settings - Fork 0
/
Line.cpp
76 lines (54 loc) · 1.22 KB
/
Line.cpp
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "stdafx.h"
#include "Line.h"
#include <string.h>
#include "Draw.h"
#include <msclr\marshal_cppstd.h>
#include <iostream>
#include <windows.h>
#include <fstream>
using namespace System;
using namespace std;
#define Pi 3.14159265359
Line::Line()
{
}
Line::~Line()
{
}
void Line::Initialize(float a, float b, float c, float X, float Y, float Z, float AngleX, float AngleY, float AngleZ, string Name, string Comment)
{
this->a = a;
this->b = b;
GenerateVertex();
this->X = X;
this->Y = Y;
this->Z = Z;
this->AngleX = AngleX;
this->AngleY = AngleY;
this->AngleZ = AngleZ;
this->Name = Name;
this->Comment = Comment;
LinkTextures();
}
void Line::GenerateVertex()
{
}
void Line::Draw()
{
glTranslatef(X, Y, Z);
glRotatef(AngleX, 1.0, 0.0, 0.0);
glRotatef(AngleY, 0.0, 1.0, 0.0);
glRotatef(AngleZ, 0.0, 0.0, 1.0);
glLineWidth(b);
glBindTexture(GL_TEXTURE_2D, Textures[0]);
glBegin(GL_LINES);
glTexCoord2f(0, 0);
glVertex3f(-a/2, 0.0, 0.0);
glTexCoord2f(1, 1);
glVertex3f(a/2, 0, 0);
glEnd();
glRotatef(-AngleX, 1.0, 0.0, 0.0);
glRotatef(-AngleY, 0.0, 1.0, 0.0);
glRotatef(-AngleZ, 0.0, 0.0, 1.0);
glTranslatef(-X, -Y, -Z);
}