Example #1
0
 def add_solid(self, node):
     mesh = BulletConvexHullShape()
     mesh.add_geom(GeomBuilder().add_ramp(self.color, self.base, self.top,
                                          self.width, self.thickness,
                                          LRotationf(*self.hpr)).get_geom())
     node.add_shape(mesh)
     return node
Example #2
0
 def create_node(self):
     rel_base = Point3(self.base - (self.midpoint - Point3(0, 0, 0)))
     rel_top = Point3(self.top - (self.midpoint - Point3(0, 0, 0)))
     self.geom = GeomBuilder().add_ramp(self.color, rel_base, rel_top,
                                        self.width,
                                        self.thickness).get_geom_node()
     return NodePath(self.geom)
Example #3
0
 def add_solid(self, node):
     mesh = BulletConvexHullShape()
     mesh.add_geom(GeomBuilder().add_dome(self.color, self.center,
                                          self.radius,
                                          self.samples, self.planes,
                                          LRotationf(*self.hpr)).get_geom())
     node.add_shape(mesh)
     return node
Example #4
0
 def create_node(self):
     extent = self.size / 2.0
     geom_points = [
         Point3(0, -extent, -extent),
         Point3(0, extent, extent),
         Point3(0, -extent, extent)
     ]
     self.geom = GeomBuilder('tri').add_tri(self.color,
                                            geom_points).get_geom_node()
     self.node = self.world.render.attach_new_node(self.geom)
     self.colorhandle = self.node.find('**/*')
     return self.node
Example #5
0
 def fade_in(self):
     # blackout card
     bgeom = GeomBuilder().add_rect([0,0,0,1],-5,-5,0,5,5,0).get_geom_node()
     b = render.attach_new_node(bgeom)
     b.set_pos(self.cam.get_pos(render))
     b.set_hpr(self.cam.get_hpr(render))
     b_move_by = render.get_relative_vector(self.cam, Vec3(0,0,-2))
     b.set_pos(b, b_move_by)
     b.set_color(0,0,0)
     b.set_transparency(TransparencyAttrib.MAlpha)
     # fade from full opacity to no opacity
     cintv = LerpColorScaleInterval(b, 1.5, (1,1,1,0), (1,1,1,1))
     def _unhide_ui():
         self.doc.GetElementById('content').style.display = 'block'
         b.detach_node()
     # show ui after lerp is finished
     showui = Func(_unhide_ui)
     Sequence(cintv,showui).start()
Example #6
0
    def attached(self):
        if not self.world.camera:
            self.node = self.world.scene.attach_new_node('sky')
            return
        geom = GeomNode('sky')
        bounds = self.world.camera.node().get_lens().make_bounds()
        dl = bounds.getMin()
        ur = bounds.getMax()
        z = dl.getZ() * 0.99

        geom.add_geom(
            GeomBuilder('sky').add_rect((1, 1, 1, 1), dl.getX(), dl.getY(), 0,
                                        ur.getX(), ur.getY(), 0).get_geom())
        self.node = self.world.scene.attach_new_node(geom)
        self.node.set_shader(Shader.load('Shaders/Sky.sha'))
        self.node.set_shader_input('camera', self.world.camera)
        self.node.set_shader_input('sky', self.node)
        self.node.set_shader_input('groundColor', *self.ground)
        self.node.set_shader_input('skyColor', *self.color)
        self.node.set_shader_input('horizonColor', *self.horizon)
        self.node.set_shader_input('gradientHeight', self.scale, 0, 0, 0)
        self.node.reparent_to(self.world.camera)
        self.node.set_pos(self.world.camera, 0, 0, z)
Example #7
0
 def create_node(self):
     self.geom = GeomBuilder().add_dome(self.color, (0, 0, 0), self.radius,
                                        self.samples,
                                        self.planes).get_geom_node()
     return NodePath(self.geom)
Example #8
0
 def create_node(self):
     return NodePath(
         GeomBuilder('ramp').add_block(
             self.color, (0, 0, 0),
             (self.thickness, self.width, self.length)).get_geom_node())
Example #9
0
 def create_node(self):
     return NodePath(
         GeomBuilder('block').add_block(self.color, (0, 0, 0),
                                        self.size).get_geom_node())
Example #10
0
 def create_node(self):
     composite_geom = GeomBuilder('composite')
     for obj in self.objects:
         obj.add_to(composite_geom)
     return NodePath(composite_geom.get_geom_node())