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

pandatool/src/maya/mayaShaderColorDef.h

Go to the documentation of this file.
00001 // Filename: mayaShaderColorDef.h
00002 // Created by:  drose (12Apr03)
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 MAYASHADERCOLORDEF_H
00020 #define MAYASHADERCOLORDEF_H
00021 
00022 #include "pandatoolbase.h"
00023 
00024 #include "luse.h"
00025 #include "lmatrix.h"
00026 
00027 class MObject;
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : MayaShaderColorDef
00031 // Description : This defines the various attributes that Maya may
00032 //               associate with the "color" channel for a particular
00033 //               shader (as well as on the "transparency" channel).
00034 ////////////////////////////////////////////////////////////////////
00035 class MayaShaderColorDef {
00036 public:
00037   MayaShaderColorDef();
00038   ~MayaShaderColorDef();
00039   
00040   LMatrix3d compute_texture_matrix() const;
00041   bool has_projection() const;
00042   TexCoordd project_uv(const LPoint3d &pos, const LPoint3d &ref_point) const;
00043   bool reset_maya_texture(const Filename &texture);
00044   
00045   void write(ostream &out) const;
00046 
00047   enum ProjectionType {
00048     PT_off,
00049     PT_planar,
00050     PT_spherical,
00051     PT_cylindrical,
00052     PT_ball,
00053     PT_cubic,
00054     PT_triplanar,
00055     PT_concentric,
00056     PT_perspective,
00057   };
00058 
00059   bool _has_texture;
00060   Filename _texture;
00061   RGBColorf _color_gain;
00062   
00063   bool _has_flat_color;
00064   Colord _flat_color;
00065   
00066   ProjectionType _projection_type;
00067   LMatrix4d _projection_matrix;
00068   double _u_angle;
00069   double _v_angle;
00070     
00071   LVector2f _coverage;
00072   LVector2f _translate_frame;
00073   double _rotate_frame;
00074   
00075   bool _mirror;
00076   bool _stagger;
00077   bool _wrap_u;
00078   bool _wrap_v;
00079   
00080   LVector2f _repeat_uv;
00081   LVector2f _offset;
00082   double _rotate_uv;
00083   
00084 private:
00085   void read_surface_color(MObject color);
00086   void set_projection_type(const string &type);
00087 
00088   LPoint2d map_planar(const LPoint3d &pos, const LPoint3d &centroid) const;
00089   LPoint2d map_spherical(const LPoint3d &pos, const LPoint3d &centroid) const;
00090   LPoint2d map_cylindrical(const LPoint3d &pos, const LPoint3d &centroid) const;
00091 
00092   // Define a pointer to one of the above member functions.
00093   LPoint2d (MayaShaderColorDef::*_map_uvs)(const LPoint3d &pos, const LPoint3d &centroid) const;
00094   
00095   MObject *_color_object;
00096   
00097   friend class MayaShader;
00098 };
00099 
00100 #endif
00101 

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