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


Python WindowProperties.size方法代码示例

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


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

示例1: test_winprops_size_staticmethod

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
def test_winprops_size_staticmethod():
    props = WindowProperties.size(1, 2)
    assert props.has_size()
    assert props.get_size() == (1, 2)

    props = WindowProperties.size((1, 2))
    assert props.has_size()
    assert props.get_size() == (1, 2)
开发者ID:Moteesh,项目名称:panda3d,代码行数:10,代码来源:test_winprops.py

示例2: createBuffer

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
    def createBuffer(self, name, xsize, ysize, colortex, cmode, auxtex):

        winprops = WindowProperties.size(xsize, ysize)
        props = FrameBufferProperties()
        props.setColorBits(48)
        props.setRgbColor(0)

        if auxtex:
            props.setAuxHrgba(1)

        buffer = base.graphicsEngine.makeOutput(
            base.win.getPipe(), name, 1,
            props, winprops, GraphicsPipe.BFRefuseWindow,
            base.win.getGsg(), base.win)

        if (buffer == None):
            return buffer

        buffer.addRenderTexture(colortex, cmode, GraphicsOutput.RTPColor)

        if auxtex:
            buffer.addRenderTexture(auxtex, cmode, GraphicsOutput.RTPAuxHrgba0)

        buffer.setSort(-1)
        buffer.disableClears()
        buffer.getDisplayRegion(0).disableClears()
        return buffer
开发者ID:croxis,项目名称:Panda-Core-Technology,代码行数:29,代码来源:AtmosphericScattering.py

示例3: _make_properties

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
    def _make_properties(self):
        """ Creates the window and buffer properties """
        window_props = WindowProperties.size(self._size.x, self._size.y)
        buffer_props = FrameBufferProperties()

        if self._size_constraint.x == 0 or self._size_constraint.y == 0:
            window_props = WindowProperties.size(1, 1)

        if self._color_bits == (16, 16, 16, 0):
            if RenderTarget.USE_R11G11B10:
                buffer_props.set_rgba_bits(11, 11, 10, 0)
            else:
                buffer_props.set_rgba_bits(*self._color_bits)
        elif 8 in self._color_bits:
            # When specifying 8 bits, specify 1 bit, this is a workarround
            # to a legacy logic in panda
            buffer_props.set_rgba_bits(*[i if i != 8 else 1 for i in self._color_bits])
        else:
            buffer_props.set_rgba_bits(*self._color_bits)

        buffer_props.set_accum_bits(0)
        buffer_props.set_stencil_bits(0)
        buffer_props.set_back_buffers(0)
        buffer_props.set_coverage_samples(0)
        buffer_props.set_depth_bits(self._depth_bits)

        if self._depth_bits == 32:
            buffer_props.set_float_depth(True)

        buffer_props.set_float_color(max(self._color_bits) > 8)

        buffer_props.set_force_hardware(True)
        buffer_props.set_multisamples(0)
        buffer_props.set_srgb_color(False)
        buffer_props.set_stereo(False)
        buffer_props.set_stencil_bits(0)

        if self._aux_bits == 8:
            buffer_props.set_aux_rgba(self._aux_count)
        elif self._aux_bits == 16:
            buffer_props.set_aux_hrgba(self._aux_count)
        elif self._aux_bits == 32:
            buffer_props.set_aux_float(self._aux_count)
        else:
            self.error("Invalid aux bits")

        return window_props, buffer_props
开发者ID:jakogut,项目名称:RenderPipeline,代码行数:49,代码来源:render_target.py

示例4: test_winprops_size_property

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
def test_winprops_size_property():
    props = WindowProperties()

    # Test get
    props.set_size(1, 2)
    assert props.size == (1, 2)

    # Test has
    props.clear_size()
    assert props.size is None

    # Test set
    props.size = (4, 5)
    assert props.get_size() == (4, 5)

    # Test clear
    props.size = None
    assert not props.has_size()
开发者ID:Moteesh,项目名称:panda3d,代码行数:20,代码来源:test_winprops.py

示例5: init_wp

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
    def init_wp(window_type, size):
        """Initial / default WindowProperties.

        Args:
            window_type (str): Window type.
            size (Iterable, 2): Width, height.

        Return:
            (WindowProperties): WindowProperties object.

        """
        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
开发者ID:jhamrick,项目名称:scenesim,代码行数:19,代码来源:lightbase.py

示例6: gsg

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
def gsg(graphics_pipe, graphics_engine):
    "Returns a windowless GSG that can be used for offscreen rendering."
    from panda3d.core import GraphicsPipe, FrameBufferProperties, WindowProperties

    fbprops = FrameBufferProperties()
    fbprops.force_hardware = True

    buffer = graphics_engine.make_output(
        graphics_pipe,
        'buffer',
        0,
        fbprops,
        WindowProperties.size(32, 32),
        GraphicsPipe.BF_refuse_window
    )
    graphics_engine.open_windows()

    assert buffer is not None
    yield buffer.gsg

    if buffer is not None:
        graphics_engine.remove_window(buffer)
开发者ID:nirai-compiler,项目名称:panda3d,代码行数:24,代码来源:conftest.py

