TextureParam Class Reference

#include <MaterialParam.h>

Collaboration diagram for TextureParam:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TextureParam (void)
virtual ~TextureParam (void)
void init (void)
void free (void)
void clear (void)
void dup (TextureParam m)
bool isSetTexture (void)
bool isSetColor (void)
bool isSetAlpha (void)
bool isSetParams (void)
bool isSetShift (void)
bool isSetScale (void)
bool isSetRotate (void)
void setName (const char *nm)
char * getName (void)
void addName (const char *nm)
void setColor (double r, double g, double b, double a=1.0)
void setColor (double v, int c)
void setShiftU (double u)
void setShiftV (double v)
void setScaleU (double u)
void setScaleV (double v)
void setRotate (double r)
void setFlipU (bool f)
void setFlipV (bool f)
void setShift (double u, double v)
void setScale (double u, double v)
void setAlphaChannel (bool h)
void setAlphaMode (int m)
void setAlphaCutoff (double m)
double getColor (int c)
double getShiftU (void)
double getShiftV (void)
double getScaleU (void)
double getScaleV (void)
double getRotate (void)
bool getAlphaChannel (void)
int getAlphaMode (void)
double getAlphaCutoff (void)
void execTrans (UVMap< double > *uv, int n)
 Rotate -> Scale -> Shift.
void execShift (UVMap< double > *uv, int n)
void execScale (UVMap< double > *uv, int n)
void execRotate (UVMap< double > *uv, int n)
void execInvTrans (UVMap< double > *uv, int n)
 Shift -> Scale -> Rotate.
void execInvShift (UVMap< double > *uv, int n)
void execInvScale (UVMap< double > *uv, int n)
void execInvRotate (UVMap< double > *uv, int n)
void execFlipU (UVMap< double > *uv, int n)
void execFlipV (UVMap< double > *uv, int n)
void printParam (FILE *fp)

Private Attributes

Buffer name
 テクスチャ名
double color [4]
 RGBA.
bool alphaChannel
 テクスチャデータがアルファチャンネルを持っているかどうか.
int alphaMode
 アルファチャンネルのモード
double alphaCutoff
 アルファチャンネルの Cutoff値.alphaMode==MATERIAL_ALPHA_MASKING の場合に有効
double shiftU
 UVマップのシフト (U方向).
double shiftV
 UVマップのシフト (V方向).
double scaleU
 UVマップのスケール (U方向).
double scaleV
 UVマップのスケール (V方向).
double rotate
 UVマップの回転.
bool flipU
 UVマップで U方向の反転を行うか.
bool flipV
 UVマップで V方向の反転を行うか.

Detailed Description

Definition at line 57 of file MaterialParam.h.


Constructor & Destructor Documentation

TextureParam ( void   )  [inline]

Definition at line 78 of file MaterialParam.h.

00078 {}

virtual ~TextureParam ( void   )  [inline, virtual]

Definition at line 79 of file MaterialParam.h.

00079 {}


Member Function Documentation

void addName ( const char *  nm  )  [inline]

Definition at line 98 of file MaterialParam.h.

References cat_s2Buffer, and TextureParam::name.

Referenced by MaterialParam::setupFullName().

00098 { if(nm!=NULL) cat_s2Buffer(nm, &name);}

Here is the caller graph for this function:

void clear ( void   )  [inline]

Definition at line 83 of file MaterialParam.h.

References TextureParam::free(), and TextureParam::init().

00083 { free(); init();}

Here is the call graph for this function:

void dup ( TextureParam  m  ) 

Definition at line 45 of file MaterialParam.cpp.

References dup_Buffer(), and TextureParam::name.

Referenced by MaterialParam::dup().

00046 {
00047     *this = t;
00048     
00049     name = dup_Buffer(t.name);
00050 }

Here is the call graph for this function:

Here is the caller graph for this function:

void execFlipU ( UVMap< double > *  uv,
int  n 
) [inline]

