Here is a small modification from the original Cube function.

def Box(x,y,z,parent = None, material = None, insert_into = None, 
texcoord_size=1):
        """Box(parent = None, material = None, insert_into = None) -> World

Creates and returns a World in PARENT, containing a box(x,y,z) length centered
on the origin, with material MATERIAL.

If INSERT_INTO is not None, the cube's faces are inserted into it, instead of
creating a new world."""
        
        cube = insert_into or soya.World(parent)
        s = texcoord_size
        soya.Face(cube, [soya.Vertex(cube,  0.5*x,  0.5*y,  0.5*z, 1.0*s, 
1.0*s),
                                                        soya.Vertex(cube, 
-0.5*x,  0.5*y,  0.5*z, 0.0, 1.0*s),
                                                        soya.Vertex(cube, 
-0.5*x, -0.5*y,  0.5*z, 0.0, 0.0),
                                                        soya.Vertex(cube,  
0.5*x, -0.5*y,  0.5*z, 1.0*s, 0.0),
                                                        ], material)
        soya.Face(cube, [soya.Vertex(cube,  0.5*x,  0.5*y, -0.5*z, 0.0, 1.0*s),
                                                        soya.Vertex(cube,  
0.5*x, -0.5*y, -0.5*z, 0.0, 0.0),
                                                        soya.Vertex(cube, 
-0.5*x, -0.5*y, -0.5*z, 1.0*s, 0.0),
                                                        soya.Vertex(cube, 
-0.5*x,  0.5*y, -0.5*z, 1.0*s, 1.0*s),
                                                        ], material)
        
        soya.Face(cube, [soya.Vertex(cube,  0.5*x,  0.5*y,  0.5*z, 1.0*s, 0.0),
                                                        soya.Vertex(cube,  
0.5*x,  0.5*y, -0.5*z, 1.0*s, 1.0*s),
                                                        soya.Vertex(cube, 
-0.5*x,  0.5*y, -0.5*z, 0.0, 1.0*s),
                                                        soya.Vertex(cube, 
-0.5*x,  0.5*y,  0.5*z, 0.0, 0.0),
                                                        ], material)
        soya.Face(cube, [soya.Vertex(cube,  0.5*x, -0.5*y,  0.5*z, 1.0*s, 0.0),
                                                        soya.Vertex(cube, 
-0.5*x, -0.5*y,  0.5*z, 1.0*s, 1.0*s),
                                                        soya.Vertex(cube, 
-0.5*x, -0.5*y, -0.5*z, 0.0, 1.0*s),
                                                        soya.Vertex(cube,  
0.5*x, -0.5*y, -0.5*z, 0.0, 0.0),
                                                        ], material)
        
        soya.Face(cube, [soya.Vertex(cube,  0.5*x,  0.5*y,  0.5*z, 1.0*s, 
1.0*s),
                                                        soya.Vertex(cube,  
0.5*x, -0.5*y,  0.5*z, 1.0*s, 0.0),
                                                        soya.Vertex(cube,  
0.5*x, -0.5*y, -0.5*z, 0.0, 0.0),
                                                        soya.Vertex(cube,  
0.5*x,  0.5*y, -0.5*z, 0.0, 1.0*s),
                                                        ], material)
        soya.Face(cube, [soya.Vertex(cube, -0.5*x,  0.5*y,  0.5*z, 0.0, 1.0*s),
                                                        soya.Vertex(cube, 
-0.5*x,  0.5*y, -0.5*z, 1.0*s, 1.0*s),
                                                        soya.Vertex(cube, 
-0.5*x, -0.5*y, -0.5*z, 1.0*s, 0.0),
                                                        soya.Vertex(cube, 
-0.5*x, -0.5*y,  0.5*z, 0.0, 0.0),
                                                        ], material)
        
        return cube

        

_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user

Reply via email to