00001 // Filename: xFileMaterial.h 00002 // Created by: drose (19Jun01) 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 XFILEMATERIAL_H 00016 #define XFILEMATERIAL_H 00017 00018 #include "pandatoolbase.h" 00019 #include "luse.h" 00020 #include "filename.h" 00021 00022 class EggPrimitive; 00023 class Datagram; 00024 class XFileToEggConverter; 00025 class XFileNode; 00026 class XFileDataNode; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : XFileMaterial 00030 // Description : This represents an X file "material", which consists 00031 // of a color, lighting, and/or texture specification. 00032 //////////////////////////////////////////////////////////////////// 00033 class XFileMaterial { 00034 public: 00035 XFileMaterial(); 00036 ~XFileMaterial(); 00037 00038 void set_from_egg(EggPrimitive *egg_prim); 00039 void apply_to_egg(EggPrimitive *egg_prim, XFileToEggConverter *converter); 00040 00041 int compare_to(const XFileMaterial &other) const; 00042 00043 bool has_material() const; 00044 bool has_texture() const; 00045 00046 XFileDataNode *make_x_material(XFileNode *x_meshMaterials, const string &suffix); 00047 bool fill_material(XFileDataNode *obj); 00048 00049 private: 00050 LColor _face_color; 00051 double _power; 00052 LRGBColor _specular_color; 00053 LRGBColor _emissive_color; 00054 Filename _texture; 00055 00056 bool _has_material; 00057 bool _has_texture; 00058 }; 00059 00060 #endif 00061