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 )
159 : type ( video::
EMT_SOLID ), modulate ( mod ),
161 isTransparent ( 0 ) {}
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 ) )
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 );
303 blendfunc.
param0 = 1.f/255.f;
325 blendfunc.
param0 = 1.f/255.f;
339 blendfunc.
param0 = 1.f / 255.f;
364 static u32 RandomSeed = 0x69666966;
365 RandomSeed = (RandomSeed * 3631 + 1);
367 f32 value = ( (
f32) (RandomSeed & 0x7FFF ) * (1.0f / (
f32)(0x7FFF >> 1) ) ) - 1.f;
425 base ( 0 ), amp ( 1 ), phase ( 0 ), frequency ( 1 ),
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;
504 return base + ( y * amp );
515 sinf ( lat ) * sinf ( lng ),
522 if (
string.size() == 0 )
525 static const c8 * funclist[] =
527 "sin",
"cos",
"square",
528 "triangle",
"sawtooth",
"inversesawtooth",
"noise" 582 for (
u32 i = 0; i != Variable.size (); ++i )
584 if ( 0 == strcmp ( Variable[i].name.c_str(), name ) &&
585 ( 0 == content || strstr ( Variable[i].content.c_str(), content ) )
599 s32 index = Variable.linear_search ( search );
601 return irrEmptyStringc;
603 return Variable [ index ].content;
607 void set (
const c8 * name,
const c8 * content = 0 )
609 u32 index = isDefined ( name, 0 );
612 Variable.push_back (
SVariable ( name, content ) );
616 Variable [ index ].content = content;
641 : ID ( 0 ), VarGroup ( 0 ) {}
651 bool operator == (
const IShader &other )
const 653 return 0 == strcmp ( name.c_str(), other.
name.
c_str () );
659 return strcmp ( name.c_str(), other.
name.
c_str () ) < 0;
667 return VarGroup->VariableGroup.size ();
672 if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
675 return &VarGroup->VariableGroup [ stage ];
704 for ( i = 0; i < stack - 1; ++i )
711 for (
u32 g = 0; g != group->
Variable.size(); ++g )
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[] =
786 tStringList stringList;
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 ) )
s16 isEqual(const core::stringc &string, u32 &pos, const c8 *list[], u16 listSize)
The FileSystem manages files and archives and provides access to them.
void getModifierFunc(SModifierFunction &fill, const core::stringc &string, u32 &pos)
bool drop() const
Drops the object. Decrements the reference counter by one.
signed short s16
16 bit signed variable.
core::stringc & dumpShader(core::stringc &dest, const IShader *shader, bool entity=false)
const f32 PI
Constant for PI.
T Y
Y coordinate of the vector.
E_BLEND_FACTOR
Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) BlendFunc = source * sourceFactor + dest * destFactor...
core::vector3df getAsVector3df(const core::stringc &string, u32 &pos)
get a quake3 vector translated to irrlicht position (x,-z,y )
Manages various Quake3 Shader Styles.
u32 size() const
Returns length of the string's content.
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
const char * fast_atof_move(const char *in, f32 &result)
Provides a fast function for converting a string into a float.
dest (srcR, srcG, srcB, srcA)
video::E_MODULATE_FUNC modulate
eQ3MeshIndex
Hold the different Mesh Types used for getMesh.
float f32
32 bit floating point variable.
holding a group a variable
f32 getAsFloat(const core::stringc &string, u32 &pos)
string< T, TAlloc > & append(T character)
Appends a character to this string.
void getTextures(tTexArray &textures, const core::stringc &name, u32 &startPos, io::IFileSystem *fileSystem, video::IVideoDriver *driver)
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.
Material type with standard lightmap technique.
char c8
8 bit character variable.
video::E_MATERIAL_TYPE defaultLightMapMaterial
eQ3ModifierFunction rgbgen
T X
X coordinate of the vector.
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)
EMT_ONETEXTURE_BLEND: pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam.
core::array< video::ITexture *> tTexArray
Everything in the Irrlicht Engine can be found in this namespace.
Interface for software image data.
void push_back(const T &element)
Adds an element at back of array.
unsigned char u8
8 bit unsigned variable.
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
File containing useful basic utility functions.
src & dest (srcA, srcA, srcA, srcA)
core::array< SVariable > Variable
SVariable(const c8 *n, const c8 *c=0)
u8 getDepthFunction(const core::stringc &string)
eQ3ModifierFunction tcgen
SBlendFunc(video::E_MODULATE_FUNC mod)
Is bilinear filtering enabled? Default: true.
unsigned short u16
16 bit unsigned variable.
u32 isDefined(const c8 *name, const c8 *content=0) const
video::E_MATERIAL_TYPE type
signed int s32
32 bit signed variable.
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
const T * c_str() const
Returns character string.
unsigned int u32
32 bit unsigned variable.
u32 size() const
Get number of occupied elements of the array.
src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
Interface to driver which is able to perform 2d and 3d graphics functions.
void getAsStringList(tStringList &list, s32 max, const core::stringc &string, u32 &startPos)
eQ3ModifierFunction masterfunc1
f32 evaluate(f32 dt) const
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
Self reallocating template array (like stl vector) with additional features.
A Parsed Shader Holding Variables ordered in Groups.
E_MATERIAL_FLAG
Material flags.
virtual ITexture * getTexture(const io::path &filename)=0
Get access to a named texture.
eQ3ModifierFunction alphagen
s32 cleanUnResolvedMeshes
core::array< SVarGroup > VariableGroup
const SVarGroup * getGroup(u32 stage) const
T Z
Z coordinate of the vector.
A blend function for a q3 shader.
Interface of a Video Driver dependent Texture.
Base class of most objects of the Irrlicht Engine.
Makes the material transparent based on the texture alpha channel.
eQ3ModifierFunction masterfunc0
void dumpVarGroup(core::stringc &dest, const SVarGroup *group, s32 stack)
src (destR, destG, destB, destA)
Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha...
void clear()
Clears the array and deletes all allocated memory.
core::vector3df getMD3Normal(u32 i, u32 j)
BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
video::E_MODULATE_FUNC defaultModulate
virtual bool existFile(const path &filename) const =0
Determines if a file exists and could be opened.
core::array< core::stringc > tStringList
bool getCullingFunction(const core::stringc &cull)
video::E_MATERIAL_FLAG defaultFilter
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
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 ...
core::array< IEntity > tQ3EntityList