Panda3D

fltGeometry.h

00001 // Filename: fltGeometry.h
00002 // Created by:  drose (28Feb01)
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 FLTGEOMETRY_H
00016 #define FLTGEOMETRY_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "fltBeadID.h"
00021 #include "fltPackedColor.h"
00022 #include "fltHeader.h"
00023 
00024 #include "luse.h"
00025 
00026 class FltTexture;
00027 class FltMaterial;
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : FltGeometry
00031 // Description : This is a base class for both FltFace and FltMesh,
00032 //               which are two different kinds of geometric primitives
00033 //               that might be encountered in a MultiGen file.  They
00034 //               have similar properties.
00035 ////////////////////////////////////////////////////////////////////
00036 class FltGeometry : public FltBeadID {
00037 public:
00038   FltGeometry(FltHeader *header);
00039 
00040   enum DrawType {
00041     DT_solid_cull_backface = 0,
00042     DT_solid_no_cull       = 1,
00043     DT_wireframe           = 2,
00044     DT_wireframe_close     = 3,
00045     DT_wireframe_highlight = 4,
00046     DT_omni_light          = 8,
00047     DT_uni_light           = 9,
00048     DT_bi_light            = 10
00049   };
00050 
00051   enum BillboardType {
00052     BT_none                = 0,
00053     BT_fixed               = 1,
00054     BT_axial               = 2,
00055     BT_point               = 4
00056   };
00057 
00058   enum Flags {
00059     F_terrain              = 0x80000000,
00060     F_no_color             = 0x40000000,
00061     F_no_alt_color         = 0x20000000,
00062     F_packed_color         = 0x10000000,
00063     F_terrain_footprint    = 0x08000000,
00064     F_hidden               = 0x04000000
00065   };
00066 
00067   enum LightMode {
00068     LM_face_no_normal      = 0,
00069     LM_vertex_no_normal    = 1,
00070     LM_face_with_normal    = 2,
00071     LM_vertex_with_normal  = 3
00072   };
00073 
00074   int _ir_color;
00075   int _relative_priority;
00076   DrawType _draw_type;
00077   bool _texwhite;
00078   int _color_name_index;
00079   int _alt_color_name_index;
00080   BillboardType _billboard_type;
00081   int _detail_texture_index;
00082   int _texture_index;
00083   int _material_index;
00084   int _dfad_material_code;
00085   int _dfad_feature_id;
00086   int _ir_material_code;
00087   int _transparency;
00088   int _lod_generation_control;
00089   int _line_style_index;
00090   unsigned int _flags;
00091   LightMode _light_mode;
00092   FltPackedColor _packed_color;
00093   FltPackedColor _alt_packed_color;
00094   int _texture_mapping_index;
00095   int _color_index;
00096   int _alt_color_index;
00097 
00098 public:
00099   INLINE bool has_texture() const;
00100   INLINE FltTexture *get_texture() const;
00101   INLINE void set_texture(FltTexture *texture);
00102 
00103   INLINE bool has_material() const;
00104   INLINE FltMaterial *get_material() const;
00105   INLINE void set_material(FltMaterial *material);
00106 
00107   INLINE bool has_color() const;
00108   LColor get_color() const;
00109   void set_color(const LColor &color);
00110   LRGBColor get_rgb() const;
00111   void set_rgb(const LRGBColor &rgb);
00112 
00113   bool has_alt_color() const;
00114   LColor get_alt_color() const;
00115   LRGBColor get_alt_rgb() const;
00116 
00117 
00118 protected:
00119   virtual bool extract_record(FltRecordReader &reader);
00120   virtual bool build_record(FltRecordWriter &writer) const;
00121 
00122 public:
00123   virtual TypeHandle get_type() const {
00124     return get_class_type();
00125   }
00126   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00127   static TypeHandle get_class_type() {
00128     return _type_handle;
00129   }
00130   static void init_type() {
00131     FltBeadID::init_type();
00132     register_type(_type_handle, "FltGeometry",
00133                   FltBeadID::get_class_type());
00134   }
00135 
00136 private:
00137   static TypeHandle _type_handle;
00138 };
00139 
00140 #include "fltGeometry.I"
00141 
00142 #endif
00143 
00144 
 All Classes Functions Variables Enumerations