Beispiel #1
0
	def __init__(self, x, y, z, parent = None, 
					target = cgt.vec3([.5,.5,.5]), 
					ortho = True, zoom = 30):
		#lgl._culling()
		self.shader = lgl.get_shader()
		self.light = light(x, y, z, shader = self.shader)
		self.material = lgl.material()
		world_object.__init__(self, x, y, z, parent = parent, 
			shader = self.shader, children = [self.light])
		self._draw_origin_ = False
		self.ortho = ortho
		self.zoom_initial = zoom
		self.zoom_ = self.zoom_initial

		self.znear = 0.001
		self.zfar = 1000.0

		self.location_initial = self._get_position_()
		self.target_initial = target
		self.location = cgt.vec3(self.location_initial)
		self.target = cgt.vec3(self.target_initial)

		self.select_ = None
		self.selectables = []

		self.roll = 0
		self.pitch = 0
		self.yaw = 0

		self.view_regimes = ['first person', 'arc ball']
		self.view_regime = self.view_regimes[1]
		self.view_callbacks = {
			'first person':self.get_basis_first_person, 
			'arc ball':self.get_basis_arc_ball, 
			}

		self._view_matrix_ = lm.identity_mat(4).flatten()
		self._projection_matrix_ = lm.identity_mat(4).flatten()
		self._normal_matrix_ = lm.identity_mat(3).flatten()
		self._mvp_matrix_ = lm.identity_mat(4).flatten()
		self.update_transforms()
Beispiel #2
0
	def __init__(self, x = 0, y = 0, z = 0, shader = None):
		self.material = lgl.material(shininess = 0.01, 
					dif_refl = cgt.vec3([0.9,0.1,0.1]), 
					amb_refl = cgt.vec3([0.9,0.1,0.1]))
		world_object.__init__(self, x, y, z, shader = shader)
		self._set_geometry_()