Panda3D
cLwoSurface.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 cLwoSurface.h
10  * @author drose
11  * @date 2001-04-25
12  */
13 
14 #ifndef CLWOSURFACE_H
15 #define CLWOSURFACE_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "cLwoSurfaceBlock.h"
20 
21 #include "lwoSurface.h"
22 #include "luse.h"
23 #include "eggTexture.h"
24 #include "eggMaterial.h"
25 #include "pt_EggTexture.h"
26 #include "pt_EggMaterial.h"
27 #include "vector_PT_EggVertex.h"
28 
29 #include "pmap.h"
30 
31 class LwoToEggConverter;
32 class LwoSurfaceBlock;
33 class EggPrimitive;
34 
35 /**
36  * This class is a wrapper around LwoSurface and stores additional information
37  * useful during the conversion-to-egg process.
38  */
39 class CLwoSurface {
40 public:
41  CLwoSurface(LwoToEggConverter *converter, const LwoSurface *surface);
42  ~CLwoSurface();
43 
44  INLINE const std::string &get_name() const;
45 
46  void apply_properties(EggPrimitive *egg_prim,
47  vector_PT_EggVertex &egg_vertices,
48  PN_stdfloat &smooth_angle);
49  bool check_texture();
50  bool check_material();
51 
52  INLINE bool has_named_uvs() const;
53  INLINE const std::string &get_uv_name() const;
54 
55 
56  enum Flags {
57  F_rgb = 0x0001,
58  F_diffuse = 0x0002,
59  F_luminosity = 0x0004,
60  F_specular = 0x0008,
61  F_reflection = 0x0010,
62  F_transparency = 0x0020,
63  F_gloss = 0x0040,
64  F_translucency = 0x0080,
65  F_smooth_angle = 0x0100,
66  F_backface = 0x0200,
67  };
68 
69  int _flags;
70  LRGBColor _rgb;
71  PN_stdfloat _diffuse;
72  PN_stdfloat _luminosity;
73  PN_stdfloat _specular;
74  PN_stdfloat _reflection;
75  PN_stdfloat _transparency;
76  PN_stdfloat _gloss;
77  PN_stdfloat _translucency;
78  PN_stdfloat _smooth_angle;
79  bool _backface;
80 
81  LColor _color;
82  LColor _diffuse_color;
83 
84  LwoToEggConverter *_converter;
85  CPT(LwoSurface) _surface;
86 
87  bool _checked_material;
88  PT_EggMaterial _egg_material;
89 
90  bool _checked_texture;
91  PT_EggTexture _egg_texture;
92 
93  CLwoSurfaceBlock *_block;
94 
95 private:
96  void generate_uvs(vector_PT_EggVertex &egg_vertices);
97 
98  LPoint2d map_planar(const LPoint3d &pos, const LPoint3d &centroid) const;
99  LPoint2d map_spherical(const LPoint3d &pos, const LPoint3d &centroid) const;
100  LPoint2d map_cylindrical(const LPoint3d &pos, const LPoint3d &centroid) const;
101  LPoint2d map_cubic(const LPoint3d &pos, const LPoint3d &centroid) const;
102 
103  // Define a pointer to one of the above member functions.
104  LPoint2d (CLwoSurface::*_map_uvs)(const LPoint3d &pos, const LPoint3d &centroid) const;
105 };
106 
107 #include "cLwoSurface.I"
108 
109 #endif
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
Definition: eggPrimitive.h:47
bool check_material()
Checks whether the surface demands a material or not.
const std::string & get_name() const
Returns the name of the surface.
Definition: cLwoSurface.I:19
const std::string & get_uv_name() const
Returns the name of the set of UV's that are associated with this surface, if has_named_uvs() is true...
Definition: cLwoSurface.I:40
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is a wrapper around LwoSurfaceBlock and stores additional information useful during the co...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Describes the shading attributes of a surface.
Definition: lwoSurface.h:25
A texture layer or shader, part of a LwoSurface chunk.
bool has_named_uvs() const
Returns true if the surface is set up to reference UV's stored on the vertices, by name (as opposed t...
Definition: cLwoSurface.I:30
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool check_texture()
Checks whether the surface demands a texture or not.
This class is a wrapper around LwoSurface and stores additional information useful during the convers...
Definition: cLwoSurface.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void apply_properties(EggPrimitive *egg_prim, vector_PT_EggVertex &egg_vertices, PN_stdfloat &smooth_angle)
Applies the color, texture, etc.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class supervises the construction of an EggData structure from the data represented by the LwoHe...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.