Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
DrawableRegion Class Reference

This is a base class for GraphicsWindow (actually, GraphicsOutput) and DisplayRegion, both of which are conceptually rectangular regions into which drawing commands may be issued. More...

Inheritance diagram for DrawableRegion:
DisplayRegion GraphicsOutput StereoDisplayRegion GraphicsBuffer GraphicsWindow ParasiteBuffer CallbackGraphicsWindow

Public Types

enum  RenderTexturePlane {
  RTP_stencil = 0, RTP_depth_stencil = 1, RTP_color = 2, RTP_aux_rgba_0 = 3,
  RTP_aux_rgba_1 = 4, RTP_aux_rgba_2 = 5, RTP_aux_rgba_3 = 6, RTP_aux_hrgba_0 = 7,
  RTP_aux_hrgba_1 = 8, RTP_aux_hrgba_2 = 9, RTP_aux_hrgba_3 = 10, RTP_aux_float_0 = 11,
  RTP_aux_float_1 = 12, RTP_aux_float_2 = 13, RTP_aux_float_3 = 14, RTP_depth = 15,
  RTP_COUNT = 16
}
 

Public Member Functions

 disableClears ()
 Disables both the color and depth clear. More...
 
bool getClearActive (int n)
 Gets the clear-active flag for any bitplane. More...
 
const LColor getClearColor ()
 Returns the current clear color value. More...
 
bool getClearColorActive ()
 Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. More...
 
float getClearDepth ()
 Returns the current clear depth value. More...
 
bool getClearDepthActive ()
 Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame. More...
 
unsigned int getClearStencil ()
 Returns the current clear stencil value. More...
 
bool getClearStencilActive ()
 Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. More...
 
const LColor getClearValue (int n)
 Returns the clear value for any bitplane. More...
 
float getPixelFactor ()
 Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by set_pixel_zoom(). More...
 
float getPixelZoom ()
 Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not. More...
 
bool isAnyClearActive ()
 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. More...
 
 setClearActive (int n, bool clear_aux_active)
 Sets the clear-active flag for any bitplane. More...
 
 setClearColor (const LColor color)
 Sets the clear color to the indicated value. More...
 
 setClearColorActive (bool clear_color_active)
 Toggles the flag that indicates whether the color buffer should be cleared every frame. More...
 
 setClearDepth (float depth)
 Sets the clear depth to the indicated value. More...
 
 setClearDepthActive (bool clear_depth_active)
 Toggles the flag that indicates whether the depth buffer should be cleared every frame. More...
 
 setClearStencil (unsigned int stencil)
 
 setClearStencilActive (bool clear_stencil_active)
 Toggles the flag that indicates whether the stencil buffer should be cleared every frame. More...
 
 setClearValue (int n, const LColor clear_value)
 Sets the clear value for any bitplane. More...
 
 setPixelZoom (float pixel_zoom)
 Sets the amount by which the pixels of the region are scaled internally when filling the image interally. More...
 
bool supportsPixelZoom ()
 Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored. More...
 

Static Public Member Functions

static int getRenderbufferType (int plane)
 Returns the RenderBuffer::Type that corresponds to a RenderTexturePlane. More...
 

Public Attributes

const LColor clear_color
 Returns the current clear color value. More...
 
float clear_depth
 Returns the current clear depth value. More...
 
unsigned int clear_stencil
 Returns the current clear stencil value. More...
 
float pixel_factor
 Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by set_pixel_zoom(). More...
 
float pixel_zoom
 Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not. More...
 

Detailed Description

This is a base class for GraphicsWindow (actually, GraphicsOutput) and DisplayRegion, 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.

Member Enumeration Documentation

◆ RenderTexturePlane

Enumerator
RTP_stencil 
RTP_depth_stencil 
RTP_color 
RTP_aux_rgba_0 
RTP_aux_rgba_1 
RTP_aux_rgba_2 
RTP_aux_rgba_3 
RTP_aux_hrgba_0 
RTP_aux_hrgba_1 
RTP_aux_hrgba_2 
RTP_aux_hrgba_3 
RTP_aux_float_0 
RTP_aux_float_1 
RTP_aux_float_2 
RTP_aux_float_3 
RTP_depth 
RTP_COUNT 

Member Function Documentation

◆ disableClears()

disableClears ( )

