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