Definition at line 137 of file MaterialParam.h.

Referenced by MaterialParam::execFlipU(), TextureParam::execInvTrans(), and TextureParam::execTrans().

00137 { for(int i=0; i<n; i++) uv[i].u = 1.0 - uv[i].u;}

Here is the caller graph for this function:

void execFlipV ( UVMap< double > *  uv,
int  n 
) [inline]

Definition at line 138 of file MaterialParam.h.

Referenced by MaterialParam::execFlipV(), TextureParam::execInvTrans(), and TextureParam::execTrans().

00138 { for(int i=0; i<n; i++) uv[i].v = 1.0 - uv[i].v;}

Here is the caller graph for this function:

void execInvRotate ( UVMap< double > *  uv,
int  n 
)

Definition at line 118 of file MaterialParam.cpp.

References TextureParam::rotate, UVMap< T >::u, and UVMap< T >::v.

Referenced by MaterialParam::execInvRotate(), and TextureParam::execInvTrans().

00119 {
00120     double uu, vv;
00121     double cs =  cos(rotate);
00122     double sn = -sin(rotate);
00123 
00124     for (int i=0; i<num; i++) {
00125         uu = uv[i].u - 0.5;
00126         vv = uv[i].v - 0.5;
00127         uv[i].u =  uu*cs + vv*sn + 0.5;
00128         uv[i].v = -uu*sn + vv*cs + 0.5;
00129     }
00130 }

Here is the caller graph for this function:

void execInvScale ( UVMap< double > *  uv,
int  n 
)

Definition at line 88 of file MaterialParam.cpp.

References TextureParam::scaleU, TextureParam::scaleV, UVMap< T >::u, and UVMap< T >::v.

Referenced by MaterialParam::execInvScale(), and TextureParam::execInvTrans().

00089 {
00090     double uu, vv;
00091 
00092     for (int i=0; i<num; i++) {
00093         uu = (uv[i].u - 0.5)/scaleU;
00094         vv = (uv[i].v - 0.5)/scaleV;
00095         uv[i].u = uu + 0.5;
00096         uv[i].v = vv + 0.5;
00097     }
00098 }

Here is the caller graph for this function:

void execInvShift ( UVMap< double > *  uv,
int  n 
)

Definition at line 64 of file MaterialParam.cpp.

References TextureParam::shiftU, TextureParam::shiftV, UVMap< T >::u, and UVMap< T >::v.

Referenced by MaterialParam::execInvShift(), and TextureParam::execInvTrans().

00065 {
00066     for (int i=0; i<num; i++) {
00067         uv[i].u -= shiftU;
00068         uv[i].v -= shiftV;
00069     }
00070 }

Here is the caller graph for this function:

void execInvTrans ( UVMap< double > *  uv,
int  n 
)

Definition at line 148 of file MaterialParam.cpp.

References TextureParam::execFlipU(), TextureParam::execFlipV(), TextureParam::execInvRotate(), TextureParam::execInvScale(), TextureParam::execInvShift(), TextureParam::flipU, TextureParam::flipV, TextureParam::isSetRotate(), TextureParam::isSetScale(), and TextureParam::isSetShift().

Referenced by MaterialParam::execInvTrans().

00149 {
00150     if (flipU) { execFlipU(uv, num); flipU = false;}    
00151     if (flipV) { execFlipV(uv, num); flipV = false;}    
00152     if (isSetShift())  execInvShift (uv, num);
00153     if (isSetScale())  execInvScale (uv, num);
00154     if (isSetRotate()) execInvRotate(uv, num);
00155 
00156     return;
00157 }

Here is the call graph for this function:

Here is the caller graph for this function:

void execRotate ( UVMap< double > *  uv,
int  n 
)

Definition at line 102 of file MaterialParam.cpp.

References TextureParam::rotate, UVMap< T >::u, and UVMap< T >::v.

