示例#1
0
 def rotate_point_rotation(self, point, axis, magnitude):
     m = Matrix4.new_rotate_axis(magnitude, axis)
     pos = Vector3(self.position.x - point.x,
                   self.position.y - point.y,
                   self.position.z - point.z)
     pos = m.transform( pos)
     return pos + point
示例#2
0
    def __init__(self, *args, **kwargs):
        super(Raw, self).__init__(*args, **kwargs)

        import import_raw
        self.vertices, self.indices = import_raw.readMeshRAW('trim.raw')
        
        verts = np.array(self.vertices).reshape(-1,3)
        idx = np.array(self.indices).reshape(-1,3)

        verts = self.transform_verts(verts, Matrix4.new_rotate_axis(math.pi*-0.5, Vector3(1,0,0)) )
        vn = self.calculate_normals(verts, idx)
        
        self.vertices = tuple(verts.flat)
        self.normals = tuple(vn.flat)
        self.indices = tuple(idx.flat)
        self.vertex_list = self.batch.add_indexed(len(self.vertices)//3,
                                             GL_TRIANGLES,
                                             None,
                                             self.indices,
                                             ('v3f/static', self.vertices),
                                             ('n3f/static', self.normals)
                                             )
        self.color = Parameter(default=Color3(0.9, 0.3, 0.4), vmin=0.0, vmax=1.0)
示例#3
0
 def rotate_point_rotation(self, point, axis, magnitude):
     m = Matrix4.new_rotate_axis(magnitude, axis)
     pos = Vector3(self.position.x - point.x, self.position.y - point.y,
                   self.position.z - point.z)
     pos = m.transform(pos)
     return pos + point