arsa  2.7
Classes | Typedefs | Enumerations | Functions
irr::scene::quake3 Namespace Reference

Classes

struct  IShader
 A Parsed Shader Holding Variables ordered in Groups. More...
 
class  IShaderManager
 Manages various Quake3 Shader Styles. More...
 
struct  Noiser
 
struct  Q3LevelLoadParameter
 
struct  SBlendFunc
 A blend function for a q3 shader. More...
 
struct  SModifierFunction
 
struct  SVarGroup
 
struct  SVarGroupList
 holding a group a variable More...
 
struct  SVariable
 

Typedefs

typedef core::array< core::stringctStringList
 
typedef core::array< video::ITexture * > tTexArray
 
typedef IShader IEntity
 
typedef core::array< IEntitytQ3EntityList
 

Enumerations

enum  eQ3MeshIndex {
  E_Q3_MESH_GEOMETRY = 0, E_Q3_MESH_ITEMS, E_Q3_MESH_BILLBOARD, E_Q3_MESH_FOG,
  E_Q3_MESH_UNRESOLVED, E_Q3_MESH_SIZE
}
 Hold the different Mesh Types used for getMesh. More...
 
enum  eQ3ModifierFunction {
  TCMOD = 0, DEFORMVERTEXES = 1, RGBGEN = 2, TCGEN = 3,
  MAP = 4, ALPHAGEN = 5, FUNCTION2 = 0x10, SCROLL = FUNCTION2 + 1,
  SCALE = FUNCTION2 + 2, ROTATE = FUNCTION2 + 3, STRETCH = FUNCTION2 + 4, TURBULENCE = FUNCTION2 + 5,
  WAVE = FUNCTION2 + 6, IDENTITY = FUNCTION2 + 7, VERTEX = FUNCTION2 + 8, TEXTURE = FUNCTION2 + 9,
  LIGHTMAP = FUNCTION2 + 10, ENVIRONMENT = FUNCTION2 + 11, DOLLAR_LIGHTMAP = FUNCTION2 + 12, BULGE = FUNCTION2 + 13,
  AUTOSPRITE = FUNCTION2 + 14, AUTOSPRITE2 = FUNCTION2 + 15, TRANSFORM = FUNCTION2 + 16, EXACTVERTEX = FUNCTION2 + 17,
  CONSTANT = FUNCTION2 + 18, LIGHTINGSPECULAR = FUNCTION2 + 19, MOVE = FUNCTION2 + 20, NORMAL = FUNCTION2 + 21,
  IDENTITYLIGHTING = FUNCTION2 + 22, WAVE_MODIFIER_FUNCTION = 0x30, SINUS = WAVE_MODIFIER_FUNCTION + 1, COSINUS = WAVE_MODIFIER_FUNCTION + 2,
  SQUARE = WAVE_MODIFIER_FUNCTION + 3, TRIANGLE = WAVE_MODIFIER_FUNCTION + 4, SAWTOOTH = WAVE_MODIFIER_FUNCTION + 5, SAWTOOTH_INVERSE = WAVE_MODIFIER_FUNCTION + 6,
  NOISE = WAVE_MODIFIER_FUNCTION + 7, UNKNOWN = -2
}
 

Functions

s16 isEqual (const core::stringc &string, u32 &pos, const c8 *const list[], u16 listSize)
 
f32 getAsFloat (const core::stringc &string, u32 &pos)
 
core::vector3df getAsVector3df (const core::stringc &string, u32 &pos)
 get a quake3 vector translated to irrlicht position (x,-z,y ) More...
 
void getAsStringList (tStringList &list, s32 max, const core::stringc &string, u32 &startPos)
 
bool getCullingFunction (const core::stringc &cull)
 
u8 getDepthFunction (const core::stringc &string)
 
core::vector3df getMD3Normal (u32 i, u32 j)
 
void getModifierFunc (SModifierFunction &fill, const core::stringc &string, u32 &pos)
 
void dumpVarGroup (core::stringc &dest, const SVarGroup *group, s32 stack)
 
core::stringcdumpShader (core::stringc &dest, const IShader *shader, bool entity=false)
 
