Commit ddec65e5 authored by Václav 'Ax' Hůla's avatar Václav 'Ax' Hůla

Colors!

parent 20a28bb6
...@@ -283,9 +283,9 @@ class gcline(object): ...@@ -283,9 +283,9 @@ class gcline(object):
] ]
def glcolor(self): def glcolor(self):
if self.extrusion_ratio == 0: if self.extrusion_ratio == 0:
return [10,10,10,0,10,10,10,0] return [255,255,255,128,128,128]
else: else:
return[255,128,128,120,255,128,128,120] return[255,128,128,128,0,0]
def float_from_line(axe, line): def float_from_line(axe, line):
...@@ -317,8 +317,7 @@ class gcview(object): ...@@ -317,8 +317,7 @@ class gcview(object):
layer_name = line.z layer_name = line.z
if line.z not in self.layers: if line.z not in self.layers:
self.layers[line.z] = pyglet.graphics.Batch() self.layers[line.z] = pyglet.graphics.Batch()
self.layers[line.z].add(2, GL_LINES, None, ("c4B", line.glcolor())) self.layers[line.z].add(2, GL_LINES, None, ("v3f", line.glline()), ("c3B", line.glcolor()))
self.layers[line.z].add(2, GL_LINES, None, ("v3f", line.glline()))
self.layerlist = self.layers.keys() self.layerlist = self.layers.keys()
self.layerlist.sort() self.layerlist.sort()
t2 = time.time() t2 = time.time()
...@@ -800,11 +799,16 @@ class TestGlPanel(GLPanel): ...@@ -800,11 +799,16 @@ class TestGlPanel(GLPanel):
glTranslatef(*(i.offsets)) glTranslatef(*(i.offsets))
glRotatef(i.rot, 0.0, 0.0, 1.0) glRotatef(i.rot, 0.0, 0.0, 1.0)
glScalef(*i.scale) glScalef(*i.scale)
#glEnable(GL_COLOR_MATERIAL) #glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0.93, 0.37, 0.25, 1))
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0.93, 0.37, 0.25, 1)) glEnable(GL_COLOR_MATERIAL)
glLineWidth (0.5)
[i.gc.layers[j].draw() for j in i.gc.layerlist if j < i.curlayer] [i.gc.layers[j].draw() for j in i.gc.layerlist if j < i.curlayer]
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0.5, 0.6, 0.9, 1))
glLineWidth (3.5)
i.gc.layers[i.curlayer].draw() i.gc.layers[i.curlayer].draw()
glLineWidth (1.5)
glDisable(GL_COLOR_MATERIAL)
glPopMatrix() glPopMatrix()
glPopMatrix() glPopMatrix()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment