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)
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;
425 x ( 0 ),
y ( 0 ),
z( 0 ),
count( 0 ) {}
484 y =
x < 0.5f ? 1.f : -1.f;
487 y =
x < 0.5f ? ( 4.f *
x ) - 1.
f : ( -4.
f *
x ) + 3.f;
513 sinf ( lat ) * sinf ( lng ),
520 if (
string.
size() == 0 )
523 static const c8 * funclist[] =
525 "sin",
"cos",
"square",
526 "triangle",
"sawtooth",
"inversesawtooth",
"noise" 583 ( 0 == content || strstr (
Variable[i].content.c_str(), content ) )
599 return irrEmptyStringc;
700 for (
s32 i = 0; i < stack - 1; ++i )
707 for (
u32 g = 0;
g !=
group->Variable.size(); ++
g )
710 for (
s32 i = 0; i < stack; ++i )
723 for (
s32 i = 0; i < stack - 1; ++i )
740 for (
u32 i = 0; i !=
size; ++i )
768 static const char *
const extension[] =
785 for (
u32 i = 0; i!= stringList.
size (); ++i )
788 for (
u32 g = 0;
g != 7; ++
g)
792 if ( loadFile ==
"$whiteimage" )
798 u32 image[4] = { 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF };
806 if ( loadFile ==
"$redimage" )
812 u32 image[4] = { 0xFFFF0000, 0xFFFF0000,0xFFFF0000,0xFFFF0000 };
819 if ( loadFile ==
"$blueimage" )
825 u32 image[4] = { 0xFF0000FF, 0xFF0000FF,0xFF0000FF,0xFF0000FF };
832 if ( loadFile ==
"$checkerimage" )
838 u32 image[4] = { 0xFFFFFFFF, 0xFF000000,0xFF000000,0xFFFFFFFF };
845 if ( loadFile ==
"$lightmap" )
851 loadFile.
append ( extension[
g] );
858 if ( fileSystem->
existFile ( loadFile ) )
const core::stringc & get(const c8 *name) const
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.
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.
void getTextures(tTexArray &textures, const core::stringc &name, u32 &startPos, const io::IFileSystem *fileSystem, video::IVideoDriver *driver)
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.
GLuint GLuint GLsizei count
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
Material type with standard lightmap technique.
GLenum GLenum GLuint texture
char c8
8 bit character variable.
video::E_MATERIAL_TYPE defaultLightMapMaterial
eQ3ModifierFunction rgbgen
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.
core::array< video::ITexture * > tTexArray
GLuint const GLchar * name
Everything in the Irrlicht Engine can be found in this namespace.
bool operator<(const IShader &other) const
void operator=(const IShader &other)
Interface for software image data.
Very simple string class with some useful features.
s16 isEqual(const core::stringc &string, u32 &pos, const c8 *const list[], u16 listSize)
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.
bool operator<(const SVariable &other) const
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
GLsizei const GLuint * textures
signed int s32
32 bit signed variable.
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
GLsizei const GLfloat * value
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)
GLint GLint GLint GLint GLint GLint y
Interface to driver which is able to perform 2d and 3d graphics functions.
GLenum GLuint GLenum GLsizei const GLchar * buf
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.
GLint GLint GLint GLint GLint x
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
bool operator==(const IShader &other) const
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
GLuint GLuint GLsizei GLenum type
void dumpVarGroup(core::stringc &dest, const SVarGroup *group, s32 stack)
src (destR, destG, destB, destA)
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.
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)
void set(const c8 *name, const c8 *content=0)
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