void getTextures (tTexArray &textures, const core::stringc &name, u32 &startPos, const io::IFileSystem *fileSystem, video::IVideoDriver *driver)
 

Typedef Documentation

◆ IEntity

Definition at line 685 of file IQ3Shader.h.

◆ tQ3EntityList

Definition at line 687 of file IQ3Shader.h.

◆ tStringList

Definition at line 79 of file IQ3Shader.h.

◆ tTexArray

Definition at line 80 of file IQ3Shader.h.

Enumeration Type Documentation

◆ eQ3MeshIndex

Hold the different Mesh Types used for getMesh.

Enumerator
E_Q3_MESH_GEOMETRY 
E_Q3_MESH_ITEMS 
E_Q3_MESH_BILLBOARD 
E_Q3_MESH_FOG 
E_Q3_MESH_UNRESOLVED 
E_Q3_MESH_SIZE 

Definition at line 24 of file IQ3Shader.h.

◆ eQ3ModifierFunction

Enumerator
TCMOD 
DEFORMVERTEXES 
RGBGEN 
TCGEN 
MAP 
ALPHAGEN 
FUNCTION2 
SCROLL 
SCALE 
ROTATE 
STRETCH 
TURBULENCE 
WAVE 
IDENTITY 
VERTEX 
TEXTURE 
LIGHTMAP 
ENVIRONMENT 
DOLLAR_LIGHTMAP 
BULGE 
AUTOSPRITE 
AUTOSPRITE2 
TRANSFORM 
EXACTVERTEX 
CONSTANT 
LIGHTINGSPECULAR 
MOVE 
NORMAL 
IDENTITYLIGHTING 
WAVE_MODIFIER_FUNCTION 
SINUS 
COSINUS 
SQUARE 
TRIANGLE 
SAWTOOTH 
SAWTOOTH_INVERSE 
NOISE 
UNKNOWN 

Definition at line 372 of file IQ3Shader.h.

373  {
374  TCMOD = 0,
375  DEFORMVERTEXES = 1,
376  RGBGEN = 2,
377  TCGEN = 3,
378  MAP = 4,
379  ALPHAGEN = 5,
380 
381  FUNCTION2 = 0x10,
382  SCROLL = FUNCTION2 + 1,
383  SCALE = FUNCTION2 + 2,
384  ROTATE = FUNCTION2 + 3,
385  STRETCH = FUNCTION2 + 4,
386  TURBULENCE = FUNCTION2 + 5,
387  WAVE = FUNCTION2 + 6,
388 
389  IDENTITY = FUNCTION2 + 7,
390  VERTEX = FUNCTION2 + 8,
391  TEXTURE = FUNCTION2 + 9,
392  LIGHTMAP = FUNCTION2 + 10,
393  ENVIRONMENT = FUNCTION2 + 11,
394  DOLLAR_LIGHTMAP = FUNCTION2 + 12,
395  BULGE = FUNCTION2 + 13,
396  AUTOSPRITE = FUNCTION2 + 14,
397  AUTOSPRITE2 = FUNCTION2 + 15,
398  TRANSFORM = FUNCTION2 + 16,
399  EXACTVERTEX = FUNCTION2 + 17,
400  CONSTANT = FUNCTION2 + 18,
402  MOVE = FUNCTION2 + 20,
403  NORMAL = FUNCTION2 + 21,
405 
406  WAVE_MODIFIER_FUNCTION = 0x30,
414 
415  UNKNOWN = -2
416  };

Function Documentation

◆ dumpShader()

core::stringc& irr::scene::quake3::dumpShader ( core::stringc dest,
const IShader shader,
bool  entity = false 
)
inline

dump a Shader or an Entity

Definition at line 734 of file IQ3Shader.h.

735  {
736  if ( 0 == shader )
737  return dest;
738 
739  const u32 size = shader->VarGroup->VariableGroup.size ();
740  for ( u32 i = 0; i != size; ++i )
741  {
742  const SVarGroup * group = &shader->VarGroup->VariableGroup[ i ];
743  dumpVarGroup ( dest, group, core::clamp( (int)i, 0, 2 ) );
744  }
745 
746  if ( !entity )
747  {
748  if ( size <= 1 )
749  {
750  dest.append ( "{\n" );
751  }
752  dest.append ( "}\n" );
753  }
754  return dest;
755  }
GLboolean GLuint group
GLsizeiptr size
GLenum clamp
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
void dumpVarGroup(core::stringc &dest, const SVarGroup *group, s32 stack)
Definition: IQ3Shader.h:693
GLuint shader

