VRUT::Material Struct Reference

Material definition. More...

#include <material.h>

List of all members.

Public Types

enum  FLAG {
  BLENDED = 0x00000001, DEPTH_TEST_DISABLE = 0x00000002, DEPTH_MASK_DISABLE = 0x00000004, DOUBLE_SIDED = 0x00000008,
  INVERT_ALPHA = 0x00000010, UNLIT = 0x00000020
}
 Material flags definitions. More...
enum  TEX_FLAG {
  TEX_UWRAP_REPEAT = 0x00000001, TEX_UWRAP_CLAMP = 0x00000002, TEX_VWRAP_REPEAT = 0x00000004, TEX_VWRAP_CLAMP = 0x00000008,
  TEX_MIN_FILTER_POINT = 0x00000010, TEX_MIN_FILTER_LINEAR = 0x00000020, TEX_MIN_FILTER_MIPMAP = 0x00000040, TEX_MAG_FILTER_POINT = 0x00000080,
  TEX_MAG_FILTER_LINEAR = 0x00000100, TEX_ENV_MODULATE = 0x00000400, TEX_ENV_REPLACE = 0x00000800, TEX_ENV_DECAL = 0x00001000,
  TEX_ENV_BLEND = 0x00002000, TEX_ENV_ADD = 0x00004000, TEX_IGNORE_COLORS = 0x00008000, TEX_GEN_FUNC_U_EYE = 0x00010000,
  TEX_GEN_FUNC_U_OBJECT = 0x00020000, TEX_GEN_FUNC_U_SPHERE = 0x00040000, TEX_GEN_FUNC_V_EYE = 0x00080000, TEX_GEN_FUNC_V_OBJECT = 0x00100000,
  TEX_GEN_FUNC_V_SPHERE = 0x00200000, TEX_GEN_ENABLED = 0x003f0000
}
 Texture flags definitons. More...

Public Member Functions

 Material (const wxString &_name)
 Constructor.
 Material (const Material &m)
 Copy constructor.
 ~Material ()
 Destructor.
MaterialClone () const
 Get copy of instance.
bool IsSameAs (const Material &m, int fieldsMask) const
 Compare materials.

Public Attributes

wxString uid
 Unique ID.
wxString name
 Name.
VECTOR4 ambient
 Ambient color RGB.
VECTOR4 diffuse
 Diffuse color RGB.
VECTOR4 specular
 Specular color RGB.
VECTOR4 emission
 Emission color RGB.
float shininess
 Shininess intensity.
GLuint depthFunc
 Depth function.
float textureMix
 Texture mix.
unsigned flags
 Material flags.
unsigned texFlags
 Texture flags.
GLuint texBlendSrc
 Texture source blend func.
GLuint texBlendDst
 Texture destination blend func.
wxString imageName
 Image name.
ShaderProgramshader
 Shader program.


Detailed Description

Material definition.

Definition at line 24 of file material.h.


Member Enumeration Documentation

Material flags definitions.

Enumerator:
BLENDED  Blending should be enabled when rendering material.
DEPTH_TEST_DISABLE 
DEPTH_MASK_DISABLE 
DOUBLE_SIDED 
INVERT_ALPHA 
UNLIT 

Definition at line 45 of file material.h.

00046               {
00047                      BLENDED                = 0x00000001,  
00048                      DEPTH_TEST_DISABLE     = 0x00000002,
00049                      DEPTH_MASK_DISABLE     = 0x00000004,
00050                      DOUBLE_SIDED           = 0x00000008,
00051                      INVERT_ALPHA           = 0x00000010,
00052                      UNLIT                  = 0x00000020,
00053               };

Texture flags definitons.

Enumerator:
TEX_UWRAP_REPEAT 
TEX_UWRAP_CLAMP 
TEX_VWRAP_REPEAT 
TEX_VWRAP_CLAMP 
TEX_MIN_FILTER_POINT 
TEX_MIN_FILTER_LINEAR 
TEX_MIN_FILTER_MIPMAP 
TEX_MAG_FILTER_POINT 
TEX_MAG_FILTER_LINEAR 
TEX_ENV_MODULATE 
TEX_ENV_REPLACE 
TEX_ENV_DECAL 
TEX_ENV_BLEND 
TEX_ENV_ADD 
TEX_IGNORE_COLORS 
TEX_GEN_FUNC_U_EYE 
TEX_GEN_FUNC_U_OBJECT 
TEX_GEN_FUNC_U_SPHERE 
TEX_GEN_FUNC_V_EYE 
TEX_GEN_FUNC_V_OBJECT 
TEX_GEN_FUNC_V_SPHERE 
TEX_GEN_ENABLED 

Definition at line 58 of file material.h.

