From f7e1017175990c60650d9466538ea240ffc0eb77 Mon Sep 17 00:00:00 2001 From: David Martinez Marti Date: Fri, 23 Oct 2009 11:51:11 +0200 Subject: [PATCH] add material option for wLabel3D --- src/pyworlds/basics/wbody.py | 6 +++--- src/pyworlds/utils.py | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/pyworlds/basics/wbody.py b/src/pyworlds/basics/wbody.py index 49a86fe..9ff23b4 100644 --- a/src/pyworlds/basics/wbody.py +++ b/src/pyworlds/basics/wbody.py @@ -178,7 +178,7 @@ m_red.specular = (1.0, 0.0, 0.0, 0.5) class wLabel3DFlat(soya.World): - def __init__(self, size = 0.01, compensation = 0.02, follows = None, offset = (0.0,1.0,1.0), *args, **kwargs): + def __init__(self, size = 0.01, compensation = 0.02, follows = None, material = m_black, offset = (0.0,1.0,1.0), *args, **kwargs): if 'parent' not in kwargs: kwargs['parent']=pyworlds.worlds.scene soya.World.__init__(self, kwargs['parent']) @@ -196,11 +196,11 @@ class wLabel3DFlat(soya.World): self.text_width, self.text_height = self.label._font.get_print_size(self.label._text) self.text_width+=10 self.text_height+=10 - pyworlds.utils.Box(self.text_width*size,size*self.text_height,0,insert_into=self.box, material=m_black, origin = (0,1*size,-0.01) ) + pyworlds.utils.Box(self.text_width*size,size*self.text_height,0,insert_into=self.box, material=material, origin = (0,1*size,-0.01) , lit = False) self.box_normal = self.box.to_model() self.box = soya.World(None) - pyworlds.utils.Box(self.text_width*size,size*self.text_height,0,insert_into=self.box, material=m_red, origin = (0,1*size,-0.01) ) + pyworlds.utils.Box(self.text_width*size,size*self.text_height,0,insert_into=self.box, material=m_red, origin = (0,1*size,-0.01), lit = False ) self.box_selected = self.box.to_model() self.model = self.box_normal diff --git a/src/pyworlds/utils.py b/src/pyworlds/utils.py index 15993ea..57a5170 100644 --- a/src/pyworlds/utils.py +++ b/src/pyworlds/utils.py @@ -68,7 +68,7 @@ def xy_toangle(x1,y1): -def Box(x,y,z,parent = None, material = None, insert_into = None, texcoord_size=1, origin=(0,0,0)): +def Box(x,y,z,parent = None, material = None, insert_into = None, texcoord_size=1, origin=(0,0,0), lit = True): """Box(parent = None, material = None, insert_into = None) -> World Creates and returns a World in PARENT, containing a box(x,y,z) length centered @@ -82,40 +82,46 @@ creating a new world.""" cube = insert_into or soya.World(parent) s = texcoord_size - soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 1.0*s, 1.0*s), + f=soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 1.0*s, 1.0*s), soya.Vertex(cube, -0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 0.0, 1.0*s), soya.Vertex(cube, -0.5*x+ox, -0.5 * y+oy, 0.5 * z+oz, 0.0, 0.0), soya.Vertex(cube, 0.5*x+ox, -0.5 * y+oy, 0.5 * z+oz, 1.0*s, 0.0), ], material) + f.lit = lit - soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, -0.5 * z+oz, 0.0, 1.0*s), + f=soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, -0.5 * z+oz, 0.0, 1.0*s), soya.Vertex(cube, 0.5*x+ox, -0.5 * y+oy, -0.5 * z+oz, 0.0, 0.0), soya.Vertex(cube, -0.5*x+ox, -0.5 * y+oy, -0.5 * z+oz, 1.0*s, 0.0), soya.Vertex(cube, -0.5*x+ox, 0.5 * y+oy, -0.5 * z+oz, 1.0*s, 1.0*s), ], material) + f.lit = lit - soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 1.0*s, 0.0), + f=soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 1.0*s, 0.0), soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, -0.5 * z+oz, 1.0*s, 1.0*s), soya.Vertex(cube, -0.5*x+ox, 0.5 * y+oy, -0.5 * z+oz, 0.0, 1.0*s), soya.Vertex(cube, -0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 0.0, 0.0), ], material) - soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, -0.5 * y+oy, 0.5 * z+oz, 1.0*s, 0.0), + f.lit = lit + f=soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, -0.5 * y+oy, 0.5 * z+oz, 1.0*s, 0.0), soya.Vertex(cube, -0.5*x+ox, -0.5 * y+oy, 0.5 * z+oz, 1.0*s, 1.0*s), soya.Vertex(cube, -0.5*x+ox, -0.5 * y+oy, -0.5 * z+oz, 0.0, 1.0*s), soya.Vertex(cube, 0.5*x+ox, -0.5 * y+oy, -0.5 * z+oz, 0.0, 0.0), ], material) + f.lit = lit - soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 1.0*s, 1.0*s), + f=soya.Face(cube, [soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 1.0*s, 1.0*s), soya.Vertex(cube, 0.5*x+ox, -0.5 * y+oy, 0.5 * z+oz, 1.0*s, 0.0), soya.Vertex(cube, 0.5*x+ox, -0.5 * y+oy, -0.5 * z+oz, 0.0, 0.0), soya.Vertex(cube, 0.5*x+ox, 0.5 * y+oy, -0.5 * z+oz, 0.0, 1.0*s), ], material) - soya.Face(cube, [soya.Vertex(cube, -0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 0.0, 1.0*s), + f.lit = lit + f=soya.Face(cube, [soya.Vertex(cube, -0.5*x+ox, 0.5 * y+oy, 0.5 * z+oz, 0.0, 1.0*s), soya.Vertex(cube, -0.5*x+ox, 0.5 * y+oy, -0.5 * z+oz, 1.0*s, 1.0*s), soya.Vertex(cube, -0.5*x+ox, -0.5 * y+oy, -0.5 * z+oz, 1.0*s, 0.0), soya.Vertex(cube, -0.5*x+ox, -0.5 * y+oy, 0.5 * z+oz, 0.0, 0.0), ], material) + f.lit = lit return cube -- 2.11.4.GIT