Ejemplo n.º 1
0
    def __init__(self, vertexes=None, indices=None, *args, **kwds):
        """
        Constructor for the MeshObject class.

        Parameters:
        vertexes (list): List of vertices used in the mesh.
        indices (list): List of indices for the faces used in the mesh.
        rot_quat (glm.quat): Quaternion defining the rotation of the object.
        rot_vec (vec3): Vector3 defining the rotation of the object.
        scale (vec3): Scale factor for each axis of the object. Defaults to (1.0, 1.0, 1.0)
        position (vec3): Position of the object. Defaults to (0.0, 0.0, 0.0)
        """
        GLMeshItem.__init__(self)
        SpatialObject.__init__(self)
        # Argument extraction
        self.opts = {
            "vertexes": None,
            "model_verts": None,
            "indices": None,
            "position": vec3(0.0),
            "rot_vec": None,
            "rot_quat": None,
            "scale": vec3(1.0),
            "smooth": True,
            "computeNormals": False,
            "drawEdges": False,
            "drawFaces": True,
            "shader": None,
            "color": (1.0, 1.0, 1.0, 1.0),
            "edgeColor": (0.5, 0.5, 0.5, 1.0),
        }
        for k, v in kwds.items():
            self.opts[k] = v
        if(vertexes is not None):
            self.opts["vertexes"] = vertexes
        if(indices is not None):
            self.opts["indices"] = indices
            
        self.set_position(self.opts["position"], False)
        if (self.opts["rot_quat"] is not None):
          self.rotation = R.from_quat(self.opts["rot_quat"])
        if (self.opts["rot_vec"] is not None):
          self.rotation = R.from_rotvec(self.opts["rot_vec"])
        self.set_scale(self.opts["scale"], False)
        self.opts["meshdata"] = MeshData()
        self.set_vertexes(self.opts["vertexes"], False)
        self.set_indices(self.opts["indices"], False)
        if (self.opts["vertexes"] is not None):
            self.update_vertices()
Ejemplo n.º 2
0
 def __init__(self, **kwds):
     #super(CustomFrame, self,).__init__(size, color, glOptions)
     GLMeshItem.__init__(self, **kwds)