Panda3D
xFileMaterial.h
1 // Filename: xFileMaterial.h
2 // Created by: drose (19Jun01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef XFILEMATERIAL_H
16 #define XFILEMATERIAL_H
17 
18 #include "pandatoolbase.h"
19 #include "luse.h"
20 #include "filename.h"
21 
22 class EggPrimitive;
23 class Datagram;
25 class XFileNode;
26 class XFileDataNode;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : XFileMaterial
30 // Description : This represents an X file "material", which consists
31 // of a color, lighting, and/or texture specification.
32 ////////////////////////////////////////////////////////////////////
34 public:
35  XFileMaterial();
36  ~XFileMaterial();
37 
38  void set_from_egg(EggPrimitive *egg_prim);
39  void apply_to_egg(EggPrimitive *egg_prim, XFileToEggConverter *converter);
40 
41  int compare_to(const XFileMaterial &other) const;
42 
43  bool has_material() const;
44  bool has_texture() const;
45 
46  XFileDataNode *make_x_material(XFileNode *x_meshMaterials, const string &suffix);
47  bool fill_material(XFileDataNode *obj);
48 
49 private:
50  LColor _face_color;
51  double _power;
52  LRGBColor _specular_color;
53  LRGBColor _emissive_color;
54  Filename _texture;
55 
56  bool _has_material;
57  bool _has_texture;
58 };
59 
60 #endif
61 
A base class for any of a number of kinds of geometry primitives: polygons, point lights...
Definition: eggPrimitive.h:51
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
bool has_texture() const
Returns true if this material includes a texture map, false otherwise.
void apply_to_egg(EggPrimitive *egg_prim, XFileToEggConverter *converter)
Applies the properties in the material to the indicated egg primitive.
void set_from_egg(EggPrimitive *egg_prim)
Sets the structure up from the indicated egg data.
bool has_material() const
Returns true if this material represents something meaningful, or false if the default material is su...
XFileDataNode * make_x_material(XFileNode *x_meshMaterials, const string &suffix)
Creates a Material object for the material list.
A single node of an X file.
Definition: xFileNode.h:42
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:79
This represents an X file "material", which consists of a color, lighting, and/or texture specificati...
Definition: xFileMaterial.h:33
This is an abstract base class for an XFileNode which is also an XFileDataObject. ...
Definition: xFileDataNode.h:36
bool fill_material(XFileDataNode *obj)
Fills the structure based on the raw data from the X file's Material object.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43