// Filename: eggRenderMode.I // Created by: drose (20Jan99) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved // // All use of this software is subject to the terms of the Panda 3d // Software license. You should have received a copy of this license // along with this source code; you will also find a current copy of // the license at http://www.panda3d.org/license.txt . // // To contact the maintainers of this program write to // panda3d@yahoogroups.com . // //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE EggRenderMode:: EggRenderMode() { _alpha_mode = AM_unspecified; _depth_write_mode = DWM_unspecified; _depth_test_mode = DTM_unspecified; _draw_order = 0; _has_draw_order = false; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::Copy Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE EggRenderMode:: EggRenderMode(const EggRenderMode ©) { (*this) = copy; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::Copy assignment operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE EggRenderMode &EggRenderMode:: operator = (const EggRenderMode ©) { _alpha_mode = copy._alpha_mode; _depth_write_mode = copy._depth_write_mode; _depth_test_mode = copy._depth_test_mode; _draw_order = copy._draw_order; _has_draw_order = copy._has_draw_order; return *this; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::set_depth_write_mode // Access: Public // Description: Specifies whether writes should be made to the depth // buffer (assuming the rendering backend provides a // depth buffer) when rendering this geometry. //////////////////////////////////////////////////////////////////// INLINE void EggRenderMode:: set_depth_write_mode(DepthWriteMode mode) { _depth_write_mode = mode; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::get_depth_write_mode // Access: Public // Description: Returns the depth_write mode that was set, or // DWM_unspecified if nothing was set. See // set_depth_write_mode(). //////////////////////////////////////////////////////////////////// INLINE EggRenderMode::DepthWriteMode EggRenderMode:: get_depth_write_mode() const { return _depth_write_mode; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::set_depth_test_mode // Access: Public // Description: Specifies whether this geometry should be tested // against the depth buffer when it is drawn (assuming // the rendering backend provides a depth buffer). Note // that this is different, and independent from, the // depth_write mode. //////////////////////////////////////////////////////////////////// INLINE void EggRenderMode:: set_depth_test_mode(DepthTestMode mode) { _depth_test_mode = mode; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::get_depth_test_mode // Access: Public // Description: Returns the depth_test mode that was set, or // DTM_unspecified if nothing was set. See // set_depth_test_mode(). //////////////////////////////////////////////////////////////////// INLINE EggRenderMode::DepthTestMode EggRenderMode:: get_depth_test_mode() const { return _depth_test_mode; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::set_alpha_mode // Access: Public // Description: Specifies precisely how the transparency for this // geometry should be achieved, or if it should be used. // The default, AM_unspecified, is to use transparency // if the geometry has a color whose alpha value is // non-1, or if it has a four-channel texture applied; // otherwise, AM_on forces transparency on, and AM_off // forces it off. The other flavors of transparency are // specific ways to turn on transparency, which may or // may not be supported by a particular rendering // backend. //////////////////////////////////////////////////////////////////// INLINE void EggRenderMode:: set_alpha_mode(AlphaMode mode) { _alpha_mode = mode; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::get_alpha_mode // Access: Public // Description: Returns the alpha mode that was set, or // AM_unspecified if nothing was set. See // set_alpha_mode(). //////////////////////////////////////////////////////////////////// INLINE EggRenderMode::AlphaMode EggRenderMode:: get_alpha_mode() const { return _alpha_mode; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::set_draw_order // Access: Public // Description: Sets the "draw-order" flag associated with this // object. This specifies a particular order in which // objects of this type should be drawn, within the // specified bin. If a bin is not explicitly specified, // "fixed" is used. See also set_bin(). //////////////////////////////////////////////////////////////////// INLINE void EggRenderMode:: set_draw_order(int order) { _draw_order = order; _has_draw_order = true; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::get_draw_order // Access: Public // Description: Returns the "draw-order" flag as set for this // particular object. See set_draw_order(). //////////////////////////////////////////////////////////////////// INLINE int EggRenderMode:: get_draw_order() const { return _draw_order; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::has_draw_order // Access: Public // Description: Returns true if the draw-order flag has been set for // this particular object. See set_draw_order(). //////////////////////////////////////////////////////////////////// INLINE bool EggRenderMode:: has_draw_order() const { return _has_draw_order; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::clear_draw_order // Access: Public // Description: Removes the draw-order flag from this particular // object. See set_draw_order(). //////////////////////////////////////////////////////////////////// INLINE void EggRenderMode:: clear_draw_order() { _has_draw_order = false; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::set_bin // Access: Public // Description: Sets the "bin" string for this particular object. // This names a particular bin in which the object // should be rendered. The exact meaning of a bin is // implementation defined, but generally a GeomBin // matching each bin name must also be specifically // added to the rendering engine (e.g. the // CullTraverser) in use for this to work. See also // set_draw_order(). //////////////////////////////////////////////////////////////////// INLINE void EggRenderMode:: set_bin(const string &bin) { _bin = bin; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::get_bin // Access: Public // Description: Returns the bin name that has been set for this // particular object, if any. See set_bin(). //////////////////////////////////////////////////////////////////// INLINE string EggRenderMode:: get_bin() const { return _bin; } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::has_bin // Access: Public // Description: Returns true if a bin name has been set for this // particular object. See set_bin(). //////////////////////////////////////////////////////////////////// INLINE bool EggRenderMode:: has_bin() const { return !_bin.empty(); } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::clear_bin // Access: Public // Description: Removes the bin name that was set for this particular // object. See set_bin(). //////////////////////////////////////////////////////////////////// INLINE void EggRenderMode:: clear_bin() { _bin = string(); } //////////////////////////////////////////////////////////////////// // Function: EggRenderMode::Inequality Operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE bool EggRenderMode:: operator != (const EggRenderMode &other) const { return !(*this == other); }