本文整理汇总了Python中panda3d.core.OrthographicLens.getCoordinateSystem方法的典型用法代码示例。如果您正苦于以下问题:Python OrthographicLens.getCoordinateSystem方法的具体用法?Python OrthographicLens.getCoordinateSystem怎么用?Python OrthographicLens.getCoordinateSystem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.OrthographicLens
的用法示例。
在下文中一共展示了OrthographicLens.getCoordinateSystem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ShadowSource
# 需要导入模块: from panda3d.core import OrthographicLens [as 别名]
# 或者: from panda3d.core.OrthographicLens import getCoordinateSystem [as 别名]
#.........这里部分代码省略.........
""" Assigns this source a position in the shadow atlas. This is called
by the shadow atlas. Coordinates are float from 0 .. 1 """
self.atlasPos = Vec2(x, y)
self.doesHaveAtlasPos = True
def update(self):
""" Updates the shadow source. Currently only recomputes the mvp. """
self.mvp = self.computeMVP()
self.onPropertyChanged()
def getAtlasPos(self):
""" Returns the assigned atlas pos, if present. Coordinates are float
from 0 .. 1 """
return self.atlasPos
def hasAtlasPos(self):
""" Returns wheter this ShadowSource has already a position in the
shadow atlas """
return self.doesHaveAtlasPos
def removeFromAtlas(self):
""" Deletes the atlas coordinates, called by the atlas after the
Source got removed from the atlas """
self.doesHaveAtlasPos = False
self.atlasPos = Vec2(0)
def setResolution(self, resolution):
""" Sets the resolution in pixels of this shadow source. Has to be
a multiple of the tileSize specified in LightManager """
assert(resolution > 1 and resolution <= 8192)
self.resolution = resolution
def getResolution(self):
""" Returns the resolution of the shadow source in pixels """
return self.resolution
def setupPerspectiveLens(self, near=0.1, far=100.0, fov=(90, 90)):
""" Setups a PerspectiveLens with a given nearPlane, farPlane
and FoV. The FoV is a tuple in the format
(Horizontal FoV, Vertical FoV) """
# self.debug("setupPerspectiveLens(",near,",",far,",",fov,")")
self.lens = PerspectiveLens()
self.lens.setNearFar(near, far)
self.lens.setFov(fov[0], fov[1])
self.camera.setLens(self.lens)
self.nearPlane = near
self.farPlane = far
self.rebuildMatrixCache()
def setupOrtographicLens(self, near=0.1, far=100.0, filmSize=(512, 512)):
""" Setups a OrtographicLens with a given nearPlane, farPlane
and filmSize. The filmSize is a tuple in the format
(filmWidth, filmHeight) in world space. """
# self.debug("setupOrtographicLens(",near,",",far,",",filmSize,")")
self.lens = OrthographicLens()
self.lens.setNearFar(near, far)
self.lens.setFilmSize(*filmSize)
self.camera.setLens(self.lens)
self.nearPlane = near
self.farPlane = far
self.rebuildMatrixCache()
def rebuildMatrixCache(self):
""" Computes values frequently used to compute the mvp """
self.converterYUR = Mat4.convertMat(CSYupRight, self.lens.getCoordinateSystem()) * self.lens.getProjectionMat()
def setPos(self, pos):
""" Sets the position in world space """
self.cameraNode.setPos(pos)
def setHpr(self, hpr):
""" Sets the rotation in world space """
self.cameraNode.setHpr(hpr)
def lookAt(self, pos):
""" Looks at a point (in world space) """
self.cameraNode.lookAt(pos.x, pos.y, pos.z)
def invalidate(self):
""" Invalidates this shadow source, means telling the LightManager
that the shadow map for this light should be rebuilt. Otherwise it
won't get refreshed """
self.valid = False
def setValid(self):
""" The LightManager calls this after the shadow map got updated
successfully """
self.valid = True
def isValid(self):
""" Returns wether the shadow map is still valid or should
be refreshed """
return self.valid
def __repr__(self):
""" Returns a representative string of this instance """
return "ShadowSource[id=" + str(self.index) + "]"
def onUpdated(self):
""" Gets called when shadow sources was updated """