◆ dumpVarGroup()

void irr::scene::quake3::dumpVarGroup ( core::stringc dest,
const SVarGroup group,
s32  stack 
)
inline

Definition at line 693 of file IQ3Shader.h.

694  {
696 
697  if ( stack > 0 )
698  {
699  buf = "";
700  for (s32 i = 0; i < stack - 1; ++i )
701  buf += '\t';
702 
703  buf += "{\n";
704  dest.append ( buf );
705  }
706 
707  for ( u32 g = 0; g != group->Variable.size(); ++g )
708  {
709  buf = "";
710  for (s32 i = 0; i < stack; ++i )
711  buf += '\t';
712 
713  buf += group->Variable[g].name;
714  buf += " ";
715  buf += group->Variable[g].content;
716  buf += "\n";
717  dest.append ( buf );
718  }
719 
720  if ( stack > 1 )
721  {
722  buf = "";
723  for (s32 i = 0; i < stack - 1; ++i )
724  buf += '\t';
725 
726  buf += "}\n";
727  dest.append ( buf );
728  }
729  }
GLboolean GLuint group
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
string< c8 > stringc
Typedef for character strings.
Definition: irrString.h:1458
GLenum GLuint GLenum GLsizei const GLchar * buf
GLboolean GLboolean g

◆ getAsFloat()

f32 irr::scene::quake3::getAsFloat ( const core::stringc string,
u32 pos 
)
inline

Definition at line 105 of file IQ3Shader.h.

106  {
107  const char * in = string.c_str () + pos;
108 
109  f32 value = 0.f;
110  pos += (u32) ( core::fast_atof_move ( in, value ) - in ) + 1;
111  return value;
112  }
const char * fast_atof_move(const char *in, f32 &result)
Provides a fast function for converting a string into a float.
Definition: fast_atof.h:310
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
GLsizei const GLfloat * value
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint in

◆ getAsStringList()

void irr::scene::quake3::getAsStringList ( tStringList list,
s32  max,
const core::stringc string,
u32 startPos 
)
inline

Definition at line 130 of file IQ3Shader.h.

131  {
132  list.clear ();
133 
134  s32 finish = 0;
135  s32 endPos;
136  do
137  {
138  endPos = string.findNext ( ' ', startPos );
139  if ( endPos == -1 )
140  {
141  finish = 1;
142  endPos = string.size();
143  }
144 
145  list.push_back ( string.subString ( startPos, endPos - startPos ) );
146  startPos = endPos + 1;
147 
148  if ( list.size() >= (u32) max )
149  finish = 1;
150 
151  } while ( !finish );
152 
153  }
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

◆ getAsVector3df()

core::vector3df irr::scene::quake3::getAsVector3df ( const core::stringc string,
u32 pos 
)
inline

get a quake3 vector translated to irrlicht position (x,-z,y )

Definition at line 115 of file IQ3Shader.h.

116  {
118 
119  v.X = getAsFloat ( string, pos );
120  v.Z = getAsFloat ( string, pos );
121  v.Y = getAsFloat ( string, pos );
122 
123  return v;
124  }
f32 getAsFloat(const core::stringc &string, u32 &pos)
Definition: IQ3Shader.h:105
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition: vector3d.h:461
const GLdouble * v
Definition: SDL_opengl.h:2064

◆ getCullingFunction()

bool irr::scene::quake3::getCullingFunction ( const core::stringc cull)
inline

Definition at line 171 of file IQ3Shader.h.

172  {
173  if ( cull.size() == 0 )
174  return true;
175 
176  bool ret = true;
177  static const c8 * funclist[] = { "none", "disable", "twosided" };
178 
179  u32 pos = 0;
180  switch ( isEqual ( cull, pos, funclist, 3 ) )
181  {
182  case 0:
183  case 1:
184  case 2:
185  ret = false;
186  break;
187  }
188  return ret;
189  }
char c8
8 bit character variable.
Definition: irrTypes.h:35
s16 isEqual(const core::stringc &string, u32 &pos, const c8 *const list[], u16 listSize)
Definition: IQ3Shader.h:83
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

