Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
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...

#include "drawableRegion.h"

Inheritance diagram for DrawableRegion:
DisplayRegion GraphicsOutput RocketRegion StereoDisplayRegion GraphicsBuffer GraphicsWindow ParasiteBuffer eglGraphicsBuffer eglGraphicsPixmap glxGraphicsBuffer glxGraphicsPixmap OsMesaGraphicsBuffer osxGraphicsBuffer TinyGraphicsBuffer wdxGraphicsBuffer8 wdxGraphicsBuffer9 wglGraphicsBuffer CallbackGraphicsWindow eglGraphicsWindow IPhoneGraphicsWindow osxGraphicsWindow WinGraphicsWindow x11GraphicsWindow

List of all members.

Public Types

enum  RenderTexturePlane {
  RTP_stencil = 0, RTP_depth_stencil = 1, 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
}

Public Member Functions

 DrawableRegion (const DrawableRegion &copy)
void copy_clear_settings (const DrawableRegion &copy)
 Copies only the clear settings from the other drawable region.
virtual void disable_clears ()
 Disables both the color and depth clear.
virtual bool get_clear_active (int n) const
 Gets the clear-active flag for any bitplane.
const LColorget_clear_color () const
 Returns the current clear color value.
bool get_clear_color_active () const
 Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame.
PN_stdfloat get_clear_depth () const
 Returns the current clear depth value.
bool get_clear_depth_active () const
 Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame.
unsigned int get_clear_stencil () const
 Returns the current clear stencil value.
bool get_clear_stencil_active () const
 Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame.
virtual const LColorget_clear_value (int n) const
 Returns the clear value for any bitplane.
int get_draw_buffer_type () const
 Returns the RenderBuffer into which the GSG should issue draw commands.
PN_stdfloat get_pixel_factor () const
 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().
PN_stdfloat get_pixel_zoom () const
 Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not.
int get_screenshot_buffer_type () const
 Returns the RenderBuffer that should be used for capturing screenshots from this particular DrawableRegion.
virtual bool is_any_clear_active () const
 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.
void operator= (const DrawableRegion &copy)
virtual void set_clear_active (int n, bool clear_aux_active)
 Sets the clear-active flag for any bitplane.
void set_clear_color (const LColor &color)
 Sets the clear color to the indicated value.
void set_clear_color_active (bool clear_color_active)
 Toggles the flag that indicates whether the color buffer should be cleared every frame.
void set_clear_depth (PN_stdfloat depth)
 Sets the clear depth to the indicated value.
void set_clear_depth_active (bool clear_depth_active)
 Toggles the flag that indicates whether the depth buffer should be cleared every frame.
void set_clear_stencil (unsigned int stencil)
 Sets the clear stencil to the indicated value.
void set_clear_stencil_active (bool clear_stencil_active)
 Toggles the flag that indicates whether the stencil buffer should be cleared every frame.
virtual void set_clear_value (int n, const LColor &clear_value)
 Sets the clear value for any bitplane.
virtual void set_pixel_zoom (PN_stdfloat pixel_zoom)
 Sets the amount by which the pixels of the region are scaled internally when filling the image interally.
virtual bool supports_pixel_zoom () const
 Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored.

Static Public Member Functions

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

Protected Member Functions

virtual void pixel_factor_changed ()
 Called internally when the pixel factor changes.
void update_pixel_factor ()
 Internal function to reset pixel_factor after it may have changed.

Protected Attributes

int _draw_buffer_type
int _screenshot_buffer_type

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.

Definition at line 33 of file drawableRegion.h.


Member Function Documentation

void DrawableRegion::copy_clear_settings ( const DrawableRegion copy) [inline]

Copies only the clear settings from the other drawable region.

Definition at line 77 of file drawableRegion.I.

References update_pixel_factor().

Referenced by GraphicsOutput::make_cube_map().

void DrawableRegion::disable_clears ( ) [virtual]

Disables both the color and depth clear.

See set_clear_color_active and set_clear_depth_active.

Reimplemented in StereoDisplayRegion.

Definition at line 80 of file drawableRegion.cxx.

References update_pixel_factor().

bool DrawableRegion::get_clear_active ( int  n) const [virtual]

Gets the clear-active flag for any bitplane.

Definition at line 45 of file drawableRegion.cxx.

Referenced by get_clear_color_active(), get_clear_depth_active(), get_clear_stencil_active(), and is_any_clear_active().

const LColor & DrawableRegion::get_clear_color ( ) const [inline]

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.

Definition at line 187 of file drawableRegion.I.

References get_clear_value().

bool DrawableRegion::get_clear_color_active ( ) const [inline]

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

See set_clear_color_active().

Definition at line 107 of file drawableRegion.I.

References get_clear_active().

Referenced by DisplayRegion::supports_pixel_zoom().

PN_stdfloat DrawableRegion::get_clear_depth ( ) const [inline]

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.

Definition at line 215 of file drawableRegion.I.

References get_clear_value().

bool DrawableRegion::get_clear_depth_active ( ) const [inline]

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

See set_clear_depth_active().

Definition at line 133 of file drawableRegion.I.

References get_clear_active().

Referenced by GraphicsOutput::make_stereo_display_region(), and DisplayRegion::supports_pixel_zoom().