00059               {
00060                      TEX_UWRAP_REPEAT       = 0x00000001,
00061                      TEX_UWRAP_CLAMP        = 0x00000002,
00062                      TEX_VWRAP_REPEAT       = 0x00000004,
00063                      TEX_VWRAP_CLAMP        = 0x00000008,
00064                      TEX_MIN_FILTER_POINT   = 0x00000010,
00065                      TEX_MIN_FILTER_LINEAR  = 0x00000020,
00066                      TEX_MIN_FILTER_MIPMAP  = 0x00000040,
00067                      TEX_MAG_FILTER_POINT   = 0x00000080,
00068                      TEX_MAG_FILTER_LINEAR  = 0x00000100,
00069 
00070                      TEX_ENV_MODULATE     = 0x00000400,
00071                      TEX_ENV_REPLACE      = 0x00000800,
00072                      TEX_ENV_DECAL        = 0x00001000,
00073                      TEX_ENV_BLEND        = 0x00002000,
00074                      TEX_ENV_ADD          = 0x00004000,
00075                      TEX_IGNORE_COLORS      = 0x00008000,
00076 
00077                      TEX_GEN_FUNC_U_EYE     = 0x00010000,
00078                      TEX_GEN_FUNC_U_OBJECT  = 0x00020000,
00079                      TEX_GEN_FUNC_U_SPHERE  = 0x00040000,
00080                      TEX_GEN_FUNC_V_EYE     = 0x00080000,
00081                      TEX_GEN_FUNC_V_OBJECT  = 0x00100000,
00082                      TEX_GEN_FUNC_V_SPHERE  = 0x00200000,
00083                      TEX_GEN_ENABLED        = 0x003f0000   //auxiliary value to test if any tex coord gen function enabled
00084               };


Constructor & Destructor Documentation

VRUT::Material::Material ( const wxString &  _name  )  [inline]

Constructor.

Definition at line 97 of file material.h.

00097                                                : name(CloneWxString(_name))
00098               {
00099                      depthFunc = GL_LEQUAL;
00100                      shininess = 0.0f;
00101                      textureMix = 1;
00102                      texFlags = flags = 0;
00103                      texBlendSrc = texBlendDst = GL_ID_NONE;
00104                      shader = (ShaderProgram *)NULL;
00105               }

VRUT::Material::Material ( const Material m  )  [inline]

Copy constructor.

Definition at line 108 of file material.h.

00109                      : uid(CloneWxString(m.uid)), name(CloneWxString(m.name)), ambient(m.ambient),
00110                      diffuse(m.diffuse), specular(m.specular), emission(m.emission),
00111                      shininess(m.shininess), depthFunc(m.depthFunc), textureMix(m.textureMix),
00112                      flags(m.flags), texFlags(m.texFlags), texBlendSrc(m.texBlendSrc),
00113                      texBlendDst(m.texBlendDst), imageName(CloneWxString(m.imageName))
00114               {
00115                      shader = ( m.shader ? m.shader->Clone() : (ShaderProgram *)NULL );
00116               }

VRUT::Material::~Material (  )  [inline]

Destructor.

Definition at line 119 of file material.h.

00120               {
00121                      SAFE_DELETE(shader);
00122               }


Member Function Documentation

Material* VRUT::Material::Clone (  )  const [inline]

Get copy of instance.

Definition at line 125 of file material.h.

00126               {
00127                      return new Material(*this);
00128               }

bool VRUT::Material::IsSameAs ( const Material m,
int  fieldsMask 
) const [inline]

Compare materials.

Definition at line 131 of file material.h.

00132               {
00133                      //Name
00134                      if (fieldsMask & 1)
00135                             if (name != m.name)
00136                                    return false;
00137                      //UID
00138                      if (fieldsMask & 2)
00139                             if (uid != m.uid)
00140                                    return false;
00141                      //Colors
00142                      if (fieldsMask & 4)
00143                             if ((ambient != m.ambient) || (diffuse != m.diffuse) || (specular != m.specular) || (emission != m.emission)
00144                                    || (shininess != m.shininess) || (depthFunc != m.depthFunc) || (flags != m.flags))
00145                                    return false;
00146                      //Texture
00147                      if (fieldsMask & 8)
00148                             if ((textureMix != m.textureMix) || (texFlags != m.texFlags) || (texBlendSrc != m.texBlendSrc) || (texBlendDst != m.texBlendDst) || (imageName != m.imageName))
00149                                    return false;
00150                      //Shader
00151                      if (fieldsMask & 16)
00152                             if (shader)
00153                             {
00154                                    if (!m.shader)
00155                                           return false;
00156                                    else
00157                                    {
00158                                           if (!shader->IsSameAs(*(m.shader), 3))
00159                                                  return false;
00160                                    }
00161                             }
00162                             else
00163                             {
00164                                    if (m.shader)
00165                                           return false;
00166                             }
00167                      return true;
00168               }


Member Data Documentation

Unique ID.

Definition at line 27 of file material.h.

Name.

Definition at line 29 of file material.h.

Ambient color RGB.

Definition at line 31 of file material.h.

Diffuse color RGB.

Definition at line 33 of file material.h.

Specular color RGB.

Definition at line 35 of file material.h.

Emission color RGB.

Definition at line 37 of file material.h.

Shininess intensity.

Definition at line 39 of file material.h.

Depth function.

Definition at line 41 of file material.h.

Texture mix.

Definition at line 43 of file material.h.

Material flags.

Definition at line 55 of file material.h.

Texture flags.

Definition at line 86 of file material.h.

Texture source blend func.

Definition at line 88 of file material.h.

Texture destination blend func.

Definition at line 90 of file material.h.

Image name.

Definition at line 92 of file material.h.

Shader program.

Definition at line 94 of file material.h.


The documentation for this struct was generated from the following file:

Generated on Tue Mar 10 14:41:44 2009 for VRUT by  doxygen 1.5.5