◆ getDepthFunction()

u8 irr::scene::quake3::getDepthFunction ( const core::stringc string)
inline

Definition at line 193 of file IQ3Shader.h.

194  {
196 
197  if ( string.size() == 0 )
198  return ret;
199 
200  static const c8 * funclist[] = { "lequal","equal" };
201 
202  u32 pos = 0;
203  switch ( isEqual ( string, pos, funclist, 2 ) )
204  {
205  case 0:
206  ret = video::ECFN_LESSEQUAL;
207  break;
208  case 1:
209  ret = video::ECFN_EQUAL;
210  break;
211  }
212  return ret;
213  }
char c8
8 bit character variable.
Definition: irrTypes.h:35
GLsizeiptr size
s16 isEqual(const core::stringc &string, u32 &pos, const c8 *const list[], u16 listSize)
Definition: IQ3Shader.h:83
unsigned char u8
8 bit unsigned variable.
Definition: irrTypes.h:22
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
Exact equality.
Definition: SMaterial.h:70
<= test, default for e.g. depth test
Definition: SMaterial.h:68

◆ getMD3Normal()

core::vector3df irr::scene::quake3::getMD3Normal ( u32  i,
u32  j 
)
inline

Definition at line 508 of file IQ3Shader.h.

509  {
510  const f32 lng = i * 2.0f * core::PI / 255.0f;
511  const f32 lat = j * 2.0f * core::PI / 255.0f;
512  return core::vector3df(cosf ( lat ) * sinf ( lng ),
513  sinf ( lat ) * sinf ( lng ),
514  cosf ( lng ));
515  }
const f32 PI
Constant for PI.
Definition: irrMath.h:57
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition: vector3d.h:461

◆ getModifierFunc()

void irr::scene::quake3::getModifierFunc ( SModifierFunction fill,
const core::stringc string,
u32 pos 
)
inline

Definition at line 518 of file IQ3Shader.h.

519  {
520  if ( string.size() == 0 )
521  return;
522 
523  static const c8 * funclist[] =
524  {
525  "sin","cos","square",
526  "triangle", "sawtooth","inversesawtooth", "noise"
527  };
528 
529  fill.func = (eQ3ModifierFunction) isEqual ( string,pos, funclist,7 );
530  fill.func = fill.func == UNKNOWN ? SINUS : (eQ3ModifierFunction) ((u32) fill.func + WAVE_MODIFIER_FUNCTION + 1);
531 
532  fill.base = getAsFloat ( string, pos );
533  fill.amp = getAsFloat ( string, pos );
534  fill.phase = getAsFloat ( string, pos );
535  fill.frequency = getAsFloat ( string, pos );
536  }
f32 getAsFloat(const core::stringc &string, u32 &pos)
Definition: IQ3Shader.h:105
char c8
8 bit character variable.
Definition: irrTypes.h:35
GLsizeiptr size
s16 isEqual(const core::stringc &string, u32 &pos, const c8 *const list[], u16 listSize)
Definition: IQ3Shader.h:83
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

◆ getTextures()

void irr::scene::quake3::getTextures ( tTexArray textures,
const core::stringc name,
u32 startPos,
const io::IFileSystem fileSystem,
video::IVideoDriver driver 
)
inline

Definition at line 763 of file IQ3Shader.h.