Referenced by MaterialParam::execRotate(), and TextureParam::execTrans().

00103 {
00104     double uu, vv;
00105     double cs = cos(rotate);
00106     double sn = sin(rotate);
00107 
00108     for (int i=0; i<num; i++) {
00109         uu = uv[i].u - 0.5;
00110         vv = uv[i].v - 0.5;
00111         uv[i].u =  uu*cs + vv*sn + 0.5;
00112         uv[i].v = -uu*sn + vv*cs + 0.5;
00113     }
00114 }

Here is the caller graph for this function:

void execScale ( UVMap< double > *  uv,
int  n 
)

Definition at line 74 of file MaterialParam.cpp.

References TextureParam::scaleU, TextureParam::scaleV, UVMap< T >::u, and UVMap< T >::v.

Referenced by MaterialParam::execScale(), and TextureParam::execTrans().

00075 {
00076     double uu, vv;
00077 
00078     for (int i=0; i<num; i++) {
00079         uu = (uv[i].u - 0.5)*scaleU;
00080         vv = (uv[i].v - 0.5)*scaleV;
00081         uv[i].u = uu + 0.5;
00082         uv[i].v = vv + 0.5;
00083     }
00084 }

Here is the caller graph for this function:

void execShift ( UVMap< double > *  uv,
int  n 
)

Definition at line 54 of file MaterialParam.cpp.

References TextureParam::shiftU, TextureParam::shiftV, UVMap< T >::u, and UVMap< T >::v.

Referenced by MaterialParam::execShift(), and TextureParam::execTrans().

00055 {
00056     for (int i=0; i<num; i++) {
00057         uv[i].u += shiftU;
00058         uv[i].v += shiftV;
00059     }
00060 }

Here is the caller graph for this function:

void execTrans ( UVMap< double > *  uv,
int  n 
)

Definition at line 134 of file MaterialParam.cpp.

References TextureParam::execFlipU(), TextureParam::execFlipV(), TextureParam::execRotate(), TextureParam::execScale(), TextureParam::execShift(), TextureParam::flipU, TextureParam::flipV, TextureParam::isSetRotate(), TextureParam::isSetScale(), and TextureParam::isSetShift().

Referenced by MaterialParam::execTrans().

00135 {
00136     //DEBUG_MODE PRINT_MESG("%f %f, %f %f, %f\n", shiftU, shiftV, scaleU, scaleV, rotate);
00137     if (flipU) { execFlipU(uv, num); flipU = false;}    
00138     if (flipV) { execFlipV(uv, num); flipV = false;}    
00139     if (isSetRotate()) execRotate(uv, num);
00140     if (isSetScale())  execScale (uv, num);
00141     if (isSetShift())  execShift (uv, num);
00142 
00143     return;
00144 }

Here is the call graph for this function:

Here is the caller graph for this function:

void free ( void   ) 

Definition at line 36 of file MaterialParam.cpp.

References free_Buffer(), and TextureParam::name.

Referenced by TextureParam::clear(), and MaterialParam::free().

