當前位置: 首頁>>代碼示例>>Python>>正文


Python PointLight.setShadowCaster方法代碼示例

本文整理匯總了Python中panda3d.core.PointLight.setShadowCaster方法的典型用法代碼示例。如果您正苦於以下問題:Python PointLight.setShadowCaster方法的具體用法?Python PointLight.setShadowCaster怎麽用?Python PointLight.setShadowCaster使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在panda3d.core.PointLight的用法示例。


在下文中一共展示了PointLight.setShadowCaster方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: buildSubType

# 需要導入模塊: from panda3d.core import PointLight [as 別名]
# 或者: from panda3d.core.PointLight import setShadowCaster [as 別名]
    def buildSubType(self):
        """Build the light with the given subType"""

        if self.subType == "pointType":
            # make a point light
            c = self.color
            pointLight = PointLight(self.name)
            pointLight.setColor(VBase4(c[0], c[1], c[2], c[3]))
            pointLight.setShadowCaster(True, 512, 512)
            plnp = self.renderObjectsLight.attachNewNode(pointLight)
            plnp.setPos(self.position)
            self.lightNP = plnp
            self.setLightSwitch(True)

        if self.subType == "directType":
            # make a directional light
            c = self.color
            directLight = DirectionalLight(self.name)
            directLight.setColor(VBase4(c[0], c[1], c[2], c[3]))
            directLight.setShadowCaster(True, 512, 512)
            dlnp = self.renderObjectsLight.attachNewNode(directLight)
            #dlnp.setHpr(0, -60, 0) # no idea why its like that.. but it works
            self.lightNP = dlnp
            self.setLightSwitch(True)


        if self.subType == "ambientType":
            # make a ambient light
            c = self.color
            ambientLight = AmbientLight(self.name)
            ambientLight.setColor(VBase4(c[0], c[1],c[2], c[3]))
            alnp = self.renderObjectsLight.attachNewNode(ambientLight)
            self.lightNP = alnp
            self.setLightSwitch(True)

        if self.subType == "spotType":
            # make a spot light
            # lookAtObj = _object.getTag("lookAt") get rid of this.
            c = self.color
            spotLight = Spotlight(self.name)
            spotLight.setColor(VBase4(c[0], c[1], c[2], c[3]))
            spotLight.setShadowCaster(True, 512, 512)
            lens = PerspectiveLens()
            spotLight.setLens(lens)
            slnp = self.renderObjectsLight.attachNewNode(spotLight)
            slnp.setPos(self.position)
            slnp.setHpr(self.hpr)
            # Find out if this is really the only option
            # because setHpr doesnt seem to have any effect.
            # lookAt would be okay but that means adding anothe type
            #slnp.lookAt(self.main.GameObjects["player"].collisionBody)
            self.lightNP = slnp
            self.setLightSwitch(True)
開發者ID:grimfang,項目名稱:quickShadows,代碼行數:55,代碼來源:baseObject.py

示例2: __create_point_light

# 需要導入模塊: from panda3d.core import PointLight [as 別名]
# 或者: from panda3d.core.PointLight import setShadowCaster [as 別名]
    def __create_point_light(self,
                             lightId,
                             lightColor,
                             lightPos,
                             shadow = True):

        pointLight = PointLight(lightId)
        pointLight.setColor(lightColor)
        pointLight.setShadowCaster(shadow)

        pointLightNP = NodePath(pointLight)

        pointLightNP.setPos(lightPos)

        return pointLightNP
開發者ID:ShengCN,項目名稱:SeriousCode,代碼行數:17,代碼來源:light_controller.py


注:本文中的panda3d.core.PointLight.setShadowCaster方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。