Panda3D
|
This is a special GraphicsOutput type that acts a lot like a GraphicsBuffer, effectively allowing rendering to an offscreen buffer, except it does not create any framebuffer space for itself. More...
#include <pandadoc.hpp>
Public Member Functions | |
setSize (int x, int y) | |
This is called by the GraphicsEngine to request that the buffer resize itself. | |
![]() | |
addRenderTexture (Texture tex, GraphicsOutput::RenderTextureMode mode, DrawableRegion::RenderTexturePlane bitplane) | |
Creates a new Texture object, suitable for rendering the contents of this buffer into, and appends it to the list of render textures. | |
clearChildSort () | |
Resets the sort value of future offscreen buffers created by make_texture_sort() to the default value. | |
clearDeleteFlag () | |
Resets the delete flag, so the GraphicsOutput will not be automatically deleted before the beginning of the next frame. | |
clearRenderTextures () | |
If the GraphicsOutput is currently rendering to a texture, then all textures are dissociated from the GraphicsOuput. | |
int | countTextures () |
If the GraphicsOutput is set to render into a texture, returns the number of textures that are being rendered into. | |
bool | flipReady () |
DisplayRegion | getActiveDisplayRegion (int n) |
Returns the nth active DisplayRegion of those that have been created within the window. | |
list | getActiveDisplayRegions () |
int | getChildSort () |
Returns the sort value of future offscreen buffers created by make_texture_sort(). | |
bool | getDeleteFlag () |
Returns the current setting of the delete flag. | |
DisplayRegion | getDisplayRegion (int n) |
Returns the nth DisplayRegion of those that have been created within the window. | |
list | getDisplayRegions () |
GraphicsEngine | getEngine () |
Returns the graphics engine that created this output. | |
const FrameBufferProperties | getFbProperties () |
Returns the framebuffer properties of the window. | |
LVecBase2i | getFbSize () |
Returns the internal size of the window or buffer. | |
int | getFbXSize () |
Returns the internal width of the window or buffer. | |
int | getFbYSize () |
Returns the internal height of the window or buffer. | |
GraphicsStateGuardian | getGsg () |
Returns the GSG that is associated with this window. | |
GraphicsOutput | getHost () |
This is normally called only from within make_texture_buffer(). | |
bool | getInverted () |
Returns the current setting of the inverted flag. | |
unsigned int | getLeftEyeColorMask () |
Returns the color mask in effect when rendering a left-eye view in red_blue stereo mode. | |
str | getName () |
Returns the name that was passed to the GraphicsOutput constructor. | |
int | getNumActiveDisplayRegions () |
Returns the number of active DisplayRegions that have been created within the window. | |
int | getNumDisplayRegions () |
Returns the number of DisplayRegions that have been created within the window, active or otherwise. | |
bool | getOneShot () |
Returns the current setting of the one-shot flag. | |
DisplayRegion | getOverlayDisplayRegion () |
Returns the special "overlay" DisplayRegion that is created for each window or buffer. | |
GraphicsPipe | getPipe () |
Returns the GraphicsPipe that this window is associated with. | |
bool | getRedBlueStereo () |
Returns whether red-blue stereo mode is in effect for this particular window. | |
unsigned int | getRightEyeColorMask () |
Returns the color mask in effect when rendering a right-eye view in red_blue stereo mode. | |
GraphicsOutput::RenderTextureMode | getRtmMode (int i) |
Returns the RenderTextureMode associated with the nth render-texture. | |
const LVecBase4 | getSbsLeftDimensions () |
Returns the effective sub-region of the window for displaying the left channel, if side-by-side stereo mode is in effect for the window. | |
LVecBase2i | getSbsLeftSize () |
If side-by-side stereo is enabled, this returns the pixel size of the left eye, based on scaling get_size() by get_sbs_left_dimensions(). | |
int | getSbsLeftXSize () |
If side-by-side stereo is enabled, this returns the pixel width of the left eye, based on scaling get_x_size() by get_sbs_left_dimensions(). | |
int | getSbsLeftYSize () |
If side-by-side stereo is enabled, this returns the pixel height of the left eye, based on scaling get_y_size() by get_sbs_left_dimensions(). | |
const LVecBase4 | getSbsRightDimensions () |
Returns the effective sub-region of the window for displaying the right channel, if side-by-side stereo mode is in effect for the window. | |
LVecBase2i | getSbsRightSize () |
If side-by-side stereo is enabled, this returns the pixel size of the right eye, based on scaling get_size() by get_sbs_right_dimensions(). | |
int | getSbsRightXSize () |
If side-by-side stereo is enabled, this returns the pixel width of the right eye, based on scaling get_x_size() by get_sbs_right_dimensions(). | |
int | getSbsRightYSize () |
If side-by-side stereo is enabled, this returns the pixel height of the right eye, based on scaling get_y_size() by get_sbs_right_dimensions(). | |
Texture | getScreenshot () |
Captures the most-recently rendered image from the framebuffer and returns it as Texture, or NULL on failure. | |
bool | getScreenshot (PNMImage image) |
Captures the most-recently rendered image from the framebuffer into the indicated PNMImage. | |
bool | getSideBySideStereo () |
Returns whether side-by-side stereo mode is in effect for this particular window. | |
const LVecBase2i | getSize () |
Returns the visible size of the window or buffer, if it is known. | |
int | getSort () |
Returns the sorting order of this particular GraphicsOutput. | |
bool | getSupportsRenderTexture () |
Returns true if this particular GraphicsOutput can render directly into a texture, or false if it must always copy-to-texture at the end of each frame to achieve this effect. | |
bool | getSwapEyes () |
Returns the current setting of the "swap eyes" flag. | |
Texture | getTexture (int i) |
Returns the nth texture into which the GraphicsOutput renders. | |
NodePath | getTextureCard () |
Returns a PandaNode containing a square polygon. | |
DrawableRegion::RenderTexturePlane | getTexturePlane (int i) |
Returns the RenderTexturePlane associated with the nth render-texture. | |
int | getXSize () |
Returns the visible width of the window or buffer, if it is known. | |
int | getYSize () |
Returns the visible height of the window or buffer, if it is known. | |
bool | hasSize () |
Returns true if the size of the window/frame buffer is known, false otherwise. | |
bool | hasTexture () |
Returns true if the GraphicsOutput is rendering into any textures at all. | |
bool | isActive () |
Returns true if the window is ready to be rendered into, false otherwise. | |
bool | isNonzeroSize () |
Returns true if the output has a nonzero size in both X and Y, or false if it is zero (and therefore invalid). | |
bool | isStereo () |
Returns Returns true if this window can render stereo DisplayRegions, either through red-blue stereo (see set_red_blue_stereo()) or through true hardware stereo rendering. | |
bool | isValid () |
Returns true if the output is fully created and ready for rendering, false otherwise. | |
GraphicsOutput | makeCubeMap (str name, int size, NodePath camera_rig, DrawMask camera_mask, bool to_ram, FrameBufferProperties fbp) |
This is similar to make_texture_buffer() in that it allocates a separate buffer suitable for rendering to a texture that can be assigned to geometry in this window, but in this case, the buffer is set up to render the six faces of a cube map. | |
DisplayRegion | makeDisplayRegion () |
Creates a new DisplayRegion that covers the entire window. | |
DisplayRegion | makeDisplayRegion (const LVecBase4 dimensions) |
Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. | |
DisplayRegion | makeDisplayRegion (float l, float r, float b, float t) |
Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. | |
DisplayRegion | makeMonoDisplayRegion () |
Creates a new DisplayRegion that covers the entire window. | |
DisplayRegion | makeMonoDisplayRegion (const LVecBase4 dimensions) |
Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. | |
DisplayRegion | makeMonoDisplayRegion (float l, float r, float b, float t) |
Creates a new DisplayRegion that covers the entire window. | |
StereoDisplayRegion | makeStereoDisplayRegion () |
Creates a new DisplayRegion that covers the entire window. | |
StereoDisplayRegion | makeStereoDisplayRegion (const LVecBase4 dimensions) |
Creates a new DisplayRegion that covers the indicated sub-rectangle within the window. | |
StereoDisplayRegion | makeStereoDisplayRegion (float l, float r, float b, float t) |
Creates a new DisplayRegion that covers the entire window. | |
GraphicsOutput | makeTextureBuffer (str name, int x_size, int y_size, Texture tex, bool to_ram, FrameBufferProperties fbp) |
Creates and returns an offscreen buffer for rendering into, the result of which will be a texture suitable for applying to geometry within the scene rendered into this window. | |
removeAllDisplayRegions () | |
Removes all display regions from the window, except the default one that is created with the window. | |
bool | removeDisplayRegion (DisplayRegion display_region) |
Removes the indicated DisplayRegion from the window, and destructs it if there are no other references. | |
bool | saveScreenshot (const Filename filename, str image_comment) |
Saves a screenshot of the region to the indicated filename. | |
Filename | saveScreenshotDefault (str prefix) |
Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed. | |
setActive (bool active) | |
Sets the active flag associated with the GraphicsOutput. | |
setChildSort (int child_sort) | |
Specifies the sort value of future offscreen buffers created by make_texture_sort(). | |
setInverted (bool inverted) | |
Changes the current setting of the inverted flag. | |
setOneShot (bool one_shot) | |
Changes the current setting of the one-shot flag. | |
setOverlayDisplayRegion (DisplayRegion display_region) | |
Replaces the special "overlay" DisplayRegion that is created for each window or buffer. | |
setRedBlueStereo (bool red_blue_stereo, unsigned int left_eye_color_mask, unsigned int right_eye_color_mask) | |
Enables red-blue stereo mode on this particular window. | |
setSideBySideStereo (bool side_by_side_stereo) | |
Enables side-by-side stereo mode on this particular window. | |
setSideBySideStereo (bool side_by_side_stereo, const LVecBase4 sbs_left_dimensions, const LVecBase4 sbs_right_dimensions) | |
Enables side-by-side stereo mode on this particular window. | |
setSort (int sort) | |
Adjusts the sorting order of this particular GraphicsOutput, relative to other GraphicsOutputs. | |
setSwapEyes (bool swap_eyes) | |
Changes the "swap eyes" flag. | |
setupRenderTexture (Texture tex, bool allow_bind, bool to_ram) | |
This is a deprecated interface that made sense back when GraphicsOutputs could only render into one texture at a time. | |
bool | shareDepthBuffer (GraphicsOutput graphics_output) |
Will attempt to use the depth buffer of the input graphics_output. | |
AsyncFuture | triggerCopy () |
When the GraphicsOutput is in triggered copy mode, this function triggers the copy (at the end of the next frame). | |
unshareDepthBuffer () | |
Discontinue sharing the depth buffer. | |
![]() | |
Texture | getTexture (int i) |
setSort (int sort) | |
![]() | |
object | __reduce__ () |
object | __reduce_persist__ (object pickler) |
VectorUchar | encodeToBamStream () |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. | |
bool | encodeToBamStream (VectorUchar data, BamWriter writer) |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
fillin (DatagramIterator scan, BamReader manager) | |
This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. | |
UpdateSeq | getBamModified () |
Returns the current bam_modified counter. | |
markBamModified () | |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
![]() | |
TypeHandle | getType () |
int | getTypeIndex () |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | isExactType (TypeHandle handle) |
Returns true if the current object is the indicated type exactly. | |
bool | isOfType (TypeHandle handle) |
Returns true if the current object is or derives from the indicated type. | |
![]() | |
int | getRefCount () |
Returns the current reference count. | |
ref () | |
Explicitly increments the reference count. | |
bool | testRefCountIntegrity () |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | testRefCountNonzero () |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
bool | unref () |
Explicitly decrements the reference count. | |
![]() | |
disableClears () | |
Disables both the color and depth clear. | |
bool | getClearActive (int n) |
Gets the clear-active flag for any bitplane. | |
const LColor | getClearColor () |
Returns the current clear color value. | |
bool | getClearColorActive () |
Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. | |
float | getClearDepth () |
Returns the current clear depth value. | |
bool | getClearDepthActive () |
Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame. | |
unsigned int | getClearStencil () |
Returns the current clear stencil value. | |
bool | getClearStencilActive () |
Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. | |
const LColor | getClearValue (int n) |
Returns the clear value for any bitplane. | |
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(). | |
float | getPixelZoom () |
Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not. | |
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 (int n, bool clear_aux_active) | |
Sets the clear-active flag for any bitplane. | |
setClearColor (const LColor color) | |
Sets the clear color to the indicated value. | |
setClearColorActive (bool clear_color_active) | |
Toggles the flag that indicates whether the color buffer should be cleared every frame. | |
setClearDepth (float depth) | |
Sets the clear depth to the indicated value. | |
setClearDepthActive (bool clear_depth_active) | |
Toggles the flag that indicates whether the depth buffer should be cleared every frame. | |
setClearStencil (unsigned int stencil) | |
setClearStencilActive (bool clear_stencil_active) | |
Toggles the flag that indicates whether the stencil buffer should be cleared every frame. | |
setClearValue (int n, const LColor clear_value) | |
Sets the clear value for any bitplane. | |
setPixelZoom (float pixel_zoom) | |
Sets the amount by which the pixels of the region are scaled internally when filling the image interally. | |
bool | supportsPixelZoom () |
Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored. | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
static Filename | makeScreenshotFilename (str prefix) |
Saves a screenshot of the region to a default filename, and returns the filename, or empty string if the screenshot failed. | |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypedWritableReferenceCount | decodeFromBamStream (VectorUchar data, BamReader reader) |
Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on those bytes. | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static int | getRenderbufferType (int plane) |
Returns the RenderBuffer::Type that corresponds to a RenderTexturePlane. | |
Additional Inherited Members | |
![]() | |
enum | FrameMode { FM_render = 0 , FM_parasite = 1 , FM_refresh = 2 } |
enum | RenderTextureMode { RTM_none = 0 , RTM_bind_or_copy = 1 , RTM_copy_texture = 2 , RTM_copy_ram = 3 , RTM_triggered_copy_texture = 4 , RTM_triggered_copy_ram = 5 , RTM_bind_layered = 6 } |
![]() | |
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 } |
![]() | |
bool | active |
Returns true if the window is ready to be rendered into, false otherwise. | |
PointerToDisplayRegion | active_display_regions [] |
Returns the nth active DisplayRegion of those that have been created within the window. | |
int | child_sort |
Returns the sort value of future offscreen buffers created by make_texture_sort(). | |
PointerToDisplayRegion | display_regions [] |
Returns the nth DisplayRegion of those that have been created within the window. | |
GraphicsEngine | engine |
Returns the graphics engine that created this output. | |
LVecBase2i | fb_size |
Returns the internal size of the window or buffer. | |
GraphicsStateGuardian | gsg |
Returns the GSG that is associated with this window. | |
bool | inverted |
Returns the current setting of the inverted flag. | |
const String | name |
Returns the name that was passed to the GraphicsOutput constructor. | |
bool | one_shot |
Returns the current setting of the one-shot flag. | |
GraphicsPipe | pipe |
Returns the GraphicsPipe that this window is associated with. | |
LVecBase2i | sbs_left_size |
If side-by-side stereo is enabled, this returns the pixel size of the left eye, based on scaling get_size() by get_sbs_left_dimensions(). | |
LVecBase2i | sbs_right_size |
If side-by-side stereo is enabled, this returns the pixel size of the right eye, based on scaling get_size() by get_sbs_right_dimensions(). | |
const LVecBase2i | size |
Returns the visible size of the window or buffer, if it is known. | |
int | sort |
Returns the sorting order of this particular GraphicsOutput. | |
bool | supports_render_texture |
Returns true if this particular GraphicsOutput can render directly into a texture, or false if it must always copy-to-texture at the end of each frame to achieve this effect. | |
bool | swap_eyes |
Returns the current setting of the "swap eyes" flag. | |
![]() | |
TypeHandle | type |
Returns the TypeHandle representing this object's type. | |
![]() | |
int | ref_count |
The current reference count. | |
![]() | |
const LColor | clear_color |
Returns the current clear color value. | |
float | clear_depth |
Returns the current clear depth value. | |
unsigned int | clear_stencil |
Returns the current clear stencil value. | |
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(). | |
float | pixel_zoom |
Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not. | |
This is a special GraphicsOutput type that acts a lot like a GraphicsBuffer, effectively allowing rendering to an offscreen buffer, except it does not create any framebuffer space for itself.
Instead, it renders into the framebuffer owned by some other GraphicsOutput.
The x_size and y_size must therefore fit within the bounds of the source GraphicsOutput.
Since the framebuffer will be subsequently cleared when the actual owner draws in it later, this only makes sense if we are going to copy the contents of the framebuffer to a texture immediately after we draw it. Thus, has_texture() is implicitly true for a ParasiteBuffer.
This class is useful to render offscreen to a texture while preventing the waste of framebuffer memory for API's that are unable to render directly into a texture (and must render into a separate framebuffer first and then copy to texture). It is also the only way to render to a texture on API's that do not support offscreen rendering.
|
static |
setSize | ( | int | x, |
int | y ) |
This is called by the GraphicsEngine to request that the buffer resize itself.
Although calls to get the size will return the new value, much of the actual resizing work doesn't take place until the next begin_frame. Not all buffers are resizeable.