示例7: _handle_window_event

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
    def _handle_window_event(self, event):
        """ Checks for window events. This mainly handles incoming resizes,
        and calls the required handlers """
        self._showbase.windowEvent(event)
        window_dims = LVecBase2i(self._showbase.win.get_x_size(), self._showbase.win.get_y_size())
        if window_dims != self._last_window_dims and window_dims != Globals.native_resolution:
            self._last_window_dims = LVecBase2i(window_dims)

            # Ensure the dimensions are a multiple of 4, and if not, correct it
            if window_dims.x % 4 != 0 or window_dims.y % 4 != 0:
                self.debug("Correcting non-multiple of 4 window size:", window_dims)
                window_dims.x = window_dims.x - window_dims.x % 4
                window_dims.y = window_dims.y - window_dims.y % 4
                props = WindowProperties.size(window_dims.x, window_dims.y)
                self._showbase.win.request_properties(props)

            self.debug("Resizing to", window_dims.x, "x", window_dims.y)
            Globals.native_resolution = window_dims
            self._compute_render_resolution()
            self.light_mgr.compute_tile_size()
            self.stage_mgr.handle_window_resize()
            self.debugger.handle_window_resize()
开发者ID:ELMERzark,项目名称:RenderPipeline,代码行数:24,代码来源:render_pipeline.py

示例8: _make_properties

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
    def _make_properties(self):
        """ Creates the window and buffer properties """
        window_props = WindowProperties.size(self._size.x, self._size.y)
        buffer_props = FrameBufferProperties()

        if self._color_bits == (16, 16, 16, 0):
            if RenderTarget.USE_R11G11B10:
                buffer_props.set_rgba_bits(11, 11, 10, 0)
            else:
                buffer_props.set_rgba_bits(*self._color_bits)
        else:
            buffer_props.set_rgba_bits(*self._color_bits)

        buffer_props.set_accum_bits(0)
        buffer_props.set_stencil_bits(0)
        buffer_props.set_back_buffers(0)
        buffer_props.set_coverage_samples(0)
        buffer_props.set_depth_bits(self._depth_bits)

        if self._depth_bits:
            buffer_props.set_float_depth(True)
        buffer_props.set_float_color(max(self._color_bits) > 8)
        buffer_props.set_force_hardware(True)
        buffer_props.set_multisamples(0)
        buffer_props.set_srgb_color(False)
        buffer_props.set_stereo(False)
        buffer_props.set_stencil_bits(0)

        if self._aux_bits == 8:
            buffer_props.set_aux_rgba(self._aux_count)
        elif self._aux_bits == 16:
            buffer_props.set_aux_hrgba(self._aux_count)
        elif self._aux_bits == 32:
            buffer_props.set_aux_float(self._aux_count)
        else:
            self.error("Invalid aux bits")

        return window_props, buffer_props
开发者ID:aimoonchen,项目名称:RenderPipeline,代码行数:40,代码来源:render_target.py

示例9: create

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
    def create(self):
        """ Attempts to create this buffer """

        colorIsFloat = self._colorBits >= 16
        auxIsFloat = self._auxBits >= 16

        self.debug("Bitcount: color=" +str(self._colorBits) + "; aux="+str(self._auxBits) + "; depth=" + str(self._depthBits))


        # set wrap modes for color + auxtextures,
        # also set correct formats:
        # panda doesnt use sized formats automatically, this
        # gives problems when using imageLoad / imageStore
        prepare = [
            RenderTargetType.Color,
            RenderTargetType.Aux0,
            RenderTargetType.Aux1,
            RenderTargetType.Aux2,
            RenderTargetType.Aux3,
        ]

        for target in prepare:
            if not self.hasTarget(target):
                continue
            handle = self.getTarget(target)
            handle.setWrapU(Texture.WMClamp)
            handle.setWrapV(Texture.WMClamp)
            handle.setWrapW(Texture.WMClamp)
            handle.setMinfilter(Texture.FTLinear)
            handle.setMagfilter(Texture.FTLinear)
            handle.setAnisotropicDegree(0)

            if target == RenderTargetType.Color:
                if colorIsFloat:
                    handle.setComponentType(Texture.TFloat)

                if self._colorBits == 16:
                    handle.setFormat(Texture.FRgba16)
                elif self._colorBits == 32:
                    handle.setFormat(Texture.FRgba32)
            else:
                if auxIsFloat:
                    handle.setComponentType(Texture.TFloat)
                if self._auxBits == 16:
                    handle.setFormat(Texture.FRgba16)
                elif self._auxBits == 32:
                    handle.setFormat(Texture.FRgba32)

            if self._layers > 1:
                # handle.setup2dTextureArray(self._layers)
                handle.setup3dTexture(self._layers)

        # set layers for depth texture
        if self._layers > 1 and self.hasTarget(RenderTargetType.Depth):
            # self.getTarget(RenderTargetType.Depth).setup2dTextureArray(
                # self._layers)
            self.getTarget(RenderTargetType.Depth).setup3dTexture(
                self._layers)

        # Create buffer descriptors
        windowProps = WindowProperties.size(self._width, self._height)
        bufferProps = FrameBufferProperties()


        # Set color and alpha bits
        if self.hasTarget(RenderTargetType.Color):
            bufferProps.setColorBits(self._colorBits * 3)
            bufferProps.setAlphaBits(self._colorBits)

            if colorIsFloat:
                bufferProps.setFloatColor(True)

        # Set aux bits
        if self.hasTarget(RenderTargetType.Aux0) and auxIsFloat:

            # FRAMEBUFFER INCOMPLETE when using this to render to a 3d texture
            # bufferProps.setAuxFloat(True)

            pass

        # Set depth bits and depth texture format
        if self.hasTarget(RenderTargetType.Depth):
            depthTarget = self.getTarget(RenderTargetType.Depth)

            bufferProps.setDepthBits(self._depthBits)
            bufferProps.setFloatDepth(True)

        # We need no stencil (not supported yet)
        bufferProps.setStencilBits(0)

        numAuxtex = 0

        # Python really needs switch()
        if self.hasTarget(RenderTargetType.Aux3):
            numAuxtex = 4
        elif self.hasTarget(RenderTargetType.Aux2):
            numAuxtex = 3
        elif self.hasTarget(RenderTargetType.Aux1):
            numAuxtex = 2
        elif self.hasTarget(RenderTargetType.Aux0):
