Remove Quake 3 level load
This commit is contained in:
parent
a08a9b1af4
commit
6bd852c95f
@ -81,7 +81,6 @@ source/Irrlicht/CSceneNodeAnimatorTexture.cpp
|
|||||||
source/Irrlicht/COpenGLTexture.cpp
|
source/Irrlicht/COpenGLTexture.cpp
|
||||||
source/Irrlicht/COctreeSceneNode.cpp
|
source/Irrlicht/COctreeSceneNode.cpp
|
||||||
source/Irrlicht/CWaterSurfaceSceneNode.cpp
|
source/Irrlicht/CWaterSurfaceSceneNode.cpp
|
||||||
source/Irrlicht/CQuake3ShaderSceneNode.cpp
|
|
||||||
source/Irrlicht/CWADReader.cpp
|
source/Irrlicht/CWADReader.cpp
|
||||||
source/Irrlicht/CParticleAttractionAffector.cpp
|
source/Irrlicht/CParticleAttractionAffector.cpp
|
||||||
source/Irrlicht/CMeshSceneNode.cpp
|
source/Irrlicht/CMeshSceneNode.cpp
|
||||||
@ -96,7 +95,6 @@ source/Irrlicht/CTextSceneNode.cpp
|
|||||||
source/Irrlicht/COpenGLCgMaterialRenderer.cpp
|
source/Irrlicht/COpenGLCgMaterialRenderer.cpp
|
||||||
source/Irrlicht/CIrrDeviceLinux.cpp
|
source/Irrlicht/CIrrDeviceLinux.cpp
|
||||||
source/Irrlicht/CIrrDeviceStub.cpp
|
source/Irrlicht/CIrrDeviceStub.cpp
|
||||||
source/Irrlicht/CQ3LevelMesh.cpp
|
|
||||||
source/Irrlicht/CImageWriterPCX.cpp
|
source/Irrlicht/CImageWriterPCX.cpp
|
||||||
source/Irrlicht/CGUIInOutFader.cpp
|
source/Irrlicht/CGUIInOutFader.cpp
|
||||||
source/Irrlicht/CGUITreeView.cpp
|
source/Irrlicht/CGUITreeView.cpp
|
||||||
@ -302,7 +300,6 @@ source/Irrlicht/CGUIInOutFader.h
|
|||||||
source/Irrlicht/CGUIFont.h
|
source/Irrlicht/CGUIFont.h
|
||||||
source/Irrlicht/CGUIImageList.h
|
source/Irrlicht/CGUIImageList.h
|
||||||
source/Irrlicht/CFileSystem.h
|
source/Irrlicht/CFileSystem.h
|
||||||
source/Irrlicht/CQ3LevelMesh.h
|
|
||||||
source/Irrlicht/CSceneNodeAnimatorRotation.h
|
source/Irrlicht/CSceneNodeAnimatorRotation.h
|
||||||
source/Irrlicht/CGUISkin.h
|
source/Irrlicht/CGUISkin.h
|
||||||
source/Irrlicht/CNPKReader.h
|
source/Irrlicht/CNPKReader.h
|
||||||
@ -318,7 +315,6 @@ source/Irrlicht/CNullDriver.h
|
|||||||
source/Irrlicht/CImageLoaderRGB.h
|
source/Irrlicht/CImageLoaderRGB.h
|
||||||
source/Irrlicht/CWriteFile.h
|
source/Irrlicht/CWriteFile.h
|
||||||
source/Irrlicht/CSceneNodeAnimatorFollowSpline.h
|
source/Irrlicht/CSceneNodeAnimatorFollowSpline.h
|
||||||
source/Irrlicht/CQuake3ShaderSceneNode.h
|
|
||||||
source/Irrlicht/glxext.h
|
source/Irrlicht/glxext.h
|
||||||
source/Irrlicht/CMetaTriangleSelector.h
|
source/Irrlicht/CMetaTriangleSelector.h
|
||||||
source/Irrlicht/CTarReader.h
|
source/Irrlicht/CTarReader.h
|
||||||
@ -432,7 +428,6 @@ include/IParticleMeshEmitter.h
|
|||||||
include/IGUIColorSelectDialog.h
|
include/IGUIColorSelectDialog.h
|
||||||
include/IGUIImage.h
|
include/IGUIImage.h
|
||||||
include/IGUIListBox.h
|
include/IGUIListBox.h
|
||||||
include/IQ3LevelMesh.h
|
|
||||||
include/vector2d.h
|
include/vector2d.h
|
||||||
include/CIndexBuffer.h
|
include/CIndexBuffer.h
|
||||||
include/IAnimatedMesh.h
|
include/IAnimatedMesh.h
|
||||||
@ -462,7 +457,6 @@ include/heapsort.h
|
|||||||
include/IGUIComboBox.h
|
include/IGUIComboBox.h
|
||||||
include/Keycodes.h
|
include/Keycodes.h
|
||||||
include/SParticle.h
|
include/SParticle.h
|
||||||
include/IQ3Shader.h
|
|
||||||
include/EDriverTypes.h
|
include/EDriverTypes.h
|
||||||
include/IFileSystem.h
|
include/IFileSystem.h
|
||||||
include/SMesh.h
|
include/SMesh.h
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#ifndef __I_Q3_LEVEL_MESH_H_INCLUDED__
|
|
||||||
#define __I_Q3_LEVEL_MESH_H_INCLUDED__
|
|
||||||
|
|
||||||
#include "IAnimatedMesh.h"
|
|
||||||
#include "IQ3Shader.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace scene
|
|
||||||
{
|
|
||||||
//! Interface for a Mesh which can be loaded directly from a Quake3 .bsp-file.
|
|
||||||
/** The Mesh tries to load all textures of the map.*/
|
|
||||||
class IQ3LevelMesh : public IAnimatedMesh
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! loads the shader definition from file
|
|
||||||
/** \param filename Name of the shaderfile, defaults to /scripts if fileNameIsValid is false.
|
|
||||||
\param fileNameIsValid Specifies whether the filename is valid in the current situation. */
|
|
||||||
virtual const quake3::IShader* getShader( const c8* filename, bool fileNameIsValid=true ) = 0;
|
|
||||||
|
|
||||||
//! returns a already loaded Shader
|
|
||||||
virtual const quake3::IShader* getShader(u32 index) const = 0;
|
|
||||||
|
|
||||||
//! get's an interface to the entities
|
|
||||||
virtual quake3::tQ3EntityList& getEntityList() = 0;
|
|
||||||
|
|
||||||
//! returns the requested brush entity
|
|
||||||
/** \param num The number from the model key of the entity.
|
|
||||||
|
|
||||||
Use this interface if you parse the entities yourself.*/
|
|
||||||
virtual IMesh* getBrushEntityMesh(s32 num) const = 0;
|
|
||||||
|
|
||||||
//! returns the requested brush entity
|
|
||||||
virtual IMesh* getBrushEntityMesh(quake3::IEntity &ent) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end namespace scene
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,884 +0,0 @@
|
|||||||
// Copyright (C) 2006-2012 Nikolaus Gebhardt / Thomas Alten
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#ifndef __I_Q3_LEVEL_SHADER_H_INCLUDED__
|
|
||||||
#define __I_Q3_LEVEL_SHADER_H_INCLUDED__
|
|
||||||
|
|
||||||
#include "irrArray.h"
|
|
||||||
#include "fast_atof.h"
|
|
||||||
#include "IFileSystem.h"
|
|
||||||
#include "IVideoDriver.h"
|
|
||||||
#include "coreutil.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace scene
|
|
||||||
{
|
|
||||||
namespace quake3
|
|
||||||
{
|
|
||||||
|
|
||||||
static core::stringc irrEmptyStringc("");
|
|
||||||
|
|
||||||
//! Hold the different Mesh Types used for getMesh
|
|
||||||
enum eQ3MeshIndex
|
|
||||||
{
|
|
||||||
E_Q3_MESH_GEOMETRY = 0,
|
|
||||||
E_Q3_MESH_ITEMS,
|
|
||||||
E_Q3_MESH_BILLBOARD,
|
|
||||||
E_Q3_MESH_FOG,
|
|
||||||
E_Q3_MESH_UNRESOLVED,
|
|
||||||
E_Q3_MESH_SIZE
|
|
||||||
};
|
|
||||||
|
|
||||||
/*! used to customize Quake3 BSP Loader
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct Q3LevelLoadParameter
|
|
||||||
{
|
|
||||||
Q3LevelLoadParameter ()
|
|
||||||
:defaultLightMapMaterial ( video::EMT_LIGHTMAP_M4 ),
|
|
||||||
defaultModulate ( video::EMFN_MODULATE_4X ),
|
|
||||||
defaultFilter ( video::EMF_BILINEAR_FILTER ),
|
|
||||||
patchTesselation ( 8 ),
|
|
||||||
verbose ( 0 ),
|
|
||||||
startTime ( 0 ), endTime ( 0 ),
|
|
||||||
mergeShaderBuffer ( 1 ),
|
|
||||||
cleanUnResolvedMeshes ( 1 ),
|
|
||||||
loadAllShaders ( 0 ),
|
|
||||||
loadSkyShader ( 0 ),
|
|
||||||
alpharef ( 1 ),
|
|
||||||
swapLump ( 0 ),
|
|
||||||
#ifdef __BIG_ENDIAN__
|
|
||||||
swapHeader ( 1 )
|
|
||||||
#else
|
|
||||||
swapHeader ( 0 )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
memcpy ( scriptDir, "scripts\x0", 8 );
|
|
||||||
}
|
|
||||||
|
|
||||||
video::E_MATERIAL_TYPE defaultLightMapMaterial;
|
|
||||||
video::E_MODULATE_FUNC defaultModulate;
|
|
||||||
video::E_MATERIAL_FLAG defaultFilter;
|
|
||||||
s32 patchTesselation;
|
|
||||||
s32 verbose;
|
|
||||||
u32 startTime;
|
|
||||||
u32 endTime;
|
|
||||||
s32 mergeShaderBuffer;
|
|
||||||
s32 cleanUnResolvedMeshes;
|
|
||||||
s32 loadAllShaders;
|
|
||||||
s32 loadSkyShader;
|
|
||||||
s32 alpharef;
|
|
||||||
s32 swapLump;
|
|
||||||
s32 swapHeader;
|
|
||||||
c8 scriptDir [ 64 ];
|
|
||||||
};
|
|
||||||
|
|
||||||
// some useful typedefs
|
|
||||||
typedef core::array< core::stringc > tStringList;
|
|
||||||
typedef core::array< video::ITexture* > tTexArray;
|
|
||||||
|
|
||||||
// string helper.. TODO: move to generic files
|
|
||||||
inline s16 isEqual ( const core::stringc &string, u32 &pos, const c8 *list[], u16 listSize )
|
|
||||||
{
|
|
||||||
const char * in = string.c_str () + pos;
|
|
||||||
|
|
||||||
for ( u16 i = 0; i != listSize; ++i )
|
|
||||||
{
|
|
||||||
if (string.size() < pos)
|
|
||||||
return -2;
|
|
||||||
u32 len = (u32) strlen ( list[i] );
|
|
||||||
if (string.size() < pos+len)
|
|
||||||
continue;
|
|
||||||
if ( in [len] != 0 && in [len] != ' ' )
|
|
||||||
continue;
|
|
||||||
if ( strncmp ( in, list[i], len ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pos += len + 1;
|
|
||||||
return (s16) i;
|
|
||||||
}
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline f32 getAsFloat ( const core::stringc &string, u32 &pos )
|
|
||||||
{
|
|
||||||
const char * in = string.c_str () + pos;
|
|
||||||
|
|
||||||
f32 value = 0.f;
|
|
||||||
pos += (u32) ( core::fast_atof_move ( in, value ) - in ) + 1;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! get a quake3 vector translated to irrlicht position (x,-z,y )
|
|
||||||
inline core::vector3df getAsVector3df ( const core::stringc &string, u32 &pos )
|
|
||||||
{
|
|
||||||
core::vector3df v;
|
|
||||||
|
|
||||||
v.X = getAsFloat ( string, pos );
|
|
||||||
v.Z = getAsFloat ( string, pos );
|
|
||||||
v.Y = getAsFloat ( string, pos );
|
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
extract substrings
|
|
||||||
*/
|
|
||||||
inline void getAsStringList ( tStringList &list, s32 max, const core::stringc &string, u32 &startPos )
|
|
||||||
{
|
|
||||||
list.clear ();
|
|
||||||
|
|
||||||
s32 finish = 0;
|
|
||||||
s32 endPos;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
endPos = string.findNext ( ' ', startPos );
|
|
||||||
if ( endPos == -1 )
|
|
||||||
{
|
|
||||||
finish = 1;
|
|
||||||
endPos = string.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
list.push_back ( string.subString ( startPos, endPos - startPos ) );
|
|
||||||
startPos = endPos + 1;
|
|
||||||
|
|
||||||
if ( list.size() >= (u32) max )
|
|
||||||
finish = 1;
|
|
||||||
|
|
||||||
} while ( !finish );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! A blend function for a q3 shader.
|
|
||||||
struct SBlendFunc
|
|
||||||
{
|
|
||||||
SBlendFunc ( video::E_MODULATE_FUNC mod )
|
|
||||||
: type ( video::EMT_SOLID ), modulate ( mod ),
|
|
||||||
param0( 0.f ),
|
|
||||||
isTransparent ( 0 ) {}
|
|
||||||
|
|
||||||
video::E_MATERIAL_TYPE type;
|
|
||||||
video::E_MODULATE_FUNC modulate;
|
|
||||||
|
|
||||||
f32 param0;
|
|
||||||
u32 isTransparent;
|
|
||||||
};
|
|
||||||
|
|
||||||
// parses the content of Variable cull
|
|
||||||
inline bool getCullingFunction ( const core::stringc &cull )
|
|
||||||
{
|
|
||||||
if ( cull.size() == 0 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
bool ret = true;
|
|
||||||
static const c8 * funclist[] = { "none", "disable", "twosided" };
|
|
||||||
|
|
||||||
u32 pos = 0;
|
|
||||||
switch ( isEqual ( cull, pos, funclist, 3 ) )
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
ret = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// parses the content of Variable depthfunc
|
|
||||||
// return a z-test
|
|
||||||
inline u8 getDepthFunction ( const core::stringc &string )
|
|
||||||
{
|
|
||||||
u8 ret = video::ECFN_LESSEQUAL;
|
|
||||||
|
|
||||||
if ( string.size() == 0 )
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
static const c8 * funclist[] = { "lequal","equal" };
|
|
||||||
|
|
||||||
u32 pos = 0;
|
|
||||||
switch ( isEqual ( string, pos, funclist, 2 ) )
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
ret = video::ECFN_LESSEQUAL;
|
|
||||||
case 1:
|
|
||||||
ret = video::ECFN_EQUAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
parses the content of Variable blendfunc,alphafunc
|
|
||||||
it also make a hint for rendering as transparent or solid node.
|
|
||||||
|
|
||||||
we assume a typical quake scene would look like this..
|
|
||||||
1) Big Static Mesh ( solid )
|
|
||||||
2) static scene item ( may use transparency ) but rendered in the solid pass
|
|
||||||
3) additional transparency item in the transparent pass
|
|
||||||
|
|
||||||
it's not 100% accurate! it just empirical..
|
|
||||||
*/
|
|
||||||
inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc )
|
|
||||||
{
|
|
||||||
if ( string.size() == 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// maps to E_BLEND_FACTOR
|
|
||||||
static const c8 * funclist[] =
|
|
||||||
{
|
|
||||||
"gl_zero",
|
|
||||||
"gl_one",
|
|
||||||
"gl_dst_color",
|
|
||||||
"gl_one_minus_dst_color",
|
|
||||||
"gl_src_color",
|
|
||||||
"gl_one_minus_src_color",
|
|
||||||
"gl_src_alpha",
|
|
||||||
"gl_one_minus_src_alpha",
|
|
||||||
"gl_dst_alpha",
|
|
||||||
"gl_one_minus_dst_alpha",
|
|
||||||
"gl_src_alpha_sat",
|
|
||||||
|
|
||||||
"add",
|
|
||||||
"filter",
|
|
||||||
"blend",
|
|
||||||
|
|
||||||
"ge128",
|
|
||||||
"gt0",
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
u32 pos = 0;
|
|
||||||
s32 srcFact = isEqual ( string, pos, funclist, 16 );
|
|
||||||
|
|
||||||
if ( srcFact < 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
u32 resolved = 0;
|
|
||||||
s32 dstFact = isEqual ( string, pos, funclist, 16 );
|
|
||||||
|
|
||||||
switch ( srcFact )
|
|
||||||
{
|
|
||||||
case video::EBF_ZERO:
|
|
||||||
switch ( dstFact )
|
|
||||||
{
|
|
||||||
// gl_zero gl_src_color == gl_dst_color gl_zero
|
|
||||||
case video::EBF_SRC_COLOR:
|
|
||||||
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
|
|
||||||
blendfunc.param0 = video::pack_textureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case video::EBF_ONE:
|
|
||||||
switch ( dstFact )
|
|
||||||
{
|
|
||||||
// gl_one gl_zero
|
|
||||||
case video::EBF_ZERO:
|
|
||||||
blendfunc.type = video::EMT_SOLID;
|
|
||||||
blendfunc.isTransparent = 0;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// gl_one gl_one
|
|
||||||
case video::EBF_ONE:
|
|
||||||
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case video::EBF_SRC_ALPHA:
|
|
||||||
switch ( dstFact )
|
|
||||||
{
|
|
||||||
// gl_src_alpha gl_one_minus_src_alpha
|
|
||||||
case video::EBF_ONE_MINUS_SRC_ALPHA:
|
|
||||||
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
|
||||||
blendfunc.param0 = 1.f/255.f;
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case 11:
|
|
||||||
// add
|
|
||||||
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
// filter = gl_dst_color gl_zero or gl_zero gl_src_color
|
|
||||||
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
|
|
||||||
blendfunc.param0 = video::pack_textureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
// blend = gl_src_alpha gl_one_minus_src_alpha
|
|
||||||
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
|
||||||
blendfunc.param0 = 1.f/255.f;
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
// alphafunc ge128
|
|
||||||
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
|
||||||
blendfunc.param0 = 0.5f;
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
// alphafunc gt0
|
|
||||||
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
|
||||||
blendfunc.param0 = 1.f / 255.f;
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
resolved = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// use the generic blender
|
|
||||||
if ( 0 == resolved )
|
|
||||||
{
|
|
||||||
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
|
|
||||||
blendfunc.param0 = video::pack_textureBlendFunc (
|
|
||||||
(video::E_BLEND_FACTOR) srcFact,
|
|
||||||
(video::E_BLEND_FACTOR) dstFact,
|
|
||||||
blendfunc.modulate);
|
|
||||||
|
|
||||||
blendfunc.isTransparent = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// random noise [-1;1]
|
|
||||||
struct Noiser
|
|
||||||
{
|
|
||||||
static f32 get ()
|
|
||||||
{
|
|
||||||
static u32 RandomSeed = 0x69666966;
|
|
||||||
RandomSeed = (RandomSeed * 3631 + 1);
|
|
||||||
|
|
||||||
f32 value = ( (f32) (RandomSeed & 0x7FFF ) * (1.0f / (f32)(0x7FFF >> 1) ) ) - 1.f;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum eQ3ModifierFunction
|
|
||||||
{
|
|
||||||
TCMOD = 0,
|
|
||||||
DEFORMVERTEXES = 1,
|
|
||||||
RGBGEN = 2,
|
|
||||||
TCGEN = 3,
|
|
||||||
MAP = 4,
|
|
||||||
ALPHAGEN = 5,
|
|
||||||
|
|
||||||
FUNCTION2 = 0x10,
|
|
||||||
SCROLL = FUNCTION2 + 1,
|
|
||||||
SCALE = FUNCTION2 + 2,
|
|
||||||
ROTATE = FUNCTION2 + 3,
|
|
||||||
STRETCH = FUNCTION2 + 4,
|
|
||||||
TURBULENCE = FUNCTION2 + 5,
|
|
||||||
WAVE = FUNCTION2 + 6,
|
|
||||||
|
|
||||||
IDENTITY = FUNCTION2 + 7,
|
|
||||||
VERTEX = FUNCTION2 + 8,
|
|
||||||
TEXTURE = FUNCTION2 + 9,
|
|
||||||
LIGHTMAP = FUNCTION2 + 10,
|
|
||||||
ENVIRONMENT = FUNCTION2 + 11,
|
|
||||||
DOLLAR_LIGHTMAP = FUNCTION2 + 12,
|
|
||||||
BULGE = FUNCTION2 + 13,
|
|
||||||
AUTOSPRITE = FUNCTION2 + 14,
|
|
||||||
AUTOSPRITE2 = FUNCTION2 + 15,
|
|
||||||
TRANSFORM = FUNCTION2 + 16,
|
|
||||||
EXACTVERTEX = FUNCTION2 + 17,
|
|
||||||
CONSTANT = FUNCTION2 + 18,
|
|
||||||
LIGHTINGSPECULAR = FUNCTION2 + 19,
|
|
||||||
MOVE = FUNCTION2 + 20,
|
|
||||||
NORMAL = FUNCTION2 + 21,
|
|
||||||
IDENTITYLIGHTING = FUNCTION2 + 22,
|
|
||||||
|
|
||||||
WAVE_MODIFIER_FUNCTION = 0x30,
|
|
||||||
SINUS = WAVE_MODIFIER_FUNCTION + 1,
|
|
||||||
COSINUS = WAVE_MODIFIER_FUNCTION + 2,
|
|
||||||
SQUARE = WAVE_MODIFIER_FUNCTION + 3,
|
|
||||||
TRIANGLE = WAVE_MODIFIER_FUNCTION + 4,
|
|
||||||
SAWTOOTH = WAVE_MODIFIER_FUNCTION + 5,
|
|
||||||
SAWTOOTH_INVERSE = WAVE_MODIFIER_FUNCTION + 6,
|
|
||||||
NOISE = WAVE_MODIFIER_FUNCTION + 7,
|
|
||||||
|
|
||||||
|
|
||||||
UNKNOWN = -2
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SModifierFunction
|
|
||||||
{
|
|
||||||
SModifierFunction ()
|
|
||||||
: masterfunc0 ( UNKNOWN ), masterfunc1( UNKNOWN ), func ( SINUS ),
|
|
||||||
tcgen( TEXTURE ), rgbgen ( IDENTITY ), alphagen ( UNKNOWN ),
|
|
||||||
base ( 0 ), amp ( 1 ), phase ( 0 ), frequency ( 1 ),
|
|
||||||
wave ( 1 ),
|
|
||||||
x ( 0 ), y ( 0 ), z( 0 ), count( 0 ) {}
|
|
||||||
|
|
||||||
// "tcmod","deformvertexes","rgbgen", "tcgen"
|
|
||||||
eQ3ModifierFunction masterfunc0;
|
|
||||||
// depends
|
|
||||||
eQ3ModifierFunction masterfunc1;
|
|
||||||
// depends
|
|
||||||
eQ3ModifierFunction func;
|
|
||||||
|
|
||||||
eQ3ModifierFunction tcgen;
|
|
||||||
eQ3ModifierFunction rgbgen;
|
|
||||||
eQ3ModifierFunction alphagen;
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
f32 base;
|
|
||||||
f32 bulgewidth;
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
f32 amp;
|
|
||||||
f32 bulgeheight;
|
|
||||||
};
|
|
||||||
|
|
||||||
f32 phase;
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
f32 frequency;
|
|
||||||
f32 bulgespeed;
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
f32 wave;
|
|
||||||
f32 div;
|
|
||||||
};
|
|
||||||
|
|
||||||
f32 x;
|
|
||||||
f32 y;
|
|
||||||
f32 z;
|
|
||||||
u32 count;
|
|
||||||
|
|
||||||
f32 evaluate ( f32 dt ) const
|
|
||||||
{
|
|
||||||
// phase in 0 and 1..
|
|
||||||
f32 x = core::fract( (dt + phase ) * frequency );
|
|
||||||
f32 y = 0.f;
|
|
||||||
|
|
||||||
switch ( func )
|
|
||||||
{
|
|
||||||
case SINUS:
|
|
||||||
y = sinf ( x * core::PI * 2.f );
|
|
||||||
break;
|
|
||||||
case COSINUS:
|
|
||||||
y = cosf ( x * core::PI * 2.f );
|
|
||||||
break;
|
|
||||||
case SQUARE:
|
|
||||||
y = x < 0.5f ? 1.f : -1.f;
|
|
||||||
break;
|
|
||||||
case TRIANGLE:
|
|
||||||
y = x < 0.5f ? ( 4.f * x ) - 1.f : ( -4.f * x ) + 3.f;
|
|
||||||
break;
|
|
||||||
case SAWTOOTH:
|
|
||||||
y = x;
|
|
||||||
break;
|
|
||||||
case SAWTOOTH_INVERSE:
|
|
||||||
y = 1.f - x;
|
|
||||||
break;
|
|
||||||
case NOISE:
|
|
||||||
y = Noiser::get();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base + ( y * amp );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
inline core::vector3df getMD3Normal ( u32 i, u32 j )
|
|
||||||
{
|
|
||||||
const f32 lng = i * 2.0f * core::PI / 255.0f;
|
|
||||||
const f32 lat = j * 2.0f * core::PI / 255.0f;
|
|
||||||
return core::vector3df(cosf ( lat ) * sinf ( lng ),
|
|
||||||
sinf ( lat ) * sinf ( lng ),
|
|
||||||
cosf ( lng ));
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
inline void getModifierFunc ( SModifierFunction& fill, const core::stringc &string, u32 &pos )
|
|
||||||
{
|
|
||||||
if ( string.size() == 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
static const c8 * funclist[] =
|
|
||||||
{
|
|
||||||
"sin","cos","square",
|
|
||||||
"triangle", "sawtooth","inversesawtooth", "noise"
|
|
||||||
};
|
|
||||||
|
|
||||||
fill.func = (eQ3ModifierFunction) isEqual ( string,pos, funclist,7 );
|
|
||||||
fill.func = fill.func == UNKNOWN ? SINUS : (eQ3ModifierFunction) ((u32) fill.func + WAVE_MODIFIER_FUNCTION + 1);
|
|
||||||
|
|
||||||
fill.base = getAsFloat ( string, pos );
|
|
||||||
fill.amp = getAsFloat ( string, pos );
|
|
||||||
fill.phase = getAsFloat ( string, pos );
|
|
||||||
fill.frequency = getAsFloat ( string, pos );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// name = "a b c .."
|
|
||||||
struct SVariable
|
|
||||||
{
|
|
||||||
core::stringc name;
|
|
||||||
core::stringc content;
|
|
||||||
|
|
||||||
SVariable ( const c8 * n, const c8 *c = 0 ) : name ( n ), content (c) {}
|
|
||||||
virtual ~SVariable () {}
|
|
||||||
|
|
||||||
void clear ()
|
|
||||||
{
|
|
||||||
name = "";
|
|
||||||
content = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 isValid () const
|
|
||||||
{
|
|
||||||
return name.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator == ( const SVariable &other ) const
|
|
||||||
{
|
|
||||||
return 0 == strcmp ( name.c_str(), other.name.c_str () );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator < ( const SVariable &other ) const
|
|
||||||
{
|
|
||||||
return 0 > strcmp ( name.c_str(), other.name.c_str () );
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// string database. "a" = "Hello", "b" = "1234.6"
|
|
||||||
struct SVarGroup
|
|
||||||
{
|
|
||||||
SVarGroup () { Variable.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE ); }
|
|
||||||
virtual ~SVarGroup () {}
|
|
||||||
|
|
||||||
u32 isDefined ( const c8 * name, const c8 * content = 0 ) const
|
|
||||||
{
|
|
||||||
for ( u32 i = 0; i != Variable.size (); ++i )
|
|
||||||
{
|
|
||||||
if ( 0 == strcmp ( Variable[i].name.c_str(), name ) &&
|
|
||||||
( 0 == content || strstr ( Variable[i].content.c_str(), content ) )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// searches for Variable name and returns is content
|
|
||||||
// if Variable is not found a reference to an Empty String is returned
|
|
||||||
const core::stringc &get( const c8 * name ) const
|
|
||||||
{
|
|
||||||
SVariable search ( name );
|
|
||||||
s32 index = Variable.linear_search ( search );
|
|
||||||
if ( index < 0 )
|
|
||||||
return irrEmptyStringc;
|
|
||||||
|
|
||||||
return Variable [ index ].content;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the Variable name
|
|
||||||
void set ( const c8 * name, const c8 * content = 0 )
|
|
||||||
{
|
|
||||||
u32 index = isDefined ( name, 0 );
|
|
||||||
if ( 0 == index )
|
|
||||||
{
|
|
||||||
Variable.push_back ( SVariable ( name, content ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Variable [ index ].content = content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
core::array < SVariable > Variable;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! holding a group a variable
|
|
||||||
struct SVarGroupList: public IReferenceCounted
|
|
||||||
{
|
|
||||||
SVarGroupList ()
|
|
||||||
{
|
|
||||||
VariableGroup.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
|
|
||||||
}
|
|
||||||
virtual ~SVarGroupList () {}
|
|
||||||
|
|
||||||
core::array < SVarGroup > VariableGroup;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//! A Parsed Shader Holding Variables ordered in Groups
|
|
||||||
struct IShader
|
|
||||||
{
|
|
||||||
IShader ()
|
|
||||||
: ID ( 0 ), VarGroup ( 0 ) {}
|
|
||||||
virtual ~IShader () {}
|
|
||||||
|
|
||||||
void operator = (const IShader &other )
|
|
||||||
{
|
|
||||||
ID = other.ID;
|
|
||||||
VarGroup = other.VarGroup;
|
|
||||||
name = other.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator == (const IShader &other ) const
|
|
||||||
{
|
|
||||||
return 0 == strcmp ( name.c_str(), other.name.c_str () );
|
|
||||||
//return name == other.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator < (const IShader &other ) const
|
|
||||||
{
|
|
||||||
return strcmp ( name.c_str(), other.name.c_str () ) < 0;
|
|
||||||
//return name < other.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 getGroupSize () const
|
|
||||||
{
|
|
||||||
if ( 0 == VarGroup )
|
|
||||||
return 0;
|
|
||||||
return VarGroup->VariableGroup.size ();
|
|
||||||
}
|
|
||||||
|
|
||||||
const SVarGroup * getGroup ( u32 stage ) const
|
|
||||||
{
|
|
||||||
if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return &VarGroup->VariableGroup [ stage ];
|
|
||||||
}
|
|
||||||
|
|
||||||
// id
|
|
||||||
s32 ID;
|
|
||||||
SVarGroupList *VarGroup; // reference
|
|
||||||
|
|
||||||
// Shader: shader name ( also first variable in first Vargroup )
|
|
||||||
// Entity: classname ( variable in Group(1) )
|
|
||||||
core::stringc name;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef IShader IEntity;
|
|
||||||
|
|
||||||
typedef core::array < IEntity > tQ3EntityList;
|
|
||||||
|
|
||||||
/*
|
|
||||||
dump shader like original layout, regardless of internal data holding
|
|
||||||
no recursive folding..
|
|
||||||
*/
|
|
||||||
inline void dumpVarGroup ( core::stringc &dest, const SVarGroup * group, s32 stack )
|
|
||||||
{
|
|
||||||
core::stringc buf;
|
|
||||||
s32 i;
|
|
||||||
|
|
||||||
|
|
||||||
if ( stack > 0 )
|
|
||||||
{
|
|
||||||
buf = "";
|
|
||||||
for ( i = 0; i < stack - 1; ++i )
|
|
||||||
buf += '\t';
|
|
||||||
|
|
||||||
buf += "{\n";
|
|
||||||
dest.append ( buf );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( u32 g = 0; g != group->Variable.size(); ++g )
|
|
||||||
{
|
|
||||||
buf = "";
|
|
||||||
for ( i = 0; i < stack; ++i )
|
|
||||||
buf += '\t';
|
|
||||||
|
|
||||||
buf += group->Variable[g].name;
|
|
||||||
buf += " ";
|
|
||||||
buf += group->Variable[g].content;
|
|
||||||
buf += "\n";
|
|
||||||
dest.append ( buf );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( stack > 1 )
|
|
||||||
{
|
|
||||||
buf = "";
|
|
||||||
for ( i = 0; i < stack - 1; ++i )
|
|
||||||
buf += '\t';
|
|
||||||
|
|
||||||
buf += "}\n";
|
|
||||||
dest.append ( buf );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
dump a Shader or an Entity
|
|
||||||
*/
|
|
||||||
inline core::stringc & dumpShader ( core::stringc &dest, const IShader * shader, bool entity = false )
|
|
||||||
{
|
|
||||||
if ( 0 == shader )
|
|
||||||
return dest;
|
|
||||||
|
|
||||||
const SVarGroup * group;
|
|
||||||
|
|
||||||
const u32 size = shader->VarGroup->VariableGroup.size ();
|
|
||||||
for ( u32 i = 0; i != size; ++i )
|
|
||||||
{
|
|
||||||
group = &shader->VarGroup->VariableGroup[ i ];
|
|
||||||
dumpVarGroup ( dest, group, core::clamp( (int)i, 0, 2 ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !entity )
|
|
||||||
{
|
|
||||||
if ( size <= 1 )
|
|
||||||
{
|
|
||||||
dest.append ( "{\n" );
|
|
||||||
}
|
|
||||||
dest.append ( "}\n" );
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
quake3 doesn't care much about tga & jpg
|
|
||||||
load one or multiple files stored in name started at startPos to the texture array textures
|
|
||||||
if texture is not loaded 0 will be added ( to find missing textures easier)
|
|
||||||
*/
|
|
||||||
inline void getTextures(tTexArray &textures,
|
|
||||||
const core::stringc &name, u32 &startPos,
|
|
||||||
io::IFileSystem *fileSystem,
|
|
||||||
video::IVideoDriver* driver)
|
|
||||||
{
|
|
||||||
static const char* extension[] =
|
|
||||||
{
|
|
||||||
".jpg",
|
|
||||||
".jpeg",
|
|
||||||
".png",
|
|
||||||
".dds",
|
|
||||||
".tga",
|
|
||||||
".bmp",
|
|
||||||
".pcx"
|
|
||||||
};
|
|
||||||
|
|
||||||
tStringList stringList;
|
|
||||||
getAsStringList(stringList, -1, name, startPos);
|
|
||||||
|
|
||||||
textures.clear();
|
|
||||||
|
|
||||||
io::path loadFile;
|
|
||||||
for ( u32 i = 0; i!= stringList.size (); ++i )
|
|
||||||
{
|
|
||||||
video::ITexture* texture = 0;
|
|
||||||
for (u32 g = 0; g != 7 ; ++g)
|
|
||||||
{
|
|
||||||
core::cutFilenameExtension ( loadFile, stringList[i] );
|
|
||||||
|
|
||||||
if ( loadFile == "$whiteimage" )
|
|
||||||
{
|
|
||||||
texture = driver->getTexture( "$whiteimage" );
|
|
||||||
if ( 0 == texture )
|
|
||||||
{
|
|
||||||
core::dimension2du s ( 2, 2 );
|
|
||||||
u32 image[4] = { 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF };
|
|
||||||
video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
|
|
||||||
texture = driver->addTexture( "$whiteimage", w );
|
|
||||||
w->drop ();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ( loadFile == "$redimage" )
|
|
||||||
{
|
|
||||||
texture = driver->getTexture( "$redimage" );
|
|
||||||
if ( 0 == texture )
|
|
||||||
{
|
|
||||||
core::dimension2du s ( 2, 2 );
|
|
||||||
u32 image[4] = { 0xFFFF0000, 0xFFFF0000,0xFFFF0000,0xFFFF0000 };
|
|
||||||
video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
|
|
||||||
texture = driver->addTexture( "$redimage", w );
|
|
||||||
w->drop ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ( loadFile == "$blueimage" )
|
|
||||||
{
|
|
||||||
texture = driver->getTexture( "$blueimage" );
|
|
||||||
if ( 0 == texture )
|
|
||||||
{
|
|
||||||
core::dimension2du s ( 2, 2 );
|
|
||||||
u32 image[4] = { 0xFF0000FF, 0xFF0000FF,0xFF0000FF,0xFF0000FF };
|
|
||||||
video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
|
|
||||||
texture = driver->addTexture( "$blueimage", w );
|
|
||||||
w->drop ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ( loadFile == "$checkerimage" )
|
|
||||||
{
|
|
||||||
texture = driver->getTexture( "$checkerimage" );
|
|
||||||
if ( 0 == texture )
|
|
||||||
{
|
|
||||||
core::dimension2du s ( 2, 2 );
|
|
||||||
u32 image[4] = { 0xFFFFFFFF, 0xFF000000,0xFF000000,0xFFFFFFFF };
|
|
||||||
video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
|
|
||||||
texture = driver->addTexture( "$checkerimage", w );
|
|
||||||
w->drop ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ( loadFile == "$lightmap" )
|
|
||||||
{
|
|
||||||
texture = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
loadFile.append ( extension[g] );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( fileSystem->existFile ( loadFile ) )
|
|
||||||
{
|
|
||||||
texture = driver->getTexture( loadFile );
|
|
||||||
if ( texture )
|
|
||||||
break;
|
|
||||||
texture = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// take 0 Texture
|
|
||||||
textures.push_back(texture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Manages various Quake3 Shader Styles
|
|
||||||
class IShaderManager : public IReferenceCounted
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end namespace quake3
|
|
||||||
} // end namespace scene
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -124,11 +124,6 @@ namespace scene
|
|||||||
class ITriangleSelector;
|
class ITriangleSelector;
|
||||||
class IVolumeLightSceneNode;
|
class IVolumeLightSceneNode;
|
||||||
|
|
||||||
namespace quake3
|
|
||||||
{
|
|
||||||
struct IShader;
|
|
||||||
} // end namespace quake3
|
|
||||||
|
|
||||||
//! The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff.
|
//! The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff.
|
||||||
/** All Scene nodes can be created only here. There is a always growing
|
/** All Scene nodes can be created only here. There is a always growing
|
||||||
list of scene nodes for lots of purposes: Indoor rendering scene nodes
|
list of scene nodes for lots of purposes: Indoor rendering scene nodes
|
||||||
@ -914,14 +909,6 @@ namespace scene
|
|||||||
s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
|
s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
|
||||||
bool addAlsoIfHeightmapEmpty = false) = 0;
|
bool addAlsoIfHeightmapEmpty = false) = 0;
|
||||||
|
|
||||||
//! Adds a quake3 scene node to the scene graph.
|
|
||||||
/** A Quake3 Scene renders multiple meshes for a specific HighLanguage Shader (Quake3 Style )
|
|
||||||
\return Pointer to the quake3 scene node if successful, otherwise NULL.
|
|
||||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
|
||||||
virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
|
|
||||||
ISceneNode* parent=0, s32 id=-1
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//! Adds an empty scene node to the scene graph.
|
//! Adds an empty scene node to the scene graph.
|
||||||
/** Can be used for doing advanced transformations
|
/** Can be used for doing advanced transformations
|
||||||
|
@ -113,8 +113,6 @@
|
|||||||
#include "IMetaTriangleSelector.h"
|
#include "IMetaTriangleSelector.h"
|
||||||
#include "IOSOperator.h"
|
#include "IOSOperator.h"
|
||||||
#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
|
#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
|
||||||
#include "IQ3LevelMesh.h"
|
|
||||||
#include "IQ3Shader.h"
|
|
||||||
#include "IReadFile.h"
|
#include "IReadFile.h"
|
||||||
#include "IReferenceCounted.h"
|
#include "IReferenceCounted.h"
|
||||||
#include "irrArray.h"
|
#include "irrArray.h"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,491 +0,0 @@
|
|||||||
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#ifndef __C_Q3_LEVEL_MESH_H_INCLUDED__
|
|
||||||
#define __C_Q3_LEVEL_MESH_H_INCLUDED__
|
|
||||||
|
|
||||||
#include "IQ3LevelMesh.h"
|
|
||||||
#include "IReadFile.h"
|
|
||||||
#include "IFileSystem.h"
|
|
||||||
#include "SMesh.h"
|
|
||||||
#include "SMeshBufferLightMap.h"
|
|
||||||
#include "IVideoDriver.h"
|
|
||||||
#include "irrString.h"
|
|
||||||
#include "ISceneManager.h"
|
|
||||||
#include "os.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace scene
|
|
||||||
{
|
|
||||||
class CQ3LevelMesh : public IQ3LevelMesh
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! constructor
|
|
||||||
CQ3LevelMesh(io::IFileSystem* fs, scene::ISceneManager* smgr,
|
|
||||||
const quake3::Q3LevelLoadParameter &loadParam);
|
|
||||||
|
|
||||||
//! destructor
|
|
||||||
virtual ~CQ3LevelMesh();
|
|
||||||
|
|
||||||
//! loads a level from a .bsp-File. Also tries to load all
|
|
||||||
//! needed textures. Returns true if successful.
|
|
||||||
bool loadFile(io::IReadFile* file);
|
|
||||||
|
|
||||||
//! returns the amount of frames in milliseconds. If the amount
|
|
||||||
//! is 1, it is a static (=non animated) mesh.
|
|
||||||
virtual u32 getFrameCount() const;
|
|
||||||
|
|
||||||
//! Gets the default animation speed of the animated mesh.
|
|
||||||
/** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */
|
|
||||||
virtual f32 getAnimationSpeed() const
|
|
||||||
{
|
|
||||||
return FramesPerSecond;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Gets the frame count of the animated mesh.
|
|
||||||
/** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated.
|
|
||||||
The actual speed is set in the scene node the mesh is instantiated in.*/
|
|
||||||
virtual void setAnimationSpeed(f32 fps)
|
|
||||||
{
|
|
||||||
FramesPerSecond=fps;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! returns the animated mesh based on a detail level. 0 is the
|
|
||||||
//! lowest, 255 the highest detail. Note, that some Meshes will
|
|
||||||
//! ignore the detail level.
|
|
||||||
virtual IMesh* getMesh(s32 frameInMs, s32 detailLevel=255,
|
|
||||||
s32 startFrameLoop=-1, s32 endFrameLoop=-1);
|
|
||||||
|
|
||||||
//! Returns an axis aligned bounding box of the mesh.
|
|
||||||
//! \return A bounding box of this mesh is returned.
|
|
||||||
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
|
||||||
|
|
||||||
virtual void setBoundingBox( const core::aabbox3df& box);
|
|
||||||
|
|
||||||
//! Returns the type of the animated mesh.
|
|
||||||
virtual E_ANIMATED_MESH_TYPE getMeshType() const;
|
|
||||||
|
|
||||||
//! loads the shader definition
|
|
||||||
virtual void getShader( io::IReadFile* file );
|
|
||||||
|
|
||||||
//! loads the shader definition
|
|
||||||
virtual const quake3::IShader * getShader( const c8 * filename, bool fileNameIsValid=true );
|
|
||||||
|
|
||||||
//! returns a already loaded Shader
|
|
||||||
virtual const quake3::IShader * getShader( u32 index ) const;
|
|
||||||
|
|
||||||
|
|
||||||
//! loads a configuration file
|
|
||||||
virtual void getConfiguration( io::IReadFile* file );
|
|
||||||
//! get's an interface to the entities
|
|
||||||
virtual quake3::tQ3EntityList & getEntityList();
|
|
||||||
|
|
||||||
//! returns the requested brush entity
|
|
||||||
virtual IMesh* getBrushEntityMesh(s32 num) const;
|
|
||||||
|
|
||||||
//! returns the requested brush entity
|
|
||||||
virtual IMesh* getBrushEntityMesh(quake3::IEntity &ent) const;
|
|
||||||
|
|
||||||
//Link to held meshes? ...
|
|
||||||
|
|
||||||
|
|
||||||
//! returns amount of mesh buffers.
|
|
||||||
virtual u32 getMeshBufferCount() const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! returns pointer to a mesh buffer
|
|
||||||
virtual IMeshBuffer* getMeshBuffer(u32 nr) const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns pointer to a mesh buffer which fits a material
|
|
||||||
/** \param material: material to search for
|
|
||||||
\return Pointer to the mesh buffer or 0 if there is no such mesh buffer. */
|
|
||||||
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! set the hardware mapping hint, for driver
|
|
||||||
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! flags the meshbuffer as changed, reloads hardware buffers
|
|
||||||
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
void constructMesh();
|
|
||||||
void solveTJunction();
|
|
||||||
void loadTextures();
|
|
||||||
scene::SMesh** buildMesh(s32 num);
|
|
||||||
|
|
||||||
struct STexShader
|
|
||||||
{
|
|
||||||
video::ITexture* Texture;
|
|
||||||
s32 ShaderID;
|
|
||||||
};
|
|
||||||
|
|
||||||
core::array< STexShader > Tex;
|
|
||||||
core::array<video::ITexture*> Lightmap;
|
|
||||||
|
|
||||||
enum eLumps
|
|
||||||
{
|
|
||||||
kEntities = 0, // Stores player/object positions, etc...
|
|
||||||
kShaders = 1, // Stores texture information
|
|
||||||
kPlanes = 2, // Stores the splitting planes
|
|
||||||
kNodes = 3, // Stores the BSP nodes
|
|
||||||
kLeafs = 4, // Stores the leafs of the nodes
|
|
||||||
kLeafFaces = 5, // Stores the leaf's indices into the faces
|
|
||||||
kLeafBrushes = 6, // Stores the leaf's indices into the brushes
|
|
||||||
kModels = 7, // Stores the info of world models
|
|
||||||
kBrushes = 8, // Stores the brushes info (for collision)
|
|
||||||
kBrushSides = 9, // Stores the brush surfaces info
|
|
||||||
kVertices = 10, // Stores the level vertices
|
|
||||||
kMeshVerts = 11, // Stores the model vertices offsets
|
|
||||||
kFogs = 12, // Stores the shader files (blending, anims..)
|
|
||||||
kFaces = 13, // Stores the faces for the level
|
|
||||||
kLightmaps = 14, // Stores the lightmaps for the level
|
|
||||||
kLightGrid = 15, // Stores extra world lighting information
|
|
||||||
kVisData = 16, // Stores PVS and cluster info (visibility)
|
|
||||||
kLightArray = 17, // RBSP
|
|
||||||
kMaxLumps // A constant to store the number of lumps
|
|
||||||
};
|
|
||||||
|
|
||||||
enum eBspSurfaceType
|
|
||||||
{
|
|
||||||
BSP_MST_BAD,
|
|
||||||
BSP_MST_PLANAR,
|
|
||||||
BSP_MST_PATCH,
|
|
||||||
BSP_MST_TRIANGLE_SOUP,
|
|
||||||
BSP_MST_FLARE,
|
|
||||||
BSP_MST_FOLIAGE
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPHeader
|
|
||||||
{
|
|
||||||
s32 strID; // This should always be 'IBSP'
|
|
||||||
s32 version; // This should be 0x2e for Quake 3 files
|
|
||||||
};
|
|
||||||
tBSPHeader header;
|
|
||||||
|
|
||||||
struct tBSPLump
|
|
||||||
{
|
|
||||||
s32 offset;
|
|
||||||
s32 length;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct tBSPVertex
|
|
||||||
{
|
|
||||||
f32 vPosition[3]; // (x, y, z) position.
|
|
||||||
f32 vTextureCoord[2]; // (u, v) texture coordinate
|
|
||||||
f32 vLightmapCoord[2]; // (u, v) lightmap coordinate
|
|
||||||
f32 vNormal[3]; // (x, y, z) normal vector
|
|
||||||
u8 color[4]; // RGBA color for the vertex
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPFace
|
|
||||||
{
|
|
||||||
s32 textureID; // The index into the texture array
|
|
||||||
s32 fogNum; // The index for the effects (or -1 = n/a)
|
|
||||||
s32 type; // 1=polygon, 2=patch, 3=mesh, 4=billboard
|
|
||||||
s32 vertexIndex; // The index into this face's first vertex
|
|
||||||
s32 numOfVerts; // The number of vertices for this face
|
|
||||||
s32 meshVertIndex; // The index into the first meshvertex
|
|
||||||
s32 numMeshVerts; // The number of mesh vertices
|
|
||||||
s32 lightmapID; // The texture index for the lightmap
|
|
||||||
s32 lMapCorner[2]; // The face's lightmap corner in the image
|
|
||||||
s32 lMapSize[2]; // The size of the lightmap section
|
|
||||||
f32 lMapPos[3]; // The 3D origin of lightmap.
|
|
||||||
f32 lMapBitsets[2][3]; // The 3D space for s and t unit vectors.
|
|
||||||
f32 vNormal[3]; // The face normal.
|
|
||||||
s32 size[2]; // The bezier patch dimensions.
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPTexture
|
|
||||||
{
|
|
||||||
c8 strName[64]; // The name of the texture w/o the extension
|
|
||||||
u32 flags; // The surface flags (unknown)
|
|
||||||
u32 contents; // The content flags (unknown)
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPLightmap
|
|
||||||
{
|
|
||||||
u8 imageBits[128][128][3]; // The RGB data in a 128x128 image
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPNode
|
|
||||||
{
|
|
||||||
s32 plane; // The index into the planes array
|
|
||||||
s32 front; // The child index for the front node
|
|
||||||
s32 back; // The child index for the back node
|
|
||||||
s32 mins[3]; // The bounding box min position.
|
|
||||||
s32 maxs[3]; // The bounding box max position.
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPLeaf
|
|
||||||
{
|
|
||||||
s32 cluster; // The visibility cluster
|
|
||||||
s32 area; // The area portal
|
|
||||||
s32 mins[3]; // The bounding box min position
|
|
||||||
s32 maxs[3]; // The bounding box max position
|
|
||||||
s32 leafface; // The first index into the face array
|
|
||||||
s32 numOfLeafFaces; // The number of faces for this leaf
|
|
||||||
s32 leafBrush; // The first index for into the brushes
|
|
||||||
s32 numOfLeafBrushes; // The number of brushes for this leaf
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPPlane
|
|
||||||
{
|
|
||||||
f32 vNormal[3]; // Plane normal.
|
|
||||||
f32 d; // The plane distance from origin
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPVisData
|
|
||||||
{
|
|
||||||
s32 numOfClusters; // The number of clusters
|
|
||||||
s32 bytesPerCluster; // Bytes (8 bits) in the cluster's bitset
|
|
||||||
c8 *pBitsets; // Array of bytes holding the cluster vis.
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPBrush
|
|
||||||
{
|
|
||||||
s32 brushSide; // The starting brush side for the brush
|
|
||||||
s32 numOfBrushSides; // Number of brush sides for the brush
|
|
||||||
s32 textureID; // The texture index for the brush
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPBrushSide
|
|
||||||
{
|
|
||||||
s32 plane; // The plane index
|
|
||||||
s32 textureID; // The texture index
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPModel
|
|
||||||
{
|
|
||||||
f32 min[3]; // The min position for the bounding box
|
|
||||||
f32 max[3]; // The max position for the bounding box.
|
|
||||||
s32 faceIndex; // The first face index in the model
|
|
||||||
s32 numOfFaces; // The number of faces in the model
|
|
||||||
s32 brushIndex; // The first brush index in the model
|
|
||||||
s32 numOfBrushes; // The number brushes for the model
|
|
||||||
};
|
|
||||||
|
|
||||||
struct tBSPFog
|
|
||||||
{
|
|
||||||
c8 shader[64]; // The name of the shader file
|
|
||||||
s32 brushIndex; // The brush index for this shader
|
|
||||||
s32 visibleSide; // the brush side that ray tests need to clip against (-1 == none
|
|
||||||
};
|
|
||||||
core::array < STexShader > FogMap;
|
|
||||||
|
|
||||||
struct tBSPLights
|
|
||||||
{
|
|
||||||
u8 ambient[3]; // This is the ambient color in RGB
|
|
||||||
u8 directional[3]; // This is the directional color in RGB
|
|
||||||
u8 direction[2]; // The direction of the light: [phi,theta]
|
|
||||||
};
|
|
||||||
|
|
||||||
void loadTextures (tBSPLump* l, io::IReadFile* file); // Load the textures
|
|
||||||
void loadLightmaps (tBSPLump* l, io::IReadFile* file); // Load the lightmaps
|
|
||||||
void loadVerts (tBSPLump* l, io::IReadFile* file); // Load the vertices
|
|
||||||
void loadFaces (tBSPLump* l, io::IReadFile* file); // Load the faces
|
|
||||||
void loadPlanes (tBSPLump* l, io::IReadFile* file); // Load the Planes of the BSP
|
|
||||||
void loadNodes (tBSPLump* l, io::IReadFile* file); // load the Nodes of the BSP
|
|
||||||
void loadLeafs (tBSPLump* l, io::IReadFile* file); // load the Leafs of the BSP
|
|
||||||
void loadLeafFaces (tBSPLump* l, io::IReadFile* file); // load the Faces of the Leafs of the BSP
|
|
||||||
void loadVisData (tBSPLump* l, io::IReadFile* file); // load the visibility data of the clusters
|
|
||||||
void loadEntities (tBSPLump* l, io::IReadFile* file); // load the entities
|
|
||||||
void loadModels (tBSPLump* l, io::IReadFile* file); // load the models
|
|
||||||
void loadMeshVerts (tBSPLump* l, io::IReadFile* file); // load the mesh vertices
|
|
||||||
void loadBrushes (tBSPLump* l, io::IReadFile* file); // load the brushes of the BSP
|
|
||||||
void loadBrushSides (tBSPLump* l, io::IReadFile* file); // load the brushsides of the BSP
|
|
||||||
void loadLeafBrushes(tBSPLump* l, io::IReadFile* file); // load the brushes of the leaf
|
|
||||||
void loadFogs (tBSPLump* l, io::IReadFile* file); // load the shaders
|
|
||||||
|
|
||||||
//bi-quadratic bezier patches
|
|
||||||
void createCurvedSurface_bezier(SMeshBufferLightMap* meshBuffer,
|
|
||||||
s32 faceIndex, s32 patchTesselation, s32 storevertexcolor);
|
|
||||||
|
|
||||||
void createCurvedSurface_nosubdivision(SMeshBufferLightMap* meshBuffer,
|
|
||||||
s32 faceIndex, s32 patchTesselation, s32 storevertexcolor);
|
|
||||||
|
|
||||||
struct S3DVertex2TCoords_64
|
|
||||||
{
|
|
||||||
core::vector3d<f64> Pos;
|
|
||||||
core::vector3d<f64> Normal;
|
|
||||||
video::SColorf Color;
|
|
||||||
core::vector2d<f64> TCoords;
|
|
||||||
core::vector2d<f64> TCoords2;
|
|
||||||
|
|
||||||
void copy( video::S3DVertex2TCoords &dest ) const;
|
|
||||||
|
|
||||||
S3DVertex2TCoords_64() {}
|
|
||||||
S3DVertex2TCoords_64(const core::vector3d<f64>& pos, const core::vector3d<f64>& normal, const video::SColorf& color,
|
|
||||||
const core::vector2d<f64>& tcoords, const core::vector2d<f64>& tcoords2)
|
|
||||||
: Pos(pos), Normal(normal), Color(color), TCoords(tcoords), TCoords2(tcoords2) {}
|
|
||||||
|
|
||||||
S3DVertex2TCoords_64 getInterpolated_quadratic(const S3DVertex2TCoords_64& v2,
|
|
||||||
const S3DVertex2TCoords_64& v3, const f64 d) const
|
|
||||||
{
|
|
||||||
return S3DVertex2TCoords_64 (
|
|
||||||
Pos.getInterpolated_quadratic ( v2.Pos, v3.Pos, d ),
|
|
||||||
Normal.getInterpolated_quadratic ( v2.Normal, v3.Normal, d ),
|
|
||||||
Color.getInterpolated_quadratic ( v2.Color, v3.Color, (f32) d ),
|
|
||||||
TCoords.getInterpolated_quadratic ( v2.TCoords, v3.TCoords, d ),
|
|
||||||
TCoords2.getInterpolated_quadratic ( v2.TCoords2, v3.TCoords2, d ));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline void copy( video::S3DVertex2TCoords * dest, const tBSPVertex * source,
|
|
||||||
s32 vertexcolor ) const;
|
|
||||||
void copy( S3DVertex2TCoords_64 * dest, const tBSPVertex * source, s32 vertexcolor ) const;
|
|
||||||
|
|
||||||
|
|
||||||
struct SBezier
|
|
||||||
{
|
|
||||||
SMeshBufferLightMap *Patch;
|
|
||||||
S3DVertex2TCoords_64 control[9];
|
|
||||||
|
|
||||||
void tesselate(s32 level);
|
|
||||||
|
|
||||||
private:
|
|
||||||
s32 Level;
|
|
||||||
|
|
||||||
core::array<S3DVertex2TCoords_64> column[3];
|
|
||||||
|
|
||||||
};
|
|
||||||
SBezier Bezier;
|
|
||||||
|
|
||||||
quake3::Q3LevelLoadParameter LoadParam;
|
|
||||||
|
|
||||||
tBSPLump Lumps[kMaxLumps];
|
|
||||||
|
|
||||||
tBSPTexture* Textures;
|
|
||||||
s32 NumTextures;
|
|
||||||
|
|
||||||
tBSPLightmap* LightMaps;
|
|
||||||
s32 NumLightMaps;
|
|
||||||
|
|
||||||
tBSPVertex* Vertices;
|
|
||||||
s32 NumVertices;
|
|
||||||
|
|
||||||
tBSPFace* Faces;
|
|
||||||
s32 NumFaces;
|
|
||||||
|
|
||||||
tBSPModel* Models;
|
|
||||||
s32 NumModels;
|
|
||||||
|
|
||||||
tBSPPlane* Planes;
|
|
||||||
s32 NumPlanes;
|
|
||||||
|
|
||||||
tBSPNode* Nodes;
|
|
||||||
s32 NumNodes;
|
|
||||||
|
|
||||||
tBSPLeaf* Leafs;
|
|
||||||
s32 NumLeafs;
|
|
||||||
|
|
||||||
s32 *LeafFaces;
|
|
||||||
s32 NumLeafFaces;
|
|
||||||
|
|
||||||
s32 *MeshVerts; // The vertex offsets for a mesh
|
|
||||||
s32 NumMeshVerts;
|
|
||||||
|
|
||||||
tBSPBrush* Brushes;
|
|
||||||
s32 NumBrushes;
|
|
||||||
|
|
||||||
scene::SMesh** BrushEntities;
|
|
||||||
|
|
||||||
scene::SMesh* Mesh[quake3::E_Q3_MESH_SIZE];
|
|
||||||
video::IVideoDriver* Driver;
|
|
||||||
core::stringc LevelName;
|
|
||||||
io::IFileSystem* FileSystem; // needs because there are no file extenstions stored in .bsp files.
|
|
||||||
|
|
||||||
// Additional content
|
|
||||||
scene::ISceneManager* SceneManager;
|
|
||||||
enum eToken
|
|
||||||
{
|
|
||||||
Q3_TOKEN_UNRESOLVED = 0,
|
|
||||||
Q3_TOKEN_EOF = 1,
|
|
||||||
Q3_TOKEN_START_LIST,
|
|
||||||
Q3_TOKEN_END_LIST,
|
|
||||||
Q3_TOKEN_ENTITY,
|
|
||||||
Q3_TOKEN_TOKEN,
|
|
||||||
Q3_TOKEN_EOL,
|
|
||||||
Q3_TOKEN_COMMENT,
|
|
||||||
Q3_TOKEN_MATH_DIVIDE,
|
|
||||||
Q3_TOKEN_MATH_ADD,
|
|
||||||
Q3_TOKEN_MATH_MULTIPY
|
|
||||||
};
|
|
||||||
struct SQ3Parser
|
|
||||||
{
|
|
||||||
const c8 *source;
|
|
||||||
u32 sourcesize;
|
|
||||||
u32 index;
|
|
||||||
core::stringc token;
|
|
||||||
eToken tokenresult;
|
|
||||||
};
|
|
||||||
SQ3Parser Parser;
|
|
||||||
|
|
||||||
|
|
||||||
typedef void( CQ3LevelMesh::*tParserCallback ) ( quake3::SVarGroupList *& groupList, eToken token );
|
|
||||||
void parser_parse( const void * data, u32 size, tParserCallback callback );
|
|
||||||
void parser_nextToken();
|
|
||||||
|
|
||||||
void dumpVarGroup( const quake3::SVarGroup * group, s32 stack ) const;
|
|
||||||
|
|
||||||
void scriptcallback_entity( quake3::SVarGroupList *& grouplist, eToken token );
|
|
||||||
void scriptcallback_shader( quake3::SVarGroupList *& grouplist, eToken token );
|
|
||||||
void scriptcallback_config( quake3::SVarGroupList *& grouplist, eToken token );
|
|
||||||
|
|
||||||
core::array < quake3::IShader > Shader;
|
|
||||||
core::array < quake3::IShader > Entity; //quake3::tQ3EntityList Entity;
|
|
||||||
|
|
||||||
|
|
||||||
quake3::tStringList ShaderFile;
|
|
||||||
void InitShader();
|
|
||||||
void ReleaseShader();
|
|
||||||
void ReleaseEntity();
|
|
||||||
|
|
||||||
|
|
||||||
s32 setShaderMaterial( video::SMaterial & material, const tBSPFace * face ) const;
|
|
||||||
s32 setShaderFogMaterial( video::SMaterial &material, const tBSPFace * face ) const;
|
|
||||||
|
|
||||||
struct SToBuffer
|
|
||||||
{
|
|
||||||
s32 takeVertexColor;
|
|
||||||
u32 index;
|
|
||||||
};
|
|
||||||
|
|
||||||
void cleanMeshes();
|
|
||||||
void cleanMesh(SMesh *m, const bool texture0important = false);
|
|
||||||
void cleanLoader ();
|
|
||||||
void calcBoundingBoxes();
|
|
||||||
c8 buf[128];
|
|
||||||
f32 FramesPerSecond;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end namespace scene
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,118 +0,0 @@
|
|||||||
// Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#ifndef __C_QUAKE3_SCENE_NODE_H_INCLUDED__
|
|
||||||
#define __C_QUAKE3_SCENE_NODE_H_INCLUDED__
|
|
||||||
|
|
||||||
#include "IMeshSceneNode.h"
|
|
||||||
#include "IQ3Shader.h"
|
|
||||||
#include "IFileSystem.h"
|
|
||||||
#include "SMeshBuffer.h"
|
|
||||||
#include "SMeshBufferLightMap.h"
|
|
||||||
#include "SMesh.h"
|
|
||||||
#include "ISceneManager.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace scene
|
|
||||||
{
|
|
||||||
|
|
||||||
//! Scene node which is a quake3 shader.
|
|
||||||
class CQuake3ShaderSceneNode : public scene::IMeshSceneNode
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
CQuake3ShaderSceneNode( ISceneNode* parent, ISceneManager* mgr, s32 id,
|
|
||||||
io::IFileSystem* fileSystem,
|
|
||||||
const IMeshBuffer* original,
|
|
||||||
const quake3::IShader* shader
|
|
||||||
);
|
|
||||||
|
|
||||||
virtual ~CQuake3ShaderSceneNode();
|
|
||||||
|
|
||||||
virtual void OnRegisterSceneNode();
|
|
||||||
virtual void render();
|
|
||||||
virtual void OnAnimate(u32 timeMs);
|
|
||||||
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
|
||||||
|
|
||||||
virtual u32 getMaterialCount() const;
|
|
||||||
virtual video::SMaterial& getMaterial(u32 i);
|
|
||||||
|
|
||||||
//! Returns type of the scene node
|
|
||||||
virtual ESCENE_NODE_TYPE getType() const { return ESNT_Q3SHADER_SCENE_NODE; }
|
|
||||||
|
|
||||||
virtual void setMesh(IMesh* mesh){}
|
|
||||||
virtual IMesh* getMesh() { return Mesh; }
|
|
||||||
virtual void setReadOnlyMaterials(bool readonly) {}
|
|
||||||
virtual bool isReadOnlyMaterials() const { return true; }
|
|
||||||
|
|
||||||
//! Creates shadow volume scene node as child of this node
|
|
||||||
//! and returns a pointer to it.
|
|
||||||
virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh,
|
|
||||||
s32 id, bool zfailmethod=true, f32 infinity=10000.0f);
|
|
||||||
|
|
||||||
//! Removes a child from this scene node.
|
|
||||||
//! Implemented here, to be able to remove the shadow properly, if there is one,
|
|
||||||
//! or to remove attached childs.
|
|
||||||
virtual bool removeChild(ISceneNode* child);
|
|
||||||
|
|
||||||
private:
|
|
||||||
const quake3::IShader* Shader;
|
|
||||||
SMesh *Mesh;
|
|
||||||
IShadowVolumeSceneNode* Shadow;
|
|
||||||
const SMeshBufferLightMap* Original;
|
|
||||||
SMeshBuffer* MeshBuffer;
|
|
||||||
core::vector3df MeshOffset;
|
|
||||||
|
|
||||||
struct SQ3Texture
|
|
||||||
{
|
|
||||||
SQ3Texture () :
|
|
||||||
TextureIndex ( 0 ),
|
|
||||||
TextureFrequency(0.f),
|
|
||||||
TextureAddressMode( video::ETC_REPEAT )
|
|
||||||
{
|
|
||||||
Texture.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
|
|
||||||
}
|
|
||||||
|
|
||||||
quake3::tTexArray Texture;
|
|
||||||
|
|
||||||
u32 TextureIndex;
|
|
||||||
f32 TextureFrequency;
|
|
||||||
video::E_TEXTURE_CLAMP TextureAddressMode; // Wrapping/Clamping
|
|
||||||
};
|
|
||||||
|
|
||||||
core::array< SQ3Texture > Q3Texture;
|
|
||||||
|
|
||||||
void loadTextures ( io::IFileSystem * fileSystem );
|
|
||||||
void addBuffer ( scene::SMeshBufferLightMap * buffer );
|
|
||||||
void cloneBuffer ( scene::SMeshBuffer *dest, const scene::SMeshBufferLightMap * buffer, bool translateCenter );
|
|
||||||
|
|
||||||
void deformvertexes_wave ( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
void deformvertexes_move ( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
void deformvertexes_bulge( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
void deformvertexes_autosprite( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
void deformvertexes_autosprite2( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
void deformvertexes_normal ( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
|
|
||||||
void vertextransform_tcgen ( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
void vertextransform_rgbgen ( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
void vertextransform_alphagen ( f32 dt, quake3::SModifierFunction &function );
|
|
||||||
|
|
||||||
void transformtex ( const core::matrix4 &m, const u32 clamp );
|
|
||||||
|
|
||||||
f32 TimeAbs;
|
|
||||||
|
|
||||||
void animate( u32 stage, core::matrix4 &texture );
|
|
||||||
|
|
||||||
E_SCENE_NODE_RENDER_PASS getRenderStage() const;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace scene
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -44,7 +44,6 @@
|
|||||||
#include "CTerrainSceneNode.h"
|
#include "CTerrainSceneNode.h"
|
||||||
#include "CEmptySceneNode.h"
|
#include "CEmptySceneNode.h"
|
||||||
#include "CTextSceneNode.h"
|
#include "CTextSceneNode.h"
|
||||||
#include "CQuake3ShaderSceneNode.h"
|
|
||||||
#include "CVolumeLightSceneNode.h"
|
#include "CVolumeLightSceneNode.h"
|
||||||
|
|
||||||
#include "CDefaultSceneNodeFactory.h"
|
#include "CDefaultSceneNodeFactory.h"
|
||||||
@ -347,16 +346,6 @@ IBillboardTextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont*
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Adds a scene node, which can render a quake3 shader
|
|
||||||
IMeshSceneNode* CSceneManager::addQuake3SceneNode(const IMeshBuffer* meshBuffer,
|
|
||||||
const quake3::IShader * shader,
|
|
||||||
ISceneNode* parent, s32 id )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! adds Volume Lighting Scene Node.
|
//! adds Volume Lighting Scene Node.
|
||||||
//! the returned pointer must not be dropped.
|
//! the returned pointer must not be dropped.
|
||||||
IVolumeLightSceneNode* CSceneManager::addVolumeLightSceneNode(
|
IVolumeLightSceneNode* CSceneManager::addVolumeLightSceneNode(
|
||||||
|
@ -195,11 +195,6 @@ namespace scene
|
|||||||
const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
|
const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
|
||||||
video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF);
|
video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF);
|
||||||
|
|
||||||
//! Adds a scene node, which can render a quake3 shader
|
|
||||||
virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
|
|
||||||
ISceneNode* parent=0, s32 id=-1
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//! Adds a Hill Plane mesh to the mesh pool. The mesh is
|
//! Adds a Hill Plane mesh to the mesh pool. The mesh is
|
||||||
//! generated on the fly and looks like a plane with some hills
|
//! generated on the fly and looks like a plane with some hills
|
||||||
|
Loading…
Reference in New Issue
Block a user