Beispiel #1
0
def frustumProjMtx(fovy, near, far, aspect=0):
	if aspect == 0:
		from gltools import getViewportSize
		w,h = getViewportSize()
		aspect = float(w) / float(h)

	h = math.tan(fovy / 360.0 * math.pi) * near
	w = h * aspect

	return T.clip_matrix(-w, w, -h, h, near, far, perspective=True)
Beispiel #2
0
    def init(self):
        self.resetModelview()
        self._normal_m = N.array([(1,0,0),(0,1,0),(0,0,1)],dtype="f")
        self._light_m = T.identity_matrix()


        self._perspective_m = frustumProjMtx(60, 0.5, 500.0)
        vpw, vph = getViewportSize()
        self._ortho_m = T.clip_matrix(0, vpw, vph, 0, -1, 1)#  0.,0.,.,1.,-1.,1.,False)
        self._modelview_m_stack = []

        self.setPerspectiveMode()

        print self._modelview_m
        print self._projection_m

        self.pushTransform()
Beispiel #3
0
	def _getNewProjectionMatrix(self):
		return T.clip_matrix(self._x_min, self._x_max, self._y_min, self._y_max, -1, 1)#  0.,0.,.,1.,-1.,1.,False)