Panda3D
|
Encapsulates all the communication with a particular instance of a given rendering backend. More...
#include "graphicsStateGuardian.h"
Public Types | |
enum | ShaderModel { SM_00, SM_11, SM_20, SM_2X, SM_30, SM_40 } |
typedef bool | TextureCallback (TextureContext *tc, void *callback_arg) |
Public Member Functions | |
GraphicsStateGuardian (CoordinateSystem internal_coordinate_system, GraphicsEngine *engine, GraphicsPipe *pipe) | |
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. | |
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. | |
virtual void | begin_occlusion_query () |
Begins a new occlusion query. | |
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. | |
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. | |
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. | |
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. | |
virtual void | clear (DrawableRegion *clearable) |
Clears the framebuffer within the current DisplayRegion, according to the flags indicated by the given DrawableRegion object. | |
virtual void | clear_before_callback () |
Resets any non-standard graphics state that might give a callback apoplexy. | |
void | clear_flash_texture () |
Resets the "flash texture", so that no textures will flash. | |
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. | |
virtual PN_stdfloat | compute_distance_to (const LPoint3 &point) const |
This function may only be called during a render traversal; it will compute the distance to the indicated point, assumed to be in eye coordinates, from the camera plane. | |
virtual | CPT (TransformState) calc_projection_mat(const Lens *lens) |
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 | |
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. | |
void | do_issue_clip_plane () |
This is fundametically similar to do_issue_light(), with calls to apply_clip_plane() and enable_clip_planes(), as appropriate. | |
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. | |
void | do_issue_color_scale () |
virtual void | do_issue_light () |
This implementation of do_issue_light() assumes we have a limited number of hardware lights available. | |
virtual bool | draw_lines (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected line segments. | |
virtual bool | draw_linestrips (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of line strips. | |
virtual bool | draw_points (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected points. | |
virtual bool | draw_triangles (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected triangles. | |
virtual bool | draw_trifans (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of triangle fans. | |
virtual bool | draw_tristrips (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of triangle strips. | |
virtual void | end_draw_primitives () |
Called after a sequence of draw_primitive() functions are called, this should do whatever cleanup is appropriate. | |
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. | |
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. | |
virtual bool | extract_texture_data (Texture *tex) |
This method should only be called by the GraphicsEngine. | |
const Shader::ShaderPtrData * | fetch_ptr_parameter (const Shader::ShaderPtrSpec &spec) |
Return a pointer to struct ShaderPtrData. | |
const LMatrix4 * | fetch_specified_part (Shader::ShaderMatInput input, InternalName *name, LMatrix4 &t) |
See fetch_specified_value. | |
const LMatrix4 * | fetch_specified_value (Shader::ShaderMatSpec &spec, int altered) |
The gsg contains a large number of useful matrices: | |
virtual void | finish_decal () |
Called during draw to clean up after decals are finished. | |
virtual TypeHandle | force_init_type () |
virtual bool | framebuffer_copy_to_ram (Texture *tex, 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. | |
virtual bool | framebuffer_copy_to_texture (Texture *tex, int z, const DisplayRegion *dr, const RenderBuffer &rb) |
Copy the pixels within the indicated display region from the framebuffer into texture memory. | |
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. | |
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. | |
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. | |
CoordinateSystem | get_coordinate_system () const |
Returns the coordinate system in effect on this particular gsg. | |
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. | |
virtual const TransformState * | get_cs_transform () const |
Returns a transform that converts from the GSG's external coordinate system (as returned by get_coordinate_system()) to its internal coordinate system (as returned by get_internal_coordinate_system()). | |
const DisplayRegion * | get_current_display_region () const |
Returns the current display region being rendered to, as set by the last call to prepare_display_region(). | |
const Lens * | get_current_lens () const |
Returns the current lens being used to render, according to the scene specified via the last call to set_scene(). | |
Lens::StereoChannel | get_current_stereo_channel () const |
Returns the current stereo channel being rendered to, as set by the last call to prepare_display_region(). | |
int | get_current_tex_view_offset () const |
Returns the current tex view offset, as set by the last call to prepare_display_region(). | |
virtual string | get_driver_renderer () |
Returns GL_Renderer. | |
virtual int | get_driver_shader_version_major () |
Returns the major version of the shader model. | |
virtual int | get_driver_shader_version_minor () |
Returns the minor version of the shader model. | |
virtual string | get_driver_vendor () |
Returns the vendor of the video card driver. | |
virtual string | get_driver_version () |
Returns driver version. | |
virtual int | get_driver_version_major () |
Returns major version of the video driver. | |
virtual int | get_driver_version_minor () |
Returns the minor version of the video driver. | |
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. | |
GraphicsEngine * | get_engine () const |
Returns the graphics engine that created this GSG. | |
Texture * | get_flash_texture () const |
Returns the current "flash texture", if any, or NULL if none. | |
PN_stdfloat | get_gamma (PN_stdfloat gamma) |
Get the current gamma setting. | |
virtual bool | get_incomplete_render () const |
Returns the incomplete_render flag. | |
virtual CoordinateSystem | get_internal_coordinate_system () const |
Returns the coordinate system used internally by the GSG. | |
const TransformState * | get_inv_cs_transform () const |
Returns the inverse of the transform returned by get_cs_transform(). | |
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. | |
int | get_max_2d_texture_array_layers () const |
Returns the largest possible number of pages, or -1 if there is no particular limit. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
int | get_max_vertex_transform_indices () const |
Returns the maximum number of transforms there may be in a single TransformTable for this graphics hardware. | |
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. | |
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. | |
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. | |
int | get_maximum_simultaneous_render_targets () const |
Returns the maximum simultaneous render targets supported. | |
GraphicsPipe * | get_pipe () const |
Returns the graphics pipe on which this GSG was created. | |
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). | |
RenderBuffer | get_render_buffer (int buffer_type, const FrameBufferProperties &prop) |
Returns a RenderBuffer object suitable for operating on the requested set of buffers. | |
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. | |
virtual SceneSetup * | get_scene () const |
Returns the current SceneSetup object. | |
int | get_shader_model () const |
Returns the ShaderModel. | |
virtual int | get_supported_geom_rendering () const |
Returns the union of Geom::GeomRendering values that this particular GSG can support directly. | |
bool | get_supports_2d_texture_array () const |
Returns true if this GSG can render 2-d textures array. | |
bool | get_supports_3d_texture () const |
Returns true if this GSG can render 3-d (volumetric) textures. | |
bool | get_supports_basic_shaders () const |
Returns true if this particular GSG supports arbfp1+arbvp1 or above. | |
virtual bool | get_supports_cg_profile (const string &name) const |
Returns true if this particular GSG supports the specified Cg Shader Profile. | |
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. | |
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. | |
bool | get_supports_cube_map () const |
Returns true if this GSG can render cube map textures. | |
bool | get_supports_depth_stencil () const |
Returns true if this particular GSG supports textures whose format is F_depth_stencil. | |
bool | get_supports_depth_texture () const |
Returns true if this particular GSG supports textures whose format is F_depth_stencil. | |
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. | |
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. | |
bool | get_supports_glsl () const |
Returns true if this particular GSG supports GLSL shaders. | |
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. | |
virtual bool | get_supports_occlusion_query () const |
Returns true if this GSG supports an occlusion query. | |
bool | get_supports_shadow_filter () const |
Returns true if this particular GSG supports the filter mode FT_shadow for depth textures. | |
bool | get_supports_stencil () const |
Returns true if this particular GSG supports stencil buffers at all. | |
bool | get_supports_tex_non_pow2 () const |
Returns true if this GSG can handle non power of two sized textures. | |
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(). | |
bool | get_supports_texture_dot3 () const |
Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes. | |
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. | |
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. | |
Texture::QualityLevel | get_texture_quality_override () const |
Returns the global quality_level override specified by set_texture_quality_override. | |
const GraphicsThreadingModel & | get_threading_model () const |
Returns the threading model that was used to create this GSG. | |
virtual TypeHandle | get_type () const |
bool | is_active () const |
Returns the active flag associated with the GraphicsStateGuardian. | |
bool | is_hardware () const |
Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software only. | |
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. | |
void | mark_new () |
Marks the GSG as "new", so that the next call to reset_if_new() will be effective. | |
bool | needs_reset () const |
Returns true if the gsg is marked as needing a reset. | |
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). | |
virtual void | prepare_display_region (DisplayRegionPipelineReader *dr) |
Makes the specified DisplayRegion current. | |
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). | |
virtual IndexBufferContext * | prepare_index_buffer (GeomPrimitive *data) |
Prepares the indicated buffer for retained-mode rendering. | |
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. | |
virtual ShaderContext * | prepare_shader (Shader *shader) |
Compile a vertex/fragment shader body. | |
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. | |
virtual VertexBufferContext * | prepare_vertex_buffer (GeomVertexArrayData *data) |
Prepares the indicated buffer for retained-mode rendering. | |
virtual | PT (OcclusionQueryContext) end_occlusion_query() |
virtual | PT (GeomMunger) get_geom_munger(const RenderState *state |
virtual | PT (GeomMunger) make_geom_munger(const RenderState *state |
virtual | PT (Texture) make_shadow_buffer(const NodePath &light_np |
void | release_all () |
Releases all prepared objects. | |
int | release_all_geoms () |
Frees the resources for all geoms associated with this GSG. | |
int | release_all_index_buffers () |
Frees the resources for all index buffers associated with this GSG. | |
int | release_all_textures () |
Frees the resources for all textures associated with this GSG. | |
int | release_all_vertex_buffers () |
Frees the resources for all vertex buffers associated with this GSG. | |
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. | |
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. | |
virtual void | release_shader (ShaderContext *sc) |
Releases the resources allocated by prepare_shader. | |
virtual void | release_texture (TextureContext *tc) |
Frees the resources previously allocated via a call to prepare_texture(), including deleting the TextureContext itself, if it is non-NULL. | |
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. | |
virtual void | remove_window (GraphicsOutputBase *window) |
This is simply a transparent call to GraphicsEngine::remove_window(). | |
virtual void | reset () |
Resets all internal state as if the gsg were newly created. | |
bool | reset_if_new () |
Calls reset() to initialize the GSG, but only if it hasn't been called yet. | |
virtual void | restore_gamma () |
Restore original gamma setting. | |
void | set_active (bool active) |
Sets the active flag associated with the GraphicsStateGuardian. | |
void | set_coordinate_system (CoordinateSystem cs) |
Changes the coordinate system in effect on this particular gsg. | |
void | set_current_properties (const FrameBufferProperties *properties) |
Notifies the gsg that it is about to render into a window/buffer with the given FrameBufferProperties. | |
void | set_flash_texture (Texture *tex) |
Sets the "flash texture". | |
virtual bool | set_gamma (PN_stdfloat gamma) |
Set gamma. | |
void | set_incomplete_render (bool incomplete_render) |
Sets the incomplete_render flag. | |
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. | |
bool | set_scene (SceneSetup *scene_setup) |
Sets the SceneSetup object that indicates the initial camera position, etc. | |
void | set_shader_model (int shader_model) |
Sets the ShaderModel. | |
virtual void | set_state_and_transform (const RenderState *state, const TransformState *transform) |
Simultaneously resets the render state and the transform state. | |
void | set_texture_quality_override (Texture::QualityLevel quality_level) |
Specifies the global quality_level to be imposed for all Textures rendered by this GSG. | |
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. | |
virtual bool | update_texture (TextureContext *tc, bool force) |
Ensures that the current Texture data is refreshed onto the GSG. | |
Static Public Member Functions | |
static void | create_gamma_table (PN_stdfloat gamma, unsigned short *red_table, unsigned short *green_table, unsigned short *blue_table) |
Create a gamma table. | |
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. | |
static TypeHandle | get_class_type () |
static void | init_type () |
Public Attributes | |
virtual Thread * | current_thread |
virtual GraphicsOutputBase * | host |
Static Public Attributes | |
static PStatCollector | _clear_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 | _primitive_batches_other_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 | _transform_state_pcollector |
static PStatCollector | _vertex_buffer_switch_pcollector |
static PStatCollector | _vertices_indexed_tristrip_pcollector |
static PStatCollector | _vertices_other_pcollector |
static PStatCollector | _vertices_tri_pcollector |
static PStatCollector | _vertices_trifan_pcollector |
static PStatCollector | _vertices_tristrip_pcollector |
static PStatCollector | _wait_occlusion_pcollector |
Protected Member Functions | |
void | async_reload_texture (TextureContext *tc) |
Should be called when a texture is encountered that needs to have its RAM image reloaded, and get_incomplete_render() is true. | |
virtual void | begin_bind_clip_planes () |
Called immediately before bind_clip_plane() is called, this is intended to provide the derived class a hook in which to set up some state (like transform) that might apply to several planes. | |
virtual void | begin_bind_lights () |
Called immediately before bind_light() is called, this is intended to provide the derived class a hook in which to set up some state (like transform) that might apply to several lights. | |
virtual void | bind_clip_plane (const NodePath &plane, int plane_id) |
Called the first time a particular clipping plane has been bound to a given id within a frame, this should set up the associated hardware (or API) clipping plane with the plane's properties. | |
virtual void | close_gsg () |
This is called by the associated GraphicsWindow when close_window() is called. | |
CPT (RenderState) _state_rs | |
CPT (RenderState) _target_rs | |
CPT (TransformState) _internal_transform | |
CPT (TextureAttrib) _target_texture | |
CPT (TextureAttrib) _state_texture | |
CPT (TexGenAttrib) _target_tex_gen | |
CPT (TexGenAttrib) _state_tex_gen | |
CPT (ShaderAttrib) _state_shader | |
CPT (ShaderAttrib) _target_shader | |
CPT (GeomMunger) _munger | |
CPT (DisplayRegion) _current_display_region | |
CPT (Lens) _current_lens | |
CPT (TransformState) _projection_mat | |
CPT (TransformState) _projection_mat_inv | |
CPT (TransformState) _cs_transform | |
CPT (TransformState) _inv_cs_transform | |
void | determine_light_color_scale () |
Called whenever the color or color scale is changed, if _color_scale_via_lighting is true. | |
void | determine_target_texture () |
Assigns _target_texture and _target_tex_gen based on the _target_rs. | |
virtual void | enable_clip_plane (int plane_id, bool enable) |
Intended to be overridden by a derived class to enable the indicated plane id. | |
virtual void | enable_clip_planes (bool enable) |
Intended to be overridden by a derived class to enable or disable the use of clipping planes overall. | |
virtual void | enable_light (int light_id, bool enable) |
Intended to be overridden by a derived class to enable the indicated light id. | |
virtual void | enable_lighting (bool enable) |
Intended to be overridden by a derived class to enable or disable the use of lighting overall. | |
virtual void | end_bind_clip_planes () |
Called after before bind_clip_plane() has been called one or more times (but before any geometry is issued or additional state is changed), this is intended to clean up any temporary changes to the state that may have been made by begin_bind_clip_planes(). | |
virtual void | end_bind_lights () |
Called after before bind_light() has been called one or more times (but before any geometry is issued or additional state is changed), this is intended to clean up any temporary changes to the state that may have been made by begin_bind_lights(). | |
virtual void | free_pointers () |
Frees some memory that was explicitly allocated within the glgsg. | |
void | panic_deactivate () |
This is called internally when it is determined that things are just fubar. | |
PT (SceneSetup) _scene_null | |
PT (SceneSetup) _scene_setup | |
PT (Loader) _loader | |
PT (PreparedGraphicsObjects) _prepared_objects | |
PT (OcclusionQueryContext) _current_occlusion_query | |
PT (Texture) _flash_texture | |
virtual void | reissue_transforms () |
Called by clear_state_and_transform() to ensure that the current modelview and projection matrices are properly loaded in the graphics state, after a callback might have mucked them up. | |
virtual void | set_ambient_light (const LColor &color) |
Intended to be overridden by a derived class to indicate the color of the ambient light that should be in effect. | |
Static Protected Member Functions | |
static | CPT (RenderState) get_unlit_state() |
static | CPT (RenderState) get_unclipped_state() |
static | CPT (RenderState) get_untextured_state() |
static | PT (TextureStage) _alpha_scale_texture_stage |
Protected Attributes | |
bool | _active |
bool | _alpha_scale_via_texture |
int | _auto_detect_shader_model |
bool | _clip_planes_enabled |
bool | _closing_gsg |
bool | _color_blend_involves_color_scale |
bool | _color_scale_enabled |
bool | _color_scale_via_lighting |
unsigned int | _color_write_mask |
BitMask32 | _compressed_texture_formats |
CoordinateSystem | _coordinate_system |
bool | _copy_texture_inverted |
LVecBase4 | _current_color_scale |
const FrameBufferProperties * | _current_properties |
Lens::StereoChannel | _current_stereo_channel |
int | _current_tex_view_offset |
const GeomVertexDataPipelineReader * | _data_reader |
bool | _effective_incomplete_render |
PN_stdfloat | _gamma |
bool | _has_material_force_color |
bool | _has_scene_graph_color |
bool | _has_texture_alpha_scale |
bool | _incomplete_render |
CoordinateSystem | _internal_coordinate_system |
RenderState::SlotMask | _inv_state_mask |
bool | _is_hardware |
bool | _is_valid |
int | _last_max_stage_index |
LVecBase4 | _light_color_scale |
bool | _lighting_enabled |
LColor | _material_force_color |
int | _max_2d_texture_array_layers |
int | _max_3d_texture_dimension |
int | _max_clip_planes |
int | _max_cube_map_dimension |
int | _max_lights |
int | _max_texture_dimension |
int | _max_texture_stages |
int | _max_vertex_transform_indices |
int | _max_vertex_transforms |
int | _max_vertices_per_array |
int | _max_vertices_per_primitive |
int | _maximum_simultaneous_render_targets |
bool | _needs_reset |
bool | _prefers_triangle_strips |
bool | _runtime_color_scale |
LColor | _scene_graph_color |
Shader::ShaderCaps | _shader_caps |
ShaderGenerator * | _shader_generator |
int | _shader_model |
RenderState::SlotMask | _state_mask |
StencilRenderStates * | _stencil_render_states |
int | _stereo_buffer_mask |
int | _supported_geom_rendering |
bool | _supports_2d_texture_array |
bool | _supports_3d_texture |
bool | _supports_basic_shaders |
bool | _supports_compressed_texture |
bool | _supports_cube_map |
bool | _supports_depth_stencil |
bool | _supports_depth_texture |
bool | _supports_framebuffer_blit |
bool | _supports_framebuffer_multisample |
bool | _supports_generate_mipmap |
bool | _supports_geometry_instancing |
bool | _supports_glsl |
bool | _supports_multisample |
bool | _supports_occlusion_query |
bool | _supports_shadow_filter |
bool | _supports_stencil |
bool | _supports_stencil_wrap |
bool | _supports_tex_non_pow2 |
bool | _supports_texture_combine |
bool | _supports_texture_dot3 |
bool | _supports_texture_saved_result |
bool | _supports_two_sided_stencil |
bool | _tex_gen_modifies_mat |
bool | _tex_gen_point_sprite |
bool | _texture_involves_color_scale |
Texture::QualityLevel | _texture_quality_override |
bool | _transform_stale |
bool | _vertex_colors_enabled |
Friends | |
class | GraphicsEngine |
class | GraphicsPipe |
class | GraphicsWindow |
Encapsulates all the communication with a particular instance of a given rendering backend.
Tries to guarantee that redundant state-change requests are not issued (hence "state guardian").
There will be one of these objects for each different graphics context active in the system.
Definition at line 67 of file graphicsStateGuardian.h.
void GraphicsStateGuardian::async_reload_texture | ( | TextureContext * | tc | ) | [protected] |
Should be called when a texture is encountered that needs to have its RAM image reloaded, and get_incomplete_render() is true.
This will fire off a thread on the current Loader object that will request the texture to load its image. The image will be available at some point in the future (no event will be generated).
Definition at line 2593 of file graphicsStateGuardian.cxx.
References AsyncTaskCollection::get_num_tasks(), AsyncTask::get_priority(), AsyncTaskCollection::get_task(), TextureContext::get_texture(), TypedObject::is_exact_type(), and AsyncTask::set_priority().
Referenced by DXGraphicsStateGuardian8::upload_texture(), and DXGraphicsStateGuardian9::upload_texture().
void GraphicsStateGuardian::begin_bind_clip_planes | ( | ) | [protected, virtual] |
Called immediately before bind_clip_plane() is called, this is intended to provide the derived class a hook in which to set up some state (like transform) that might apply to several planes.
The sequence is: begin_bind_clip_planes() will be called, then one or more bind_clip_plane() calls, then end_bind_clip_planes().
Definition at line 2376 of file graphicsStateGuardian.cxx.
Referenced by do_issue_clip_plane().
void GraphicsStateGuardian::begin_bind_lights | ( | ) | [protected, virtual] |
Called immediately before bind_light() is called, this is intended to provide the derived class a hook in which to set up some state (like transform) that might apply to several lights.
The sequence is: begin_bind_lights() will be called, then one or more bind_light() calls, then end_bind_lights().
Definition at line 2323 of file graphicsStateGuardian.cxx.
Referenced by do_issue_light().
bool GraphicsStateGuardian::begin_draw_primitives | ( | const GeomPipelineReader * | geom_reader, |
const GeomMunger * | munger, | ||
const GeomVertexDataPipelineReader * | data_reader, | ||
bool | force | ||
) | [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.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1677 of file graphicsStateGuardian.cxx.
Referenced by TinyGraphicsStateGuardian::begin_draw_primitives(), DXGraphicsStateGuardian8::begin_draw_primitives(), and DXGraphicsStateGuardian9::begin_draw_primitives().
bool GraphicsStateGuardian::begin_frame | ( | Thread * | current_thread | ) | [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 in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1459 of file graphicsStateGuardian.cxx.
References BitMask< WType, nbits >::clear().
Referenced by TinyGraphicsStateGuardian::begin_frame(), and DXGraphicsStateGuardian8::begin_frame().
void GraphicsStateGuardian::begin_occlusion_query | ( | ) | [virtual] |
Begins a new occlusion query.
After this call, you may call begin_draw_primitives() and draw_triangles()/draw_whatever() repeatedly. Eventually, you should call end_occlusion_query() before the end of the frame; that will return a new OcclusionQueryContext object that will tell you how many pixels represented by the bracketed geometry passed the depth test.
It is not valid to call begin_occlusion_query() between another begin_occlusion_query() .. end_occlusion_query() sequence.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9.
Definition at line 766 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::begin_scene | ( | ) | [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(). This must be called in the draw thread.
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 in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1491 of file graphicsStateGuardian.cxx.
Referenced by DXGraphicsStateGuardian8::begin_scene(), DXGraphicsStateGuardian9::begin_scene(), PipeOcclusionCullTraverser::set_scene(), and DisplayRegionDrawCallbackData::upcall().
void GraphicsStateGuardian::bind_clip_plane | ( | const NodePath & | plane, |
int | plane_id | ||
) | [protected, virtual] |
Called the first time a particular clipping plane has been bound to a given id within a frame, this should set up the associated hardware (or API) clipping plane with the plane's properties.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 2388 of file graphicsStateGuardian.cxx.
Referenced by do_issue_clip_plane().
void GraphicsStateGuardian::bind_light | ( | PointLight * | light_obj, |
const NodePath & | light, | ||
int | light_id | ||
) | [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 GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 2171 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::bind_light | ( | DirectionalLight * | light_obj, |
const NodePath & | light, | ||
int | light_id | ||
) | [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 GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 2183 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::bind_light | ( | Spotlight * | light_obj, |
const NodePath & | light, | ||
int | light_id | ||
) | [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 GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 2195 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::clear | ( | DrawableRegion * | clearable | ) | [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 in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1844 of file graphicsStateGuardian.cxx.
Referenced by TinyGraphicsBuffer::close_buffer().
void GraphicsStateGuardian::clear_before_callback | ( | ) | [virtual] |
Resets any non-standard graphics state that might give a callback apoplexy.
Some drivers require that the graphics state be restored to neutral before performing certain operations. In OpenGL, for instance, this closes any open vertex buffers.
Implements GraphicsStateGuardianBase.
Definition at line 1368 of file graphicsStateGuardian.cxx.
Resets the "flash texture", so that no textures will flash.
See set_flash_texture().
Definition at line 524 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::clear_state_and_transform | ( | ) | [virtual] |
Forgets the current graphics state and current transform, so that the next call to set_state_and_transform() will have to reload everything.
This is a good thing to call when you are no longer sure what the graphics state is. This should only be called from the draw thread.
Implements GraphicsStateGuardianBase.
Definition at line 1382 of file graphicsStateGuardian.cxx.
References BitMask< WType, nbits >::clear(), and reissue_transforms().
Referenced by DisplayRegionDrawCallbackData::upcall().
void GraphicsStateGuardian::close_gsg | ( | ) | [protected, 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 in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 2453 of file graphicsStateGuardian.cxx.
References free_pointers(), and Thread::get_current_thread().
Referenced by GraphicsPipe::close_gsg().
PN_stdfloat GraphicsStateGuardian::compute_distance_to | ( | const LPoint3 & | point | ) | const [virtual] |
This function may only be called during a render traversal; it will compute the distance to the indicated point, assumed to be in eye coordinates, from the camera plane.
Implements GraphicsStateGuardianBase.
Definition at line 860 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::create_gamma_table | ( | PN_stdfloat | gamma, |
unsigned short * | red_table, | ||
unsigned short * | green_table, | ||
unsigned short * | blue_table | ||
) | [static] |
Create a gamma table.
Definition at line 2236 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::depth_offset_decals | ( | ) | [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.
Implements GraphicsStateGuardianBase.
Reimplemented in TinyGraphicsStateGuardian.
Definition at line 1574 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::determine_light_color_scale | ( | ) | [protected] |
Called whenever the color or color scale is changed, if _color_scale_via_lighting is true.
This will rederive _material_force_color and _light_color_scale appropriately.
Definition at line 2513 of file graphicsStateGuardian.cxx.
Referenced by do_issue_color().
void GraphicsStateGuardian::determine_target_texture | ( | ) | [protected] |
Assigns _target_texture and _target_tex_gen based on the _target_rs.
Definition at line 2411 of file graphicsStateGuardian.cxx.
References TexturePool::get_alpha_scale_map(), get_alpha_scale_texture_stage(), and get_max_texture_stages().
Referenced by TinyGraphicsStateGuardian::set_state_and_transform(), DXGraphicsStateGuardian8::set_state_and_transform(), and DXGraphicsStateGuardian9::set_state_and_transform().
This is fundametically similar to do_issue_light(), with calls to apply_clip_plane() and enable_clip_planes(), as appropriate.
Definition at line 1882 of file graphicsStateGuardian.cxx.
References begin_bind_clip_planes(), bind_clip_plane(), enable_clip_plane(), enable_clip_planes(), end_bind_clip_planes(), ClipPlaneAttrib::get_num_on_planes(), NodePath::is_empty(), and NodePath::node().
Referenced by DXGraphicsStateGuardian8::set_state_and_transform(), and DXGraphicsStateGuardian9::set_state_and_transform().
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.
The ColorAttribute just changes the interpretation of the color on the vertices, and fiddles with _vertex_colors_enabled, etc.
Definition at line 1945 of file graphicsStateGuardian.cxx.
References BitMask< WType, nbits >::clear_bit(), determine_light_color_scale(), ColorAttrib::get_color(), and ColorAttrib::get_color_type().
Referenced by TinyGraphicsStateGuardian::set_state_and_transform(), DXGraphicsStateGuardian8::set_state_and_transform(), and DXGraphicsStateGuardian9::set_state_and_transform().
void GraphicsStateGuardian::do_issue_light | ( | ) | [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 in TinyGraphicsStateGuardian.
Definition at line 2044 of file graphicsStateGuardian.cxx.
References PandaNode::as_light(), begin_bind_lights(), enable_light(), enable_lighting(), end_bind_lights(), NodePath::is_empty(), NodePath::node(), and set_ambient_light().
Referenced by DXGraphicsStateGuardian8::set_state_and_transform(), and DXGraphicsStateGuardian9::set_state_and_transform().
bool GraphicsStateGuardian::draw_lines | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of disconnected line segments.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1722 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::draw_linestrips | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of line strips.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 1732 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::draw_points | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of disconnected points.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1742 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::draw_triangles | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of disconnected triangles.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1692 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::draw_trifans | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of triangle fans.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 1712 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::draw_tristrips | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of triangle strips.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1702 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::enable_clip_plane | ( | int | plane_id, |
bool | enable | ||
) | [protected, virtual] |
Intended to be overridden by a derived class to enable the indicated plane id.
A specific PlaneNode will already have been bound to this id via bind_clip_plane().
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 2360 of file graphicsStateGuardian.cxx.
Referenced by do_issue_clip_plane(), and end_scene().
void GraphicsStateGuardian::enable_clip_planes | ( | bool | enable | ) | [protected, virtual] |
Intended to be overridden by a derived class to enable or disable the use of clipping planes overall.
This is called by do_issue_clip_plane() according to whether any planes are in use or not.
Definition at line 2348 of file graphicsStateGuardian.cxx.
Referenced by do_issue_clip_plane().
void GraphicsStateGuardian::enable_light | ( | int | light_id, |
bool | enable | ||
) | [protected, virtual] |
Intended to be overridden by a derived class to enable the indicated light id.
A specific Light will already have been bound to this id via bind_light().
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 2307 of file graphicsStateGuardian.cxx.
Referenced by do_issue_light(), and end_scene().
void GraphicsStateGuardian::enable_lighting | ( | bool | enable | ) | [protected, virtual] |
Intended to be overridden by a derived class to enable or disable the use of lighting overall.
This is called by do_issue_light() according to whether any lights are in use or not.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 2284 of file graphicsStateGuardian.cxx.
Referenced by do_issue_light().
void GraphicsStateGuardian::end_bind_clip_planes | ( | ) | [protected, virtual] |
Called after before bind_clip_plane() has been called one or more times (but before any geometry is issued or additional state is changed), this is intended to clean up any temporary changes to the state that may have been made by begin_bind_clip_planes().
Definition at line 2401 of file graphicsStateGuardian.cxx.
Referenced by do_issue_clip_plane().
void GraphicsStateGuardian::end_bind_lights | ( | ) | [protected, virtual] |
Called after before bind_light() has been called one or more times (but before any geometry is issued or additional state is changed), this is intended to clean up any temporary changes to the state that may have been made by begin_bind_lights().
Definition at line 2336 of file graphicsStateGuardian.cxx.
Referenced by do_issue_light().
void GraphicsStateGuardian::end_draw_primitives | ( | ) | [virtual] |
Called after a sequence of draw_primitive() functions are called, this should do whatever cleanup is appropriate.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1754 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::end_frame | ( | Thread * | current_thread | ) | [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 in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1540 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::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 in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1505 of file graphicsStateGuardian.cxx.
References BitMask< WType, nbits >::clear(), enable_clip_plane(), and enable_light().
Referenced by PipeOcclusionCullTraverser::end_traverse(), and DisplayRegionDrawCallbackData::upcall().
bool GraphicsStateGuardian::extract_texture_data | ( | Texture * | tex | ) | [virtual] |
This method should only be called by the GraphicsEngine.
Do not call it directly; call GraphicsEngine::extract_texture_data() instead.
This method will be called in the draw thread to download the texture memory's image into its ram_image value. It returns true on success, false otherwise.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 640 of file graphicsStateGuardian.cxx.
Referenced by GraphicsEngine::extract_texture_data().
const Shader::ShaderPtrData * GraphicsStateGuardian::fetch_ptr_parameter | ( | const Shader::ShaderPtrSpec & | spec | ) |
Return a pointer to struct ShaderPtrData.
Definition at line 1300 of file graphicsStateGuardian.cxx.
const LMatrix4 * GraphicsStateGuardian::fetch_specified_part | ( | Shader::ShaderMatInput | input, |
InternalName * | name, | ||
LMatrix4 & | t | ||
) |
See fetch_specified_value.
Definition at line 971 of file graphicsStateGuardian.cxx.
References LMatrix4f::convert_mat(), Material::get_ambient(), SceneSetup::get_camera_transform(), ColorAttrib::get_color(), ColorAttrib::get_color_type(), LVecBase4f::get_data(), Material::get_diffuse(), Material::get_emission(), FogAttrib::get_fog(), TexMatrixAttrib::get_mat(), TransformState::get_mat(), NodePath::get_mat(), MaterialAttrib::get_material(), InternalName::get_name(), ClipPlaneAttrib::get_num_on_planes(), ClipPlaneAttrib::get_on_plane(), Texture::get_pad_x_size(), Texture::get_pad_y_size(), Texture::get_pad_z_size(), ColorScaleAttrib::get_scale(), get_scene(), Material::get_shininess(), Material::get_specular(), PandaNode::get_transform(), SceneSetup::get_world_transform(), Texture::get_x_size(), Texture::get_y_size(), Texture::get_z_size(), LMatrix4f::ident_mat(), LMatrix4f::invert_from(), NodePath::is_empty(), ColorScaleAttrib::is_identity(), TypedObject::is_of_type(), MaterialAttrib::is_off(), NodePath::node(), LVecBase3f::normalize(), LMatrix4f::ones_mat(), LMatrix4f::translate_mat(), LMatrix4f::xform_point(), LMatrix4f::xform_vec(), and LMatrix4f::zeros_mat().
Referenced by fetch_specified_value().
const LMatrix4 * GraphicsStateGuardian::fetch_specified_value | ( | Shader::ShaderMatSpec & | spec, |
int | altered | ||
) |
The gsg contains a large number of useful matrices:
the world transform, the modelview matrix, the cs_transform, etc, etc.
A shader can request any of these values, and furthermore, it can request that various compositions, inverses, and transposes be performed. The ShaderMatSpec is a data structure indicating what datum is desired and what conversions to perform. This routine, fetch_specified_value, is responsible for doing the actual retrieval and conversions.
Some values, like the following, aren't matrices:
window size texture coordinates of card center
This routine can fetch these values as well, by shoehorning them into a matrix. In this way, we avoid the need for a separate routine to fetch these values.
The "altered" bits indicate what parts of the state_and_transform have changed since the last time this particular ShaderMatSpec was evaluated. This may allow data to be cached and not reevaluated.
Definition at line 916 of file graphicsStateGuardian.cxx.
References fetch_specified_part(), LMatrix4f::get_row3(), LMatrix4f::ident_mat(), LVecBase3f::normalize(), LMatrix4f::set_row(), LMatrix4f::xform_point(), and LMatrix4f::xform_vec().
void GraphicsStateGuardian::finish_decal | ( | ) | [virtual] |
Called during draw to clean up after decals are finished.
Implements GraphicsStateGuardianBase.
Definition at line 1664 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::framebuffer_copy_to_ram | ( | Texture * | tex, |
int | z, | ||
const DisplayRegion * | dr, | ||
const RenderBuffer & | rb | ||
) | [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.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 2157 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::framebuffer_copy_to_texture | ( | Texture * | tex, |
int | z, | ||
const DisplayRegion * | dr, | ||
const RenderBuffer & | rb | ||
) | [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.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 2140 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::free_pointers | ( | ) | [protected, virtual] |
Frees some memory that was explicitly allocated within the glgsg.
Reimplemented in TinyGraphicsStateGuardian.
Definition at line 2441 of file graphicsStateGuardian.cxx.
Referenced by close_gsg().
TextureStage * GraphicsStateGuardian::get_alpha_scale_texture_stage | ( | ) | [inline, static] |
Returns the TextureStage that will be used to apply an alpha scale, if get_alpha_scale_via_texture() returns true.
Definition at line 769 of file graphicsStateGuardian.I.
Referenced by determine_target_texture().
bool GraphicsStateGuardian::get_alpha_scale_via_texture | ( | ) | const [inline] |
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.
Definition at line 740 of file graphicsStateGuardian.I.
Referenced by StandardMunger::StandardMunger().
bool GraphicsStateGuardian::get_alpha_scale_via_texture | ( | const TextureAttrib * | tex_attrib | ) | const [inline] |
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.
This considers whether there is at least one additional texture slot available on the GSG.
Definition at line 755 of file graphicsStateGuardian.I.
References get_max_texture_stages().
bool GraphicsStateGuardian::get_color_scale_via_lighting | ( | ) | const [inline] |
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.
Definition at line 727 of file graphicsStateGuardian.I.
Referenced by StandardMunger::StandardMunger().
CoordinateSystem GraphicsStateGuardian::get_coordinate_system | ( | ) | const [inline] |
Returns the coordinate system in effect on this particular gsg.
Normally, this will be the default coordinate system, but it might be set differently at runtime.
Definition at line 799 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_copy_texture_inverted | ( | ) | const [inline] |
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.
If this is true, then on offscreen GraphicsBuffer created for the purposes of rendering into a texture should be created with the invert flag set true, to compensate. Panda will do this automatically if you create an offscreen buffer using GraphicsOutput::make_texture_buffer().
Definition at line 563 of file graphicsStateGuardian.I.
References ConfigVariableBase::has_value().
Referenced by ParasiteBuffer::ParasiteBuffer().
const TransformState * GraphicsStateGuardian::get_cs_transform | ( | ) | const [virtual] |
Returns a transform that converts from the GSG's external coordinate system (as returned by get_coordinate_system()) to its internal coordinate system (as returned by get_internal_coordinate_system()).
This is used for rendering.
Implements GraphicsStateGuardianBase.
Definition at line 1870 of file graphicsStateGuardian.cxx.
Referenced by SpeedTreeNode::cull_callback().
const DisplayRegion * GraphicsStateGuardian::get_current_display_region | ( | ) | const [inline] |
Returns the current display region being rendered to, as set by the last call to prepare_display_region().
Definition at line 897 of file graphicsStateGuardian.I.
const Lens * GraphicsStateGuardian::get_current_lens | ( | ) | const [inline] |
Returns the current lens being used to render, according to the scene specified via the last call to set_scene().
Definition at line 932 of file graphicsStateGuardian.I.
Lens::StereoChannel GraphicsStateGuardian::get_current_stereo_channel | ( | ) | const [inline] |
Returns the current stereo channel being rendered to, as set by the last call to prepare_display_region().
Definition at line 908 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_current_tex_view_offset | ( | ) | const [inline] |
Returns the current tex view offset, as set by the last call to prepare_display_region().
This is read from the current DisplayRegion.
Definition at line 920 of file graphicsStateGuardian.I.
string GraphicsStateGuardian::get_driver_renderer | ( | ) | [virtual] |
Returns GL_Renderer.
Definition at line 2739 of file graphicsStateGuardian.cxx.
int GraphicsStateGuardian::get_driver_shader_version_major | ( | ) | [virtual] |
Returns the major version of the shader model.
Definition at line 2779 of file graphicsStateGuardian.cxx.
int GraphicsStateGuardian::get_driver_shader_version_minor | ( | ) | [virtual] |
Returns the minor version of the shader model.
Definition at line 2789 of file graphicsStateGuardian.cxx.
string GraphicsStateGuardian::get_driver_vendor | ( | ) | [virtual] |
Returns the vendor of the video card driver.
Definition at line 2730 of file graphicsStateGuardian.cxx.
string GraphicsStateGuardian::get_driver_version | ( | ) | [virtual] |
Returns driver version.
Definition at line 2749 of file graphicsStateGuardian.cxx.
int GraphicsStateGuardian::get_driver_version_major | ( | ) | [virtual] |
Returns major version of the video driver.
Definition at line 2759 of file graphicsStateGuardian.cxx.
int GraphicsStateGuardian::get_driver_version_minor | ( | ) | [virtual] |
Returns the minor version of the video driver.
Definition at line 2769 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::get_effective_incomplete_render | ( | ) | const [inline, virtual] |
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.
It only makes sense to call this during the draw traversal; at other times this return value will be meaningless.
See CullTraverser::get_effective_incomplete_render() for this same information during the cull traversal.
Implements GraphicsStateGuardianBase.
Definition at line 178 of file graphicsStateGuardian.I.
GraphicsEngine * GraphicsStateGuardian::get_engine | ( | ) | const |
Returns the graphics engine that created this GSG.
Since there is normally only one GraphicsEngine object in an application, this is usually the same as the global GraphicsEngine.
Definition at line 284 of file graphicsStateGuardian.cxx.
Referenced by NonlinearImager::add_viewer(), DXTextureContext8::create_texture(), DXTextureContext9::create_texture(), GraphicsEngine::make_output(), GraphicsOutput::make_texture_buffer(), DXGraphicsStateGuardian8::reset_d3d_device(), and DXGraphicsStateGuardian9::reset_d3d_device().
Texture * GraphicsStateGuardian::get_flash_texture | ( | ) | const |
Returns the current "flash texture", if any, or NULL if none.
See set_flash_texture().
Definition at line 537 of file graphicsStateGuardian.cxx.
PN_stdfloat GraphicsStateGuardian::get_gamma | ( | PN_stdfloat | gamma | ) |
Get the current gamma setting.
Definition at line 416 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::get_incomplete_render | ( | ) | const [inline, virtual] |
Returns the incomplete_render flag.
Implements GraphicsStateGuardianBase.
Definition at line 160 of file graphicsStateGuardian.I.
CoordinateSystem GraphicsStateGuardian::get_internal_coordinate_system | ( | ) | const [virtual] |
Returns the coordinate system used internally by the GSG.
This may be the same as the external coordinate system reported by get_coordinate_system(), or it may be something different.
In any case, vertices that have been transformed before being handed to the GSG (that is, vertices with a contents value of C_clip_point) will be expected to be in this coordinate system.
Implements GraphicsStateGuardianBase.
Definition at line 382 of file graphicsStateGuardian.cxx.
Referenced by SpeedTreeNode::cull_callback().
const TransformState * GraphicsStateGuardian::get_inv_cs_transform | ( | ) | const [inline] |
Returns the inverse of the transform returned by get_cs_transform().
Definition at line 943 of file graphicsStateGuardian.I.
Loader * GraphicsStateGuardian::get_loader | ( | ) | const [inline] |
Returns the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true.
Definition at line 202 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_2d_texture_array_layers | ( | ) | const [inline] |
Returns the largest possible number of pages, or -1 if there is no particular limit.
Returns 0 if 2-d texture arrays not supported.
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Definition at line 346 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_3d_texture_dimension | ( | ) | const [inline] |
Returns the largest possible texture size in any one dimension for a 3-d texture, or -1 if there is no particular limit.
Returns 0 if 3-d textures are not supported.
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Definition at line 330 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_clip_planes | ( | ) | const [inline] |
Returns the maximum number of simultaneous clip planes that may be applied to geometry, or -1 if there is no particular limit.
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Definition at line 503 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_cube_map_dimension | ( | ) | const [inline] |
Returns the largest possible texture size in any one dimension for a cube map texture, or -1 if there is no particular limit.
Returns 0 if cube map textures are not supported.
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Definition at line 363 of file graphicsStateGuardian.I.
Referenced by GraphicsOutput::make_cube_map().
int GraphicsStateGuardian::get_max_lights | ( | ) | const [inline] |
Returns the maximum number of simultaneous lights that may be rendered on geometry, or -1 if there is no particular limit.
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Definition at line 487 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_texture_dimension | ( | ) | const [inline, virtual] |
Returns the largest possible texture size in any one dimension supported by the GSG, or -1 if there is no particular limit.
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Implements GraphicsStateGuardianBase.
Definition at line 313 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_texture_stages | ( | ) | const [inline] |
Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturing, as supported by this particular GSG.
If you exceed this number, the lowest-priority texture stages will not be applied. Use TextureStage::set_priority() to adjust the relative importance of the different texture stages.
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Definition at line 294 of file graphicsStateGuardian.I.
Referenced by determine_target_texture(), and get_alpha_scale_via_texture().
int GraphicsStateGuardian::get_max_vertex_transform_indices | ( | ) | const [inline] |
Returns the maximum number of transforms there may be in a single TransformTable for this graphics hardware.
If this number is 0 (but get_max_transforms() is nonzero), then the graphics hardware (or API) doesn't support indexed transforms, but can support direct transform references.
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Definition at line 541 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_vertex_transforms | ( | ) | const [inline] |
Returns the maximum number of transform matrices that may be simultaneously used to transform any one vertex by the graphics hardware.
If this number is 0, then the hardware (or the graphics backend) doesn't support soft-skinned vertices (in which case Panda will animate the vertices in software).
The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).
Definition at line 522 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_vertices_per_array | ( | ) | const [inline, virtual] |
Returns the maximum number of vertices that should be put into any one GeomVertexData object for use with this GSG.
Implements GraphicsStateGuardianBase.
Definition at line 262 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_max_vertices_per_primitive | ( | ) | const [inline, virtual] |
Returns the maximum number of vertex indices that should be put into any one GeomPrimitive object for use with this GSG.
Implements GraphicsStateGuardianBase.
Definition at line 274 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_maximum_simultaneous_render_targets | ( | ) | const [inline] |
Returns the maximum simultaneous render targets supported.
Definition at line 690 of file graphicsStateGuardian.I.
GraphicsPipe * GraphicsStateGuardian::get_pipe | ( | ) | const [inline] |
Returns the graphics pipe on which this GSG was created.
Definition at line 213 of file graphicsStateGuardian.I.
Referenced by GraphicsEngine::make_buffer(), GraphicsEngine::make_output(), wdxGraphicsWindow9::open_window(), and wdxGraphicsWindow8::open_window().
PreparedGraphicsObjects * GraphicsStateGuardian::get_prepared_objects | ( | ) | [virtual] |
Returns the set of texture and geom objects that have been prepared with this GSG (and possibly other GSG's that share objects).
Implements GraphicsStateGuardianBase.
Definition at line 394 of file graphicsStateGuardian.cxx.
Referenced by DXGraphicsStateGuardian8::begin_draw_primitives(), DXGraphicsStateGuardian8::draw_lines(), DXGraphicsStateGuardian9::draw_lines(), DXGraphicsStateGuardian8::draw_triangles(), DXGraphicsStateGuardian9::draw_triangles(), DXGraphicsStateGuardian8::draw_trifans(), DXGraphicsStateGuardian9::draw_trifans(), DXGraphicsStateGuardian8::draw_tristrips(), DXGraphicsStateGuardian9::draw_tristrips(), DXGraphicsStateGuardian8::extract_texture_data(), DXGraphicsStateGuardian9::extract_texture_data(), TinyGraphicsStateGuardian::framebuffer_copy_to_texture(), DXGraphicsStateGuardian8::framebuffer_copy_to_texture(), DXGraphicsStateGuardian9::framebuffer_copy_to_texture(), GraphicsOutput::make_texture_buffer(), and GraphicsEngine::remove_window().
RenderBuffer GraphicsStateGuardian::get_render_buffer | ( | int | buffer_type, |
const FrameBufferProperties & | prop | ||
) |
Returns a RenderBuffer object suitable for operating on the requested set of buffers.
buffer_type is the union of all the desired RenderBuffer::Type values.
Definition at line 1855 of file graphicsStateGuardian.cxx.
References FrameBufferProperties::get_buffer_mask().
bool GraphicsStateGuardian::get_runtime_color_scale | ( | ) | const [inline] |
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.
Definition at line 786 of file graphicsStateGuardian.I.
Referenced by StandardMunger::StandardMunger().
SceneSetup * GraphicsStateGuardian::get_scene | ( | ) | const [virtual] |
Returns the current SceneSetup object.
Implements GraphicsStateGuardianBase.
Definition at line 573 of file graphicsStateGuardian.cxx.
Referenced by fetch_specified_part().
int GraphicsStateGuardian::get_shader_model | ( | ) | const [inline] |
Returns the ShaderModel.
Definition at line 700 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::get_supported_geom_rendering | ( | ) | const [virtual] |
Returns the union of Geom::GeomRendering values that this particular GSG can support directly.
If a Geom needs to be rendered that requires some additional properties, the StandardMunger and/or the CullableObject will convert it as needed.
This method is declared virtual solely so that it can be queried from cullableObject.cxx.
Implements GraphicsStateGuardianBase.
Definition at line 320 of file graphicsStateGuardian.cxx.
Referenced by StandardMunger::munge_geom_impl(), and StandardMunger::premunge_geom_impl().
bool GraphicsStateGuardian::get_supports_2d_texture_array | ( | ) | const [inline] |
Returns true if this GSG can render 2-d textures array.
Definition at line 425 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_3d_texture | ( | ) | const [inline] |
Returns true if this GSG can render 3-d (volumetric) textures.
Definition at line 414 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_basic_shaders | ( | ) | const [inline] |
Returns true if this particular GSG supports arbfp1+arbvp1 or above.
Definition at line 632 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_cg_profile | ( | const string & | name | ) | const [virtual] |
Returns true if this particular GSG supports the specified Cg Shader Profile.
Reimplemented in DXGraphicsStateGuardian9.
Definition at line 331 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::get_supports_compressed_texture | ( | ) | const [inline] |
Returns true if this GSG can compress textures as it loads them into texture memory, and/or accept pre-compressed textures for storing.
Definition at line 458 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_compressed_texture_format | ( | int | compression_mode | ) | const [inline, virtual] |
Returns true if this GSG can accept textures pre-compressed in the indicated format.
compression_mode may be any of the Texture::CompressionMode enums.
Implements GraphicsStateGuardianBase.
Definition at line 471 of file graphicsStateGuardian.I.
References BitMask< WType, nbits >::get_bit().
Referenced by DXGraphicsStateGuardian8::prepare_texture(), DXGraphicsStateGuardian9::prepare_texture(), DXGraphicsStateGuardian8::upload_texture(), and DXGraphicsStateGuardian9::upload_texture().
bool GraphicsStateGuardian::get_supports_cube_map | ( | ) | const [inline] |
Returns true if this GSG can render cube map textures.
Definition at line 435 of file graphicsStateGuardian.I.
Referenced by GraphicsOutput::make_cube_map().
bool GraphicsStateGuardian::get_supports_depth_stencil | ( | ) | const [inline] |
Returns true if this particular GSG supports textures whose format is F_depth_stencil.
This only returns true if the GSG supports the full packed depth-stencil functionality.
Definition at line 610 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_depth_texture | ( | ) | const [inline] |
Returns true if this particular GSG supports textures whose format is F_depth_stencil.
This returns true if the GSG supports GL_DEPTH_COMPONENT textures, which are considered a limited but still valid case of F_depth_stencil.
Definition at line 597 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_generate_mipmap | ( | ) | const [inline] |
Returns true if this particular GSG can generate mipmaps for a texture automatically, or if they must be generated in software.
If this is true, then mipmaps can safely be enabled for rendered textures (e.g. using the MultitexReducer).
Definition at line 583 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_geometry_instancing | ( | ) | const [inline] |
Returns true if this particular GSG supports hardware geometry instancing: the ability to render multiple copies of a model.
In OpenGL, this is done using the EXT_draw_instanced extension.
Definition at line 679 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_glsl | ( | ) | const [inline] |
Returns true if this particular GSG supports GLSL shaders.
Definition at line 643 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_multisample | ( | ) | const [virtual] |
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.
If this is not true for a particular GSG, Panda will map the M_multisample modes to M_binary.
This method is declared virtual solely so that it can be queried from cullResult.cxx.
Implements GraphicsStateGuardianBase.
Definition at line 303 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::get_supports_occlusion_query | ( | ) | const [virtual] |
Returns true if this GSG supports an occlusion query.
If this is true, then begin_occlusion_query() and end_occlusion_query() may be called to bracket a sequence of draw_triangles() (or whatever) calls to measure pixels that pass the depth test.
Implements GraphicsStateGuardianBase.
Definition at line 745 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::get_supports_shadow_filter | ( | ) | const [inline, virtual] |
Returns true if this particular GSG supports the filter mode FT_shadow for depth textures.
Implements GraphicsStateGuardianBase.
Definition at line 621 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_stencil | ( | ) | const [inline] |
Returns true if this particular GSG supports stencil buffers at all.
Definition at line 654 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_tex_non_pow2 | ( | ) | const [inline] |
Returns true if this GSG can handle non power of two sized textures.
Definition at line 446 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_texture_combine | ( | ) | const [inline] |
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().
If this is false, you must limit yourself to using the simpler blend modes.
Definition at line 378 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_texture_dot3 | ( | ) | const [inline] |
Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes.
Definition at line 403 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_texture_saved_result | ( | ) | const [inline] |
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.
Definition at line 391 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::get_supports_two_sided_stencil | ( | ) | const [inline] |
Returns true if this particular GSG supports two sided stencil: different stencil settings for the front and back side of the same polygon.
Definition at line 666 of file graphicsStateGuardian.I.
Texture::QualityLevel GraphicsStateGuardian::get_texture_quality_override | ( | ) | const [inline] |
Returns the global quality_level override specified by set_texture_quality_override.
This is mainly useful for the tinydisplay software renderer. See Texture::set_quality_level().
Definition at line 831 of file graphicsStateGuardian.I.
const GraphicsThreadingModel & GraphicsStateGuardian::get_threading_model | ( | ) | const [inline] |
Returns the threading model that was used to create this GSG.
Definition at line 224 of file graphicsStateGuardian.I.
Referenced by GraphicsEngine::extract_texture_data(), and GraphicsEngine::make_output().
bool GraphicsStateGuardian::is_active | ( | ) | const [inline] |
Returns the active flag associated with the GraphicsStateGuardian.
Definition at line 93 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::is_hardware | ( | ) | const [inline] |
Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software only.
Definition at line 236 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::is_valid | ( | ) | const [inline] |
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.
Definition at line 106 of file graphicsStateGuardian.I.
Referenced by GraphicsEngine::make_output(), and TinyGraphicsBuffer::open_buffer().
void GraphicsStateGuardian::mark_new | ( | ) | [inline] |
Marks the GSG as "new", so that the next call to reset_if_new() will be effective.
Definition at line 858 of file graphicsStateGuardian.I.
Referenced by DXGraphicsStateGuardian8::reset_d3d_device(), and DXGraphicsStateGuardian9::reset_d3d_device().
bool GraphicsStateGuardian::needs_reset | ( | ) | const [inline] |
Returns true if the gsg is marked as needing a reset.
Definition at line 117 of file graphicsStateGuardian.I.
Referenced by GraphicsEngine::make_output().
void GraphicsStateGuardian::panic_deactivate | ( | ) | [protected] |
This is called internally when it is determined that things are just fubar.
It temporarily deactivates the GSG just so things don't get out of hand, and throws an event so the application can deal with this if it needs to.
Definition at line 2495 of file graphicsStateGuardian.cxx.
References set_active().
bool GraphicsStateGuardian::prefers_triangle_strips | ( | ) | const [inline, virtual] |
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).
Implements GraphicsStateGuardianBase.
Definition at line 250 of file graphicsStateGuardian.I.
void GraphicsStateGuardian::prepare_display_region | ( | DisplayRegionPipelineReader * | dr | ) | [virtual] |
Makes the specified DisplayRegion current.
All future drawing and clear operations will be constrained within the given DisplayRegion.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1312 of file graphicsStateGuardian.cxx.
References GraphicsOutput::get_left_eye_color_mask(), GraphicsOutput::get_right_eye_color_mask(), DisplayRegionPipelineReader::get_stereo_channel(), GraphicsOutput::get_swap_eyes(), DisplayRegionPipelineReader::get_tex_view_offset(), and DisplayRegionPipelineReader::get_window().
Referenced by PipeOcclusionCullTraverser::set_scene().
GeomContext * GraphicsStateGuardian::prepare_geom | ( | Geom * | geom | ) | [virtual] |
Prepares the indicated Geom for retained-mode rendering, by creating whatever structures are necessary in the GSG (for instance, vertex buffers).
Returns the newly-allocated GeomContext that can be used to render the geom.
Implements GraphicsStateGuardianBase.
Definition at line 654 of file graphicsStateGuardian.cxx.
IndexBufferContext * GraphicsStateGuardian::prepare_index_buffer | ( | GeomPrimitive * | data | ) | [virtual] |
Prepares the indicated buffer for retained-mode rendering.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 720 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::prepare_lens | ( | ) | [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 in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1421 of file graphicsStateGuardian.cxx.
Referenced by set_scene().
ShaderContext * GraphicsStateGuardian::prepare_shader | ( | Shader * | shader | ) | [virtual] |
Compile a vertex/fragment shader body.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9.
Definition at line 678 of file graphicsStateGuardian.cxx.
TextureContext * GraphicsStateGuardian::prepare_texture | ( | Texture * | tex | ) | [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().
Definition at line 591 of file graphicsStateGuardian.cxx.
VertexBufferContext * GraphicsStateGuardian::prepare_vertex_buffer | ( | GeomVertexArrayData * | data | ) | [virtual] |
Prepares the indicated buffer for retained-mode rendering.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 698 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::reissue_transforms | ( | ) | [protected, virtual] |
Called by clear_state_and_transform() to ensure that the current modelview and projection matrices are properly loaded in the graphics state, after a callback might have mucked them up.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 2272 of file graphicsStateGuardian.cxx.
Referenced by clear_state_and_transform().
void GraphicsStateGuardian::release_all | ( | ) | [inline] |
Releases all prepared objects.
Definition at line 24 of file graphicsStateGuardian.I.
Referenced by DXGraphicsStateGuardian8::close_gsg(), DXGraphicsStateGuardian9::close_gsg(), DXGraphicsStateGuardian8::free_d3d_device(), DXGraphicsStateGuardian9::free_d3d_device(), GraphicsEngine::remove_all_windows(), DXGraphicsStateGuardian8::reset_d3d_device(), and DXGraphicsStateGuardian9::reset_d3d_device().
int GraphicsStateGuardian::release_all_geoms | ( | ) | [inline] |
Frees the resources for all geoms associated with this GSG.
Definition at line 46 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::release_all_index_buffers | ( | ) | [inline] |
Frees the resources for all index buffers associated with this GSG.
Definition at line 68 of file graphicsStateGuardian.I.
Referenced by DXGraphicsStateGuardian8::reset_d3d_device(), and DXGraphicsStateGuardian9::reset_d3d_device().
int GraphicsStateGuardian::release_all_textures | ( | ) | [inline] |
Frees the resources for all textures associated with this GSG.
Definition at line 35 of file graphicsStateGuardian.I.
int GraphicsStateGuardian::release_all_vertex_buffers | ( | ) | [inline] |
Frees the resources for all vertex buffers associated with this GSG.
Definition at line 57 of file graphicsStateGuardian.I.
Referenced by DXGraphicsStateGuardian8::reset_d3d_device(), and DXGraphicsStateGuardian9::reset_d3d_device().
void GraphicsStateGuardian::release_geom | ( | GeomContext * | gc | ) | [virtual] |
Frees the resources previously allocated via a call to prepare_geom(), including deleting the GeomContext itself, if it is non-NULL.
This function should not be called directly to prepare a Geom. Instead, call Geom::prepare().
Implements GraphicsStateGuardianBase.
Definition at line 669 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::release_index_buffer | ( | IndexBufferContext * | ibc | ) | [virtual] |
Frees the resources previously allocated via a call to prepare_data(), including deleting the IndexBufferContext itself, if necessary.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 732 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::release_shader | ( | ShaderContext * | sc | ) | [virtual] |
Releases the resources allocated by prepare_shader.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9.
Definition at line 688 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::release_texture | ( | TextureContext * | tc | ) | [virtual] |
Frees the resources previously allocated via a call to prepare_texture(), including deleting the TextureContext itself, if it is non-NULL.
Implements GraphicsStateGuardianBase.
Reimplemented in TinyGraphicsStateGuardian, DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 624 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::release_vertex_buffer | ( | VertexBufferContext * | vbc | ) | [virtual] |
Frees the resources previously allocated via a call to prepare_data(), including deleting the VertexBufferContext itself, if necessary.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 710 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::remove_window | ( | GraphicsOutputBase * | window | ) | [virtual] |
This is simply a transparent call to GraphicsEngine::remove_window().
It exists primary to support removing a window from that compiles before the display module, and therefore has no knowledge of a GraphicsEngine object.
Implements GraphicsStateGuardianBase.
Definition at line 1401 of file graphicsStateGuardian.cxx.
References GraphicsEngine::remove_window().
void GraphicsStateGuardian::reset | ( | ) | [virtual] |
Resets all internal state as if the gsg were newly created.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1766 of file graphicsStateGuardian.cxx.
References BitMask< WType, nbits >::clear().
Referenced by reset_if_new().
bool GraphicsStateGuardian::reset_if_new | ( | ) | [inline] |
Calls reset() to initialize the GSG, but only if it hasn't been called yet.
Returns true if the GSG was new, false otherwise.
Definition at line 843 of file graphicsStateGuardian.I.
References reset().
Referenced by TinyGraphicsBuffer::begin_frame(), and TinyGraphicsBuffer::open_buffer().
void GraphicsStateGuardian::restore_gamma | ( | ) | [virtual] |
Restore original gamma setting.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 426 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::set_active | ( | bool | active | ) | [inline] |
Sets the active flag associated with the GraphicsStateGuardian.
If the GraphicsStateGuardian is marked inactive, nothing is rendered. This is not normally turned off unless there is a problem with the rendering detected at a low level.
Definition at line 82 of file graphicsStateGuardian.I.
Referenced by panic_deactivate().
void GraphicsStateGuardian::set_ambient_light | ( | const LColor & | color | ) | [protected, virtual] |
Intended to be overridden by a derived class to indicate the color of the ambient light that should be in effect.
This is called by do_issue_light() after all other lights have been enabled or disabled.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 2296 of file graphicsStateGuardian.cxx.
Referenced by do_issue_light().
void GraphicsStateGuardian::set_coordinate_system | ( | CoordinateSystem | cs | ) |
Changes the coordinate system in effect on this particular gsg.
This is also called the "external" coordinate system, since it is the coordinate system used by the scene graph, external to to GSG.
Normally, this will be the default coordinate system, but it might be set differently at runtime.
Definition at line 347 of file graphicsStateGuardian.cxx.
References LMatrix4f::convert_mat().
void GraphicsStateGuardian::set_current_properties | ( | const FrameBufferProperties * | properties | ) | [inline] |
Notifies the gsg that it is about to render into a window/buffer with the given FrameBufferProperties.
Definition at line 954 of file graphicsStateGuardian.I.
void GraphicsStateGuardian::set_flash_texture | ( | Texture * | tex | ) |
Sets the "flash texture".
This is a debug feature; when enabled, the specified texture will begin flashing in the scene, helping you to find it visually.
The texture also flashes with a color code: blue for mipmap level 0, yellow for mipmap level 1, and red for mipmap level 2 or higher (even for textures that don't have mipmaps). This gives you an idea of the choice of the texture size. If it is blue, the texture is being drawn the proper size or magnified; if it is yellow, it is being minified a little bit; and if it red, it is being minified considerably. If you see a red texture when you are right in front of it, you should consider reducing the size of the texture to avoid wasting texture memory.
Not all rendering backends support the flash_texture feature. Presently, it is only supported by OpenGL.
Definition at line 511 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::set_gamma | ( | PN_stdfloat | gamma | ) | [virtual] |
Set gamma.
Returns true on success.
Reimplemented in DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 404 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::set_incomplete_render | ( | bool | incomplete_render | ) | [inline] |
Sets the incomplete_render flag.
When this is true, the frame will be rendered even if some of the geometry or textures in the scene are not available (e.g. they have been temporarily paged out). When this is false, the frame will be held up while this data is reloaded.
Setting this true allows for a smoother frame rate, but occasionally parts of the frame will be invisible or missing (they will generally come in within a second or two). Setting this false guarantees that every frame will be complete, but may cause more chugs as things are loaded up at runtime.
You may want to set this false during loading screens, to guarantee that all of your assets are available by the time you take the loading screen down.
This flag may also be set individually on each DisplayRegion. It will be considered true for a given DisplayRegion only if it is true on both the GSG and on the DisplayRegion.
Definition at line 149 of file graphicsStateGuardian.I.
void GraphicsStateGuardian::set_loader | ( | Loader * | loader | ) | [inline] |
Sets the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true.
Definition at line 190 of file graphicsStateGuardian.I.
bool GraphicsStateGuardian::set_scene | ( | SceneSetup * | scene_setup | ) |
Sets the SceneSetup object that indicates the initial camera position, etc.
This must be called before traversal begins. Returns true if the scene is acceptable, false if something's wrong. This should be called in the draw thread only.
Definition at line 552 of file graphicsStateGuardian.cxx.
References SceneSetup::get_lens(), and prepare_lens().
Referenced by PipeOcclusionCullTraverser::set_scene(), and DisplayRegionDrawCallbackData::upcall().
void GraphicsStateGuardian::set_shader_model | ( | int | shader_model | ) | [inline] |
Sets the ShaderModel.
This will override the auto- detected shader model during GSG reset. Useful for testing lower-end shaders.
Definition at line 712 of file graphicsStateGuardian.I.
void GraphicsStateGuardian::set_state_and_transform | ( | const RenderState * | state, |
const TransformState * | trans | ||
) | [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.
Implements GraphicsStateGuardianBase.
Reimplemented in DXGraphicsStateGuardian9, DXGraphicsStateGuardian8, and TinyGraphicsStateGuardian.
Definition at line 1828 of file graphicsStateGuardian.cxx.
void GraphicsStateGuardian::set_texture_quality_override | ( | Texture::QualityLevel | quality_level | ) | [inline] |
Specifies the global quality_level to be imposed for all Textures rendered by this GSG.
This overrides the value set on individual textures via Texture::set_quality_level(). Set this to Texture::QL_default in order to allow the individual texture quality levels to be respected.
This is mainly useful for the tinydisplay software renderer. See Texture::set_quality_level().
Definition at line 817 of file graphicsStateGuardian.I.
void GraphicsStateGuardian::traverse_prepared_textures | ( | GraphicsStateGuardian::TextureCallback * | func, |
void * | callback_arg | ||
) |
Calls the indicated function on all currently-prepared textures, or until the callback function returns false.
Definition at line 472 of file graphicsStateGuardian.cxx.
bool GraphicsStateGuardian::update_texture | ( | TextureContext * | tc, |
bool | force | ||
) | [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).
Implements GraphicsStateGuardianBase.
Reimplemented in TinyGraphicsStateGuardian, DXGraphicsStateGuardian9, and DXGraphicsStateGuardian8.
Definition at line 612 of file graphicsStateGuardian.cxx.