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 ) )
226 inline static void getBlendFunc (
const core::stringc &
string, SBlendFunc &blendfunc )
228 if (
string.size() == 0 )
232 static const c8 * funclist[] =
237 "gl_one_minus_dst_color",
239 "gl_one_minus_src_color",
241 "gl_one_minus_src_alpha",
243 "gl_one_minus_dst_alpha",
256 s32 srcFact =
isEqual (
string, pos, funclist, 16 );
262 s32 dstFact =
isEqual (
string, pos, funclist, 16 );
273 blendfunc.isTransparent = 1;
284 blendfunc.isTransparent = 0;
291 blendfunc.isTransparent = 1;
302 blendfunc.param0 = 1.f/255.f;
303 blendfunc.isTransparent = 1;
311 blendfunc.isTransparent = 1;
318 blendfunc.isTransparent = 1;
324 blendfunc.param0 = 1.f/255.f;
325 blendfunc.isTransparent = 1;
331 blendfunc.param0 = 0.5f;
332 blendfunc.isTransparent = 1;
338 blendfunc.param0 = 1.f / 255.f;
339 blendfunc.isTransparent = 1;
354 blendfunc.isTransparent = 1;
363 static u32 RandomSeed = 0x69666966;
364 RandomSeed = (RandomSeed * 3631 + 1);
366 f32 value = ( (
f32) (RandomSeed & 0x7FFF ) * (1.0f / (
f32)(0x7FFF >> 1) ) ) - 1.f;
426 x ( 0 ),
y ( 0 ),
z( 0 ),
count( 0 ) {}
485 y = x < 0.5f ? 1.f : -1.f;
488 y = x < 0.5f ? ( 4.f *
x ) - 1.f : ( -4.f * x ) + 3.f;
514 sinf ( lat ) * sinf ( lng ),
521 if (
string.size() == 0 )
524 static const c8 * funclist[] =
526 "sin",
"cos",
"square",
527 "triangle",
"sawtooth",
"inversesawtooth",
"noise"
583 if ( 0 == strcmp (
Variable[i].name.c_str(), name ) &&
584 ( 0 == content || strstr (
Variable[i].content.c_str(), content ) )
600 return irrEmptyStringc;
606 void set (
const c8 * name,
const c8 * content = 0 )
615 Variable [ index ].content = content;
703 for ( i = 0; i < stack - 1; ++i )
710 for (
u32 g = 0; g != group->
Variable.size(); ++g )
713 for ( i = 0; i < stack; ++i )
726 for ( i = 0; i < stack - 1; ++i )
746 for (
u32 i = 0; i != size; ++i )
774 static const char* extension[] =
791 for (
u32 i = 0; i!= stringList.
size (); ++i )
794 for (
u32 g = 0; g != 7 ; ++g)
798 if ( loadFile ==
"$whiteimage" )
800 texture = driver->
getTexture(
"$whiteimage" );
804 u32 image[4] = { 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF };
806 texture = driver->
addTexture(
"$whiteimage", w );
812 if ( loadFile ==
"$redimage" )
818 u32 image[4] = { 0xFFFF0000, 0xFFFF0000,0xFFFF0000,0xFFFF0000 };
820 texture = driver->
addTexture(
"$redimage", w );
825 if ( loadFile ==
"$blueimage" )
831 u32 image[4] = { 0xFF0000FF, 0xFF0000FF,0xFF0000FF,0xFF0000FF };
833 texture = driver->
addTexture(
"$blueimage", w );
838 if ( loadFile ==
"$checkerimage" )
840 texture = driver->
getTexture(
"$checkerimage" );
844 u32 image[4] = { 0xFFFFFFFF, 0xFF000000,0xFF000000,0xFFFFFFFF };
846 texture = driver->
addTexture(
"$checkerimage", w );
851 if ( loadFile ==
"$lightmap" )
857 loadFile.
append ( extension[g] );
860 if ( fileSystem->
existFile ( loadFile ) )