 |
Irrlicht 3D Engine
|
|
Go to the documentation of this file.
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 )
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[] =
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 ) )
u32 size() const
Get number of occupied elements of the array.
@ EBF_SRC_COLOR
dest (srcR, srcG, srcB, srcA)
const core::stringc & get(const c8 *name) const
E_MATERIAL_FLAG
Material flags.
eQ3MeshIndex
Hold the different Mesh Types used for getMesh.
const SVarGroup * getGroup(u32 stage) const
core::array< core::stringc > tStringList
u8 getDepthFunction(const core::stringc &string)
@ EMF_BILINEAR_FILTER
Is bilinear filtering enabled? Default: true.
A Parsed Shader Holding Variables ordered in Groups.
@ EBF_ONE_MINUS_SRC_ALPHA
src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
char c8
8 bit character variable.
@ EMT_SOLID
Standard solid material.
eQ3ModifierFunction rgbgen
holding a group a variable
Manages various Quake3 Shader Styles.
A blend function for a q3 shader.
const f32 PI
Constant for PI.
@ EBF_ZERO
src & dest (0, 0, 0, 0)
@ EBF_SRC_ALPHA
src & dest (srcA, srcA, srcA, srcA)
core::array< SVariable > Variable
bool drop() const
Drops the object. Decrements the reference counter by one.
core::array< video::ITexture * > tTexArray
signed short s16
16 bit signed variable.
u32 isDefined(const c8 *name, const c8 *content=0) const
bool operator<(const SVariable &other) const
video::E_MATERIAL_TYPE type
void clear()
Clears the array and deletes all allocated memory.
video::E_MODULATE_FUNC modulate
video::E_MATERIAL_TYPE defaultLightMapMaterial
Interface of a Video Driver dependent Texture.
eQ3ModifierFunction tcgen
bool getCullingFunction(const core::stringc &cull)
Interface for software image data.
void operator=(const IShader &other)
@ ECFN_LESSEQUAL
<= test, default for e.g. depth test
core::vector3df getMD3Normal(u32 i, u32 j)
T Y
Y coordinate of the vector.
signed int s32
32 bit signed variable.
The FileSystem manages files and archives and provides access to them.
bool operator==(const IShader &other) const
@ EBF_DST_COLOR
src (destR, destG, destB, destA)
void push_back(const T &element)
Adds an element at back of array.
core::array< SVarGroup > VariableGroup
SBlendFunc(video::E_MODULATE_FUNC mod)
T Z
Z coordinate of the vector.
const char * fast_atof_move(const char *in, f32 &result)
Provides a fast function for converting a string into a float.
SVariable(const c8 *n, const c8 *c=0)
Base class of most objects of the Irrlicht Engine.
virtual bool existFile(const path &filename) const =0
Determines if a file exists and could be opened.
float f32
32 bit floating point variable.
File containing useful basic utility functions.
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
s16 isEqual(const core::stringc &string, u32 &pos, const c8 *list[], u16 listSize)
f32 getAsFloat(const core::stringc &string, u32 &pos)
void dumpVarGroup(core::stringc &dest, const SVarGroup *group, s32 stack)
video::E_MODULATE_FUNC defaultModulate
@ EMT_LIGHTMAP_M4
Material type with standard lightmap technique.
f32 evaluate(f32 dt) const
const T * c_str() const
Returns character string.
@ ECF_A8R8G8B8
Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
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.
void getTextures(tTexArray &textures, const core::stringc &name, u32 &startPos, io::IFileSystem *fileSystem, video::IVideoDriver *driver)
bool operator<(const IShader &other) const
@ EMT_ONETEXTURE_BLEND
BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
core::stringc & dumpShader(core::stringc &dest, const IShader *shader, bool entity=false)
E_BLEND_FACTOR
Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) BlendFunc = source * sourceFactor + dest * destFactor.
eQ3ModifierFunction alphagen
Everything in the Irrlicht Engine can be found in this namespace.
unsigned short u16
16 bit unsigned variable.
core::array< IEntity > tQ3EntityList
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.
@ ECFN_EQUAL
Exact equality.
unsigned int u32
32 bit unsigned variable.
eQ3ModifierFunction masterfunc0
eQ3ModifierFunction masterfunc1
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
void getModifierFunc(SModifierFunction &fill, const core::stringc &string, u32 &pos)
virtual ITexture * getTexture(const io::path &filename)=0
Get access to a named texture.
string< T, TAlloc > & append(T character)
Appends a character to this string.
Self reallocating template array (like stl vector) with additional features.
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
u32 size() const
Returns length of the string's content.
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
@ EMT_TRANSPARENT_ALPHA_CHANNEL
Makes the material transparent based on the texture alpha channel.
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.
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
void set(const c8 *name, const c8 *content=0)
core::vector3df getAsVector3df(const core::stringc &string, u32 &pos)
get a quake3 vector translated to irrlicht position (x,-z,y )
bool operator==(const SVariable &other) const
Interface to driver which is able to perform 2d and 3d graphics functions.
@ EMT_TRANSPARENT_ADD_COLOR
A transparent material.
video::E_MATERIAL_FLAG defaultFilter
@ EBF_ONE
src & dest (1, 1, 1, 1)
unsigned char u8
8 bit unsigned variable.
s32 cleanUnResolvedMeshes
void getAsStringList(tStringList &list, s32 max, const core::stringc &string, u32 &startPos)
T X
X coordinate of the vector.