5 #ifndef __I_Q3_LEVEL_SHADER_H_INCLUDED__
6 #define __I_Q3_LEVEL_SHADER_H_INCLUDED__
85 const char * in =
string.c_str () + pos;
87 for (
u16 i = 0; i != listSize; ++i )
89 if (
string.size() < pos)
91 u32 len = (
u32) strlen ( list[i] );
92 if (
string.size() < pos+len)
94 if ( in [len] != 0 && in [len] !=
' ' )
96 if ( strncmp ( in, list[i], len ) )
107 const char * in =
string.c_str () + pos;
138 endPos =
string.findNext (
' ', startPos );
142 endPos =
string.size();
145 list.
push_back (
string.subString ( startPos, endPos - startPos ) );
146 startPos = endPos + 1;
148 if ( list.
size() >= (
u32) max )
173 if ( cull.
size() == 0 )
177 static const c8 * funclist[] = {
"none",
"disable",
"twosided" };
180 switch (
isEqual ( cull, pos, funclist, 3 ) )
197 if (
string.size() == 0 )
200 static const c8 * funclist[] = {
"lequal",
"equal" };
203 switch (
isEqual (
string, pos, funclist, 2 ) )
227 inline static void getBlendFunc (
const core::stringc &
string, SBlendFunc &blendfunc )
229 if (
string.size() == 0 )
233 static const c8 * funclist[] =
238 "gl_one_minus_dst_color",
240 "gl_one_minus_src_color",
242 "gl_one_minus_src_alpha",
244 "gl_one_minus_dst_alpha",
257 s32 srcFact =
isEqual (
string, pos, funclist, 16 );
263 s32 dstFact =
isEqual (
string, pos, funclist, 16 );
274 blendfunc.isTransparent = 1;
285 blendfunc.isTransparent = 0;
292 blendfunc.isTransparent = 1;
303 blendfunc.param0 = 1.f/255.f;
304 blendfunc.isTransparent = 1;
312 blendfunc.isTransparent = 1;
319 blendfunc.isTransparent = 1;
325 blendfunc.param0 = 1.f/255.f;
326 blendfunc.isTransparent = 1;
332 blendfunc.param0 = 0.5f;
333 blendfunc.isTransparent = 1;
339 blendfunc.param0 = 1.f / 255.f;
340 blendfunc.isTransparent = 1;
355 blendfunc.isTransparent = 1;
364 static u32 RandomSeed = 0x69666966;
365 RandomSeed = (RandomSeed * 3631 + 1);
367 f32 value = ( (
f32) (RandomSeed & 0x7FFF ) * (1.0f / (
f32)(0x7FFF >> 1) ) ) - 1.f;
427 x ( 0 ),
y ( 0 ),
z( 0 ),
count( 0 ) {}
486 y = x < 0.5f ? 1.f : -1.f;
489 y = x < 0.5f ? ( 4.f *
x ) - 1.f : ( -4.f * x ) + 3.f;
515 sinf ( lat ) * sinf ( lng ),
522 if (
string.size() == 0 )
525 static const c8 * funclist[] =
527 "sin",
"cos",
"square",
528 "triangle",
"sawtooth",
"inversesawtooth",
"noise"
584 if ( 0 == strcmp (
Variable[i].name.c_str(), name ) &&
585 ( 0 == content || strstr (
Variable[i].content.c_str(), content ) )
601 return irrEmptyStringc;
607 void set (
const c8 * name,
const c8 * content = 0 )
616 Variable [ index ].content = content;
704 for ( i = 0; i < stack - 1; ++i )
714 for ( i = 0; i < stack; ++i )
727 for ( i = 0; i < stack - 1; ++i )
747 for (
u32 i = 0; i != size; ++i )
775 static const char* extension[] =
792 for (
u32 i = 0; i!= stringList.
size (); ++i )
795 for (
u32 g = 0; g != 7 ; ++g)
799 if ( loadFile ==
"$whiteimage" )
801 texture = driver->
getTexture(
"$whiteimage" );
805 u32 image[4] = { 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF };
807 texture = driver->
addTexture(
"$whiteimage", w );
813 if ( loadFile ==
"$redimage" )
819 u32 image[4] = { 0xFFFF0000, 0xFFFF0000,0xFFFF0000,0xFFFF0000 };
821 texture = driver->
addTexture(
"$redimage", w );
826 if ( loadFile ==
"$blueimage" )
832 u32 image[4] = { 0xFF0000FF, 0xFF0000FF,0xFF0000FF,0xFF0000FF };
834 texture = driver->
addTexture(
"$blueimage", w );
839 if ( loadFile ==
"$checkerimage" )
841 texture = driver->
getTexture(
"$checkerimage" );
845 u32 image[4] = { 0xFFFFFFFF, 0xFF000000,0xFF000000,0xFFFFFFFF };
847 texture = driver->
addTexture(
"$checkerimage", w );
852 if ( loadFile ==
"$lightmap" )
858 loadFile.
append ( extension[g] );
861 if ( fileSystem->
existFile ( loadFile ) )