DrawableRegion¶
from panda3d.core import DrawableRegion
-
class
DrawableRegion
¶ This is a base class for
GraphicsWindow
(actually,GraphicsOutput
) andDisplayRegion
, both of which are conceptually rectangular regions into which drawing commands may be issued. Sometimes you want to deal with a single display region, and sometimes you want to deal with the whole window at once, particularly for issuing clear commands and capturing screenshots.Inheritance diagram
-
enum
RenderTexturePlane
¶ It seems awkward to have this type, and also RenderBuffer::Type. However, the fact that RenderBuffer::Type is a bitmask makes it awfully awkward to work with.
-
enumerator
RTP_stencil
= 0¶
-
enumerator
RTP_depth_stencil
= 1¶
-
enumerator
RTP_color
= 2¶
-
enumerator
RTP_aux_rgba_0
= 3¶
-
enumerator
RTP_aux_rgba_1
= 4¶
-
enumerator
RTP_aux_rgba_2
= 5¶
-
enumerator
RTP_aux_rgba_3
= 6¶
-
enumerator
RTP_aux_hrgba_0
= 7¶
-
enumerator
RTP_aux_hrgba_1
= 8¶
-
enumerator
RTP_aux_hrgba_2
= 9¶
-
enumerator
RTP_aux_hrgba_3
= 10¶
-
enumerator
RTP_aux_float_0
= 11¶
-
enumerator
RTP_aux_float_1
= 12¶
-
enumerator
RTP_aux_float_2
= 13¶
-
enumerator
RTP_aux_float_3
= 14¶
-
enumerator
RTP_depth
= 15¶
-
enumerator
RTP_COUNT
= 16¶
-
enumerator
-
property
clear_color
→ LColor¶ - Getter
Returns the current clear color value. This is the value that will be used to clear the color buffer every frame, but only if
getClearColorActive()
returns true. IfgetClearColorActive()
returns false, this is meaningless.- Setter
Sets the clear color to the indicated value. This is the value that will be used to clear the color buffer every frame, but only if
getClearColorActive()
returns true. IfgetClearColorActive()
returns false, this is meaningless.
-
property
clear_depth
→ float¶ - Getter
Returns the current clear depth value. This is the value that will be used to clear the depth buffer every frame, but only if
getClearDepthActive()
returns true. IfgetClearDepthActive()
returns false, this is meaningless.- Setter
Sets the clear depth to the indicated value. This is the value that will be used to clear the depth buffer every frame, but only if
getClearDepthActive()
returns true. IfgetClearDepthActive()
returns false, this is meaningless.
-
property
clear_stencil
→ int¶ - Getter
Returns the current clear stencil value. This is the value that will be used to clear the stencil buffer every frame, but only if
getClearStencilActive()
returns true. IfgetClearStencilActive()
returns false, this is meaningless.- Setter
Sets the clear stencil to the indicated value. This is the value that will be used to clear the stencil buffer every frame, but only if
getClearColorActive()
returns true. IfgetClearStencilActive()
returns false, this is meaningless.
-
disableClears
() → None¶ Disables both the color and depth clear. See
setClearColorActive()
andsetClearDepthActive()
.
-
getClearColor
() → LColor¶ Returns the current clear color value. This is the value that will be used to clear the color buffer every frame, but only if
getClearColorActive()
returns true. IfgetClearColorActive()
returns false, this is meaningless.
-
getClearColorActive
() → bool¶ Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. See
setClearColorActive()
.
-
getClearDepth
() → float¶ Returns the current clear depth value. This is the value that will be used to clear the depth buffer every frame, but only if
getClearDepthActive()
returns true. IfgetClearDepthActive()
returns false, this is meaningless.
-
getClearDepthActive
() → bool¶ Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame. See
setClearDepthActive()
.
-
getClearStencil
() → int¶ Returns the current clear stencil value. This is the value that will be used to clear the stencil buffer every frame, but only if
getClearStencilActive()
returns true. IfgetClearStencilActive()
returns false, this is meaningless.
-
getClearStencilActive
() → bool¶ Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. See
setClearStencilActive()
.
-
getPixelFactor
() → float¶ Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by
setPixelZoom()
. This will return 1.0 if the pixel_zoom was not set or if it is not being respected (for instance, because the underlying renderer doesn’t support it –seesupportsPixelZoom()
).
-
getPixelZoom
() → float¶ Returns the value set by
setPixelZoom()
, regardless of whether it is being respected or not. Also seegetPixelFactor()
.
-
static
getRenderbufferType
(plane: int) → int¶ Returns the RenderBuffer::Type that corresponds to a
DrawableRegionRenderTexturePlane
.
-
isAnyClearActive
() → bool¶ Returns true if any of the clear types (so far there are just color or depth) have been set active, or false if none of them are active and there is no need to clear.
-
property
pixel_factor
→ float¶ Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by
setPixelZoom()
. This will return 1.0 if the pixel_zoom was not set or if it is not being respected (for instance, because the underlying renderer doesn’t support it –seesupportsPixelZoom()
).
-
property
pixel_zoom
→ float¶ - Getter
Returns the value set by
setPixelZoom()
, regardless of whether it is being respected or not. Also seegetPixelFactor()
.- Setter
Sets the amount by which the pixels of the region are scaled internally when filling the image interally. Setting this number larger makes the pixels blockier, but may make the rendering faster, particularly for software renderers. Setting this number to 2.0 reduces the number of pixels that have to be filled by the renderer by a factor of 2.0. It doesn’t make sense to set this lower than 1.0.
It is possible to set this on either individual
DisplayRegions
or on overallGraphicsWindows
, but you will get better performance for setting it on the window rather than its individualDisplayRegions
. Also, you may not set it on aDisplayRegion
that doesn’t have both clear_color() and clear_depth() enabled.This property is only supported on renderers for which it is particularly useful–currently, this is the tinydisplay software renderer. Other kinds of renderers allow you to set this property, but ignore it.
-
setClearColor
(color: LColor) → None¶ Sets the clear color to the indicated value. This is the value that will be used to clear the color buffer every frame, but only if
getClearColorActive()
returns true. IfgetClearColorActive()
returns false, this is meaningless.
-
setClearColorActive
(clear_color_active: bool) → None¶ Toggles the flag that indicates whether the color buffer should be cleared every frame. If this is true, the color buffer will be cleared to the color indicated by
setClearColor()
; otherwise, it will be left alone.
-
setClearDepth
(depth: float) → None¶ Sets the clear depth to the indicated value. This is the value that will be used to clear the depth buffer every frame, but only if
getClearDepthActive()
returns true. IfgetClearDepthActive()
returns false, this is meaningless.
-
setClearDepthActive
(clear_depth_active: bool) → None¶ Toggles the flag that indicates whether the depth buffer should be cleared every frame. If this is true, the depth buffer will be cleared to the depth value indicated by
setClearDepth()
; otherwise, it will be left alone.
-
setClearStencilActive
(clear_stencil_active: bool) → None¶ Toggles the flag that indicates whether the stencil buffer should be cleared every frame. If this is true, the stencil buffer will be cleared to the value indicated by
setClearStencil()
; otherwise, it will be left alone.
-
setPixelZoom
(pixel_zoom: float) → None¶ Sets the amount by which the pixels of the region are scaled internally when filling the image interally. Setting this number larger makes the pixels blockier, but may make the rendering faster, particularly for software renderers. Setting this number to 2.0 reduces the number of pixels that have to be filled by the renderer by a factor of 2.0. It doesn’t make sense to set this lower than 1.0.
It is possible to set this on either individual
DisplayRegions
or on overallGraphicsWindows
, but you will get better performance for setting it on the window rather than its individualDisplayRegions
. Also, you may not set it on aDisplayRegion
that doesn’t have both clear_color() and clear_depth() enabled.This property is only supported on renderers for which it is particularly useful–currently, this is the tinydisplay software renderer. Other kinds of renderers allow you to set this property, but ignore it.
-
supportsPixelZoom
() → bool¶ Returns true if a call to
setPixelZoom()
will be respected, false if it will be ignored. If this returns false, thengetPixelFactor()
will always return 1.0, regardless of what value you specify forsetPixelZoom()
.This may return false if the underlying renderer doesn’t support pixel zooming, or if you have called this on a
DisplayRegion
that doesn’t have bothsetClearColor()
andsetClearDepth()
enabled.
-
enum