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