text: """
  Student Name: Haowei Li
  Student ID: U32332746
  Class: CS480
  Assignment Number: 4
  Due Date: Tuesday 12/07, 11:59 PM
  no collabrations
  """
  import math
  
  import numpy as np
  
  import ColorType
  from Animation import Animation
  from Component import Component
  from Light import Light
  from Material import Material
  from Point import Point
  import GLUtility
  
  from DisplayableCube import DisplayableCube
  from DisplayableTorus import DisplayableTorus
  from DisplayableSphere import DisplayableSphere
  from DisplayableCubeEBO import DisplayableCubeEBO
  from DisplayableEllipsoid import DisplayableEllipsoid
  from DisplayableCylinder import DisplayableCylinder
  from DisplayableDisk import DisplayableDisk
  earth = "./assets/earth.jpg"
  marble = "./assets/marble.jpg"
  class SceneFive(Component, Animation):
      lights = None
      lightCubes = None
      shaderProg = None
      glutility = None
  
      lRadius = None
      lAngles = None
      lTransformations = None
  
      def __init__(self, shaderProg, curMode=0,lightMode=0):
          super().__init__(Point((0, 0, 0)))
          self.shaderProg = shaderProg
          self.glutility = GLUtility.GLUtility()
          self.curMode = curMode
          self.lightMode = lightMode
          self.lTransformations = [self.glutility.translate(0, 2, 0, False),
                                   self.glutility.rotate(60, [0, 0, 1], False),
                                   self.glutility.rotate(120, [0, 0, 1], False)]
          self.lRadius = 3
          self.lAngles = [0, 0, 0]
          m1 = Material(np.array((0.1, 0.1, 0.1, 0.1)), np.array((0.2, 0.2, 0.2, 1)),
                        np.array((0.4, 0.4, 0.4, 0.1)), 64)
          sphere = Component(Point((0, 0, 0)), DisplayableSphere(shaderProg, 1, 36, 36,ColorType.ORANGE))
          sphere.setMaterial(m1)
          sphere.setTexture(self.shaderProg, earth)
          sphere.renderingRouting = "texture"
          self.addChild(sphere)
  
          torus = Component(Point((1, 0, 0)), DisplayableTorus(shaderProg, 0.25, 0.5, 36, 36,ColorType.ORANGE))
          torus.setMaterial(m1)
          sphere.setTexture(self.shaderProg, marble)
          torus.renderingRouting = "texture"
          self.addChild(torus)
  
          l0 = Light(self.lightPos(self.lRadius, self.lAngles[0], self.lTransformations[0]),
                     np.array((*ColorType.SOFTRED, 1.0)))
          lightCube0 = Component(Point((0, 1, 0)), DisplayableCube(shaderProg, 0.1, 0.1, 0.1, ColorType.SOFTRED))
          lightCube0.renderingRouting = "vertex"
          l1 = Light(self.lightPos(self.lRadius, self.lAngles[1], self.lTransformations[1]),
                     np.array((*ColorType.SOFTBLUE, 1.0)))
          lightCube1 = Component(Point((0, 0, 0)), DisplayableCube(shaderProg, 0.1, 0.1, 0.1, ColorType.SOFTBLUE))
          lightCube1.renderingRouting = "vertex"
          l2 = Light(self.lightPos(self.lRadius, self.lAngles[2], self.lTransformations[2]),
                     np.array((*ColorType.SOFTGREEN, 1.0)))
          lightCube2 = Component(Point((0, -1, 0)), DisplayableCube(shaderProg, 0.1, 0.1, 0.1, ColorType.SOFTGREEN))
          lightCube2.renderingRouting = "vertex"
          if self.lightMode == 0:
              self.addChild(lightCube0)
              self.addChild(lightCube1)
              self.addChild(lightCube2)
              self.lights = [l0, l1, l2]
              self.lightCubes = [lightCube0, lightCube1, lightCube2]
          if self.lightMode == 1:
              self.addChild(lightCube0)
              self.lights = [l0]
              self.lightCubes = [lightCube0]
          if self.lightMode == 2:
              self.addChild(lightCube1)
              self.lights = [l1]
              self.lightCubes = [lightCube1]
          if self.lightMode == 3:
              self.addChild(lightCube2)
              self.lights = [l2]
              self.lightCubes = [lightCube2]
  
      def lightPos(self, radius, thetaAng, transformationMatrix):
          r = np.zeros(4)
          r[0] = radius * math.cos(thetaAng / 180 * math.pi)
          r[2] = radius * math.sin(thetaAng / 180 * math.pi)
          r[3] = 1
          r = transformationMatrix @ r
          return r[0:3]
  
      def animationUpdate(self):
          self.lAngles[0] = (self.lAngles[0] + 0.5) % 360
          self.lAngles[1] = (self.lAngles[1] + 0.7) % 360
          self.lAngles[2] = (self.lAngles[2] + 1.0) % 360
          for i, v in enumerate(self.lights):
              lPos = self.lightPos(self.lRadius, self.lAngles[i], self.lTransformations[i])
              self.lightCubes[i].setCurrentPosition(Point(lPos))
              self.lights[i].setPosition(lPos)
              self.shaderProg.setLight(i, v)
  
          for c in self.children:
              if isinstance(c, Animation):
                  c.animationUpdate()
  
      def initialize(self):
          self.shaderProg.clearAllLights()
          for i, v in enumerate(self.lights):
              self.shaderProg.setLight(i, v)
          super().initialize()
  