unsigned int DrawableRegion::get_clear_stencil ( ) const [inline]

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.

Definition at line 242 of file drawableRegion.I.

References get_clear_value().

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

See set_clear_stencil_active().

Definition at line 159 of file drawableRegion.I.

References get_clear_active().

Referenced by GraphicsOutput::make_stereo_display_region().

const LColor & DrawableRegion::get_clear_value ( int  n) const [virtual]

Returns the clear value for any bitplane.

Definition at line 67 of file drawableRegion.cxx.

Referenced by get_clear_color(), get_clear_depth(), and get_clear_stencil().

int DrawableRegion::get_draw_buffer_type ( ) const [inline]

Returns the RenderBuffer into which the GSG should issue draw commands.

Normally, this is the back buffer for double-buffered windows, and the front buffer for single-buffered windows.

Definition at line 295 of file drawableRegion.I.

Referenced by GraphicsOutput::change_scenes(), and GraphicsOutput::copy_to_textures().

PN_stdfloat DrawableRegion::get_pixel_factor ( ) const [inline]

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).

Definition at line 270 of file drawableRegion.I.

Referenced by GraphicsOutput::get_fb_x_size(), and GraphicsOutput::get_fb_y_size().

PN_stdfloat DrawableRegion::get_pixel_zoom ( ) const [inline]

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

Also see get_pixel_factor().

Definition at line 254 of file drawableRegion.I.

int DrawableRegion::get_renderbuffer_type ( int  plane) [static]

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

Definition at line 163 of file drawableRegion.cxx.

Referenced by GraphicsOutput::copy_to_textures().

Returns the RenderBuffer that should be used for capturing screenshots from this particular DrawableRegion.

Definition at line 282 of file drawableRegion.I.

bool DrawableRegion::is_any_clear_active ( ) const [virtual]

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.

Definition at line 96 of file drawableRegion.cxx.

References get_clear_active().

Referenced by GraphicsOutput::clear().

void DrawableRegion::pixel_factor_changed ( ) [protected, virtual]

Called internally when the pixel factor changes.

Reimplemented in GraphicsOutput.

Definition at line 193 of file drawableRegion.cxx.

Referenced by update_pixel_factor().

void DrawableRegion::set_clear_active ( int  n,
bool  clear_aux_active 
) [virtual]

Sets the clear-active flag for any bitplane.

Reimplemented in StereoDisplayRegion.

Definition at line 33 of file drawableRegion.cxx.

References update_pixel_factor().

Referenced by set_clear_color_active(), set_clear_depth_active(), and set_clear_stencil_active().

void DrawableRegion::set_clear_color ( const LColor color) [inline]

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.

Definition at line 173 of file drawableRegion.I.

References set_clear_value().

Referenced by GraphicsOutput::GraphicsOutput().

void DrawableRegion::set_clear_color_active ( bool  clear_color_active) [inline]

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.

Definition at line 95 of file drawableRegion.I.

References set_clear_active().

Referenced by GraphicsOutput::GraphicsOutput(), and GraphicsOutput::make_cube_map().

void DrawableRegion::set_clear_depth ( PN_stdfloat  depth) [inline]

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.

Definition at line 201 of file drawableRegion.I.

References set_clear_value().

void DrawableRegion::set_clear_depth_active ( bool  clear_depth_active) [inline]

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.

Definition at line 121 of file drawableRegion.I.

References set_clear_active().

Referenced by GraphicsOutput::GraphicsOutput(), and GraphicsOutput::make_cube_map().

void DrawableRegion::set_clear_stencil ( unsigned int  stencil) [inline]

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

Definition at line 228 of file drawableRegion.I.

References set_clear_value().

void DrawableRegion::set_clear_stencil_active ( bool  clear_stencil_active) [inline]

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.

Definition at line 147 of file drawableRegion.I.

References set_clear_active().

Referenced by GraphicsOutput::GraphicsOutput(), and GraphicsOutput::make_cube_map().

void DrawableRegion::set_clear_value ( int  n,
const LColor clear_value 
) [virtual]

Sets the clear value for any bitplane.

Reimplemented in StereoDisplayRegion.

Definition at line 56 of file drawableRegion.cxx.

Referenced by set_clear_color(), set_clear_depth(), and set_clear_stencil().

void DrawableRegion::set_pixel_zoom ( PN_stdfloat  pixel_zoom) [virtual]

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.

Reimplemented in StereoDisplayRegion.

Definition at line 132 of file drawableRegion.cxx.

References update_pixel_factor().

Referenced by GraphicsWindow::GraphicsWindow().

bool DrawableRegion::supports_pixel_zoom ( ) const [virtual]

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.

Reimplemented in DisplayRegion.

Definition at line 152 of file drawableRegion.cxx.

Referenced by DisplayRegion::supports_pixel_zoom(), and update_pixel_factor().

void DrawableRegion::update_pixel_factor ( ) [inline, protected]

Internal function to reset pixel_factor after it may have changed.

Definition at line 306 of file drawableRegion.I.

References pixel_factor_changed(), and supports_pixel_zoom().

Referenced by copy_clear_settings(), disable_clears(), set_clear_active(), and set_pixel_zoom().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations