From b4751ec36be862c92059ce281611e4b8a529851c Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 30 Apr 2003 18:37:34 +0000 Subject: [PATCH] expose get_draw_order, etc. --- panda/src/pgraph/renderState.I | 46 +++++++++++++++++----------------- panda/src/pgraph/renderState.h | 7 ++++-- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/panda/src/pgraph/renderState.I b/panda/src/pgraph/renderState.I index 8cda909c54..c45f070357 100644 --- a/panda/src/pgraph/renderState.I +++ b/panda/src/pgraph/renderState.I @@ -182,28 +182,9 @@ get_override(int n) const { return _attributes[n]._override; } -//////////////////////////////////////////////////////////////////// -// Function: RenderState::get_bin_index -// Access: Public -// Description: Returns the bin index indicated by the CullBinAttrib, -// if any, associated by this state (or the default bin -// index if there is no CullBinAttrib). This function -// is provided as an optimization for determining this -// at render time. -//////////////////////////////////////////////////////////////////// -INLINE int RenderState:: -get_bin_index() const { - if ((_flags & F_checked_bin_index) == 0) { - // We pretend this function is const, even though it transparently - // modifies the internal bin_index cache. - ((RenderState *)this)->determine_bin_index(); - } - return _bin_index; -} - //////////////////////////////////////////////////////////////////// // Function: RenderState::get_draw_order -// Access: Public +// Access: Published // Description: Returns the draw order indicated by the // CullBinAttrib, if any, associated by this state (or 0 // if there is no CullBinAttrib). See get_bin_index(). @@ -220,7 +201,7 @@ get_draw_order() const { //////////////////////////////////////////////////////////////////// // Function: RenderState::get_fog -// Access: Public +// Access: Published // Description: This function is provided as an optimization, to // speed up the render-time checking for the existance // of a FogAttrib on this state. It returns a @@ -239,7 +220,7 @@ get_fog() const { //////////////////////////////////////////////////////////////////// // Function: RenderState::get_bin -// Access: Public +// Access: Published // Description: This function is provided as an optimization, to // speed up the render-time checking for the existance // of a BinAttrib on this state. It returns a @@ -258,7 +239,7 @@ get_bin() const { //////////////////////////////////////////////////////////////////// // Function: RenderState::get_transparency -// Access: Public +// Access: Published // Description: This function is provided as an optimization, to // speed up the render-time checking for the existance // of a TransparencyAttrib on this state. It returns a @@ -275,6 +256,25 @@ get_transparency() const { return _transparency; } +//////////////////////////////////////////////////////////////////// +// Function: RenderState::get_bin_index +// Access: Published +// Description: Returns the bin index indicated by the CullBinAttrib, +// if any, associated by this state (or the default bin +// index if there is no CullBinAttrib). This function +// is provided as an optimization for determining this +// at render time. +//////////////////////////////////////////////////////////////////// +INLINE int RenderState:: +get_bin_index() const { + if ((_flags & F_checked_bin_index) == 0) { + // We pretend this function is const, even though it transparently + // modifies the internal bin_index cache. + ((RenderState *)this)->determine_bin_index(); + } + return _bin_index; +} + //////////////////////////////////////////////////////////////////// // Function: RenderState::set_destructing // Access: Private diff --git a/panda/src/pgraph/renderState.h b/panda/src/pgraph/renderState.h index 017b4272a1..e2dbf6d65a 100644 --- a/panda/src/pgraph/renderState.h +++ b/panda/src/pgraph/renderState.h @@ -99,13 +99,16 @@ PUBLISHED: static int get_num_unused_states(); static int clear_cache(); -public: - INLINE int get_bin_index() const; +PUBLISHED: + // These methods are intended for use by low-level code, but they're + // also handy enough to expose to high-level users. INLINE int get_draw_order() const; INLINE const FogAttrib *get_fog() const; INLINE const CullBinAttrib *get_bin() const; INLINE const TransparencyAttrib *get_transparency() const; + INLINE int get_bin_index() const; +public: CPT(RenderState) issue_delta_modify(const RenderState *other, GraphicsStateGuardianBase *gsg) const; CPT(RenderState) issue_delta_set(const RenderState *other,