Panda3D
|
00001 // Filename: fltMaterial.h 00002 // Created by: drose (25Aug00) 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 FLTMATERIAL_H 00016 #define FLTMATERIAL_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "fltRecord.h" 00021 00022 #include "luse.h" 00023 00024 class DatagramIterator; 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : FltMaterial 00028 // Description : Represents a single material in the material palette. 00029 //////////////////////////////////////////////////////////////////// 00030 class FltMaterial : public FltRecord { 00031 public: 00032 FltMaterial(FltHeader *header); 00033 00034 enum Flags { 00035 F_materials_used = 0x80000000, 00036 }; 00037 00038 int _material_index; 00039 string _material_name; 00040 unsigned int _flags; 00041 LRGBColor _ambient; 00042 LRGBColor _diffuse; 00043 LRGBColor _specular; 00044 LRGBColor _emissive; 00045 PN_stdfloat _shininess; 00046 PN_stdfloat _alpha; 00047 00048 protected: 00049 virtual bool extract_record(FltRecordReader &reader); 00050 virtual bool build_record(FltRecordWriter &writer) const; 00051 00052 public: 00053 bool extract_14_record(int index, DatagramIterator &di); 00054 bool build_14_record(Datagram &datagram); 00055 00056 public: 00057 virtual TypeHandle get_type() const { 00058 return get_class_type(); 00059 } 00060 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00061 static TypeHandle get_class_type() { 00062 return _type_handle; 00063 } 00064 static void init_type() { 00065 FltRecord::init_type(); 00066 register_type(_type_handle, "FltMaterial", 00067 FltRecord::get_class_type()); 00068 } 00069 00070 private: 00071 static TypeHandle _type_handle; 00072 00073 friend class FltHeader; 00074 }; 00075 00076 #endif 00077 00078