本文整理汇总了Python中pandac.PandaModules.WindowProperties.size方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.size方法的具体用法?Python WindowProperties.size怎么用?Python WindowProperties.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.WindowProperties
的用法示例。
在下文中一共展示了WindowProperties.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeTextureBuffer
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import size [as 别名]
def makeTextureBuffer(name, xSize, ySize, tex = None, toRam = False, fbp = None):
"""Copied from graphicsOutput.cxx and pythonified."""
if fbp == None:
fbp = FrameBufferProperties()
fbp.setRgbColor(1)
fbp.setDepthBits(1)
flags = GraphicsPipe.BFRefuseWindow;
if hasattr(GraphicsPipe, "BFSizePower2") and Texture.getTexturesPower2() != ATSNone:
flags |= GraphicsPipe.BFSizePower2
if tex != None and tex.getTextureType() == Texture.TTCubeMap:
flags |= GraphicsPipe.BFSizeSquare
buffer = WindowManager.gsg.getEngine().makeOutput(base.pipe, name, 0,
fbp, WindowProperties.size(xSize, ySize), flags, WindowManager.gsg)
if WindowManager.gsg == None:
WindowManager.gsg = buffer.getGsg()
if buffer != None:
if toRam:
buffer.addRenderTexture(tex, RTMCopyRam);
else:
buffer.addRenderTexture(tex, RTMBindOrCopy);
return buffer
return None
示例2: init_wp
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import size [as 别名]
def init_wp(window_type, size):
""" Initial / default WindowProperties """
if window_type == 'onscreen':
wp = WindowProperties.getDefault()
wp.setSize(size[0], size[1])
elif window_type == 'offscreen':
wp = WindowProperties.size(size[0], size[1])
return wp
示例3: createOffscreenBuffer
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import size [as 别名]
def createOffscreenBuffer(sort):
winprops = WindowProperties.size(SIZE, SIZE)
props = FrameBufferProperties()
props.setRgbColor(1)
props.setAlphaBits(1)
props.setDepthBits(1)
return base.graphicsEngine.makeOutput(
base.pipe, "offscreenBuffer", sort, props, winprops, GraphicsPipe.BFRefuseWindow, base.win.getGsg(), base.win
)
示例4: __init__
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import size [as 别名]
def __init__(self, _base):
self._base = _base
self._base.cam.node().setActive(0)
# window properties
self.winprops = WindowProperties.size(base.win.getXSize(),base.win.getYSize())
self.props = FrameBufferProperties()
self.props.setDepthBits(1)
self.props.setColorBits(1)
self.props.setAlphaBits(1)
# buffers creation
self.geom_buffer = self.make_FBO("geom buffer",3)
self.light_buffer = self.make_FBO("light buffer",0)
self.transparency_buffer = self.make_FBO("transparency buffer",0)
# cameras creation
self.geom_cam = self._base.makeCamera(self.geom_buffer)
self.light_cam = self._base.makeCamera(self.light_buffer)
self.transparency_cam = self._base.makeCamera(self.transparency_buffer)
# cameras setup
self.geom_cam.node().getDisplayRegion(0).setClearColorActive(1)
self.geom_cam.node().getDisplayRegion(0).setClearColor(Vec4(1,0,0,1))
self.geom_cam.node().getDisplayRegion(0).setClearDepthActive(1)
self.light_cam.node().getDisplayRegion(0).setClearColorActive(1)
self.geom_cam.node().getDisplayRegion(0).setClearColor(Vec4(0,1,0,1))
self.light_cam.node().getDisplayRegion(0).setClearDepthActive(1)
self.transparency_cam.node().getDisplayRegion(0).setClearColorActive(1)
self.transparency_cam.node().getDisplayRegion(0).setClearDepthActive(1)
self.geom_cam.node().getLens().setNear(0.1)
self.light_cam.node().getLens().setNear(0.1)
self.transparency_cam.node().getLens().setNear(0.1)
self.geom_cam.node().getLens().setFov(90)
self.light_cam.node().getLens().setFov(90)
self._base.cam.node().getLens().setFov(90)
self.transparency_cam.node().getLens().setFov(90)
# cameras masks
self.geom_mask = BitMask32(1)
self.light_mask = BitMask32(2)
self.transparency_mask = BitMask32(4)
self.light_cam.node().setCameraMask(self.light_mask)
self.geom_cam.node().setCameraMask(self.geom_mask)
self.transparency_cam.node().setCameraMask(self.transparency_mask)
RENDER_NODES['LIGHTS'].hide(self.geom_mask)
RENDER_NODES['GEOMS'].hide(self.light_mask)
RENDER_NODES['TRANSPS'].hide(self.geom_mask)
# link cameras
self.geom_cam.node().setScene(RENDER_NODES['GEOMS'])
self.light_cam.node().setScene(RENDER_NODES['LIGHTS'])
self.transparency_cam.node().setScene(RENDER_NODES['TRANSPS'])
# buffers rendering order
self.light_buffer.setSort(0)
self.geom_buffer.setSort(-50)
self.transparency_buffer.setSort(50)
self._base.win.setSort(-100)
# shadows cube creation
self.shadow_cube = RENDER_NODES['GEOMS'].attachNewNode("cubemap")
self.shadow_cube.setPos(0, 0, 0)
buffer_cube_shadow = self._base.win.makeCubeMap("cube 1", 512, self.shadow_cube, camera_mask = self.geom_mask, to_ram = False, fbp = self.props)
self.shadow_cube_texture = buffer_cube_shadow.getTexture()
cameras = []
for camera in self.shadow_cube.getChildren():
cameras.append(camera)
camera.node().getLens().setFov(90)
camera.node().getLens().setNearFar(0.1 ,10.0)
camera.node().setCameraMask(self.geom_mask)
cameraInit = NodePath(PandaNode("cube camera initiator"))
cameraInit.setShader(Shader.load('shaders/point_lights_cube.sha'))
cameraInit.setShaderInput("light2", self.shadow_cube)
cameraInit.setShaderInput("lightCamera", camera)
cameraInit.setShaderInput("lensFar", Vec4(camera.node().getLens().getFar()))
cameraInit.setShaderInput("transparency", Vec4(1))
camera.node().setInitialState(cameraInit.getState())
# reflections cube creation
self.reflection_cube = RENDER_NODES['GEOMS'].attachNewNode("cubemap pivot")
self.buffer_reflection_cube = self._base.win.makeCubeMap("cube 2", 512, self.reflection_cube, camera_mask = self.geom_mask, to_ram = False, fbp = self.props)
self.reflection_cube_texture = self.buffer_reflection_cube.getTexture()
for camera in self.reflection_cube.getChildren():
camera.node().getLens().setNearFar(0.1 ,500.0)
# shader rendering normal maps
normal_shader = ShaderAttrib.make()
normal_shader = normal_shader.setShader(Shader.load(CG_NORMALMAP))
#.........这里部分代码省略.........
示例5: setupShaderLighting
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import size [as 别名]
def setupShaderLighting(self):
loadPrcFileData("", "prefer-parasite-buffer #f")
# Preliminary capabilities check.
if (base.win.getGsg().getSupportsBasicShaders()==0):
print "[err] Video driver reports that shaders are not supported."
return
if (base.win.getGsg().getSupportsDepthTexture()==0):
print "[err] Video driver reports that depth textures are not supported."
return
# creating the offscreen buffer.
winprops = WindowProperties.size(2048,2048)
props = FrameBufferProperties()
props.setRgbColor(1)
props.setAlphaBits(1)
props.setDepthBits(1)
LBuffer = base.graphicsEngine.makeOutput(
base.pipe, "offscreen buffer", -2,
props, winprops,
GraphicsPipe.BFRefuseWindow,
base.win.getGsg(), base.win)
if (LBuffer == None):
print "[err] Video driver cannot create an offscreen buffer."
return
# Adding a color texture is totally unnecessary, but it helps with debugging.
Lcolormap = Texture()
LBuffer.addRenderTexture(Lcolormap, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPColor)
self.LCam = base.makeCamera(LBuffer)
self.LCam.reparentTo(render)
self.LCam.node().setScene(render)
self.LCam.node().getLens().setFov(30)
self.LCam.node().getLens().setNearFar(277, 305)
#self.LCam.node().getLens().setFilmSize(100, 100)
self.LCam.setPos(0, 0, 300)
self.LCam.setP(-90)
self.LCam.lookAt(0, 0, 0)
#self.createFrustumNode(self.LCam)
# default values
self.pushBias=0.50
self.ambient=0.20
self.cameraSelection = 0
self.lightSelection = 0
# Put a shader on the Main camera.
# Some video cards have special hardware for shadow maps.
# If the card has that, use it. If not, use a different
# shader that does not require hardware support.
mci = NodePath(PandaNode("Main Camera Initializer"))
if (base.win.getGsg().getSupportsShadowFilter()):
mci.setShader(Shader.load(self.datadir + 'shaders/shadow.sha'))
else:
print "[wrn] No shadow shader support found, using shadow-nosupport.sha"
mci.setShader(Shader.load(self.datadir + 'shaders/shadow-nosupport.sha'))
base.cam.node().setInitialState(mci.getState())
# setting up shader
render.setShaderInput('light',self.LCam)
render.setShaderInput('Ldepthmap',Lcolormap)
render.setShaderInput('ambient',self.ambient,0,0,1.0)
render.setShaderInput('texDisable',0,0,0,0)
render.setShaderInput('scale',1,1,1,1)
render.setShaderInput('push',0.20,0.20,0.20,0)
# Put a shader on the Light camera.
lci = NodePath(PandaNode("Light Camera Initializer"))
lci.setShader(Shader.load(self.datadir + 'shaders/caster.sha'))
self.LCam.node().setInitialState(lci.getState())
self.adjustPushBias(self.pushBias)