Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/lwoegg/cLwoSurface.h

Go to the documentation of this file.
00001 // Filename: cLwoSurface.h
00002 // Created by:  drose (25Apr01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
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 //       Class : CLwoSurface
00042 // Description : This class is a wrapper around LwoSurface and stores
00043 //               additional information useful during the
00044 //               conversion-to-egg process.
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 &centroid) const;
00106   LPoint2d map_spherical(const LPoint3d &pos, const LPoint3d &centroid) const;
00107   LPoint2d map_cylindrical(const LPoint3d &pos, const LPoint3d &centroid) const;
00108   LPoint2d map_cubic(const LPoint3d &pos, const LPoint3d &centroid) const;
00109 
00110   // Define a pointer to one of the above member functions.
00111   LPoint2d (CLwoSurface::*_map_uvs)(const LPoint3d &pos, const LPoint3d &centroid) const;
00112 };
00113 
00114 #include "cLwoSurface.I"
00115 
00116 #endif
00117 
00118 

Generated on Fri May 2 03:21:11 2003 for Panda-Tool by doxygen1.3