Exemplo n.º 1
0
    def scatter_sphere(self, scene):
            
        # Add a new material to the sphere
        mat = scene.readMaterial(self.pzSphereMat)
        mat = scene.addMaterial(mat)
        
        radius = self.radius
        
        
        # scatter dots into scenes
        for i in range(self.numbOfDots):
            # Create a instance of the sphere in the scene
            x = random.random() * self.depth - self.depth/2
            y = random.random() * self.width - self.width/2
            z = random.random() * self.height - self.height/2
            
            dot = Geom.CSphere([x, y, z], radius)
            points = dot.getVertices()
            normals = dot.getNormals()
            triangles = dot.getTriangles()
            obj = MXS.createMxObject(scene, "dot_{}".format(i), points, normals, triangles)

            # Assign the material to the object of the new sphere
            obj.setMaterial(mat)
Exemplo n.º 2
0
    def create_light_planes(self, scene):
        distance = self.depth * 3
        height = self.height * 3
        width = self.width * 3

        origin = [distance, -width/2, -height/2]
        v = [0, width , 0]
        u = [0, 0, height]
      
    
        plane = Geom.CRectangle(origin, u, v)
        points = plane.getVertices()
        triangles = plane.getTriangles()
        normals = plane.getNormals()

        lightPlane = MXS.createMxObject(scene, "light_plane", points, normals, triangles)
        lightMat = scene.readMaterial(self.pzLightMat)
        lightMat = scene.addMaterial(lightMat)
        lightPlane.setMaterial(lightMat)
        lightPlane.setHideToCamera(True)
        lightPlane.setHideToGI(True)
        lightPlane.setHideToReflectionsRefractions(True)
        
        '''