Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/egg/eggRenderMode.h

Go to the documentation of this file.
00001 // Filename: eggRenderMode.h
00002 // Created by:  drose (20Jan99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef EGGRENDERMODE_H
00020 #define EGGRENDERMODE_H
00021 
00022 #include "pandabase.h"
00023 #include "typedObject.h"
00024 
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : EggRenderMode
00028 // Description : This class stores miscellaneous rendering properties
00029 //               that is associated with geometry, and which may be
00030 //               set on the geometry primitive level, on the group
00031 //               above it, or indirectly via a texture.  It's intended
00032 //               to be a base class for egg objects that can have
00033 //               these properties set.
00034 //
00035 //               This class cannot inherit from EggObject, because it
00036 //               causes problems at the EggPolygon level with multiple
00037 //               appearances of the EggObject base class.  And making
00038 //               EggObject a virtual base class is just no fun.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDAEGG EggRenderMode {
00041 public:
00042   INLINE EggRenderMode();
00043   INLINE EggRenderMode(const EggRenderMode &copy);
00044   INLINE EggRenderMode &operator = (const EggRenderMode &copy);
00045 
00046   void write(ostream &out, int indent_level) const;
00047 
00048   enum AlphaMode {  // Specifies implementation of transparency.
00049     AM_unspecified, 
00050     AM_off,     // No transparency.
00051     AM_on,      // Use whatever the default model is.
00052     AM_blend,   // Normal alpha blending, e.g. TransparencyAttrib::M_alpha.
00053     AM_blend_no_occlude,  // Alpha blending w/o depth write.
00054     AM_ms,      // TransparencyAttrib::M_multisample
00055     AM_ms_mask, // TransparencyAttrib::M_multisample_mask
00056     AM_binary,  // TransparencyAttrib::M_binary
00057     AM_dual     // TransparencyAttrib::M_dual
00058   };
00059 
00060   enum DepthWriteMode {
00061     DWM_unspecified, DWM_off, DWM_on
00062   };
00063 
00064   enum DepthTestMode {
00065     DTM_unspecified, DTM_off, DTM_on
00066   };
00067 
00068   INLINE void set_alpha_mode(AlphaMode mode);
00069   INLINE AlphaMode get_alpha_mode() const;
00070 
00071   INLINE void set_depth_write_mode(DepthWriteMode mode);
00072   INLINE DepthWriteMode get_depth_write_mode() const;
00073 
00074   INLINE void set_depth_test_mode(DepthTestMode mode);
00075   INLINE DepthTestMode get_depth_test_mode() const;
00076 
00077   INLINE void set_draw_order(int order);
00078   INLINE int get_draw_order() const;
00079   INLINE bool has_draw_order() const;
00080   INLINE void clear_draw_order();
00081 
00082   INLINE void set_bin(const string &bin);
00083   INLINE string get_bin() const;
00084   INLINE bool has_bin() const;
00085   INLINE void clear_bin();
00086 
00087   // Comparison operators are handy.
00088   bool operator == (const EggRenderMode &other) const;
00089   INLINE bool operator != (const EggRenderMode &other) const;
00090   bool operator < (const EggRenderMode &other) const;
00091 
00092   static AlphaMode string_alpha_mode(const string &string);
00093   static DepthWriteMode string_depth_write_mode(const string &string);
00094   static DepthTestMode string_depth_test_mode(const string &string);
00095 
00096 private:
00097   AlphaMode _alpha_mode;
00098   DepthWriteMode _depth_write_mode;
00099   DepthTestMode _depth_test_mode;
00100   int _draw_order;
00101   bool _has_draw_order;
00102   string _bin;
00103 
00104 
00105 public:
00106   static TypeHandle get_class_type() {
00107     return _type_handle;
00108   }
00109   static void init_type() {
00110     register_type(_type_handle, "EggRenderMode");
00111   }
00112 
00113 private:
00114   static TypeHandle _type_handle;
00115 };
00116 
00117 ostream &operator << (ostream &out, EggRenderMode::AlphaMode mode);
00118 ostream &operator << (ostream &out, EggRenderMode::DepthWriteMode mode);
00119 ostream &operator << (ostream &out, EggRenderMode::DepthTestMode mode);
00120 
00121 #include "eggRenderMode.I"
00122 
00123 #endif
00124 

Generated on Fri May 2 00:37:54 2003 for Panda by doxygen1.3