#.........这里部分代码省略.........
开发者ID:Happy-Ferret,项目名称:RenderPipeline,代码行数:103,代码来源:RenderBuffer.py

示例10: _create

# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import size [as 别名]
    def _create(self):
        """ Attempts to create this buffer """

        # if len(self._targets.keys()) < 1:
            # print "WARNING:", self._debug_name, "has no attachments!"

        colorIsFloat = self._colorBits >= 16
        auxIsFloat = self._auxBits >= 16

        self.debug("Bitcount: color=" + str(self._colorBits) +
                   "; aux=" + str(self._auxBits) + "; depth=" + str(self._depthBits))

        # set wrap modes for color + auxtextures,
        # also set correct formats:
        # panda doesnt use sized formats automatically, this
        # gives problems when using imageLoad / imageStore
        prepare = [
            RenderTargetType.Color,
            RenderTargetType.Aux0,
            RenderTargetType.Aux1,
            RenderTargetType.Aux2,
            RenderTargetType.Aux3,
        ]

        for target in prepare:
            if not self.hasTarget(target):
                continue
            handle = self.getTarget(target)
            handle.setWrapU(Texture.WMClamp)
            handle.setWrapV(Texture.WMClamp)
            handle.setWrapW(Texture.WMClamp)
            handle.setMinfilter(Texture.FTLinear)
            handle.setMagfilter(Texture.FTLinear)
            handle.setAnisotropicDegree(0)

            handle.setXSize(self._width)
            handle.setYSize(self._height)

            if target == RenderTargetType.Color:
                if colorIsFloat:
                    handle.setComponentType(Texture.TFloat)

                if self._colorBits == 8:
                    if self._haveColorAlpha:
                        handle.setFormat(Texture.FRgba8)
                    else:
                        handle.setFormat(Texture.FRgb8)

                elif self._colorBits == 16:
                    if self._haveColorAlpha:
                        handle.setFormat(Texture.FRgba16)
                    else:
                        handle.setFormat(Texture.FRgb16)

                elif self._colorBits == 32:
                    if self._haveColorAlpha:
                        handle.setFormat(Texture.FRgba32)
                    else:
                        handle.setFormat(Texture.FRgb32)
            else:
                if auxIsFloat:
                    handle.setComponentType(Texture.TFloat)

                if self._auxBits == 8:
                    handle.setFormat(Texture.FRgba8)
                elif self._auxBits == 16:
                    handle.setFormat(Texture.FRgba16)
                elif self._auxBits == 32:
                    handle.setFormat(Texture.FRgba32)

            if self._layers > 1:
                if self._useTextureArrays:
                    handle.setup2dTextureArray(self._layers)
                else:
                    handle.setup3dTexture(self._layers)

        # set layers for depth texture
        if self._layers > 1 and self.hasTarget(RenderTargetType.Depth):
            if self._useTextureArrays:
                self.getTarget(RenderTargetType.Depth).setup2dTextureArray(
                    self._layers)
            else:
                self.getTarget(RenderTargetType.Depth).setup3dTexture(
                    self._layers)


        # Create buffer descriptors
        windowProps = WindowProperties.size(self._width, self._height)
        bufferProps = FrameBufferProperties()

        # Set color and alpha bits
        if self.hasTarget(RenderTargetType.Color):
            bufferProps.setRgbaBits(self._colorBits, self._colorBits, self._colorBits, self._colorBits if self._haveColorAlpha else 0)
            if colorIsFloat:
                bufferProps.setFloatColor(True)


        # Set aux bits
        if self.hasTarget(RenderTargetType.Aux0) and auxIsFloat:
            # FRAMEBUFFER INCOMPLETE when using this to render to a 3d texture
#.........这里部分代码省略.........
开发者ID:cesarmarinhorj,项目名称:RenderPipeline,代码行数:103,代码来源:RenderTarget.py


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