-
Notifications
You must be signed in to change notification settings - Fork 0
/
objects.py
200 lines (156 loc) · 5.8 KB
/
objects.py
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
from OpenGL.GL import *
import OpenGL.GL.shaders
import numpy as np
import math
def create_triangle(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
# Funcao para calcular os vertices aqui
# Preenchendo as coordenadas de cada vértice
vertices = [
(-0.1, +0.0),
(+0.1, +0.0),
(+0.0, +0.14),
]
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_nose(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
# Funcao para calcular os vertices aqui
# Preenchendo as coordenadas de cada vértice
vertices = [
(-0.05, +0.0),
(+0.1, +0.1),
(+0.2, +0.3),
(+0.3, +0.2),
(+0.4, +0.4),
(+0.5, +0.25),
(+0.6, +0.4),
(+0.7, +0.2),
(+0.8, +0.3),
(+0.9, +0.1),
(+1.05, +0.0),
]
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_mouth(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
# Funcao para calcular os vertices aqui
num_vertices = 32 # define a "qualidade" do circulo
pi = 3.14
counter = 0
radius = 0.5
vertices = []
angle = 0.0
for counter in range(num_vertices):
angle += 2*pi/num_vertices
vertice_x = math.cos(angle)*radius
vertice_y = math.sin(angle)*radius
# x = np.float64(round(x, 3))
# y = np.float64(round(y, 3))
# Para pegar somente o semi circulo inferior, ignore os primeiros 15 pontos
if counter > 14:
vertices.append((vertice_x,vertice_y))
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_head(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
# Funcao para calcular os vertices aqui
# Preenchendo as coordenadas de cada vértice
vertices = [
(+0.0, +0.65),
(+0.3, +0.0),
(-0.3, +0.0),
(+0.0, -0.45),
]
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_head_outline(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
# Funcao para calcular os vertices aqui
# Preenchendo as coordenadas de cada vértice
vertices = [
(+0.0, +0.65),
(+0.3, +0.0),
(+0.0, -0.45),
(-0.3, +0.0),
]
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_hair(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
# Funcao para calcular os vertices aqui
# Preenchendo as coordenadas de cada vértice
vertices = [
(0.270, -0.200),
(0.225, -0.250),
(0.268, -0.279),
(0.341, -0.164),
(0.300, -0.182),
(0.309, -0.108),
(0.285, -0.042),
(0.263, -0.122),
(0.200, -0.066),
(0.127, -0.048),
(0.063, -0.048),
(0.127, -0.090),
(0.158, -0.130),
(0.066, -0.154),
(0.140, -0.188),
(0.084, -0.244),
(0.170, -0.243),
(0.225, -0.250),
]
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_hair_outline(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
# Funcao para calcular os vertices aqui
# Preenchendo as coordenadas de cada vértice
vertices = [
(0.225, -0.250),
(0.268, -0.279),
(0.341, -0.164),
(0.300, -0.182),
(0.309, -0.108),
(0.285, -0.042),
(0.263, -0.122),
(0.200, -0.066),
(0.127, -0.048),
(0.063, -0.048),
(0.127, -0.090),
(0.158, -0.130),
(0.066, -0.154),
(0.140, -0.188),
(0.084, -0.244),
(0.170, -0.243),
]
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_ellipse(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, radius=1.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP, eccentricity=1):
num_vertices = 32 # define a "qualidade" do circulo
pi = 3.14
counter = 0
vertices = []
offset_x = x
offset_y = y
angle = 0.0
for counter in range(num_vertices):
angle += 2*pi/num_vertices
x = math.cos(angle)*radius + offset_x
y = math.sin(angle)*radius*eccentricity + offset_y
# x = np.float64(round(x, 3))
# y = np.float64(round(y, 3))
vertices.append((x,y))
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_ear(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
num_vertices = 32 # define a "qualidade" do circulo
pi = 3.14
counter = 0
radius = 0.06
vertices = []
angle = 0.0
for counter in range(num_vertices):
angle += 2*pi/num_vertices
vertice_x = math.cos(angle)*radius
vertice_y = math.sin(angle)*radius
vertices.append((vertice_x,vertice_y))
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]
def create_ear_line(program=None, x=0.0, y=0.0, scale_x=1.0, scale_y= 1.0, rotation=0.0, R=0.1, G=0.1, B=0.1, mode=GL_LINE_STRIP):
# Funcao para calcular os vertices aqui
# Preenchendo as coordenadas de cada vértice
vertices = [
(+0.033, -0.03),
(+0.01, -0.035),
(-0.01, -0.02),
(+0.00, +0.00),
(-0.011, +0.019),
(+0.01, +0.042),
(+0.032, +0.03),
]
return [vertices, x, y, scale_x, scale_y, rotation, R, G, B, mode]