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