Ejemplo n.º 1
0
    def __init__(self, 
                 position=Vector3(0,0,0), 
                 width=None, 
                 height=None, 
                 depth=None, 
                 max=Vector3(0.5, 0.5, 0.5), 
                 min=Vector3(-0.5,-0.5,-0.5),
                 colour=Preset.white ):
        
        Node.__init__(self, name="WireCube")
        
        self.transform.position = position
        
        self._width = width     # X
        self._height = height   # Y
        self._depth = depth     # Z
        
        self._min = min
        self._max = max
        
        # Gen min/max - Will override explictly defined min/max - so pick one or the other!
        if not width is None and not height is None and not depth is None:
            hw = width / 2.0
            hh = height / 2.0
            hd = depth / 2.0
            
            self._min = Vector3(-hw, -hh, -hd) + position
            self._max = Vector3(hw, hh, hd) + position
        
        self.gen_coords()

        self._colour = colour
Ejemplo n.º 2
0
 def __init__(self, pos, normal=Vector3.UP(), size=1.0, colour=Preset.white):
     
     Node.__init__(self, name="WirePlane")
     
     self.transform.position = pos
     self._normal = normal.normalized()
     self._size = size
     self._colour = colour
     self._gen_offset_coords()
Ejemplo n.º 3
0
    def __init__(self, pos=Vector3(0,0,0), radius=150.0, density=16): #6.328
        Node.__init__(self)
        
        self._name = "planet_root"

        self.transform.position = pos

        # The mesh density
        self._density = density
        
        # The camera position in sphere-space coordinates
        self._camera_pos = pos
        self._camera_pos_sc = None
        self._radius = radius
        self._horizon = 0.0
        
        self._max_depth = 8
        
        #self._camera_gizmo = WireSphere(radius=0.1)
        #self.transform.add_child(self._camera_gizmo.transform)
        
        self._camera_gizmo = GizmoManager.draw_sphere(Vector3(), radius=0.2)
        
        # The maximum height of the sphere surface (above the radius)
        self._max_height = (radius * 0.05) #0.02
        self._split_factor = 1.1  #16
        self._split_power = 1.1 #1.25
        
        self._horizon = 0
        
        self._ui = PlanetSphereDebugWindow()
        
        # Number splits this frame
        self._num_splits = 0
        # Max number of splits per frame
        self._max_splits = 8
        
#        pos = self.transform.position
#        pos.y += 0.1
#        self.transform.position.y = 1.0
#        self._line = Line(Vector3(0,1,0), Vector3(0, 0, 0), 5.0)
#        self.transform.add_child(self._line.transform)

        self._line = GizmoManager.draw_line(Vector3(-1,0,0), Vector3(0,0,0), 5.0)
        
#        self._cube_pos = Line(self.transform.position, Vector3(0, 0, 0), 5.0)
#        self.transform.add_child(self._cube_pos.transform)
        
        self._camera = None
        self._last_camera_pos = None
        self._last_time = datetime.now()
        
        self._generator = SphereSurface(self._density, self._radius, self._max_height)

        # Create the faces of the planet
        self._gen_faces()
Ejemplo n.º 4
0
    def __init__(self, name,
                       sphere_parent,
                       planet_root, 
                       split_distance=1.0, 
                       radius=1.0,
                       root=True, 
                       level=-1,
                       density=10,
                       face=CubeSphereMap.TOP,
                       quad=QuadName.TL):
        
        # Override the default renderer
        Node.__init__(self, renderer=SphereQuadRenderer())
        
        self._name = name

        self._sphere_parent = sphere_parent
        
        # Planet Root - for global controls
        self._planet_root = planet_root
        
        self._face = face
        self._quad = quad
        #self.local_scale = Vector3(size, size, size)
        
        self._root = root
        
        self._is_split = False
        self._level = level
        
        # The Mesh density
        self._density = density
        
        self._radius = radius
#        self._split_dist = split_distance * self.SPLIT_DISTANCE 
        
        self._corners = None
        self._quad_centres = None
        
        self._centre_coords = None
        
        self._sorted_quads = None
        
        # The Quads
        self._tl = None
        self._tr = None
        self._bl = None
        self._br = None
Ejemplo n.º 5
0
    def __init__(self, 
                 position=Vector3(0,0,0), 
                 direction=Vector3(0,0,0), 
                 length=1.0, 
                 colour=None, 
                 start_colour=Preset.white, 
                 end_colour=Preset.red):
        Node.__init__(self)
        self.transform.position = position
        self._direction = direction.normalized()
        self._length = length

        if not colour is None:
            self._start_colour = colour
            self._end_colour = colour
        else:
            self._start_colour = start_colour
            self._end_colour = end_colour
Ejemplo n.º 6
0
 def __init__(self, position=Vector3(0,0,0), radius=1.0):
     Node.__init__(self)
     self.transform.position = position
     print "Wire Sphere position: %s" % self.transform.position
     self._radius = radius
Ejemplo n.º 7
0
 def __init__(self, name="terrain", size=64, low=-2.5, high=2.5):
     Node.__init__(self, name=name)
     self._size = size
     self._low = low
     self._high = high
Ejemplo n.º 8
0
 def __init__(self):
     Node.__init__(self, name="default_light", light=GLLight(), renderer=None)
Ejemplo n.º 9
0
	def __init__(self):
		Node.__init__(self, name="default_camera", camera=CameraGL(), renderer=None)