767  {
768  static const char * const extension[] =
769  {
770  ".jpg",
771  ".jpeg",
772  ".png",
773  ".dds",
774  ".tga",
775  ".bmp",
776  ".pcx"
777  };
778 
779  tStringList stringList;
780  getAsStringList(stringList, -1, name, startPos);
781 
782  textures.clear();
783 
784  io::path loadFile;
785  for ( u32 i = 0; i!= stringList.size (); ++i )
786  {
787  video::ITexture* texture = 0;
788  for (u32 g = 0; g != 7; ++g)
789  {
790  core::cutFilenameExtension ( loadFile, stringList[i] );
791 
792  if ( loadFile == "$whiteimage" )
793  {
794  texture = driver->getTexture( "$whiteimage" );
795  if ( 0 == texture )
796  {
797  core::dimension2du s ( 2, 2 );
798  u32 image[4] = { 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF };
799  video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
800  texture = driver->addTexture( "$whiteimage", w );
801  w->drop ();
802  }
803 
804  }
805  else
806  if ( loadFile == "$redimage" )
807  {
808  texture = driver->getTexture( "$redimage" );
809  if ( 0 == texture )
810  {
811  core::dimension2du s ( 2, 2 );
812  u32 image[4] = { 0xFFFF0000, 0xFFFF0000,0xFFFF0000,0xFFFF0000 };
813  video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
814  texture = driver->addTexture( "$redimage", w );
815  w->drop ();
816  }
817  }
818  else
819  if ( loadFile == "$blueimage" )
820  {
821  texture = driver->getTexture( "$blueimage" );
822  if ( 0 == texture )
823  {
824  core::dimension2du s ( 2, 2 );
825  u32 image[4] = { 0xFF0000FF, 0xFF0000FF,0xFF0000FF,0xFF0000FF };
826  video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
827  texture = driver->addTexture( "$blueimage", w );
828  w->drop ();
829  }
830  }
831  else
832  if ( loadFile == "$checkerimage" )
833  {
834  texture = driver->getTexture( "$checkerimage" );
835  if ( 0 == texture )
836  {
837  core::dimension2du s ( 2, 2 );
838  u32 image[4] = { 0xFFFFFFFF, 0xFF000000,0xFF000000,0xFFFFFFFF };
839  video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
840  texture = driver->addTexture( "$checkerimage", w );
841  w->drop ();
842  }
843  }
844  else
845  if ( loadFile == "$lightmap" )
846  {
847  texture = 0;
848  }
849  else
850  {
851  loadFile.append ( extension[g] );
852  }
853 
854  texture = driver->findTexture( loadFile );
855  if ( texture )
856  break;
857 
858  if ( fileSystem->existFile ( loadFile ) )
859  {
860  texture = driver->getTexture( loadFile );
861  if ( texture )
862  break;
863  texture = 0;
864  }
865  }
866  // take 0 Texture
867  textures.push_back(texture);
868  }
869  }
dimension2d< u32 > dimension2du
Typedef for an unsigned integer dimension.
Definition: dimension2d.h:212
GLeglImageOES image
Definition: SDL_opengl.h:2148
GLenum GLenum GLuint texture
GLuint const GLchar * name
GLsizei const GLuint * textures
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
void getAsStringList(tStringList &list, s32 max, const core::stringc &string, u32 &startPos)
Definition: IQ3Shader.h:130
GLdouble s
Definition: SDL_opengl.h:2063
GLsizei const GLchar *const * path
GLubyte GLubyte GLubyte GLubyte w
GLboolean GLboolean g
core::array< core::stringc > tStringList
Definition: IQ3Shader.h:79
io::path & cutFilenameExtension(io::path &dest, const io::path &source)
cut the filename extension from a source file path and store it in a dest file path
Definition: coreutil.h:48

◆ isEqual()

s16 irr::scene::quake3::isEqual ( const core::stringc string,
u32 pos,
const c8 *const  list[],
u16  listSize 
)
inline

Definition at line 83 of file IQ3Shader.h.

84  {
85  const char * in = string.c_str () + pos;
86 
87  for ( u16 i = 0; i != listSize; ++i )
88  {
89  if (string.size() < pos)
90  return -2;
91  u32 len = (u32) strlen ( list[i] );
92  if (string.size() < pos+len)
93  continue;
94  if ( in [len] != 0 && in [len] != ' ' )
95  continue;
96  if ( strncmp ( in, list[i], len ) )
97  continue;
98 
99  pos += len + 1;
100  return (s16) i;
101  }
102  return -2;
103  }
signed short s16
16 bit signed variable.
Definition: irrTypes.h:52
GLsizeiptr size
GLenum GLsizei len
unsigned short u16
16 bit unsigned variable.
Definition: irrTypes.h:44
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
GLuint in