00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CLWOSURFACE_H
00016 #define CLWOSURFACE_H
00017
00018 #include "pandatoolbase.h"
00019
00020 #include "cLwoSurfaceBlock.h"
00021
00022 #include "lwoSurface.h"
00023 #include "luse.h"
00024 #include "eggTexture.h"
00025 #include "eggMaterial.h"
00026 #include "pt_EggTexture.h"
00027 #include "pt_EggMaterial.h"
00028 #include "vector_PT_EggVertex.h"
00029
00030 #include "pmap.h"
00031
00032 class LwoToEggConverter;
00033 class LwoSurfaceBlock;
00034 class EggPrimitive;
00035
00036
00037
00038
00039
00040
00041
00042 class CLwoSurface {
00043 public:
00044 CLwoSurface(LwoToEggConverter *converter, const LwoSurface *surface);
00045 ~CLwoSurface();
00046
00047 INLINE const string &get_name() const;
00048
00049 void apply_properties(EggPrimitive *egg_prim,
00050 vector_PT_EggVertex &egg_vertices,
00051 PN_stdfloat &smooth_angle);
00052 bool check_texture();
00053 bool check_material();
00054
00055 INLINE bool has_named_uvs() const;
00056 INLINE const string &get_uv_name() const;
00057
00058
00059 enum Flags {
00060 F_rgb = 0x0001,
00061 F_diffuse = 0x0002,
00062 F_luminosity = 0x0004,
00063 F_specular = 0x0008,
00064 F_reflection = 0x0010,
00065 F_transparency = 0x0020,
00066 F_gloss = 0x0040,
00067 F_translucency = 0x0080,
00068 F_smooth_angle = 0x0100,
00069 F_backface = 0x0200,
00070 };
00071
00072 int _flags;
00073 LRGBColor _rgb;
00074 PN_stdfloat _diffuse;
00075 PN_stdfloat _luminosity;
00076 PN_stdfloat _specular;
00077 PN_stdfloat _reflection;
00078 PN_stdfloat _transparency;
00079 PN_stdfloat _gloss;
00080 PN_stdfloat _translucency;
00081 PN_stdfloat _smooth_angle;
00082 bool _backface;
00083
00084 LColor _color;
00085 LColor _diffuse_color;
00086
00087 LwoToEggConverter *_converter;
00088 CPT(LwoSurface) _surface;
00089
00090 bool _checked_material;
00091 PT_EggMaterial _egg_material;
00092
00093 bool _checked_texture;
00094 PT_EggTexture _egg_texture;
00095
00096 CLwoSurfaceBlock *_block;
00097
00098 private:
00099 void generate_uvs(vector_PT_EggVertex &egg_vertices);
00100
00101 LPoint2d map_planar(const LPoint3d &pos, const LPoint3d ¢roid) const;
00102 LPoint2d map_spherical(const LPoint3d &pos, const LPoint3d ¢roid) const;
00103 LPoint2d map_cylindrical(const LPoint3d &pos, const LPoint3d ¢roid) const;
00104 LPoint2d map_cubic(const LPoint3d &pos, const LPoint3d ¢roid) const;
00105
00106
00107 LPoint2d (CLwoSurface::*_map_uvs)(const LPoint3d &pos, const LPoint3d ¢roid) const;
00108 };
00109
00110 #include "cLwoSurface.I"
00111
00112 #endif
00113
00114