Panda3D
xFileMaterial.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file xFileMaterial.h
10  * @author drose
11  * @date 2001-06-19
12  */
13 
14 #ifndef XFILEMATERIAL_H
15 #define XFILEMATERIAL_H
16 
17 #include "pandatoolbase.h"
18 #include "luse.h"
19 #include "filename.h"
20 
21 class EggPrimitive;
22 class Datagram;
24 class XFileNode;
25 class XFileDataNode;
26 
27 /**
28  * This represents an X file "material", which consists of a color, lighting,
29  * and/or texture specification.
30  */
32 public:
33  XFileMaterial();
34  ~XFileMaterial();
35 
36  void set_from_egg(EggPrimitive *egg_prim);
37  void apply_to_egg(EggPrimitive *egg_prim, XFileToEggConverter *converter);
38 
39  int compare_to(const XFileMaterial &other) const;
40 
41  bool has_material() const;
42  bool has_texture() const;
43 
44  XFileDataNode *make_x_material(XFileNode *x_meshMaterials, const std::string &suffix);
45  bool fill_material(XFileDataNode *obj);
46 
47 private:
48  LColor _face_color;
49  double _power;
50  LRGBColor _specular_color;
51  LRGBColor _emissive_color;
52  Filename _texture;
53 
54  bool _has_material;
55  bool _has_texture;
56 };
57 
58 #endif
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
Definition: eggPrimitive.h:47
bool has_texture() const
Returns true if this material includes a texture map, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
XFileDataNode * make_x_material(XFileNode *x_meshMaterials, const std::string &suffix)
Creates a Material object for the material list.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
A single node of an X file.
Definition: xFileNode.h:39
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:73
This represents an X file "material", which consists of a color, lighting, and/or texture specificati...
Definition: xFileMaterial.h:31
This is an abstract base class for an XFileNode which is also an XFileDataObject.
Definition: xFileDataNode.h:33
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:38