pythonCascade Sample Problems

Viewer: Positional light

 

        self.Initialize()

        if self.NbActiveLights >= self.myGraphicDriver.InquireLightLimit():

            print "You have reached the limit number of active lights :" + `self.myGraphicDriver.InquireLightLimit()`

            print "Clear lights to create new ones."

            return

        self.myCurrentMode = CurAction3d_BeginPositionalLight

        sb = self.frame.GetStatusBar().SetStatusText("Pick the light position")

        self.myCurrent_PositionalLight = V3d_PositionalLight(self.viewer,0,0,0,Quantity_NOC_GREEN,1,0)

        self.view.SetLightOn(self.myCurrent_PositionalLight)

        sb = self.frame.GetStatusBar().SetStatusText("Pick the light position")

        self.NbActiveLights = self.NbActiveLights + 1

 

# in mouse move

            elif self.myCurrentMode == CurAction3d_BeginPositionalLight:

                x,y = self.ConvertEventCoords(event)

                self.p2 = self.ConvertClickToPoint(x,y,self.view)

                self.myCurrent_PositionalLight.SetPosition(self.p2.X(),self.p2.Y(),self.p2.Z())               

                self.view.UpdateLights()