Example #1
0
 def add_celestial(self, azimuth, elevation, color, intensity, radius,
                   visible):
     """
     Adds a celestial light source to the scene. If it is a visible celestial, also add a sphere model.
     """
     if not self.camera:
         return
     location = Vec3(
         to_cartesian(azimuth, elevation, 1000.0 * 255.0 / 256.0))
     if intensity:
         dlight = DirectionalLight('celestial')
         dlight.set_color((color[0] * intensity, color[1] * intensity,
                           color[2] * intensity, 1.0))
         node = self.scene.attach_new_node(dlight)
         node.look_at(*(location * -1))
         self.scene.set_light(node)
     if visible:
         if radius <= 2.0:
             samples = 6
         elif radius >= 36.0:
             samples = 40
         else:
             samples = int(round(((1.5 * radius) * (2 / 3.0)) + 3.75))
         celestial = Dome(
             radius * 1.5, samples, 2, color, 0, location,
             ((-(math.degrees(azimuth))), 90 + math.degrees(elevation), 0))
         self.celestials.attach(celestial)
Example #2
0
 def add_celestial(self, azimuth, elevation, color, intensity, radius, visible):
     """
     Adds a celestial light source to the scene. If it is a visible celestial, also add a sphere model.
     """
     location = Vec3(to_cartesian(azimuth, elevation, 1000.0 * 255.0 / 256.0))
     if intensity:
         dlight = DirectionalLight('celestial')
         dlight.set_color((color[0] * intensity, color[1] * intensity,
             color[2] * intensity, 1.0))
         node = self.render.attach_new_node(dlight)
         node.look_at(*(location * -1))
         self.render.set_light(node)
     if visible:
         if radius <= 2.0:
             samples = 6
         elif radius >= 36.0:
             samples = 40
         else:
             samples = int(round(((1.5 * radius) * (2 / 3.0)) + 3.75))
         celestial = Dome(radius * 1.5, samples, 2, color, 0, location,
             ((-(math.degrees(azimuth))), 90 + math.degrees(elevation), 0))
         self.celestials.attach(celestial)
Example #3
0
 def __init__(self, pos, heading, name=None):
     super(Incarnator, self).__init__(name)
     self.pos = Vec3(*pos)
     self.heading = Vec3(to_cartesian(math.radians(heading), 0, 1000.0 * 255.0 / 256.0)) * -1
Example #4
0
 def __init__(self, pos, heading, name=None):
     super(Incarnator, self).__init__(name)
     self.pos = Vec3(*pos)
     self.heading = Vec3(
         to_cartesian(math.radians(heading), 0,
                      1000.0 * 255.0 / 256.0)) * -1