00037 {
00038     free_Buffer(&name);
00039 
00040     return;
00041 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool getAlphaChannel ( void   )  [inline]

Definition at line 123 of file MaterialParam.h.

References TextureParam::alphaChannel.

Referenced by MaterialParam::getAlphaChannel().

00123 { return alphaChannel;}

Here is the caller graph for this function:

double getAlphaCutoff ( void   )  [inline]

Definition at line 125 of file MaterialParam.h.

References TextureParam::alphaCutoff.

Referenced by MaterialParam::getAlphaCutoff().

00125 { return alphaCutoff;}

Here is the caller graph for this function:

int getAlphaMode ( void   )  [inline]

Definition at line 124 of file MaterialParam.h.

References TextureParam::alphaMode, TextureParam::color, and MATERIAL_ALPHA_BLENDING.

Referenced by MaterialParam::getAlphaMode().

00124 { if (color[3]<0.99) return MATERIAL_ALPHA_BLENDING; else return alphaMode;}

Here is the caller graph for this function:

double getColor ( int  c  )  [inline]

Definition at line 116 of file MaterialParam.h.

References TextureParam::color.

Referenced by ColladaXML::addEffect(), MaterialParam::getColor(), and jbxl::isSameTexture().

00116 { if(c<0) c = 0; else if(c>3) c = 3; return color[c];}

Here is the caller graph for this function:

char* getName ( void   )  [inline]

Definition at line 97 of file MaterialParam.h.

References Buffer::buf, and TextureParam::name.

Referenced by MaterialParam::getBumpMapName(), MaterialParam::getSpecMapName(), MaterialParam::getTextureName(), and jbxl::isSameTexture().

00097 { return (char*)name.buf;}

Here is the caller graph for this function:

double getRotate ( void   )  [inline]

Definition at line 121 of file MaterialParam.h.

References TextureParam::rotate.

Referenced by MaterialParam::getRotate().

00121 { return rotate;}

Here is the caller graph for this function:

double getScaleU ( void   )  [inline]

Definition at line 119 of file MaterialParam.h.

References TextureParam::scaleU.

Referenced by MaterialParam::getScaleU().

00119 { return scaleU;}

Here is the caller graph for this function:

double getScaleV ( void   )  [inline]

Definition at line 120 of file MaterialParam.h.

References TextureParam::scaleV.

Referenced by MaterialParam::getScaleV().

00120 { return scaleV;}

Here is the caller graph for this function:

double getShiftU ( void   )  [inline]

Definition at line 117 of file MaterialParam.h.

References TextureParam::shiftU.

Referenced by MaterialParam::getShiftU().

00117 { return shiftU;}

Here is the caller graph for this function:

double getShiftV ( void   )  [inline]

Definition at line 118 of file MaterialParam.h.

References TextureParam::shiftV.

Referenced by MaterialParam::getShiftV().

00118 { return shiftV;}

Here is the caller graph for this function:

void init ( void   ) 

Definition at line 12 of file MaterialParam.cpp.

References TextureParam::alphaChannel, TextureParam::alphaCutoff, TextureParam::alphaMode, TextureParam::color, TextureParam::flipU, TextureParam::flipV, init_Buffer(), MATERIAL_ALPHA_NONE, TextureParam::name, TextureParam::rotate, TextureParam::scaleU, TextureParam::scaleV, TextureParam::shiftU, and TextureParam::shiftV.

Referenced by TextureParam::clear(), and MaterialParam::init().

00013 {
00014     name = init_Buffer();
00015 
00016     for (int i=0; i<4; i++) color[i] = 1.0;
00017 
00018     alphaChannel = false;
00019     alphaMode    = MATERIAL_ALPHA_NONE;
00020     alphaCutoff  = 0.0;
00021 
00022     shiftU       = 0.0;
00023     shiftV       = 0.0;
00024     scaleU       = 1.0;
00025     scaleV       = 1.0;
00026     rotate       = 0.0;
00027 
00028     flipU        = false;
00029     flipV        = false;
00030 
00031     return;
00032 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool isSetAlpha ( void   )  [inline]
bool isSetColor ( void   )  [inline]

Definition at line 88 of file MaterialParam.h.

References TextureParam::color.

Referenced by MaterialParam::isSetColor(), and TextureParam::isSetParams().

00088 { return (color[0]!=1.0 || color[1]!=1.0 || color[2]!=1.0 || color[3]!=1.0);}

Here is the caller graph for this function:

bool isSetParams ( void   )  [inline]

Definition at line 90 of file MaterialParam.h.

References TextureParam::isSetAlpha(), and TextureParam::isSetColor().

Referenced by MaterialParam::isSetTextureParams().

00090 { return (isSetColor() || isSetAlpha());}

Here is the call graph for this function:

Here is the caller graph for this function:

bool isSetRotate ( void   )  [inline]

Definition at line 94 of file MaterialParam.h.

References TextureParam::rotate.

Referenced by TextureParam::execInvTrans(), and TextureParam::execTrans().

00094 { return (rotate!=0.0);}

Here is the caller graph for this function:

bool isSetScale ( void   )  [inline]

Definition at line 93 of file MaterialParam.h.

References TextureParam::scaleU, and TextureParam::scaleV.

Referenced by TextureParam::execInvTrans(), and TextureParam::execTrans().

00093 { return (scaleU!=1.0 || scaleV!=1.0);}

Here is the caller graph for this function:

bool isSetShift ( void   )  [inline]

Definition at line 92 of file MaterialParam.h.

References TextureParam::shiftU, and TextureParam::shiftV.

Referenced by TextureParam::execInvTrans(), and TextureParam::execTrans().

00092 { return (shiftU!=0.0 || shiftV!=0.0);}

Here is the caller graph for this function:

bool isSetTexture ( void   )  [inline]

Definition at line 87 of file MaterialParam.h.

References Buffer::buf, and TextureParam::name.

Referenced by MaterialParam::isSetBumpMap(), MaterialParam::isSetSpecMap(), MaterialParam::isSetTexture(), MaterialParam::printParam(), and MaterialParam::setupFullName().

00087 { return (name.buf!=NULL);}

Here is the caller graph for this function:

void printParam ( FILE *  fp  ) 

Definition at line 161 of file MaterialParam.cpp.

References TextureParam::alphaChannel, Buffer::buf, TextureParam::color, TextureParam::flipU, TextureParam::flipV, TextureParam::name, TextureParam::rotate, TextureParam::scaleU, TextureParam::scaleV, TextureParam::shiftU, and TextureParam::shiftV.

Referenced by MaterialParam::printParam().

00162 {
00163     fprintf(fp, "TextureParam.name         = %s\n", name.buf);
00164     fprintf(fp, "TextureParam.color        = (%f,%f,%f,%f) [RGBA]\n", color[0], color[1], color[2], color[3]);
00165     fprintf(fp, "TextureParam.shiftU       = %f\n", shiftU);
00166     fprintf(fp, "TextureParam.shiftV       = %f\n", shiftV);
00167     fprintf(fp, "TextureParam.scaleU       = %f\n", scaleU);
00168     fprintf(fp, "TextureParam.scaleV       = %f\n", scaleV);
00169     fprintf(fp, "TextureParam.rotate       = %f\n", rotate);
00170     
00171     if (alphaChannel) fprintf(fp, "TextureParam.alphaChannel = true\n");
00172     else              fprintf(fp, "TextureParam.alphaChannel = flase\n");
00173 
00174     if (flipU) fprintf(fp, "TextureParam.flipU        = true\n");
00175     else       fprintf(fp, "TextureParam.flipU        = false\n");
00176     if (flipV) fprintf(fp, "TextureParam.flipV        = true\n");
00177     else       fprintf(fp, "TextureParam.flipV        = false\n");
00178 
00179     fflush(fp);
00180     return;
00181 }

Here is the caller graph for this function:

void setAlphaChannel ( bool  h  )  [inline]

Definition at line 112 of file MaterialParam.h.

References TextureParam::alphaChannel.

Referenced by MaterialParam::setAlphaChannel().

00112 { alphaChannel = h;}

Here is the caller graph for this function:

void setAlphaCutoff ( double  m  )  [inline]

Definition at line 114 of file MaterialParam.h.

References TextureParam::alphaCutoff.

Referenced by MaterialParam::setAlphaCutoff().

00114 { alphaCutoff = m;}

Here is the caller graph for this function:

void setAlphaMode ( int  m  )  [inline]

Definition at line 113 of file MaterialParam.h.

References TextureParam::alphaMode.

Referenced by MaterialParam::setAlphaMode().

00113 { alphaMode = m;}

Here is the caller graph for this function:

void setColor ( double  v,
int  c 
) [inline]

Definition at line 101 of file MaterialParam.h.

References TextureParam::color.

00101 { if(c<0) c = 0; else if(c>3) c = 3; color[c] = v;}

void setColor ( double  r,
double  g,
double  b,
double  a = 1.0 
) [inline]

Definition at line 100 of file MaterialParam.h.

References TextureParam::color.

Referenced by MaterialParam::setColor().

00100 { color[0] = r; color[1] = g; color[2] = b; color[3] = a;}

Here is the caller graph for this function:

void setFlipU ( bool  f  )  [inline]

Definition at line 107 of file MaterialParam.h.

References TextureParam::flipU.

Referenced by MaterialParam::setFlipU().

00107 { flipU  = f;}

Here is the caller graph for this function:

void setFlipV ( bool  f  )  [inline]

Definition at line 108 of file MaterialParam.h.

References TextureParam::flipV.

Referenced by MaterialParam::setFlipV().

00108 { flipV  = f;}

Here is the caller graph for this function:

void setName ( const char *  nm  )  [inline]

Definition at line 96 of file MaterialParam.h.

References free_Buffer(), make_Buffer_bystr, and TextureParam::name.

Referenced by MaterialParam::setBumpMapName(), MaterialParam::setSpecMapName(), and MaterialParam::setTextureName().

00096 { free_Buffer(&name); if(nm!=NULL) name = make_Buffer_bystr(nm);}

Here is the call graph for this function:

Here is the caller graph for this function:

void setRotate ( double  r  )  [inline]

Definition at line 106 of file MaterialParam.h.

References TextureParam::rotate.

Referenced by MaterialParam::setRotate().

00106 { rotate = r;}

Here is the caller graph for this function:

void setScale ( double  u,
double  v 
) [inline]

Definition at line 110 of file MaterialParam.h.

References TextureParam::scaleU, and TextureParam::scaleV.

00110 { scaleU = u; scaleV = v;}

void setScaleU ( double  u  )  [inline]

Definition at line 104 of file MaterialParam.h.

References TextureParam::scaleU.

Referenced by MaterialParam::setScale(), and MaterialParam::setScaleU().

00104 { scaleU = u;}

Here is the caller graph for this function:

void setScaleV ( double  v  )  [inline]

Definition at line 105 of file MaterialParam.h.

References TextureParam::scaleV.

Referenced by MaterialParam::setScale(), and MaterialParam::setScaleV().

00105 { scaleV = v;}

Here is the caller graph for this function:

void setShift ( double  u,
double  v 
) [inline]

Definition at line 109 of file MaterialParam.h.

References TextureParam::shiftU, and TextureParam::shiftV.

00109 { shiftU = u; shiftV = v;}

void setShiftU ( double  u  )  [inline]

Definition at line 102 of file MaterialParam.h.

References TextureParam::shiftU.

Referenced by MaterialParam::setShift(), and MaterialParam::setShiftU().

00102 { shiftU = u;}

Here is the caller graph for this function:

void setShiftV ( double  v  )  [inline]

Definition at line 103 of file MaterialParam.h.

References TextureParam::shiftV.

Referenced by MaterialParam::setShift(), and MaterialParam::setShiftV().

00103 { shiftV = v;}

Here is the caller graph for this function:


Member Data Documentation

bool alphaChannel [private]
double alphaCutoff [private]
int alphaMode [private]
double color[4] [private]
bool flipU [private]
bool flipV [private]
Buffer name [private]
double rotate [private]
double scaleU [private]
double scaleV [private]
double shiftU [private]
double shiftV [private]

The documentation for this class was generated from the following files:

Generated on 15 Nov 2023 for JunkBox_Lib++ (for Windows) by  doxygen 1.6.1