Panda3D
|
An interface to the TinyPanda software rendering code within this module. More...
#include "tinyGraphicsStateGuardian.h"
Public Member Functions | |
TinyGraphicsStateGuardian (GraphicsEngine *engine, GraphicsPipe *pipe, TinyGraphicsStateGuardian *share_with) | |
virtual bool | begin_draw_primitives (const GeomPipelineReader *geom_reader, const GeomMunger *munger, const GeomVertexDataPipelineReader *data_reader, bool force) |
Called before a sequence of draw_primitive() functions are called, this should prepare the vertex data for rendering. More... | |
virtual bool | begin_frame (Thread *current_thread) |
Called before each frame is rendered, to allow the GSG a chance to do any internal cleanup before beginning the frame. More... | |
virtual bool | begin_scene () |
Called between begin_frame() and end_frame() to mark the beginning of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame. More... | |
virtual void | bind_light (PointLight *light_obj, const NodePath &light, int light_id) |
Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties. More... | |
virtual void | bind_light (DirectionalLight *light_obj, const NodePath &light, int light_id) |
Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties. More... | |
virtual void | bind_light (Spotlight *light_obj, const NodePath &light, int light_id) |
Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties. More... | |
virtual void | clear (DrawableRegion *clearable) |
Clears the framebuffer within the current DisplayRegion, according to the flags indicated by the given DrawableRegion object. More... | |
virtual void | close_gsg () |
This is called by the associated GraphicsWindow when close_window() is called. More... | |
virtual | CPT (TransformState) calc_projection_mat(const Lens *lens) |
virtual bool | depth_offset_decals () |
Returns true if this GSG can implement decals using a DepthOffsetAttrib, or false if that is unreliable and the three-step rendering process should be used instead. More... | |
virtual void | do_issue_light () |
This implementation of do_issue_light() assumes we have a limited number of hardware lights available. More... | |
virtual bool | draw_lines (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected line segments. More... | |
virtual bool | draw_points (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected points. More... | |
virtual bool | draw_triangles (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected triangles. More... | |
virtual bool | draw_tristrips (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of triangle strips. More... | |
virtual void | end_draw_primitives () |
Called after a sequence of draw_primitive() functions are called, this should do whatever cleanup is appropriate. More... | |
virtual void | end_frame (Thread *current_thread) |
Called after each frame is rendered, to allow the GSG a chance to do any internal cleanup after rendering the frame, and before the window flips. More... | |
virtual void | end_scene () |
Called between begin_frame() and end_frame() to mark the end of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame. More... | |
virtual TypeHandle | force_init_type () |
virtual bool | framebuffer_copy_to_ram (Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb) |
Copy the pixels within the indicated display region from the framebuffer into system memory, not texture memory. More... | |
virtual bool | framebuffer_copy_to_texture (Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb) |
Copy the pixels within the indicated display region from the framebuffer into texture memory. More... | |
virtual void | free_pointers () |
Frees some memory that was explicitly allocated within the glgsg. More... | |
virtual TypeHandle | get_type () const |
virtual void | prepare_display_region (DisplayRegionPipelineReader *dr) |
Prepare a display region for rendering (set up scissor region and viewport) More... | |
virtual bool | prepare_lens () |
Makes the current lens (whichever lens was most recently specified with set_scene()) active, so that it will transform future rendered geometry. More... | |
virtual TextureContext * | prepare_texture (Texture *tex, int view) |
Creates whatever structures the GSG requires to represent the texture internally, and returns a newly-allocated TextureContext object with this data. More... | |
virtual | PT (GeomMunger) make_geom_munger(const RenderState *state |
virtual void | release_texture (TextureContext *tc) |
Frees the GL resources previously allocated for the texture. More... | |
virtual void | reset () |
Resets all internal state as if the gsg were newly created. More... | |
virtual void | set_state_and_transform (const RenderState *state, const TransformState *transform) |
Simultaneously resets the render state and the transform state. More... | |
virtual bool | update_texture (TextureContext *tc, bool force) |
Ensures that the current Texture data is refreshed onto the GSG. More... | |
bool | update_texture (TextureContext *tc, bool force, int stage_index, bool uses_mipmaps) |
Ensures that the current Texture data is refreshed onto the GSG. More... | |
![]() | |
GraphicsStateGuardian (CoordinateSystem internal_coordinate_system, GraphicsEngine *engine, GraphicsPipe *pipe) | |
virtual void | begin_occlusion_query () |
Begins a new occlusion query. More... | |
virtual void | clear_before_callback () |
Resets any non-standard graphics state that might give a callback apoplexy. More... | |
void | clear_flash_texture () |
Resets the "flash texture", so that no textures will flash. More... | |
virtual void | clear_state_and_transform () |
Forgets the current graphics state and current transform, so that the next call to set_state_and_transform() will have to reload everything. More... | |
virtual PN_stdfloat | compute_distance_to (const LPoint3 &point) const |
This function will compute the distance to the indicated point, assumed to be in eye coordinates, from the camera plane. More... | |
virtual | CPT (RenderState) begin_decal_base_first() |
virtual | CPT (RenderState) begin_decal_nested() |
virtual | CPT (RenderState) begin_decal_base_second() |
CPT (TransformState) get_external_transform() const | |
CPT (TransformState) get_internal_transform() const | |
CPT (TransformState) get_inv_cs_transform() const | |
virtual void | dispatch_compute (int size_x, int size_y, int size_z) |
Dispatches a currently bound compute shader using the given work group counts. More... | |
void | do_issue_clip_plane () |
void | do_issue_color () |
This method is defined in the base class because it is likely that this functionality will be used for all (or at least most) kinds of GraphicsStateGuardians–it's not specific to any one rendering backend. More... | |
void | do_issue_color_scale () |
virtual bool | draw_linestrips (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of line strips. More... | |
virtual bool | draw_patches (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of "patches", which can only be processed by a tessellation shader. More... | |
virtual bool | draw_trifans (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of triangle fans. More... | |
virtual bool | extract_texture_data (Texture *tex) |
This method should only be called by the GraphicsEngine. More... | |
const Shader::ShaderPtrData * | fetch_ptr_parameter (const Shader::ShaderPtrSpec &spec) |
Return a pointer to struct ShaderPtrData. More... | |
const LMatrix4 * | fetch_specified_part (Shader::ShaderMatInput input, InternalName *name, LMatrix4 &t, int index) |
See fetch_specified_value. More... | |
const LMatrix4 * | fetch_specified_value (Shader::ShaderMatSpec &spec, int altered) |
The gsg contains a large number of useful matrices: More... | |
virtual void | finish_decal () |
Called during draw to clean up after decals are finished. More... | |
void | flush_timer_queries () |
Called by the graphics engine on the draw thread to check the status of the running timer queries and submit their results to the PStats server. More... | |
bool | get_alpha_scale_via_texture () const |
Returns true if this particular GSG can implement (or would prefer to implement) an alpha scale via an additional Texture layer, or false if we need to actually munge the alpha. More... | |
bool | get_alpha_scale_via_texture (const TextureAttrib *tex_attrib) const |
This variant of get_alpha_scale_via_texture() answers the question of whether the GSG can implement an alpha scale via an additional Texture layer, considering the current TextureAttrib that will be in effect. More... | |
bool | get_color_scale_via_lighting () const |
Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale using materials and/or ambient lights, or false if we need to actually munge the color. More... | |
CoordinateSystem | get_coordinate_system () const |
Returns the coordinate system in effect on this particular gsg. More... | |
bool | get_copy_texture_inverted () const |
Returns true if this particular GSG has the property that any framebuffer-to-texture copy results in a texture that is upside-down and backwards from Panda's usual convention; that is, it copies into a texture from the bottom up instead of from the top down. More... | |
const DisplayRegion * | get_current_display_region () const |
const Lens * | get_current_lens () const |
Lens::StereoChannel | get_current_stereo_channel () const |
int | get_current_tex_view_offset () const |
virtual string | get_driver_renderer () |
Returns GL_Renderer. More... | |
virtual int | get_driver_shader_version_major () |
Returns the major version of the shader model. More... | |
virtual int | get_driver_shader_version_minor () |
Returns the minor version of the shader model. More... | |
virtual string | get_driver_vendor () |
Returns the vendor of the video card driver. More... | |
virtual string | get_driver_version () |
Returns driver version This has an implementation-defined meaning, and may be "" if the particular graphics implementation does not provide a way to query this information. More... | |
virtual int | get_driver_version_major () |
Returns major version of the video driver. More... | |
virtual int | get_driver_version_minor () |
Returns the minor version of the video driver. More... | |
virtual bool | get_effective_incomplete_render () const |
Returns true if the GSG is effectively in incomplete_render state, considering both the GSG's incomplete_render and its current DisplayRegion's incomplete_render flags. More... | |
GraphicsEngine * | get_engine () const |
Returns the graphics engine that created this GSG. More... | |
Texture * | get_flash_texture () const |
Returns the current "flash texture", if any, or NULL if none. More... | |
PN_stdfloat | get_gamma (PN_stdfloat gamma) |
Get the current gamma setting. More... | |
virtual bool | get_incomplete_render () const |
Returns the incomplete_render flag. More... | |
virtual CoordinateSystem | get_internal_coordinate_system () const |
Returns the coordinate system used internally by the GSG. More... | |
Loader * | get_loader () const |
Returns the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true. More... | |
int | get_max_2d_texture_array_layers () const |
Returns the largest possible number of pages, or -1 if there is no particular limit. More... | |
int | get_max_3d_texture_dimension () const |
Returns the largest possible texture size in any one dimension for a 3-d texture, or -1 if there is no particular limit. More... | |
int | get_max_clip_planes () const |
Returns the maximum number of simultaneous clip planes that may be applied to geometry, or -1 if there is no particular limit. More... | |
int | get_max_color_targets () const |
Returns the maximum number of simultaneous color textures that may be attached for render-to-texture, as supported by this particular GSG. More... | |
int | get_max_cube_map_dimension () const |
Returns the largest possible texture size in any one dimension for a cube map texture, or -1 if there is no particular limit. More... | |
int | get_max_lights () const |
Returns the maximum number of simultaneous lights that may be rendered on geometry, or -1 if there is no particular limit. More... | |
virtual int | get_max_texture_dimension () const |
Returns the largest possible texture size in any one dimension supported by the GSG, or -1 if there is no particular limit. More... | |
int | get_max_texture_stages () const |
Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturing, as supported by this particular GSG. More... | |
int | get_max_vertex_transform_indices () const |
Returns the maximum number of transforms there may be in a single TransformTable for this graphics hardware. More... | |
int | get_max_vertex_transforms () const |
Returns the maximum number of transform matrices that may be simultaneously used to transform any one vertex by the graphics hardware. More... | |
virtual int | get_max_vertices_per_array () const |
Returns the maximum number of vertices that should be put into any one GeomVertexData object for use with this GSG. More... | |
virtual int | get_max_vertices_per_primitive () const |
Returns the maximum number of vertex indices that should be put into any one GeomPrimitive object for use with this GSG. More... | |
int | get_maximum_simultaneous_render_targets () const |
Deprecated. More... | |
GraphicsPipe * | get_pipe () const |
Returns the graphics pipe on which this GSG was created. More... | |
virtual PreparedGraphicsObjects * | get_prepared_objects () |
Returns the set of texture and geom objects that have been prepared with this GSG (and possibly other GSG's that share objects). More... | |
RenderBuffer | get_render_buffer (int buffer_type, const FrameBufferProperties &prop) |
Returns a RenderBuffer object suitable for operating on the requested set of buffers. More... | |
bool | get_runtime_color_scale () const |
Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale directly, without requiring any munging of vertices or tricks with lighting. More... | |
virtual SceneSetup * | get_scene () const |
Returns the current SceneSetup object. More... | |
ShaderGenerator * | get_shader_generator () const |
Returns the ShaderGenerator object that will be used by this GSG to generate shaders when necessary. More... | |
int | get_shader_model () const |
Returns the ShaderModel. More... | |
virtual int | get_supported_geom_rendering () const |
Returns the union of Geom::GeomRendering values that this particular GSG can support directly. More... | |
bool | get_supports_2d_texture_array () const |
Returns true if this GSG can render 2-d textures array. More... | |
bool | get_supports_3d_texture () const |
Returns true if this GSG can render 3-d (volumetric) textures. More... | |
bool | get_supports_basic_shaders () const |
Returns true if this particular GSG supports arbfp1+arbvp1 or above. More... | |
virtual bool | get_supports_cg_profile (const string &name) const |
Returns true if this particular GSG supports the specified Cg Shader Profile. More... | |
bool | get_supports_compressed_texture () const |
Returns true if this GSG can compress textures as it loads them into texture memory, and/or accept pre-compressed textures for storing. More... | |
virtual bool | get_supports_compressed_texture_format (int compression_mode) const |
Returns true if this GSG can accept textures pre-compressed in the indicated format. More... | |
bool | get_supports_compute_shaders () const |
Returns true if this particular GSG supports compute shaders. More... | |
bool | get_supports_cube_map () const |
Returns true if this GSG can render cube map textures. More... | |
bool | get_supports_depth_stencil () const |
Returns true if this particular GSG supports textures whose format is F_depth_stencil. More... | |
bool | get_supports_depth_texture () const |
Returns true if this particular GSG supports textures whose format is F_depth_stencil. More... | |
bool | get_supports_generate_mipmap () const |
Returns true if this particular GSG can generate mipmaps for a texture automatically, or if they must be generated in software. More... | |
bool | get_supports_geometry_instancing () const |
Returns true if this particular GSG supports hardware geometry instancing: the ability to render multiple copies of a model. More... | |
bool | get_supports_geometry_shaders () const |
Returns true if this particular GSG supports geometry shaders. More... | |
bool | get_supports_glsl () const |
Returns true if this particular GSG supports GLSL shaders. More... | |
virtual bool | get_supports_multisample () const |
Returns true if this particular GSG supports using the multisample bits to provide antialiasing, and also supports M_multisample and M_multisample_mask transparency modes. More... | |
bool | get_supports_occlusion_query () const |
Returns true if this GSG supports an occlusion query. More... | |
bool | get_supports_sampler_objects () const |
Returns true if this particular GSG supports the use of sampler objects to record texture sampling parameters separately from the texture objects. More... | |
bool | get_supports_shadow_filter () const |
Returns true if this particular GSG supports the filter mode FT_shadow for depth textures. More... | |
bool | get_supports_stencil () const |
Returns true if this particular GSG supports stencil buffers at all. More... | |
bool | get_supports_tessellation_shaders () const |
Returns true if this particular GSG supports tesselation shaders. More... | |
bool | get_supports_tex_non_pow2 () const |
Returns true if this GSG can handle non power of two sized textures. More... | |
bool | get_supports_texture_combine () const |
Returns true if this particular GSG can use the TextureStage::M_combine mode, which includes all of the texture blend modes specified by set_combine_rgb() and/or set_combine_alpha(). More... | |
bool | get_supports_texture_dot3 () const |
Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes. More... | |
bool | get_supports_texture_saved_result () const |
Returns true if this GSG can use the TextureStage::CS_last_saved_result source, which allows you to save the result of a TextureStage and re-use it for multiple inputs. More... | |
bool | get_supports_texture_srgb () const |
Returns true if this GSG can handle sRGB textures. More... | |
bool | get_supports_timer_query () const |
Returns true if this GSG supports a timer query. More... | |
bool | get_supports_two_sided_stencil () const |
Returns true if this particular GSG supports two sided stencil: different stencil settings for the front and back side of the same polygon. More... | |
Texture::QualityLevel | get_texture_quality_override () const |
Returns the global quality_level override specified by set_texture_quality_override. More... | |
const GraphicsThreadingModel & | get_threading_model () const |
Returns the threading model that was used to create this GSG. More... | |
bool | get_timer_queries_active () const |
Returns true if timer queries are currently enabled on this GSG. More... | |
virtual bool | has_extension (const string &extension) const |
Returns true if the GSG implements the extension identified by the given string. More... | |
bool | is_active () const |
Returns the active flag associated with the GraphicsStateGuardian. More... | |
bool | is_hardware () const |
Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software only. More... | |
bool | is_valid () const |
Returns true if the GSG has been correctly initialized within a graphics context, false if there has been some problem or it hasn't been initialized yet. More... | |
void | mark_new () |
Marks the GSG as "new", so that the next call to reset_if_new() will be effective. More... | |
bool | needs_reset () const |
Returns true if the gsg is marked as needing a reset. More... | |
virtual bool | prefers_triangle_strips () const |
Returns true if this GSG strongly prefers triangle strips to individual triangles (such as SGI), or false if it prefers to minimize the number of primitive batches, even at the expense of triangle strips (such as most PC hardware). More... | |
virtual GeomContext * | prepare_geom (Geom *geom) |
Prepares the indicated Geom for retained-mode rendering, by creating whatever structures are necessary in the GSG (for instance, vertex buffers). More... | |
virtual IndexBufferContext * | prepare_index_buffer (GeomPrimitive *data) |
Prepares the indicated buffer for retained-mode rendering. More... | |
virtual SamplerContext * | prepare_sampler (const SamplerState &sampler) |
Creates whatever structures the GSG requires to represent the sampler internally, and returns a newly-allocated SamplerContext object with this data. More... | |
virtual ShaderContext * | prepare_shader (Shader *shader) |
Compile a vertex/fragment shader body. More... | |
virtual TextureContext * | prepare_texture (Texture *tex) |
Creates whatever structures the GSG requires to represent the texture internally, and returns a newly-allocated TextureContext object with this data. More... | |
virtual VertexBufferContext * | prepare_vertex_buffer (GeomVertexArrayData *data) |
Prepares the indicated buffer for retained-mode rendering. More... | |
virtual | PT (OcclusionQueryContext) end_occlusion_query() |
virtual | PT (TimerQueryContext) issue_timer_query(int pstats_index) |
virtual | PT (Texture) make_shadow_buffer(const NodePath &light_np |
void | release_all () |
Releases all prepared objects. More... | |
int | release_all_geoms () |
Frees the resources for all geoms associated with this GSG. More... | |
int | release_all_index_buffers () |
Frees the resources for all index buffers associated with this GSG. More... | |
int | release_all_samplers () |
Frees the resources for all samplers associated with this GSG. More... | |
int | release_all_textures () |
Frees the resources for all textures associated with this GSG. More... | |
int | release_all_vertex_buffers () |
Frees the resources for all vertex buffers associated with this GSG. More... | |
virtual void | release_geom (GeomContext *gc) |
Frees the resources previously allocated via a call to prepare_geom(), including deleting the GeomContext itself, if it is non-NULL. More... | |
virtual void | release_index_buffer (IndexBufferContext *ibc) |
Frees the resources previously allocated via a call to prepare_data(), including deleting the IndexBufferContext itself, if necessary. More... | |
virtual void | release_sampler (SamplerContext *sc) |
Frees the resources previously allocated via a call to prepare_sampler(), including deleting the SamplerContext itself, if it is non-NULL. More... | |
virtual void | release_shader (ShaderContext *sc) |
Releases the resources allocated by prepare_shader. More... | |
virtual void | release_vertex_buffer (VertexBufferContext *vbc) |
Frees the resources previously allocated via a call to prepare_data(), including deleting the VertexBufferContext itself, if necessary. More... | |
virtual void | remove_window (GraphicsOutputBase *window) |
This is simply a transparent call to GraphicsEngine::remove_window(). More... | |
bool | reset_if_new () |
Calls reset() to initialize the GSG, but only if it hasn't been called yet. More... | |
virtual void | restore_gamma () |
Restore original gamma setting. More... | |
void | set_active (bool active) |
Sets the active flag associated with the GraphicsStateGuardian. More... | |
void | set_coordinate_system (CoordinateSystem cs) |
Changes the coordinate system in effect on this particular gsg. More... | |
void | set_current_properties (const FrameBufferProperties *properties) |
void | set_flash_texture (Texture *tex) |
Sets the "flash texture". More... | |
virtual bool | set_gamma (PN_stdfloat gamma) |
Set gamma. More... | |
void | set_incomplete_render (bool incomplete_render) |
Sets the incomplete_render flag. More... | |
void | set_loader (Loader *loader) |
Sets the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true. More... | |
bool | set_scene (SceneSetup *scene_setup) |
Sets the SceneSetup object that indicates the initial camera position, etc. More... | |
void | set_shader_generator (ShaderGenerator *shader_generator) |
Sets the ShaderGenerator object that will be used by this GSG to generate shaders when necessary. More... | |
void | set_shader_model (int shader_model) |
Sets the ShaderModel. More... | |
void | set_texture_quality_override (Texture::QualityLevel quality_level) |
Specifies the global quality_level to be imposed for all Textures rendered by this GSG. More... | |
void | traverse_prepared_textures (TextureCallback *func, void *callback_arg) |
Calls the indicated function on all currently-prepared textures, or until the callback function returns false. More... | |
![]() | |
MAKE_SEQ (get_gsgs, get_num_gsgs, get_gsg) | |
![]() | |
TypedWritableReferenceCount (const TypedWritableReferenceCount ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More... | |
void | operator= (const TypedWritableReferenceCount ©) |
![]() | |
TypedWritable (const TypedWritable ©) | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More... | |
string | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. More... | |
bool | encode_to_bam_stream (string &data, BamWriter *writer=NULL) const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More... | |
virtual void | 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. More... | |
virtual void | finalize (BamReader *manager) |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More... | |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. More... | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More... | |
void | operator= (const TypedWritable ©) |
virtual bool | require_fully_complete () const |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More... | |
virtual void | update_bam_nested (BamWriter *manager) |
Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More... | |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. More... | |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
void | operator= (const TypedObject ©) |
![]() | |
int | get_ref_count () const |
Returns the current reference count. More... | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static void | create_gamma_table (PN_stdfloat gamma, unsigned short *red_table, unsigned short *green_table, unsigned short *blue_table) |
Create a gamma table. More... | |
static TextureStage * | get_alpha_scale_texture_stage () |
Returns the TextureStage that will be used to apply an alpha scale, if get_alpha_scale_via_texture() returns true. More... | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static void | add_gsg (GraphicsStateGuardianBase *gsg) |
Called by a GSG after it has been initialized, to add a new GSG to the available list. More... | |
static TypeHandle | get_class_type () |
static GraphicsStateGuardianBase * | get_default_gsg () |
Returns a pointer to the "default" GSG. More... | |
static GraphicsStateGuardianBase * | get_gsg (int n) |
Returns the nth GSG in the universe. More... | |
static int | get_num_gsgs () |
Returns the total number of GSG's in the universe. More... | |
static void | init_type () |
static void | remove_gsg (GraphicsStateGuardianBase *gsg) |
Called by a GSG destructor to remove a GSG from the available list. More... | |
static void | set_default_gsg (GraphicsStateGuardianBase *default_gsg) |
Specifies a particular GSG to use as the "default" GSG. More... | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
static | PT (TypedWritableReferenceCount) decode_from_bam_stream(const string &data |
![]() | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, const string &data, BamReader *reader=NULL) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string. More... | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
Public Attributes | |
ZBuffer * | _current_frame_buffer |
virtual Thread * | current_thread |
![]() | |
virtual Thread * | current_thread |
virtual GraphicsOutputBase * | host |
![]() | |
virtual Thread * | current_thread =0 |
virtual GraphicsOutputBase * | host =0 |
![]() | |
static BamReader * | reader = NULL) |
Additional Inherited Members | |
![]() | |
enum | ShaderModel { SM_00, SM_11, SM_20, SM_2X, SM_30, SM_40, SM_50 } |
typedef bool | TextureCallback(TextureContext *tc, void *callback_arg) |
![]() | |
static PStatCollector | _clear_pcollector |
static PStatCollector | _command_latency_pcollector |
static PStatCollector | _compute_dispatch_pcollector |
static PStatCollector | _create_index_buffer_pcollector |
static PStatCollector | _create_vertex_buffer_pcollector |
static PStatCollector | _data_transferred_pcollector |
static PStatCollector | _draw_primitive_pcollector |
static PStatCollector | _draw_set_state_alpha_test_pcollector |
static PStatCollector | _draw_set_state_antialias_pcollector |
static PStatCollector | _draw_set_state_blending_pcollector |
static PStatCollector | _draw_set_state_clip_plane_pcollector |
static PStatCollector | _draw_set_state_color_pcollector |
static PStatCollector | _draw_set_state_cull_face_pcollector |
static PStatCollector | _draw_set_state_depth_offset_pcollector |
static PStatCollector | _draw_set_state_depth_test_pcollector |
static PStatCollector | _draw_set_state_depth_write_pcollector |
static PStatCollector | _draw_set_state_fog_pcollector |
static PStatCollector | _draw_set_state_light_pcollector |
static PStatCollector | _draw_set_state_material_pcollector |
static PStatCollector | _draw_set_state_pcollector |
static PStatCollector | _draw_set_state_render_mode_pcollector |
static PStatCollector | _draw_set_state_rescale_normal_pcollector |
static PStatCollector | _draw_set_state_scissor_pcollector |
static PStatCollector | _draw_set_state_shade_model_pcollector |
static PStatCollector | _draw_set_state_shader_parameters_pcollector |
static PStatCollector | _draw_set_state_shader_pcollector |
static PStatCollector | _draw_set_state_stencil_pcollector |
static PStatCollector | _draw_set_state_tex_gen_pcollector |
static PStatCollector | _draw_set_state_tex_matrix_pcollector |
static PStatCollector | _draw_set_state_texture_pcollector |
static PStatCollector | _draw_set_state_transform_pcollector |
static PStatCollector | _flush_pcollector |
static PStatCollector | _index_buffer_switch_pcollector |
static PStatCollector | _load_index_buffer_pcollector |
static PStatCollector | _load_texture_pcollector |
static PStatCollector | _load_vertex_buffer_pcollector |
static PStatCollector | _prepare_geom_pcollector |
static PStatCollector | _prepare_index_buffer_pcollector |
static PStatCollector | _prepare_pcollector |
static PStatCollector | _prepare_sampler_pcollector |
static PStatCollector | _prepare_shader_pcollector |
static PStatCollector | _prepare_texture_pcollector |
static PStatCollector | _prepare_vertex_buffer_pcollector |
static PStatCollector | _primitive_batches_other_pcollector |
static PStatCollector | _primitive_batches_patch_pcollector |
static PStatCollector | _primitive_batches_pcollector |
static PStatCollector | _primitive_batches_tri_pcollector |
static PStatCollector | _primitive_batches_trifan_pcollector |
static PStatCollector | _primitive_batches_tristrip_pcollector |
static PStatCollector | _state_pcollector |
static PStatCollector | _texmgrmem_resident_pcollector |
static PStatCollector | _texmgrmem_total_pcollector |
static PStatCollector | _texture_state_pcollector |
static PStatCollector | _timer_queries_pcollector |
static PStatCollector | _transform_state_pcollector |
static PStatCollector | _vertex_buffer_switch_pcollector |
static PStatCollector | _vertices_indexed_tristrip_pcollector |
static PStatCollector | _vertices_other_pcollector |
static PStatCollector | _vertices_patch_pcollector |
static PStatCollector | _vertices_tri_pcollector |
static PStatCollector | _vertices_trifan_pcollector |
static PStatCollector | _vertices_tristrip_pcollector |
static PStatCollector | _wait_occlusion_pcollector |
static PStatCollector | _wait_timer_pcollector |
![]() | |
static TypedWritable *const | Null = (TypedWritable*)0L |
An interface to the TinyPanda software rendering code within this module.
TinyPanda takes its name from TinyGL, the public-domain software renderer (see http://fabrice.bellard.free.fr/TinyGL/ ) from which this code originated. It has since been heavily modified, to integrate it closely with Panda, and to add additional features such as blending, filtering, and multitexturing.
Definition at line 43 of file tinyGraphicsStateGuardian.h.
|
virtual |
Called before a sequence of draw_primitive() functions are called, this should prepare the vertex data for rendering.
It returns true if the vertices are ok, false to abort this group of primitives.
Reimplemented from GraphicsStateGuardian.
Definition at line 523 of file tinyGraphicsStateGuardian.cxx.
References GraphicsStateGuardian::begin_draw_primitives(), draw_triangles(), ColorWriteAttrib::get_channels(), ColorBlendAttrib::get_color(), GeomVertexReader::get_data3(), GeomVertexReader::get_data4(), DepthTestAttrib::get_mode(), AlphaTestAttrib::get_mode(), DepthWriteAttrib::get_mode(), ShadeModelAttrib::get_mode(), TransparencyAttrib::get_mode(), ColorBlendAttrib::get_mode(), ColorBlendAttrib::get_operand_a(), ColorBlendAttrib::get_operand_b(), AlphaTestAttrib::get_reference_alpha(), TextureStage::get_texcoord_name(), GeomVertexReader::has_column(), and GeomVertexReader::set_row_unsafe().
Referenced by end_frame().
|
virtual |
Called before each frame is rendered, to allow the GSG a chance to do any internal cleanup before beginning the frame.
The return value is true if successful (in which case the frame will be drawn and end_frame() will be called later), or false if unsuccessful (in which case nothing will be drawn and end_frame() will not be called).
Reimplemented from GraphicsStateGuardian.
Definition at line 386 of file tinyGraphicsStateGuardian.cxx.
References GraphicsStateGuardian::begin_frame(), and begin_scene().
Referenced by prepare_lens().
|
virtual |
Called between begin_frame() and end_frame() to mark the beginning of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame.
All 3-D drawing commands, except the clear operation, must be enclosed within begin_scene() .. end_scene().
The return value is true if successful (in which case the scene will be drawn and end_scene() will be called later), or false if unsuccessful (in which case nothing will be drawn and end_scene() will not be called).
Reimplemented from GraphicsStateGuardian.
Definition at line 428 of file tinyGraphicsStateGuardian.cxx.
References GraphicsStateGuardian::begin_scene(), and end_scene().
Referenced by begin_frame().
|
virtual |
Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties.
Reimplemented from GraphicsStateGuardian.
Definition at line 1890 of file tinyGraphicsStateGuardian.cxx.
References PointLight::get_attenuation(), PointLight::get_point(), PointLight::get_specular_color(), and NodePath::get_transform().
Referenced by bind_light(), and do_issue_light().
|
virtual |
Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties.
Reimplemented from GraphicsStateGuardian.
Definition at line 1945 of file tinyGraphicsStateGuardian.cxx.
References bind_light(), DirectionalLight::get_direction(), DirectionalLight::get_specular_color(), NodePath::get_transform(), and LVecBase3f::normalize().
|
virtual |
Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties.
Reimplemented from GraphicsStateGuardian.
Definition at line 2007 of file tinyGraphicsStateGuardian.cxx.
References Texture::generate_ram_mipmap_images(), Material::get_ambient(), Spotlight::get_attenuation(), Texture::get_border_color(), LMatrix4f::get_cell(), Texture::get_component_width(), Material::get_diffuse(), SamplerState::get_effective_magfilter(), SamplerState::get_effective_minfilter(), CullFaceAttrib::get_effective_mode(), Material::get_emission(), GraphicsOutput::get_engine(), Texture::get_expected_mipmap_x_size(), Texture::get_expected_mipmap_y_size(), Texture::get_expected_num_mipmap_levels(), Spotlight::get_exponent(), Texture::get_format(), ScissorAttrib::get_frame(), Lens::get_hfov(), LensNode::get_lens(), SamplerState::get_magfilter(), MaterialAttrib::get_material(), DepthOffsetAttrib::get_max_value(), DepthOffsetAttrib::get_min_value(), SamplerState::get_minfilter(), RescaleNormalAttrib::get_mode(), RenderModeAttrib::get_mode(), TextureStage::get_mode(), Lens::get_nodal_point(), Texture::get_num_components(), Texture::get_num_ram_mipmap_images(), DepthOffsetAttrib::get_offset(), Texture::get_quality_level(), Texture::get_ram_image_size(), Texture::get_ram_mipmap_image(), Texture::get_ram_mipmap_view_size(), Material::get_shininess(), Texture::get_simple_ram_image(), Texture::get_simple_ram_image_size(), Texture::get_simple_x_size(), Texture::get_simple_y_size(), Material::get_specular(), Spotlight::get_specular_color(), TextureStage::get_tex_view_offset(), TextureContext::get_texture(), NodePath::get_transform(), Texture::get_uncompressed_ram_image(), TextureContext::get_view(), Lens::get_view_vector(), SamplerState::get_wrap_u(), SamplerState::get_wrap_v(), Texture::get_x_size(), Texture::get_y_size(), Material::has_ambient(), Material::has_diffuse(), Texture::has_ram_image(), Texture::has_simple_ram_image(), SamplerState::is_mipmap(), PointerToVoid::is_null(), MaterialAttrib::is_off(), TextureContext::mark_loaded(), TextureContext::mark_simple_loaded(), Texture::might_have_ram_image(), LVecBase3f::normalize(), Texture::prepare_now(), BufferContext::set_active(), GraphicsEngine::texture_uploaded(), TextureContext::update_data_size_bytes(), SamplerState::uses_mipmaps(), TextureContext::was_simple_image_modified(), and LVecBase4f::zero().
|
virtual |
Clears the framebuffer within the current DisplayRegion, according to the flags indicated by the given DrawableRegion object.
This does not set the DisplayRegion first. You should call prepare_display_region() to specify the region you wish the clear operation to apply to.
Reimplemented from GraphicsStateGuardian.
Definition at line 222 of file tinyGraphicsStateGuardian.cxx.
References DrawableRegion::get_clear_color(), DrawableRegion::get_clear_color_active(), DrawableRegion::get_clear_depth_active(), DrawableRegion::get_clear_stencil_active(), prepare_display_region(), and LVecBase4f::zero().
Referenced by depth_offset_decals().
|
virtual |
This is called by the associated GraphicsWindow when close_window() is called.
It should null out the _win pointer and possibly free any open resources associated with the GSG.
Reimplemented from GraphicsStateGuardian.
Definition at line 176 of file tinyGraphicsStateGuardian.cxx.
References depth_offset_decals().
Referenced by free_pointers().
|
virtual |
Returns true if this GSG can implement decals using a DepthOffsetAttrib, or false if that is unreliable and the three-step rendering process should be used instead.
Reimplemented from GraphicsStateGuardian.
Definition at line 194 of file tinyGraphicsStateGuardian.cxx.
References clear().
Referenced by close_gsg().
|
virtual |
This implementation of do_issue_light() assumes we have a limited number of hardware lights available.
This function assigns each light to a different hardware light id, trying to keep each light associated with the same id where possible, but reusing id's when necessary. When it is no longer possible to reuse existing id's (e.g. all id's are in use), the next sequential id is assigned (if available).
It will call apply_light() each time a light is assigned to a particular id for the first time in a given frame, and it will subsequently call enable_light() to enable or disable each light as the frame is rendered, as well as enable_lighting() to enable or disable overall lighting.
Reimplemented from GraphicsStateGuardian.
Definition at line 1815 of file tinyGraphicsStateGuardian.cxx.
References PandaNode::as_light(), bind_light(), NodePath::is_empty(), and NodePath::node().
Referenced by release_texture().
|
virtual |
Draws a series of disconnected line segments.
Reimplemented from GraphicsStateGuardian.
Definition at line 1214 of file tinyGraphicsStateGuardian.cxx.
References draw_points().
Referenced by draw_tristrips().
|
virtual |
Draws a series of disconnected points.
Reimplemented from GraphicsStateGuardian.
Definition at line 1293 of file tinyGraphicsStateGuardian.cxx.
References end_draw_primitives().
Referenced by draw_lines().
|
virtual |
Draws a series of disconnected triangles.
Reimplemented from GraphicsStateGuardian.
Definition at line 987 of file tinyGraphicsStateGuardian.cxx.
References draw_tristrips().
Referenced by begin_draw_primitives().
|
virtual |
Draws a series of triangle strips.
Reimplemented from GraphicsStateGuardian.
Definition at line 1071 of file tinyGraphicsStateGuardian.cxx.
References draw_lines().
Referenced by draw_triangles().
|
virtual |
Called after a sequence of draw_primitive() functions are called, this should do whatever cleanup is appropriate.
Reimplemented from GraphicsStateGuardian.
Definition at line 1370 of file tinyGraphicsStateGuardian.cxx.
References GraphicsStateGuardian::end_draw_primitives(), and framebuffer_copy_to_texture().
Referenced by draw_points().
|
virtual |
Called after each frame is rendered, to allow the GSG a chance to do any internal cleanup after rendering the frame, and before the window flips.
Reimplemented from GraphicsStateGuardian.
Definition at line 475 of file tinyGraphicsStateGuardian.cxx.
References begin_draw_primitives(), and GraphicsStateGuardian::end_frame().
Referenced by end_scene().
|
virtual |
Called between begin_frame() and end_frame() to mark the end of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame.
All 3-D drawing commands, except the clear operation, must be enclosed within begin_scene() .. end_scene().
Reimplemented from GraphicsStateGuardian.
Definition at line 442 of file tinyGraphicsStateGuardian.cxx.
References end_frame(), and GraphicsStateGuardian::end_scene().
Referenced by begin_scene().
|
virtual |
Copy the pixels within the indicated display region from the framebuffer into system memory, not texture memory.
Returns true on success, false on failure.
This completely redefines the ram image of the indicated texture.
Reimplemented from GraphicsStateGuardian.
Definition at line 1450 of file tinyGraphicsStateGuardian.cxx.
References Texture::get_component_type(), Texture::get_expected_ram_page_size(), Texture::get_format(), Texture::get_ram_image_size(), DisplayRegion::get_region_pixels_i(), Texture::get_texture_type(), Texture::get_x_size(), Texture::get_y_size(), Texture::get_z_size(), Texture::modify_ram_image(), set_state_and_transform(), and Texture::setup_texture().
Referenced by framebuffer_copy_to_texture().
|
virtual |
Copy the pixels within the indicated display region from the framebuffer into texture memory.
If z > -1, it is the cube map index into which to copy.
Reimplemented from GraphicsStateGuardian.
Definition at line 1399 of file tinyGraphicsStateGuardian.cxx.
References AdaptiveLruPage::enqueue_lru(), framebuffer_copy_to_ram(), Texture::get_border_color(), DisplayRegion::get_region_pixels_i(), Texture::get_x_size(), Texture::get_y_size(), TextureContext::mark_loaded(), Texture::prepare_now(), Texture::setup_2d_texture(), TextureContext::update_data_size_bytes(), and LVecBase4f::zero().
Referenced by end_draw_primitives().
|
virtual |
Frees some memory that was explicitly allocated within the glgsg.
Reimplemented from GraphicsStateGuardian.
Definition at line 154 of file tinyGraphicsStateGuardian.cxx.
References close_gsg().
Referenced by reset().
|
virtual |
Prepare a display region for rendering (set up scissor region and viewport)
Reimplemented from GraphicsStateGuardian.
Definition at line 271 of file tinyGraphicsStateGuardian.cxx.
References LMatrix4f::convert_mat(), Lens::get_projection_mat(), DisplayRegionPipelineReader::get_region_pixels_i(), Lens::is_linear(), GraphicsStateGuardian::prepare_display_region(), prepare_lens(), and LMatrix4f::scale_mat().
Referenced by clear().
|
virtual |
Makes the current lens (whichever lens was most recently specified with set_scene()) active, so that it will transform future rendered geometry.
Normally this is only called from the draw process, and usually it is called by set_scene().
The return value is true if the lens is acceptable, false if it is not.
Reimplemented from GraphicsStateGuardian.
Definition at line 367 of file tinyGraphicsStateGuardian.cxx.
References begin_frame().
Referenced by prepare_display_region().
|
virtual |
Creates whatever structures the GSG requires to represent the texture internally, and returns a newly-allocated TextureContext object with this data.
It is the responsibility of the calling function to later call release_texture() with this same pointer (which will also delete the pointer).
This function should not be called directly to prepare a texture. Instead, call Texture::prepare().
Implements GraphicsStateGuardianBase.
Definition at line 1665 of file tinyGraphicsStateGuardian.cxx.
References Texture::get_texture_type(), and update_texture().
Referenced by set_state_and_transform().
|
virtual |
Frees the GL resources previously allocated for the texture.
This function should never be called directly; instead, call Texture::release() (or simply let the Texture destruct).
Reimplemented from GraphicsStateGuardian.
Definition at line 1802 of file tinyGraphicsStateGuardian.cxx.
References do_issue_light().
Referenced by update_texture().
|
virtual |
Resets all internal state as if the gsg were newly created.
Reimplemented from GraphicsStateGuardian.
Definition at line 93 of file tinyGraphicsStateGuardian.cxx.
References free_pointers(), and GraphicsStateGuardian::reset().
|
virtual |
Simultaneously resets the render state and the transform state.
This transform specified is the "internal" net transform, already converted into the GSG's internal coordinate space by composing it to get_cs_transform(). (Previously, this used to be the "external" net transform, with the assumption that that GSG would convert it internally, but that is no longer the case.)
Special case: if (state==NULL), then the target state is already stored in _target.
Reimplemented from GraphicsStateGuardian.
Definition at line 1544 of file tinyGraphicsStateGuardian.cxx.
References prepare_texture().
Referenced by framebuffer_copy_to_ram().
|
virtual |
Ensures that the current Texture data is refreshed onto the GSG.
This means updating the texture properties and/or re-uploading the texture image, if necessary. This should only be called within the draw thread.
If force is true, this function will not return until the texture has been fully uploaded. If force is false, the function may choose to upload a simple version of the texture instead, if the texture is not fully resident (and if get_incomplete_render() is true).
Reimplemented from GraphicsStateGuardian.
Definition at line 1714 of file tinyGraphicsStateGuardian.cxx.
References AdaptiveLruPage::enqueue_lru(), TextureContext::get_texture(), Texture::uses_mipmaps(), and TextureContext::was_image_modified().
Referenced by prepare_texture().
bool TinyGraphicsStateGuardian::update_texture | ( | TextureContext * | tc, |
bool | force, | ||
int | stage_index, | ||
bool | uses_mipmaps | ||
) |
Ensures that the current Texture data is refreshed onto the GSG.
This means updating the texture properties and/or re-uploading the texture image, if necessary. This should only be called within the draw thread.
If force is true, this function will not return until the texture has been fully uploaded. If force is false, the function may choose to upload a simple version of the texture instead, if the texture is not fully resident (and if get_incomplete_render() is true).
Definition at line 1753 of file tinyGraphicsStateGuardian.cxx.
References TextureContext::get_texture(), and release_texture().