当前位置: 首页>>代码示例>>Python>>正文


Python OrthographicLens.getProjectionMat方法代码示例

本文整理汇总了Python中panda3d.core.OrthographicLens.getProjectionMat方法的典型用法代码示例。如果您正苦于以下问题:Python OrthographicLens.getProjectionMat方法的具体用法?Python OrthographicLens.getProjectionMat怎么用?Python OrthographicLens.getProjectionMat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panda3d.core.OrthographicLens的用法示例。


在下文中一共展示了OrthographicLens.getProjectionMat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ShadowSource

# 需要导入模块: from panda3d.core import OrthographicLens [as 别名]
# 或者: from panda3d.core.OrthographicLens import getProjectionMat [as 别名]

#.........这里部分代码省略.........
        return self.atlasPos

    def hasAtlasPos(self):
        """ Returns Whether this ShadowSource has already a position in the
        shadow atlas, or is currently unassigned """
        return self.doesHaveAtlasPos

    def removeFromAtlas(self):
        """ Deletes the atlas coordinates, this gets 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 near plane, far plane
        and FoV. The FoV is a tuple in the format (Horizontal FoV, Vertical 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 setLens(self, lens):
        """ Setups the ShadowSource to use an external lens """
        self.lens = lens
        self.camera.setLens(self.lens)
        self.nearPlane = lens.getNear()
        self.farPlane = lens.getFar()
        self.nearPlane = 0.5
        self.farPlane = 50.0
        self.rebuildMatrixCache()

    def setupOrtographicLens(self, near=0.1, far=100.0, filmSize=(512, 512)):
        """ Setups a OrtographicLens with a given near plane, far plane
        and film size. The film size is a tuple in the format (filmWidth, filmHeight)
        in world space. """
        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):
        """ Internal method to precompute a part of the MVP to improve performance"""
        self.converterYUR = self.lens.getProjectionMat()

    def setPos(self, pos):
        """ Sets the position of the source in world space """
        self.cameraNode.setPos(pos)

    def getPos(self):
        """ Returns the position of the source in world space """
        return self.cameraNode.getPos()

    def setHpr(self, hpr):
        """ Sets the rotation of the source 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 __hash__(self):
        return self.index

    def onUpdated(self):
        """ Gets called when shadow source was updated """
开发者ID:cesarmarinhorj,项目名称:RenderPipeline,代码行数:104,代码来源:ShadowSource.py


注:本文中的panda3d.core.OrthographicLens.getProjectionMat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。