Panda3D
|
00001 // Filename: shadeModelAttrib.h 00002 // Created by: drose (14Mar05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef SHADEMODELATTRIB_H 00016 #define SHADEMODELATTRIB_H 00017 00018 #include "pandabase.h" 00019 00020 #include "renderAttrib.h" 00021 00022 class FactoryParams; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : ShadeModelAttrib 00026 // Description : Specifies whether flat shading (per-polygon) or 00027 // smooth shading (per-vertex) is in effect. 00028 //////////////////////////////////////////////////////////////////// 00029 class EXPCL_PANDA_PGRAPH ShadeModelAttrib : public RenderAttrib { 00030 PUBLISHED: 00031 enum Mode { 00032 M_flat, 00033 M_smooth, 00034 }; 00035 00036 private: 00037 INLINE ShadeModelAttrib(Mode mode); 00038 00039 PUBLISHED: 00040 static CPT(RenderAttrib) make(Mode mode); 00041 static CPT(RenderAttrib) make_default(); 00042 00043 INLINE Mode get_mode() const; 00044 00045 public: 00046 virtual void output(ostream &out) const; 00047 00048 protected: 00049 virtual int compare_to_impl(const RenderAttrib *other) const; 00050 virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const; 00051 00052 private: 00053 Mode _mode; 00054 00055 PUBLISHED: 00056 static int get_class_slot() { 00057 return _attrib_slot; 00058 } 00059 virtual int get_slot() const { 00060 return get_class_slot(); 00061 } 00062 00063 public: 00064 static void register_with_read_factory(); 00065 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00066 00067 protected: 00068 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00069 void fillin(DatagramIterator &scan, BamReader *manager); 00070 00071 public: 00072 static TypeHandle get_class_type() { 00073 return _type_handle; 00074 } 00075 static void init_type() { 00076 RenderAttrib::init_type(); 00077 register_type(_type_handle, "ShadeModelAttrib", 00078 RenderAttrib::get_class_type()); 00079 _attrib_slot = register_slot(_type_handle, 100, make_default); 00080 } 00081 virtual TypeHandle get_type() const { 00082 return get_class_type(); 00083 } 00084 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00085 00086 private: 00087 static TypeHandle _type_handle; 00088 static int _attrib_slot; 00089 }; 00090 00091 #include "shadeModelAttrib.I" 00092 00093 #endif 00094