arsa  2.7
IQ3Shader.h
Go to the documentation of this file.
1 // Copyright (C) 2006-2012 Nikolaus Gebhardt / Thomas Alten
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __I_Q3_LEVEL_SHADER_H_INCLUDED__
6 #define __I_Q3_LEVEL_SHADER_H_INCLUDED__
7 
8 #include "irrArray.h"
9 #include "fast_atof.h"
10 #include "IFileSystem.h"
11 #include "IVideoDriver.h"
12 #include "coreutil.h"
13 
14 namespace irr
15 {
16 namespace scene
17 {
18 namespace quake3
19 {
20 
21  static core::stringc irrEmptyStringc("");
22 
25  {
32  };
33 
38  {
43  patchTesselation ( 8 ),
44  verbose ( 0 ),
45  startTime ( 0 ), endTime ( 0 ),
46  mergeShaderBuffer ( 1 ),
48  loadAllShaders ( 0 ),
49  loadSkyShader ( 0 ),
50  alpharef ( 1 ),
51  swapLump ( 0 ),
52  #ifdef __BIG_ENDIAN__
53  swapHeader ( 1 )
54  #else
55  swapHeader ( 0 )
56  #endif
57  {
58  memcpy ( scriptDir, "scripts\x0", 8 );
59  }
60 
75  c8 scriptDir [ 64 ];
76  };
77 
78  // some useful typedefs
81 
82  // string helper.. TODO: move to generic files
83  inline s16 isEqual ( const core::stringc &string, u32 &pos, const c8 * const list[], u16 listSize )
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  }
104 
105  inline f32 getAsFloat ( const core::stringc &string, u32 &pos )
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  }
113 
115  inline core::vector3df getAsVector3df ( const core::stringc &string, u32 &pos )
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  }
125 
126 
127  /*
128  extract substrings
129  */
130  inline void getAsStringList ( tStringList &list, s32 max, const core::stringc &string, u32 &startPos )
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  }
154 
156  struct SBlendFunc
157  {
159  : type ( video::EMT_SOLID ), modulate ( mod ),
160  param0( 0.f ),
161  isTransparent ( 0 ) {}
162 
165 
168  };
169 
170  // parses the content of Variable cull
171  inline bool getCullingFunction ( const core::stringc &cull )
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  }
190 
191  // parses the content of Variable depthfunc
192  // return a z-test
193  inline u8 getDepthFunction ( const core::stringc &string )
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  }
214 
215 
227  inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc )
228  {
229  if ( string.size() == 0 )
230  return;
231 
232  // maps to E_BLEND_FACTOR
233  static const c8 * funclist[] =
234  {
235  "gl_zero",
236  "gl_one",
237  "gl_dst_color",
238  "gl_one_minus_dst_color",
239  "gl_src_color",
240  "gl_one_minus_src_color",
241  "gl_src_alpha",
242  "gl_one_minus_src_alpha",
243  "gl_dst_alpha",
244  "gl_one_minus_dst_alpha",
245  "gl_src_alpha_sat",
246 
247  "add",
248  "filter",
249  "blend",
250 
251  "ge128",
252  "gt0",
253  };
254 
255 
256  u32 pos = 0;
257  s32 srcFact = isEqual ( string, pos, funclist, 16 );
258 
259  if ( srcFact < 0 )
260  return;
261 
262  u32 resolved = 0;
263  s32 dstFact = isEqual ( string, pos, funclist, 16 );
264 
265  switch ( srcFact )
266  {
267  case video::EBF_ZERO:
268  switch ( dstFact )
269  {
270  // gl_zero gl_src_color == gl_dst_color gl_zero
272  blendfunc.type = video::EMT_ONETEXTURE_BLEND;
273  blendfunc.param0 = video::pack_textureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
274  blendfunc.isTransparent = 1;
275  resolved = 1;
276  break;
277  } break;
278 
279  case video::EBF_ONE:
280  switch ( dstFact )
281  {
282  // gl_one gl_zero
283  case video::EBF_ZERO:
284  blendfunc.type = video::EMT_SOLID;
285  blendfunc.isTransparent = 0;
286  resolved = 1;
287  break;
288 
289  // gl_one gl_one
290  case video::EBF_ONE:
291  blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
292  blendfunc.isTransparent = 1;
293  resolved = 1;
294  break;
295  } break;
296 
298  switch ( dstFact )
299  {
300  // gl_src_alpha gl_one_minus_src_alpha
302  blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
303  blendfunc.param0 = 1.f/255.f;
304  blendfunc.isTransparent = 1;
305  resolved = 1;
306  break;
307  } break;
308 
309  case 11:
310  // add
311  blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
312  blendfunc.isTransparent = 1;
313  resolved = 1;
314  break;
315  case 12:
316  // filter = gl_dst_color gl_zero or gl_zero gl_src_color
317  blendfunc.type = video::EMT_ONETEXTURE_BLEND;
318  blendfunc.param0 = video::pack_textureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
319  blendfunc.isTransparent = 1;
320  resolved = 1;
321  break;
322  case 13:
323  // blend = gl_src_alpha gl_one_minus_src_alpha
324  blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
325  blendfunc.param0 = 1.f/255.f;
326  blendfunc.isTransparent = 1;
327  resolved = 1;
328  break;
329  case 14:
330  // alphafunc ge128
331  blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
332  blendfunc.param0 = 0.5f;
333  blendfunc.isTransparent = 1;
334  resolved = 1;
335  break;
336  case 15:
337  // alphafunc gt0
338  blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
339  blendfunc.param0 = 1.f / 255.f;
340  blendfunc.isTransparent = 1;
341  resolved = 1;
342  break;
343 
344  }
345 
346  // use the generic blender
347  if ( 0 == resolved )
348  {
349  blendfunc.type = video::EMT_ONETEXTURE_BLEND;
350  blendfunc.param0 = video::pack_textureBlendFunc (
351  (video::E_BLEND_FACTOR) srcFact,
352  (video::E_BLEND_FACTOR) dstFact,
353  blendfunc.modulate);
354 
355  blendfunc.isTransparent = 1;
356  }
357  }
358 
359  // random noise [-1;1]
360  struct Noiser
361  {
362  static f32 get ()
363  {
364  static u32 RandomSeed = 0x69666966;
365  RandomSeed = (RandomSeed * 3631 + 1);
366 
367  f32 value = ( (f32) (RandomSeed & 0x7FFF ) * (1.0f / (f32)(0x7FFF >> 1) ) ) - 1.f;
368  return value;
369  }
370  };
371 
373  {
374  TCMOD = 0,
376  RGBGEN = 2,
377  TCGEN = 3,
378  MAP = 4,
379  ALPHAGEN = 5,
380 
381  FUNCTION2 = 0x10,
388 
395  BULGE = FUNCTION2 + 13,
402  MOVE = FUNCTION2 + 20,
405 
414 
415  UNKNOWN = -2
416  };
417 
419  {
423  base ( 0 ), amp ( 1 ), phase ( 0 ), frequency ( 1 ),
424  wave ( 1 ),
425  x ( 0 ), y ( 0 ), z( 0 ), count( 0 ) {}
426 
427  // "tcmod","deformvertexes","rgbgen", "tcgen"
429  // depends
431  // depends
433 
437 
438  union
439  {
442  };
443 
444  union
445  {
448  };
449 
451 
452  union
453  {
456  };
457 
458  union
459  {
462  };
463 
468 
469  f32 evaluate ( f32 dt ) const
470  {
471  // phase in 0 and 1..
472  f32 x = core::fract( (dt + phase ) * frequency );
473  f32 y = 0.f;
474 
475  switch ( func )
476  {
477  case SINUS:
478  y = sinf ( x * core::PI * 2.f );
479  break;
480  case COSINUS:
481  y = cosf ( x * core::PI * 2.f );
482  break;
483  case SQUARE:
484  y = x < 0.5f ? 1.f : -1.f;
485  break;
486  case TRIANGLE:
487  y = x < 0.5f ? ( 4.f * x ) - 1.f : ( -4.f * x ) + 3.f;
488  break;
489  case SAWTOOTH:
490  y = x;
491  break;
492  case SAWTOOTH_INVERSE:
493  y = 1.f - x;
494  break;
495  case NOISE:
496  y = Noiser::get();
497  break;
498  default:
499  break;
500  }
501 
502  return base + ( y * amp );
503  }
504 
505 
506  };
507 
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  }
516 
517  //
518  inline void getModifierFunc ( SModifierFunction& fill, const core::stringc &string, u32 &pos )
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  }
537 
538 
539  // name = "a b c .."
540  struct SVariable
541  {
544 
545  SVariable ( const c8 * n, const c8 *c = 0 ) : name ( n ), content (c) {}
546  virtual ~SVariable () {}
547 
548  void clear ()
549  {
550  name = "";
551  content = "";
552  }
553 
554  s32 isValid () const
555  {
556  return name.size();
557  }
558 
559  bool operator == ( const SVariable &other ) const
560  {
561  return 0 == strcmp ( name.c_str(), other.name.c_str () );
562  }
563 
564  bool operator < ( const SVariable &other ) const
565  {
566  return 0 > strcmp ( name.c_str(), other.name.c_str () );
567  }
568 
569  };
570 
571 
572  // string database. "a" = "Hello", "b" = "1234.6"
573  struct SVarGroup
574  {
575  SVarGroup () { Variable.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE ); }
576  virtual ~SVarGroup () {}
577 
578  u32 isDefined ( const c8 * name, const c8 * content = 0 ) const
579  {
580  for ( u32 i = 0; i != Variable.size (); ++i )
581  {
582  if ( 0 == strcmp ( Variable[i].name.c_str(), name ) &&
583  ( 0 == content || strstr ( Variable[i].content.c_str(), content ) )
584  )
585  {
586  return i + 1;
587  }
588  }
589  return 0;
590  }
591 
592  // searches for Variable name and returns is content
593  // if Variable is not found a reference to an Empty String is returned
594  const core::stringc &get( const c8 * name ) const
595  {
596  SVariable search ( name );
597  s32 index = Variable.linear_search ( search );
598  if ( index < 0 )
599  return irrEmptyStringc;
600 
601  return Variable [ index ].content;
602  }
603 
604  // set the Variable name
605  void set ( const c8 * name, const c8 * content = 0 )
606  {
607  u32 index = isDefined ( name, 0 );
608  if ( 0 == index )
609  {
610  Variable.push_back ( SVariable ( name, content ) );
611  }
612  else
613  {
614  Variable [ index ].content = content;
615  }
616  }
617 
618 
620  };
621 
624  {
626  {
627  VariableGroup.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
628  }
629  virtual ~SVarGroupList () {}
630 
632  };
633 
634 
636  struct IShader
637  {
639  : ID ( 0 ), VarGroup ( 0 ) {}
640  virtual ~IShader () {}
641 
642  void operator = (const IShader &other )
643  {
644  ID = other.ID;
645  VarGroup = other.VarGroup;
646  name = other.name;
647  }
648 
649  bool operator == (const IShader &other ) const
650  {
651  return 0 == strcmp ( name.c_str(), other.name.c_str () );
652  //return name == other.name;
653  }
654 
655  bool operator < (const IShader &other ) const
656  {
657  return strcmp ( name.c_str(), other.name.c_str () ) < 0;
658  //return name < other.name;
659  }
660 
661  u32 getGroupSize () const
662  {
663  if ( 0 == VarGroup )
664  return 0;
665  return VarGroup->VariableGroup.size ();
666  }
667 
668  const SVarGroup * getGroup ( u32 stage ) const
669  {
670  if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
671  return 0;
672 
673  return &VarGroup->VariableGroup [ stage ];
674  }
675 
676  // id
678  SVarGroupList *VarGroup; // reference
679 
680  // Shader: shader name ( also first variable in first Vargroup )
681  // Entity: classname ( variable in Group(1) )
683  };
684 
685  typedef IShader IEntity;
686 
688 
689  /*
690  dump shader like original layout, regardless of internal data holding
691  no recursive folding..
692  */
693  inline void dumpVarGroup ( core::stringc &dest, const SVarGroup * group, s32 stack )
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  }
730 
734  inline core::stringc & dumpShader ( core::stringc &dest, const IShader * shader, bool entity = false )
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  }
756 
757 
758  /*
759  quake3 doesn't care much about tga & jpg
760  load one or multiple files stored in name started at startPos to the texture array textures
761  if texture is not loaded 0 will be added ( to find missing textures easier)
762  */
764  const core::stringc &name, u32 &startPos,
765  const io::IFileSystem *fileSystem,
766  video::IVideoDriver* driver)
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  {
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 };
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 };
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 };
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 };
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  }
870 
871 
874  {
875  };
876 
877 } // end namespace quake3
878 } // end namespace scene
879 } // end namespace irr
880 
881 #endif
882 
const core::stringc & get(const c8 *name) const
Definition: IQ3Shader.h:594
The FileSystem manages files and archives and provides access to them.
Definition: IFileSystem.h:32
void getModifierFunc(SModifierFunction &fill, const core::stringc &string, u32 &pos)
Definition: IQ3Shader.h:518
GLboolean GLuint group
bool drop() const
Drops the object. Decrements the reference counter by one.
signed short s16
16 bit signed variable.
Definition: irrTypes.h:52
core::stringc & dumpShader(core::stringc &dest, const IShader *shader, bool entity=false)
Definition: IQ3Shader.h:734
const f32 PI
Constant for PI.
Definition: irrMath.h:57
core::vector3df getAsVector3df(const core::stringc &string, u32 &pos)
get a quake3 vector translated to irrlicht position (x,-z,y )
Definition: IQ3Shader.h:115
Manages various Quake3 Shader Styles.
Definition: IQ3Shader.h:873
GLdouble n
u32 size() const
Returns length of the string's content.
Definition: irrString.h:502
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
GLeglImageOES image
Definition: SDL_opengl.h:2148
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
void getTextures(tTexArray &textures, const core::stringc &name, u32 &startPos, const io::IFileSystem *fileSystem, video::IVideoDriver *driver)
Definition: IQ3Shader.h:763
dest (srcR, srcG, srcB, srcA)
Definition: SMaterial.h:30
video::E_MODULATE_FUNC modulate
Definition: IQ3Shader.h:164
eQ3MeshIndex
Hold the different Mesh Types used for getMesh.
Definition: IQ3Shader.h:24
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
holding a group a variable
Definition: IQ3Shader.h:623
f32 getAsFloat(const core::stringc &string, u32 &pos)
Definition: IQ3Shader.h:105
string< T, TAlloc > & append(T character)
Appends a character to this string.
Definition: irrString.h:634
src & dest (0, 0, 0, 0)
Definition: SMaterial.h:26
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
virtual IImage * createImageFromData(ECOLOR_FORMAT format, const core::dimension2d< u32 > &size, void *data, bool ownForeignMemory=false, bool deleteMemory=true)=0
Creates a software image from a byte array.
bool operator==(const SVariable &other) const
Definition: IQ3Shader.h:559
Material type with standard lightmap technique.
GLenum GLenum GLuint texture
char c8
8 bit character variable.
Definition: irrTypes.h:35
f32 fract(f32 x)
Definition: irrMath.h:672
video::E_MATERIAL_TYPE defaultLightMapMaterial
Definition: IQ3Shader.h:61
f32 pack_textureBlendFunc(const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE)
Pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam or BlendFactor.
Definition: SMaterial.h:119
SVarGroupList * VarGroup
Definition: IQ3Shader.h:678
core::array< video::ITexture * > tTexArray
Definition: IQ3Shader.h:80
GLuint const GLchar * name
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
bool operator<(const IShader &other) const
Definition: IQ3Shader.h:655
void operator=(const IShader &other)
Definition: IQ3Shader.h:642
GLsizeiptr size
src & dest (1, 1, 1, 1)
Definition: SMaterial.h:27
GLenum GLsizei len
Interface for software image data.
Definition: IImage.h:25
Very simple string class with some useful features.
Definition: irrString.h:37
s16 isEqual(const core::stringc &string, u32 &pos, const c8 *const list[], u16 listSize)
Definition: IQ3Shader.h:83
void push_back(const T &element)
Adds an element at back of array.
Definition: irrArray.h:111
unsigned char u8
8 bit unsigned variable.
Definition: irrTypes.h:22
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition: vector3d.h:461
bool operator<(const SVariable &other) const
Definition: IQ3Shader.h:564
File containing useful basic utility functions.
src & dest (srcA, srcA, srcA, srcA)
Definition: SMaterial.h:32
core::array< SVariable > Variable
Definition: IQ3Shader.h:619
SVariable(const c8 *n, const c8 *c=0)
Definition: IQ3Shader.h:545
u8 getDepthFunction(const core::stringc &string)
Definition: IQ3Shader.h:193
SBlendFunc(video::E_MODULATE_FUNC mod)
Definition: IQ3Shader.h:158
Is bilinear filtering enabled? Default: true.
unsigned short u16
16 bit unsigned variable.
Definition: irrTypes.h:44
const GLdouble * v
Definition: SDL_opengl.h:2064
u32 isDefined(const c8 *name, const c8 *content=0) const
Definition: IQ3Shader.h:578
video::E_MATERIAL_TYPE type
Definition: IQ3Shader.h:163
GLsizei const GLuint * textures
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
Definition: SMaterial.h:55
GLsizei const GLfloat * value
const T * c_str() const
Returns character string.
Definition: irrString.h:526
GLfloat f
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
Exact equality.
Definition: SMaterial.h:70
u32 size() const
Get number of occupied elements of the array.
Definition: irrArray.h:364
src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
Definition: SMaterial.h:33
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
Interface to driver which is able to perform 2d and 3d graphics functions.
Definition: IVideoDriver.h:151
GLenum GLuint GLenum GLsizei const GLchar * buf
void getAsStringList(tStringList &list, s32 max, const core::stringc &string, u32 &startPos)
Definition: IQ3Shader.h:130
GLuint index
Standard solid material.
virtual ITexture * addTexture(const core::dimension2d< u32 > &size, const io::path &name, ECOLOR_FORMAT format=ECF_A8R8G8B8)=0
Creates an empty texture of specified size.
<= test, default for e.g. depth test
Definition: SMaterial.h:68
Self reallocating template array (like stl vector) with additional features.
Definition: irrArray.h:22
GLenum func
A Parsed Shader Holding Variables ordered in Groups.
Definition: IQ3Shader.h:636
GLdouble s
Definition: SDL_opengl.h:2063
E_MATERIAL_FLAG
Material flags.
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
virtual ITexture * getTexture(const io::path &filename)=0
Get access to a named texture.
core::array< SVarGroup > VariableGroup
Definition: IQ3Shader.h:631
const SVarGroup * getGroup(u32 stage) const
Definition: IQ3Shader.h:668
bool operator==(const IShader &other) const
Definition: IQ3Shader.h:649
A blend function for a q3 shader.
Definition: IQ3Shader.h:156
Interface of a Video Driver dependent Texture.
Definition: ITexture.h:177
Base class of most objects of the Irrlicht Engine.
Makes the material transparent based on the texture alpha channel.
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
void dumpVarGroup(core::stringc &dest, const SVarGroup *group, s32 stack)
Definition: IQ3Shader.h:693
src (destR, destG, destB, destA)
Definition: SMaterial.h:28
GLubyte GLubyte GLubyte GLubyte w
virtual video::ITexture * findTexture(const io::path &filename)=0
Check if the image is already loaded.
void clear()
Clears the array and deletes all allocated memory.
Definition: irrArray.h:199
core::vector3df getMD3Normal(u32 i, u32 j)
Definition: IQ3Shader.h:508
BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
const GLubyte * c
video::E_MODULATE_FUNC defaultModulate
Definition: IQ3Shader.h:62
virtual bool existFile(const path &filename) const =0
Determines if a file exists and could be opened.
GLboolean GLboolean g
GLuint in
core::array< core::stringc > tStringList
Definition: IQ3Shader.h:79
bool getCullingFunction(const core::stringc &cull)
Definition: IQ3Shader.h:171
GLdouble GLdouble z
void set(const c8 *name, const c8 *content=0)
Definition: IQ3Shader.h:605
video::E_MATERIAL_FLAG defaultFilter
Definition: IQ3Shader.h:63
GLuint shader
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
Definition: irrMath.h:167
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
core::array< IEntity > tQ3EntityList
Definition: IQ3Shader.h:687