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;
23 class XFileToEggConverter;
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 */
31 class XFileMaterial {
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
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
EggPrimitive
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
Definition: eggPrimitive.h:49
Filename
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
XFileDataNode
This is an abstract base class for an XFileNode which is also an XFileDataObject.
Definition: xFileDataNode.h:33
XFileMaterial
This represents an X file "material", which consists of a color, lighting, and/or texture specificati...
Definition: xFileMaterial.h:31
XFileMaterial::has_texture
bool has_texture() const
Returns true if this material includes a texture map, false otherwise.
Definition: xFileMaterial.cxx:157
XFileMaterial::make_x_material
XFileDataNode * make_x_material(XFileNode *x_meshMaterials, const std::string &suffix)
Creates a Material object for the material list.
Definition: xFileMaterial.cxx:165
XFileMaterial::apply_to_egg
void apply_to_egg(EggPrimitive *egg_prim, XFileToEggConverter *converter)
Applies the properties in the material to the indicated egg primitive.
Definition: xFileMaterial.cxx:90
XFileMaterial::fill_material
bool fill_material(XFileDataNode *obj)
Fills the structure based on the raw data from the X file's Material object.
Definition: xFileMaterial.cxx:183
XFileMaterial::has_material
bool has_material() const
Returns true if this material represents something meaningful, or false if the default material is su...
Definition: xFileMaterial.cxx:149
XFileMaterial::set_from_egg
void set_from_egg(EggPrimitive *egg_prim)
Sets the structure up from the indicated egg data.
Definition: xFileMaterial.cxx:50
XFileNode
A single node of an X file.
Definition: xFileNode.h:40
XFileToEggConverter
Definition: xFileToEggConverter.h:40
compare_to
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:73
filename.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.