TextureFunction.h

00001 
00006 #ifndef TEXTURE_FUNCTION_H
00007 #define TEXTURE_FUNCTION_H
00008 
00009 /*
00010 ** ---------------------------------------------------------------
00011 ** Includes:
00012 */
00013 #include "RenderContext.h"
00014 
00015 /*
00016 ** ---------------------------------------------------------------
00017 ** Definitions:
00018 */
00019 
00020 #define TMAP_TILE 1
00021 #define TMAP_CLAMP 3
00022 
00023 
00024 #include "geom.h"
00025 #include "color.h"
00026 #include "poly.h"
00027 #include "hpoly.h"
00028 #include "shade.h"
00029 #include "lang.h"
00030 
00031 #define TEX_MAXPAR 6
00032 
00033 #define TEX_W 0
00034 #define TEX_T 1
00035 #define TEX_P 2
00036 #define TEX_N 3
00037 #define TEX_U 4 
00038 #define TEX_V 5
00039 
00040 
00042 
00052 class TextureFunction {
00053 
00054 public :
00056         virtual Color &texture(const Vector3 &t) const = 0;
00057 };
00058 
00059 
00061 
00068 class ImageTexture : public TextureFunction {
00069 
00070 public :
00071         
00073         ImageTexture(const Image &i);
00075         virtual Color &texture(const Vector3 &t) const;
00076 
00078         static Val parse(int pass, Pval *pl);
00079 
00080 private :
00081 
00083         Image &img;
00084 };
00085 
00087 
00096 typedef struct ChequerInfo {
00097   Real xfreq, yfreq;
00098   Color fg, bg;
00099 } ChequerInfo;
00100 
00101 
00102 class ChequerTexture : public TextureFunction {
00103 
00104 public :
00105         
00107         ChequerTexture(Real xfreq, Real yfreq,const Color &a,const Color &b,const Vector3 &t);
00108 
00110         virtual Color &texture(const Vector3 &t) const;
00111 
00113         static Val parse(int pass, Pval *pl);
00114 
00115 protected :
00116 
00118         Color  chequer(Real xfreq, Real yfreq, const Color &a, const Color &b, const Vector3 &t)
00119 
00120 private :
00121 
00123         ChequerInfo &c;
00124 };
00125 
00126 
00127 #endif //TEXTURE_FUNCTION_H

Generated on Thu Jul 5 13:27:52 2007 for S3D by  doxygen 1.4.6