Disables both the color and depth clear.

See set_clear_color_active and set_clear_depth_active.

◆ getClearActive()

bool getClearActive ( int  n)

Gets the clear-active flag for any bitplane.

◆ getClearColor()

const LColor getClearColor ( )

Returns the current clear color value.

This is the value that will be used to clear the color buffer every frame, but only if get_clear_color_active() returns true. If get_clear_color_active() returns false, this is meaningless.

◆ getClearColorActive()

bool getClearColorActive ( )

Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame.

See set_clear_color_active().

◆ getClearDepth()

float getClearDepth ( )

Returns the current clear depth value.

This is the value that will be used to clear the depth buffer every frame, but only if get_clear_depth_active() returns true. If get_clear_depth_active() returns false, this is meaningless.

◆ getClearDepthActive()

bool getClearDepthActive ( )

Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame.

See set_clear_depth_active().

◆ getClearStencil()

unsigned int getClearStencil ( )

Returns the current clear stencil value.

This is the value that will be used to clear the stencil buffer every frame, but only if get_clear_stencil_active() returns true. If get_clear_stencil_active() returns false, this is meaningless.

◆ getClearStencilActive()

bool getClearStencilActive ( )

Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame.

See set_clear_stencil_active().

◆ getClearValue()

const LColor getClearValue ( int  n)

Returns the clear value for any bitplane.

◆ getPixelFactor()

float getPixelFactor ( )

Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by set_pixel_zoom().

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 –see supports_pixel_zoom).

◆ getPixelZoom()

float getPixelZoom ( )

Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not.

Also see get_pixel_factor().

◆ getRenderbufferType()

static int getRenderbufferType ( int  plane)
static

Returns the RenderBuffer::Type that corresponds to a RenderTexturePlane.

◆ isAnyClearActive()

bool isAnyClearActive ( )

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.

◆ setClearActive()

setClearActive ( int  n,
bool  clear_aux_active 
)

Sets the clear-active flag for any bitplane.

◆ setClearColor()

setClearColor ( const LColor  color)

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 get_clear_color_active() returns true. If get_clear_color_active() returns false, this is meaningless.

◆ setClearColorActive()

setClearColorActive ( bool  clear_color_active)

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 set_clear_color(); otherwise, it will be left alone.

◆ setClearDepth()

setClearDepth ( float  depth)

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 get_clear_depth_active() returns true. If get_clear_depth_active() returns false, this is meaningless.

◆ setClearDepthActive()

setClearDepthActive ( bool  clear_depth_active)

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 set_clear_depth(); otherwise, it will be left alone.

◆ setClearStencil()

setClearStencil ( unsigned int  stencil)

◆ setClearStencilActive()

setClearStencilActive ( bool  clear_stencil_active)

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 set_clear_stencil(); otherwise, it will be left alone.

◆ setClearValue()

setClearValue ( int  n,
const LColor  clear_value 
)

Sets the clear value for any bitplane.

◆ setPixelZoom()

setPixelZoom ( float  pixel_zoom)

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 overall GraphicsWindows, but you will get better performance for setting it on the window rather than its individual DisplayRegions. Also, you may not set it on a DisplayRegion 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 supportsPixelZoom ( )

Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored.

If this returns false, then get_pixel_factor() will always return 1.0, regardless of what value you specify for set_pixel_zoom().

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 both set_clear_color() and set_clear_depth() enabled.

Member Data Documentation

◆ clear_color

const LColor clear_color

Returns the current clear color value.

This is the value that will be used to clear the color buffer every frame, but only if get_clear_color_active() returns true. If get_clear_color_active() returns false, this is meaningless.

◆ clear_depth

float clear_depth

Returns the current clear depth value.

This is the value that will be used to clear the depth buffer every frame, but only if get_clear_depth_active() returns true. If get_clear_depth_active() returns false, this is meaningless.

◆ clear_stencil

unsigned int clear_stencil

Returns the current clear stencil value.

This is the value that will be used to clear the stencil buffer every frame, but only if get_clear_stencil_active() returns true. If get_clear_stencil_active() returns false, this is meaningless.

◆ pixel_factor

float pixel_factor

Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by set_pixel_zoom().

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 –see supports_pixel_zoom).

◆ pixel_zoom

float pixel_zoom

Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not.

Also see get_pixel_factor().