* Major overhaul of linux build system

** Only openssl and bz2 (for stuffextract) left as external dependencies, zlib, zthread and irrlicht are compiled from dep folder
** Irrlicht upgraded to version 1.5
** Various fixes to make GCC not complain
** to compile: autoreconf -if && ./compile -prefix=full_path_to_bin_directory && make
** Only issue: rename dep/openssl otherwise compiler will complain - too late to figure out now.
This commit is contained in:
shlainn 2009-04-11 00:59:48 +00:00
parent bf1813e90c
commit 32e4271361
596 changed files with 80509 additions and 44938 deletions

View File

@ -13,15 +13,16 @@ AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LN_S AC_PROG_LN_S
AC_PROG_RANLIB AC_PROG_RANLIB
# AC_PROG_LIBTOOL
# Checks for libraries. # Checks for libraries.
AC_CHECK_LIB([Xxf86vm], [main], [], [echo "ERROR: Xxf86vm library not found." && exit 1]) AC_CHECK_LIB([Xxf86vm], [main], [], [echo "ERROR: Xxf86vm library not found." && exit 1])
AC_CHECK_LIB([GL], [main], [], [echo "ERROR: GL library not found." && exit 1]) AC_CHECK_LIB([GL], [main], [], [echo "ERROR: GL library not found." && exit 1])
AC_CHECK_LIB([GLU], [main], [], [echo "ERROR: GLU library not found." && exit 1]) AC_CHECK_LIB([GLU], [main], [], [echo "ERROR: GLU library not found." && exit 1])
AC_CHECK_LIB([Irrlicht], [main], [], [echo "ERROR: Irrlicht library not found." && exit 1]) # AC_CHECK_LIB([Irrlicht], [main], [], [echo "ERROR: Irrlicht library not found." && exit 1])
AC_CHECK_LIB([ssl], [main], [], [echo "ERROR: ssl library not found." && exit 1]) AC_CHECK_LIB([ssl], [main], [], [echo "ERROR: ssl library not found." && exit 1])
AC_CHECK_LIB([crypto], [main], [], [echo "ERROR: ssl crypto library not found." && exit 1]) AC_CHECK_LIB([crypto], [main], [], [echo "ERROR: ssl crypto library not found." && exit 1])
AC_CHECK_LIB([ZThread], [main], [], [echo "ERROR: ZThread library not found." && exit 1]) # AC_CHECK_LIB([ZThread], [main], [], [echo "ERROR: ZThread library not found." && exit 1])
# Checks for header files. # Checks for header files.
AC_PATH_X AC_PATH_X
@ -65,6 +66,10 @@ AC_CHECK_FUNCS([floor ftime ftruncate getcwd gethostbyaddr gethostbyname gethost
# src/dep/src/irrlicht/libpng]) # src/dep/src/irrlicht/libpng])
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
src/Makefile src/Makefile
src/dep/Makefile
src/dep/src/Makefile
src/dep/src/zlib/Makefile
src/dep/src/zthread/Makefile
src/tools/Makefile src/tools/Makefile
src/tools/stuffextract/Makefile src/tools/stuffextract/Makefile
src/tools/stuffextract/StormLib/Makefile src/tools/stuffextract/StormLib/Makefile

View File

@ -1,32 +1,7 @@
#include <iostream> #include <iostream>
#include "CM2MeshFileLoader.h" #include "CM2MeshFileLoader.h"
#include "SSkinnedMesh.h" #include "SSkinnedMesh.h"
#define _DEBUG
#include "common.h" #include "common.h"
#ifdef _DEBUG
#define DEBUG(code) code;
#else
#define DEBUG(code) ;
#endif
/*
void logdebug(const char *str, ...)
{
if(!str)
return;
va_list ap;
// _log_setcolor(true,LBLUE);
va_start(ap, str);
vprintf( str, ap );
va_end(ap);
// _log_resetcolor(true);
printf("\n");
fflush(stdout);
}*/
namespace irr namespace irr
{ {
@ -207,7 +182,7 @@ for(u32 i=0;i<header.nTexLookup;i++)
{ {
MeshFile->read(&tempM2TexLookup,sizeof(u16)); MeshFile->read(&tempM2TexLookup,sizeof(u16));
M2MTextureLookup.push_back(tempM2TexLookup); M2MTextureLookup.push_back(tempM2TexLookup);
printf("Texture %u Type %u\n",i,tempM2TexLookup); DEBUG(logdebug("Texture %u Type %u\n",i,tempM2TexLookup));
} }
DEBUG(logdebug("Read %u Texture lookup entries",M2MTextureLookup.size())); DEBUG(logdebug("Read %u Texture lookup entries",M2MTextureLookup.size()));
@ -222,7 +197,7 @@ for(u32 i=0;i<header.nTextures;i++)
{ {
MeshFile->read(&tempM2TexDef,sizeof(TextureDefinition)); MeshFile->read(&tempM2TexDef,sizeof(TextureDefinition));
M2MTextureDef.push_back(tempM2TexDef); M2MTextureDef.push_back(tempM2TexDef);
printf("Texture %u Type %u\n",i,tempM2TexDef.texType); DEBUG(logdebug("Texture %u Type %u\n",i,tempM2TexDef.texType));
} }
DEBUG(logdebug("Read %u Texture Definition entries",M2MTextureDef.size())); DEBUG(logdebug("Read %u Texture Definition entries",M2MTextureDef.size()));
@ -241,10 +216,6 @@ for(u32 i=0;i<header.nTexFlags;i++)
} }
DEBUG(logdebug("Read %u Renderflags",M2MRenderFlags.size())); DEBUG(logdebug("Read %u Renderflags",M2MRenderFlags.size()));
//std::cout << M2MTextureUnit[0].submeshIndex1 <<","<<M2MTextureUnit[0].submeshIndex1 <<","<<M2MTextureUnit[0].textureIndex<<";\n";
if(!M2MTextureFiles.empty()) if(!M2MTextureFiles.empty())
M2MTextureFiles.clear(); M2MTextureFiles.clear();
@ -258,7 +229,6 @@ for(u32 i=0; i<M2MTextureDef.size(); i++)
M2MTextureFiles.push_back(tempTexFileName.c_str()); M2MTextureFiles.push_back(tempTexFileName.c_str());
DEBUG(logdebug("Texture: %u (%s)",M2MTextureFiles.size(),M2MTextureFiles[i].c_str())); DEBUG(logdebug("Texture: %u (%s)",M2MTextureFiles.size(),M2MTextureFiles[i].c_str()));
} }
// std::cout << "Read "<<M2MTextureFiles.size()<<"/"<<M2MTextureDef.size()<<" Texture file names\n";
/////////////////////////////////////// ///////////////////////////////////////
// Animation related stuff // // Animation related stuff //
@ -491,7 +461,7 @@ for(u32 i=0; i < currentView.nSub;i++)//
{ {
MeshBuffer->Indices.push_back(M2MIndices[M2MTriangles[j]]-M2MSubmeshes[i].ofsVertex); MeshBuffer->Indices.push_back(M2MIndices[M2MTriangles[j]]-M2MSubmeshes[i].ofsVertex);
} }
// std::cout << i << ": " << MeshBuffer->Indices.size() << "\n";
for(u32 j=M2MSubmeshes[i].ofsVertex;j<M2MSubmeshes[i].ofsVertex+M2MSubmeshes[i].nVertex;j++) for(u32 j=M2MSubmeshes[i].ofsVertex;j<M2MSubmeshes[i].ofsVertex+M2MSubmeshes[i].nVertex;j++)
{ {
MeshBuffer->Vertices_Standard.push_back(M2Vertices[j]); MeshBuffer->Vertices_Standard.push_back(M2Vertices[j]);

View File

@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall -D_DEBUG AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -I$(top_builddir)/src/dep/include -Wall -D_DEBUG
## Build pseuwow ## Build pseuwow
noinst_LIBRARIES = libgui.a noinst_LIBRARIES = libgui.a
libgui_a_SOURCES =CCursorController.cpp DrawObject.cpp MInput.h Scene.h SImage.h\ libgui_a_SOURCES =CCursorController.cpp DrawObject.cpp MInput.h Scene.h SImage.h\

View File

@ -185,6 +185,7 @@ void SImage::setPixel(u32 x, u32 y, const SColor &color )
} }
//! returns a pixel //! returns a pixel
SColor SImage::getPixel(u32 x, u32 y) const SColor SImage::getPixel(u32 x, u32 y) const
{ {
@ -269,6 +270,40 @@ void SImage::copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT fo
} }
} }
//! copies this surface into another, using the alpha mask, an cliprect and a color to add with
void SImage::copyToWithAlpha(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const SColor &color, const core::rect<s32>* clipRect)
{
// color blend only necessary on not full spectrum aka. color.color != 0xFFFFFFFF
// Blit(color.color == 0xFFFFFFFF ? BLITTER_TEXTURE_ALPHA_BLEND: BLITTER_TEXTURE_ALPHA_COLOR_BLEND, target, clipRect, &pos, this, &sourceRect, color.color);
}
//! fills the surface with given color
void SImage::fill(const SColor &color)
{
u32 c;
switch ( Format )
{
case ECF_A1R5G5B5:
c = video::A8R8G8B8toA1R5G5B5( color.color );
c |= c << 16;
break;
case ECF_R5G6B5:
c = video::A8R8G8B8toR5G6B5( color.color );
c |= c << 16;
break;
case ECF_A8R8G8B8:
c = color.color;
break;
default:
// os::Printer::log("CImage::Format not supported", ELL_ERROR);
return;
}
//memset32( Data, c, getImageDataSizeInBytes() );
}
//! copies this surface into another, scaling it to the target image size //! copies this surface into another, scaling it to the target image size
// note: this is very very slow. (i didn't want to write a fast version. // note: this is very very slow. (i didn't want to write a fast version.
// but hopefully, nobody wants to scale surfaces every frame. // but hopefully, nobody wants to scale surfaces every frame.

View File

@ -64,6 +64,14 @@ public:
//! copies this surface into another //! copies this surface into another
void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0); void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0);
//! copies this surface into another, using the alpha mask, an cliprect and a color to add with
virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect, const SColor &color,
const core::rect<s32>* clipRect = 0);
//! fills the surface with black or white
virtual void fill(const SColor &color);
//! copies this surface into another, scaling it to fit. //! copies this surface into another, scaling it to fit.
void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format, u32 pitch=0); void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format, u32 pitch=0);

View File

@ -70,7 +70,7 @@ IMesh* CSkinnedMesh::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32
//! Animates this mesh's joints based on frame input //! Animates this mesh's joints based on frame input
//! blend: {0-old position, 1-New position} //! blend: {0-old position, 1-New position}
void CSkinnedMesh::animateMesh(f32 frame, f32 blend) void CSkinnedMesh::animateMesh(f32 frame, f32 blend)
{ {
// std::cout<<"Frame "<<frame<<' '<<blend<<'\n'; // std::cout<<"Frame "<<frame<<' '<<blend<<'\n';
if ( !HasAnimation || LastAnimatedFrame==frame) if ( !HasAnimation || LastAnimatedFrame==frame)
return; return;
@ -596,6 +596,22 @@ void CSkinnedMesh::setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
LocalBuffers[i]->Material.setFlag(flag,newvalue); LocalBuffers[i]->Material.setFlag(flag,newvalue);
} }
//! set the hardware mapping hint, for driver
void CSkinnedMesh::setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint,
E_BUFFER_TYPE buffer)
{
for (u32 i=0; i<LocalBuffers.size(); ++i)
LocalBuffers[i]->setHardwareMappingHint(newMappingHint, buffer);
}
//! flags the meshbuffer as changed, reloads hardware buffers
void CSkinnedMesh::setDirty(E_BUFFER_TYPE buffer)
{
for (u32 i=0; i<LocalBuffers.size(); ++i)
LocalBuffers[i]->setDirty(buffer);
}
//! uses animation from another mesh //! uses animation from another mesh
bool CSkinnedMesh::useAnimationFrom(const ISkinnedMesh *mesh) bool CSkinnedMesh::useAnimationFrom(const ISkinnedMesh *mesh)
@ -837,7 +853,6 @@ void CSkinnedMesh::checkForAnimation()
//! called by loader after populating with mesh and bone data //! called by loader after populating with mesh and bone data
void CSkinnedMesh::finalize() void CSkinnedMesh::finalize()
{ {
std::cout<<"Finalize has been called\n";
u32 i; u32 i;
LastAnimatedFrame=-1; LastAnimatedFrame=-1;
@ -913,8 +928,8 @@ void CSkinnedMesh::finalize()
//Todo: optimise keys here... //Todo: optimise keys here...
checkForAnimation(); checkForAnimation();
printf("Has Animation %u\n",HasAnimation);
if (HasAnimation) if (HasAnimation)
{ {
//--- optimize and check keyframes --- //--- optimize and check keyframes ---
for(i=0;i<AllJoints.size();++i) for(i=0;i<AllJoints.size();++i)

View File

@ -61,6 +61,13 @@ namespace scene
//! sets a flag of all contained materials to a new value //! sets a flag of all contained materials to a new value
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue); virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue);
//! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX);
//! flags the meshbuffer as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX);
//! Returns the type of the animated mesh. //! Returns the type of the animated mesh.
virtual E_ANIMATED_MESH_TYPE getMeshType() const; virtual E_ANIMATED_MESH_TYPE getMeshType() const;

View File

@ -418,7 +418,14 @@ void SceneWorld::OnUpdate(s32 timediff)
str += " ## HEAD: "; str += " ## HEAD: ";
str += IRR_TO_O(camera->getHeading()); str += IRR_TO_O(camera->getHeading());
str += L" Pos: "; str += L" Pos: ";
str += ((((((str + wp.x) + L" | ") + wp.y) + L" | ") + wp.z) + L" | OR:") + wp.o; str += wp.x;
str += L" | ";
str += wp.y;
str += L" | ";
str += wp.z;
str += L" | OR:";
str += wp.o;
// str += ((((((str + wp.x) + L" | ") + wp.y) + L" | ") + wp.z) + L" | OR:") + wp.o;// WTF?
str += L" -- Terrain: Sectors: "; str += L" -- Terrain: Sectors: ";
str += (int)terrain->getSectorsRendered(); str += (int)terrain->getSectorsRendered();
str += L" / "; str += L" / ";

View File

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
SUBDIRS = DefScript Realm World GUI SUBDIRS = DefScript Realm World GUI
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -I$(top_builddir)/src/dep/include -Wall
## Build pseuwow ## Build pseuwow
bin_PROGRAMS = pseuwow bin_PROGRAMS = pseuwow
pseuwow_SOURCES = Cli.cpp\ pseuwow_SOURCES = Cli.cpp\
@ -18,5 +18,15 @@ pseuwow_SOURCES = Cli.cpp\
World/MapMgr.cpp World/MapMgr.cpp
pseuwow_LDADD = ../shared/libshared.a ../shared/Auth/libauth.a ../shared/Network/libnetwork.a DefScript/libdefscript.a World/libworld.a GUI/libgui.a /usr/local/lib/libIrrKlang.so pseuwow_LDADD = ../shared/libshared.a\
../shared/Auth/libauth.a\
../shared/Network/libnetwork.a\
DefScript/libdefscript.a\
World/libworld.a \
GUI/libgui.a\
$(prefix)/libIrrKlang.so\
../dep/lib/linux-gcc/libIrrlicht.a\
../dep/src/zlib/libzlib.a\
../dep/src/zthread/libZThread.a
pseuwow_LDFLAGS =-pthread pseuwow_LDFLAGS =-pthread

View File

@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -I$(top_builddir)/src/dep/include -Wall
## Build pseuwow ## Build pseuwow
noinst_LIBRARIES = librealm.a noinst_LIBRARIES = librealm.a
librealm_a_SOURCES =RealmSession.cpp RealmSession.h RealmSocket.cpp RealmSocket.h librealm_a_SOURCES =RealmSession.cpp RealmSession.h RealmSocket.cpp RealmSocket.h

View File

@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -I$(top_builddir)/src/dep/include -Wall
## Build pseuwow ## Build pseuwow
noinst_LIBRARIES = libworld.a noinst_LIBRARIES = libworld.a
libworld_a_SOURCES =Bag.cpp DynamicObject.cpp MovementMgr.cpp Player.cpp World.cpp\ libworld_a_SOURCES =Bag.cpp DynamicObject.cpp MovementMgr.cpp Player.cpp World.cpp\

View File

@ -1,4 +1,4 @@
## Makefile.am - process this file with automake ## Makefile.am - process this file with automake
AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall AM_CPPFLAGS = -I$(top_builddir)/src/Client -I$(top_builddir)/src/shared -I$(top_builddir)/src/Client/DefScript -I$(top_builddir)/src/Client/World -I$(top_builddir)/src/Client/Realm -Wall
SUBDIRS = shared Client tools SUBDIRS = dep shared Client tools
## End Makefile.am ## End Makefile.am

View File

@ -8,7 +8,7 @@
<Build> <Build>
<Target title="Debug"> <Target title="Debug">
<Option platforms="Unix;" /> <Option platforms="Unix;" />
<Option output="bin/Debug/pseuwow" prefix_auto="1" extension_auto="1" /> <Option output="../bin/pseuwow" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" /> <Option object_output="obj/Debug/" />
<Option type="1" /> <Option type="1" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@ -48,6 +48,8 @@
<Add library="Xxf86vm" /> <Add library="Xxf86vm" />
<Add library="/usr/local/ssl/lib/libssl.a" /> <Add library="/usr/local/ssl/lib/libssl.a" />
<Add library="/usr/local/ssl/lib/libcrypto.a" /> <Add library="/usr/local/ssl/lib/libcrypto.a" />
<Add library="../bin/ikpMP3.so" />
<Add library="../bin/libIrrKlang.so" />
</Linker> </Linker>
<Unit filename="Client/Cli.cpp" /> <Unit filename="Client/Cli.cpp" />
<Unit filename="Client/Cli.h" /> <Unit filename="Client/Cli.h" />
@ -70,29 +72,55 @@
<Unit filename="Client/DefScriptInterface.cpp" /> <Unit filename="Client/DefScriptInterface.cpp" />
<Unit filename="Client/DefScriptInterface.h" /> <Unit filename="Client/DefScriptInterface.h" />
<Unit filename="Client/DefScriptInterfaceInclude.h" /> <Unit filename="Client/DefScriptInterfaceInclude.h" />
<Unit filename="Client/GUI/CBoneSceneNode.cpp" />
<Unit filename="Client/GUI/CBoneSceneNode.h" />
<Unit filename="Client/GUI/CCursorController.cpp" /> <Unit filename="Client/GUI/CCursorController.cpp" />
<Unit filename="Client/GUI/CCursorController.h" /> <Unit filename="Client/GUI/CCursorController.h" />
<Unit filename="Client/GUI/CImageLoaderBLP.cpp" /> <Unit filename="Client/GUI/CImageLoaderBLP.cpp" />
<Unit filename="Client/GUI/CImageLoaderBLP.h" /> <Unit filename="Client/GUI/CImageLoaderBLP.h" />
<Unit filename="Client/GUI/CIrrKlangAudioStreamLoaderMP3.cpp" />
<Unit filename="Client/GUI/CIrrKlangAudioStreamLoaderMP3.h" />
<Unit filename="Client/GUI/CIrrKlangAudioStreamMP3.cpp" />
<Unit filename="Client/GUI/CIrrKlangAudioStreamMP3.h" />
<Unit filename="Client/GUI/CM2MeshFileLoader.cpp" /> <Unit filename="Client/GUI/CM2MeshFileLoader.cpp" />
<Unit filename="Client/GUI/CM2MeshFileLoader.h" /> <Unit filename="Client/GUI/CM2MeshFileLoader.h" />
<Unit filename="Client/GUI/DrawObjMgr.cpp" /> <Unit filename="Client/GUI/DrawObjMgr.cpp" />
<Unit filename="Client/GUI/DrawObjMgr.h" /> <Unit filename="Client/GUI/DrawObjMgr.h" />
<Unit filename="Client/GUI/DrawObject.cpp" /> <Unit filename="Client/GUI/DrawObject.cpp" />
<Unit filename="Client/GUI/DrawObject.h" /> <Unit filename="Client/GUI/DrawObject.h" />
<Unit filename="Client/GUI/GUIEventReceiver.h" />
<Unit filename="Client/GUI/MCamera.h" /> <Unit filename="Client/GUI/MCamera.h" />
<Unit filename="Client/GUI/MInput.h" /> <Unit filename="Client/GUI/MInput.h" />
<Unit filename="Client/GUI/PseuGUI.cpp" /> <Unit filename="Client/GUI/PseuGUI.cpp" />
<Unit filename="Client/GUI/PseuGUI.h" /> <Unit filename="Client/GUI/PseuGUI.h" />
<Unit filename="Client/GUI/SImage.cpp" /> <Unit filename="Client/GUI/SImage.cpp" />
<Unit filename="Client/GUI/SImage.h" /> <Unit filename="Client/GUI/SImage.h" />
<Unit filename="Client/GUI/SSkinnedMesh.cpp" />
<Unit filename="Client/GUI/SSkinnedMesh.h" />
<Unit filename="Client/GUI/Scene.cpp" /> <Unit filename="Client/GUI/Scene.cpp" />
<Unit filename="Client/GUI/Scene.h" /> <Unit filename="Client/GUI/Scene.h" />
<Unit filename="Client/GUI/SceneCharselection.cpp" />
<Unit filename="Client/GUI/SceneData.h" />
<Unit filename="Client/GUI/SceneGuiStart.cpp" /> <Unit filename="Client/GUI/SceneGuiStart.cpp" />
<Unit filename="Client/GUI/SceneLogin.cpp" />
<Unit filename="Client/GUI/SceneWorld.cpp" /> <Unit filename="Client/GUI/SceneWorld.cpp" />
<Unit filename="Client/GUI/ShTlTerrainSceneNode.cpp" /> <Unit filename="Client/GUI/ShTlTerrainSceneNode.cpp" />
<Unit filename="Client/GUI/ShTlTerrainSceneNode.h" /> <Unit filename="Client/GUI/ShTlTerrainSceneNode.h" />
<Unit filename="Client/GUI/TlTMesh.h" /> <Unit filename="Client/GUI/TlTMesh.h" />
<Unit filename="Client/GUI/TlTSector.h" />
<Unit filename="Client/GUI/decoder/bits.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="Client/GUI/decoder/internal.h" />
<Unit filename="Client/GUI/decoder/mpaudec.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="Client/GUI/decoder/mpaudec.h" />
<Unit filename="Client/GUI/decoder/mpaudectab.h" />
<Unit filename="Client/GUI/decoder/mpegaudio.h" />
<Unit filename="Client/GUI/ikpMP3.cpp" />
<Unit filename="Client/GUI/irrKlangSceneNode.cpp" />
<Unit filename="Client/GUI/irrKlangSceneNode.h" />
<Unit filename="Client/HelperDefs.h" /> <Unit filename="Client/HelperDefs.h" />
<Unit filename="Client/MemoryDataHolder.cpp" /> <Unit filename="Client/MemoryDataHolder.cpp" />
<Unit filename="Client/MemoryDataHolder.h" /> <Unit filename="Client/MemoryDataHolder.h" />
@ -159,6 +187,8 @@
<Unit filename="shared/Auth/AuthCrypt.h" /> <Unit filename="shared/Auth/AuthCrypt.h" />
<Unit filename="shared/Auth/BigNumber.cpp" /> <Unit filename="shared/Auth/BigNumber.cpp" />
<Unit filename="shared/Auth/BigNumber.h" /> <Unit filename="shared/Auth/BigNumber.h" />
<Unit filename="shared/Auth/Hmac.cpp" />
<Unit filename="shared/Auth/Hmac.h" />
<Unit filename="shared/Auth/MD5Hash.h" /> <Unit filename="shared/Auth/MD5Hash.h" />
<Unit filename="shared/Auth/Sha1.cpp" /> <Unit filename="shared/Auth/Sha1.cpp" />
<Unit filename="shared/Auth/Sha1.h" /> <Unit filename="shared/Auth/Sha1.h" />
@ -202,6 +232,8 @@
<Unit filename="shared/Network/Utility.h" /> <Unit filename="shared/Network/Utility.h" />
<Unit filename="shared/Network/socket_include.cpp" /> <Unit filename="shared/Network/socket_include.cpp" />
<Unit filename="shared/Network/socket_include.h" /> <Unit filename="shared/Network/socket_include.h" />
<Unit filename="shared/ProgressBar.cpp" />
<Unit filename="shared/ProgressBar.h" />
<Unit filename="shared/SysDefs.h" /> <Unit filename="shared/SysDefs.h" />
<Unit filename="shared/WDTFile.cpp" /> <Unit filename="shared/WDTFile.cpp" />
<Unit filename="shared/WDTFile.h" /> <Unit filename="shared/WDTFile.h" />

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,68 +17,95 @@ namespace scene
class CMeshBuffer : public IMeshBuffer class CMeshBuffer : public IMeshBuffer
{ {
public: public:
//! constructor //! Default constructor for empty meshbuffer
CMeshBuffer() // everything's default constructed CMeshBuffer():ChangedID_Vertex(1),ChangedID_Index(1),MappingHint_Vertex(EHM_NEVER), MappingHint_Index(EHM_NEVER)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("SMeshBuffer"); setDebugName("SMeshBuffer");
#endif #endif
} }
//! returns the material of this meshbuffer
//! Get material of this meshbuffer
/** \return Material of this buffer */
virtual const video::SMaterial& getMaterial() const virtual const video::SMaterial& getMaterial() const
{ {
return Material; return Material;
} }
//! returns the material of this meshbuffer
//! Get material of this meshbuffer
/** \return Material of this buffer */
virtual video::SMaterial& getMaterial() virtual video::SMaterial& getMaterial()
{ {
return Material; return Material;
} }
//! returns pointer to vertices
//! Get pointer to vertices
/** \return Pointer to vertices. */
virtual const void* getVertices() const virtual const void* getVertices() const
{ {
return Vertices.const_pointer(); return Vertices.const_pointer();
} }
//! returns pointer to vertices
//! Get pointer to vertices
/** \return Pointer to vertices. */
virtual void* getVertices() virtual void* getVertices()
{ {
return Vertices.pointer(); return Vertices.pointer();
} }
//! returns amount of vertices
//! Get number of vertices
/** \return Number of vertices. */
virtual u32 getVertexCount() const virtual u32 getVertexCount() const
{ {
return Vertices.size(); return Vertices.size();
} }
//! returns pointer to Indices //! Get type of index data which is stored in this meshbuffer.
/** \return Index type of this buffer. */
virtual video::E_INDEX_TYPE getIndexType() const
{
return video::EIT_16BIT;
}
//! Get pointer to indices
/** \return Pointer to indices. */
virtual const u16* getIndices() const virtual const u16* getIndices() const
{ {
return Indices.const_pointer(); return Indices.const_pointer();
} }
//! returns pointer to Indices
//! Get pointer to indices
/** \return Pointer to indices. */
virtual u16* getIndices() virtual u16* getIndices()
{ {
return Indices.pointer(); return Indices.pointer();
} }
//! returns amount of indices
//! Get number of indices
/** \return Number of indices. */
virtual u32 getIndexCount() const virtual u32 getIndexCount() const
{ {
return Indices.size(); return Indices.size();
} }
//! returns an axis aligned bounding box
//! Get the axis aligned bounding box
/** \return Axis aligned bounding box of this buffer. */
virtual const core::aabbox3d<f32>& getBoundingBox() const virtual const core::aabbox3d<f32>& getBoundingBox() const
{ {
return BoundingBox; return BoundingBox;
} }
//! Set the axis aligned bounding box
/** \param box New axis aligned bounding box for this buffer. */
//! set user axis aligned bounding box //! set user axis aligned bounding box
virtual void setBoundingBox(const core::aabbox3df& box) virtual void setBoundingBox(const core::aabbox3df& box)
{ {
@ -86,7 +113,8 @@ namespace scene
} }
//! recalculates the bounding box. should be called if the mesh changed. //! Recalculate the bounding box.
/** should be called if the mesh changed. */
virtual void recalculateBoundingBox() virtual void recalculateBoundingBox()
{ {
if (Vertices.empty()) if (Vertices.empty())
@ -99,16 +127,61 @@ namespace scene
} }
} }
//! returns which type of vertex data is stored.
//! Get type of vertex data stored in this buffer.
/** \return Type of vertex data. */
virtual video::E_VERTEX_TYPE getVertexType() const virtual video::E_VERTEX_TYPE getVertexType() const
{ {
return T().getType(); return T().getType();
} }
//! returns position of vertex i
//! append the vertices and indices to the current buffer virtual const core::vector3df& getPosition(u32 i) const
{
return Vertices[i].Pos;
}
//! returns position of vertex i
virtual core::vector3df& getPosition(u32 i)
{
return Vertices[i].Pos;
}
//! returns normal of vertex i
virtual const core::vector3df& getNormal(u32 i) const
{
return Vertices[i].Normal;
}
//! returns normal of vertex i
virtual core::vector3df& getNormal(u32 i)
{
return Vertices[i].Normal;
}
//! returns texture coord of vertex i
virtual const core::vector2df& getTCoords(u32 i) const
{
return Vertices[i].TCoords;
}
//! returns texture coord of vertex i
virtual core::vector2df& getTCoords(u32 i)
{
return Vertices[i].TCoords;
}
//! Append the vertices and indices to the current buffer
/** Only works for compatible types, i.e. either the same type
or the main buffer is of standard type. Otherwise, behavior is
undefined.
*/
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices)
{ {
if (vertices == getVertices())
return;
const u32 vertexCount = getVertexCount(); const u32 vertexCount = getVertexCount();
u32 i; u32 i;
@ -126,9 +199,19 @@ namespace scene
} }
} }
//! append the meshbuffer to the current buffer
//! Append the meshbuffer to the current buffer
/** Only works for compatible types, i.e. either the same type
or the main buffer is of standard type. Otherwise, behavior is
undefined.
\param other Meshbuffer to be appended to this one.
*/
virtual void append(const IMeshBuffer* const other) virtual void append(const IMeshBuffer* const other)
{ {
/*
if (this==other)
return;
const u32 vertexCount = getVertexCount(); const u32 vertexCount = getVertexCount();
u32 i; u32 i;
@ -144,8 +227,56 @@ namespace scene
Indices.push_back(other->getIndices()[i]+vertexCount); Indices.push_back(other->getIndices()[i]+vertexCount);
} }
BoundingBox.addInternalBox(other->getBoundingBox()); BoundingBox.addInternalBox(other->getBoundingBox());
*/
} }
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const
{
return MappingHint_Vertex;
}
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const
{
return MappingHint_Index;
}
//! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX )
{
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
MappingHint_Vertex=NewMappingHint;
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
MappingHint_Index=NewMappingHint;
}
//! flags the mesh as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX)
{
if (Buffer==EBT_VERTEX_AND_INDEX ||Buffer==EBT_VERTEX)
++ChangedID_Vertex;
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
++ChangedID_Index;
}
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual u32 getChangedID_Vertex() const {return ChangedID_Vertex;}
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual u32 getChangedID_Index() const {return ChangedID_Index;}
u32 ChangedID_Vertex;
u32 ChangedID_Index;
//! hardware mapping hint
E_HARDWARE_MAPPING MappingHint_Vertex;
E_HARDWARE_MAPPING MappingHint_Index;
//! Material for this meshbuffer. //! Material for this meshbuffer.
video::SMaterial Material; video::SMaterial Material;
//! Vertices of this buffer //! Vertices of this buffer
@ -156,11 +287,15 @@ namespace scene
core::aabbox3d<f32> BoundingBox; core::aabbox3d<f32> BoundingBox;
}; };
//! Standard meshbuffer
typedef CMeshBuffer<video::S3DVertex> SMeshBuffer; typedef CMeshBuffer<video::S3DVertex> SMeshBuffer;
//! Meshbuffer with two texture coords per vertex, e.g. for lightmaps
typedef CMeshBuffer<video::S3DVertex2TCoords> SMeshBufferLightMap; typedef CMeshBuffer<video::S3DVertex2TCoords> SMeshBufferLightMap;
//! Meshbuffer with vertices having tangents stored, e.g. for normal mapping
typedef CMeshBuffer<video::S3DVertexTangents> SMeshBufferTangents; typedef CMeshBuffer<video::S3DVertexTangents> SMeshBufferTangents;
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
#endif #endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,13 +14,13 @@ namespace scene
enum E_DEBUG_SCENE_TYPE enum E_DEBUG_SCENE_TYPE
{ {
//! No Debug Data ( Default ) //! No Debug Data ( Default )
EDS_OFF = 0, EDS_OFF = 0,
//! Show Bounding Boxes of SceneNode //! Show Bounding Boxes of SceneNode
EDS_BBOX = 1, EDS_BBOX = 1,
//! Show Vertex Normals //! Show Vertex Normals
EDS_NORMALS = 2, EDS_NORMALS = 2,
//! Shows Skeleton/Tags //! Shows Skeleton/Tags
EDS_SKELETON = 4, EDS_SKELETON = 4,
@ -34,6 +34,9 @@ namespace scene
//! Show Bounding Boxes of all MeshBuffers //! Show Bounding Boxes of all MeshBuffers
EDS_BBOX_BUFFERS = 32, EDS_BBOX_BUFFERS = 32,
//! EDS_BBOX | EDS_BBOX_BUFFERS
EDS_BBOX_ALL = EDS_BBOX | EDS_BBOX_BUFFERS,
//! Show all debug infos //! Show all debug infos
EDS_FULL = 0xffffffff EDS_FULL = 0xffffffff
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -73,11 +73,20 @@ namespace video
//! Is HLSL supported? //! Is HLSL supported?
EVDF_HLSL, EVDF_HLSL,
//! Are non-square textures supported?
EVDF_TEXTURE_NSQUARE,
//! Are non-power-of-two textures supported? //! Are non-power-of-two textures supported?
EVDF_TEXTURE_NPOT, EVDF_TEXTURE_NPOT,
//! Are framebuffer objects supported? //! Are framebuffer objects supported?
EVDF_FRAMEBUFFER_OBJECT EVDF_FRAMEBUFFER_OBJECT,
//! Are vertex buffer objects supported?
EVDF_VERTEX_BUFFER_OBJECT,
//! Only used for counting the elements of this enum
EVDF_COUNT
}; };
} // end namespace video } // end namespace video

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -13,38 +13,43 @@ namespace video
//! An enum for all types of drivers the Irrlicht Engine supports. //! An enum for all types of drivers the Irrlicht Engine supports.
enum E_DRIVER_TYPE enum E_DRIVER_TYPE
{ {
//! Null device, useful for applications to run the engine without visualisation. //! Null driver, useful for applications to run the engine without visualisation.
//! The null device is able to load textures, but does not render and display /** The null device is able to load textures, but does not
//! any graphics. render and display any graphics. */
EDT_NULL, EDT_NULL,
//! The Irrlicht Engine Software renderer, runs on all platforms, //! The Irrlicht Engine Software renderer.
//! with every hardware. It should only be used for 2d graphics, /** Runs on all platforms, with every hardware. It should only be used for
//! but it can also perform some primitive 3d functions. These 3d drawing 2d graphics, but it can also perform some primitive 3d
//! functions are quite fast, but very inaccurate, and don't even support functions. These 3d drawing functions are quite fast, but
//! clipping in 3D mode. very inaccurate, and don't even support clipping in 3D mode. */
EDT_SOFTWARE, EDT_SOFTWARE,
//! The Burning's Software Renderer, an alternative software renderer for Irrlicht. //! The Burning's Software Renderer, an alternative software renderer
//! Basically it can be described as the Irrlicht Software renderer on steroids. It rasterizes /** Basically it can be described as the Irrlicht Software
//! 3D geometry perfectly: It is able to perform correct 3d clipping, perspective renderer on steroids. It rasterizes 3D geometry perfectly: It
//! correct texture mapping, perspective correct color mapping, and renders is able to perform correct 3d clipping, perspective correct
//! sub pixel correct, sub texel correct primitives. In addition, it does texture mapping, perspective correct color mapping, and renders
//! bilinear texel filtering and supports more materials than the EDT_SOFTWARE driver. sub pixel correct, sub texel correct primitives. In addition,
//! This renderer has been written entirely by Thomas Alten, thanks a lot for this huge it does bilinear texel filtering and supports more materials
//! contribution. than the EDT_SOFTWARE driver. This renderer has been written
entirely by Thomas Alten, thanks a lot for this huge
contribution. */
EDT_BURNINGSVIDEO, EDT_BURNINGSVIDEO,
//! Direct3D 8 device, only available on Win32 platforms. //! Direct3D8 device, only available on Win32 platforms.
//! Performs hardware accelerated rendering of 3D and 2D primitives. /** Performs hardware accelerated rendering of 3D and 2D
primitives. */
EDT_DIRECT3D8, EDT_DIRECT3D8,
//! Direct3D 9 device, only available on Win32 platforms. //! Direct3D 9 device, only available on Win32 platforms.
//! Performs hardware accelerated rendering of 3D and 2D primitives. /** Performs hardware accelerated rendering of 3D and 2D
primitives. */
EDT_DIRECT3D9, EDT_DIRECT3D9,
//! OpenGL device, available on most platforms. //! OpenGL device, available on most platforms.
//! Performs hardware accelerated rendering of 3D and 2D primitives. /** Performs hardware accelerated rendering of 3D and 2D
primitives. */
EDT_OPENGL EDT_OPENGL
}; };

View File

@ -1,10 +1,12 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_GUI_ELEMENT_TYPES_H_INCLUDED__ #ifndef __E_GUI_ELEMENT_TYPES_H_INCLUDED__
#define __E_GUI_ELEMENT_TYPES_H_INCLUDED__ #define __E_GUI_ELEMENT_TYPES_H_INCLUDED__
#include "irrTypes.h"
namespace irr namespace irr
{ {
namespace gui namespace gui
@ -59,6 +61,9 @@ enum EGUI_ELEMENT_TYPE
//! A scroll bar (IGUIScrollBar) //! A scroll bar (IGUIScrollBar)
EGUIET_SCROLL_BAR, EGUIET_SCROLL_BAR,
//! A spin box (IGUISpinBox)
EGUIET_SPIN_BOX,
//! A static text (IGUIStaticText) //! A static text (IGUIStaticText)
EGUIET_STATIC_TEXT, EGUIET_STATIC_TEXT,
@ -68,23 +73,22 @@ enum EGUI_ELEMENT_TYPE
//! A tab control //! A tab control
EGUIET_TAB_CONTROL, EGUIET_TAB_CONTROL,
//! A Table
EGUIET_TABLE,
//! A tool bar (IGUIToolBar) //! A tool bar (IGUIToolBar)
EGUIET_TOOL_BAR, EGUIET_TOOL_BAR,
//! A window //! A window
EGUIET_WINDOW, EGUIET_WINDOW,
//! A spin box (IGUISpinBox)
EGUIET_SPIN_BOX,
//! Not an element, amount of elements in there //! Not an element, amount of elements in there
EGUIET_COUNT, EGUIET_COUNT,
//! Unknown type. //! Unknown type.
EGUIET_ELEMENT, EGUIET_ELEMENT,
//! This enum is never used, it only forces the compiler to //! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit.
//! compile these enumeration values to 32 bit.
EGUIET_FORCE_32_BIT = 0x7fffffff EGUIET_FORCE_32_BIT = 0x7fffffff
}; };
@ -107,12 +111,13 @@ const c8* const GUIElementTypeNames[] =
"messageBox", "messageBox",
"modalScreen", "modalScreen",
"scrollBar", "scrollBar",
"spinBox",
"staticText", "staticText",
"tab", "tab",
"tabControl", "tabControl",
"table",
"toolBar", "toolBar",
"window", "window",
"spinBox",
0 0
}; };
@ -121,3 +126,6 @@ const c8* const GUIElementTypeNames[] =
#endif #endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -29,34 +29,40 @@ namespace video
EMF_ZBUFFER, EMF_ZBUFFER,
//! May be written to the zbuffer or is it readonly. Default: true //! May be written to the zbuffer or is it readonly. Default: true
//! This flag is ignored, if the material type is a transparent type. /** This flag is ignored, if the material type is a transparent type. */
EMF_ZWRITE_ENABLE, EMF_ZWRITE_ENABLE,
//! Is backfaceculling enabled? Default: true //! Is backface culling enabled? Default: true
EMF_BACK_FACE_CULLING, EMF_BACK_FACE_CULLING,
//! Is frontface culling enabled? Default: false
/** Overrides EMF_BACK_FACE_CULLING if both are enabled. */
EMF_FRONT_FACE_CULLING,
//! Is bilinear filtering enabled? Default: true //! Is bilinear filtering enabled? Default: true
EMF_BILINEAR_FILTER, EMF_BILINEAR_FILTER,
//! Is trilinear filtering enabled? Default: false //! Is trilinear filtering enabled? Default: false
//! If the trilinear filter flag is enabled, /** If the trilinear filter flag is enabled,
//! the bilinear filtering flag is ignored. the bilinear filtering flag is ignored. */
EMF_TRILINEAR_FILTER, EMF_TRILINEAR_FILTER,
//! Is anisotropic filtering? Default: false //! Is anisotropic filtering? Default: false
//! In Irrlicht you can use anisotropic texture filtering in /** In Irrlicht you can use anisotropic texture filtering in
//! conjunction with bilinear or trilinear texture filtering conjunction with bilinear or trilinear texture filtering
//! to improve rendering results. Primitives will look less to improve rendering results. Primitives will look less
//! blurry with this flag switched on. blurry with this flag switched on. */
EMF_ANISOTROPIC_FILTER, EMF_ANISOTROPIC_FILTER,
//! Is fog enabled? Default: false //! Is fog enabled? Default: false
EMF_FOG_ENABLE, EMF_FOG_ENABLE,
//! Normalizes normals.You can enable this if you need //! Normalizes normals. Default: false
//! to scale a dynamic lighted model. Usually, its normals will get scaled /** You can enable this if you need to scale a dynamic lighted
//! too then and it will get darker. If you enable the EMF_NORMALIZE_NORMALS flag, model. Usually, its normals will get scaled too then and it
//! the normals will be normalized again, and the model will look as bright as it should. will get darker. If you enable the EMF_NORMALIZE_NORMALS flag,
the normals will be normalized again, and the model will look
as bright as it should. */
EMF_NORMALIZE_NORMALS, EMF_NORMALIZE_NORMALS,
//! Access to all layers texture wrap settings. Overwrites separate layer settings. //! Access to all layers texture wrap settings. Overwrites separate layer settings.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -13,37 +13,39 @@ namespace video
//! Abstracted and easy to use fixed function/programmable pipeline material modes. //! Abstracted and easy to use fixed function/programmable pipeline material modes.
enum E_MATERIAL_TYPE enum E_MATERIAL_TYPE
{ {
//! Standard solid material. Only first texture is used, which is //! Standard solid material.
//! supposed to be the diffuse material. /** Only first texture is used, which is supposed to be the
diffuse material. */
EMT_SOLID = 0, EMT_SOLID = 0,
//! Solid material with 2 texture layers. The second is blended onto the //! Solid material with 2 texture layers.
//! first using the alpha value of the vertex colors. /** The second is blended onto the first using the alpha value
//! This material is currently not implemented in OpenGL, but it of the vertex colors. This material is currently not implemented in OpenGL.
//! works with DirectX. */
EMT_SOLID_2_LAYER, EMT_SOLID_2_LAYER,
//! Material type with standard lightmap technique: //! Material type with standard lightmap technique
//! There should be 2 textures: The first texture layer is a diffuse map, /** There should be 2 textures: The first texture layer is a
//! the second is a light map. Vertex light is ignored. diffuse map, the second is a light map. Dynamic light is
ignored. */
EMT_LIGHTMAP, EMT_LIGHTMAP,
//! Material type with lightmap technique like EMT_LIGHTMAP, but //! Material type with lightmap technique like EMT_LIGHTMAP.
//! lightmap and diffuse texture are not modulated, but added instead. /** But lightmap and diffuse texture are added instead of modulated. */
EMT_LIGHTMAP_ADD, EMT_LIGHTMAP_ADD,
//! Material type with standard lightmap technique: //! Material type with standard lightmap technique
//! There should be 2 textures: The first texture layer is a diffuse map, /** There should be 2 textures: The first texture layer is a
//! the second is a light map. Vertex light is ignored. diffuse map, the second is a light map. Dynamic light is
//! The texture colors are effectively multiplyied by 2 for brightening. ignored. The texture colors are effectively multiplied by 2
//! like known in DirectX as D3DTOP_MODULATE2X. for brightening. Like known in DirectX as D3DTOP_MODULATE2X. */
EMT_LIGHTMAP_M2, EMT_LIGHTMAP_M2,
//! Material type with standard lightmap technique: //! Material type with standard lightmap technique
//! There should be 2 textures: The first texture layer is a diffuse map, /** There should be 2 textures: The first texture layer is a
//! the second is a light map. Vertex light is ignored. diffuse map, the second is a light map. Dynamic light is
//! The texture colors are effectively multiplyied by 4 for brightening. ignored. The texture colors are effectively multiplyied by 4
//! like known in DirectX as D3DTOP_MODULATE4X. for brightening. Like known in DirectX as D3DTOP_MODULATE4X. */
EMT_LIGHTMAP_M4, EMT_LIGHTMAP_M4,
//! Like EMT_LIGHTMAP, but also supports dynamic lighting. //! Like EMT_LIGHTMAP, but also supports dynamic lighting.
@ -55,133 +57,142 @@ namespace video
//! Like EMT_LIGHTMAP_4, but also supports dynamic lighting. //! Like EMT_LIGHTMAP_4, but also supports dynamic lighting.
EMT_LIGHTMAP_LIGHTING_M4, EMT_LIGHTMAP_LIGHTING_M4,
//! Detail mapped material. The first texture is diffuse color map, the //! Detail mapped material.
//! second is added to this and usually displayed with a bigger scale value /** The first texture is diffuse color map, the second is added
//! so that it adds more detail. The detail map is added to the diffuse map using to this and usually displayed with a bigger scale value so that
//! ADD_SIGNED, so that it is possible to add and substract color from the diffuse it adds more detail. The detail map is added to the diffuse map
//! map. For example a value of (127,127,127) will not change the appearance of using ADD_SIGNED, so that it is possible to add and substract
//! the diffuse map at all. color from the diffuse map. For example a value of
//! Often used for terrain rendering. (127,127,127) will not change the appearance of the diffuse map
at all. Often used for terrain rendering. */
EMT_DETAIL_MAP, EMT_DETAIL_MAP,
//! Makes the material look like it was reflection the environment //! Look like a reflection of the environment around it.
//! around it. To make this possible, a texture called 'sphere map' /** To make this possible, a texture called 'sphere map' is
//! is used, which must be set as Textures[0]. used, which must be set as the first texture. */
EMT_SPHERE_MAP, EMT_SPHERE_MAP,
//! A reflecting material with an //! A reflecting material with an optional non reflecting texture layer.
//! optional additional non reflecting texture layer. The reflection /** The reflection map should be set as first texture. */
//! map should be set as Texture 1.
EMT_REFLECTION_2_LAYER, EMT_REFLECTION_2_LAYER,
//! A transparent material. Only the first texture is used. //! A transparent material.
//! The new color is calculated by simply adding the source color and /** Only the first texture is used. The new color is calculated
//! the dest color. This means if for example a billboard using a texture with by simply adding the source color and the dest color. This
//! black background and a red circle on it is drawn with this material, the means if for example a billboard using a texture with black
//! result is that only the red circle will be drawn a little bit transparent, background and a red circle on it is drawn with this material,
//! and everything which was black is 100% transparent and not visible. the result is that only the red circle will be drawn a little
//! This material type is useful for e.g. particle effects. bit transparent, and everything which was black is 100%
transparent and not visible. This material type is useful for
particle effects. */
EMT_TRANSPARENT_ADD_COLOR, EMT_TRANSPARENT_ADD_COLOR,
//! Makes the material transparent based on the texture alpha channel. //! Makes the material transparent based on the texture alpha channel.
//! The final color is blended together from the destination color and the /** The final color is blended together from the destination
//! texture color, using the alpha channel value as blend factor. color and the texture color, using the alpha channel value as
//! Only first texture is used. If you are using this material with small blend factor. Only first texture is used. If you are using
//! textures, it is a good idea to load the texture in 32 bit this material with small textures, it is a good idea to load
//! mode (video::IVideoDriver::setTextureCreationFlag()). the texture in 32 bit mode
//! Also, an alpha ref is used, which can be manipulated using SMaterial::MaterialTypeParam. (video::IVideoDriver::setTextureCreationFlag()). Also, an alpha
//! If set to 0, the alpha ref gets its default value which is 0.5f and which means ref is used, which can be manipulated using
//! that pixels with an alpha value >127 will be written, others not. In other, simple SMaterial::MaterialTypeParam. This value controls how sharp the
//! words: this value controls how sharp the edges become when going from a edges become when going from a transparent to a solid spot on
//! transparent to a solid spot on the texture. the texture. */
EMT_TRANSPARENT_ALPHA_CHANNEL, EMT_TRANSPARENT_ALPHA_CHANNEL,
//! Makes the material transparent based on the texture alpha channel. //! Makes the material transparent based on the texture alpha channel.
//! If the alpha channel value is greater than 127, a pixel is written to the /** If the alpha channel value is greater than 127, a
//! target, otherwise not. This material does not use alpha blending pixel is written to the target, otherwise not. This
//! and is a lot faster than EMT_TRANSPARENT_ALPHA_CHANNEL. It material does not use alpha blending and is a lot faster
//! is ideal for drawing stuff like leafes of plants, because the borders than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing
//! are not blurry but sharp. stuff like leafes of plants, because the borders are not
//! Only first texture is used. If you are using this material with small blurry but sharp. Only first texture is used. If you are
//! textures and 3d object, it is a good idea to load the texture in 32 bit using this material with small textures and 3d object, it
//! mode (video::IVideoDriver::setTextureCreationFlag()). is a good idea to load the texture in 32 bit mode
(video::IVideoDriver::setTextureCreationFlag()). */
EMT_TRANSPARENT_ALPHA_CHANNEL_REF, EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
//! Makes the material transparent based on the vertex alpha value. //! Makes the material transparent based on the vertex alpha value.
EMT_TRANSPARENT_VERTEX_ALPHA, EMT_TRANSPARENT_VERTEX_ALPHA,
//! A transparent reflecting material with an //! A transparent reflecting material with an optional additional non reflecting texture layer.
//! optional additional non reflecting texture layer. The reflection /** The reflection map should be set as first texture. The
//! map should be set as Texture 1. The transparency depends on the transparency depends on the alpha value in the vertex colors. A
//! alpha value in the vertex colors. A texture which will not reflect texture which will not reflect can be set as second texture.
//! can be set als Texture 2. Please note that this material type is currently not 100%
//! Please note that this material type is currently not 100% implemented implemented in OpenGL. */
//! in OpenGL. It works in Direct3D.
EMT_TRANSPARENT_REFLECTION_2_LAYER, EMT_TRANSPARENT_REFLECTION_2_LAYER,
//! A solid normal map renderer. First texture is the color map, the //! A solid normal map renderer.
//! second should be the normal map. Note that you should use this material /** First texture is the color map, the second should be the
//! only when drawing geometry consisting of vertices of type S3DVertexTangents normal map. Note that you should use this material only when
//! (EVT_TANGENTS). You can convert any mesh into this format using drawing geometry consisting of vertices of type
//! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
//! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and this format using IMeshManipulator::createMeshWithTangents()
//! falls back on a fixed function lighted material if this hardware is not available. (See SpecialFX2 Tutorial). This shader runs on vertex shader
//! Only two lights are supported by this shader, if there are more, the nearest two 1.1 and pixel shader 1.1 capable hardware and falls back to a
//! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. fixed function lighted material if this hardware is not
available. Only two lights are supported by this shader, if
there are more, the nearest two are chosen. */
EMT_NORMAL_MAP_SOLID, EMT_NORMAL_MAP_SOLID,
//! A transparent normal map renderer. First texture is the color map, the //! A transparent normal map renderer.
//! second should be the normal map. Note that you should use this material /** First texture is the color map, the second should be the
//! only when drawing geometry consisting of vertices of type S3DVertexTangents normal map. Note that you should use this material only when
//! (EVT_TANGENTS). You can convert any mesh into this format using drawing geometry consisting of vertices of type
//! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
//! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and this format using IMeshManipulator::createMeshWithTangents()
//! falls back on a fixed function lighted material if this hardware is not available. (See SpecialFX2 Tutorial). This shader runs on vertex shader
//! Only two lights are supported by this shader, if there are more, the nearest two 1.1 and pixel shader 1.1 capable hardware and falls back to a
//! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. fixed function lighted material if this hardware is not
available. Only two lights are supported by this shader, if
there are more, the nearest two are chosen. */
EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR,
//! A transparent (based on the vertex alpha value) normal map renderer. //! A transparent (based on the vertex alpha value) normal map renderer.
//! First texture is the color map, the /** First texture is the color map, the second should be the
//! second should be the normal map. Note that you should use this material normal map. Note that you should use this material only when
//! only when drawing geometry consisting of vertices of type S3DVertexTangents drawing geometry consisting of vertices of type
//! (EVT_TANGENTS). You can convert any mesh into this format using S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
//! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). this format using IMeshManipulator::createMeshWithTangents()
//! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and (See SpecialFX2 Tutorial). This shader runs on vertex shader
//! falls back on a fixed function lighted material if this hardware is not available. 1.1 and pixel shader 1.1 capable hardware and falls back to a
//! Only two lights are supported by this shader, if there are more, the nearest two fixed function lighted material if this hardware is not
//! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. available. Only two lights are supported by this shader, if
there are more, the nearest two are chosen. */
EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA,
//! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping too, which //! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping.
//! looks a lot more realistic. This only works when the hardware supports at /** Looks a lot more realistic. This only works when the
//! least vertex shader 1.1 and pixel shader 1.4. hardware supports at least vertex shader 1.1 and pixel shader
//! First texture is the color map, the second should be the normal map. 1.4. First texture is the color map, the second should be the
//! The normal map texture should contain the height value in the normal map. The normal map texture should contain the height
//! alpha component. The IVideoDriver::makeNormalMapTexture() method writes value in the alpha component. The
//! this value automaticly when creating normal maps from a heightmap when using a 32 bit IVideoDriver::makeNormalMapTexture() method writes this value
//! texture. automatically when creating normal maps from a heightmap when
//! The height scale of the material (affecting the bumpiness) is being controlled using a 32 bit texture. The height scale of the material
//! by the SMaterial::MaterialTypeParam member. (affecting the bumpiness) is being controlled by the
//! If set to zero, the default value (0.02f) will be applied. Otherwise SMaterial::MaterialTypeParam member. If set to zero, the
//! the value set in SMaterial::MaterialTypeParam is taken. This value depends on with which default value (0.02f) will be applied. Otherwise the value set
//! scale the texture is mapped on the material. Too high or low values of MaterialTypeParam in SMaterial::MaterialTypeParam is taken. This value depends on
//! can result in strange artifacts. with which scale the texture is mapped on the material. Too
high or low values of MaterialTypeParam can result in strange
artifacts. */
EMT_PARALLAX_MAP_SOLID, EMT_PARALLAX_MAP_SOLID,
//! A material just like EMT_PARALLAX_MAP_SOLID, but it is transparent, using //! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
//! EMT_TRANSPARENT_ADD_COLOR as base material. /** Using EMT_TRANSPARENT_ADD_COLOR as base material. */
EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR,
//! A material just like EMT_PARALLAX_MAP_SOLID, but it is transparent, using //! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
//! EMT_TRANSPARENT_VERTEX_ALPHA as base material. /** Using EMT_TRANSPARENT_VERTEX_ALPHA as base material. */
EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA,
//! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC ) //! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
//! Using only Textures[0]. generic Blender /** Using only first texture. Generic blending method. */
EMT_ONETEXTURE_BLEND, EMT_ONETEXTURE_BLEND,
//! This value is not used. It only forces this enumeration to compile in 32 bit. //! This value is not used. It only forces this enumeration to compile to 32 bit.
EMT_FORCE_32BIT = 0x7fffffff EMT_FORCE_32BIT = 0x7fffffff
}; };

View File

@ -1,10 +1,12 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_MESH_WRITER_ENUMS_H_INCLUDED__ #ifndef __E_MESH_WRITER_ENUMS_H_INCLUDED__
#define __E_MESH_WRITER_ENUMS_H_INCLUDED__ #define __E_MESH_WRITER_ENUMS_H_INCLUDED__
#include "irrTypes.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
@ -23,7 +25,10 @@ namespace scene
EMWT_COLLADA = MAKE_IRR_ID('c','o','l','l'), EMWT_COLLADA = MAKE_IRR_ID('c','o','l','l'),
//! STL mesh writer for .stl files //! STL mesh writer for .stl files
EMWT_STL = MAKE_IRR_ID('s','t','l',0) EMWT_STL = MAKE_IRR_ID('s','t','l',0),
//! OBJ mesh writer for .obj files
EMWT_OBJ = MAKE_IRR_ID('o','b','j',0)
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -26,10 +26,11 @@ enum EMESSAGE_BOX_FLAG
EMBF_NO = 0x8, EMBF_NO = 0x8,
//! This value is not used. It only forces this enumeration to compile in 32 bit. //! This value is not used. It only forces this enumeration to compile in 32 bit.
EMBF_FORCE_32BIT = 0x7fffffff EMBF_FORCE_32BIT = 0x7fffffff
}; };
} // namespace gui } // namespace gui
} // namespace irr } // namespace irr
#endif #endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -34,14 +34,19 @@ namespace scene
//! Collision respose scene node animator //! Collision respose scene node animator
ESNAT_COLLISION_RESPONSE, ESNAT_COLLISION_RESPONSE,
//! FPS camera animator
ESNAT_CAMERA_FPS,
//! Maya camera animator
ESNAT_CAMERA_MAYA,
//! Amount of built-in scene node animators //! Amount of built-in scene node animators
ESNAT_COUNT, ESNAT_COUNT,
//! Unknown scene node animator //! Unknown scene node animator
ESNAT_UNKNOWN, ESNAT_UNKNOWN,
//! This enum is never used, it only forces the compiler to //! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit.
//! compile these enumeration values to 32 bit.
ESNAT_FORCE_32_BIT = 0x7fffffff ESNAT_FORCE_32_BIT = 0x7fffffff
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -57,12 +57,6 @@ namespace scene
//! Camera Scene Node //! Camera Scene Node
ESNT_CAMERA = MAKE_IRR_ID('c','a','m','_'), ESNT_CAMERA = MAKE_IRR_ID('c','a','m','_'),
//! Maya Camera Scene Node
ESNT_CAMERA_MAYA = MAKE_IRR_ID('c','a','m','M'),
//! First Person Shooter style Camera
ESNT_CAMERA_FPS = MAKE_IRR_ID('c','a','m','F'),
//! Billboard Scene Node //! Billboard Scene Node
ESNT_BILLBOARD = MAKE_IRR_ID('b','i','l','l'), ESNT_BILLBOARD = MAKE_IRR_ID('b','i','l','l'),
@ -73,10 +67,21 @@ namespace scene
ESNT_PARTICLE_SYSTEM = MAKE_IRR_ID('p','t','c','l'), ESNT_PARTICLE_SYSTEM = MAKE_IRR_ID('p','t','c','l'),
//! Quake3 Model Scene Node ( has tag to link to ) //! Quake3 Model Scene Node ( has tag to link to )
ESNT_MD3_SCENE_NODE = MAKE_IRR_ID('m','d','3','_'), ESNT_MD3_SCENE_NODE = MAKE_IRR_ID('m','d','3','_'),
//! Maya Camera Scene Node
/** Legacy, for loading version <= 1.4.x .irr files */
ESNT_CAMERA_MAYA = MAKE_IRR_ID('c','a','m','M'),
//! First Person Shooter Camera
/** Legacy, for loading version <= 1.4.x .irr files */
ESNT_CAMERA_FPS = MAKE_IRR_ID('c','a','m','F'),
//! Unknown scene node //! Unknown scene node
ESNT_UNKNOWN = MAKE_IRR_ID('u','n','k','n') ESNT_UNKNOWN = MAKE_IRR_ID('u','n','k','n'),
//! Will match with any scene node when checking types
ESNT_ANY = MAKE_IRR_ID('a','n','y','_')
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -12,7 +12,7 @@ namespace irr
{ {
namespace scene namespace scene
{ {
//! Possible types of (animated) meshes.
enum E_ANIMATED_MESH_TYPE enum E_ANIMATED_MESH_TYPE
{ {
//! Unknown animated mesh type. //! Unknown animated mesh type.
@ -36,16 +36,15 @@ namespace scene
//! My3D Mesh, the file format by Zhuck Dimitry //! My3D Mesh, the file format by Zhuck Dimitry
EAMT_MY3D, EAMT_MY3D,
//! Pulsar LMTools .lmts file. This Irrlicht loader was //! Pulsar LMTools .lmts file. This Irrlicht loader was written by Jonas Petersen
//! written by Jonas Petersen
EAMT_LMTS, EAMT_LMTS,
//! Cartography Shop .csm file. This loader was created by Saurav Mohapatra. //! Cartography Shop .csm file. This loader was created by Saurav Mohapatra.
EAMT_CSM, EAMT_CSM,
//! .oct file for Paul Nette's FSRad or from Murphy McCauley's //! .oct file for Paul Nette's FSRad or from Murphy McCauley's Blender .oct exporter.
//! Blender .oct exporter. The oct file format contains 3D /** The oct file format contains 3D geometry and lightmaps and
//! geometry and lightmaps and can be loaded directly by Irrlicht can be loaded directly by Irrlicht */
EAMT_OCT, EAMT_OCT,
//! generic skinned mesh //! generic skinned mesh
@ -61,9 +60,6 @@ namespace scene
{ {
public: public:
//! destructor
virtual ~IAnimatedMesh() { }
//! Gets the frame count of the animated mesh. //! Gets the frame count of the animated mesh.
/** \return Returns the amount of frames. If the amount is 1, /** \return Returns the amount of frames. If the amount is 1,
it is a static, non animated mesh. */ it is a static, non animated mesh. */
@ -81,7 +77,7 @@ namespace scene
outside of this loop. outside of this loop.
If startFrameLoop and endFrameLoop are both -1, they are ignored. If startFrameLoop and endFrameLoop are both -1, they are ignored.
\param endFrameLoop: see startFrameLoop. \param endFrameLoop: see startFrameLoop.
\return Returns the animated mesh based on a detail level. */ \return Returns the animated mesh based on a detail level. */
virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1) = 0; virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1) = 0;
//! Returns the type of the animated mesh. //! Returns the type of the animated mesh.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -46,29 +46,29 @@ namespace scene
{ {
public: public:
// Get frame loop data for a default MD2 animation type. //! Get frame loop data for a default MD2 animation type.
//! \param l: The EMD2_ANIMATION_TYPE to get the frames for. /** \param l The EMD2_ANIMATION_TYPE to get the frames for.
//! \param outBegin: The returned beginning frame for animation type specified. \param outBegin The returned beginning frame for animation type specified.
//! \param outEnd: The returned ending frame for the animation type specified. \param outEnd The returned ending frame for the animation type specified.
//! \param outFPS: The number of frames per second, this animation should be played at. \param outFPS The number of frames per second, this animation should be played at.
//! \return Returns the beginframe, endframe and frames per second for a default MD2 animation type. \return beginframe, endframe and frames per second for a default MD2 animation type. */
virtual void getFrameLoop(EMD2_ANIMATION_TYPE l, s32& outBegin, virtual void getFrameLoop(EMD2_ANIMATION_TYPE l, s32& outBegin,
s32& outEnd, s32& outFPS) const = 0; s32& outEnd, s32& outFPS) const = 0;
// Get frame loop data for a special MD2 animation type, identified by name. //! Get frame loop data for a special MD2 animation type, identified by name.
//! \param name: Name of the animation. /** \param name Name of the animation.
//! \param outBegin: The returned beginning frame for animation type specified. \param outBegin The returned beginning frame for animation type specified.
//! \param outEnd: The returned ending frame for the animation type specified. \param outEnd The returned ending frame for the animation type specified.
//! \param outFPS: The number of frames per second, this animation should be played at. \param outFPS The number of frames per second, this animation should be played at.
//! \return Returns the beginframe, endframe and frames per second for a special MD2 animation type. \return beginframe, endframe and frames per second for a special MD2 animation type. */
virtual bool getFrameLoop(const c8* name, virtual bool getFrameLoop(const c8* name,
s32& outBegin, s32& outEnd, s32& outFPS) const = 0; s32& outBegin, s32& outEnd, s32& outFPS) const = 0;
//! Returns amount of md2 animations in this file. //! Get amount of md2 animations in this file.
virtual s32 getAnimationCount() const = 0; virtual s32 getAnimationCount() const = 0;
//! Returns name of md2 animation. //! Get name of md2 animation.
//! \param nr: Zero based index of animation. /** \param nr: Zero based index of animation. */
virtual const c8* getAnimationName(s32 nr) const = 0; virtual const c8* getAnimationName(s32 nr) const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt / Thomas Alten // Copyright (C) 2007-2009 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -23,8 +23,7 @@ namespace scene
EMD3_NUMMODELS EMD3_NUMMODELS
}; };
//! Animation list
// Animation list
enum EMD3_ANIMATION_TYPE enum EMD3_ANIMATION_TYPE
{ {
// Animations for both lower and upper parts of the player // Animations for both lower and upper parts of the player
@ -64,15 +63,19 @@ namespace scene
struct SMD3AnimationInfo struct SMD3AnimationInfo
{ {
s32 first; // First frame //! First frame
s32 num; // Last frame s32 first;
s32 looping; // Looping frames //! Last frame
s32 fps; // Frames per second s32 num;
//! Looping frames
s32 looping;
//! Frames per second
s32 fps;
}; };
// byte-align structures // byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing ) # pragma pack( push, packing )
# pragma pack( 1 ) # pragma pack( 1 )
# define PACK_STRUCT # define PACK_STRUCT
@ -82,36 +85,37 @@ namespace scene
# error compiler not supported # error compiler not supported
#endif #endif
// this holds the header info of the MD3 file //! this holds the header info of the MD3 file
struct SMD3Header struct SMD3Header
{ {
c8 headerID[4]; //id of file, always "IDP3" c8 headerID[4]; //id of file, always "IDP3"
s32 Version; //this is a version number, always 15 s32 Version; //this is a version number, always 15
s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars
s32 numFrames; //number of KeyFrames s32 numFrames; //number of KeyFrames
s32 numTags; //number of 'tags' per frame s32 numTags; //number of 'tags' per frame
s32 numMeshes; //number of meshes/skins s32 numMeshes; //number of meshes/skins
s32 numMaxSkins; //maximum number of unique skins used in md3 file s32 numMaxSkins; //maximum number of unique skins used in md3 file
s32 headerSize; //always equal to the length of this header s32 headerSize; //always equal to the length of this header
s32 tagStart; //starting position of tag-structures s32 tagStart; //starting position of tag-structures
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
s32 fileSize; s32 fileSize;
}; };
//! this holds the header info of an MD3 mesh section
struct SMD3MeshHeader struct SMD3MeshHeader
{ {
c8 meshID[4]; //id, must be IDP3 c8 meshID[4]; //id, must be IDP3
c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars
s32 numFrames; //number of meshframes in mesh s32 numFrames; //number of meshframes in mesh
s32 numShader; //number of skins in mesh s32 numShader; //number of skins in mesh
s32 numVertices; //number of vertices s32 numVertices; //number of vertices
s32 numTriangles; //number of Triangles s32 numTriangles; //number of Triangles
s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header
s32 offset_shaders; //size of header s32 offset_shaders; //size of header
s32 offset_st; //starting position of texvector data, relative to start of Mesh_Header s32 offset_st; //starting position of texvector data, relative to start of Mesh_Header
s32 vertexStart; //starting position of vertex data,relative to start of Mesh_Header s32 vertexStart; //starting position of vertex data,relative to start of Mesh_Header
s32 offset_end; s32 offset_end;
}; };
@ -123,7 +127,7 @@ namespace scene
u8 normal[2]; u8 normal[2];
}; };
//! Texure Coordinate //! Texture Coordinate
struct SMD3TexCoord struct SMD3TexCoord
{ {
f32 u; f32 u;
@ -138,7 +142,7 @@ namespace scene
// Default alignment // Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing ) # pragma pack( pop, packing )
#endif #endif
@ -156,7 +160,7 @@ namespace scene
}; };
//! hold a tag info for connecting meshes //! hold a tag info for connecting meshes
//! basically its an alternate way to describe a transformation /** Basically its an alternate way to describe a transformation. */
struct SMD3QuaterionTag struct SMD3QuaterionTag
{ {
SMD3QuaterionTag() {} SMD3QuaterionTag() {}
@ -165,12 +169,12 @@ namespace scene
: Name ( name ) {} : Name ( name ) {}
// construct from a matrix // construct from a matrix
SMD3QuaterionTag ( const core::stringc& name, const core::matrix4 &m ) SMD3QuaterionTag ( const core::stringc& name, const core::matrix4 &m ) : Name(name), position(m.getTranslation()), rotation(m)
{ { }
Name = name;
position = m.getTranslation (); // construct from a position and euler angles in degrees
rotation = m; SMD3QuaterionTag ( const core::vector3df &pos, const core::vector3df &angle ) : position(pos), rotation(angle * core::DEGTORAD)
} { }
// set to matrix // set to matrix
void setto ( core::matrix4 &m ) void setto ( core::matrix4 &m )
@ -179,13 +183,6 @@ namespace scene
m.setTranslation ( position ); m.setTranslation ( position );
} }
// construct from a position and euler angles in degrees
SMD3QuaterionTag ( const core::vector3df &pos, const core::vector3df &angle )
{
position = pos;
rotation.set ( angle * core::DEGTORAD );
}
bool operator == ( const SMD3QuaterionTag &other ) const bool operator == ( const SMD3QuaterionTag &other ) const
{ {
return Name == other.Name; return Name == other.Name;
@ -196,7 +193,7 @@ namespace scene
core::quaternion rotation; core::quaternion rotation;
}; };
// holds a assoziative list of named quaternions //! holds a associative list of named quaternions
struct SMD3QuaterionTagList : public virtual IReferenceCounted struct SMD3QuaterionTagList : public virtual IReferenceCounted
{ {
SMD3QuaterionTag* get ( const core::stringc& name ) SMD3QuaterionTag* get ( const core::stringc& name )
@ -213,11 +210,22 @@ namespace scene
return Container.size(); return Container.size();
} }
SMD3QuaterionTag& operator[] (u32 index ) const SMD3QuaterionTag& operator[](u32 index) const
{ {
return Container[index]; return Container[index];
} }
SMD3QuaterionTag& operator[](u32 index)
{
return Container[index];
}
SMD3QuaterionTagList & operator = (const SMD3QuaterionTagList & copyMe)
{
Container = copyMe.Container;
return *this;
}
core::array < SMD3QuaterionTag > Container; core::array < SMD3QuaterionTag > Container;
}; };
@ -229,7 +237,7 @@ namespace scene
{ {
for (u32 i=0; i<Buffer.size(); ++i) for (u32 i=0; i<Buffer.size(); ++i)
Buffer[i]->drop(); Buffer[i]->drop();
}; }
SMD3Header MD3Header; SMD3Header MD3Header;
core::stringc Name; core::stringc Name;
@ -243,11 +251,13 @@ namespace scene
{ {
public: public:
//! tune how many frames you want to render inbetween //! tune how many frames you want to render inbetween.
virtual void setInterpolationShift ( u32 shift, u32 loopMode ) = 0; virtual void setInterpolationShift ( u32 shift, u32 loopMode ) = 0;
//! get the tag list of the mesh.
virtual SMD3QuaterionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) = 0; virtual SMD3QuaterionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) = 0;
//! get the original md3 mesh.
virtual SMD3Mesh * getOriginalMesh () = 0; virtual SMD3Mesh * getOriginalMesh () = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -9,23 +9,22 @@
#include "IBoneSceneNode.h" #include "IBoneSceneNode.h"
#include "IAnimatedMeshMD2.h" #include "IAnimatedMeshMD2.h"
#include "IAnimatedMeshMD3.h" #include "IAnimatedMeshMD3.h"
#include "IShadowVolumeSceneNode.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
class IShadowVolumeSceneNode;
enum E_JOINT_UPDATE_ON_RENDER enum E_JOINT_UPDATE_ON_RENDER
{ {
// do nothing //! do nothing
EJUOR_NONE = 0, EJUOR_NONE = 0,
// get joints positions from the mesh (for attached nodes, etc) //! get joints positions from the mesh (for attached nodes, etc)
EJUOR_READ, EJUOR_READ,
// control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() ) //! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() )
EJUOR_CONTROL, EJUOR_CONTROL,
//! count of all available interpolation modes //! count of all available interpolation modes
@ -33,28 +32,27 @@ namespace scene
}; };
class IAnimatedMeshSceneNode; class IAnimatedMeshSceneNode;
//! Callback interface for catching events of ended animations. //! Callback interface for catching events of ended animations.
/** Implement this interface and use /** Implement this interface and use
IAnimatedMeshSceneNode::setAnimationEndCallback to be able to IAnimatedMeshSceneNode::setAnimationEndCallback to be able to
be notified if an animation playback has ended. be notified if an animation playback has ended.
**/ **/
class IAnimationEndCallBack : public virtual IReferenceCounted class IAnimationEndCallBack : public virtual IReferenceCounted
{ {
public: public:
//! Will be called when the animation playback has ended. //! Will be called when the animation playback has ended.
//! See IAnimatedMeshSceneNode::setAnimationEndCallback for /** See IAnimatedMeshSceneNode::setAnimationEndCallback for
//! more informations. more informations.
//! \param node: Node of which the animation has ended. \param node: Node of which the animation has ended. */
virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node) = 0; virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node) = 0;
}; };
//! Scene node capable of displaying an animated mesh and its shadow. //! Scene node capable of displaying an animated mesh and its shadow.
/** The shadow is optional: If a shadow should be displayed too, just invoke /** The shadow is optional: If a shadow should be displayed too, just
the IAnimatedMeshSceneNode::createShadowVolumeSceneNode().*/ invoke the IAnimatedMeshSceneNode::createShadowVolumeSceneNode().*/
class IAnimatedMeshSceneNode : public ISceneNode class IAnimatedMeshSceneNode : public ISceneNode
{ {
public: public:
@ -70,88 +68,96 @@ namespace scene
virtual ~IAnimatedMeshSceneNode() {} virtual ~IAnimatedMeshSceneNode() {}
//! Sets the current frame number. //! Sets the current frame number.
//! From now on the animation is played from this frame. /** From now on the animation is played from this frame.
//! \param frame: Number of the frame to let the animation be started from. \param frame: Number of the frame to let the animation be started from.
//! The frame number must be a valid frame number of the IMesh used by this The frame number must be a valid frame number of the IMesh used by this
//! scene node. Set IAnimatedMesh::getMesh() for details. scene node. Set IAnimatedMesh::getMesh() for details. */
virtual void setCurrentFrame(f32 frame) = 0; virtual void setCurrentFrame(f32 frame) = 0;
//! Sets the frame numbers between the animation is looped. //! Sets the frame numbers between the animation is looped.
//! The default is 0 - MaximalFrameCount of the mesh. /** The default is 0 - MaximalFrameCount of the mesh.
//! \param begin: Start frame number of the loop. \param begin: Start frame number of the loop.
//! \param end: End frame number of the loop. \param end: End frame number of the loop.
//! \return Returns true if successful, false if not. \return True if successful, false if not. */
virtual bool setFrameLoop(s32 begin, s32 end) = 0; virtual bool setFrameLoop(s32 begin, s32 end) = 0;
//! Sets the speed with witch the animation is played. //! Sets the speed with witch the animation is played.
//! \param framesPerSecond: Frames per second played. /** \param framesPerSecond: Frames per second played. */
virtual void setAnimationSpeed(f32 framesPerSecond) = 0; virtual void setAnimationSpeed(f32 framesPerSecond) = 0;
//! Creates shadow volume scene node as child of this node //! Creates shadow volume scene node as child of this node.
//! and returns a pointer to it. The shadow can be rendered using the ZPass /** The shadow can be rendered using the ZPass or the zfail
//! or the zfail method. ZPass is a little bit faster because the shadow volume method. ZPass is a little bit faster because the shadow volume
//! creation is easier, but with this method there occur ugly looking artifacs creation is easier, but with this method there occur ugly
//! when the camera is inside the shadow volume. These error do not occur looking artifacs when the camera is inside the shadow volume.
//! with the ZFail method. These error do not occur with the ZFail method.
//! \param id: Id of the shadow scene node. This id can be used to identify \param shadowMesh: Optional custom mesh for shadow volume.
//! the node later. \param id: Id of the shadow scene node. This id can be used to
//! \param zfailmethod: If set to true, the shadow will use the zfail method, identify the node later.
//! if not, zpass is used. \param zfailmethod: If set to true, the shadow will use the
//! \param infinity: Value used by the shadow volume algorithm to scale the zfail method, if not, zpass is used.
//! shadow volume. \param infinity: Value used by the shadow volume algorithm to
//! \return Returns pointer to the created shadow scene node. scale the shadow volume.
//! This pointer should not be dropped. See IReferenceCounted::drop() for more information. \return Pointer to the created shadow scene node. This pointer
virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(s32 id=-1, should not be dropped. See IReferenceCounted::drop() for more
bool zfailmethod=true, f32 infinity=10000.0f) = 0; information. */
virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh=0,
s32 id=-1, bool zfailmethod=true, f32 infinity=10000.0f) = 0;
//! Returns a pointer to a joint in the mesh (if the mesh is a bone based mesh) //! Get a pointer to a joint in the mesh (if the mesh is a bone based mesh).
//! With this method it is possible to attach scene nodes to joints /** With this method it is possible to attach scene nodes to
//! for example possible to attach a weapon to the left hand of an joints for example possible to attach a weapon to the left hand
//! animated model. This example shows how: of an animated model. This example shows how:
//! \code \code
//! ISceneNode* hand = ISceneNode* hand =
//! yourAnimatedMeshSceneNode->getJointNode("LeftHand"); yourAnimatedMeshSceneNode->getJointNode("LeftHand");
//! hand->addChild(weaponSceneNode); hand->addChild(weaponSceneNode);
//! \endcode \endcode
//! Please note that the joint returned by this method may not exist Please note that the joint returned by this method may not exist
//! before this call and the joints in the node were created by it. before this call and the joints in the node were created by it.
//! \param jointName: Name of the joint. \param jointName: Name of the joint.
//! \return Returns a pointer to the scene node which represents the joint \return Pointer to the scene node which represents the joint
//! with the specified name. Returns 0 if the contained mesh is not an with the specified name. Returns 0 if the contained mesh is not
//! skinned mesh or the name of the joint could not be found. an skinned mesh or the name of the joint could not be found. */
virtual IBoneSceneNode* getJointNode(const c8* jointName)=0; virtual IBoneSceneNode* getJointNode(const c8* jointName)=0;
//! same as getJointNode(const c8* jointName), but based on id //! same as getJointNode(const c8* jointName), but based on id
virtual IBoneSceneNode* getJointNode(u32 jointID) = 0; virtual IBoneSceneNode* getJointNode(u32 jointID) = 0;
//! Redundant command, please use getJointNode (only for backwards compatibility) //! Gets joint count.
/** \return Amount of joints in the mesh. */
virtual u32 getJointCount() const = 0;
//! Deprecated command, please use getJointNode
virtual ISceneNode* getMS3DJointNode(const c8* jointName) = 0; virtual ISceneNode* getMS3DJointNode(const c8* jointName) = 0;
//! Redundant command, please use getJointNode (only for backwards compatibility) //! Deprecated command, please use getJointNode
virtual ISceneNode* getXJointNode(const c8* jointName) = 0; virtual ISceneNode* getXJointNode(const c8* jointName) = 0;
//! Starts a default MD2 animation. //! Starts a default MD2 animation.
//! With this method it is easily possible to start a Run, Attack, /** With this method it is easily possible to start a Run,
//! Die or whatever animation, if the mesh contained in this scene Attack, Die or whatever animation, if the mesh contained in
//! node is an md2 mesh. Otherwise, nothing happens. this scene node is an md2 mesh. Otherwise, nothing happens.
//! \param anim: An MD2 animation type, which should be played, for \param anim: An MD2 animation type, which should be played, for
//! example EMAT_STAND for the standing animation. example EMAT_STAND for the standing animation.
//! \return Returns true if successful, and false if not, for example \return True if successful, and false if not, for example if
//! if the mesh in the scene node is not a md2 mesh. the mesh in the scene node is not a md2 mesh. */
virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim) = 0; virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim) = 0;
//! Starts a special MD2 animation. //! Starts a special MD2 animation.
//! With this method it is easily possible to start a Run, Attack, /** With this method it is easily possible to start a Run,
//! Die or whatever animation, if the mesh contained in this scene Attack, Die or whatever animation, if the mesh contained in
//! node is an md2 mesh. Otherwise, nothing happens. This method uses this scene node is an md2 mesh. Otherwise, nothing happens.
//! a character string to identify the animation. If the animation is a This method uses a character string to identify the animation.
//! standard md2 animation, you might want to start this animation If the animation is a standard md2 animation, you might want to
//! with the EMD2_ANIMATION_TYPE enumeration instead. start this animation with the EMD2_ANIMATION_TYPE enumeration
//! \param animationName: Name of the animation which should be played. instead.
//! \return Returns true if successful, and false if not, for example \param animationName: Name of the animation which should be
//! if the mesh in the scene node is not an md2 mesh, or no animation played.
//! with this name could be found. \return Returns true if successful, and false if not, for
example if the mesh in the scene node is not an md2 mesh, or no
animation with this name could be found. */
virtual bool setMD2Animation(const c8* animationName) = 0; virtual bool setMD2Animation(const c8* animationName) = 0;
//! Returns the current displayed frame number. //! Returns the current displayed frame number.
@ -161,19 +167,20 @@ namespace scene
//! Returns the current end frame number. //! Returns the current end frame number.
virtual s32 getEndFrame() const = 0; virtual s32 getEndFrame() const = 0;
//! Sets looping mode which is on by default. If set to false, //! Sets looping mode which is on by default.
//! animations will not be played looped. /** If set to false, animations will not be played looped. */
virtual void setLoopMode(bool playAnimationLooped) = 0; virtual void setLoopMode(bool playAnimationLooped) = 0;
//! Sets a callback interface which will be called if an animation //! Sets a callback interface which will be called if an animation playback has ended.
//! playback has ended. Set this to 0 to disable the callback again. /** Set this to 0 to disable the callback again.
//! Please note that this will only be called when in non looped mode, Please note that this will only be called when in non looped
//! see IAnimatedMeshSceneNode::setLoopMode(). mode, see IAnimatedMeshSceneNode::setLoopMode(). */
virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0) = 0; virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0) = 0;
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style. //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes /* In this way it is possible to change the materials a mesh
referencing this mesh to change too. */ causing all mesh scene nodes referencing this mesh to change
too. */
virtual void setReadOnlyMaterials(bool readonly) = 0; virtual void setReadOnlyMaterials(bool readonly) = 0;
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style //! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
@ -185,25 +192,32 @@ namespace scene
//! Returns the current mesh //! Returns the current mesh
virtual IAnimatedMesh* getMesh(void) = 0; virtual IAnimatedMesh* getMesh(void) = 0;
//! returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, //! Get the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, or the absolutetransformation if it's a normal scenenode
//! or the absolutetransformation if it's a normal scenenode
virtual const SMD3QuaterionTag& getMD3TagTransformation( const core::stringc & tagname) = 0; virtual const SMD3QuaterionTag& getMD3TagTransformation( const core::stringc & tagname) = 0;
//! Set how the joints should be updated on render //! Set how the joints should be updated on render
//! 0-do nothing
//! 1-get joints positions from the mesh (for attached nodes, etc)
//! 2-control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() )
virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode)=0; virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode)=0;
//! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2) //! Sets the transition time in seconds
//! you must call animateJoints(), or the mesh will not ani\mate /** Note: This needs to enable joints, and setJointmode set to
EJUOR_CONTROL. You must call animateJoints(), or the mesh will
not animate. */
virtual void setTransitionTime(f32 Time) =0; virtual void setTransitionTime(f32 Time) =0;
//! animates the joints in the mesh based on the current frame (also takes in to account transitions) //! animates the joints in the mesh based on the current frame.
/** Also takes in to account transitions. */
virtual void animateJoints(bool CalculateAbsolutePositions=true) = 0; virtual void animateJoints(bool CalculateAbsolutePositions=true) = 0;
//! render mesh ignoring it's transformation. Used with ragdolls. (culling is unaffected) //! render mesh ignoring its transformation.
/** Used with ragdolls. Culling is unaffected. */
virtual void setRenderFromIdentity( bool On )=0; virtual void setRenderFromIdentity( bool On )=0;
//! Creates a clone of this scene node and its children.
/** \param newParent An optional new parent.
\param newManager An optional new scene manager.
\return The newly created clone of this node. */
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) = 0;
}; };
} // end namespace scene } // end namespace scene

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -16,7 +16,7 @@ namespace io
class IAttributes; class IAttributes;
//! Enumation flags passed through SAttributeReadWriteOptions to the IAttributeExchangingObject object //! Enumeration flags passed through SAttributeReadWriteOptions to the IAttributeExchangingObject object
enum E_ATTRIBUTE_READ_WRITE_FLAGS enum E_ATTRIBUTE_READ_WRITE_FLAGS
{ {
//! Serialization/Deserializion is done for an xml file //! Serialization/Deserializion is done for an xml file
@ -30,36 +30,36 @@ enum E_ATTRIBUTE_READ_WRITE_FLAGS
}; };
//! struct holding data describing options //! struct holding data describing options
struct SAttributeReadWriteOptions struct SAttributeReadWriteOptions
{ {
//! constructor //! Constructor
SAttributeReadWriteOptions() SAttributeReadWriteOptions()
: Flags(0), Filename(0) : Flags(0), Filename(0)
{ {
} }
//! Combination of E_ATTRIBUTE_READ_WRITE_FLAGS or other, custom ones //! Combination of E_ATTRIBUTE_READ_WRITE_FLAGS or other, custom ones
s32 Flags; s32 Flags;
//! optional filename //! Optional filename
const c8* Filename; const c8* Filename;
}; };
//! An object which is able to serialize and deserialize its attributes into an attributes object //! An object which is able to serialize and deserialize its attributes into an attributes object
class IAttributeExchangingObject : public virtual IReferenceCounted class IAttributeExchangingObject : virtual public IReferenceCounted
{ {
public: public:
//! Writes attributes of the object. //! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for /** Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes. scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {} virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}
//! Reads attributes of the object. //! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for /** Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes. scripting languages, editors, debuggers or xml deserialization purposes. */
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) {} virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) {}
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -124,7 +124,7 @@ public:
//! Returns amount of attributes in this collection of attributes. //! Returns amount of attributes in this collection of attributes.
virtual u32 getAttributeCount() const = 0; virtual u32 getAttributeCount() const = 0;
//! Returns attribute name by index. //! Returns attribute name by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const c8* getAttributeName(s32 index) = 0; virtual const c8* getAttributeName(s32 index) = 0;
@ -132,7 +132,7 @@ public:
//! \param attributeName: Name for the attribute //! \param attributeName: Name for the attribute
virtual E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) = 0; virtual E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) = 0;
//! Returns attribute type by index. //! Returns attribute type by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) = 0; virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) = 0;
@ -140,7 +140,7 @@ public:
//! \param attributeName: String for the attribute type //! \param attributeName: String for the attribute type
virtual const wchar_t* getAttributeTypeString(const c8* attributeName) = 0; virtual const wchar_t* getAttributeTypeString(const c8* attributeName) = 0;
//! Returns the type string of the attribute by index. //! Returns the type string of the attribute by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const wchar_t* getAttributeTypeString(s32 index) = 0; virtual const wchar_t* getAttributeTypeString(s32 index) = 0;
@ -154,9 +154,10 @@ public:
virtual void clear() = 0; virtual void clear() = 0;
//! Reads attributes from a xml file. //! Reads attributes from a xml file.
//! \param readCurrentElementOnly: If set to true, reading only works if current element has the name 'attributes' or //! \param reader The XML reader to read from
//! \param readCurrentElementOnly If set to true, reading only works if current element has the name 'attributes' or
//! the name specified using elementName. //! the name specified using elementName.
//! \param elementName: The surrounding element name. If it is null, the default one, "attributes" will be taken. //! \param elementName The surrounding element name. If it is null, the default one, "attributes" will be taken.
//! If set to false, the first appearing list of attributes are read. //! If set to false, the first appearing list of attributes are read.
virtual bool read(io::IXMLReader* reader, bool readCurrentElementOnly=false, const wchar_t* elementName=0) = 0; virtual bool read(io::IXMLReader* reader, bool readCurrentElementOnly=false, const wchar_t* elementName=0) = 0;
@ -224,28 +225,29 @@ public:
//! Adds an attribute as string //! Adds an attribute as string
virtual void addString(const c8* attributeName, const c8* value) = 0; virtual void addString(const c8* attributeName, const c8* value) = 0;
//! Sets an attribute value as string. //! Sets an attribute value as string.
//! \param attributeName: Name for the attribute //! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute //! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const c8* value) = 0; virtual void setAttribute(const c8* attributeName, const c8* value) = 0;
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or 0 if attribute is not set.
virtual core::stringc getAttributeAsString(const c8* attributeName) = 0; virtual core::stringc getAttributeAsString(const c8* attributeName) = 0;
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName Name of the attribute to get.
//! \param target: Buffer where the string is copied to. //! \param target Buffer where the string is copied to.
virtual void getAttributeAsString(const c8* attributeName, c8* target) = 0; virtual void getAttributeAsString(const c8* attributeName, c8* target) = 0;
//! Returns attribute value as string by index. //! Returns attribute value as string by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index Index value, must be between 0 and getAttributeCount()-1.
virtual core::stringc getAttributeAsString(s32 index) = 0; virtual core::stringc getAttributeAsString(s32 index) = 0;
//! Sets an attribute value as string. //! Sets an attribute value as string.
//! \param attributeName: Name for the attribute //! \param index Index value, must be between 0 and getAttributeCount()-1.
//! \param value String to which the attribute is set.
virtual void setAttribute(s32 index, const c8* value) = 0; virtual void setAttribute(s32 index, const c8* value) = 0;
// wide strings // wide strings
@ -253,14 +255,14 @@ public:
//! Adds an attribute as string //! Adds an attribute as string
virtual void addString(const c8* attributeName, const wchar_t* value) = 0; virtual void addString(const c8* attributeName, const wchar_t* value) = 0;
//! Sets an attribute value as string. //! Sets an attribute value as string.
//! \param attributeName: Name for the attribute //! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute //! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const wchar_t* value) = 0; virtual void setAttribute(const c8* attributeName, const wchar_t* value) = 0;
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or 0 if attribute is not set.
virtual core::stringw getAttributeAsStringW(const c8* attributeName) = 0; virtual core::stringw getAttributeAsStringW(const c8* attributeName) = 0;
@ -269,12 +271,13 @@ public:
//! \param target: Buffer where the string is copied to. //! \param target: Buffer where the string is copied to.
virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) = 0; virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) = 0;
//! Returns attribute value as string by index. //! Returns attribute value as string by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::stringw getAttributeAsStringW(s32 index) = 0; virtual core::stringw getAttributeAsStringW(s32 index) = 0;
//! Sets an attribute value as string. //! Sets an attribute value as string.
//! \param attributeName: Name for the attribute //! \param index Index value, must be between 0 and getAttributeCount()-1.
//! \param value String to which the attribute is set.
virtual void setAttribute(s32 index, const wchar_t* value) = 0; virtual void setAttribute(s32 index, const wchar_t* value) = 0;
/* /*
@ -290,11 +293,17 @@ public:
virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0; virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0;
//! Gets an attribute as binary data //! Gets an attribute as binary data
//! \param attributeName: Name of the attribute to get. /** \param attributeName: Name of the attribute to get.
\param outData Pointer to buffer where data shall be stored.
\param maxSizeInBytes Maximum number of bytes to write into outData.
*/
virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) = 0; virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) = 0;
//! Gets an attribute as binary data //! Gets an attribute as binary data
//! \param index: Index value, must be between 0 and getAttributeCount()-1. /** \param index: Index value, must be between 0 and getAttributeCount()-1.
\param outData Pointer to buffer where data shall be stored.
\param maxSizeInBytes Maximum number of bytes to write into outData.
*/
virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) = 0; virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) = 0;
//! Sets an attribute as binary data //! Sets an attribute as binary data
@ -302,26 +311,24 @@ public:
/* /*
Array Attribute Array Attribute
*/ */
//! Adds an attribute as wide string array //! Adds an attribute as wide string array
virtual void addArray(const c8* attributeName, core::array<core::stringw> value) = 0; virtual void addArray(const c8* attributeName, core::array<core::stringw> value) = 0;
//! Sets an attribute value as a wide string array. //! Sets an attribute value as a wide string array.
//! \param attributeName: Name for the attribute //! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute //! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const core::array<core::stringw> value) = 0; virtual void setAttribute(const c8* attributeName, const core::array<core::stringw> value) = 0;
//! Gets an attribute as an array of wide strings. //! Gets an attribute as an array of wide strings.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or 0 if attribute is not set.
virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName) = 0; virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName) = 0;
//! Returns attribute value as an array of wide strings by index. //! Returns attribute value as an array of wide strings by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::array<core::stringw> getAttributeAsArray(s32 index) = 0; virtual core::array<core::stringw> getAttributeAsArray(s32 index) = 0;
@ -343,7 +350,7 @@ public:
//! Gets an attribute as boolean value //! Gets an attribute as boolean value
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual bool getAttributeAsBool(const c8* attributeName) = 0; virtual bool getAttributeAsBool(const c8* attributeName) = 0;
//! Gets an attribute as boolean value //! Gets an attribute as boolean value
@ -374,27 +381,37 @@ public:
virtual const c8* getAttributeAsEnumeration(const c8* attributeName) = 0; virtual const c8* getAttributeAsEnumeration(const c8* attributeName) = 0;
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get. /** \param attributeName: Name of the attribute to get.
//! \param enumerationLiteralsToUse: Use these enumeration literals to get the index value instead of the set ones. \param enumerationLiteralsToUse: Use these enumeration literals to get
//! This is useful when the attribute list maybe was read from an xml file, and only contains the enumeration string, but the index value instead of the set ones. This is useful when the
//! no information about its index. attribute list maybe was read from an xml file, and only contains the
//! \return Returns value of the attribute previously set by setAttribute() enumeration string, but no information about its index.
\return Returns value of the attribute previously set by setAttribute()
*/
virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse) = 0; virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse) = 0;
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
//! \param index: Index value, must be between 0 and getAttributeCount()-1. /** \param index: Index value, must be between 0 and getAttributeCount()-1.
\param enumerationLiteralsToUse: Use these enumeration literals to get
the index value instead of the set ones. This is useful when the
attribute list maybe was read from an xml file, and only contains the
enumeration string, but no information about its index.
\return Returns value of the attribute previously set by setAttribute()
*/
virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse) = 0; virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse) = 0;
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const c8* getAttributeAsEnumeration(s32 index) = 0; virtual const c8* getAttributeAsEnumeration(s32 index) = 0;
//! Gets the list of enumeration literals of an enumeration attribute //! Gets the list of enumeration literals of an enumeration attribute
//! \param attributeName: Name of the attribute to get. //! \param attributeName Name of the attribute to get.
//! \param outLiterals Set of strings to choose the enum name from.
virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) = 0; virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) = 0;
//! Gets the list of enumeration literals of an enumeration attribute //! Gets the list of enumeration literals of an enumeration attribute
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
//! \param outLiterals Set of strings to choose the enum name from.
virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) = 0; virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) = 0;
//! Sets an attribute as enumeration //! Sets an attribute as enumeration
@ -471,7 +488,7 @@ public:
//! Gets an attribute as 3d vector //! Gets an attribute as 3d vector
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::vector3df getAttributeAsVector3d(s32 index) = 0; virtual core::vector3df getAttributeAsVector3d(s32 index) = 0;
//! Sets an attribute as vector //! Sets an attribute as vector
virtual void setAttribute(s32 index, core::vector3df v) = 0; virtual void setAttribute(s32 index, core::vector3df v) = 0;
@ -525,10 +542,8 @@ public:
/* /*
matrix attribute matrix attribute
*/
*/
//! Adds an attribute as matrix //! Adds an attribute as matrix
virtual void addMatrix(const c8* attributeName, const core::matrix4& v) = 0; virtual void addMatrix(const c8* attributeName, const core::matrix4& v) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,8 +21,8 @@ class IBillboardSceneNode : public ISceneNode
{ {
public: public:
//! constructor //! Constructor
IBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, IBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0)) const core::vector3df& position = core::vector3df(0,0,0))
: ISceneNode(parent, mgr, id, position) {} : ISceneNode(parent, mgr, id, position) {}
@ -33,19 +33,18 @@ public:
virtual const core::dimension2d<f32>& getSize() const = 0; virtual const core::dimension2d<f32>& getSize() const = 0;
//! Set the color of all vertices of the billboard //! Set the color of all vertices of the billboard
//! \param overallColor: the color to set /** \param overallColor: the color to set */
virtual void setColor(const video::SColor & overallColor) = 0; virtual void setColor(const video::SColor & overallColor) = 0;
//! Set the color of the top and bottom vertices of the billboard //! Set the color of the top and bottom vertices of the billboard
//! \param topColor: the color to set the top vertices /** \param topColor: the color to set the top vertices
//! \param bottomColor: the color to set the bottom vertices \param bottomColor: the color to set the bottom vertices */
virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor) = 0; virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor) = 0;
//! Gets the color of the top and bottom vertices of the billboard //! Gets the color of the top and bottom vertices of the billboard
//! \param topColor: stores the color of the top vertices /** \param topColor: stores the color of the top vertices
//! \param bottomColor: stores the color of the bottom vertices \param bottomColor: stores the color of the bottom vertices */
virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0; virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0;
}; };
} // end namespace scene } // end namespace scene

View File

@ -1,8 +1,10 @@
// Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_BONE_SCENE_NODE_H_INCLUDED__ #ifndef __I_BONE_SCENE_NODE_H_INCLUDED__
#define __I_BONE_SCENE_NODE_H_INCLUDED__ #define __I_BONE_SCENE_NODE_H_INCLUDED__
// Used with ISkinnedMesh and IAnimatedMeshSceneNode, for boned meshes
#include "ISceneNode.h" #include "ISceneNode.h"
namespace irr namespace irr
@ -16,8 +18,7 @@ namespace scene
//! The bone is usually animated, unless it's parent is not animated //! The bone is usually animated, unless it's parent is not animated
EBAM_AUTOMATIC=0, EBAM_AUTOMATIC=0,
//! The bone is animated by the skin, if it's parent is not animated //! The bone is animated by the skin, if it's parent is not animated then animation will resume from this bone onward
//! then animation will resume from this bone onward
EBAM_ANIMATED, EBAM_ANIMATED,
//! The bone is not animated by the skin //! The bone is not animated by the skin
@ -49,47 +50,51 @@ namespace scene
}; };
//! Interface for bones used for skeletal animation.
/** Used with ISkinnedMesh and IAnimatedMeshSceneNode. */
class IBoneSceneNode : public ISceneNode class IBoneSceneNode : public ISceneNode
{ {
public: public:
IBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1) : IBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1) :
ISceneNode(parent, mgr, id),positionHint(-1),scaleHint(-1),rotationHint(-1) { } ISceneNode(parent, mgr, id),positionHint(-1),scaleHint(-1),rotationHint(-1) { }
//! Returns the name of the bone //! Get the name of the bone
virtual const c8* getBoneName() const = 0; /** \deprecated Use getName instead. */
virtual const c8* getBoneName() const { return getName(); }
//! Returns the index of the bone //! Get the index of the bone
virtual u32 getBoneIndex() const = 0; virtual u32 getBoneIndex() const = 0;
//! Sets the animation mode of the bone. Returns true if successful. (Unused) //! Sets the animation mode of the bone.
/** \return True if successful. (Unused) */
virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0; virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0;
//! Gets the current animation mode of the bone //! Gets the current animation mode of the bone
virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0; virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
//! returns the axis aligned bounding box of this node //! Get the axis aligned bounding box of this node
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0; virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
//! Returns the relative transformation of the scene node. //! Returns the relative transformation of the scene node.
//virtual core::matrix4 getRelativeTransformation() const = 0; //virtual core::matrix4 getRelativeTransformation() const = 0;
//! The animation method.
virtual void OnAnimate(u32 timeMs) =0; virtual void OnAnimate(u32 timeMs) =0;
//! Does nothing as bones are not visible //! The render method.
/** Does nothing as bones are not visible. */
virtual void render() { } virtual void render() { }
//! How the relative transformation of the bone is used //! How the relative transformation of the bone is used
virtual void setSkinningSpace( E_BONE_SKINNING_SPACE space ) =0; virtual void setSkinningSpace( E_BONE_SKINNING_SPACE space ) =0;
//! How the relative transformation of the bone is used //! How the relative transformation of the bone is used
virtual E_BONE_SKINNING_SPACE getSkinningSpace() =0; virtual E_BONE_SKINNING_SPACE getSkinningSpace() const =0;
//! updates the absolute position based on the relative and the parents position //! Updates the absolute position based on the relative and the parents position
virtual void updateAbsolutePositionOfAllChildren()=0; virtual void updateAbsolutePositionOfAllChildren()=0;
s32 positionHint; s32 positionHint;
s32 scaleHint; s32 scaleHint;
s32 rotationHint; s32 rotationHint;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -15,79 +15,93 @@ namespace scene
struct SViewFrustum; struct SViewFrustum;
//! Scene Node which is a (controlable) camera. //! Scene Node which is a (controlable) camera.
/** The whole scene will be /** The whole scene will be rendered from the cameras point of view.
rendered from the cameras point of view. Because the ICameraScenNode Because the ICameraScenNode is a SceneNode, it can be attached to any
is a SceneNode, it can be attached to any other scene node, and will other scene node, and will follow its parents movement, rotation and so
follow its parents movement, rotation and so on. on.
*/ */
class ICameraSceneNode : public ISceneNode, public IEventReceiver class ICameraSceneNode : public ISceneNode, public IEventReceiver
{ {
public: public:
//! Constructor //! Constructor
ICameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, ICameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& rotation = core::vector3df(0,0,0), const core::vector3df& rotation = core::vector3df(0,0,0),
const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f)) const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f))
: ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {} : ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {}
//! Destructor //! Sets the projection matrix of the camera.
virtual ~ICameraSceneNode() {} /** The core::matrix4 class has some methods to build a
projection matrix. e.g:
//! Sets the projection matrix of the camera. core::matrix4::buildProjectionMatrixPerspectiveFovLH.
/** The core::matrix4 class has some methods Note that the matrix will only stay as set by this method until
to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH. one of the following Methods are called: setNearValue,
Note that the matrix will only stay as set by this method until one of setFarValue, setAspectRatio, setFOV.
the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV. \param projection The new projection matrix of the camera.
\param projection: The new projection matrix of the camera. */ \param isOrthogonal Set this to true if the matrix is an
virtual void setProjectionMatrix(const core::matrix4& projection) = 0; orthogonal one (e.g. from matrix4::buildProjectionMatrixOrtho).
*/
virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal = false) = 0;
//! Gets the current projection matrix of the camera. //! Gets the current projection matrix of the camera.
/** \return Returns the current projection matrix of the camera. */ /** \return The current projection matrix of the camera. */
virtual const core::matrix4& getProjectionMatrix() const = 0; virtual const core::matrix4& getProjectionMatrix() const = 0;
//! Gets the current view matrix of the camera. //! Gets the current view matrix of the camera.
/** \return Returns the current view matrix of the camera. */ /** \return The current view matrix of the camera. */
virtual const core::matrix4& getViewMatrix() const = 0; virtual const core::matrix4& getViewMatrix() const = 0;
//! It is possible to send mouse and key events to the camera. //! It is possible to send mouse and key events to the camera.
/** Most cameras /** Most cameras may ignore this input, but camera scene nodes
may ignore this input, but camera scene nodes which are created for which are created for example with
example with ISceneManager::addMayaCameraSceneNode or ISceneManager::addCameraSceneNodeMaya or
ISceneManager::addMeshViewerCameraSceneNode, may want to get this input ISceneManager::addCameraSceneNodeFPS, may want to get
for changing their position, look at target or whatever. */ this input for changing their position, look at target or
whatever. */
virtual bool OnEvent(const SEvent& event) = 0; virtual bool OnEvent(const SEvent& event) = 0;
//! Sets the look at target of the camera //! Sets the look at target of the camera
/** \param pos: Look at target of the camera. */ /** If the camera's target and rotation are bound ( @see
bindTargetAndRotation() ) then calling this will also change
the camera's scene node rotation to match the target.
\param pos Look at target of the camera, in world co-ordinates. */
virtual void setTarget(const core::vector3df& pos) = 0; virtual void setTarget(const core::vector3df& pos) = 0;
//! Sets the rotation of the node.
/** This only modifies the relative rotation of the node.
If the camera's target and rotation are bound ( @see
bindTargetAndRotation() ) then calling this will also change
the camera's target to match the rotation.
\param rotation New rotation of the node in degrees. */
virtual void setRotation(const core::vector3df& rotation) = 0;
//! Gets the current look at target of the camera //! Gets the current look at target of the camera
/** \return Returns the current look at target of the camera */ /** \return The current look at target of the camera, in world co-ordinates */
virtual core::vector3df getTarget() const = 0; virtual const core::vector3df& getTarget() const = 0;
//! Sets the up vector of the camera. //! Sets the up vector of the camera.
/** \param pos: New upvector of the camera. */ /** \param pos: New upvector of the camera. */
virtual void setUpVector(const core::vector3df& pos) = 0; virtual void setUpVector(const core::vector3df& pos) = 0;
//! Gets the up vector of the camera. //! Gets the up vector of the camera.
/** \return Returns the up vector of the camera. */ /** \return The up vector of the camera, in world space. */
virtual core::vector3df getUpVector() const = 0; virtual const core::vector3df& getUpVector() const = 0;
//! Gets the value of the near plane of the camera. //! Gets the value of the near plane of the camera.
/** \return Returns the value of the near plane of the camera. */ /** \return The value of the near plane of the camera. */
virtual f32 getNearValue() const = 0; virtual f32 getNearValue() const = 0;
//! Gets the value of the far plane of the camera. //! Gets the value of the far plane of the camera.
/** \return Returns the value of the far plane of the camera. */ /** \return The value of the far plane of the camera. */
virtual f32 getFarValue() const = 0; virtual f32 getFarValue() const = 0;
//! Gets the aspect ratio of the camera. //! Gets the aspect ratio of the camera.
/** \return Returns the aspect ratio of the camera. */ /** \return The aspect ratio of the camera. */
virtual f32 getAspectRatio() const = 0; virtual f32 getAspectRatio() const = 0;
//! Gets the field of view of the camera. //! Gets the field of view of the camera.
/** \return Returns the field of view of the camera in radiants. */ /** \return The field of view of the camera in radiants. */
virtual f32 getFOV() const = 0; virtual f32 getFOV() const = 0;
//! Sets the value of the near clipping plane. (default: 1.0f) //! Sets the value of the near clipping plane. (default: 1.0f)
@ -106,37 +120,42 @@ namespace scene
/** \param fovy: New field of view in radiants. */ /** \param fovy: New field of view in radiants. */
virtual void setFOV(f32 fovy) = 0; virtual void setFOV(f32 fovy) = 0;
//! Returns the view frustum. //! Get the view frustum.
/** Needed sometimes by bspTree or LOD render nodes. /** Needed sometimes by bspTree or LOD render nodes.
\return Returns the current view frustum. */ \return The current view frustum. */
virtual const SViewFrustum* getViewFrustum() const = 0; virtual const SViewFrustum* getViewFrustum() const = 0;
//! Disables or enables the camera to get key or mouse inputs. //! Disables or enables the camera to get key or mouse inputs.
/** If this is set to true, the camera will respond to key inputs /** If this is set to true, the camera will respond to key
otherwise not. */ inputs otherwise not. */
virtual void setInputReceiverEnabled(bool enabled) = 0; virtual void setInputReceiverEnabled(bool enabled) = 0;
//! Returns if the input receiver of the camera is currently enabled. //! Checks if the input receiver of the camera is currently enabled.
virtual bool isInputReceiverEnabled() const = 0; virtual bool isInputReceiverEnabled() const = 0;
//! Returns if a camera is orthogonal. //! Checks if a camera is orthogonal.
/** This setting does not change anything of the view or projection matrix. However virtual bool isOrthogonal() const
it influences how collision detection and picking is done with this camera. */
virtual bool isOrthogonal() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsOrthogonal; return IsOrthogonal;
}
//! Sets if this camera should return if it is orthogonal.
/** This setting does not change anything of the view or projection matrix. However
it influences how collision detection and picking is done with this camera. */
void setIsOrthogonal( bool orthogonal )
{
IsOrthogonal = orthogonal;
} }
private: //! Binds the camera scene node's rotation to its target position and vice vera, or unbinds them.
/** When bound, calling setRotation() will update the camera's
target position to be along its +Z axis, and likewise calling
setTarget() will update its rotation so that its +Z axis will
point at the target point. FPS camera use this binding by
default; other cameras do not.
\param bound True to bind the camera's scene node rotation
and targetting, false to unbind them.
@see getTargetAndRotationBinding() */
virtual void bindTargetAndRotation(bool bound) = 0;
//! Queries if the camera scene node's rotation and its target position are bound together.
/** @see bindTargetAndRotation() */
virtual bool getTargetAndRotationBinding(void) const = 0;
protected:
bool IsOrthogonal; bool IsOrthogonal;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -25,22 +25,24 @@ namespace gui
virtual void setVisible(bool visible) = 0; virtual void setVisible(bool visible) = 0;
//! Returns if the cursor is currently visible. //! Returns if the cursor is currently visible.
/** \return Returns true if the cursor is visible, false if not. */ /** \return True if the cursor is visible, false if not. */
virtual bool isVisible() const = 0; virtual bool isVisible() const = 0;
/** Sets the new position of the cursor. The position must be //! Sets the new position of the cursor.
between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is /** The position must be
between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
the top left corner and (1.0f, 1.0f) is the bottom right corner of the the top left corner and (1.0f, 1.0f) is the bottom right corner of the
render window. */ render window.
//! \param pos: New position of the cursor. \param pos New position of the cursor. */
virtual void setPosition(const core::position2d<f32> &pos) = 0; virtual void setPosition(const core::position2d<f32> &pos) = 0;
/** Sets the new position of the cursor. The position must be //! Sets the new position of the cursor.
between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is /** The position must be
between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
the top left corner and (1.0f, 1.0f) is the bottom right corner of the the top left corner and (1.0f, 1.0f) is the bottom right corner of the
render window. */ render window.
//! \param x: New x-coord of the cursor. \param x New x-coord of the cursor.
//! \param y: New x-coord of the cursor. \param y New x-coord of the cursor. */
virtual void setPosition(f32 x, f32 y) = 0; virtual void setPosition(f32 x, f32 y) = 0;
//! Sets the new position of the cursor. //! Sets the new position of the cursor.
@ -48,8 +50,8 @@ namespace gui
virtual void setPosition(const core::position2d<s32> &pos) = 0; virtual void setPosition(const core::position2d<s32> &pos) = 0;
//! Sets the new position of the cursor. //! Sets the new position of the cursor.
/** \param x: New x-coord of the cursor. The coordinates are pixel units. */ /** \param x New x-coord of the cursor. The coordinates are pixel units.
/** \param y: New y-coord of the cursor. The coordinates are pixel units. */ \param y New y-coord of the cursor. The coordinates are pixel units. */
virtual void setPosition(s32 x, s32 y) = 0; virtual void setPosition(s32 x, s32 y) = 0;
//! Returns the current position of the mouse cursor. //! Returns the current position of the mouse cursor.
@ -59,16 +61,16 @@ namespace gui
//! Returns the current position of the mouse cursor. //! Returns the current position of the mouse cursor.
/** \return Returns the current position of the cursor. The returned position /** \return Returns the current position of the cursor. The returned position
is a value between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is is a value between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
the top left corner and (1.0f, 1.0f) is the bottom right corner of the the top left corner and (1.0f, 1.0f) is the bottom right corner of the
render window. */ render window. */
virtual core::position2d<f32> getRelativePosition() = 0; virtual core::position2d<f32> getRelativePosition() = 0;
//! Sets an absolute reference rect for setting and retrieving the cursor position. //! Sets an absolute reference rect for setting and retrieving the cursor position.
/** If this rect is set, the cursor position is not being calculated relative to /** If this rect is set, the cursor position is not being calculated relative to
the rendering window but to this rect. You can set the rect pointer to 0 to disable the rendering window but to this rect. You can set the rect pointer to 0 to disable
this feature again. This feature is useful when rendering into parts of foreign windows this feature again. This feature is useful when rendering into parts of foreign windows
for example in an editor. for example in an editor.
\param rect: A pointer to an reference rectangle or 0 to disable the reference rectangle.*/ \param rect: A pointer to an reference rectangle or 0 to disable the reference rectangle.*/
virtual void setReferenceRect(core::rect<s32>* rect=0) = 0; virtual void setReferenceRect(core::rect<s32>* rect=0) = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,7 +14,7 @@ namespace scene
//! Dummy scene node for adding additional transformations to the scene graph. //! Dummy scene node for adding additional transformations to the scene graph.
/** This scene node does not render itself, and does not respond to set/getPosition, /** This scene node does not render itself, and does not respond to set/getPosition,
set/getRotation and set/getScale. Its just a simple scene node that takes a set/getRotation and set/getScale. Its just a simple scene node that takes a
matrix as relative transformation, making it possible to insert any transformation matrix as relative transformation, making it possible to insert any transformation
anywhere into the scene graph. anywhere into the scene graph.
This scene node is for example used by the IAnimatedMeshSceneNode for emulating This scene node is for example used by the IAnimatedMeshSceneNode for emulating
@ -24,13 +24,13 @@ class IDummyTransformationSceneNode : public ISceneNode
{ {
public: public:
//! constructor //! Constructor
IDummyTransformationSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id) IDummyTransformationSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
: ISceneNode(parent, mgr, id) {} : ISceneNode(parent, mgr, id) {}
//! Returns a reference to the current relative transformation matrix. //! Returns a reference to the current relative transformation matrix.
//! This is the matrix, this scene node uses instead of scale, translation /** This is the matrix, this scene node uses instead of scale, translation
//! and rotation. and rotation. */
virtual core::matrix4& getRelativeTransformationMatrix() = 0; virtual core::matrix4& getRelativeTransformationMatrix() = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -8,6 +8,7 @@
#include "ILogger.h" #include "ILogger.h"
#include "position2d.h" #include "position2d.h"
#include "Keycodes.h" #include "Keycodes.h"
#include "irrString.h"
namespace irr namespace irr
{ {
@ -16,32 +17,58 @@ namespace irr
{ {
//! An event of the graphical user interface. //! An event of the graphical user interface.
/** GUI events are created by the GUI environment or the GUI elements in response /** GUI events are created by the GUI environment or the GUI elements in response
to mouse or keyboard events. When a GUI element receives an event it will either to mouse or keyboard events. When a GUI element receives an event it will either
process it and return true, or pass the event to its parent. If an event is not absorbed process it and return true, or pass the event to its parent. If an event is not absorbed
before it reaches the root element then it will then be passed to the user receiver. */ before it reaches the root element then it will then be passed to the user receiver. */
EET_GUI_EVENT = 0, EET_GUI_EVENT = 0,
//! A mouse input event. //! A mouse input event.
/** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser /** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser
in response to mouse input received from the operating system. in response to mouse input received from the operating system.
Mouse events are first passed to the user receiver, then to the GUI environment (and possibly Mouse events are first passed to the user receiver, then to the GUI environment and its elements,
many GUI elements), then finally the input receiving scene manager (and possibly the active then finally the input receiving scene manager where it is passed to the active camera.
camera) */ */
EET_MOUSE_INPUT_EVENT, EET_MOUSE_INPUT_EVENT,
//! A key input evant. //! A key input event.
/** Keyboard events are also created by the device and passed to IrrlichtDevice::postEventFromUser. /** Like mouse events, keyboard events are created by the device and passed to
They take the same path as mouse events. */ IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
EET_KEY_INPUT_EVENT, EET_KEY_INPUT_EVENT,
//! A joystick (joypad, gamepad) input event.
/** Joystick events are created by polling all connected joysticks once per
device run() and then passing the events to IrrlichtDevice::postEventFromUser.
They take the same path as mouse events.
Windows, SDL: Implemented.
Linux: Implemented, with POV hat issues.
MacOS / Other: Not yet implemented.
*/
EET_JOYSTICK_INPUT_EVENT,
//! A log event //! A log event
/** Log events are only passed to the user receiver if there is one. If they are absorbed by the /** Log events are only passed to the user receiver if there is one. If they are absorbed by the
user receiver then no text will be sent to the console. */ user receiver then no text will be sent to the console. */
EET_LOG_TEXT_EVENT, EET_LOG_TEXT_EVENT,
//! A user event with user data. This is not used by Irrlicht and can be used //! A user event with user data.
//! to send user specific data though the system. /** This is not used by Irrlicht and can be used to send user
EET_USER_EVENT specific data though the system. The Irrlicht 'window handle'
can be obtained from IrrlichtDevice::getExposedVideoData()
The usage and behaviour depends on the operating system:
Windows: send a WM_USER message to the Irrlicht Window; the
wParam and lParam will be used to populate the
UserData1 and UserData2 members of the SUserEvent.
Linux: send a ClientMessage via XSendEvent to the Irrlicht
Window; the data.l[0] and data.l[1] members will be
casted to s32 and used as UserData1 and UserData2.
MacOS: Not yet implemented
*/
EET_USER_EVENT,
//! This enum is never used, it only forces the compiler to
//! compile these enumeration values to 32 bit.
EGUIET_FORCE_32_BIT = 0x7fffffff
}; };
//! Enumeration for all mouse input events //! Enumeration for all mouse input events
@ -68,7 +95,7 @@ namespace irr
//! The mouse cursor changed its position. //! The mouse cursor changed its position.
EMIE_MOUSE_MOVED, EMIE_MOUSE_MOVED,
//! The mouse wheel was moved. Use Wheel value in event data to find out //! The mouse wheel was moved. Use Wheel value in event data to find out
//! in what direction and how fast. //! in what direction and how fast.
EMIE_MOUSE_WHEEL, EMIE_MOUSE_WHEEL,
@ -85,12 +112,12 @@ namespace irr
enum EGUI_EVENT_TYPE enum EGUI_EVENT_TYPE
{ {
//! A gui element has lost its focus. //! A gui element has lost its focus.
//! GUIEvent.Caller is losing the focus to GUIEvent.Element. /** GUIEvent.Caller is losing the focus to GUIEvent.Element.
//! If the event is absorbed then the focus will not be changed. If the event is absorbed then the focus will not be changed. */
EGET_ELEMENT_FOCUS_LOST = 0, EGET_ELEMENT_FOCUS_LOST = 0,
//! A gui element has got the focus. //! A gui element has got the focus.
//! If the event is absorbed then the focus will not be changed. /** If the event is absorbed then the focus will not be changed. */
EGET_ELEMENT_FOCUSED, EGET_ELEMENT_FOCUSED,
//! The mouse cursor hovered over a gui element. //! The mouse cursor hovered over a gui element.
@ -100,8 +127,8 @@ namespace irr
EGET_ELEMENT_LEFT, EGET_ELEMENT_LEFT,
//! An element would like to close. //! An element would like to close.
//! Windows and context menus use this event when they would like to close, /** Windows and context menus use this event when they would like to close,
//! this can be cancelled by absorbing the event. this can be cancelled by absorbing the event. */
EGET_ELEMENT_CLOSED, EGET_ELEMENT_CLOSED,
//! A button was clicked. //! A button was clicked.
@ -114,10 +141,10 @@ namespace irr
EGET_CHECKBOX_CHANGED, EGET_CHECKBOX_CHANGED,
//! A new item in a listbox was seleted. //! A new item in a listbox was seleted.
EGET_LISTBOX_CHANGED, EGET_LISTBOX_CHANGED,
//! An item in the listbox was selected, which was already selected. //! An item in the listbox was selected, which was already selected.
EGET_LISTBOX_SELECTED_AGAIN, EGET_LISTBOX_SELECTED_AGAIN,
//! A file has been selected in the file dialog //! A file has been selected in the file dialog
EGET_FILE_SELECTED, EGET_FILE_SELECTED,
@ -150,7 +177,11 @@ namespace irr
EGET_COMBO_BOX_CHANGED, EGET_COMBO_BOX_CHANGED,
//! The value of a spin box has changed //! The value of a spin box has changed
EGET_SPINBOX_CHANGED EGET_SPINBOX_CHANGED,
//! A table has changed
EGET_TABLE_CHANGED,
EGET_TABLE_HEADER_CHANGED,
EGET_TABLE_SELECTED_AGAIN
}; };
} // end namespace gui } // end namespace gui
@ -159,6 +190,7 @@ namespace irr
//! SEvents hold information about an event. See irr::IEventReceiver for details on event handling. //! SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
struct SEvent struct SEvent
{ {
//! Any kind of GUI event.
struct SGUIEvent struct SGUIEvent
{ {
//! IGUIElement who called the event //! IGUIElement who called the event
@ -172,6 +204,7 @@ struct SEvent
}; };
//! Any kind of mouse event.
struct SMouseInput struct SMouseInput
{ {
//! X position of mouse cursor //! X position of mouse cursor
@ -182,49 +215,109 @@ struct SEvent
//! mouse wheel delta, usually 1.0 or -1.0. //! mouse wheel delta, usually 1.0 or -1.0.
/** Only valid if event was EMIE_MOUSE_WHEEL */ /** Only valid if event was EMIE_MOUSE_WHEEL */
f32 Wheel; f32 Wheel;
//! type of mouse event //! Type of mouse event
EMOUSE_INPUT_EVENT Event; EMOUSE_INPUT_EVENT Event;
}; };
//! Any kind of keyboard event.
struct SKeyInput struct SKeyInput
{ {
//! Character corresponding to the key (0, if not a character) //! Character corresponding to the key (0, if not a character)
wchar_t Char; wchar_t Char;
//! Key which has been pressed or released //! Key which has been pressed or released
EKEY_CODE Key; EKEY_CODE Key;
//! if not pressed, then the key was left up //! If not true, then the key was left up
bool PressedDown; bool PressedDown;
//! true if shift was also pressed //! True if shift was also pressed
bool Shift; bool Shift;
//! true if ctrl was also pressed //! True if ctrl was also pressed
bool Control; bool Control;
}; };
//! A joystick event.
/** Unlike other events, joystick events represent the result of polling
* each connected joystick once per run() of the device. Joystick events will
* not be generated by default. If joystick support is available for the
* active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and
* @ref IrrlichtDevice::activateJoysticks() has been called, an event of
* this type will be generated once per joystick per @ref IrrlichtDevice::run()
* regardless of whether the state of the joystick has actually changed. */
struct SJoystickEvent
{
enum
{
NUMBER_OF_BUTTONS = 32,
AXIS_X = 0, // e.g. analog stick 1 left to right
AXIS_Y, // e.g. analog stick 1 top to bottom
AXIS_Z, // e.g. throttle, or analog 2 stick 2 left to right
AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom
AXIS_U,
AXIS_V,
NUMBER_OF_AXES
};
/** A bitmap of button states. You can use IsButtonPressed() to
( check the state of each button from 0 to (NUMBER_OF_BUTTONS - 1) */
u32 ButtonStates;
/** For AXIS_X, AXIS_Y, AXIS_Z, AXIS_R, AXIS_U and AXIS_V
* Values are in the range -32768 to 32767, with 0 representing
* the center position. You will receive the raw value from the
* joystick, and so will usually want to implement a dead zone around
* the center of the range. Axes not supported by this joystick will
* always have a value of 0. On Linux, POV hats are represented as axes,
* usually the last two active axis.
*/
s16 Axis[NUMBER_OF_AXES];
/** The POV represents the angle of the POV hat in degrees * 100,
* from 0 to 35,900. A value of 65535 indicates that the POV hat
* is centered (or not present).
* This value is only supported on Windows. On Linux, the POV hat
* will be sent as 2 axes instead. */
u16 POV;
//! The ID of the joystick which generated this event.
/** This is an internal Irrlicht index; it does not map directly
* to any particular hardware joystick. */
u8 Joystick;
//! A helper function to check if a button is pressed.
bool IsButtonPressed(u32 button) const
{
if(button >= (u32)NUMBER_OF_BUTTONS)
return false;
return (ButtonStates & (1 << button)) ? true : false;
}
};
//! Any kind of log event.
struct SLogEvent struct SLogEvent
{ {
//! pointer to text which has been logged //! Pointer to text which has been logged
const c8* Text; const c8* Text;
//! log level in which the text has been logged //! Log level in which the text has been logged
ELOG_LEVEL Level; ELOG_LEVEL Level;
}; };
//! Any kind of user event.
struct SUserEvent struct SUserEvent
{ {
//! Some user specified data as int //! Some user specified data as int
s32 UserData1; s32 UserData1;
//! Another user specified data as int //! Another user specified data as int
s32 UserData2; s32 UserData2;
//! Some user specified data as float
f32 UserData3;
}; };
EEVENT_TYPE EventType; EEVENT_TYPE EventType;
@ -233,6 +326,7 @@ struct SEvent
struct SGUIEvent GUIEvent; struct SGUIEvent GUIEvent;
struct SMouseInput MouseInput; struct SMouseInput MouseInput;
struct SKeyInput KeyInput; struct SKeyInput KeyInput;
struct SJoystickEvent JoystickEvent;
struct SLogEvent LogEvent; struct SLogEvent LogEvent;
struct SUserEvent UserEvent; struct SUserEvent UserEvent;
}; };
@ -240,23 +334,61 @@ struct SEvent
}; };
//! Interface of an object which can receive events. //! Interface of an object which can receive events.
/** Many of the engine's classes inherit IEventReceiver so they are able to process events. /** Many of the engine's classes inherit IEventReceiver so they are able to
Events usually start at a postEventFromUser function and are passed down through a chain of process events. Events usually start at a postEventFromUser function and are
event receivers until OnEvent returns true. passed down through a chain of event receivers until OnEvent returns true. See
See irr::EEVENT_TYPE for a description of where each type of event starts, and the path it takes irr::EEVENT_TYPE for a description of where each type of event starts, and the
through the system. */ path it takes through the system. */
class IEventReceiver class IEventReceiver
{ {
public: public:
//! Destructor
virtual ~IEventReceiver() {} virtual ~IEventReceiver() {}
//! called if an event happened. //! Called if an event happened.
//! \return Returns true if the event was processed /** \return True if the event was processed. */
virtual bool OnEvent(const SEvent& event) = 0; virtual bool OnEvent(const SEvent& event) = 0;
}; };
//! Information on a joystick, returned from @ref IrrlichtDevice::activateJoysticks()
struct SJoystickInfo
{
//! The ID of the joystick
/** This is an internal Irrlicht index; it does not map directly
* to any particular hardware joystick. It corresponds to the
* irr::SJoystickEvent Joystick ID. */
u8 Joystick;
//! The name that the joystick uses to identify itself.
core::stringc Name;
//! The number of buttons that the joystick has.
u32 Buttons;
//! The number of axes that the joystick has, i.e. X, Y, Z, R, U, V.
/** Note: with a Linux device, the POV hat (if any) will use two axes. These
* will be included in this count. */
u32 Axes;
//! An indication of whether the joystick has a POV hat.
/** A Windows device will identify the presence or absence or the POV hat. A
* Linux device cannot, and will always return POV_HAT_UNKNOWN. */
enum
{
//! A hat is definitely present.
POV_HAT_PRESENT,
//! A hat is definitely not present.
POV_HAT_ABSENT,
//! The presence or absence of a hat cannot be determined.
POV_HAT_UNKNOWN
} PovHat;
}; // struct SJoystickInfo
} // end namespace irr } // end namespace irr
#endif #endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -16,37 +16,27 @@ namespace io
class IFileList : public virtual IReferenceCounted class IFileList : public virtual IReferenceCounted
{ {
public: public:
//! Get the number of files in the filelist.
//! destructor /** \return Amount of files and directories in the file list. */
virtual ~IFileList() {}
//! Returns the amount of files in the filelist.
//! \return
//! Returns the amount of files and directories in the file list.
virtual u32 getFileCount() const = 0; virtual u32 getFileCount() const = 0;
//! Gets the name of a file in the list, based on an index. //! Gets the name of a file in the list, based on an index.
//! The path is not included in this name. Use getFullFileName for this. /** The path is not included in this name. Use getFullFileName for this.
//! \param index is the zero based index of the file which name should \param index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns. be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return \return File name of the file. Returns 0, if an error occured. */
//! Returns the file name of the file. Returns 0, if an error occured.
virtual const c8* getFileName(u32 index) const = 0; virtual const c8* getFileName(u32 index) const = 0;
//! Gets the full name of a file in the list, path included, based on an index. //! Gets the full name of a file in the list, path included, based on an index.
//! \param index is the zero based index of the file which name should /** \param index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns. be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return \return File name of the file. Returns 0, if an error occured. */
//! Returns the file name of the file. Returns 0, if an error occured.
virtual const c8* getFullFileName(u32 index) = 0; virtual const c8* getFullFileName(u32 index) = 0;
//! Returns of the file is a directory //! Check if the file is a directory
//! \param /** \param index The zero based index of the file whose name shall
//! index is the zero based index of the file which name should be returned. The index has to be smaller than the amount getFileCount() returns.
//! be returned. The index has to be smaller than the amount getFileCount() returns. \return True if the file is a directory, else false. */
//! \return
//! Returns true, if the file is a directory, and false, if it is not.
//! If an error occurs, the result is undefined.
virtual bool isDirectory(u32 index) const = 0; virtual bool isDirectory(u32 index) const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -25,19 +25,13 @@ class IXMLWriter;
class IAttributes; class IAttributes;
//! The FileSystem manages files and archives and provides access to them. //! The FileSystem manages files and archives and provides access to them.
/** /** It manages where files are, so that modules which use the the IO do not
It manages where files are, so that modules which need to know where every file is located. A file could be in a .zip-Archive or
use the the IO do not need to know where every file is located. A file as file on disk, using the IFileSystem makes no difference to this. */
could be in a .zip-Archive or as file on disk, using the IFileSystem
makes no difference to this.
*/
class IFileSystem : public virtual IReferenceCounted class IFileSystem : public virtual IReferenceCounted
{ {
public: public:
//! destructor
virtual ~IFileSystem() {}
//! Opens a file for read access. //! Opens a file for read access.
/** \param filename: Name of file to open. /** \param filename: Name of file to open.
\return Returns a pointer to the created file interface. \return Returns a pointer to the created file interface.
@ -50,17 +44,17 @@ public:
\param memory: A pointer to the start of the file in memory \param memory: A pointer to the start of the file in memory
\param len: The length of the memory in bytes \param len: The length of the memory in bytes
\param fileName: The name given to this file \param fileName: The name given to this file
\param deleteMemoryWhenDropped: True if the memory should be deleted \param deleteMemoryWhenDropped: True if the memory should be deleted
along with the IReadFile when it is dropped. along with the IReadFile when it is dropped.
\return Returns a pointer to the created file interface. \return Returns a pointer to the created file interface.
The returned pointer should be dropped when no longer needed. The returned pointer should be dropped when no longer needed.
See IReferenceCounted::drop() for more information. See IReferenceCounted::drop() for more information.
*/ */
virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const c8* fileName, bool deleteMemoryWhenDropped=false) = 0; virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const c8* fileName, bool deleteMemoryWhenDropped=false) = 0;
//! Opens a file for write access. //! Opens a file for write access.
/** \param filename: Name of file to open. /** \param filename: Name of file to open.
\param append: If the file already exist, all write operations are \param append: If the file already exist, all write operations are
appended to the file. appended to the file.
\return Returns a pointer to the created file interface. 0 is returned, if the \return Returns a pointer to the created file interface. 0 is returned, if the
file could not created or opened for writing. file could not created or opened for writing.
@ -69,9 +63,9 @@ public:
virtual IWriteFile* createAndWriteFile(const c8* filename, bool append=false) = 0; virtual IWriteFile* createAndWriteFile(const c8* filename, bool append=false) = 0;
//! Adds an zip archive to the file system. //! Adds an zip archive to the file system.
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too. /** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
This is useful for hiding data from the end user, speeding up file access and making it possible to This is useful for hiding data from the end user, speeding up file access and making it possible to
access for example Quake3 .pk3 files, which are nothing different than .zip files. access for example Quake3 .pk3 files, which are nothing different than .zip files.
\param filename: Filename of the zip archive to add to the file system. \param filename: Filename of the zip archive to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without \param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case. writing all letters in the right case.
@ -89,11 +83,11 @@ public:
without its complete path. without its complete path.
\return Returns true if the archive was added successful, false if not. */ \return Returns true if the archive was added successful, false if not. */
virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0; virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
//! Adds an pak archive to the file system. //! Adds an pak archive to the file system.
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too. /** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
This is useful for hiding data from the end user, speeding up file access and making it possible to This is useful for hiding data from the end user, speeding up file access and making it possible to
access for example Quake2/KingPin/Hexen2 .pak files access for example Quake2/KingPin/Hexen2 .pak files
\param filename: Filename of the pak archive to add to the file system. \param filename: Filename of the pak archive to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without \param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case. writing all letters in the right case.
@ -102,23 +96,34 @@ public:
\return Returns true if the archive was added successful, false if not. */ \return Returns true if the archive was added successful, false if not. */
virtual bool addPakFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0; virtual bool addPakFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
//! Returns the string of the current working directory. //! Get the current working directory.
/** \return Current working directory as a string. */
virtual const c8* getWorkingDirectory() = 0; virtual const c8* getWorkingDirectory() = 0;
//! Changes the current Working Directory. //! Changes the current working directory.
/** \param newDirectory: A string specifying the new working directory. /** \param newDirectory: A string specifying the new working directory.
The string is operating system dependent. Under Windows it has The string is operating system dependent. Under Windows it has
the form "<drive>:\<directory>\<sudirectory>\<..>". An example would be: "C:\Windows\" the form "<drive>:\<directory>\<sudirectory>\<..>". An example would be: "C:\Windows\"
\return Returns true if successful, otherwise false. */ \return True if successful, otherwise false. */
virtual bool changeWorkingDirectoryTo(const c8* newDirectory) = 0; virtual bool changeWorkingDirectoryTo(const c8* newDirectory) = 0;
//! Converts a relative path to an absolute (unique) path, resolving symbolic links if required //! Converts a relative path to an absolute (unique) path, resolving symbolic links if required
/** \param filename Possibly relative filename begin queried.
\result Absolute filename which points to the same file. */
virtual core::stringc getAbsolutePath(const core::stringc& filename) const = 0; virtual core::stringc getAbsolutePath(const core::stringc& filename) const = 0;
//! Returns the directory a file is located in. //! Returns the directory a file is located in.
/** \param filename: The file to get the directory from */ /** \param filename: The file to get the directory from.
\return String containing the directory of the file. */
virtual core::stringc getFileDir(const core::stringc& filename) const = 0; virtual core::stringc getFileDir(const core::stringc& filename) const = 0;
//! Returns the base part of a filename, i.e. the name without the directory
//! part. If no directory is prefixed, the full name is returned.
/** \param filename: The file to get the basename from
\param keepExtension True if filename with extension is returned otherwise everything
after the final '.' is removed as well. */
virtual core::stringc getFileBasename(const core::stringc& filename, bool keepExtension=true) const = 0;
//! Creates a list of files and directories in the current working directory and returns it. //! Creates a list of files and directories in the current working directory and returns it.
/** \return a Pointer to the created IFileList is returned. After the list has been used /** \return a Pointer to the created IFileList is returned. After the list has been used
it has to be deleted using its IFileList::drop() method. it has to be deleted using its IFileList::drop() method.
@ -130,6 +135,11 @@ public:
\return Returns true if file exists, and false if it does not exist or an error occured. */ \return Returns true if file exists, and false if it does not exist or an error occured. */
virtual bool existFile(const c8* filename) const = 0; virtual bool existFile(const c8* filename) const = 0;
//! Determines if a file exists and could be opened.
/** \param filename is the string identifying the file which should be tested for existence.
\return Returns true if file exists, and false if it does not exist or an error occured. */
virtual bool existFile(const core::stringc& filename) const = 0;
//! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*). //! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
/** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for /** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
more information on how to use the parser. more information on how to use the parser.
@ -183,7 +193,7 @@ public:
//! Creates a new empty collection of attributes, usable for serialization and more. //! Creates a new empty collection of attributes, usable for serialization and more.
/** \param driver: Video driver to be used to load textures when specified as attribute values. /** \param driver: Video driver to be used to load textures when specified as attribute values.
Can be null to prevent automatic texture loading by attributes. Can be null to prevent automatic texture loading by attributes.
\return Returns a pointer to the created object. \return Pointer to the created object.
If you no longer need the object, you should call IAttributes::drop(). If you no longer need the object, you should call IAttributes::drop().
See IReferenceCounted::drop() for more information. */ See IReferenceCounted::drop() for more information. */
virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) = 0; virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -16,13 +16,13 @@ namespace io
class IReadFile; class IReadFile;
} // end namespace io } // end namespace io
namespace video namespace video
{ {
class IVideoDriver; class IVideoDriver;
class IShaderConstantSetCallBack; class IShaderConstantSetCallBack;
//! Compile target enumeration for the addHighLevelShaderMaterial() method. //! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_VERTEX_SHADER_TYPE enum E_VERTEX_SHADER_TYPE
{ {
EVST_VS_1_1 = 0, EVST_VS_1_1 = 0,
@ -42,12 +42,12 @@ const c8* const VERTEX_SHADER_TYPE_NAMES[] = {
"vs_3_0", "vs_3_0",
0 }; 0 };
//! Compile target enumeration for the addHighLevelShaderMaterial() method. //! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_PIXEL_SHADER_TYPE enum E_PIXEL_SHADER_TYPE
{ {
EPST_PS_1_1 = 0, EPST_PS_1_1 = 0,
EPST_PS_1_2, EPST_PS_1_2,
EPST_PS_1_3, EPST_PS_1_3,
EPST_PS_1_4, EPST_PS_1_4,
EPST_PS_2_0, EPST_PS_2_0,
EPST_PS_2_a, EPST_PS_2_a,
@ -60,7 +60,7 @@ enum E_PIXEL_SHADER_TYPE
//! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry. //! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry.
const c8* const PIXEL_SHADER_TYPE_NAMES[] = { const c8* const PIXEL_SHADER_TYPE_NAMES[] = {
"ps_1_1", "ps_1_1",
"ps_1_2", "ps_1_2",
"ps_1_3", "ps_1_3",
"ps_1_4", "ps_1_4",
@ -70,195 +70,229 @@ const c8* const PIXEL_SHADER_TYPE_NAMES[] = {
"ps_3_0", "ps_3_0",
0 }; 0 };
//! Interface making it possible to create and use programs running on the GPU. //! Interface making it possible to create and use programs running on the GPU.
class IGPUProgrammingServices class IGPUProgrammingServices
{ {
public: public:
//! destructor //! Destructor
virtual ~IGPUProgrammingServices() {} virtual ~IGPUProgrammingServices() {}
//! Adds a new material renderer to the VideoDriver, based on a high level shading //! Adds a new high-level shading material renderer to the VideoDriver.
//! language. Currently only HLSL/D3D9 and GLSL/OpenGL is supported. /** Currently only HLSL/D3D9 and GLSL/OpenGL are supported.
//! \param vertexShaderProgram: String containing the source of the vertex shader program. \param vertexShaderProgram: String containing the source of the vertex
//! This can be 0 if no vertex program shall be used. shader program. This can be 0 if no vertex program shall be used.
//! \param vertexShaderEntryPointName: Name of the entry function of the vertexShaderProgram \param vertexShaderEntryPointName: Name of the entry function of the
//! \param vsCompileTarget: Vertex shader version where the high level shader shall be compiled to. vertexShaderProgram
//! \param pixelShaderProgram: String containing the source of the pixel shader program. \param vsCompileTarget: Vertex shader version where the high level
//! This can be 0 if no pixel shader shall be used. shader shall be compiled to.
//! \param pixelShaderEntryPointName: Entry name of the function of the pixelShaderEntryPointName \param pixelShaderProgram: String containing the source of the pixel
//! \param psCompileTarget: Pixel shader version where the high level shader shall be compiled to. shader program. This can be 0 if no pixel shader shall be used.
//! \param callback: Pointer to an implementation of IShaderConstantSetCallBack in which you \param pixelShaderEntryPointName: Entry name of the function of the
//! can set the needed vertex and pixel shader program constants. Set this to 0 if you don't need this. pixelShaderEntryPointName
//! \param baseMaterial: Base material which renderstates will be used to shade the \param psCompileTarget: Pixel shader version where the high level
//! material. shader shall be compiled to.
//! \param userData: a user data int. This int can be set to any value and will be set as parameter \param callback: Pointer to an implementation of
//! in the callback method when calling OnSetConstants(). In this way it is easily possible to IShaderConstantSetCallBack in which you can set the needed vertex and
//! use the same callback method for multiple materials and distinguish between them during the call. pixel shader program constants. Set this to 0 if you don't need this.
//! \return Returns the number of the \param baseMaterial: Base material which renderstates will be used to
//! material type which can be set in SMaterial::MaterialType to use the renderer. shade the material.
//! -1 is returned if an error occured, e.g. if a vertex or pixel shader \param userData: a user data int. This int can be set to any value and
//! program could not be compiled or a compile target is not reachable. will be set as parameter in the callback method when calling
//! The error strings are then printed to the error log and OnSetConstants(). In this way it is easily possible to use the same
//! can be catched with a custom event receiver. callback method for multiple materials and distinguish between them
virtual s32 addHighLevelShaderMaterial( during the call.
\return Returns the number of the material type which can be set in
SMaterial::MaterialType to use the renderer. -1 is returned if an
error occured, e.g. if a vertex or pixel shader program could not be
compiled or a compile target is not reachable. The error strings are
then printed to the error log and can be catched with a custom event
receiver. */
virtual s32 addHighLevelShaderMaterial(
const c8* vertexShaderProgram, const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main", const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const c8* pixelShaderProgram = 0, const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main", const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0, IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0 ) = 0; s32 userData = 0 ) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(), //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
//! but tries to load the programs from files. /** \param vertexShaderProgram: Text file containing the source of the
//! \param vertexShaderProgram: Text file containing the source of the vertex shader program. * vertex shader program.
//! Set to 0 if no shader shall be created. Set to 0 if no shader shall be created.
//! \param vertexShaderEntryPointName: Name of the entry function of the vertexShaderProgram \param vertexShaderEntryPointName: Name of the entry function of the
//! \param vsCompileTarget: Vertex shader version where the high level shader shall be compiled to. vertexShaderProgram
//! \param pixelShaderProgram: Text file containing the source of the pixel shader program. Set to \param vsCompileTarget: Vertex shader version where the high level
//! 0 if no shader shall be created. shader shall be compiled to.
//! \param vertexShaderEntryPointName: Name of the entry function of the vertexShaderProgram \param pixelShaderProgram: Text file containing the source of the pixel
//! \param vsCompileTarget: Vertex shader version where the high level shader shall be compiled to. shader program. Set to 0 if no shader shall be created.
//! \param pixelShaderProgram: String containing the source of the pixel shader program. \param vertexShaderEntryPointName: Name of the entry function of the
//! This can be 0 if no pixel shader shall be used. vertexShaderProgram
//! \param pixelShaderEntryPointName: Entry name of the function of the pixelShaderEntryPointName \param vsCompileTarget: Vertex shader version where the high level
//! \param psCompileTarget: Pixel shader version where the high level shader shall be compiled to. shader shall be compiled to.
//! \param callback: Pointer to an implementation of IShaderConstantSetCallBack in which you \param pixelShaderProgram: String containing the source of the pixel
//! can set the needed vertex and pixel shader program constants. Set this to 0 if you don't need this. shader program. This can be 0 if no pixel shader shall be used.
//! \param baseMaterial: Base material which renderstates will be used to shade the \param pixelShaderEntryPointName: Entry name of the function of the
//! material. pixelShaderEntryPointName
//! \param userData: a user data int. This int can be set to any value and will be set as parameter \param psCompileTarget: Pixel shader version where the high level
//! in the callback method when calling OnSetConstants(). In this way it is easily possible to shader shall be compiled to.
//! use the same callback method for multiple materials and distinguish between them during the call. \param callback: Pointer to an implementation of
//! \return Returns the number of the IShaderConstantSetCallBack in which you can set the needed vertex and
//! material type which can be set in SMaterial::MaterialType to use the renderer. pixel shader program constants. Set this to 0 if you don't need this.
//! -1 is returned if an error occured, e.g. if a vertex or pixel shader \param baseMaterial: Base material which renderstates will be used to
//! program could not be compiled or a compile target is not reachable. shade the material.
//! The error strings are then printed to the error log and \param userData: a user data int. This int can be set to any value and
//! can be catched with a custom event receiver. will be set as parameter in the callback method when calling
OnSetConstants(). In this way it is easily possible to use the same
callback method for multiple materials and distinguish between them
during the call.
\return Returns the number of the material type which can be set in
SMaterial::MaterialType to use the renderer. -1 is returned if an
error occured, e.g. if a vertex or pixel shader program could not be
compiled or a compile target is not reachable. The error strings are
then printed to the error log and can be catched with a custom event
receiver. */
virtual s32 addHighLevelShaderMaterialFromFiles( virtual s32 addHighLevelShaderMaterialFromFiles(
const c8* vertexShaderProgram, const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main", const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const c8* pixelShaderProgram = 0, const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main", const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0, IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(),
//! but tries to load the programs from files.
//! \param vertexShaderProgram: Text file handle containing the source of the vertex shader program.
//! Set to 0 if no shader shall be created.
//! \param vertexShaderEntryPointName: Name of the entry function of the vertexShaderProgram
//! \param vsCompileTarget: Vertex shader version where the high level shader shall be compiled to.
//! \param pixelShaderProgram: Text file containing the source of the pixel shader program. Set to
//! \param pixelShaderProgram: Text file handle containing the source of the pixel shader program. Set to
//! 0 if no shader shall be created.
//! \param pixelShaderEntryPointName: Entry name of the function of the pixelShaderEntryPointName
//! \param psCompileTarget: Pixel shader version where the high level shader shall be compiled to.
//! \param callback: Pointer to an implementation of IShaderConstantSetCallBack in which you
//! can set the needed vertex and pixel shader program constants. Set this to 0 if you don't need this.
//! \param baseMaterial: Base material which renderstates will be used to shade the
//! material.
//! \param userData: a user data int. This int can be set to any value and will be set as parameter
//! in the callback method when calling OnSetConstants(). In this way it is easily possible to
//! use the same callback method for multiple materials and distinguish between them during the call.
//! \return Returns the number of the
//! material type which can be set in SMaterial::MaterialType to use the renderer.
//! -1 is returned if an error occured, e.g. if a vertex or pixel shader
//! program could not be compiled or a compile target is not reachable.
//! The error strings are then printed to the error log and
//! can be catched with a custom event receiver.
virtual s32 addHighLevelShaderMaterialFromFiles(
io::IReadFile* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
io::IReadFile* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Adds a new material renderer to the VideoDriver, using pixel and/or
//! vertex shaders to render geometry.
//! Note that it is a good idea to call IVideoDriver::queryFeature() before to check
//! if the IVideoDriver supports the vertex and/or pixel shader version your are using.
//! The material is added to the VideoDriver like with IVideoDriver::addMaterialRenderer()
//! and can be used like it had been added with that method.
//! \param vertexShaderProgram: String containing the source of the vertex shader program. This can be
//! 0 if no vertex program shall be used.
//! For DX8 programs, the will always input registers look like this:
//! v0: position, v1: normal,
//! v2: color, v3: texture cooridnates, v4: texture coordinates 2 if available.
//! For DX9 programs, you can manually set the registers using the dcl_ statements.
//! \param pixelShaderProgram: String containing the source of the pixel shader program.
//! This can be 0 if you don't want to use a pixel shader.
//! \param callback: Pointer to an implementation of IShaderConstantSetCallBack in which you
//! can set the needed vertex and pixel shader program constants. Set this to 0 if you don't need this.
//! \param baseMaterial: Base material which renderstates will be used to shade the
//! material.
//! \param userData: a user data int. This int can be set to any value and will be set as parameter
//! in the callback method when calling OnSetConstants(). In this way it is easily possible to
//! use the same callback method for multiple materials and distinguish between them during the call.
//! \return Returns the number of the
//! material type which can be set in SMaterial::MaterialType to use the renderer.
//! -1 is returned if an error occured. -1 is returned for example if a vertex or pixel shader
//! program could not be compiled, the error strings are then printed out into the error log, and
//! can be catched with a custom event receiver.
virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0,
const c8* pixelShaderProgram = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0; s32 userData = 0) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
//! programs from files. //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
//! \param vertexShaderProgram: Text file containing the source of the vertex shader program. /** \param vertexShaderProgram: Text file handle containing the source
//! Set to 0 if no shader shall be created. * of the vertex shader program.
//! \param pixelShaderProgram: Text file containing the source of the pixel shader program. Set to Set to 0 if no shader shall be created.
//! 0 if no shader shall be created. \param vertexShaderEntryPointName: Name of the entry function of the
//! \param callback: Pointer to an IShaderConstantSetCallback object to which the vertexShaderProgram
//! OnSetConstants function is called. \param vsCompileTarget: Vertex shader version where the high level
//! \param baseMaterial: baseMaterial shader shall be compiled to.
//! \param userData: a user data int. This int can be set to any value and will be set as parameter \param pixelShaderProgram: Text file containing the source of the pixel
//! in the callback method when calling OnSetConstants(). In this way it is easily possible to shader program. Set to
//! use the same callback method for multiple materials and distinguish between them during the call. \param pixelShaderProgram: Text file handle containing the source of
//! \return Returns the number of the the pixel shader program. Set to 0 if no shader shall be created.
//! material type which can be set in SMaterial::MaterialType to use the renderer. \param pixelShaderEntryPointName: Entry name of the function of the
//! -1 is returned if an error occured. -1 is returned for example if a vertex or pixel shader pixelShaderEntryPointName
//! program could not be compiled, the error strings are then printed out into the error log, and \param psCompileTarget: Pixel shader version where the high level
//! can be catched with a custom event receiver. shader shall be compiled to.
\param callback: Pointer to an implementation of
IShaderConstantSetCallBack in which you can set the needed vertex and
pixel shader program constants. Set this to 0 if you don't need this.
\param baseMaterial: Base material which renderstates will be used to
shade the material.
\param userData: a user data int. This int can be set to any value and
will be set as parameter in the callback method when calling
OnSetConstants(). In this way it is easily possible to use the same
callback method for multiple materials and distinguish between them
during the call.
\return Returns the number of the material type which can be set in
SMaterial::MaterialType to use the renderer. -1 is returned if an
error occured, e.g. if a vertex or pixel shader program could not be
compiled or a compile target is not reachable. The error strings are
then printed to the error log and can be catched with a custom event
receiver. */
virtual s32 addHighLevelShaderMaterialFromFiles(
io::IReadFile* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
io::IReadFile* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Adds a new ASM shader material renderer to the VideoDriver
/** Note that it is a good idea to call IVideoDriver::queryFeature() in
advance to check if the IVideoDriver supports the vertex and/or pixel
shader version your are using.
The material is added to the VideoDriver like with
IVideoDriver::addMaterialRenderer() and can be used like it had been
added with that method.
\param vertexShaderProgram: String containing the source of the vertex
shader program. This can be 0 if no vertex program shall be used.
For DX8 programs, the will always input registers look like this: v0:
position, v1: normal, v2: color, v3: texture cooridnates, v4: texture
coordinates 2 if available.
For DX9 programs, you can manually set the registers using the dcl_
statements.
\param pixelShaderProgram: String containing the source of the pixel
shader program. This can be 0 if you don't want to use a pixel shader.
\param callback: Pointer to an implementation of
IShaderConstantSetCallBack in which you can set the needed vertex and
pixel shader program constants. Set this to 0 if you don't need this.
\param baseMaterial: Base material which renderstates will be used to
shade the material.
\param userData: a user data int. This int can be set to any value and
will be set as parameter in the callback method when calling
OnSetConstants(). In this way it is easily possible to use the same
callback method for multiple materials and distinguish between them
during the call.
\return Returns the number of the material type which can be set in
SMaterial::MaterialType to use the renderer. -1 is returned if an
error occured. -1 is returned for example if a vertex or pixel shader
program could not be compiled, the error strings are then printed out
into the error log, and can be catched with a custom event receiver. */
virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0,
const c8* pixelShaderProgram = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
/** \param vertexShaderProgram: Text file containing the source of the
vertex shader program. Set to 0 if no shader shall be created.
\param pixelShaderProgram: Text file containing the source of the pixel
shader program. Set to 0 if no shader shall be created.
\param callback: Pointer to an IShaderConstantSetCallback object to
which the OnSetConstants function is called.
\param baseMaterial: baseMaterial
\param userData: a user data int. This int can be set to any value and
will be set as parameter in the callback method when calling
OnSetConstants(). In this way it is easily possible to use the same
callback method for multiple materials and distinguish between them
during the call.
\return Returns the number of the material type which can be set in
SMaterial::MaterialType to use the renderer. -1 is returned if an
error occured. -1 is returned for example if a vertex or pixel shader
program could not be compiled, the error strings are then printed out
into the error log, and can be catched with a custom event receiver. */
virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram, virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram,
io::IReadFile* pixelShaderProgram, io::IReadFile* pixelShaderProgram,
IShaderConstantSetCallBack* callback = 0, IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0; s32 userData = 0) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
//! programs from files. /** \param vertexShaderProgramFileName: Text file name containing the
//! \param vertexShaderProgramFileName: Text file name containing the source of the source of the vertex shader program. Set to 0 if no shader shall be
//! vertex shader program. created.
//! Set to 0 if no shader shall be created. \param pixelShaderProgramFileName: Text file name containing the source
//! \param pixelShaderProgramFileName: Text file name containing the source of the of the pixel shader program. Set to 0 if no shader shall be created.
//! pixel shader program. Set to 0 if no shader shall be created. \param callback: Pointer to an IShaderConstantSetCallback object on
//! \param callback: Pointer to an IShaderConstantSetCallback object on which the which the OnSetConstants function is called.
//! OnSetConstants function is called. \param baseMaterial: baseMaterial
//! \param baseMaterial: baseMaterial \param userData: a user data int. This int can be set to any value and
//! \param userData: a user data int. This int can be set to any value and will be set as parameter will be set as parameter in the callback method when calling
//! in the callback method when calling OnSetConstants(). In this way it is easily possible to OnSetConstants(). In this way it is easily possible to use the same
//! use the same callback method for multiple materials and distinguish between them during the call. callback method for multiple materials and distinguish between them
//! \return Returns the number of the during the call.
//! material type which can be set in SMaterial::MaterialType to use the renderer. \return Returns the number of the material type which can be set in
//! -1 is returned if an error occured. -1 is returned for example if a vertex or pixel shader SMaterial::MaterialType to use the renderer. -1 is returned if an
//! program could not be compiled, the error strings are then printed out into the error log, and error occured. -1 is returned for example if a vertex or pixel shader
//! can be catched with a custom event receiver. program could not be compiled, the error strings are then printed out
into the error log, and can be catched with a custom event receiver. */
virtual s32 addShaderMaterialFromFiles(const c8* vertexShaderProgramFileName, virtual s32 addShaderMaterialFromFiles(const c8* vertexShaderProgramFileName,
const c8* pixelShaderProgramFileName, const c8* pixelShaderProgramFileName,
IShaderConstantSetCallBack* callback = 0, IShaderConstantSetCallBack* callback = 0,

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -60,32 +60,29 @@ namespace gui
IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIButton() {}
//! Sets another skin independent font. //! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin. /** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */ \param font: New font to set. */
virtual void setOverrideFont(IGUIFont* font=0) = 0; virtual void setOverrideFont(IGUIFont* font=0) = 0;
//! Sets an image which should be displayed on the button when it is in normal state. //! Sets an image which should be displayed on the button when it is in normal state.
/** \param image: Image to be displayed */ /** \param image: Image to be displayed */
virtual void setImage(video::ITexture* image) = 0; virtual void setImage(video::ITexture* image) = 0;
//! Sets a background image for the button when it is in normal state. //! Sets a background image for the button when it is in normal state.
/** \param image: Texture containing the image to be displayed /** \param image: Texture containing the image to be displayed
\param pos: Position in the texture, where the image is located */ \param pos: Position in the texture, where the image is located */
virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) = 0; virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
//! Sets a background image for the button when it is in pressed state. //! Sets a background image for the button when it is in pressed state.
/** If no images is specified for the pressed state via /** If no images is specified for the pressed state via
setPressedImage(), this image is also drawn in pressed state. setPressedImage(), this image is also drawn in pressed state.
\param image: Image to be displayed */ \param image: Image to be displayed */
virtual void setPressedImage(video::ITexture* image) = 0; virtual void setPressedImage(video::ITexture* image) = 0;
//! Sets an image which should be displayed on the button when it is in pressed state. //! Sets an image which should be displayed on the button when it is in pressed state.
/** \param image: Texture containing the image to be displayed /** \param image: Texture containing the image to be displayed
\param pos: Position in the texture, where the image is located */ \param pos: Position in the texture, where the image is located */
virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) = 0; virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
//! Sets the sprite bank used by the button //! Sets the sprite bank used by the button
@ -98,10 +95,10 @@ namespace gui
\param color: The color of the sprite \param color: The color of the sprite
\param loop: True if the animation should loop, false if not \param loop: True if the animation should loop, false if not
*/ */
virtual void setSprite(EGUI_BUTTON_STATE state, s32 index, virtual void setSprite(EGUI_BUTTON_STATE state, s32 index,
video::SColor color=video::SColor(255,255,255,255), bool loop=false) = 0; video::SColor color=video::SColor(255,255,255,255), bool loop=false) = 0;
//! Sets if the button should behave like a push button. //! Sets if the button should behave like a push button.
/** Which means it can be in two states: Normal or Pressed. With a click on the button, /** Which means it can be in two states: Normal or Pressed. With a click on the button,
the user can change the state of the button. */ the user can change the state of the button. */
virtual void setIsPushButton(bool isPushButton) = 0; virtual void setIsPushButton(bool isPushButton) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,9 +21,6 @@ namespace gui
IGUICheckBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUICheckBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUICheckBox() {}
//! Set if box is checked. //! Set if box is checked.
virtual void setChecked(bool checked) = 0; virtual void setChecked(bool checked) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -20,9 +20,6 @@ namespace gui
//! constructor //! constructor
IGUIColorSelectDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIColorSelectDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_COLOR_SELECT_DIALOG, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_COLOR_SELECT_DIALOG, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIColorSelectDialog() {}
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,6 +11,7 @@ namespace irr
{ {
namespace gui namespace gui
{ {
//! Combobox widget //! Combobox widget
class IGUIComboBox : public IGUIElement class IGUIComboBox : public IGUIElement
{ {
@ -20,9 +21,6 @@ namespace gui
IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIComboBox() {}
//! Returns amount of items in box //! Returns amount of items in box
virtual u32 getItemCount() const = 0; virtual u32 getItemCount() const = 0;
@ -33,8 +31,8 @@ namespace gui
virtual u32 addItem(const wchar_t* text) = 0; virtual u32 addItem(const wchar_t* text) = 0;
//! Removes an item from the combo box. //! Removes an item from the combo box.
/** Warning. This will change the IDs of all following items */ /** Warning. This will change the index of all following items */
virtual void removeItem(u32 id) = 0; virtual void removeItem(u32 idx) = 0;
//! Deletes all items in the combo box //! Deletes all items in the combo box
virtual void clear() = 0; virtual void clear() = 0;
@ -43,7 +41,14 @@ namespace gui
virtual s32 getSelected() const = 0; virtual s32 getSelected() const = 0;
//! Sets the selected item. Set this to -1 if no item should be selected //! Sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id) = 0; virtual void setSelected(s32 idx) = 0;
//! Sets text justification of the text area
/** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
\param vertical: EGUIA_UPPERLEFT to align with top edge,
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,27 +21,22 @@ namespace gui
IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIContextMenu() {};
//! Get amount of menu items //! Get amount of menu items
virtual u32 getItemCount() const = 0; virtual u32 getItemCount() const = 0;
//! Adds a menu item. //! Adds a menu item.
/** \param text: Text of menu item. Set this to 0 to create /** \param text: Text of menu item. Set this to 0 to create
an separator instead of a real item, which is the same like an separator instead of a real item, which is the same like
calling addSeparator(); calling addSeparator();
\param commandId: Command id of menu item, a simple id you may \param commandId: Command id of menu item, a simple id you may
set to whatever you want. set to whatever you want.
\param enabled: Specifies if the menu item should be enabled. \param enabled: Specifies if the menu item should be enabled.
\param hasSubMenu: Set this to true if there should be a submenu \param hasSubMenu: Set this to true if there should be a submenu
at this item. You can acess this submenu via getSubMenu(). at this item. You can acess this submenu via getSubMenu().
\param checked: Specifies if the menu item should be initially checked. \param checked: Specifies if the menu item should be initially checked.
\return Returns the index of the new item */ \return Returns the index of the new item */
virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true, virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
bool hasSubMenu=false, bool hasSubMenu=false, bool checked=false) = 0;
bool checked=false
) = 0;
//! Adds a separator item to the menu //! Adds a separator item to the menu
virtual void addSeparator() = 0; virtual void addSeparator() = 0;
@ -52,7 +47,7 @@ namespace gui
//! Sets text of the menu item. //! Sets text of the menu item.
/** \param idx: Zero based index of the menu item /** \param idx: Zero based index of the menu item
\param text: New text of the item. */ \param text: New text of the item. */
virtual void setItemText(u32 idx, const wchar_t* text) = 0; virtual void setItemText(u32 idx, const wchar_t* text) = 0;
//! Check if a menu item is enabled //! Check if a menu item is enabled
@ -61,12 +56,12 @@ namespace gui
//! Sets if the menu item should be enabled. //! Sets if the menu item should be enabled.
/** \param idx: Zero based index of the menu item /** \param idx: Zero based index of the menu item
\param enabled: True if it is enabled, otherwise false. */ \param enabled: True if it is enabled, otherwise false. */
virtual void setItemEnabled(u32 idx, bool enabled) = 0; virtual void setItemEnabled(u32 idx, bool enabled) = 0;
//! Sets if the menu item should be checked. //! Sets if the menu item should be checked.
/** \param idx: Zero based index of the menu item /** \param idx: Zero based index of the menu item
\param enabled: True if it is enabled, otherwise false. */ \param enabled: True if it is enabled, otherwise false. */
virtual void setItemChecked(u32 idx, bool enabled) = 0; virtual void setItemChecked(u32 idx, bool enabled) = 0;
//! Check if a menu item is checked //! Check if a menu item is checked
@ -90,14 +85,14 @@ namespace gui
//! Sets the command id of a menu item //! Sets the command id of a menu item
/** \param idx: Zero based index of the menu item /** \param idx: Zero based index of the menu item
\param id: Command id of menu item, a simple id you may \param id: Command id of menu item, a simple id you may
set to whatever you want. */ set to whatever you want. */
virtual void setItemCommandId(u32 idx, s32 id) = 0; virtual void setItemCommandId(u32 idx, s32 id) = 0;
//! Get a pointer to the submenu of an item. //! Get a pointer to the submenu of an item.
/** 0 is returned if there is no submenu /** 0 is returned if there is no submenu
\param idx: Zero based index of the menu item \param idx: Zero based index of the menu item
\return Returns a pointer to the submenu of an item. */ \return Returns a pointer to the submenu of an item. */
virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0; virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -23,28 +23,25 @@ namespace gui
IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIEditBox() {};
//! Sets another skin independent font. //! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin. /** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */ \param font: New font to set. */
virtual void setOverrideFont(IGUIFont* font=0) = 0; virtual void setOverrideFont(IGUIFont* font=0) = 0;
//! Sets another color for the text. //! Sets another color for the text.
/** If set, the edit box does not use the EGDC_BUTTON_TEXT color defined /** If set, the edit box does not use the EGDC_BUTTON_TEXT color defined
in the skin, but the set color instead. You don't need to call in the skin, but the set color instead. You don't need to call
IGUIEditBox::enableOverrrideColor(true) after this, this is done IGUIEditBox::enableOverrrideColor(true) after this, this is done
by this function. by this function.
If you set a color, and you want the text displayed with the color If you set a color, and you want the text displayed with the color
of the skin again, call IGUIEditBox::enableOverrideColor(false); of the skin again, call IGUIEditBox::enableOverrideColor(false);
\param color: New color of the text. */ \param color: New color of the text. */
virtual void setOverrideColor(video::SColor color) = 0; virtual void setOverrideColor(video::SColor color) = 0;
//! Sets if the text should use the overide color or the color in the gui skin. //! Sets if the text should use the overide color or the color in the gui skin.
/** \param enable: If set to true, the override color, which can be set /** \param enable: If set to true, the override color, which can be set
with IGUIEditBox::setOverrideColor is used, otherwise the with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */ EGDC_BUTTON_TEXT color of the skin. */
virtual void enableOverrideColor(bool enable) = 0; virtual void enableOverrideColor(bool enable) = 0;
//! Turns the border on or off //! Turns the border on or off
@ -52,19 +49,19 @@ namespace gui
virtual void setDrawBorder(bool border) = 0; virtual void setDrawBorder(bool border) = 0;
//! Sets text justification mode //! Sets text justification mode
/** \param horizontal: EGUIA_UPPERLEFT for left justified (default), /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text. EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
\param vertical: EGUIA_UPPERLEFT to align with top edge, \param vertical: EGUIA_UPPERLEFT to align with top edge,
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */ EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0; virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
//! Enables or disables word wrap. //! Enables or disables word wrap.
/** \param enable: If set to true, words going over one line are /** \param enable: If set to true, words going over one line are
broken to the next line. */ broken to the next line. */
virtual void setWordWrap(bool enable) = 0; virtual void setWordWrap(bool enable) = 0;
//! Checks if word wrap is enabled //! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise /** \return true if word wrap is enabled, false otherwise */
virtual bool isWordWrapEnabled() const = 0; virtual bool isWordWrapEnabled() const = 0;
//! Enables or disables newlines. //! Enables or disables newlines.
@ -73,18 +70,18 @@ namespace gui
virtual void setMultiLine(bool enable) = 0; virtual void setMultiLine(bool enable) = 0;
//! Checks if multi line editing is enabled //! Checks if multi line editing is enabled
//! \return true if mult-line is enabled, false otherwise /** \return true if mult-line is enabled, false otherwise */
virtual bool isMultiLineEnabled() const = 0; virtual bool isMultiLineEnabled() const = 0;
//! Enables or disables automatic scrolling with cursor position //! Enables or disables automatic scrolling with cursor position
//! \param enable: If set to true, the text will move around with the cursor position /** \param enable: If set to true, the text will move around with the cursor position */
virtual void setAutoScroll(bool enable) = 0; virtual void setAutoScroll(bool enable) = 0;
//! Checks to see if automatic scrolling is enabled //! Checks to see if automatic scrolling is enabled
//! \return true if automatic scrolling is enabled, false if not /** \return true if automatic scrolling is enabled, false if not */
virtual bool isAutoScrollEnabled() const = 0; virtual bool isAutoScrollEnabled() const = 0;
//! Sets whether the edit box is a password box. Setting this to true will //! Sets whether the edit box is a password box. Setting this to true will
/** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x /** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x
\param passwordBox: true to enable password, false to disable \param passwordBox: true to enable password, false to disable
\param passwordChar: the character that is displayed instead of letters */ \param passwordChar: the character that is displayed instead of letters */
@ -94,12 +91,12 @@ namespace gui
virtual bool isPasswordBox() const = 0; virtual bool isPasswordBox() const = 0;
//! Gets the size area of the text in the edit box //! Gets the size area of the text in the edit box
//! \return Returns the size in pixels of the text /** \return The size in pixels of the text */
virtual core::dimension2di getTextDimension() = 0; virtual core::dimension2di getTextDimension() = 0;
//! Sets the maximum amount of characters which may be entered in the box. //! Sets the maximum amount of characters which may be entered in the box.
/** \param max: Maximum amount of characters. If 0, the character amount is /** \param max: Maximum amount of characters. If 0, the character amount is
infinity. */ infinity. */
virtual void setMax(u32 max) = 0; virtual void setMax(u32 max) = 0;
//! Returns maximum amount of characters, previously set by setMax(); //! Returns maximum amount of characters, previously set by setMax();

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,6 +11,7 @@
#include "irrString.h" #include "irrString.h"
#include "IEventReceiver.h" #include "IEventReceiver.h"
#include "EGUIElementTypes.h" #include "EGUIElementTypes.h"
#include "EGUIAlignment.h"
#include "IAttributes.h" #include "IAttributes.h"
namespace irr namespace irr
@ -20,28 +21,6 @@ namespace gui
class IGUIEnvironment; class IGUIEnvironment;
enum EGUI_ALIGNMENT
{
//! Aligned to parent's top or left side (default)
EGUIA_UPPERLEFT=0,
//! Aligned to parent's bottom or right side
EGUIA_LOWERRIGHT,
//! Aligned to the center of parent
EGUIA_CENTER,
//! Scaled within its parent
EGUIA_SCALE
};
//! Names for alignments
const c8* const GUIAlignmentNames[] =
{
"upperLeft",
"lowerRight",
"center",
"scale",
0
};
//! Base class of all GUI elements. //! Base class of all GUI elements.
class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver
{ {
@ -104,6 +83,7 @@ public:
//! Sets the relative rectangle of this element. //! Sets the relative rectangle of this element.
/** \param r The absolute position to set */
void setRelativePosition(const core::rect<s32>& r) void setRelativePosition(const core::rect<s32>& r)
{ {
if (Parent) if (Parent)
@ -126,19 +106,33 @@ public:
updateAbsolutePosition(); updateAbsolutePosition();
} }
//! Sets the relative rectangle of this element, maintaining its current width and height
/** \param position The new relative position to set. Width and height will not be changed. */
void setRelativePosition(const core::position2di & position)
{
const core::dimension2di mySize = RelativeRect.getSize();
const core::rect<s32> rectangle(position.X, position.Y,
position.X + mySize.Width, position.Y + mySize.Height);
setRelativePosition(rectangle);
}
//! Sets the relative rectangle of this element.
void setRelativePosition(const core::rect<f32>& r) //! Sets the relative rectangle of this element as a proportion of its parent's area.
/** \note This method used to be 'void setRelativePosition(const core::rect<f32>& r)'
\param r The rectangle to set, interpreted as a proportion of the parent's area.
Meaningful values are in the range [0...1], unless you intend this element to spill
outside its parent. */
void setRelativePositionProportional(const core::rect<f32>& r)
{ {
if (!Parent) if (!Parent)
return; return;
const core::dimension2di& d = Parent->getAbsolutePosition().getSize(); const core::dimension2di& d = Parent->getAbsolutePosition().getSize();
DesiredRect = core::rect<s32>( DesiredRect = core::rect<s32>(
core::floor32((f32)d.Width * r.UpperLeftCorner.X), core::floor32((f32)d.Width * r.UpperLeftCorner.X),
core::floor32((f32)d.Height * r.UpperLeftCorner.Y), core::floor32((f32)d.Height * r.UpperLeftCorner.Y),
core::floor32((f32)d.Width * r.LowerRightCorner.X), core::floor32((f32)d.Width * r.LowerRightCorner.X),
core::floor32((f32)d.Height * r.LowerRightCorner.Y)); core::floor32((f32)d.Height * r.LowerRightCorner.Y));
ScaleRect = r; ScaleRect = r;
@ -147,7 +141,7 @@ public:
} }
//! Returns the absolute rectangle of element. //! Gets the absolute rectangle of this element
core::rect<s32> getAbsolutePosition() const core::rect<s32> getAbsolutePosition() const
{ {
return AbsoluteRect; return AbsoluteRect;
@ -162,6 +156,7 @@ public:
//! Sets whether the element will ignore its parent's clipping rectangle //! Sets whether the element will ignore its parent's clipping rectangle
/** \param noClip If true, the element will not be clipped by its parent's clipping rectangle. */
void setNotClipped(bool noClip) void setNotClipped(bool noClip)
{ {
NoClip = noClip; NoClip = noClip;
@ -169,6 +164,7 @@ public:
//! Gets whether the element will ignore its parent's clipping rectangle //! Gets whether the element will ignore its parent's clipping rectangle
/** \return true if the element is not clipped by its parent's clipping rectangle. */
bool isNotClipped() const bool isNotClipped() const
{ {
return NoClip; return NoClip;
@ -206,7 +202,7 @@ public:
if (Parent) if (Parent)
{ {
core::rect<s32> r(Parent->getAbsolutePosition()); core::rect<s32> r(Parent->getAbsolutePosition());
core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height); core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
if (AlignLeft == EGUIA_SCALE) if (AlignLeft == EGUIA_SCALE)
@ -226,7 +222,6 @@ public:
{ {
core::rect<s32> parentAbsolute(0,0,0,0); core::rect<s32> parentAbsolute(0,0,0,0);
core::rect<s32> parentAbsoluteClip; core::rect<s32> parentAbsoluteClip;
s32 diffx, diffy;
f32 fw=0.f, fh=0.f; f32 fw=0.f, fh=0.f;
if (Parent) if (Parent)
@ -236,28 +231,23 @@ public:
if (NoClip) if (NoClip)
{ {
IGUIElement* p=this; IGUIElement* p=this;
while (p && p->NoClip && p->Parent) while (p && p->Parent)
p = p->Parent; p = p->Parent;
if (p->Parent) parentAbsoluteClip = p->AbsoluteClippingRect;
parentAbsoluteClip = p->Parent->AbsoluteClippingRect;
else
parentAbsoluteClip = p->AbsoluteClippingRect;
} }
else else
parentAbsoluteClip = Parent->AbsoluteClippingRect; parentAbsoluteClip = Parent->AbsoluteClippingRect;
} }
const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE) if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
fw = (f32)parentAbsolute.getWidth(); fw = (f32)parentAbsolute.getWidth();
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE) if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight(); fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft) switch (AlignLeft)
{ {
case EGUIA_UPPERLEFT: case EGUIA_UPPERLEFT:
@ -320,8 +310,8 @@ public:
RelativeRect = DesiredRect; RelativeRect = DesiredRect;
s32 w = RelativeRect.getWidth(); const s32 w = RelativeRect.getWidth();
s32 h = RelativeRect.getHeight(); const s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed // make sure the desired rectangle is allowed
if (w < MinSize.Width) if (w < MinSize.Width)
@ -334,7 +324,7 @@ public:
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height; RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height;
RelativeRect.repair(); RelativeRect.repair();
AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner; AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
if (!Parent) if (!Parent)
@ -354,7 +344,18 @@ public:
} }
//! Returns the child element, which is at the position of the point. //! Returns the topmost GUI element at the specific position.
/**
This will check this GUI element and all of its descendants, so it
may return this GUI element. To check all GUI elements, call this
function on device->getGUIEnvironment()->getRootGUIElement(). Note
that the root element is the size of the screen, so doing so (with
an on-screen point) will always return the root element if no other
element is above it at that point.
\param point: The point at which to find a GUI element.
\return The topmost GUI element at that point, or 0 if there are
no candidate elements at this point.
*/
IGUIElement* getElementFromPoint(const core::position2d<s32>& point) IGUIElement* getElementFromPoint(const core::position2d<s32>& point)
{ {
IGUIElement* target = 0; IGUIElement* target = 0;
@ -365,6 +366,7 @@ public:
core::list<IGUIElement*>::Iterator it = Children.getLast(); core::list<IGUIElement*>::Iterator it = Children.getLast();
if (IsVisible) if (IsVisible)
{
while(it != Children.end()) while(it != Children.end())
{ {
target = (*it)->getElementFromPoint(point); target = (*it)->getElementFromPoint(point);
@ -373,16 +375,17 @@ public:
--it; --it;
} }
}
if (IsVisible && isPointInside(point)) if (IsVisible && isPointInside(point))
target = this; target = this;
return target; return target;
} }
//! Returns true if a point is within this element. //! Returns true if a point is within this element.
//! Elements with a shape other than a rectangle will override this method /** Elements with a shape other than a rectangle should override this method */
virtual bool isPointInside(const core::position2d<s32>& point) const virtual bool isPointInside(const core::position2d<s32>& point) const
{ {
return AbsoluteClippingRect.isPointInside(point); return AbsoluteClippingRect.isPointInside(point);
@ -395,10 +398,10 @@ public:
if (child) if (child)
{ {
child->grab(); child->grab();
child->remove(); // remove from old parent child->remove(); // remove from old parent
child->LastParentRect = getAbsolutePosition(); child->LastParentRect = getAbsolutePosition();
child->Parent = this; child->Parent = this;
Children.push_back(child); Children.push_back(child);
} }
} }
@ -480,19 +483,18 @@ public:
} }
//! Sets whether this control was created as part of its parent, //! Sets whether this control was created as part of its parent.
//! for example when a scrollbar is part of a listbox. /** For example, it is true when a scrollbar is part of a listbox.
//! SubElements are not saved to disk when calling guiEnvironment->saveGUI() SubElements are not saved to disk when calling guiEnvironment->saveGUI() */
virtual void setSubElement(bool subElement) virtual void setSubElement(bool subElement)
{ {
IsSubElement = subElement; IsSubElement = subElement;
} }
//! If set to true, the focus will visit this element when using //! If set to true, the focus will visit this element when using the tab key to cycle through elements.
//! the tab key to cycle through elements. /** If this element is a tab group (see isTabGroup/setTabGroup) then
//! If this element is a tab group (see isTabGroup/setTabGroup) then ctrl+tab will be used instead. */
//! ctrl+tab will be used instead.
void setTabStop(bool enable) void setTabStop(bool enable)
{ {
IsTabStop = enable; IsTabStop = enable;
@ -507,9 +509,9 @@ public:
} }
//! Sets the priority of focus when using the tab key to navigate between a group //! Sets the priority of focus when using the tab key to navigate between a group of elements.
//! of elements. See setTabGroup, isTabGroup and getTabGroup for information on tab groups. /** See setTabGroup, isTabGroup and getTabGroup for information on tab groups.
//! Elements with a lower number are focused first Elements with a lower number are focused first */
void setTabOrder(s32 index) void setTabOrder(s32 index)
{ {
// negative = autonumber // negative = autonumber
@ -519,7 +521,7 @@ public:
IGUIElement *el = getTabGroup(); IGUIElement *el = getTabGroup();
while (IsTabGroup && el && el->Parent) while (IsTabGroup && el && el->Parent)
el = el->Parent; el = el->Parent;
IGUIElement *first=0, *closest=0; IGUIElement *first=0, *closest=0;
if (el) if (el)
{ {
@ -544,9 +546,9 @@ public:
} }
//! Sets whether this element is a container for a group of elements which //! Sets whether this element is a container for a group of elements which can be navigated using the tab key.
//! can be navigated using the tab key. For example, windows are tab groups. /** For example, windows are tab groups.
//! Groups can be navigated using ctrl+tab, providing isTabStop is true. Groups can be navigated using ctrl+tab, providing isTabStop is true. */
void setTabGroup(bool isGroup) void setTabGroup(bool isGroup)
{ {
IsTabGroup = isGroup; IsTabGroup = isGroup;
@ -561,12 +563,11 @@ public:
} }
//! Returns the container element which holds all elements in this element's //! Returns the container element which holds all elements in this element's tab group.
//! tab group.
IGUIElement* getTabGroup() IGUIElement* getTabGroup()
{ {
IGUIElement *ret=this; IGUIElement *ret=this;
while (ret && !ret->isTabGroup()) while (ret && !ret->isTabGroup())
ret = ret->getParent(); ret = ret->getParent();
@ -639,7 +640,7 @@ public:
//! Brings a child to front //! Brings a child to front
/** \return Returns true if successful, false if not. */ /** \return True if successful, false if not. */
virtual bool bringToFront(IGUIElement* element) virtual bool bringToFront(IGUIElement* element)
{ {
core::list<IGUIElement*>::Iterator it = Children.begin(); core::list<IGUIElement*>::Iterator it = Children.begin();
@ -667,11 +668,11 @@ public:
//! Finds the first element with the given id. //! Finds the first element with the given id.
/** \param id: Id to search for. /** \param id: Id to search for.
\param searchchildren: Set this to true, if also children of this \param searchchildren: Set this to true, if also children of this
element may contain the element with the searched id and they element may contain the element with the searched id and they
should be searched too. should be searched too.
\return Returns the first element with the given id. If no element \return Returns the first element with the given id. If no element
with this id was found, 0 is returned. */ with this id was found, 0 is returned. */
virtual IGUIElement* getElementFromId(s32 id, bool searchchildren=false) const virtual IGUIElement* getElementFromId(s32 id, bool searchchildren=false) const
{ {
IGUIElement* e = 0; IGUIElement* e = 0;
@ -687,7 +688,7 @@ public:
if (e) if (e)
return e; return e;
} }
return e; return e;
} }
@ -699,7 +700,7 @@ public:
{ {
if (!child) if (!child)
return false; return false;
do do
{ {
if (child->Parent) if (child->Parent)
child = child->Parent; child = child->Parent;
@ -712,14 +713,14 @@ public:
//! searches elements to find the closest next element to tab to //! searches elements to find the closest next element to tab to
//! \param startOrder: The TabOrder of the current element, -1 if none /** \param startOrder: The TabOrder of the current element, -1 if none
//! \param reverse: true if searching for a lower number \param reverse: true if searching for a lower number
//! \param group: true if searching for a higher one \param group: true if searching for a higher one
//! \param first: element with the highest/lowest known tab order depending on search direction \param first: element with the highest/lowest known tab order depending on search direction
//! \param closest: the closest match, depending on tab order and direction \param closest: the closest match, depending on tab order and direction
//! \param includeInvisible: includes invisible elements in the search (default=false) \param includeInvisible: includes invisible elements in the search (default=false)
//! \return true if successfully found an element, false to continue searching/fail \return true if successfully found an element, false to continue searching/fail */
bool getNextElement(s32 startOrder, bool reverse, bool group, bool getNextElement(s32 startOrder, bool reverse, bool group,
IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const
{ {
// we'll stop searching if we find this number // we'll stop searching if we find this number
@ -748,18 +749,18 @@ public:
closest = *it; closest = *it;
return true; return true;
} }
// is it closer than the current closest? // is it closer than the current closest?
if (closest) if (closest)
{ {
closestOrder = closest->getTabOrder(); closestOrder = closest->getTabOrder();
if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder) if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
||(!reverse && currentOrder < closestOrder && currentOrder > startOrder)) ||(!reverse && currentOrder < closestOrder && currentOrder > startOrder))
{ {
closest = *it; closest = *it;
} }
} }
else else
if ( (reverse && currentOrder < startOrder) || (!reverse && currentOrder > startOrder) ) if ( (reverse && currentOrder < startOrder) || (!reverse && currentOrder > startOrder) )
{ {
closest = *it; closest = *it;
@ -794,7 +795,7 @@ public:
} }
//! Returns the type of the gui element. //! Returns the type of the gui element.
/** This is needed for the .NET wrapper but will be used /** This is needed for the .NET wrapper but will be used
later for serializing and deserializing. later for serializing and deserializing.
If you wrote your own GUIElements, you need to set the type for your element as first parameter If you wrote your own GUIElements, you need to set the type for your element as first parameter
@ -805,8 +806,8 @@ public:
} }
//! Returns the type name of the gui element. //! Returns the type name of the gui element.
/** This is needed serializing elements. For serializing your own elements, override this function /** This is needed serializing elements. For serializing your own elements, override this function
and return your own type name which is created by your IGUIElementFactory */ and return your own type name which is created by your IGUIElementFactory */
virtual const c8* getTypeName() const virtual const c8* getTypeName() const
{ {
@ -815,8 +816,8 @@ public:
//! Writes attributes of the scene node. //! Writes attributes of the scene node.
//! Implement this to expose the attributes of your scene node for /** Implement this to expose the attributes of your scene node for
//! scripting languages, editors, debuggers or xml serialization purposes. scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
out->addInt("Id", ID ); out->addInt("Id", ID );
@ -838,8 +839,8 @@ public:
//! Reads attributes of the scene node. //! Reads attributes of the scene node.
//! Implement this to set the attributes of your scene node for /** Implement this to set the attributes of your scene node for
//! scripting languages, editors, debuggers or xml deserialization purposes. scripting languages, editors, debuggers or xml deserialization purposes. */
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
setID(in->getAttributeAsInt("Id")); setID(in->getAttributeAsInt("Id"));
@ -882,7 +883,7 @@ protected:
//! absolute clipping rect of element //! absolute clipping rect of element
core::rect<s32> AbsoluteClippingRect; core::rect<s32> AbsoluteClippingRect;
//! the rectangle the element would prefer to be, //! the rectangle the element would prefer to be,
//! if it was not constrained by parent or max/min size //! if it was not constrained by parent or max/min size
core::rect<s32> DesiredRect; core::rect<s32> DesiredRect;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,14 +11,13 @@
namespace irr namespace irr
{ {
namespace gui namespace gui
{ {
class IGUIElement; class IGUIElement;
//! Interface making it possible to dynamicly create GUI elements //! Interface making it possible to dynamicly create GUI elements
/** To be able to add custom elements to Irrlicht and to make it possible for the /** To be able to add custom elements to Irrlicht and to make it possible for the
scene manager to save and load them, simply implement this interface and register it scene manager to save and load them, simply implement this interface and register it
in your gui environment via IGUIEnvironment::registerGUIElementFactory. in your gui environment via IGUIEnvironment::registerGUIElementFactory.
Note: When implementing your own element factory, don't call IGUIEnvironment::grab() to Note: When implementing your own element factory, don't call IGUIEnvironment::grab() to
increase the reference counter of the environment. This is not necessary because the increase the reference counter of the environment. This is not necessary because the
@ -28,37 +27,34 @@ namespace gui
{ {
public: public:
// destructor
virtual ~IGUIElementFactory() {}
//! adds an element to the gui environment based on its type id //! adds an element to the gui environment based on its type id
/** \param type: Type of the element to add. /** \param type: Type of the element to add.
\param parent: Parent scene node of the new element, can be null to add to the root. \param parent: Parent scene node of the new element, can be null to add to the root.
\return Returns pointer to the new element or null if not successful. */ \return Pointer to the new element or null if not successful. */
virtual IGUIElement* addGUIElement(EGUI_ELEMENT_TYPE type, IGUIElement* parent=0) = 0; virtual IGUIElement* addGUIElement(EGUI_ELEMENT_TYPE type, IGUIElement* parent=0) = 0;
//! adds a GUI element to the GUI Environment based on its type name //! adds a GUI element to the GUI Environment based on its type name
/** \param typeName: Type name of the element to add. /** \param typeName: Type name of the element to add.
\param parent: Parent scene node of the new element, can be null to add it to the root. \param parent: Parent scene node of the new element, can be null to add it to the root.
\return Returns pointer to the new element or null if not successful. */ \return Pointer to the new element or null if not successful. */
virtual IGUIElement* addGUIElement(const c8* typeName, IGUIElement* parent=0) = 0; virtual IGUIElement* addGUIElement(const c8* typeName, IGUIElement* parent=0) = 0;
//! returns amount of GUI element types this factory is able to create //! Get amount of GUI element types this factory is able to create
virtual s32 getCreatableGUIElementTypeCount() const = 0; virtual s32 getCreatableGUIElementTypeCount() const = 0;
//! returns type of a createable element type //! Get type of a createable element type
/** \param idx: Index of the element type in this factory. Must be a value between 0 and /** \param idx: Index of the element type in this factory. Must be a value between 0 and
getCreatableGUIElementTypeCount() */ getCreatableGUIElementTypeCount() */
virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) const = 0; virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) const = 0;
//! returns type name of a createable GUI element type by index //! Get type name of a createable GUI element type by index
/** \param idx: Index of the type in this factory. Must be a value between 0 and /** \param idx: Index of the type in this factory. Must be a value between 0 and
getCreatableGUIElementTypeCount() */ getCreatableGUIElementTypeCount() */
virtual const c8* getCreateableGUIElementTypeName(s32 idx) const = 0; virtual const c8* getCreateableGUIElementTypeName(s32 idx) const = 0;
//! returns type name of a createable GUI element //! returns type name of a createable GUI element
/** \param type: Type of GUI element. /** \param type: Type of GUI element.
\return: Returns name of the type if this factory can create the type, otherwise 0. */ \return Name of the type if this factory can create the type, otherwise 0. */
virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const = 0; virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -49,6 +49,7 @@ class IGUIEditBox;
class IGUISpinBox; class IGUISpinBox;
class IGUITabControl; class IGUITabControl;
class IGUITab; class IGUITab;
class IGUITable;
class IGUIContextMenu; class IGUIContextMenu;
class IGUIComboBox; class IGUIComboBox;
class IGUIToolBar; class IGUIToolBar;
@ -61,350 +62,474 @@ class IGUIEnvironment : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Draws all gui elements by traversing the GUI environment starting at the root node.
virtual ~IGUIEnvironment() {};
//! Draws all gui elements.
virtual void drawAll() = 0; virtual void drawAll() = 0;
//! Sets the focus to an element. //! Sets the focus to an element.
/** Causes a EGET_ELEMENT_FOCUS_LOST event followed by a EGET_ELEMENT_FOCUSED event. /** Causes a EGET_ELEMENT_FOCUS_LOST event followed by a
If someone absorbed either of the events, then the focus will not be changed. EGET_ELEMENT_FOCUSED event. If someone absorbed either of the events,
\return Returns true on success, false on failure */ then the focus will not be changed.
\param element Pointer to the element which shall get the focus.
\return True on success, false on failure */
virtual bool setFocus(IGUIElement* element) = 0; virtual bool setFocus(IGUIElement* element) = 0;
//! Returns the element with the focus //! Returns the element which holds the focus.
/** \return Pointer to the element with focus. */
virtual IGUIElement* getFocus() const = 0; virtual IGUIElement* getFocus() const = 0;
//! Removes the focus from an element. //! Removes the focus from an element.
/** Causes a EGET_ELEMENT_FOCUS_LOST event. If the event is absorbed then the focus /** Causes a EGET_ELEMENT_FOCUS_LOST event. If the event is absorbed
will not be changed. then the focus will not be changed.
\return Returns true on success, false on failure */ \param element Pointer to the element which shall lose the focus.
\return True on success, false on failure */
virtual bool removeFocus(IGUIElement* element) = 0; virtual bool removeFocus(IGUIElement* element) = 0;
//! Returns if the element has focus //! Returns whether the element has focus
/** \param element Pointer to the element which is tested.
\return True if the element has focus, else false. */
virtual bool hasFocus(IGUIElement* element) const = 0; virtual bool hasFocus(IGUIElement* element) const = 0;
//! Returns the current video driver. //! Returns the current video driver.
/** \return Pointer to the video driver. */
virtual video::IVideoDriver* getVideoDriver() const = 0; virtual video::IVideoDriver* getVideoDriver() const = 0;
//! Returns the file system. //! Returns the file system.
/** \return Pointer to the file system. */
virtual io::IFileSystem* getFileSystem() const = 0; virtual io::IFileSystem* getFileSystem() const = 0;
//! returns a pointer to the OS operator //! returns a pointer to the OS operator
/** \return Pointer to the OS operator. */
virtual IOSOperator* getOSOperator() const = 0; virtual IOSOperator* getOSOperator() const = 0;
//! removes all elements from the environment. //! Removes all elements from the environment.
virtual void clear() = 0; virtual void clear() = 0;
//! Posts an input event to the environment. //! Posts an input event to the environment.
/** Usually you do not have to /** Usually you do not have to
use this method, it is used by the internal engine. */ use this method, it is used by the engine internally.
\param event The event to post.
\return True if succeeded, else false. */
virtual bool postEventFromUser(const SEvent& event) = 0; virtual bool postEventFromUser(const SEvent& event) = 0;
//! This sets a new event receiver for gui events. //! This sets a new event receiver for gui events.
/** Usually you do not have to /** Usually you do not have to
use this method, it is used by the internal engine. */ use this method, it is used by the engine internally.
\param evr Pointer to the new receiver. */
virtual void setUserEventReceiver(IEventReceiver* evr) = 0; virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
//! Returns pointer to the current gui skin. //! Returns pointer to the current gui skin.
/** \return Pointer to the GUI skin. */
virtual IGUISkin* getSkin() const = 0; virtual IGUISkin* getSkin() const = 0;
//! Sets a new GUI Skin //! Sets a new GUI Skin
/** You can use this to change the appearance of the whole GUI Environment. You /** You can use this to change the appearance of the whole GUI
can set one of the built-in skins or implement your own class derived from Environment. You can set one of the built-in skins or implement your
IGUISkin and enable it using this method. own class derived from IGUISkin and enable it using this method.
To set for example the built-in Windows classic skin, use the following code: To set for example the built-in Windows classic skin, use the following
code:
\code \code
gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC); gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
environment->setSkin(newskin); environment->setSkin(newskin);
newskin->drop(); newskin->drop();
\endcode \endcode
\param skin New skin to use.
*/ */
virtual void setSkin(IGUISkin* skin) = 0; virtual void setSkin(IGUISkin* skin) = 0;
//! Creates a new GUI Skin based on a template. //! Creates a new GUI Skin based on a template.
/** Use setSkin() to set the created skin. /** Use setSkin() to set the created skin.
\return Returns a pointer to the created skin. \param type The type of the new skin.
\return Pointer to the created skin.
If you no longer need it, you should call IGUISkin::drop(). If you no longer need it, you should call IGUISkin::drop().
See IReferenceCounted::drop() for more information. */ See IReferenceCounted::drop() for more information. */
virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0; virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
//! Returns pointer to the font with the specified file name. //! Returns pointer to the font with the specified filename.
/** Loads the font if it was not loaded before. Returns 0 if the font could not be loaded. /** Loads the font if it was not loaded before.
\return \param filename Filename of the Font.
returns a pointer to the font. \return Pointer to the font. Returns 0 if the font could not be loaded.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIFont* getFont(const c8* filename) = 0; virtual IGUIFont* getFont(const c8* filename) = 0;
//! Returns the default built-in font. //! Returns the default built-in font.
/** \return Pointer to the default built-in font.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIFont* getBuiltInFont() const = 0; virtual IGUIFont* getBuiltInFont() const = 0;
//! Returns pointer to the sprite bank with the specified file name. //! Returns pointer to the sprite bank with the specified file name.
/** Loads the bank if it was not loaded before. Returns 0 if it could not be loaded. /** Loads the bank if it was not loaded before.
\return \param filename Filename of the sprite bank's origin.
returns a pointer to the sprite bank. \return Pointer to the sprite bank. Returns 0 if it could not be loaded.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IGUISpriteBank* getSpriteBank(const c8* filename) = 0; virtual IGUISpriteBank* getSpriteBank(const c8* filename) = 0;
//! adds an empty sprite bank to the manager //! Adds an empty sprite bank to the manager
/** \param name Name of the new sprite bank.
\return Pointer to the sprite bank.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0; virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0;
//! Returns the root gui element. //! Returns the root gui element.
/** This is the first gui element, parent of all other /** This is the first gui element, the (direct or indirect) parent of all
gui elements. You'll never need to use this method, unless you are not creating other gui elements. It is a valid IGUIElement, with dimensions the same
your own gui elements, trying to add them to the gui elements without a parent. size as the screen. You should not need to use this method directly, unless
The returned pointer should not be dropped. See IReferenceCounted::drop() for more information. */ you wish to reparent GUI elements to the top level.
\return Pointer to the root element of the GUI. The returned pointer
should not be dropped. See IReferenceCounted::drop() for more
information. */
virtual IGUIElement* getRootGUIElement() = 0; virtual IGUIElement* getRootGUIElement() = 0;
//! Adds an button element. //! Adds a button element.
/** \return /** \param rectangle Rectangle specifying the borders of the button.
Returns a pointer to the created button. Returns 0 if an error occured. \param parent Parent gui element of the button.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param id Id with which the gui element can be identified.
\param text Text displayed on the button.
\param tooltiptext Text displayed in the tooltip.
\return Pointer to the created button. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIButton* addButton(const core::rect<s32>& rectangle, virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0; IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
//! Adds an empty window element. //! Adds an empty window element.
/** \param modal: Defines if the dialog is modal. This means, that all other /** \param rectangle Rectangle specifying the borders of the window.
gui elements which were created before the message box cannot be used \param modal Defines if the dialog is modal. This means, that all other
until this messagebox is removed. gui elements which were created before the window cannot be used until
\return it is removed.
Returns a pointer to the created window. Returns 0 if an error occured. \param text Text displayed as the window title.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param parent Parent gui element of the window.
virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false, \param id Id with which the gui element can be identified.
\return Pointer to the created window. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0; const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a modal screen. This control stops its parent's members from being //! Adds a modal screen.
//! able to recieve input until its last child is removed, it then deletes its self. /** This control stops its parent's members from being able to receive
/** \return input until its last child is removed, it then deletes itself.
Returns a pointer to the created window. Returns 0 if an error occured. \param parent Parent gui element of the modal.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \return Pointer to the created modal. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0; virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
//! Adds a message box. //! Adds a message box.
/** \param caption: Text to be displayed the title of the message box. /** \param caption Text to be displayed the title of the message box.
\param text: Text to be displayed in the body of the message box. \param text Text to be displayed in the body of the message box.
\param modal: Defines if the dialog is modal. This means, that all other \param modal Defines if the dialog is modal. This means, that all other
gui elements which were created before the message box cannot be used gui elements which were created before the message box cannot be used
until this messagebox is removed. until this messagebox is removed.
\param flags: Flags specifying the layout of the message box. For example \param flags Flags specifying the layout of the message box. For example
to create a message box with an OK and a CANCEL button on it, set this to create a message box with an OK and a CANCEL button on it, set this
to (EMBF_OK | EMBF_CANCEL). to (EMBF_OK | EMBF_CANCEL).
\param parent: Parent gui element of the message box. \param parent Parent gui element of the message box.
\param id: Id with which the gui element can be identified. \param id Id with which the gui element can be identified.
\return \return Pointer to the created message box. Returns 0 if an error
Returns a pointer to the created message box. Returns 0 if an error occured. occured. This pointer should not be dropped. See
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0, virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1) = 0; bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a scrollbar. //! Adds a scrollbar.
/** \return /** \param horizontal Specifies if the scroll bar is drawn horizontal
Returns a pointer to the created scrollbar. Returns 0 if an error occured. or vertical.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param rectangle Rectangle specifying the borders of the scrollbar.
\param parent Parent gui element of the scroll bar.
\param id Id to identify the gui element.
\return Pointer to the created scrollbar. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle, virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds an image element. //! Adds an image element.
/** \param image: Image to be displayed. /** \param image Image to be displayed.
\param pos: Position of the image. The width and height of the image is taken \param pos Position of the image. The width and height of the image is
from the image. taken from the image.
\param useAlphaChannel: Sets if the image should use the alpha channel of the texture \param useAlphaChannel Sets if the image should use the alpha channel
to draw itself. of the texture to draw itself.
\return \param parent Parent gui element of the image.
Returns a pointer to the created image element. Returns 0 if an error occured. \param id Id to identify the gui element.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param text Title text of the image.
\return Pointer to the created image element. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos, virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds an image element. //! Adds an image element.
/** Use IGUIImage::setImage later to set the image to be displayed. /** Use IGUIImage::setImage later to set the image to be displayed.
\return \param rectangle Rectangle specifying the borders of the image.
Returns a pointer to the created image element. Returns 0 if an error occured. \param parent Parent gui element of the image.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param id Id to identify the gui element.
\param text Title text of the image.
\return Pointer to the created image element. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIImage* addImage(const core::rect<s32>& rectangle, virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds a checkbox element. //! Adds a checkbox element.
/** \return /** \param checked Define the initial state of the check box.
Returns a pointer to the created check box. Returns 0 if an error occured. \param rectangle Rectangle specifying the borders of the check box.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param parent Parent gui element of the check box.
\param id Id to identify the gui element.
\param text Title text of the check box.
\return Pointer to the created check box. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle, virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds a list box element. //! Adds a list box element.
/** \return /** \param rectangle Rectangle specifying the borders of the list box.
Returns a pointer to the created list box. Returns 0 if an error occured. \param parent Parent gui element of the list box.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param id Id to identify the gui element.
virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle, \param drawBackground Flag whether the background should be drawn.
\return Pointer to the created list box. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0; IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
//! Adds an mesh viewer. Not 100% implemented yet. //! Adds a mesh viewer. Not 100% implemented yet.
/** \return /** \param rectangle Rectangle specifying the borders of the mesh viewer.
Returns a pointer to the created mesh viewer. Returns 0 if an error occured. \param parent Parent gui element of the mesh viewer.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param id Id to identify the gui element.
virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; \param text Title text of the mesh viewer.
\return Pointer to the created mesh viewer. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds a file open dialog. //! Adds a file open dialog.
/** \param modal: Defines if the dialog is modal. This means, that all other /** \param title Text to be displayed as the title of the dialog.
gui elements which were created before the message box cannot be used \param modal Defines if the dialog is modal. This means, that all other
until this messagebox is removed. gui elements which were created before the message box cannot be used
\return until this messagebox is removed.
Returns a pointer to the created file open dialog. Returns 0 if an error occured. \param parent Parent gui element of the dialog.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param id Id to identify the gui element.
virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0, \return Pointer to the created file open dialog. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0,
bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0; bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a color select dialog. //! Adds a color select dialog.
/** \param modal: Defines if the dialog is modal. This means, that all other /** \param title The title of the dialog.
gui elements which were created before the message box cannot be used \param modal Defines if the dialog is modal. This means, that all other
until this messagebox is removed. gui elements which were created before the dialog cannot be used
\return until it is removed.
Returns a pointer to the created file open dialog. Returns 0 if an error occured. \param parent The parent of the dialog.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param id The ID of the dialog.
virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0, \return Pointer to the created file open dialog. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0; bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a static text. //! Adds a static text.
/** The returned pointer must not be dropped. /** \param text Text to be displayed. Can be altered after creation by SetText().
\param text is the text to be displayed. Can be altered after creation with SetText(). \param rectangle Rectangle specifying the borders of the static text
\param rectangle is the position of the static text. \param border Set to true if the static text should have a 3d border.
\param border has to be set to true if the static text should have a 3d border. \param wordWrap Enable if the text should wrap into multiple lines.
\param wordWrap specifies, if the text should be wrapped into multiple lines. \param parent Parent item of the element, e.g. a window.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the fader directly in the environment. \param id The ID of the element.
\param id is a s32 to identify the static text element. \param fillBackground Enable if the background shall be filled.
\param fillBackground specifies if the background will be filled. Default: false. Defaults to false.
\return \return Pointer to the created static text. Returns 0 if an error
Returns a pointer to the created static text. Returns 0 if an error occured. occured. This pointer should not be dropped. See
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle, virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1, bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
bool fillBackground = false) = 0; bool fillBackground = false) = 0;
//! Adds an edit box. //! Adds an edit box.
/** Supports unicode input from every keyboard around the world, /** Supports unicode input from every keyboard around the world,
scrolling, copying and pasting (exchanging data with the clipboard directly), maximum scrolling, copying and pasting (exchanging data with the clipboard
character amount, marking and all shortcuts like ctrl+X, ctrl+V, ctrg+C, directly), maximum character amount, marking, and all shortcuts like
shift+Left, shift+Right, Home, End, and so on. ctrl+X, ctrl+V, ctrl+C, shift+Left, shift+Right, Home, End, and so on.
\param text is the text to be displayed. Can be altered after creation with setText(). \param text Text to be displayed. Can be altered after creation
\param rectangle is the position of the edit box. by setText().
\param border has to be set to true if the edit box should have a 3d border. \param rectangle Rectangle specifying the borders of the edit box.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the edit box directly in the environment. \param border Set to true if the edit box should have a 3d border.
\param id is a s32 to identify the edit box. \param parent Parent item of the element, e.g. a window.
\return Set it to 0 to place the edit box directly in the environment.
Returns a pointer to the created edit box. Returns 0 if an error occured. \param id The ID of the element.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \return Pointer to the created edit box. Returns 0 if an error occured.
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle, This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
bool border=true, IGUIElement* parent=0, s32 id=-1) = 0; bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a spin box. //! Adds a spin box.
/** An edit box with up and down buttons /** An edit box with up and down buttons
\param text is the text to be displayed. Can be altered after creation with setText(). \param text Text to be displayed. Can be altered after creation by setText().
\param rectangle is the position of the spin box. \param rectangle Rectangle specifying the borders of the spin box.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the spin box directly in the environment. \param parent Parent item of the element, e.g. a window.
\param id is a s32 to identify the spin box. Set it to 0 to place the spin box directly in the environment.
\return \param id The ID of the element.
Returns a pointer to the created spin box. Returns 0 if an error occured. \return Pointer to the created spin box. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle, more information. */
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds an element for fading in or out. //! Adds an element for fading in or out.
/* \param rectangle: Pointer to rectangle specifing the borders of the element. /** \param rectangle Rectangle specifying the borders of the fader.
If the pointer is NULL, the whole screen is used. If the pointer is NULL, the whole screen is used.
\param parent: Parent item of the element. E.g. a window. Set it to 0 to place the static text directly in the environment. \param parent Parent item of the element, e.g. a window.
\param id: A s32 to identify the text. \param id An identifier for the fader.
\return \return Pointer to the created in-out-fader. Returns 0 if an error
Returns a pointer to the created in-out-fader. Returns 0 if an error occured. occured. This pointer should not be dropped. See
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0; virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a tab control to the environment. //! Adds a tab control to the environment.
/** \param rectangle is the position of the tab control. /** \param rectangle Rectangle specifying the borders of the tab control.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the tab control directly in the environment. \param parent Parent item of the element, e.g. a window.
\param fillbackground specifies if the background of the tab control should be drawn to. Set it to 0 to place the tab control directly in the environment.
\param border specifiys if a flat 3d border should be drawn. \param fillbackground Specifies if the background of the tab control
This is usually not necesarry unless you don't place the control directly into the environment without a window as parent. should be drawn.
\param id is a s32 to identify the tab control. \param border Specifies if a flat 3d border should be drawn. This is
\return usually not necessary unless you place the control directly into
Returns a pointer to the created tab control element. Returns 0 if an error occured. the environment without a window as parent.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ \param id An identifier for the tab control.
\return Pointer to the created tab control element. Returns 0 if an
error occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle, virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
IGUIElement* parent=0, bool fillbackground=false, IGUIElement* parent=0, bool fillbackground=false,
bool border=true, s32 id=-1) = 0; bool border=true, s32 id=-1) = 0;
//! Adds tab to the environment. //! Adds tab to the environment.
/** You can use this element to group other elements. This is not used for creating tabs on tab controls, /** You can use this element to group other elements. This is not used
please use IGUITabControl::addTab() for this instead. for creating tabs on tab controls, please use IGUITabControl::addTab()
\param rectangle is the position of the tab. for this instead.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the tab directly in the environment. \param rectangle Rectangle specifying the borders of the tab.
\param id is a s32 to identify the tab. */ \param parent Parent item of the element, e.g. a window.
Set it to 0 to place the tab directly in the environment.
\param id An identifier for the tab.
\return Pointer to the created tab. Returns 0 if an
error occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUITab* addTab(const core::rect<s32>& rectangle, virtual IGUITab* addTab(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a context menu to the environment. //! Adds a context menu to the environment.
/** \param rectangle is the position of the menu. Note that the menu is /** \param rectangle Rectangle specifying the borders of the menu.
resizing itself based on what items you add. Note that the menu is resizing itself based on what items you add.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the menu directly in the environment. \param parent Parent item of the element, e.g. a window.
\param id is a s32 to identify the menu. */ Set it to 0 to place the menu directly in the environment.
\param id An identifier for the menu.
\return Pointer to the created context menu. Returns 0 if an
error occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle, virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a menu to the environment. //! Adds a menu to the environment.
/* This is like the menu you can find on top of most windows in modern graphical user interfaces. /* This is like the menu you can find on top of most windows in modern
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the menu directly in the environment. graphical user interfaces.
\param id is a s32 to identify the menu. */ \param parent Parent item of the element, e.g. a window.
Set it to 0 to place the menu directly in the environment.
\param id An identifier for the menu.
\return Pointer to the created menu. Returns 0 if an
error occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0; virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a toolbar to the environment. //! Adds a toolbar to the environment.
/** It is like a menu is always placed on top /** It is like a menu that is always placed on top of its parent, and
in its parent, and contains buttons. contains buttons.
\param parent is the parent item of the element. E.g. a window. Set it to 0 to place the tool bar directly in the environment. \param parent Parent item of the element, e.g. a window.
\param id is a s32 to identify the tool bar. */ Set it to 0 to place the tool bar directly in the environment.
\param id An identifier for the tool bar.
\return Pointer to the created tool bar. Returns 0 if an
error occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0; virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a combo box to the environment. //! Adds a combo box to the environment.
/** \param parent is the parent item of the element. E.g. a window. Set it to 0 to place the combo box directly in the environment. /** \param rectangle Rectangle specifying the borders of the combo box.
\param id is a s32 to identify the combo box. */ \param parent Parent item of the element, e.g. a window.
Set it to 0 to place the combo box directly in the environment.
\param id An identifier for the combo box.
\return Pointer to the created combo box. Returns 0 if an
error occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle, virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
//! Returns the default element factory which can create all built in elements //! Adds a table to the environment
/** \param rectangle Rectangle specifying the borders of the table.
\param parent Parent item of the element, e.g. a window.
Set it to 0 to place the table directly in the environment.
\param id An identifier for the combo box.
\param drawBackground Sets whether to draw the background filled.
\return Pointer to the created table. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUITable* addTable(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;
//! Get the default element factory which can create all built-in elements
/** \return Pointer to the factory.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0; virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;
//! Adds an element factory to the gui environment. //! Adds an element factory to the gui environment.
/** Use this to extend the gui environment with new element types which it should be /** Use this to extend the gui environment with new element types which
able to create automaticly, for example when loading data from xml files. */ it should be able to create automatically, for example when loading
data from xml files.
\param factoryToAdd Pointer to new factory. */
virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0; virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
//! Returns amount of registered gui element factories. //! Get amount of registered gui element factories.
/** \return Amount of registered gui element factories. */
virtual u32 getRegisteredGUIElementFactoryCount() const = 0; virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
//! Returns a gui element factory by index //! Get a gui element factory by index
/** \param index Index of the factory.
\return Factory at given index, or 0 if no such factory exists. */
virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0; virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
//! Adds a GUI Element by its name //! Adds a GUI element by its name
/** Each factory is checked if it can create an element of the given
name. The first match will be created.
\param elementName Name of the element to be created.
\param parent Parent of the new element, if not 0.
\return New GUI element, or 0 if no such element exists. */
virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0; virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
//! Saves the current gui into a file. //! Saves the current gui into a file.
//! \param filename: Name of the file. /** \param filename Name of the file.
//! \param start: The GUIElement to start with. Root if 0. \param start The GUIElement to start with. Root if 0.
\return True if saving succeeded, else false. */
virtual bool saveGUI(const c8* filename, IGUIElement* start=0) = 0; virtual bool saveGUI(const c8* filename, IGUIElement* start=0) = 0;
//! Saves the current gui into a file. //! Saves the current gui into a file.
//! \param file: The file to write to. /** \param file The file to write to.
//! \param start: The GUIElement to start with. Root if 0. \param start The GUIElement to start with. Root if 0.
\return True if saving succeeded, else false. */
virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0; virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
//! Loads the gui. Note that the current gui is not cleared before. //! Loads the gui. Note that the current gui is not cleared before.
//! \param filename: Name of the file . /** \param filename Name of the file .
//! \param parent: Parent for the loaded GUI, root if 0. \param parent Parent for the loaded GUI, root if 0.
\return True if loading succeeded, else false. */
virtual bool loadGUI(const c8* filename, IGUIElement* parent=0) = 0; virtual bool loadGUI(const c8* filename, IGUIElement* parent=0) = 0;
//! Loads the gui. Note that the current gui is not cleared before. //! Loads the gui. Note that the current gui is not cleared before.
//! \param file: The file to load from. /** \param file The file to load from.
//! \param parent: Parent for the loaded GUI, root if 0. \param parent Parent for the loaded GUI, root if 0.
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0; \return True if loading succeeded, else false. */
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
//! Writes attributes of the gui environment //! Writes attributes of the gui environment
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0; virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;
@ -417,7 +542,6 @@ public:
//! reads an element //! reads an element
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent) =0; virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent) =0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,9 +21,6 @@ namespace gui
IGUIFileOpenDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIFileOpenDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIFileOpenDialog() {}
//! Returns the filename of the selected file. Returns NULL, if no file was selected. //! Returns the filename of the selected file. Returns NULL, if no file was selected.
virtual const wchar_t* getFileName() const = 0; virtual const wchar_t* getFileName() const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -20,14 +20,14 @@ enum EGUI_FONT_TYPE
//! Bitmap fonts loaded from an XML file or a texture. //! Bitmap fonts loaded from an XML file or a texture.
EGFT_BITMAP = 0, EGFT_BITMAP = 0,
//! Scalable vector fonts loaded from an XML file. //! Scalable vector fonts loaded from an XML file.
//! These fonts reside in system memory and use no video memory /** These fonts reside in system memory and use no video memory
//! until they are displayed. These are slower than bitmap fonts until they are displayed. These are slower than bitmap fonts
//! but can be easily scaled and rotated. but can be easily scaled and rotated. */
EGFT_VECTOR, EGFT_VECTOR,
//! A font which uses a the native API provided by the operating system. //! A font which uses a the native API provided by the operating system.
//! Currently not used. /** Currently not used. */
EGFT_OS, EGFT_OS,
//! An external font type provided by the user. //! An external font type provided by the user.
@ -39,24 +39,21 @@ class IGUIFont : public virtual IReferenceCounted
{ {
public: public:
//! Destructor
virtual ~IGUIFont() {}
//! Draws an text and clips it to the specified rectangle if wanted. //! Draws an text and clips it to the specified rectangle if wanted.
/** \param text: Text to draw /** \param text: Text to draw
\param position: Rectangle specifying position where to draw the text. \param position: Rectangle specifying position where to draw the text.
\param color: Color of the text \param color: Color of the text
\param hcenter: Specifiies if the text should be centered horizontally into the rectangle. \param hcenter: Specifiies if the text should be centered horizontally into the rectangle.
\param vcenter: Specifiies if the text should be centered vertically into the rectangle. \param vcenter: Specifies if the text should be centered vertically into the rectangle.
\param clip: Optional pointer to a rectangle against which the text will be clipped. \param clip: Optional pointer to a rectangle against which the text will be clipped.
If the pointer is null, no clipping will be done. */ If the pointer is null, no clipping will be done. */
virtual void draw(const wchar_t* text, const core::rect<s32>& position, virtual void draw(const wchar_t* text, const core::rect<s32>& position,
video::SColor color, bool hcenter=false, bool vcenter=false, video::SColor color, bool hcenter=false, bool vcenter=false,
const core::rect<s32>* clip=0) = 0; const core::rect<s32>* clip=0) = 0;
//! Calculates the dimension of a text. //! Calculates the dimension of a text.
/** \return Returns width and height of the area covered by the text if it would be /** \return Returns width and height of the area covered by the text if
drawn. */ it would be drawn. */
virtual core::dimension2d<s32> getDimension(const wchar_t* text) const = 0; virtual core::dimension2d<s32> getDimension(const wchar_t* text) const = 0;
//! Calculates the index of the character in the text which is on a specific position. //! Calculates the index of the character in the text which is on a specific position.
@ -69,8 +66,10 @@ public:
//! Returns the type of this font //! Returns the type of this font
virtual EGUI_FONT_TYPE getType() const { return EGFT_CUSTOM; } virtual EGUI_FONT_TYPE getType() const { return EGFT_CUSTOM; }
//! Sets global kerning for the font. //! Sets global kerning width for the font.
virtual void setKerningWidth (s32 kerning) = 0; virtual void setKerningWidth (s32 kerning) = 0;
//! Sets global kerning height for the font.
virtual void setKerningHeight (s32 kerning) = 0; virtual void setKerningHeight (s32 kerning) = 0;
//! Gets kerning values (distance between letters) for the font. If no parameters are provided, //! Gets kerning values (distance between letters) for the font. If no parameters are provided,
@ -79,7 +78,7 @@ public:
to the global kerning value. For example, a space might only be one pixel wide, but it may to the global kerning value. For example, a space might only be one pixel wide, but it may
be displayed as several pixels. be displayed as several pixels.
\param previousLetter: If provided, kerning is calculated for both letters and added to the global \param previousLetter: If provided, kerning is calculated for both letters and added to the global
kerning value. For example, in a font which supports kerning pairs a string such as 'Wo' may have kerning value. For example, in a font which supports kerning pairs a string such as 'Wo' may have
the 'o' tucked neatly under the 'W'. the 'o' tucked neatly under the 'W'.
*/ */
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0; virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -18,9 +18,6 @@ class IGUIFontBitmap : public IGUIFont
{ {
public: public:
//! Destructor
virtual ~IGUIFontBitmap() {}
//! Returns the type of this font //! Returns the type of this font
virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; } virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -25,9 +25,6 @@ namespace gui
IGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_IMAGE, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_IMAGE, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIImage() {}
//! Sets an image //! Sets an image
virtual void setImage(video::ITexture* image) = 0; virtual void setImage(video::ITexture* image) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,7 +14,7 @@ namespace gui
{ {
//! Element for fading out or in //! Element for fading out or in
/** Here is a small example on how the class is used. In this example we fade /** Here is a small example on how the class is used. In this example we fade
in from a total red screen in the beginning. As you can see, the fader is not in from a total red screen in the beginning. As you can see, the fader is not
only useful for dramatic in and out fading, but also to show that the player only useful for dramatic in and out fading, but also to show that the player
is hit in a first person shooter game for example. is hit in a first person shooter game for example.
@ -32,29 +32,27 @@ namespace gui
IGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_IN_OUT_FADER, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_IN_OUT_FADER, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIInOutFader() {}
//! Gets the color to fade out to or to fade in from. //! Gets the color to fade out to or to fade in from.
virtual video::SColor getColor() const = 0; virtual video::SColor getColor() const = 0;
//! Sets the color to fade out to or to fade in from. //! Sets the color to fade out to or to fade in from.
//! \param color: Color to where it is faded out od from it is faded in. /** \param color: Color to where it is faded out od from it is faded in. */
virtual void setColor(video::SColor color) = 0; virtual void setColor(video::SColor color) = 0;
virtual void setColor(video::SColor source, video::SColor dest) = 0; virtual void setColor(video::SColor source, video::SColor dest) = 0;
//! Starts the fade in process. In the beginning the whole rect is drawn by //! Starts the fade in process.
//! the set color (black by default) and at the end of the overgiven /** In the beginning the whole rect is drawn by the set color
//! time the color has faded out. (black by default) and at the end of the overgiven time the
//! \param time: Time specifing how long it should need to fade in, color has faded out.
//! in milliseconds. \param time: Time specifing how long it should need to fade in,
in milliseconds. */
virtual void fadeIn(u32 time) = 0; virtual void fadeIn(u32 time) = 0;
//! Starts the fade out process. In the beginning everything is visible, //! Starts the fade out process.
//! and at the end of the time only the set color (black by the fault) /** In the beginning everything is visible, and at the end of
//! will be drawn. the time only the set color (black by the fault) will be drawn.
//! \param time: Time specifing how long it should need to fade out, \param time: Time specifing how long it should need to fade out,
//! in milliseconds. in milliseconds. */
virtual void fadeOut(u32 time) = 0; virtual void fadeOut(u32 time) = 0;
//! Returns if the fade in or out process is done. //! Returns if the fade in or out process is done.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -12,7 +12,6 @@ namespace irr
{ {
namespace gui namespace gui
{ {
class IGUIFont;
class IGUISpriteBank; class IGUISpriteBank;
//! Enumeration for listbox colors //! Enumeration for listbox colors
@ -39,9 +38,6 @@ namespace gui
IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIListBox() {}
//! returns amount of list items //! returns amount of list items
virtual u32 getItemCount() const = 0; virtual u32 getItemCount() const = 0;
@ -52,10 +48,9 @@ namespace gui
virtual u32 addItem(const wchar_t* text) = 0; virtual u32 addItem(const wchar_t* text) = 0;
//! adds an list item with an icon //! adds an list item with an icon
//! \param text Text of list entry /** \param text Text of list entry
//! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
//! \return \return The id of the new created item */
//! returns the id of the new created item
virtual u32 addItem(const wchar_t* text, s32 icon) = 0; virtual u32 addItem(const wchar_t* text, s32 icon) = 0;
//! Removes an item from the list //! Removes an item from the list
@ -64,10 +59,11 @@ namespace gui
//! Returns the icon of an item //! Returns the icon of an item
virtual s32 getIcon(u32 index) const = 0; virtual s32 getIcon(u32 index) const = 0;
//! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of //! Sets the sprite bank which should be used to draw list icons.
//! the built-in-font by default. A sprite can be displayed in front of every list item. /** This font is set to the sprite bank of the built-in-font by
//! An icon is an index within the icon sprite bank. Several default icons are available in the default. A sprite can be displayed in front of every list item.
//! skin through getIcon An icon is an index within the icon sprite bank. Several
default icons are available in the skin through getIcon. */
virtual void setSpriteBank(IGUISpriteBank* bank) = 0; virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
//! clears the list, deletes all items in the listbox //! clears the list, deletes all items in the listbox
@ -79,8 +75,7 @@ namespace gui
//! sets the selected item. Set this to -1 if no item should be selected //! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 index) = 0; virtual void setSelected(s32 index) = 0;
//! set whether the listbox should scroll to show a newly selected item //! set whether the listbox should scroll to new or newly selected items
//! or a new item as it is added to the list.
virtual void setAutoScrollEnabled(bool scroll) = 0; virtual void setAutoScrollEnabled(bool scroll) = 0;
//! returns true if automatic scrolling is enabled, false if not. //! returns true if automatic scrolling is enabled, false if not.
@ -95,23 +90,23 @@ namespace gui
//! clear all item colors at index //! clear all item colors at index
virtual void clearItemOverrideColor(u32 index) = 0; virtual void clearItemOverrideColor(u32 index) = 0;
//! clear item color at index for given colortype //! clear item color at index for given colortype
virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) = 0; virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) = 0;
//! has the item at index it's color overwritten? //! has the item at index its color overwritten?
virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0; virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
//! return the overwrite color at given item index. //! return the overwrite color at given item index.
virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0; virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
//! return the default color which is used for the given colorType //! return the default color which is used for the given colorType
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0; virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0;
//! set the item at the given index //! set the item at the given index
virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0; virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0;
//! Insert the item at the given index //! Insert the item at the given index
//! Return the index on success or -1 on failure. /** \return The index on success or -1 on failure. */
virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0; virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0;
//! Swap the items at the given indices //! Swap the items at the given indices

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -32,9 +32,6 @@ namespace gui
IGUIMeshViewer(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIMeshViewer(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_MESH_VIEWER, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_MESH_VIEWER, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIMeshViewer() {}
//! Sets the mesh to be shown //! Sets the mesh to be shown
virtual void setMesh(scene::IAnimatedMesh* mesh) = 0; virtual void setMesh(scene::IAnimatedMesh* mesh) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,9 +21,6 @@ namespace gui
IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {}
//! destructor
~IGUIScrollBar() {};
//! gets the maximum value of the scrollbar. //! gets the maximum value of the scrollbar.
virtual s32 getMax() const = 0; virtual s32 getMax() const = 0;
@ -33,15 +30,17 @@ namespace gui
//! gets the small step value //! gets the small step value
virtual s32 getSmallStep() const = 0; virtual s32 getSmallStep() const = 0;
//! Sets the small step, the amount that the value changes by when clicking //! Sets the small step
//! on the buttons or using the cursor keys. /** That is the amount that the value changes by when clicking
on the buttons or using the cursor keys. */
virtual void setSmallStep(s32 step) = 0; virtual void setSmallStep(s32 step) = 0;
//! gets the large step value //! gets the large step value
virtual s32 getLargeStep() const = 0; virtual s32 getLargeStep() const = 0;
//! Sets the large step, the amount that the value changes by when clicking //! Sets the large step
//! in the tray, or using the page up and page down keys. /** That is the amount that the value changes by when clicking
in the tray, or using the page up and page down keys. */
virtual void setLargeStep(s32 step) = 0; virtual void setLargeStep(s32 step) = 0;
//! gets the current position of the scrollbar //! gets the current position of the scrollbar

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -6,6 +6,7 @@
#define __I_GUI_SKIN_H_INCLUDED__ #define __I_GUI_SKIN_H_INCLUDED__
#include "IAttributeExchangingObject.h" #include "IAttributeExchangingObject.h"
#include "EGUIAlignment.h"
#include "SColor.h" #include "SColor.h"
#include "rect.h" #include "rect.h"
@ -270,7 +271,7 @@ namespace gui
"windowRestore", "windowRestore",
"windowClose", "windowClose",
"windowMinimize", "windowMinimize",
"windowResize", "windowResize",
"cursorUp", "cursorUp",
"cursorDown", "cursorDown",
"cursorLeft", "cursorLeft",
@ -325,9 +326,6 @@ namespace gui
{ {
public: public:
//! destructor
virtual ~IGUISkin() {};
//! returns default color //! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0; virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0;
@ -337,7 +335,7 @@ namespace gui
//! returns size for the given size type //! returns size for the given size type
virtual s32 getSize(EGUI_DEFAULT_SIZE size) const = 0; virtual s32 getSize(EGUI_DEFAULT_SIZE size) const = 0;
//! Returns a default text. //! Returns a default text.
/** For example for Message box button captions: /** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */ "OK", "Cancel", "Yes", "No" and so on. */
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const = 0; virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const = 0;
@ -367,50 +365,50 @@ namespace gui
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const = 0; virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const = 0;
//! Sets a default icon //! Sets a default icon
/** Sets the sprite index used for drawing icons like arrows, /** Sets the sprite index used for drawing icons like arrows,
close buttons and ticks in checkboxes close buttons and ticks in checkboxes
\param icon: Enum specifying which icon to change \param icon: Enum specifying which icon to change
\param index: The sprite index used to draw this icon */ \param index: The sprite index used to draw this icon */
virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index) = 0; virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index) = 0;
//! draws a standard 3d button pane //! draws a standard 3d button pane
/** Used for drawing for example buttons in normal state. /** Used for drawing for example buttons in normal state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DButtonPaneStandard(IGUIElement* element, virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0; const core::rect<s32>* clip=0) = 0;
//! draws a pressed 3d button pane //! draws a pressed 3d button pane
/** Used for drawing for example buttons in pressed state. /** Used for drawing for example buttons in pressed state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DButtonPanePressed(IGUIElement* element, virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0; const core::rect<s32>* clip=0) = 0;
//! draws a sunken 3d pane //! draws a sunken 3d pane
/** Used for drawing the background of edit, combo or check boxes. /** Used for drawing the background of edit, combo or check boxes.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param bgcolor: Background color. \param bgcolor: Background color.
\param flat: Specifies if the sunken pane should be flat or displayed as sunken \param flat: Specifies if the sunken pane should be flat or displayed as sunken
deep into the ground. deep into the ground.
\param fillBackGround: Specifies if the background should be filled with the background \param fillBackGround: Specifies if the background should be filled with the background
color or not be drawn at all. color or not be drawn at all.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DSunkenPane(IGUIElement* element, virtual void draw3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat, bool fillBackGround, video::SColor bgcolor, bool flat, bool fillBackGround,
const core::rect<s32>& rect, const core::rect<s32>& rect,
@ -419,12 +417,12 @@ namespace gui
//! draws a window background //! draws a window background
/** Used for drawing the background of dialogs and windows. /** Used for drawing the background of dialogs and windows.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param titleBarColor: Title color. \param titleBarColor: Title color.
\param drawTitleBar: True to enable title drawing. \param drawTitleBar: True to enable title drawing.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. \param clip: Clip area.
\return Returns rect where it would be good to draw title bar text. */ \return Returns rect where it would be good to draw title bar text. */
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element, virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor, bool drawTitleBar, video::SColor titleBarColor,
@ -432,79 +430,82 @@ namespace gui
const core::rect<s32>* clip=0) = 0; const core::rect<s32>* clip=0) = 0;
//! draws a standard 3d menu pane //! draws a standard 3d menu pane
/** Used for drawing for menus and context menus. /** Used for drawing for menus and context menus.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DMenuPane(IGUIElement* element, virtual void draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0; const core::rect<s32>* clip=0) = 0;
//! draws a standard 3d tool bar //! draws a standard 3d tool bar
/** Used for drawing for toolbars and menus. /** Used for drawing for toolbars and menus.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DToolBar(IGUIElement* element, virtual void draw3DToolBar(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0; const core::rect<s32>* clip=0) = 0;
//! draws a tab button //! draws a tab button
/** Used for drawing for tab buttons on top of tabs. /** Used for drawing for tab buttons on top of tabs.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param active: Specifies if the tab is currently active. \param active: Specifies if the tab is currently active.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area.
\param alignment Alignment of GUI element. */
virtual void draw3DTabButton(IGUIElement* element, bool active, virtual void draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0) = 0; const core::rect<s32>& rect, const core::rect<s32>* clip=0, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT) = 0;
//! draws a tab control body //! draws a tab control body
/** \param element: Pointer to the element which wishes to draw this. This parameter /** \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by IGUISkin, but can be used for example by more complex is usually not used by IGUISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param border: Specifies if the border should be drawn. \param border: Specifies if the border should be drawn.
\param background: Specifies if the background should be drawn. \param background: Specifies if the background should be drawn.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area.
\param tabHeight Height of tab.
\param alignment Alignment of GUI element. */
virtual void draw3DTabBody(IGUIElement* element, bool border, bool background, virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0) = 0; const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT ) = 0;
//! draws an icon, usually from the skin's sprite bank //! draws an icon, usually from the skin's sprite bank
/** \param element: Pointer to the element which wishes to draw this icon. /** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly. by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn. \param icon: Specifies the icon to be drawn.
\param position: The position to draw the icon \param position: The position to draw the icon
\param starttime: The time at the start of the animation \param starttime: The time at the start of the animation
\param currenttime: The present time, used to calculate the frame number \param currenttime: The present time, used to calculate the frame number
\param loop: Whether the animation should loop or not \param loop: Whether the animation should loop or not
\param clip: Clip area. */ \param clip: Clip area. */
virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon, virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position, u32 starttime=0, u32 currenttime=0, const core::position2di position, u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0) = 0; bool loop=false, const core::rect<s32>* clip=0) = 0;
//! draws a 2d rectangle. //! draws a 2d rectangle.
/** \param element: Pointer to the element which wishes to draw this icon. /** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly. by more complex implementations to find out how to draw the part exactly.
\param color: Color of the rectangle to draw. The alpha component specifies how \param color: Color of the rectangle to draw. The alpha component specifies how
transparent the rectangle will be. transparent the rectangle will be.
\param pos: Position of the rectangle. \param pos: Position of the rectangle.
\param clip: Pointer to rectangle against which the rectangle will be clipped. \param clip: Pointer to rectangle against which the rectangle will be clipped.
If the pointer is null, no clipping will be performed. */ If the pointer is null, no clipping will be performed. */
virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color, virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
const core::rect<s32>& pos, const core::rect<s32>* clip = 0) = 0; const core::rect<s32>& pos, const core::rect<s32>* clip = 0) = 0;
//! get the type of this skin //! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }; virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }
}; };

View File

@ -1,5 +1,6 @@
// Copyright (C) 2006 Michael Zeilfelder // Copyright (C) 2006-2009 Michael Zeilfelder
// This file uses the licence of the Irrlicht Engine. // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_SPIN_BOX_H_INCLUDED__ #ifndef __I_GUI_SPIN_BOX_H_INCLUDED__
#define __I_GUI_SPIN_BOX_H_INCLUDED__ #define __I_GUI_SPIN_BOX_H_INCLUDED__
@ -22,13 +23,7 @@ namespace gui
s32 id, core::rect<s32> rectangle) s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUISpinBox() {}
//! Access the edit box used in the spin control //! Access the edit box used in the spin control
/** \param enable: If set to true, the override color, which can be set
with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
virtual IGUIEditBox* getEditBox() const = 0; virtual IGUIEditBox* getEditBox() const = 0;
//! set the current value of the spinbox //! set the current value of the spinbox

View File

@ -1,3 +1,6 @@
// Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_SPRITE_BANK_H_INCLUDED__ #ifndef __I_GUI_SPRITE_BANK_H_INCLUDED__
#define __I_GUI_SPRITE_BANK_H_INCLUDED__ #define __I_GUI_SPRITE_BANK_H_INCLUDED__
@ -18,15 +21,18 @@ namespace video
namespace gui namespace gui
{ {
//! A single sprite frame.
struct SGUISpriteFrame struct SGUISpriteFrame
{ {
u32 textureNumber; u32 textureNumber;
u32 rectNumber; u32 rectNumber;
}; };
//! A sprite composed of several frames.
struct SGUISprite struct SGUISprite
{ {
SGUISprite() : Frames(), frameTime(0) { }; SGUISprite() : Frames(), frameTime(0) {}
core::array<SGUISpriteFrame> Frames; core::array<SGUISpriteFrame> Frames;
u32 frameTime; u32 frameTime;
}; };
@ -37,9 +43,6 @@ class IGUISpriteBank : public virtual IReferenceCounted
{ {
public: public:
//! Destructor
virtual ~IGUISpriteBank() {}
//! Returns the list of rectangles held by the sprite bank //! Returns the list of rectangles held by the sprite bank
virtual core::array< core::rect<s32> >& getPositions() = 0; virtual core::array< core::rect<s32> >& getPositions() = 0;
@ -59,10 +62,11 @@ public:
virtual void setTexture(u32 index, video::ITexture* texture) = 0; virtual void setTexture(u32 index, video::ITexture* texture) = 0;
//! Draws a sprite in 2d with position and color //! Draws a sprite in 2d with position and color
virtual void draw2DSprite(u32 index, const core::position2di& pos, const core::rect<s32>* clip=0, virtual void draw2DSprite(u32 index, const core::position2di& pos,
const core::rect<s32>* clip=0,
const video::SColor& color= video::SColor(255,255,255,255), const video::SColor& color= video::SColor(255,255,255,255),
u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false) = 0; u32 starttime=0, u32 currenttime=0,
bool loop=true, bool center=false) = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -23,30 +23,27 @@ namespace gui
IGUIStaticText(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIStaticText(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_STATIC_TEXT, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_STATIC_TEXT, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIStaticText() {}
//! Sets another skin independent font. //! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin. /** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */ \param font: New font to set. */
virtual void setOverrideFont(IGUIFont* font=0) = 0; virtual void setOverrideFont(IGUIFont* font=0) = 0;
//! Gets the override font (if any) //! Gets the override font (if any)
//! \return The override font (may be 0) /** \return The override font (may be 0) */
virtual IGUIFont* getOverrideFont(void) const = 0; virtual IGUIFont* getOverrideFont(void) const = 0;
//! Sets another color for the text. //! Sets another color for the text.
/** If set, the static text does not use the EGDC_BUTTON_TEXT color defined /** If set, the static text does not use the EGDC_BUTTON_TEXT color defined
in the skin, but the set color instead. You don't need to call in the skin, but the set color instead. You don't need to call
IGUIStaticText::enableOverrrideColor(true) after this, this is done IGUIStaticText::enableOverrrideColor(true) after this, this is done
by this function. by this function.
If you set a color, and you want the text displayed with the color If you set a color, and you want the text displayed with the color
of the skin again, call IGUIStaticText::enableOverrideColor(false); of the skin again, call IGUIStaticText::enableOverrideColor(false);
\param color: New color of the text. */ \param color: New color of the text. */
virtual void setOverrideColor(video::SColor color) = 0; virtual void setOverrideColor(video::SColor color) = 0;
//! Gets the override color //! Gets the override color
//! \return: The override color /** \return: The override color */
virtual video::SColor const& getOverrideColor(void) const = 0; virtual video::SColor const& getOverrideColor(void) const = 0;
//! Sets if the static text should use the overide color or the color in the gui skin. //! Sets if the static text should use the overide color or the color in the gui skin.
@ -56,7 +53,7 @@ namespace gui
virtual void enableOverrideColor(bool enable) = 0; virtual void enableOverrideColor(bool enable) = 0;
//! Checks if an override color is enabled //! Checks if an override color is enabled
//! \return true if the override color is enabled, false otherwise /** \return true if the override color is enabled, false otherwise */
virtual bool isOverrideColorEnabled(void) const = 0; virtual bool isOverrideColorEnabled(void) const = 0;
//! Sets another color for the background. //! Sets another color for the background.
@ -69,30 +66,30 @@ namespace gui
virtual void setDrawBorder(bool draw) = 0; virtual void setDrawBorder(bool draw) = 0;
//! Sets text justification mode //! Sets text justification mode
/** \param horizontal: EGUIA_UPPERLEFT for left justified (default), /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text. EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
\param vertical: EGUIA_UPPERLEFT to align with top edge, \param vertical: EGUIA_UPPERLEFT to align with top edge,
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */ EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0; virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
//! Enables or disables word wrap for using the static text as multiline text control. //! Enables or disables word wrap for using the static text as multiline text control.
/** \param enable: If set to true, words going over one line are /** \param enable: If set to true, words going over one line are
broken on to the next line. */ broken on to the next line. */
virtual void setWordWrap(bool enable) = 0; virtual void setWordWrap(bool enable) = 0;
//! Checks if word wrap is enabled //! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise /** \return true if word wrap is enabled, false otherwise */
virtual bool isWordWrapEnabled(void) const = 0; virtual bool isWordWrapEnabled(void) const = 0;
//! Returns the height of the text in pixels when it is drawn. //! Returns the height of the text in pixels when it is drawn.
/** This is useful for adjusting the layout of gui elements based on the height /** This is useful for adjusting the layout of gui elements based on the height
of the multiline text in this element. of the multiline text in this element.
\return Returns height of text in pixels. */ \return Height of text in pixels. */
virtual s32 getTextHeight() const = 0; virtual s32 getTextHeight() const = 0;
//! Returns the width of the current text, in the current font //! Returns the width of the current text, in the current font
/** If the text is broken, this returns the width of the widest line /** If the text is broken, this returns the width of the widest line
\return The width of the text, or the widest broken line. */ \return The width of the text, or the widest broken line. */
virtual s32 getTextWidth(void) const = 0; virtual s32 getTextWidth(void) const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -7,6 +7,7 @@
#include "IGUIElement.h" #include "IGUIElement.h"
#include "SColor.h" #include "SColor.h"
#include "IGUISkin.h"
namespace irr namespace irr
{ {
@ -21,9 +22,6 @@ namespace gui
IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITab() {}
//! Returns number of tab if in tabcontrol. //! Returns number of tab if in tabcontrol.
/** Can be accessed later IGUITabControl::getTab() by this number. */ /** Can be accessed later IGUITabControl::getTab() by this number. */
virtual s32 getNumber() const = 0; virtual s32 getNumber() const = 0;
@ -39,6 +37,12 @@ namespace gui
//! returns the color of the background //! returns the color of the background
virtual video::SColor getBackgroundColor() const = 0; virtual video::SColor getBackgroundColor() const = 0;
//! sets the color of the text
virtual void setTextColor(video::SColor c) = 0;
//! gets the color of the text
virtual video::SColor getTextColor() const = 0;
}; };
//! A standard tab control //! A standard tab control
@ -50,9 +54,6 @@ namespace gui
IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITabControl() {}
//! Adds a tab //! Adds a tab
virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0; virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0;
@ -62,21 +63,43 @@ namespace gui
//! Returns a tab based on zero based index //! Returns a tab based on zero based index
/** \param idx: zero based index of tab. Is a value betwenn 0 and getTabcount()-1; /** \param idx: zero based index of tab. Is a value betwenn 0 and getTabcount()-1;
\return Returns pointer to the Tab. Returns 0 if no tab \return Returns pointer to the Tab. Returns 0 if no tab
is corresponding to this tab. */ is corresponding to this tab. */
virtual IGUITab* getTab(s32 idx) const = 0; virtual IGUITab* getTab(s32 idx) const = 0;
//! Brings a tab to front. //! Brings a tab to front.
/** \param idx: number of the tab. /** \param idx: number of the tab.
\return Returns true if successful. */ \return Returns true if successful. */
virtual bool setActiveTab(s32 idx) = 0; virtual bool setActiveTab(s32 idx) = 0;
//! Brings a tab to front. //! Brings a tab to front.
/** \param tab: pointer to the tab. /** \param tab: pointer to the tab.
\return Returns true if successful. */ \return Returns true if successful. */
virtual bool setActiveTab(IGUIElement *tab) = 0; virtual bool setActiveTab(IGUIElement *tab) = 0;
//! Returns which tab is currently active //! Returns which tab is currently active
virtual s32 getActiveTab() const = 0; virtual s32 getActiveTab() const = 0;
//! Set the height of the tabs
virtual void setTabHeight( s32 height ) = 0;
//! Get the height of the tabs
/** return Returns the height of the tabs */
virtual s32 getTabHeight() const = 0;
//! Set the alignment of the tabs
/** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */
virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0;
//! Get the alignment of the tabs
/** return Returns the alignment of the tabs */
virtual gui::EGUI_ALIGNMENT getTabVerticalAlignment() const = 0;
//! Set the extra width added to tabs on each side of the text
virtual void setTabExtraWidth( s32 extraWidth ) = 0;
//! Get the extra width added to tabs on each side of the text
/** return Returns the extra width of the tabs */
virtual s32 getTabExtraWidth() const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -26,9 +26,6 @@ namespace gui
IGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIToolBar() {}
//! Adds a button to the tool bar //! Adds a button to the tool bar
virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0, virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0,
video::ITexture* img=0, video::ITexture* pressedimg=0, video::ITexture* img=0, video::ITexture* pressedimg=0,

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -23,9 +23,6 @@ namespace gui
IGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) IGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {} : IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIWindow() {}
//! Returns pointer to the close button //! Returns pointer to the close button
virtual IGUIButton* getCloseButton() const = 0; virtual IGUIButton* getCloseButton() const = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -7,6 +7,7 @@
#include "IReferenceCounted.h" #include "IReferenceCounted.h"
#include "position2d.h" #include "position2d.h"
#include "rect.h"
#include "SColor.h" #include "SColor.h"
namespace irr namespace irr
@ -18,9 +19,10 @@ namespace video
/** A color format specifies how color information is stored. */ /** A color format specifies how color information is stored. */
enum ECOLOR_FORMAT enum ECOLOR_FORMAT
{ {
//! 16 bit color format used by the software driver, and thus preferred //! 16 bit color format used by the software driver.
//! by all other irrlicht engine video drivers. There are 5 bits for every /** It is thus preferred by all other irrlicht engine video drivers.
//! color component, and a single bit is left for alpha information. There are 5 bits for every color component, and a single bit is left
for alpha information. */
ECF_A1R5G5B5 = 0, ECF_A1R5G5B5 = 0,
//! Standard 16 bit color format. //! Standard 16 bit color format.
@ -29,13 +31,12 @@ enum ECOLOR_FORMAT
//! 24 bit color, no alpha channel, but 8 bit for red, green and blue. //! 24 bit color, no alpha channel, but 8 bit for red, green and blue.
ECF_R8G8B8, ECF_R8G8B8,
//! Default 32 bit color format. 8 bits are used for every component: //! Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
//! red, green, blue and alpha.
ECF_A8R8G8B8 ECF_A8R8G8B8
}; };
//! Interface for software image data. //! Interface for software image data.
/** Image loaders create these images from files. IVideoDrivers convert /** Image loaders create these images from files. IVideoDrivers convert
these images into their (hardware) textures. these images into their (hardware) textures.
*/ */
@ -43,20 +44,17 @@ class IImage : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Lock function. Use this to get a pointer to the image data.
virtual ~IImage() {} /** After you don't need the pointer anymore, you must call unlock().
\return Pointer to the image data. What type of data is pointed to
//! Lock function. Use this to get a pointer to the image data. After you depends on the color format of the image. For example if the color
//! don't need the pointer anymore, you must call unlock(). format is ECF_A8R8G8B8, it is of u32. Be sure to call unlock() after
//! \return Returns pointer to the image data. What type of data you don't need the pointer any more. */
//! is pointed to depends on the color format of the image. For example
//! if the color format is ECF_A8R8G8B8, it is of u32.
//! Be sure to call unlock() after you don't need the pointer any more.
virtual void* lock() = 0; virtual void* lock() = 0;
//! Unlock function. //! Unlock function.
//! Should be called after the pointer received by lock() is not /** Should be called after the pointer received by lock() is not
//! needed anymore. needed anymore. */
virtual void unlock() = 0; virtual void unlock() = 0;
//! Returns width and height of image data. //! Returns width and height of image data.
@ -74,35 +72,49 @@ public:
//! Returns image data size in pixels //! Returns image data size in pixels
virtual u32 getImageDataSizeInPixels() const = 0; virtual u32 getImageDataSizeInPixels() const = 0;
//! returns a pixel //! Returns a pixel
virtual SColor getPixel(u32 x, u32 y) const = 0; virtual SColor getPixel(u32 x, u32 y) const = 0;
//! sets a pixel //! Sets a pixel
virtual void setPixel(u32 x, u32 y, const SColor &color ) = 0; virtual void setPixel(u32 x, u32 y, const SColor &color ) = 0;
//! returns the color format //! Returns the color format
virtual ECOLOR_FORMAT getColorFormat() const = 0; virtual ECOLOR_FORMAT getColorFormat() const = 0;
//! returns mask for red value of a pixel //! Returns mask for red value of a pixel
virtual u32 getRedMask() const = 0; virtual u32 getRedMask() const = 0;
//! returns mask for green value of a pixel //! Returns mask for green value of a pixel
virtual u32 getGreenMask() const = 0; virtual u32 getGreenMask() const = 0;
//! returns mask for blue value of a pixel //! Returns mask for blue value of a pixel
virtual u32 getBlueMask() const = 0; virtual u32 getBlueMask() const = 0;
//! returns mask for alpha value of a pixel //! Returns mask for alpha value of a pixel
virtual u32 getAlphaMask() const = 0; virtual u32 getAlphaMask() const = 0;
//! returns pitch of image //! Returns pitch of image
virtual u32 getPitch() const = 0; virtual u32 getPitch() const =0;
//! copies the image into the target, scaling the image to fit //! Copies the image into the target, scaling the image to fit
virtual void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0) = 0; virtual void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0) =0;
//! copies the image into the target, scaling the image to fit //! Copies the image into the target, scaling the image to fit
virtual void copyToScaling(IImage* target) = 0; virtual void copyToScaling(IImage* target) =0;
//! copies this surface into another
virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0)) =0;
//! copies this surface into another
virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0) =0;
//! copies this surface into another, using the alpha mask, an cliprect and a color to add with
virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect, const SColor &color,
const core::rect<s32>* clipRect = 0) =0;
//! fills the surface with black or white
virtual void fill(const SColor &color) =0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,26 +17,30 @@ namespace io
namespace video namespace video
{ {
//! Class which is able to create a image from a file. //! Class which is able to create a image from a file.
/** If you want the Irrlicht Engine be able to load textures of /** If you want the Irrlicht Engine be able to load textures of
currently unsupported file formats (e.g .gif), then implement currently unsupported file formats (e.g .gif), then implement
this and add your new Surface loader with this and add your new Surface loader with
IVideoDriver::addExternalImageLoader() to the engine. */ IVideoDriver::addExternalImageLoader() to the engine. */
class IImageLoader : public virtual IReferenceCounted class IImageLoader : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Check if the file might be loaded by this class
virtual ~IImageLoader() {} /** Check is based on the file extension (e.g. ".tga")
\param fileName Name of file to check.
//! returns true if the file maybe is able to be loaded by this class \return True if file seems to be loadable. */
//! based on the file extension (e.g. ".tga")
virtual bool isALoadableFileExtension(const c8* fileName) const = 0; virtual bool isALoadableFileExtension(const c8* fileName) const = 0;
//! returns true if the file maybe is able to be loaded by this class //! Check if the file might be loaded by this class
/** Check might look into the file.
\param file File handle to check.
\return True if file seems to be loadable. */
virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0; virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;
//! creates a surface from the file //! Creates a surface from the file
/** \param file File handle to check.
\return Pointer to newly created image, or 0 upon error. */
virtual IImage* loadImage(io::IReadFile* file) const = 0; virtual IImage* loadImage(io::IReadFile* file) const = 0;
}; };

View File

@ -1,3 +1,7 @@
// Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef _I_IMAGE_WRITER_H_INCLUDED__ #ifndef _I_IMAGE_WRITER_H_INCLUDED__
#define _I_IMAGE_WRITER_H_INCLUDED__ #define _I_IMAGE_WRITER_H_INCLUDED__
@ -19,13 +23,16 @@ namespace video
class IImageWriter : public IReferenceCounted class IImageWriter : public IReferenceCounted
{ {
public: public:
//! destructor //! Check if this writer can write a file with the given extension
virtual ~IImageWriter() { } /** \param fileName Name of the file to check.
\return True if file extension specifies a writable type. */
//! return true if this writer can write a file with the given extension
virtual bool isAWriteableFileExtension(const c8* fileName) const = 0; virtual bool isAWriteableFileExtension(const c8* fileName) const = 0;
//! write image to file //! Write image to file
/** \param file File handle to write to.
\param image Image to write into file.
\param param Writer specific parameter, influencing e.g. quality.
\return True if image was successfully written. */
virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param = 0) const = 0; virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param = 0) const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -13,32 +13,63 @@ namespace irr
namespace scene namespace scene
{ {
//! Scene node which is a dynamic light. //! Scene node which is a dynamic light.
/** You can switch the light on and off by /** You can switch the light on and off by making it visible or not. It can be
making it visible or not, and let it be animated by ordinary scene node animators. animated by ordinary scene node animators. If the light type is directional or
If you set the light type to be directional, you will need to set the direction of the spot, the direction of the light source is defined by the rotation of the scene
light source manually in the SLight structure, the position of the scene node will have no node (assuming (0,0,1) as the local direction of the light).
effect on this direction.
*/ */
class ILightSceneNode : public ISceneNode class ILightSceneNode : public ISceneNode
{ {
public: public:
//! constructor //! constructor
ILightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, ILightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0)) const core::vector3df& position = core::vector3df(0,0,0))
: ISceneNode(parent, mgr, id, position) {} : ISceneNode(parent, mgr, id, position) {}
//! Sets the light data associated with this ILightSceneNode //! Sets the light data associated with this ILightSceneNode
/** \param light The new light data. */
virtual void setLightData(const video::SLight& light) = 0; virtual void setLightData(const video::SLight& light) = 0;
//! Gets the light data associated with this ILightSceneNode //! Gets the light data associated with this ILightSceneNode
//! \return Returns the light data. /** \return The light data. */
virtual const video::SLight& getLightData() const = 0; virtual const video::SLight& getLightData() const = 0;
//! Gets the light data associated with this ILightSceneNode //! Gets the light data associated with this ILightSceneNode
//! \return Returns the light data. /** \return The light data. */
virtual video::SLight& getLightData() = 0; virtual video::SLight& getLightData() = 0;
//! Sets the light's radius of influence.
/** Outside this radius the light won't lighten geometry and cast no
shadows. Setting the radius will also influence the attenuation, setting
it to (0,1/radius,0). If you want to override this behavior, set the
attenuation after the radius.
\param radius The new radius. */
virtual void setRadius(f32 radius) = 0;
//! Gets the light's radius of influence.
/** \return The current radius. */
virtual f32 getRadius() const = 0;
//! Sets the light type.
/** \param type The new type. */
virtual void setLightType(video::E_LIGHT_TYPE type) = 0;
//! Gets the light type.
/** \return The current light type. */
virtual video::E_LIGHT_TYPE getLightType() const = 0;
//! Sets whether this light casts shadows.
/** Enabling this flag won't automatically cast shadows, the meshes
will still need shadow scene nodes attached. But one can enable or
disable distinct lights for shadow casting for performance reasons.
\param shadow True if this light shall cast shadows. */
virtual void enableCastShadow(bool shadow=true) = 0;
//! Check whether this light casts shadows.
/** \return True if light would cast shadows, else false. */
virtual bool getCastShadow() const = 0;
}; };
} // end namespace scene } // end namespace scene

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -10,10 +10,10 @@
namespace irr namespace irr
{ {
//! Possible log levels.
enum ELOG_LEVEL enum ELOG_LEVEL
{ {
//! High log level, warnings, errors and important information //! High log level, warnings, errors and important information texts are printed out.
//! texts are printed out.
ELL_INFORMATION = 0, ELL_INFORMATION = 0,
//! Default log level, warnings and errors are printed out //! Default log level, warnings and errors are printed out
@ -32,60 +32,59 @@ class ILogger : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Destructor
virtual ~ILogger() {} virtual ~ILogger() {}
//! Returns the current set log level. //! Returns the current set log level.
virtual ELOG_LEVEL getLogLevel() const = 0; virtual ELOG_LEVEL getLogLevel() const = 0;
//! Sets a new log level. With this value, texts which are sent to //! Sets a new log level.
//! the logger are filtered out. For example setting this value to /** With this value, texts which are sent to the logger are filtered
//! ELL_WARNING, only warnings and out. For example setting this value to ELL_WARNING, only warnings and
//! errors are printed out. Setting it to ELL_INFORMATION, which is errors are printed out. Setting it to ELL_INFORMATION, which is the
//! the default setting, warnings, default setting, warnings, errors and informational texts are printed
//! errors and informational texts are printed out. out.
//! \param ll: new log level filter value. \param ll: new log level filter value. */
virtual void setLogLevel(ELOG_LEVEL ll) = 0; virtual void setLogLevel(ELOG_LEVEL ll) = 0;
//! Prints out a text into the log //! Prints out a text into the log
//! \param text: Text to print out. /** \param text: Text to print out.
//! \param ll: Log level of the text. If the text is an error, set \param ll: Log level of the text. If the text is an error, set
//! it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
//! is just an informational text, set it to ELL_INFORMATION. Texts are is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed, filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE. independent on what level filter is set, use ELL_NONE. */
virtual void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0; virtual void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log //! Prints out a text into the log
//! \param text: Text to print out. /** \param text: Text to print out.
//! \param hint: Additional info. This string is added after a " :" to the \param hint: Additional info. This string is added after a " :" to the
//! string. string.
//! \param ll: Log level of the text. If the text is an error, set \param ll: Log level of the text. If the text is an error, set
//! it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
//! is just an informational text, set it to ELL_INFORMATION. Texts are is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed, filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE. independent on what level filter is set, use ELL_NONE. */
virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0; virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log //! Prints out a text into the log
//! \param text: Text to print out. /** \param text: Text to print out.
//! \param hint: Additional info. This string is added after a " :" to the \param hint: Additional info. This string is added after a " :" to the
//! string. string.
//! \param ll: Log level of the text. If the text is an error, set \param ll: Log level of the text. If the text is an error, set
//! it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
//! is just an informational text, set it to ELL_INFORMATION. Texts are is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed, filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE. independent on what level filter is set, use ELL_NONE. */
virtual void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0; virtual void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log //! Prints out a text into the log
//! \param text: Text to print out. /** \param text: Text to print out.
//! \param ll: Log level of the text. If the text is an error, set \param ll: Log level of the text. If the text is an error, set
//! it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
//! is just an informational text, set it to ELL_INFORMATION. Texts are is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed, filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE. independent on what level filter is set, use ELL_NONE. */
virtual void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0; virtual void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,79 +11,83 @@
namespace irr namespace irr
{ {
namespace video namespace video
{ {
class IVideoDriver; class IVideoDriver;
class IMaterialRendererServices; class IMaterialRendererServices;
//! Interface for material rendering. Can be used to extend the engine with new materials. //! Interface for material rendering.
/** Refer to IVideoDriver::addMaterialRenderer() for more informations on how to extend the engine /** Can be used to extend the engine with new materials. Refer to
with new materials. IVideoDriver::addMaterialRenderer() for more informations on how to extend the
*/ engine with new materials. */
class IMaterialRenderer : public virtual IReferenceCounted class IMaterialRenderer : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Called by the IVideoDriver implementation the let the renderer set its needed render states.
virtual ~IMaterialRenderer() {}
//! Called by the IVideoDriver implementation the let the renderer set its needed render states.
/** This is called during the IVideoDriver::setMaterial() call. /** This is called during the IVideoDriver::setMaterial() call.
When overriding this, you can set some renderstates or for example a vertex or pixel shader When overriding this, you can set some renderstates or for example a
if you like. vertex or pixel shader if you like.
\param material: The new material parameters to be set. The renderer may change the material \param material: The new material parameters to be set. The renderer
flags in this material. For example if this material does not accept the zbuffer = true, it may change the material flags in this material. For example if this
can set it to false. This is useful, because in the next lastMaterial will be just the material material does not accept the zbuffer = true, it can set it to false.
in this call. This is useful, because in the next lastMaterial will be just the
\param lastMaterial: The material parameters which have been set before this material. material in this call.
\param resetAllRenderstates: True if all renderstates should really be reset. This is usually \param lastMaterial: The material parameters which have been set before
true if the last rendering mode was not a usual 3d rendering mode, but for example this material.
a 2d rendering mode. \param resetAllRenderstates: True if all renderstates should really be
You should reset really all renderstates if this is true, no matter if the lastMaterial had reset. This is usually true if the last rendering mode was not a usual
some similar settings. This is used because in most cases, some common renderstates are not 3d rendering mode, but for example a 2d rendering mode.
changed if they are already there, for example bilinear filtering, wireframe, gouraudshading, You should reset really all renderstates if this is true, no matter if
lighting, zbuffer, zwriteenable, backfaceculling and fogenable. the lastMaterial had some similar settings. This is used because in
\param services: Interface providing some methods for changing advanced, internal most cases, some common renderstates are not changed if they are
states of a IVideoDriver. */ already there, for example bilinear filtering, wireframe,
gouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and
fogenable.
\param services: Interface providing some methods for changing
advanced, internal states of a IVideoDriver. */
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
bool resetAllRenderstates, IMaterialRendererServices* services) {}; bool resetAllRenderstates, IMaterialRendererServices* services) {}
//! Called every time before a new bunch of geometry is being drawn using this material with //! Called every time before a new bunch of geometry is being drawn using this material with for example drawIndexedTriangleList() call.
//! for example drawIndexedTriangleList() call. /** OnSetMaterial should normally only be called if the renderer decides
/** OnSetMaterial should normally only be called if the renderer decides that the renderstates should be changed, it won't be called if for that the renderstates should be changed, it won't be called if for
example two drawIndexedTriangleList() will be called with the same material set. This example two drawIndexedTriangleList() will be called with the same
method will be called every time. This is useful for example for materials with shaders, material set. This method will be called every time. This is useful for
which don't only set new renderstates but also shader constants. example for materials with shaders, which don't only set new
\param service: Pointer to interface providing methos for setting constants and other things. renderstates but also shader constants.
\param vtxtype: Vertex type with which the next rendering will be done. This can be used \param service: Pointer to interface providing methos for setting
by the material renderer to set some specific optimized shaders or if this is an incompatible constants and other things.
vertex type for this renderer, to refuse rendering for example. \param vtxtype: Vertex type with which the next rendering will be done.
\return Returns true if everything is ok, and false if nothing should be rendered. This can be used by the material renderer to set some specific
The material renderer can choose to return false for example if he doesn't support the optimized shaders or if this is an incompatible vertex type for this
specified vertex type. This is actually done in D3D8 and D3D9 when using a renderer, to refuse rendering for example.
normal mapped material with a vertex type other than EVT_TANGENTS. */ \return Returns true if everything is ok, and false if nothing should
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) { return true; }; be rendered. The material renderer can choose to return false for
example if he doesn't support the specified vertex type. This is
actually done in D3D8 and D3D9 when using a normal mapped material with
a vertex type other than EVT_TANGENTS. */
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) { return true; }
//! Called by the IVideoDriver to unset this material. //! Called by the IVideoDriver to unset this material.
/** Called during the /** Called during the IVideoDriver::setMaterial() call before the new
IVideoDriver::setMaterial() call before the new material will get the OnSetMaterial() material will get the OnSetMaterial() call. */
call. */
virtual void OnUnsetMaterial() {} virtual void OnUnsetMaterial() {}
//! Returns if the material is transparent. //! Returns if the material is transparent.
/** The scene managment needs to know this /** The scene managment needs to know this
for being able to sort the materials by opaque and transparent. */ for being able to sort the materials by opaque and transparent. */
virtual bool isTransparent() const { return false; } virtual bool isTransparent() const { return false; }
//! Returns the render capability of the material. //! Returns the render capability of the material.
/** Because some more complex materials /** Because some more complex materials
are implemented in multiple ways and need special hardware capabilities, it is possible are implemented in multiple ways and need special hardware capabilities, it is possible
to query how the current material renderer is performing on the current hardware with this to query how the current material renderer is performing on the current hardware with this
function. function.
\return Returns 0 if everything is running fine. Any other value is material renderer \return Returns 0 if everything is running fine. Any other value is material renderer
specific and means for example that the renderer switched back to a fall back material because specific and means for example that the renderer switched back to a fall back material because
it cannot use the latest shaders. More specific examples: it cannot use the latest shaders. More specific examples:
Fixed function pipeline materials should return 0 in most cases, parallax mapped Fixed function pipeline materials should return 0 in most cases, parallax mapped
material will only return 0 when at least pixel shader 1.4 is available on that machine. */ material will only return 0 when at least pixel shader 1.4 is available on that machine. */
virtual s32 getRenderCapability() const { return 0; } virtual s32 getRenderCapability() const { return 0; }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,7 +11,7 @@
namespace irr namespace irr
{ {
namespace video namespace video
{ {
class IVideoDriver; class IVideoDriver;
@ -20,69 +20,80 @@ class IVideoDriver;
//! Interface providing some methods for changing advanced, internal states of a IVideoDriver. //! Interface providing some methods for changing advanced, internal states of a IVideoDriver.
class IMaterialRendererServices class IMaterialRendererServices
{ {
public: public:
//! destructor //! Destructor
virtual ~IMaterialRendererServices() {} virtual ~IMaterialRendererServices() {}
//! Can be called by an IMaterialRenderer to make its work easier. //! Can be called by an IMaterialRenderer to make its work easier.
//! Sets all basic renderstates if needed. /** Sets all basic renderstates if needed.
//! Basic render states are diffuse, ambient, specular, and emissive color, specular power, Basic render states are diffuse, ambient, specular, and emissive color,
//! bilinear and trilinear filtering, wireframe mode, specular power, bilinear and trilinear filtering, wireframe mode,
//! grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and fog enabling. grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and
virtual void setBasicRenderStates(const SMaterial& material, fog enabling.
\param material The new material to be used.
\param lastMaterial The material used until now.
\param resetAllRenderstates Set to true if all renderstates should be
set, regardless of their current state. */
virtual void setBasicRenderStates(const SMaterial& material,
const SMaterial& lastMaterial, const SMaterial& lastMaterial,
bool resetAllRenderstates) = 0; bool resetAllRenderstates) = 0;
//! Sets a constant for the vertex shader based on a name. This can be used if you used //! Sets a constant for the vertex shader based on a name.
//! a high level shader language like GLSL or HLSL to create a shader. Example: If you /** This can be used if you used a high level shader language like GLSL
//! created a shader which has variables named 'mWorldViewProj' (containing the or HLSL to create a shader. Example: If you created a shader which has
//! WorldViewProjection matrix) and another one named 'fTime' containing one float, variables named 'mWorldViewProj' (containing the WorldViewProjection
//! you can set them in your IShaderConstantSetCallBack derived class like this: matrix) and another one named 'fTime' containing one float, you can set
//! \code them in your IShaderConstantSetCallBack derived class like this:
//! virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData) \code
//! { virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
//! video::IVideoDriver* driver = services->getVideoDriver(); {
//! video::IVideoDriver* driver = services->getVideoDriver();
//! f32 time = (f32)os::Timer::getTime()/100000.0f;
//! services->setVertexShaderConstant("fTime", &time, 1); f32 time = (f32)os::Timer::getTime()/100000.0f;
//! services->setVertexShaderConstant("fTime", &time, 1);
//! core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
//! worldViewProj *= driver->getTransform(video::ETS_VIEW); core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
//! worldViewProj *= driver->getTransform(video::ETS_WORLD); worldViewProj *= driver->getTransform(video::ETS_VIEW);
//! services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16); worldViewProj *= driver->getTransform(video::ETS_WORLD);
//! } services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
//! \endcode }
//! \param name: Name of the variable \endcode
//! \param floats: Pointer to array of floats \param name Name of the variable
//! \param count: Amount of floats in array. \param floats Pointer to array of floats
//! \return: Returns true if successful. \param count Amount of floats in array.
\return True if successful.
*/
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0; virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0;
//! Sets a vertex shader constant. Can be used if you created a shader using //! Sets a vertex shader constant.
//! pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program. /** Can be used if you created a shader using pixel/vertex shader
//! \param data: Data to be set in the constants assembler or ARB_fragment_program or ARB_vertex_program.
//! \param startRegister: First register to be set \param data: Data to be set in the constants
//! \param constantAmount: Amount of registers to be set. One register consists of 4 floats. \param startRegister: First register to be set
\param constantAmount: Amount of registers to be set. One register consists of 4 floats. */
virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0; virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
//! Sets a constant for the pixel shader based on a name. This can be used if you used //! Sets a constant for the pixel shader based on a name.
//! a high level shader language like GLSL or HLSL to create a shader. See /** This can be used if you used a high level shader language like GLSL
//! setVertexShaderConstant() for an example on how to use this. or HLSL to create a shader. See setVertexShaderConstant() for an
//! \param name: Name of the variable example on how to use this.
//! \param floats: Pointer to array of floats \param name Name of the variable
//! \param count: Amount of floats in array. \param floats Pointer to array of floats
//! \return: Returns true if successful. \param count Amount of floats in array.
\return True if successful. */
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0; virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0;
//! Sets a pixel shader constant. Can be used if you created a shader using //! Sets a pixel shader constant.
//! pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program. /** Can be used if you created a shader using pixel/vertex shader
//! \param data: Data to be set in the constants assembler or ARB_fragment_program or ARB_vertex_program.
//! \param startRegister: First register to be set. \param data Data to be set in the constants
//! \param constantAmount: Amount of registers to be set. One register consists of 4 floats. \param startRegister First register to be set.
\param constantAmount Amount of registers to be set. One register consists of 4 floats. */
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0; virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
//! Returns a pointer to the IVideoDriver interface //! Get pointer to the IVideoDriver interface
/** \return Pointer to the IVideoDriver interface */
virtual IVideoDriver* getVideoDriver() = 0; virtual IVideoDriver* getVideoDriver() = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -7,6 +7,7 @@
#include "IReferenceCounted.h" #include "IReferenceCounted.h"
#include "SMaterial.h" #include "SMaterial.h"
#include "EHardwareBufferFlags.h"
namespace irr namespace irr
{ {
@ -14,45 +15,57 @@ namespace scene
{ {
class IMeshBuffer; class IMeshBuffer;
//! Class for accessing a mesh with multiple mesh buffers. //! Class which holds the geometry of an object.
/** An IMesh is nothing more than a collection of some mesh buffers (IMeshBuffer). /** An IMesh is nothing more than a collection of some mesh buffers
SMesh is a simple implementation of an IMesh. (IMeshBuffer). SMesh is a simple implementation of an IMesh.
A mesh is usually added to an IMeshSceneNode in order to be rendered.
*/ */
class IMesh : public virtual IReferenceCounted class IMesh : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Get the amount of mesh buffers.
virtual ~IMesh() { } /** \return Amount of mesh buffers (IMeshBuffer) in this mesh. */
//! Returns the amount of mesh buffers.
/** \return Returns the amount of mesh buffers (IMeshBuffer) in this mesh. */
virtual u32 getMeshBufferCount() const = 0; virtual u32 getMeshBufferCount() const = 0;
//! Returns pointer to a mesh buffer. //! Get pointer to a mesh buffer.
/** \param nr: Zero based index of the mesh buffer. The maximum value is /** \param nr: Zero based index of the mesh buffer. The maximum value is
getMeshBufferCount() - 1; getMeshBufferCount() - 1;
\return Returns the pointer to the mesh buffer or \return Pointer to the mesh buffer or 0 if there is no such
NULL if there is no such mesh buffer. */ mesh buffer. */
virtual IMeshBuffer* getMeshBuffer(u32 nr) const = 0; virtual IMeshBuffer* getMeshBuffer(u32 nr) const = 0;
//! Returns pointer to a mesh buffer which fits a material //! Get pointer to a mesh buffer which fits a material
/** \param material: material to search for /** \param material: material to search for
\return Returns the pointer to the mesh buffer or \return Pointer to the mesh buffer or 0 if there is no such
NULL if there is no such mesh buffer. */ mesh buffer. */
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const = 0; virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const = 0;
//! Returns an axis aligned bounding box of the mesh. //! Get an axis aligned bounding box of the mesh.
/** \return A bounding box of this mesh is returned. */ /** \return Bounding box of this mesh. */
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0; virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
//! set user axis aligned bounding box //! Set user-defined axis aligned bounding box
/** \param box New bounding box to use for the mesh. */
virtual void setBoundingBox( const core::aabbox3df& box) = 0; virtual void setBoundingBox( const core::aabbox3df& box) = 0;
//! Sets a flag of all contained materials to a new value. //! Sets a flag of all contained materials to a new value.
/** \param flag: Flag to set in all materials. /** \param flag: Flag to set in all materials.
\param newvalue: New value to set in all materials. */ \param newvalue: New value to set in all materials. */
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) = 0; virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) = 0;
//! Set the hardware mapping hint
/** This methods allows to define optimization hints for the
hardware. This enables, e.g., the use of hardware buffers on
pltforms that support this feature. This can lead to noticeable
performance gains. */
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0;
//! Flag the meshbuffer as changed, reloads hardware buffers
/** This method has to be called every time the vertices or
indices have changed. Otherwise, changes won't be updated
on the GPU in the next render cycle. */
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0;
}; };
} // end namespace scene } // end namespace scene

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -9,6 +9,8 @@
#include "SMaterial.h" #include "SMaterial.h"
#include "aabbox3d.h" #include "aabbox3d.h"
#include "S3DVertex.h" #include "S3DVertex.h"
#include "SVertexIndex.h"
#include "EHardwareBufferFlags.h"
namespace irr namespace irr
{ {
@ -54,60 +56,134 @@ namespace scene
EPT_POINT_SPRITES EPT_POINT_SPRITES
}; };
//! Struct for holding a mesh with a single material.
/** A part of an IMesh which has the same material on each face of that
group. Logical groups of an IMesh need not be put into separate mesh
buffers, but can be. Separately animated parts of the mesh must be put
into separate mesh buffers.
Some mesh buffer implementations have limitations on the number of
vertices the buffer can hold. In that case, logical grouping can help.
Moreover, the number of vertices should be optimized for the GPU upload,
which often depends on the type of gfx card. Typial figures are
1000-10000 vertices per buffer.
SMeshBuffer is a simple implementation of a MeshBuffer, which supports
up to 65535 vertices.
Since meshbuffers are used for drawing, and hence will be exposed
//! Struct for holding a mesh with a single material to the driver, chances are high that they are grab()'ed from somewhere.
/** SMeshBuffer is a simple implementation of a MeshBuffer. */ It's therefore required to dynamically allocate meshbuffers which are
passed to a video driver and only drop the buffer once it's not used in
the current code block anymore.
*/
class IMeshBuffer : public virtual IReferenceCounted class IMeshBuffer : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Get the material of this meshbuffer
virtual ~IMeshBuffer() { } /** \return Material of this buffer. */
//! returns the material of this meshbuffer
virtual video::SMaterial& getMaterial() = 0; virtual video::SMaterial& getMaterial() = 0;
//! returns the material of this meshbuffer //! Get the material of this meshbuffer
/** \return Material of this buffer. */
virtual const video::SMaterial& getMaterial() const = 0; virtual const video::SMaterial& getMaterial() const = 0;
//! returns which type of vertex data is stored. //! Get type of vertex data which is stored in this meshbuffer.
/** \return Vertex type of this buffer. */
virtual video::E_VERTEX_TYPE getVertexType() const = 0; virtual video::E_VERTEX_TYPE getVertexType() const = 0;
//! returns pointer to vertex data. The data is an array of vertices. Which vertex //! Get access to vertex data. The data is an array of vertices.
//! type is used can be determined with getVertexType(). /** Which vertex type is used can be determined by getVertexType().
virtual const void* getVertices() const = 0; \return Pointer to array of vertices. */
virtual const void* getVertices() const = 0;
//! returns pointer to vertex data. The data is an array of vertices. Which vertex //! Get access to vertex data. The data is an array of vertices.
//! type is used can be determined with getVertexType(). /** Which vertex type is used can be determined by getVertexType().
virtual void* getVertices() = 0; \return Pointer to array of vertices. */
virtual void* getVertices() = 0;
//! returns amount of vertices //! Get amount of vertices in meshbuffer.
/** \return Number of vertices in this buffer. */
virtual u32 getVertexCount() const = 0; virtual u32 getVertexCount() const = 0;
//! returns pointer to Indices //! Get type of index data which is stored in this meshbuffer.
/** \return Index type of this buffer. */
virtual video::E_INDEX_TYPE getIndexType() const =0;
//! Get access to Indices.
/** \return Pointer to indices array. */
virtual const u16* getIndices() const = 0; virtual const u16* getIndices() const = 0;
//! returns pointer to Indices //! Get access to Indices.
/** \return Pointer to indices array. */
virtual u16* getIndices() = 0; virtual u16* getIndices() = 0;
//! returns amount of indices //! Get amount of indices in this meshbuffer.
/** \return Number of indices in this buffer. */
virtual u32 getIndexCount() const = 0; virtual u32 getIndexCount() const = 0;
//! returns an axis aligned bounding box //! Get the axis aligned bounding box of this meshbuffer.
/** \return Axis aligned bounding box of this buffer. */
virtual const core::aabbox3df& getBoundingBox() const = 0; virtual const core::aabbox3df& getBoundingBox() const = 0;
//! set user axis aligned bounding box //! Set axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box) = 0; /** \param box User defined axis aligned bounding box to use
for this buffer. */
virtual void setBoundingBox(const core::aabbox3df& box) = 0;
//! recalculates the bounding box. should be called if the mesh changed. //! Recalculates the bounding box. Should be called if the mesh changed.
virtual void recalculateBoundingBox() = 0; virtual void recalculateBoundingBox() = 0;
//! append the vertices and indices to the current buffer //! returns position of vertex i
virtual const core::vector3df& getPosition(u32 i) const = 0;
//! returns position of vertex i
virtual core::vector3df& getPosition(u32 i) = 0;
//! returns normal of vertex i
virtual const core::vector3df& getNormal(u32 i) const = 0;
//! returns normal of vertex i
virtual core::vector3df& getNormal(u32 i) = 0;
//! returns texture coord of vertex i
virtual const core::vector2df& getTCoords(u32 i) const = 0;
//! returns texture coord of vertex i
virtual core::vector2df& getTCoords(u32 i) = 0;
//! Append the vertices and indices to the current buffer
/** Only works for compatible vertex types.
\param vertices Pointer to a vertex array.
\param numVertices Number of vertices in the array.
\param indices Pointer to index array.
\param numIndices Number of indices in array. */
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) = 0; virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) = 0;
//! append the meshbuffer to the current buffer //! Append the meshbuffer to the current buffer
/** Only works for compatible vertex types
\param other Buffer to append to this one. */
virtual void append(const IMeshBuffer* const other) = 0; virtual void append(const IMeshBuffer* const other) = 0;
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const = 0;
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const = 0;
//! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) = 0;
//! flags the meshbuffer as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0;
//to be spit into vertex and index buffers:
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual u32 getChangedID_Vertex() const = 0;
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual u32 getChangedID_Index() const = 0;
}; };
} // end namespace scene } // end namespace scene
@ -115,3 +191,4 @@ namespace scene
#endif #endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -18,107 +18,142 @@ namespace scene
class IAnimatedMeshSceneNode; class IAnimatedMeshSceneNode;
class IMeshLoader; class IMeshLoader;
//! The mesh cache stores already loaded meshes and provides an interface to them. //! The mesh cache stores already loaded meshes and provides an interface to them.
/** You can access it using ISceneManager::getMeshCache(). All existing scene managers /** You can access it using ISceneManager::getMeshCache(). All existing
will return a pointer to the same mesh cache, because it is shared between them. With scene managers will return a pointer to the same mesh cache, because it
this interface, it is possible to manually add new loaded meshes (if is shared between them. With this interface, it is possible to manually
ISceneManager::getMesh() is not sufficient), to remove them and to iterate through add new loaded meshes (if ISceneManager::getMesh() is not sufficient),
already loaded meshes. */ to remove them and to iterate through already loaded meshes. */
class IMeshCache : public virtual IReferenceCounted class IMeshCache : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Destructor
virtual ~IMeshCache() {} virtual ~IMeshCache() {}
//! Adds a mesh to the internal list of loaded meshes. //! Adds a mesh to the internal list of loaded meshes.
/** Usually, ISceneManager::getMesh() is called to load a mesh from a file. /** Usually, ISceneManager::getMesh() is called to load a mesh
That method searches the list of loaded meshes if a mesh has already been loaded and from a file. That method searches the list of loaded meshes if
returns a pointer to if it is in that list and already in memory. Otherwise it loads a mesh has already been loaded and returns a pointer to if it
the mesh. With IMeshCache::addMesh(), it is possible to pretend that a mesh already is in that list and already in memory. Otherwise it loads the
has been loaded. This method can be used for example by mesh loaders who need to mesh. With IMeshCache::addMesh(), it is possible to pretend
load more than one mesh with one call. They can add additional meshes with this that a mesh already has been loaded. This method can be used
method to the scene manager. The COLLADA loader for example uses this method. for example by mesh loaders who need to load more than one mesh
\param filename: Filename of the mesh. When called ISceneManager::getMesh() with this with one call. They can add additional meshes with this method
parameter, the method will return the mesh parameter given with this method. to the scene manager. The COLLADA loader for example uses this
\param mesh: Pointer to a mesh which will now be referenced by this name. */ method.
\param filename Filename of the mesh. When calling
ISceneManager::getMesh() with this name it will return the mesh
set by this method.
\param mesh Pointer to a mesh which will now be referenced by
this name. */
virtual void addMesh(const c8* filename, IAnimatedMesh* mesh) = 0; virtual void addMesh(const c8* filename, IAnimatedMesh* mesh) = 0;
//! Removes a mesh from the cache. //! Removes a mesh from the cache.
/** After loading a mesh with getMesh(), the mesh can be removed from the cache /** After loading a mesh with getMesh(), the mesh can be
using this method, freeing a lot of memory. */ removed from the cache using this method, freeing a lot of
memory.
\param mesh Pointer to the mesh which shall be removed. */
virtual void removeMesh(const IAnimatedMesh* const mesh) = 0; virtual void removeMesh(const IAnimatedMesh* const mesh) = 0;
//! Removes a mesh from the cache. //! Removes a mesh from the cache.
/** After loading a mesh with getMesh(), the mesh can be removed from the cache /** After loading a mesh with getMesh(), the mesh can be
using this method, freeing a lot of memory. */ removed from the cache using this method, freeing a lot of
memory.
\param mesh Pointer to the mesh which shall be removed. */
virtual void removeMesh(const IMesh* const mesh) = 0; virtual void removeMesh(const IMesh* const mesh) = 0;
//! Returns amount of loaded meshes in the cache. //! Returns amount of loaded meshes in the cache.
/** You can load new meshes into the cache using getMesh() and addMesh(). /** You can load new meshes into the cache using getMesh() and
If you ever need to access the internal mesh cache, you can do this using addMesh(). If you ever need to access the internal mesh cache,
removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshFilename() */ you can do this using removeMesh(), getMeshNumber(),
getMeshByIndex() and getMeshFilename().
\return Number of meshes in cache. */
virtual u32 getMeshCount() const = 0; virtual u32 getMeshCount() const = 0;
//! Returns current index number of the mesh, and -1 if it is not in the cache. //! Returns current index number of the mesh, and -1 if it is not in the cache.
/** \param mesh Pointer to the mesh to search for.
\return Index of the mesh in the cache, or -1 if not found. */
virtual s32 getMeshIndex(const IAnimatedMesh* const mesh) const = 0; virtual s32 getMeshIndex(const IAnimatedMesh* const mesh) const = 0;
//! Returns current index number of the mesh, and -1 if it is not in the cache. //! Returns current index number of the mesh, and -1 if it is not in the cache.
/** \param mesh Pointer to the mesh to search for.
\return Index of the mesh in the cache, or -1 if not found. */
virtual s32 getMeshIndex(const IMesh* const mesh) const = 0; virtual s32 getMeshIndex(const IMesh* const mesh) const = 0;
//! Returns a mesh based on its index number. //! Returns a mesh based on its index number.
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1. /** \param index: Index of the mesh, number between 0 and
Note that this number is only valid until a new mesh is loaded or removed * getMeshCount()-1.
\return Returns pointer to the mesh or 0 if there is none with this number. */ Note that this number is only valid until a new mesh is loaded
or removed.
\return Pointer to the mesh or 0 if there is none with this
number. */
virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0; virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0;
//! Returns a mesh based on its file name. //! Returns a mesh based on its filename.
/** \return Returns pointer to the mesh or 0 if there is none with this number. */ /** \param filename Name of the mesh.
\return Pointer to the mesh or 0 if there is none with this number. */
virtual IAnimatedMesh* getMeshByFilename(const c8* filename) = 0; virtual IAnimatedMesh* getMeshByFilename(const c8* filename) = 0;
//! Returns name of a mesh based on its index number. //! Get the filename of a loaded mesh, based on its index.
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1. /** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
Note that this is only valid until a new mesh is loaded */ \return String with name if mesh was found and has a name, else
0. */
virtual const c8* getMeshFilename(u32 index) const = 0; virtual const c8* getMeshFilename(u32 index) const = 0;
//! Returns the filename of a loaded mesh, if there is any. //! Get the filename of a loaded mesh, if there is any.
/** Returns 0 if there is none. */ /** \param mesh Pointer to mesh to query.
\return String with name if mesh was found and has a name, else
0. */
virtual const c8* getMeshFilename(const IAnimatedMesh* const mesh) const = 0; virtual const c8* getMeshFilename(const IAnimatedMesh* const mesh) const = 0;
//! Returns the filename of a loaded mesh, if there is any. //! Get the filename of a loaded mesh, if there is any.
/* Returns 0 if there is none.*/ /** \param mesh Pointer to mesh to query.
\return String with name if mesh was found and has a name, else
0. */
virtual const c8* getMeshFilename(const IMesh* const mesh) const = 0; virtual const c8* getMeshFilename(const IMesh* const mesh) const = 0;
//! Renames a loaded mesh, if possible. //! Renames a loaded mesh.
/** Returns true if sucessful. Note that renaming meshes might change /** Note that renaming meshes might change the ordering of the
the ordering of the meshes, and so the index of the meshes as returned by meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. */ getMeshIndex() or taken by some methods will change.
\param index The index of the mesh in the cache.
\param filename New name for the mesh.
\return True if mesh was renamed. */
virtual bool setMeshFilename(u32 index, const c8* filename) = 0; virtual bool setMeshFilename(u32 index, const c8* filename) = 0;
//! Renames a loaded mesh, if possible. //! Renames a loaded mesh.
/** Returns true if sucessful. Note that renaming meshes might change /** Note that renaming meshes might change the ordering of the
the ordering of the meshes, and so the index of the meshes as returned by meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. */ getMeshIndex() or taken by some methods will change.
\param mesh Mesh to be renamed.
\param filename New name for the mesh.
\return True if mesh was renamed. */
virtual bool setMeshFilename(const IAnimatedMesh* const mesh, const c8* filename) = 0; virtual bool setMeshFilename(const IAnimatedMesh* const mesh, const c8* filename) = 0;
//! Renames a loaded mesh, if possible. //! Renames a loaded mesh.
/** Returns true if sucessful. Note that renaming meshes might change /** Note that renaming meshes might change the ordering of the
the ordering of the meshes, and so the index of the meshes as returned by meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. */ getMeshIndex() or taken by some methods will change.
\param mesh Mesh to be renamed.
\param filename New name for the mesh.
\return True if mesh was renamed. */
virtual bool setMeshFilename(const IMesh* const mesh, const c8* filename) = 0; virtual bool setMeshFilename(const IMesh* const mesh, const c8* filename) = 0;
//! returns if a mesh already was loaded //! Check if a mesh was already loaded.
/** \param filename Name of the mesh.
\return True if the mesh has been loaded, else false. */
virtual bool isMeshLoaded(const c8* filename) = 0; virtual bool isMeshLoaded(const c8* filename) = 0;
//! Clears the whole mesh cache, removing all meshes. //! Clears the whole mesh cache, removing all meshes.
/** All meshes will be reloaded completely when using ISceneManager::getMesh() /** All meshes will be reloaded completely when using ISceneManager::getMesh()
after calling this method. after calling this method.
Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh() Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh()
and you did not grab them, then they may become invalid. */ and you did not grab them, then they may become invalid. */
virtual void clear() = 0; virtual void clear() = 0;
//! Clears all meshes that are held in the mesh cache but not used anywhere else. //! Clears all meshes that are held in the mesh cache but not used anywhere else.
/** Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh() /** Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh()
and you did not grab them, then they may become invalid. */ and you did not grab them, then they may become invalid. */
virtual void clearUnusedMeshes() = 0; virtual void clearUnusedMeshes() = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,24 +17,28 @@ namespace scene
{ {
class IAnimatedMesh; class IAnimatedMesh;
//! Class which is able to load an animated mesh from a file. //! Class which is able to load an animated mesh from a file.
/** If you want the Irrlicht Engine be able to load meshes of /** If you want Irrlicht be able to load meshes of
currently unsupported file formats (e.g .cob), then implement currently unsupported file formats (e.g. .cob), then implement
this and add your new Surface loader with this and add your new Meshloader with
ISceneManager::addExternalMeshLoader() to the engine. */ ISceneManager::addExternalMeshLoader() to the engine. */
class IMeshLoader : public virtual IReferenceCounted class IMeshLoader : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Destructor
virtual ~IMeshLoader() {} virtual ~IMeshLoader() {}
//! Returns true if the file maybe is able to be loaded by this class. //! Returns true if the file might be loaded by this class.
/** This decision should be based only on the file extension (e.g. ".cob") */ /** This decision should be based on the file extension (e.g. ".cob")
only.
\param fileName Name of the file to test.
\return True if the file might be loaded by this class. */
virtual bool isALoadableFileExtension(const c8* fileName) const = 0; virtual bool isALoadableFileExtension(const c8* fileName) const = 0;
//! Creates/loads an animated mesh from the file. //! Creates/loads an animated mesh from the file.
/** \return Pointer to the created mesh. Returns 0 if loading failed. /** \param file File handler to load the file from.
\return Pointer to the created mesh. Returns 0 if loading failed.
If you no longer need the mesh, you should call IAnimatedMesh::drop(). If you no longer need the mesh, you should call IAnimatedMesh::drop().
See IReferenceCounted::drop() for more information. */ See IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh* createMesh(io::IReadFile* file) = 0; virtual IAnimatedMesh* createMesh(io::IReadFile* file) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,96 +21,165 @@ namespace scene
class IMeshBuffer; class IMeshBuffer;
struct SMesh; struct SMesh;
//! An interface for easily manipulate meshes. //! An interface for easy manipulation of meshes.
/** Scale, set alpha value, flip surfaces, and so on. This exists for fixing problems /** Scale, set alpha value, flip surfaces, and so on. This exists for
with wrong imported or exported meshes quickly after loading. It is not intended for doing mesh fixing problems with wrong imported or exported meshes quickly after
modifications and/or animations during runtime. loading. It is not intended for doing mesh modifications and/or
animations during runtime.
*/ */
class IMeshManipulator : public virtual IReferenceCounted class IMeshManipulator : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Flips the direction of surfaces.
virtual ~IMeshManipulator() {}
//! Flips the direction of surfaces.
/** Changes backfacing triangles to frontfacing /** Changes backfacing triangles to frontfacing
triangles and vice versa. triangles and vice versa.
\param mesh: Mesh on which the operation is performed. */ \param mesh Mesh on which the operation is performed. */
virtual void flipSurfaces(IMesh* mesh) const = 0; virtual void flipSurfaces(IMesh* mesh) const = 0;
//! Sets the alpha vertex color value of the whole mesh to a new value. //! Sets the alpha vertex color value of the whole mesh to a new value.
/** \param mesh: Mesh on which the operation is performed. /** \param mesh Mesh on which the operation is performed.
\param alpha: New alpha value. Must be a value between 0 and 255. */ \param alpha New alpha value. Must be a value between 0 and 255. */
virtual void setVertexColorAlpha(IMesh* mesh, s32 alpha) const = 0; virtual void setVertexColorAlpha(IMesh* mesh, s32 alpha) const = 0;
//! Sets the colors of all vertices to one color //! Sets the colors of all vertices to one color
/** \param mesh Mesh on which the operation is performed.
\param color New color. */
virtual void setVertexColors(IMesh* mesh, video::SColor color) const = 0; virtual void setVertexColors(IMesh* mesh, video::SColor color) const = 0;
//! Recalculates all normals of the mesh. //! Recalculates all normals of the mesh.
/** \param mesh: Mesh on which the operation is performed. /** \param mesh: Mesh on which the operation is performed.
\param smooth: If the normals shall be smoothed. */ \param smooth: If the normals shall be smoothed.
virtual void recalculateNormals(IMesh* mesh, bool smooth = false) const = 0; \param angleWeighted: If the normals shall be smoothed in relation to their angles. More expensive, but also higher precision. */
virtual void recalculateNormals(IMesh* mesh, bool smooth = false, bool angleWeighted = false) const = 0;
//! Recalculates all normals of the mesh buffer. //! Recalculates all normals of the mesh buffer.
/** \param buffer: Mesh buffer on which the operation is performed. /** \param buffer: Mesh buffer on which the operation is performed.
\param smooth: If the normals shall be smoothed. */ \param smooth: If the normals shall be smoothed.
virtual void recalculateNormals(IMeshBuffer* buffer, bool smooth = false) const = 0; \param angleWeighted: If the normals shall be smoothed in relation to their angles. More expensive, but also higher precision. */
virtual void recalculateNormals(IMeshBuffer* buffer, bool smooth = false, bool angleWeighted = false) const = 0;
//! Scales the whole mesh. //! Scales the actual mesh, not a scene node.
/** \param mesh: Mesh on which the operation is performed. /** \param mesh Mesh on which the operation is performed.
\param scale: Scale factor. */ \param factor Scale factor for each axis. */
virtual void scaleMesh(IMesh* mesh, const core::vector3df& scale) const = 0; virtual void scale(IMesh* mesh, const core::vector3df& factor) const = 0;
//! Applies a transformation //! Scales the actual meshbuffer, not a scene node.
/** \param mesh: Mesh on which the operation is performed. /** \param buffer Meshbuffer on which the operation is performed.
\param m: transformation matrix. */ \param factor Scale factor for each axis. */
virtual void transformMesh(IMesh* mesh, const core::matrix4& m) const = 0; virtual void scale(IMeshBuffer* buffer, const core::vector3df& factor) const = 0;
//! Clones a static IMesh into a modifyable SMesh. //! Scales the actual mesh, not a scene node.
/** \deprecated
\param mesh Mesh on which the operation is performed.
\param factor Scale factor for each axis. */
virtual void scaleMesh(IMesh* mesh, const core::vector3df& factor) const {return scale(mesh,factor);}
//! Scale the texture coords of a mesh.
/** \param mesh Mesh on which the operation is performed.
\param factor Vector which defines the scale for each axis.
\param level Number of texture coord, starting from 1. Support for level 2 exists for LightMap buffers. */
virtual void scaleTCoords(scene::IMesh* mesh, const core::vector2df& factor, u32 level=1) const =0;
//! Scale the texture coords of a meshbuffer.
/** \param buffer Meshbuffer on which the operation is performed.
\param factor Vector which defines the scale for each axis.
\param level Number of texture coord, starting from 1. Support for level 2 exists for LightMap buffers. */
virtual void scaleTCoords(scene::IMeshBuffer* buffer, const core::vector2df& factor, u32 level=1) const =0;
//! Applies a transformation to a mesh
/** \param mesh Mesh on which the operation is performed.
\param m transformation matrix. */
virtual void transform(IMesh* mesh, const core::matrix4& m) const = 0;
//! Applies a transformation to a meshbuffer
/** \param buffer Meshbuffer on which the operation is performed.
\param m transformation matrix. */
virtual void transform(IMeshBuffer* buffer, const core::matrix4& m) const = 0;
//! Applies a transformation to a mesh
/** \deprecated
\param mesh Mesh on which the operation is performed.
\param m transformation matrix. */
virtual void transformMesh(IMesh* mesh, const core::matrix4& m) const {return transform(mesh,m);}
//! Clones a static IMesh into a modifiable SMesh.
/** All meshbuffers in the returned SMesh /** All meshbuffers in the returned SMesh
are of type SMeshBuffer or SMeshBufferLightMap. are of type SMeshBuffer or SMeshBufferLightMap.
\param mesh: Mesh to copy. \param mesh Mesh to copy.
\return Returns the cloned mesh. \return Cloned mesh. If you no longer need the
If you no longer need the cloned mesh, you should call SMesh::drop(). cloned mesh, you should call SMesh::drop(). See
See IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual SMesh* createMeshCopy(IMesh* mesh) const = 0; virtual SMesh* createMeshCopy(IMesh* mesh) const = 0;
//! Creates a planar texture mapping on the mesh //! Creates a planar texture mapping on the mesh
/** \param mesh: Mesh on which the operation is performed. /** \param mesh: Mesh on which the operation is performed.
\param resolution: resolution of the planar mapping. This is the value \param resolution: resolution of the planar mapping. This is
specifying which is the relation between world space and the value specifying which is the relation between world space
texture coordinate space. */ and texture coordinate space. */
virtual void makePlanarTextureMapping(IMesh* mesh, f32 resolution=0.001f) const = 0; virtual void makePlanarTextureMapping(IMesh* mesh, f32 resolution=0.001f) const = 0;
//! Creates a copy of the mesh, which will only consist of S3DVertexTangents vertices. //! Creates a copy of the mesh, which will only consist of S3DVertexTangents vertices.
/** This is useful if you want to draw tangent space normal mapped geometry because /** This is useful if you want to draw tangent space normal
it calculates the tangent and binormal data which is needed there. mapped geometry because it calculates the tangent and binormal
\param mesh: Input mesh data which is needed there.
\return Mesh consiting only of S3DVertexTangents vertices. \param mesh Input mesh
If you no longer need the cloned mesh, you should call IMesh::drop(). \param recalculateNormals The normals are recalculated if set,
See IReferenceCounted::drop() for more information. */ otherwise the original ones are kept. Note that keeping the
virtual IMesh* createMeshWithTangents(IMesh* mesh) const = 0; normals may introduce inaccurate tangents if the normals are
very different to those calculated from the faces.
\param smooth The normals/tangents are smoothed across the
meshbuffer's faces if this flag is set.
\param angleWeighted Improved smoothing calculation used
\return Mesh consisting only of S3DVertexTangents vertices. If
you no longer need the cloned mesh, you should call
IMesh::drop(). See IReferenceCounted::drop() for more
information. */
virtual IMesh* createMeshWithTangents(IMesh* mesh, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false) const = 0;
//! Creates a copy of the mesh, which will only consist of S3DVertex2TCoord vertices. //! Creates a copy of the mesh, which will only consist of S3DVertex2TCoord vertices.
/** \param mesh Input mesh
\return Mesh consisting only of S3DVertex2TCoord vertices. If
you no longer need the cloned mesh, you should call
IMesh::drop(). See IReferenceCounted::drop() for more
information. */
virtual IMesh* createMeshWith2TCoords(IMesh* mesh) const = 0; virtual IMesh* createMeshWith2TCoords(IMesh* mesh) const = 0;
//! Creates a copy of a mesh with all vertices unwelded //! Creates a copy of a mesh with all vertices unwelded
/** \param mesh Input mesh
\return Mesh consisting only of unique faces. All vertices
which were previously shared are now duplicated. If you no
longer need the cloned mesh, you should call IMesh::drop(). See
IReferenceCounted::drop() for more information. */
virtual IMesh* createMeshUniquePrimitives(IMesh* mesh) const = 0; virtual IMesh* createMeshUniquePrimitives(IMesh* mesh) const = 0;
//! Creates a copy of a mesh with vertices welded //! Creates a copy of a mesh with vertices welded
/** \param mesh Input mesh
\param tolerance The threshold for vertex comparisons.
\return Mesh without redundant vertices. If you no longer need
the cloned mesh, you should call IMesh::drop(). See
IReferenceCounted::drop() for more information. */
virtual IMesh* createMeshWelded(IMesh* mesh, f32 tolerance=core::ROUNDING_ERROR_32) const = 0; virtual IMesh* createMeshWelded(IMesh* mesh, f32 tolerance=core::ROUNDING_ERROR_32) const = 0;
//! Returns amount of polygons in mesh. //! Get amount of polygons in mesh.
/** \param mesh Input mesh
\return Number of polygons in mesh. */
virtual s32 getPolyCount(IMesh* mesh) const = 0; virtual s32 getPolyCount(IMesh* mesh) const = 0;
//! Returns amount of polygons in mesh. //! Get amount of polygons in mesh.
/** \param mesh Input mesh
\return Number of polygons in mesh. */
virtual s32 getPolyCount(IAnimatedMesh* mesh) const = 0; virtual s32 getPolyCount(IAnimatedMesh* mesh) const = 0;
//! create a new AnimatedMesh and adds the mesh to it //! Create a new AnimatedMesh and adds the mesh to it
/** \param mesh Input mesh
\param type The type of the animated mesh to create.
\return Newly created animated mesh with mesh as its only
content. When you don't need the animated mesh anymore, you
should call IAnimatedMesh::drop(). See
IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh * createAnimatedMesh(IMesh* mesh, virtual IAnimatedMesh * createAnimatedMesh(IMesh* mesh,
scene::E_ANIMATED_MESH_TYPE type = scene::EAMT_UNKNOWN) const = 0; scene::E_ANIMATED_MESH_TYPE type = scene::EAMT_UNKNOWN) const = 0;
}; };
} // end namespace scene } // end namespace scene

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -20,24 +20,32 @@ class IMeshSceneNode : public ISceneNode
{ {
public: public:
//! constructor //! Constructor
IMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, /** Use setMesh() to set the mesh to display.
const core::vector3df& position, const core::vector3df& rotation, */
IMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position,
const core::vector3df& rotation,
const core::vector3df& scale) const core::vector3df& scale)
: ISceneNode(parent, mgr, id, position, rotation, scale) {} : ISceneNode(parent, mgr, id, position, rotation, scale) {}
//! Sets a new mesh to display //! Sets a new mesh to display
/** \param mesh Mesh to display. */
virtual void setMesh(IMesh* mesh) = 0; virtual void setMesh(IMesh* mesh) = 0;
//! Returns the current mesh //! Get the currently defined mesh for display.
/** \return Pointer to mesh which is displayed by this node. */
virtual IMesh* getMesh(void) = 0; virtual IMesh* getMesh(void) = 0;
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style. //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes /** In this way it is possible to change the materials of a mesh
referencing this mesh to change too. */ causing all mesh scene nodes referencing this mesh to change, too.
\param readonly Flag if the materials shall be read-only. */
virtual void setReadOnlyMaterials(bool readonly) = 0; virtual void setReadOnlyMaterials(bool readonly) = 0;
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style //! Check if the scene node should not copy the materials of the mesh but use them in a read only style
/** This flag can be set by setReadOnlyMaterials().
\return Whether the materials are read-only. */
virtual bool isReadOnlyMaterials() const = 0; virtual bool isReadOnlyMaterials() const = 0;
}; };

View File

@ -1,3 +1,7 @@
// Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_I_MESH_WRITER_H_INCLUDED__ #ifndef __IRR_I_MESH_WRITER_H_INCLUDED__
#define __IRR_I_MESH_WRITER_H_INCLUDED__ #define __IRR_I_MESH_WRITER_H_INCLUDED__
@ -15,24 +19,30 @@ namespace scene
{ {
class IMesh; class IMesh;
// interface for writing meshes //! Interface for writing meshes
class IMeshWriter : public virtual IReferenceCounted class IMeshWriter : public virtual IReferenceCounted
{ {
public: public:
//! Destructor
virtual ~IMeshWriter() {} virtual ~IMeshWriter() {}
//! Returns the type of the mesh writer //! Get the type of the mesh writer
/** For own implementations, use MAKE_IRR_ID as shown in the EMESH_WRITER_TYPE /** For own implementations, use MAKE_IRR_ID as shown in the
enumeration to return your own unique mesh type id.*/ EMESH_WRITER_TYPE enumeration to return your own unique mesh
type id.
\return Type of the mesh writer. */
virtual EMESH_WRITER_TYPE getType() const = 0; virtual EMESH_WRITER_TYPE getType() const = 0;
//! writes a static mesh //! Write a static mesh.
/** \return Returns true if sucessful */ /** \param file File handle to write the mesh to.
\param mesh Pointer to mesh to be written.
\param flags Optional flags to set properties of the writer.
\return True if sucessful */
virtual bool writeMesh(io::IWriteFile* file, scene::IMesh* mesh, virtual bool writeMesh(io::IWriteFile* file, scene::IMesh* mesh,
s32 flags=EMWF_NONE) = 0; s32 flags=EMWF_NONE) = 0;
// writes an animated mesh // Writes an animated mesh
// for future use, no writer is able to write animated meshes currently // for future use, no writer is able to write animated meshes currently
/* \return Returns true if sucessful */ /* \return Returns true if sucessful */
//virtual bool writeAnimatedMesh(io::IWriteFile* file, //virtual bool writeAnimatedMesh(io::IWriteFile* file,

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,22 +14,21 @@ namespace scene
//! Interface for making multiple triangle selectors work as one big selector. //! Interface for making multiple triangle selectors work as one big selector.
/** This is nothing more than a collection of one or more triangle selectors /** This is nothing more than a collection of one or more triangle selectors
providing together the interface of one triangle selector. In this way, providing together the interface of one triangle selector. In this way,
collision tests can be done with different triangle soups in one pass. collision tests can be done with different triangle soups in one pass.
*/ */
class IMetaTriangleSelector : public ITriangleSelector class IMetaTriangleSelector : public ITriangleSelector
{ {
public: public:
//! Adds a triangle selector to the collection of triangle selectors //! Adds a triangle selector to the collection of triangle selectors.
//! in this metaTriangleSelector. /** \param toAdd: Pointer to an triangle selector to add to the list. */
//! \param toAdd: Pointer to an triangle selector to add to the list. virtual void addTriangleSelector(ITriangleSelector* toAdd) = 0;
virtual void addTriangleSelector(ITriangleSelector* toAdd) = 0;
//! Removes a specific triangle selector which was added before from the collection. //! Removes a specific triangle selector from the collection.
//! \param toRemove: Pointer to an triangle selector which is in the list /** \param toRemove: Pointer to an triangle selector which is in the
//! but will be removed. list but will be removed.
//! \return Returns true if successful, false if not. \return True if successful, false if not. */
virtual bool removeTriangleSelector(ITriangleSelector* toRemove) = 0; virtual bool removeTriangleSelector(ITriangleSelector* toRemove) = 0;
//! Removes all triangle selectors from the collection. //! Removes all triangle selectors from the collection.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -15,28 +15,28 @@ class IOSOperator : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Destructor
virtual ~IOSOperator() {} virtual ~IOSOperator() {}
//! returns the current operation system version as string. //! Get the current operation system version as string.
virtual const wchar_t* getOperationSystemVersion() const = 0; virtual const wchar_t* getOperationSystemVersion() const = 0;
//! copies text to the clipboard //! Copies text to the clipboard
virtual void copyToClipboard(const c8* text) const = 0; virtual void copyToClipboard(const c8* text) const = 0;
//! gets text from the clipboard //! Get text from the clipboard
//! \return Returns 0 if no string is in there. /** \return Returns 0 if no string is in there. */
virtual c8* getTextFromClipboard() const = 0; virtual c8* getTextFromClipboard() const = 0;
//! gets the processor speed in megahertz //! Get the processor speed in megahertz
//! \param MHz: The integer variable to store the speed in. /** \param MHz The integer variable to store the speed in.
//! \return Returns true if successful, false if not \return True if successful, false if not */
virtual bool getProcessorSpeedMHz(u32* MHz) const = 0; virtual bool getProcessorSpeedMHz(u32* MHz) const = 0;
//! gets the total and available system RAM //! Get the total and available system RAM
//! \param Total: will contain the total system memory /** \param Total: will contain the total system memory
//! \param Avail: will contain the available memory \param Avail: will contain the available memory
//! \return Returns true if successful, false if not \return True if successful, false if not */
virtual bool getSystemMemory(u32* Total, u32* Avail) const = 0; virtual bool getSystemMemory(u32* Total, u32* Avail) const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,6 +21,7 @@ enum E_PARTICLE_AFFECTOR_TYPE
EPAT_FADE_OUT, EPAT_FADE_OUT,
EPAT_GRAVITY, EPAT_GRAVITY,
EPAT_ROTATE, EPAT_ROTATE,
EPAT_SCALE,
EPAT_COUNT EPAT_COUNT
}; };
@ -32,6 +33,7 @@ const c8* const ParticleAffectorTypeNames[] =
"FadeOut", "FadeOut",
"Gravity", "Gravity",
"Rotate", "Rotate",
"Scale",
0 0
}; };
@ -44,9 +46,9 @@ public:
IParticleAffector() : Enabled(true) {} IParticleAffector() : Enabled(true) {}
//! Affects an array of particles. //! Affects an array of particles.
//! \param now: Current time. (Same as ITimer::getTime() would return) /** \param now Current time. (Same as ITimer::getTime() would return)
//! \param particlearray: Array of particles. \param particlearray Array of particles.
//! \param count: Amount of particles in array. \param count Amount of particles in array. */
virtual void affect(u32 now, SParticle* particlearray, u32 count) = 0; virtual void affect(u32 now, SParticle* particlearray, u32 count) = 0;
//! Sets whether or not the affector is currently enabled. //! Sets whether or not the affector is currently enabled.
@ -56,17 +58,17 @@ public:
virtual bool getEnabled() const { return Enabled; } virtual bool getEnabled() const { return Enabled; }
//! Writes attributes of the object. //! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for /** Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes. scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {} virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}
//! Reads attributes of the object. //! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for /** Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes. scripting languages, editors, debuggers or xml deserialization purposes.
//! \param startIndex: start index where to start reading attributes. \param startIndex start index where to start reading attributes.
//! \param in: The attributes to work with. \param in The attributes to work with.
//! \param options: Additional options. \param options Additional options.
//! \return: returns last index of an attribute read by this affector \return Last index of an attribute read by this affector */
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; } virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; }
//! Get emitter type //! Get emitter type

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -27,11 +27,10 @@ public:
//! Set the amount that the normal is divided by for getting a particles direction //! Set the amount that the normal is divided by for getting a particles direction
virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) = 0; virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) = 0;
//! Sets whether to emit min<->max particles for every vertex per //! Sets whether to emit min<->max particles for every vertex or to pick min<->max vertices
//! second, or to pick min<->max vertices every second
virtual void setEveryMeshVertex( bool everyMeshVertex = true ) = 0; virtual void setEveryMeshVertex( bool everyMeshVertex = true ) = 0;
//! Get Mesh we're emitting particles from //! Get mesh we're emitting particles from
virtual const IAnimatedMeshSceneNode* getAnimatedMeshSceneNode() const = 0; virtual const IAnimatedMeshSceneNode* getAnimatedMeshSceneNode() const = 0;
//! Get whether to use vertex normal for direction, or direction specified //! Get whether to use vertex normal for direction, or direction specified
@ -40,8 +39,7 @@ public:
//! Get the amount that the normal is divided by for getting a particles direction //! Get the amount that the normal is divided by for getting a particles direction
virtual f32 getNormalDirectionModifier() const = 0; virtual f32 getNormalDirectionModifier() const = 0;
//! Gets whether to emit min<->max particles for every vertex per //! Gets whether to emit min<->max particles for every vertex or to pick min<->max vertices
//! second, or to pick min<->max vertices every second
virtual bool getEveryMeshVertex() const = 0; virtual bool getEveryMeshVertex() const = 0;
//! Get emitter type //! Get emitter type

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -47,12 +47,11 @@ class IParticleEmitter : public virtual io::IAttributeExchangingObject
public: public:
//! Prepares an array with new particles to emitt into the system //! Prepares an array with new particles to emitt into the system
//! and returns how much new particles there are. /** \param now Current time.
//! \param now: Current time. \param timeSinceLastCall Time elapsed since last call, in milliseconds.
//! \param timeSinceLastCall: Time elapsed since last call, in milliseconds. \param outArray Pointer which will point to the array with the new
//! \param outArray: Pointer which will point to the array with the new particles to add into the system.
//! particles to add into the system. \return Amount of new particles in the array. Can be 0. */
//! \return Returns amount of new particles in the array. Can be 0.
virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray) = 0; virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray) = 0;
//! Set direction the emitter emits particles //! Set direction the emitter emits particles
@ -70,6 +69,12 @@ public:
//! Set maximum starting color for particles //! Set maximum starting color for particles
virtual void setMaxStartColor( const video::SColor& color ) = 0; virtual void setMaxStartColor( const video::SColor& color ) = 0;
//! Set the maximum starting size for particles
virtual void setMaxStartSize( const core::dimension2df& size ) = 0;
//! Set the minimum starting size for particles
virtual void setMinStartSize( const core::dimension2df& size ) = 0;
//! Get direction the emitter emits particles //! Get direction the emitter emits particles
virtual const core::vector3df& getDirection() const = 0; virtual const core::vector3df& getDirection() const = 0;
@ -85,19 +90,27 @@ public:
//! Get the maximum starting color for particles //! Get the maximum starting color for particles
virtual const video::SColor& getMaxStartColor() const = 0; virtual const video::SColor& getMaxStartColor() const = 0;
//! Get the maximum starting size for particles
virtual const core::dimension2df& getMaxStartSize() const = 0;
//! Get the minimum starting size for particles
virtual const core::dimension2df& getMinStartSize() const = 0;
//! Writes attributes of the object. //! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for /** Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes. scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {} virtual void serializeAttributes(io::IAttributes* out,
io::SAttributeReadWriteOptions* options=0) const {}
//! Reads attributes of the object. //! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for /** Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes. scripting languages, editors, debuggers or xml deserialization purposes.
//! \param startIndex: start index where to start reading attributes. \param startIndex start index where to start reading attributes.
//! \param in: The attributes to work with. \param in The attributes to work with.
//! \param options: Additional options. \param options Additional options.
//! \return: returns last index of an attribute read by this affector \return Last index of an attribute read by this affector */
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; } virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in,
io::SAttributeReadWriteOptions* options=0) { return 0; }
//! Get emitter type //! Get emitter type
virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_POINT; } virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_POINT; }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,15 +17,13 @@ class IParticleFadeOutAffector : public IParticleAffector
{ {
public: public:
//! Sets the targetColor, i.e. the color the particles will interpolate //! Sets the targetColor, i.e. the color the particles will interpolate to over time.
//! to over time.
virtual void setTargetColor( const video::SColor& targetColor ) = 0; virtual void setTargetColor( const video::SColor& targetColor ) = 0;
//! Sets the amount of time it takes for each particle to fade out. //! Sets the amount of time it takes for each particle to fade out.
virtual void setFadeOutTime( f32 fadeOutTime ) = 0; virtual void setFadeOutTime( f32 fadeOutTime ) = 0;
//! Gets the targetColor, i.e. the color the particles will interpolate //! Gets the targetColor, i.e. the color the particles will interpolate to over time.
//! to over time.
virtual const video::SColor& getTargetColor() const = 0; virtual const video::SColor& getTargetColor() const = 0;
//! Gets the amount of time it takes for each particle to fade out. //! Gets the amount of time it takes for each particle to fade out.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,15 +17,14 @@ class IParticleGravityAffector : public IParticleAffector
{ {
public: public:
//! Set the time in milliseconds when the gravity force is totally //! Set the time in milliseconds when the gravity force is totally lost
//! lost and the particle does not move any more. /** At that point the particle does not move any more. */
virtual void setTimeForceLost( f32 timeForceLost ) = 0; virtual void setTimeForceLost( f32 timeForceLost ) = 0;
//! Set the direction and force of gravity in all 3 dimensions. //! Set the direction and force of gravity in all 3 dimensions.
virtual void setGravity( const core::vector3df& gravity ) = 0; virtual void setGravity( const core::vector3df& gravity ) = 0;
//! Get the time in milliseconds when the gravity force is totally //! Get the time in milliseconds when the gravity force is totally lost
//! lost and the particle does not move any more.
virtual f32 getTimeForceLost() const = 0; virtual f32 getTimeForceLost() const = 0;
//! Get the direction and force of gravity. //! Get the direction and force of gravity.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -27,8 +27,7 @@ public:
//! Set the amount that the normal is divided by for getting a particles direction //! Set the amount that the normal is divided by for getting a particles direction
virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) = 0; virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) = 0;
//! Sets whether to emit min<->max particles for every vertex per second, or to pick //! Sets whether to emit min<->max particles for every vertex or to pick min<->max vertices
//! min<->max vertices every second
virtual void setEveryMeshVertex( bool everyMeshVertex = true ) = 0; virtual void setEveryMeshVertex( bool everyMeshVertex = true ) = 0;
//! Get Mesh we're emitting particles from //! Get Mesh we're emitting particles from
@ -40,8 +39,7 @@ public:
//! Get the amount that the normal is divided by for getting a particles direction //! Get the amount that the normal is divided by for getting a particles direction
virtual f32 getNormalDirectionModifier() const = 0; virtual f32 getNormalDirectionModifier() const = 0;
//! Gets whether to emit min<->max particles for every vertex per second, or to pick //! Gets whether to emit min<->max particles for every vertex or to pick min<->max vertices
//! min<->max vertices every second
virtual bool getEveryMeshVertex() const = 0; virtual bool getEveryMeshVertex() const = 0;
//! Get emitter type //! Get emitter type

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -25,8 +25,8 @@ namespace scene
//! A particle system scene node for creating snow, fire, exlosions, smoke... //! A particle system scene node for creating snow, fire, exlosions, smoke...
/** A scene node controlling a particle System. The behavior of the particles /** A scene node controlling a particle System. The behavior of the particles
can be controlling by setting the right particle emitters and effectors. can be controlled by setting the right particle emitters and affectors.
You can for example easily a campfire by doing this: You can for example easily create a campfire by doing this:
\code \code
scene::IParticleSystemSceneNode* p = scenemgr->addParticleSystemSceneNode(); scene::IParticleSystemSceneNode* p = scenemgr->addParticleSystemSceneNode();
@ -47,7 +47,7 @@ class IParticleSystemSceneNode : public ISceneNode
{ {
public: public:
//! constructor //! Constructor
IParticleSystemSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, IParticleSystemSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& rotation = core::vector3df(0,0,0), const core::vector3df& rotation = core::vector3df(0,0,0),
@ -58,101 +58,126 @@ public:
virtual void setParticleSize( virtual void setParticleSize(
const core::dimension2d<f32> &size = core::dimension2d<f32>(5.0f, 5.0f)) = 0; const core::dimension2d<f32> &size = core::dimension2d<f32>(5.0f, 5.0f)) = 0;
//! Sets if the particles should be global. If it is, the particles are affected by //! Sets if the particles should be global.
//! the movement of the particle system scene node too, otherwise they completely /** If they are, the particles are affected by the movement of the
//! ignore it. Default is true. particle system scene node too, otherwise they completely ignore it.
virtual void setParticlesAreGlobal(bool global) = 0; Default is true. */
virtual void setParticlesAreGlobal(bool global=true) = 0;
//! Gets the particle emitter, which creates the particles.
/** \return The particle emitter. Can be 0 if none is set. */
virtual IParticleEmitter* getEmitter() =0;
//! Sets the particle emitter, which creates the particles. //! Sets the particle emitter, which creates the particles.
//! A particle emitter can be created using one of the /** A particle emitter can be created using one of the createEmitter
//! methods. For example to create and use a simple PointEmitter, methods. For example to create and use a simple PointEmitter, call
//! call IParticleEmitter* p = createPointEmitter(); setEmitter(p); p->drop(); IParticleEmitter* p = createPointEmitter(); setEmitter(p); p->drop();
//! \param emitter: Sets the particle emitter. You can set this to 0 \param emitter: Sets the particle emitter. You can set this to 0 for
//! for removing the current emitter and stopping the particle system removing the current emitter and stopping the particle system emitting
//! emitting new particles. new particles. */
virtual void setEmitter(IParticleEmitter* emitter) = 0; virtual void setEmitter(IParticleEmitter* emitter) = 0;
//! Adds new particle effector to the particle system. A particle //! Adds new particle effector to the particle system.
//! affector modifies the particles. For example, the FadeOut /** A particle affector modifies the particles. For example, the FadeOut
//! affector lets all particles fade out after some time. It is created affector lets all particles fade out after some time. It is created and
//! and used in this way: IParticleAffector* p = createFadeOutParticleAffector(); used in this way:
//! addAffector(p); p->drop(); \code
//! Please note that a affector is not necessary for the particle IParticleAffector* p = createFadeOutParticleAffector();
//! system to work. addAffector(p);
//! \param affector: New affector. p->drop();
\endcode
Please note that an affector is not necessary for the particle system to
work.
\param affector: New affector. */
virtual void addAffector(IParticleAffector* affector) = 0; virtual void addAffector(IParticleAffector* affector) = 0;
//! Removes all particle affectors in the particle system. //! Removes all particle affectors in the particle system.
virtual void removeAllAffectors() = 0; virtual void removeAllAffectors() = 0;
//! Creates a particle emitter for an animated mesh scene node //! Creates a particle emitter for an animated mesh scene node
//! \param node: Pointer to the animated mesh scene node to emit particles from /** \param node: Pointer to the animated mesh scene node to emit
//! \param useNormalDirection: If true, the direction of each particle created will particles from
//! be the normal of the vertex that it's emitting from. The normal is divided by the \param useNormalDirection: If true, the direction of each particle
//! normalDirectionModifier parameter, which defaults to 100.0f. created will be the normal of the vertex that it's emitting from. The
//! \param direction: Direction and speed of particle emission. normal is divided by the normalDirectionModifier parameter, which
//! \param normalDirectionModifier: If the emitter is using the normal direction defaults to 100.0f.
//! then the normal of the vertex that is being emitted from is divided by this number. \param direction: Direction and speed of particle emission.
//! \param mbNumber: This allows you to specify a specific meshBuffer for the IMesh* \param normalDirectionModifier: If the emitter is using the normal
//! to emit particles from. The default value is -1, which means a random meshBuffer direction then the normal of the vertex that is being emitted from is
//! picked from all of the meshes meshBuffers will be selected to pick a random vertex from. divided by this number.
//! If the value is 0 or greater, it will only pick random vertices from the meshBuffer \param mbNumber: This allows you to specify a specific meshBuffer for
//! specified by this value. the IMesh* to emit particles from. The default value is -1, which
//! \param everyMeshVertex: If true, the emitter will emit between min/max particles every second, means a random meshBuffer picked from all of the meshes meshBuffers
//! for every vertex in the mesh, if false, it will emit between min/max particles from random vertices will be selected to pick a random vertex from. If the value is 0 or
//! in the mesh. greater, it will only pick random vertices from the meshBuffer
//! \param minParticlesPerSecond: Minimal amount of particles emitted specified by this value.
//! per second. \param everyMeshVertex: If true, the emitter will emit between min/max
//! \param maxParticlesPerSecond: Maximal amount of particles emitted particles every second, for every vertex in the mesh, if false, it will
//! per second. emit between min/max particles from random vertices in the mesh.
//! \param minStartColor: Minimal initial start color of a particle. \param minParticlesPerSecond: Minimal amount of particles emitted per
//! The real color of every particle is calculated as random interpolation second.
//! between minStartColor and maxStartColor. \param maxParticlesPerSecond: Maximal amount of particles emitted per
//! \param maxStartColor: Maximal initial start color of a particle. second.
//! The real color of every particle is calculated as random interpolation \param minStartColor: Minimal initial start color of a particle. The
//! between minStartColor and maxStartColor. real color of every particle is calculated as random interpolation
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds. between minStartColor and maxStartColor.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds. \param maxStartColor: Maximal initial start color of a particle. The
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction real color of every particle is calculated as random interpolation
//! of the particle will differ from the orignial direction. between minStartColor and maxStartColor.
//! \return Returns a pointer to the created particle emitter. \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! To set this emitter as new emitter of this particle system, \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! just call setEmitter(). Note that you'll have to drop() the \param maxAngleDegrees: Maximal angle in degrees, the emitting
//! returned pointer, after you don't need it any more, see direction of the particle will differ from the original direction.
//! IReferenceCounted::drop() for more informations. \param minStartSize: Minimal initial start size of a particle. The
real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\param maxStartSize: Maximal initial start size of a particle. The
real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\return Pointer to the created particle emitter. To set this emitter
as new emitter of this particle system, just call setEmitter(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleAnimatedMeshSceneNodeEmitter* createAnimatedMeshSceneNodeEmitter( virtual IParticleAnimatedMeshSceneNodeEmitter* createAnimatedMeshSceneNodeEmitter(
scene::IAnimatedMeshSceneNode* node, bool useNormalDirection = true, scene::IAnimatedMeshSceneNode* node, bool useNormalDirection = true,
const core::vector3df& direction = core::vector3df(0.0f,0.0f,0.0f), const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1, f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1,
bool everyMeshVertex = false, bool everyMeshVertex = false,
u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10, u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
const video::SColor& minStartColor = video::SColor(255,0,0,0), const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255), const video::SColor& maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
s32 maxAngleDegrees = 0 ) = 0; s32 maxAngleDegrees = 0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
//! Creates a box particle emitter. //! Creates a box particle emitter.
//! \param box: The box for the emitter. /** \param box: The box for the emitter.
//! \param direction: Direction and speed of particle emission. \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted \param minParticlesPerSecond: Minimal amount of particles emitted per
//! per second. second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted \param maxParticlesPerSecond: Maximal amount of particles emitted per
//! per second. second.
//! \param minStartColor: Minimal initial start color of a particle. \param minStartColor: Minimal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle. \param maxStartColor: Maximal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds. \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds. \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction \param maxAngleDegrees: Maximal angle in degrees, the emitting
//! of the particle will differ from the orignial direction. direction of the particle will differ from the original direction.
//! \return Returns a pointer to the created particle emitter. \param minStartSize: Minimal initial start size of a particle. The
//! To set this emitter as new emitter of this particle system, real size of every particle is calculated as random interpolation
//! just call setEmitter(). Note that you'll have to drop() the between minStartSize and maxStartSize.
//! returned pointer, after you don't need it any more, see \param maxStartSize: Maximal initial start size of a particle. The
//! IReferenceCounted::drop() for more informations. real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\return Pointer to the created particle emitter. To set this emitter
as new emitter of this particle system, just call setEmitter(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleBoxEmitter* createBoxEmitter( virtual IParticleBoxEmitter* createBoxEmitter(
const core::aabbox3df& box = core::aabbox3df(-10,28,-10,10,30,10), const core::aabbox3df& box = core::aabbox3df(-10,28,-10,10,30,10),
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f), const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
@ -161,108 +186,137 @@ public:
const video::SColor& minStartColor = video::SColor(255,0,0,0), const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255), const video::SColor& maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin=2000, u32 lifeTimeMax=4000, u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
s32 maxAngleDegrees=0) = 0; s32 maxAngleDegrees=0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
//! Creates a particle emitter for emitting from a cylinder //! Creates a particle emitter for emitting from a cylinder
//! \param center: The center of the circle at the base of the cylinder /** \param center: The center of the circle at the base of the cylinder
//! \param radius: The thickness of the cylinder \param radius: The thickness of the cylinder
//! \param normal: Direction of the length of the cylinder \param normal: Direction of the length of the cylinder
//! \param length: The length of the the cylinder \param length: The length of the the cylinder
//! \param outlineOnly: Whether or not to put points inside the cylinder or on the outline only \param outlineOnly: Whether or not to put points inside the cylinder or
//! \param direction: Direction and speed of particle emission. on the outline only
//! \param minParticlesPerSecond: Minimal amount of particles emitted per second. \param direction: Direction and speed of particle emission.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted per second. \param minParticlesPerSecond: Minimal amount of particles emitted per
//! \param minStartColor: Minimal initial start color of a particle. second.
//! The real color of every particle is calculated as random interpolation \param maxParticlesPerSecond: Maximal amount of particles emitted per
//! between minStartColor and maxStartColor. second.
//! \param maxStartColor: Maximal initial start color of a particle. \param minStartColor: Minimal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds. \param maxStartColor: Maximal initial start color of a particle. The
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds. real color of every particle is calculated as random interpolation
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction between minStartColor and maxStartColor.
//! of the particle will differ from the orignial direction. \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \return Returns a pointer to the created particle emitter. \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! To set this emitter as new emitter of this particle system, \param maxAngleDegrees: Maximal angle in degrees, the emitting
//! just call setEmitter(). Note that you'll have to drop() the direction of the particle will differ from the original direction.
//! returned pointer, after you don't need it any more, see \param minStartSize: Minimal initial start size of a particle. The
//! IReferenceCounted::drop() for more informations. real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\param maxStartSize: Maximal initial start size of a particle. The
real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\return Pointer to the created particle emitter. To set this emitter
as new emitter of this particle system, just call setEmitter(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleCylinderEmitter* createCylinderEmitter( virtual IParticleCylinderEmitter* createCylinderEmitter(
const core::vector3df& center, f32 radius, const core::vector3df& center, f32 radius,
const core::vector3df& normal, f32 length, const core::vector3df& normal, f32 length,
bool outlineOnly = false, bool outlineOnly = false,
const core::vector3df& direction = core::vector3df(0.0f,0.0f,0.0f), const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10, u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
const video::SColor& minStartColor = video::SColor(255,0,0,0), const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255), const video::SColor& maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
s32 maxAngleDegrees = 0 ) = 0; s32 maxAngleDegrees = 0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
//! Creates a mesh particle emitter. //! Creates a mesh particle emitter.
//! \param mesh: Pointer to mesh to emit particles from /** \param mesh: Pointer to mesh to emit particles from
//! \param useNormalDirection: If true, the direction of each particle created will \param useNormalDirection: If true, the direction of each particle
//! be the normal of the vertex that it's emitting from. The normal is divided by the created will be the normal of the vertex that it's emitting from. The
//! normalDirectionModifier parameter, which defaults to 100.0f. normal is divided by the normalDirectionModifier parameter, which
//! \param direction: Direction and speed of particle emission. defaults to 100.0f.
//! \param normalDirectionModifier: If the emitter is using the normal direction \param direction: Direction and speed of particle emission.
//! then the normal of the vertex that is being emitted from is divided by this number. \param normalDirectionModifier: If the emitter is using the normal
//! \param mbNumber: This allows you to specify a specific meshBuffer for the IMesh* direction then the normal of the vertex that is being emitted from is
//! to emit particles from. The default value is -1, which means a random meshBuffer divided by this number.
//! picked from all of the meshes meshBuffers will be selected to pick a random vertex from. \param mbNumber: This allows you to specify a specific meshBuffer for
//! If the value is 0 or greater, it will only pick random vertices from the meshBuffer the IMesh* to emit particles from. The default value is -1, which
//! specified by this value. means a random meshBuffer picked from all of the meshes meshBuffers
//! \param everyMeshVertex: If true, the emitter will emit between min/max particles every second, will be selected to pick a random vertex from. If the value is 0 or
//! for every vertex in the mesh, if false, it will emit between min/max particles from random vertices greater, it will only pick random vertices from the meshBuffer
//! in the mesh. specified by this value.
//! \param minParticlesPerSecond: Minimal amount of particles emitted per second. \param everyMeshVertex: If true, the emitter will emit between min/max
//! \param maxParticlesPerSecond: Maximal amount of particles emitted per second. particles every second, for every vertex in the mesh, if false, it will
//! \param minStartColor: Minimal initial start color of a particle. emit between min/max particles from random vertices in the mesh.
//! The real color of every particle is calculated as random interpolation \param minParticlesPerSecond: Minimal amount of particles emitted per
//! between minStartColor and maxStartColor. second.
//! \param maxStartColor: Maximal initial start color of a particle. \param maxParticlesPerSecond: Maximal amount of particles emitted per
//! The real color of every particle is calculated as random interpolation second.
//! between minStartColor and maxStartColor. \param minStartColor: Minimal initial start color of a particle. The
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds. real color of every particle is calculated as random interpolation
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds. between minStartColor and maxStartColor.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction \param maxStartColor: Maximal initial start color of a particle. The
//! of the particle will differ from the orignial direction. real color of every particle is calculated as random interpolation
//! \return Returns a pointer to the created particle emitter. between minStartColor and maxStartColor.
//! To set this emitter as new emitter of this particle system, \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! just call setEmitter(). Note that you'll have to drop() the \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! returned pointer, after you don't need it any more, see \param maxAngleDegrees: Maximal angle in degrees, the emitting
//! IReferenceCounted::drop() for more informations. direction of the particle will differ from the original direction.
\param minStartSize: Minimal initial start size of a particle. The
real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\param maxStartSize: Maximal initial start size of a particle. The
real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\return Pointer to the created particle emitter. To set this emitter
as new emitter of this particle system, just call setEmitter(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleMeshEmitter* createMeshEmitter( virtual IParticleMeshEmitter* createMeshEmitter(
scene::IMesh* mesh, bool useNormalDirection = true, scene::IMesh* mesh, bool useNormalDirection = true,
const core::vector3df& direction = core::vector3df(0.0f,0.0f,0.0f), const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1, f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1,
bool everyMeshVertex = false, bool everyMeshVertex = false,
u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10, u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
const video::SColor& minStartColor = video::SColor(255,0,0,0), const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255), const video::SColor& maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
s32 maxAngleDegrees = 0 ) = 0; s32 maxAngleDegrees = 0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
//! Creates a point particle emitter. //! Creates a point particle emitter.
//! \param direction: Direction and speed of particle emission. /** \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted \param minParticlesPerSecond: Minimal amount of particles emitted per
//! per second. second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted \param maxParticlesPerSecond: Maximal amount of particles emitted per
//! per second. second.
//! \param minStartColor: Minimal initial start color of a particle. \param minStartColor: Minimal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle. \param maxStartColor: Maximal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds. \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds. \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction \param maxAngleDegrees: Maximal angle in degrees, the emitting
//! of the particle will differ from the orignial direction. direction of the particle will differ from the original direction.
//! \return Returns a pointer to the created particle emitter. \param minStartSize: Minimal initial start size of a particle. The
//! To set this emitter as new emitter of this particle system, real size of every particle is calculated as random interpolation
//! just call setEmitter(). Note that you'll have to drop() the between minStartSize and maxStartSize.
//! returned pointer, after you don't need it any more, see \param maxStartSize: Maximal initial start size of a particle. The
//! IReferenceCounted::drop() for more informations. real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\return Pointer to the created particle emitter. To set this emitter
as new emitter of this particle system, just call setEmitter(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticlePointEmitter* createPointEmitter( virtual IParticlePointEmitter* createPointEmitter(
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f), const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
u32 minParticlesPerSecond = 5, u32 minParticlesPerSecond = 5,
@ -270,34 +324,41 @@ public:
const video::SColor& minStartColor = video::SColor(255,0,0,0), const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255), const video::SColor& maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin=2000, u32 lifeTimeMax=4000, u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
s32 maxAngleDegrees=0) = 0; s32 maxAngleDegrees=0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
//! Creates a ring particle emitter. //! Creates a ring particle emitter.
//! \param center: Center of ring /** \param center: Center of ring
//! \param radius: Distance of points from center, points will be rotated around the \param radius: Distance of points from center, points will be rotated
//! Y axis at a random 360 degrees and will then be shifted by the provided ringThickness around the Y axis at a random 360 degrees and will then be shifted by
//! values in each axis. the provided ringThickness values in each axis.
//! \param ringThickness : thickness of the ring or how wide the ring is \param ringThickness : thickness of the ring or how wide the ring is
//! \param direction: Direction and speed of particle emission. \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted \param minParticlesPerSecond: Minimal amount of particles emitted per
//! per second. second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted \param maxParticlesPerSecond: Maximal amount of particles emitted per
//! per second. second.
//! \param minStartColor: Minimal initial start color of a particle. \param minStartColor: Minimal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle. \param maxStartColor: Maximal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds. \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds. \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction \param maxAngleDegrees: Maximal angle in degrees, the emitting
//! of the particle will differ from the orignial direction. direction of the particle will differ from the original direction.
//! \return Returns a pointer to the created particle emitter. \param minStartSize: Minimal initial start size of a particle. The
//! To set this emitter as new emitter of this particle system, real size of every particle is calculated as random interpolation
//! just call setEmitter(). Note that you'll have to drop() the between minStartSize and maxStartSize.
//! returned pointer, after you don't need it any more, see \param maxStartSize: Maximal initial start size of a particle. The
//! IReferenceCounted::drop() for more informations. real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\return Pointer to the created particle emitter. To set this emitter
as new emitter of this particle system, just call setEmitter(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleRingEmitter* createRingEmitter( virtual IParticleRingEmitter* createRingEmitter(
const core::vector3df& center, f32 radius, f32 ringThickness, const core::vector3df& center, f32 radius, f32 ringThickness,
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f), const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
@ -306,31 +367,38 @@ public:
const video::SColor& minStartColor = video::SColor(255,0,0,0), const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255), const video::SColor& maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin=2000, u32 lifeTimeMax=4000, u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
s32 maxAngleDegrees=0) = 0; s32 maxAngleDegrees=0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
//! Creates a sphere particle emitter. //! Creates a sphere particle emitter.
//! \param center: Center of sphere /** \param center: Center of sphere
//! \param radius: Radius of sphere \param radius: Radius of sphere
//! \param direction: Direction and speed of particle emission. \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted \param minParticlesPerSecond: Minimal amount of particles emitted per
//! per second. second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted \param maxParticlesPerSecond: Maximal amount of particles emitted per
//! per second. second.
//! \param minStartColor: Minimal initial start color of a particle. \param minStartColor: Minimal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle. \param maxStartColor: Maximal initial start color of a particle. The
//! The real color of every particle is calculated as random interpolation real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor. between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds. \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds. \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction \param maxAngleDegrees: Maximal angle in degrees, the emitting
//! of the particle will differ from the orignial direction. direction of the particle will differ from the original direction.
//! \return Returns a pointer to the created particle emitter. \param minStartSize: Minimal initial start size of a particle. The
//! To set this emitter as new emitter of this particle system, real size of every particle is calculated as random interpolation
//! just call setEmitter(). Note that you'll have to drop() the between minStartSize and maxStartSize.
//! returned pointer, after you don't need it any more, see \param maxStartSize: Maximal initial start size of a particle. The
//! IReferenceCounted::drop() for more informations. real size of every particle is calculated as random interpolation
between minStartSize and maxStartSize.
\return Pointer to the created particle emitter. To set this emitter
as new emitter of this particle system, just call setEmitter(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleSphereEmitter* createSphereEmitter( virtual IParticleSphereEmitter* createSphereEmitter(
const core::vector3df& center, f32 radius, const core::vector3df& center, f32 radius,
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f), const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
@ -339,70 +407,86 @@ public:
const video::SColor& minStartColor = video::SColor(255,0,0,0), const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255), const video::SColor& maxStartColor = video::SColor(255,255,255,255),
u32 lifeTimeMin=2000, u32 lifeTimeMax=4000, u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
s32 maxAngleDegrees=0) = 0; s32 maxAngleDegrees=0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
//! Creates a point attraction affector. This affector modifies the positions of the //! Creates a point attraction affector.
//! particles and attracts them to a specified point at a specified speed per second. /** This affector modifies the positions of the particles and attracts
//! \param point: Point to attract particles to. them to a specified point at a specified speed per second.
//! \param speed: Speed in units per second, to attract to the specified point. \param point: Point to attract particles to.
//! \param attract: Whether the particles attract or detract from this point. \param speed: Speed in units per second, to attract to the specified
//! \param affectX: Whether or not this will affect the X position of the particle. point.
//! \param affectY: Whether or not this will affect the Y position of the particle. \param attract: Whether the particles attract or detract from this
//! \param affectZ: Whether or not this will affect the Z position of the particle. point.
//! \return Returns a pointer to the created particle affector. \param affectX: Whether or not this will affect the X position of the
//! To add this affector as new affector of this particle system, particle.
//! just call addAffector(). Note that you'll have to drop() the \param affectY: Whether or not this will affect the Y position of the
//! returned pointer, after you don't need it any more, see particle.
//! IReferenceCounted::drop() for more informations. \param affectZ: Whether or not this will affect the Z position of the
particle.
\return Pointer to the created particle affector. To add this affector
as new affector of this particle system, just call addAffector(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleAttractionAffector* createAttractionAffector( virtual IParticleAttractionAffector* createAttractionAffector(
const core::vector3df& point, f32 speed = 1.0f, bool attract = true, const core::vector3df& point, f32 speed = 1.0f, bool attract = true,
bool affectX = true, bool affectY = true, bool affectZ = true) = 0; bool affectX = true, bool affectY = true, bool affectZ = true) = 0;
//! Creates a fade out particle affector. This affector modifies //! Creates a scale particle affector.
//! the color of every particle and and reaches the final color /** This affector scales the particle to the a multiple of its size defined
//! when the particle dies. by the scaleTo variable.
//! This affector looks really good, if the EMT_TRANSPARENT_VERTEX_ALPHA \param scaleTo: multiple of the size which the particle will be scaled to until deletion
//! material is used and the targetColor is video::SColor(0,0,0,0): \return Pointer to the created particle affector.
//! Particles are fading out into void with this setting. To add this affector as new affector of this particle system,
//! \param targetColor: Color whereto the color of the particle is changed. just call addAffector(). Note that you'll have to drop() the
//! \param timeNeededToFadeOut: How much time in milli seconds returned pointer, after you don't need it any more, see
//! should the affector need to change the color to the targetColor. IReferenceCounted::drop() for more information. */
//! \return Returns a pointer to the created particle affector. virtual IParticleAffector* createScaleParticleAffector(const core::dimension2df& scaleTo = core::dimension2df(1.0f, 1.0f)) = 0;
//! To add this affector as new affector of this particle system,
//! just call addAffector(). Note that you'll have to drop() the //! Creates a fade out particle affector.
//! returned pointer, after you don't need it any more, see /** This affector modifies the color of every particle and and reaches
//! IReferenceCounted::drop() for more informations. the final color when the particle dies. This affector looks really
good, if the EMT_TRANSPARENT_VERTEX_ALPHA material is used and the
targetColor is video::SColor(0,0,0,0): Particles are fading out into
void with this setting.
\param targetColor: Color whereto the color of the particle is changed.
\param timeNeededToFadeOut: How much time in milli seconds should the
affector need to change the color to the targetColor.
\return Pointer to the created particle affector. To add this affector
as new affector of this particle system, just call addAffector(). Note
that you'll have to drop() the returned pointer, after you don't need
it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleFadeOutAffector* createFadeOutParticleAffector( virtual IParticleFadeOutAffector* createFadeOutParticleAffector(
const video::SColor& targetColor = video::SColor(0,0,0,0), const video::SColor& targetColor = video::SColor(0,0,0,0),
u32 timeNeededToFadeOut = 1000) = 0; u32 timeNeededToFadeOut = 1000) = 0;
//! Creates a gravity affector. This affector modifies the direction //! Creates a gravity affector.
//! of the particle. It assumes that the particle is fired out of the /** This affector modifies the direction of the particle. It assumes
//! emitter with huge force, but is loosing this after some time that the particle is fired out of the emitter with huge force, but is
//! and is catched by the gravity then. This affector is ideal for loosing this after some time and is catched by the gravity then. This
//! creating things like fountains. affector is ideal for creating things like fountains.
//! \param gravity: Direction and force of gravity. \param gravity: Direction and force of gravity.
//! \param timeForceLost: Time in milli seconds when the force \param timeForceLost: Time in milli seconds when the force of the
//! of the emitter is totally lost and the particle does not move any more. emitter is totally lost and the particle does not move any more. This
//! This is the time where gravity fully affects the particle. is the time where gravity fully affects the particle.
//! \return Returns a pointer to the created particle affector. \return Pointer to the created particle affector. To add this affector
//! To add this affector as new affector of this particle system, as new affector of this particle system, just call addAffector(). Note
//! just call addAffector(). Note that you'll have to drop() the that you'll have to drop() the returned pointer, after you don't need
//! returned pointer, after you don't need it any more, see it any more, see IReferenceCounted::drop() for more informations. */
//! IReferenceCounted::drop() for more informations.
virtual IParticleGravityAffector* createGravityAffector( virtual IParticleGravityAffector* createGravityAffector(
const core::vector3df& gravity = core::vector3df(0.0f,-0.03f,0.0f), const core::vector3df& gravity = core::vector3df(0.0f,-0.03f,0.0f),
u32 timeForceLost = 1000) = 0; u32 timeForceLost = 1000) = 0;
//! Creates a rotation affector. This affector modifies the positions of the //! Creates a rotation affector.
//! particles and attracts them to a specified point at a specified speed per second. /** This affector modifies the positions of the particles and attracts
//! \param speed: Rotation in degrees per second them to a specified point at a specified speed per second.
//! \param pivotPoint: Point to rotate the particles around \param speed: Rotation in degrees per second
//! \return Returns a pointer to the created particle affector. \param pivotPoint: Point to rotate the particles around
//! To add this affector as new affector of this particle system, \return Pointer to the created particle affector. To add this affector
//! just call addAffector(). Note that you'll have to drop() the as new affector of this particle system, just call addAffector(). Note
//! returned pointer, after you don't need it any more, see that you'll have to drop() the returned pointer, after you don't need
//! IReferenceCounted::drop() for more informations. it any more, see IReferenceCounted::drop() for more informations. */
virtual IParticleRotationAffector* createRotationAffector( virtual IParticleRotationAffector* createRotationAffector(
const core::vector3df& speed = core::vector3df(5.0f,5.0f,5.0f), const core::vector3df& speed = core::vector3df(5.0f,5.0f,5.0f),
const core::vector3df& pivotPoint = core::vector3df(0.0f,0.0f,0.0f) ) = 0; const core::vector3df& pivotPoint = core::vector3df(0.0f,0.0f,0.0f) ) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -13,7 +13,7 @@ namespace irr
namespace scene namespace scene
{ {
//! Interface for a Mesh which can be loaded directly from a Quake3 .bsp-file. //! Interface for a Mesh which can be loaded directly from a Quake3 .bsp-file.
/** The Mesh tries to load all textures of the map. There are currently /** The Mesh tries to load all textures of the map. There are currently
no additional methods in this class, but maybe there will be some in later no additional methods in this class, but maybe there will be some in later
releases if there are feature requests. */ releases if there are feature requests. */
class IQ3LevelMesh : public IAnimatedMesh class IQ3LevelMesh : public IAnimatedMesh
@ -21,18 +21,18 @@ namespace scene
public: public:
//! releases a Mesh from the Q3 Loader //! releases a Mesh from the Q3 Loader
virtual void releaseMesh ( s32 index ) = 0; virtual void releaseMesh(s32 index) = 0;
//! loads the shader definition //! loads the shader definition from file
// either from file ( we assume /scripts on fileNameIsValid == 0 ) /** \param filename Name of the shaderfile, defaults to /scripts if fileNameIsValid is false.
virtual const quake3::SShader * getShader ( const c8 * filename, s32 fileNameIsValid ) = 0; \param fileNameIsValid Specifies whether the filename is valid in the current situation. */
virtual const quake3::SShader* getShader( const c8* filename, bool fileNameIsValid=true ) = 0;
//! returns a already loaded Shader //! returns a already loaded Shader
virtual const quake3::SShader * getShader ( u32 index ) const = 0; virtual const quake3::SShader* getShader(u32 index) const = 0;
//! get's an interface to the entities //! get's an interface to the entities
virtual const quake3::tQ3EntityList & getEntityList () = 0; virtual const quake3::tQ3EntityList& getEntityList() = 0;
}; };
} // end namespace scene } // end namespace scene

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt / Thomas Alten // Copyright (C) 2006-2009 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -31,8 +31,8 @@ namespace quake3
// we are not using gamma, so quake3 is very dark. // we are not using gamma, so quake3 is very dark.
// define the standard multiplication for lightmaps and vertex colors // define the standard multiplication for lightmaps and vertex colors
const video::E_MATERIAL_TYPE defaultLightMap = video::EMT_LIGHTMAP_M2; const video::E_MATERIAL_TYPE defaultMaterialType = video::EMT_LIGHTMAP_M4;
const video::E_MODULATE_FUNC defaultModulate = video::EMFN_MODULATE_2X; const video::E_MODULATE_FUNC defaultModulate = video::EMFN_MODULATE_4X;
// some useful typedefs // some useful typedefs
typedef core::array< core::stringc > tStringList; typedef core::array< core::stringc > tStringList;
@ -132,16 +132,22 @@ namespace quake3
} }
//! A blend function for a q3 shader.
struct SBlendFunc struct SBlendFunc
{ {
SBlendFunc () : type ( video::EMT_SOLID ), param ( 0.f ) {} SBlendFunc ()
: type ( video::EMT_SOLID ), modulate ( defaultModulate ), param ( 0.f ),
isTransparent ( false ) {}
video::E_MATERIAL_TYPE type; video::E_MATERIAL_TYPE type;
video::E_MODULATE_FUNC modulate;
f32 param; f32 param;
bool isTransparent;
}; };
// parses the content of Variable cull // parses the content of Variable cull
inline bool getBackfaceCulling ( const core::stringc &string ) inline bool isDisabled ( const core::stringc &string )
{ {
if ( string.size() == 0 ) if ( string.size() == 0 )
return true; return true;
@ -168,7 +174,7 @@ namespace quake3
return 1; return 1;
u32 ret = 1; u32 ret = 1;
static const c8 * funclist[] = { "lequal","equal" }; static const c8 * funclist[] = { "lequal","equal" };
u32 pos = 0; u32 pos = 0;
switch ( isEqual ( string, pos, funclist, 2 ) ) switch ( isEqual ( string, pos, funclist, 2 ) )
@ -183,7 +189,6 @@ namespace quake3
} }
// parses the content of Variable blendfunc,alphafunc // parses the content of Variable blendfunc,alphafunc
inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc ) inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc )
{ {
@ -231,12 +236,14 @@ namespace quake3
// gl_one gl_zero // gl_one gl_zero
case video::EBF_ZERO: case video::EBF_ZERO:
blendfunc.type = video::EMT_SOLID; blendfunc.type = video::EMT_SOLID;
blendfunc.isTransparent = false;
resolved = 1; resolved = 1;
break; break;
// gl_one gl_one // gl_one gl_one
case video::EBF_ONE: case video::EBF_ONE:
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR; blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
blendfunc.isTransparent = true;
resolved = 1; resolved = 1;
break; break;
} break; } break;
@ -248,6 +255,7 @@ namespace quake3
case video::EBF_ONE_MINUS_SRC_ALPHA: case video::EBF_ONE_MINUS_SRC_ALPHA:
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL; blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param = 1.f / 255.f; blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
resolved = 1; resolved = 1;
break; break;
} break; } break;
@ -255,30 +263,35 @@ namespace quake3
case 11: case 11:
// add // add
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR; blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
blendfunc.isTransparent = true;
resolved = 1; resolved = 1;
break; break;
case 12: case 12:
// filter = gl_dst_color gl_zero // filter = gl_dst_color gl_zero
blendfunc.type = video::EMT_ONETEXTURE_BLEND; blendfunc.type = video::EMT_ONETEXTURE_BLEND;
blendfunc.param = video::pack_texureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, defaultModulate ); blendfunc.param = video::pack_texureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, defaultModulate );
blendfunc.isTransparent = false;
resolved = 1; resolved = 1;
break; break;
case 13: case 13:
// blend // blend
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL; blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param = 1.f / 255.f; blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
resolved = 1; resolved = 1;
break; break;
case 14: case 14:
// alphafunc ge128 // alphafunc ge128
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
blendfunc.param = 0.5f; blendfunc.param = 0.5f;
blendfunc.isTransparent = true;
resolved = 1; resolved = 1;
break; break;
case 15: case 15:
// alphafunc gt0 // alphafunc gt0
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
blendfunc.param = 1.f / 255.f; blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
resolved = 1; resolved = 1;
break; break;
} }
@ -290,14 +303,24 @@ namespace quake3
blendfunc.param = video::pack_texureBlendFunc ( blendfunc.param = video::pack_texureBlendFunc (
(video::E_BLEND_FACTOR) srcFact, (video::E_BLEND_FACTOR) srcFact,
(video::E_BLEND_FACTOR) dstFact, (video::E_BLEND_FACTOR) dstFact,
defaultModulate); blendfunc.modulate);
if (srcFact == video::EBF_SRC_COLOR && dstFact == video::EBF_ZERO)
{
blendfunc.isTransparent = 0;
}
else
{
blendfunc.isTransparent = true;
}
} }
} }
struct SModifierFunction struct SModifierFunction
{ {
SModifierFunction () SModifierFunction ()
: masterfunc0 ( 0 ), masterfunc1(0), func ( 0 ), : masterfunc0 ( -2 ), masterfunc1(0), func ( 0 ),
tcgen( 8 ), base ( 0 ), amp ( 1 ), phase ( 0 ), freq ( 1 ), wave(1) {} tcgen( 8 ), base ( 0 ), amp ( 1 ), phase ( 0 ), freq ( 1 ), wave(1) {}
// "tcmod","deformvertexes","rgbgen", "tcgen" // "tcmod","deformvertexes","rgbgen", "tcgen"
@ -442,6 +465,7 @@ namespace quake3
core::array < SVarGroup > VariableGroup; core::array < SVarGroup > VariableGroup;
}; };
//! A Parsed Shader Holding Variables ordered in Groups //! A Parsed Shader Holding Variables ordered in Groups
class SShader class SShader
{ {
@ -470,7 +494,7 @@ namespace quake3
// Shader: shader name ( also first variable in first Vargroup ) // Shader: shader name ( also first variable in first Vargroup )
// Entity: classname ( variable in Group(1) ) // Entity: classname ( variable in Group(1) )
core::stringc name; core::stringc name;
SVarGroupList *VarGroup; // reference SVarGroupList *VarGroup; // reference
}; };
typedef SShader SEntity; typedef SShader SEntity;
@ -535,7 +559,7 @@ namespace quake3
for ( u32 i = 0; i != size; ++i ) for ( u32 i = 0; i != size; ++i )
{ {
group = &shader->VarGroup->VariableGroup[ i ]; group = &shader->VarGroup->VariableGroup[ i ];
dumpVarGroup ( dest, group, core::clamp ( (s32) i, 0, 2 ) ); dumpVarGroup ( dest, group, core::clamp( (int)i, 0, 2 ) );
} }
if ( size <= 1 ) if ( size <= 1 )
@ -554,13 +578,12 @@ namespace quake3
load one or multiple files stored in name started at startPos to the texture array textures 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) if texture is not loaded 0 will be added ( to find missing textures easier)
*/ */
inline void getTextures ( tTexArray &textures , inline void getTextures(tTexArray &textures,
const core::stringc &name, u32 &startPos, const core::stringc &name, u32 &startPos,
io::IFileSystem *fileSystem, io::IFileSystem *fileSystem,
video::IVideoDriver* driver video::IVideoDriver* driver)
)
{ {
static const char * extension[2] = static const char * extension[2] =
{ {
".jpg", ".jpg",
".tga" ".tga"
@ -594,9 +617,7 @@ namespace quake3
} }
/*! //! Manages various Quake3 Shader Styles
Manages various Quake3 Shader Styles
*/
class IShaderManager : public IReferenceCounted class IShaderManager : public IReferenceCounted
{ {
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -16,33 +16,30 @@ namespace io
class IReadFile : public virtual IReferenceCounted class IReadFile : public virtual IReferenceCounted
{ {
public: public:
virtual ~IReadFile() {}
//! Reads an amount of bytes from the file. //! Reads an amount of bytes from the file.
//! \param buffer: Pointer to buffer where to read bytes will be written to. /** \param buffer Pointer to buffer where read bytes are written to.
//! \param sizeToRead: Amount of bytes to read from the file. \param sizeToRead Amount of bytes to read from the file.
//! \return Returns how much bytes were read. \return How much bytes were read. */
virtual s32 read(void* buffer, u32 sizeToRead) = 0; virtual s32 read(void* buffer, u32 sizeToRead) = 0;
//! Changes position in file, returns true if successful. //! Changes position in file
//! \param finalPos: Destination position in the file. /** \param finalPos Destination position in the file.
//! \param relativeMovement: If set to true, the position in the file is \param relativeMovement If set to true, the position in the file is
//! changed relative to current position. Otherwise the position is changed changed relative to current position. Otherwise the position is changed
//! from beginning of file. from beginning of file.
//! \return Returns true if successful, otherwise false. \return True if successful, otherwise false. */
virtual bool seek(long finalPos, bool relativeMovement = false) = 0; virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
//! Returns size of file. //! Get size of file.
//! \return Returns the size of the file in bytes. /** \return Size of the file in bytes. */
virtual long getSize() const = 0; virtual long getSize() const = 0;
//! Returns the current position in the file. //! Get the current position in the file.
//! \return Returns the current position in the file in bytes. /** \return Current position in the file in bytes. */
virtual long getPos() const = 0; virtual long getPos() const = 0;
//! Returns name of file. //! Get name of file.
//! \return Returns the file name as zero terminated character string. /** \return File name as zero terminated character string. */
virtual const c8* getFileName() const = 0; virtual const c8* getFileName() const = 0;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -18,11 +18,11 @@ namespace irr
When you create an object in the Irrlicht engine, calling a method When you create an object in the Irrlicht engine, calling a method
which starts with 'create', an object is created, and you get a pointer which starts with 'create', an object is created, and you get a pointer
to the new object. If you no longer need the object, you have to the new object. If you no longer need the object, you have
to call drop(). This will destroy the object, if grab() was not called to call drop(). This will destroy the object, if grab() was not called
in another part of you program, because this part still needs the object. in another part of you program, because this part still needs the object.
Note, that you only need to call drop() to the object, if you created it, Note, that you only need to call drop() to the object, if you created it,
and the method had a 'create' in it. and the method had a 'create' in it.
A simple example: A simple example:
@ -54,64 +54,69 @@ namespace irr
} }
//! Grabs the object. Increments the reference counter by one. //! Grabs the object. Increments the reference counter by one.
//! Someone who calls grab() to an object, should later also call /** Someone who calls grab() to an object, should later also
//! drop() to it. If an object never gets as much drop() as grab() call drop() to it. If an object never gets as much drop() as
//! calls, it will never be destroyed. grab() calls, it will never be destroyed. The
//! The IReferenceCounted class provides a basic reference counting mechanism IReferenceCounted class provides a basic reference counting
//! with its methods grab() and drop(). Most objects of the Irrlicht mechanism with its methods grab() and drop(). Most objects of
//! Engine are derived from IReferenceCounted, and so they are reference counted. the Irrlicht Engine are derived from IReferenceCounted, and so
//! they are reference counted.
//! When you create an object in the Irrlicht engine, calling a method
//! which starts with 'create', an object is created, and you get a pointer When you create an object in the Irrlicht engine, calling a
//! to the new object. If you no longer need the object, you have method which starts with 'create', an object is created, and
//! to call drop(). This will destroy the object, if grab() was not called you get a pointer to the new object. If you no longer need the
//! in another part of you program, because this part still needs the object. object, you have to call drop(). This will destroy the object,
//! Note, that you only need to call drop() to the object, if you created it, if grab() was not called in another part of you program,
//! and the method had a 'create' in it. because this part still needs the object. Note, that you only
//! need to call drop() to the object, if you created it, and the
//! A simple example: method had a 'create' in it.
//!
//! If you want to create a texture, you may want to call an imaginable method A simple example:
//! IDriver::createTexture. You call
//! ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128)); If you want to create a texture, you may want to call an
//! If you no longer need the texture, call texture->drop(). imaginable method IDriver::createTexture. You call
//! If you want to load a texture, you may want to call imaginable method ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
//! IDriver::loadTexture. You do this like If you no longer need the texture, call texture->drop().
//! ITexture* texture = driver->loadTexture("example.jpg"); If you want to load a texture, you may want to call imaginable
//! You will not have to drop the pointer to the loaded texture, because method IDriver::loadTexture. You do this like
//! the name of the method does not start with 'create'. The texture ITexture* texture = driver->loadTexture("example.jpg");
//! is stored somewhere by the driver. You will not have to drop the pointer to the loaded texture,
because the name of the method does not start with 'create'.
The texture is stored somewhere by the driver. */
void grab() const { ++ReferenceCounter; } void grab() const { ++ReferenceCounter; }
//! Drops the object. Decrements the reference counter by one. //! Drops the object. Decrements the reference counter by one.
//! Returns true, if the object was deleted. /** The IReferenceCounted class provides a basic reference
//! The IReferenceCounted class provides a basic reference counting mechanism counting mechanism with its methods grab() and drop(). Most
//! with its methods grab() and drop(). Most objects of the Irrlicht objects of the Irrlicht Engine are derived from
//! Engine are derived from IReferenceCounted, and so they are reference counted. IReferenceCounted, and so they are reference counted.
//!
//! When you create an object in the Irrlicht engine, calling a method When you create an object in the Irrlicht engine, calling a
//! which starts with 'create', an object is created, and you get a pointer method which starts with 'create', an object is created, and
//! to the new object. If you no longer need the object, you have you get a pointer to the new object. If you no longer need the
//! to call drop(). This will destroy the object, if grab() was not called object, you have to call drop(). This will destroy the object,
//! in another part of you program, because this part still needs the object. if grab() was not called in another part of you program,
//! Note, that you only need to call drop() to the object, if you created it, because this part still needs the object. Note, that you only
//! and the method had a 'create' in it. need to call drop() to the object, if you created it, and the
//! method had a 'create' in it.
//! A simple example:
//! A simple example:
//! If you want to create a texture, you may want to call an imaginable method
//! IDriver::createTexture. You call If you want to create a texture, you may want to call an
//! ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128)); imaginable method IDriver::createTexture. You call
//! If you no longer need the texture, call texture->drop(). ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
//! If you want to load a texture, you may want to call imaginable method If you no longer need the texture, call texture->drop().
//! IDriver::loadTexture. You do this like If you want to load a texture, you may want to call imaginable
//! ITexture* texture = driver->loadTexture("example.jpg"); method IDriver::loadTexture. You do this like
//! You will not have to drop the pointer to the loaded texture, because ITexture* texture = driver->loadTexture("example.jpg");
//! the name of the method does not start with 'create'. The texture You will not have to drop the pointer to the loaded texture,
//! is stored somewhere by the driver. because the name of the method does not start with 'create'.
The texture is stored somewhere by the driver.
\return True, if the object was deleted. */
bool drop() const bool drop() const
{ {
_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0) // someone is doing bad reference counting. // someone is doing bad reference counting.
_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0)
--ReferenceCounter; --ReferenceCounter;
if (!ReferenceCounter) if (!ReferenceCounter)
@ -123,15 +128,17 @@ namespace irr
return false; return false;
} }
//! Returns the reference counter. //! Get the reference count.
/** \return Current value of the reference counter. */
s32 getReferenceCount() const s32 getReferenceCount() const
{ {
return ReferenceCounter; return ReferenceCounter;
} }
//! Returns the debug name of the object. The Debugname may only be set and //! Returns the debug name of the object.
//! changed by the object itself. This method should only be used in Debug mode. /** The Debugname may only be set and changed by the object
//! \return Returns a string, previously set by setDebugName(); itself. This method should only be used in Debug mode.
\return Returns a string, previously set by setDebugName(); */
const c8* getDebugName() const const c8* getDebugName() const
{ {
return DebugName; return DebugName;
@ -139,17 +146,19 @@ namespace irr
protected: protected:
//! Sets the debug name of the object. The Debugname may only be set and //! Sets the debug name of the object.
//! changed by the object itself. This method should only be used in Debug mode. /** The Debugname may only be set and changed by the object
//! \param newName: New debug name to set. itself. This method should only be used in Debug mode.
\param newName: New debug name to set. */
void setDebugName(const c8* newName) void setDebugName(const c8* newName)
{ {
DebugName = newName; DebugName = newName;
} }
private: private:
//! The reference counter. Mutable to do reference counting on const objects.
mutable s32 ReferenceCounter; mutable s32 ReferenceCounter;
//! The debug name.
const c8* DebugName; const c8* DebugName;
}; };

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,131 +14,136 @@
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
class ISceneNode; class ISceneNode;
class ICameraSceneNode; class ICameraSceneNode;
class ITriangleSelector; class ITriangleSelector;
//! The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes. //! The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.
class ISceneCollisionManager : public virtual IReferenceCounted class ISceneCollisionManager : public virtual IReferenceCounted
{ {
public: public:
//! destructor //! Destructor
virtual ~ISceneCollisionManager() {} virtual ~ISceneCollisionManager() {}
//! Finds the collision point of a line and lots of triangles, if there is one. //! Finds the collision point of a line and lots of triangles, if there is one.
//! \param ray: Line with witch collisions are tested. /** \param ray: Line with witch collisions are tested.
//! \param selector: TriangleSelector containing the triangles. It can \param selector: TriangleSelector containing the triangles. It
//! be created for example using ISceneManager::createTriangleSelector() or can be created for example using
//! ISceneManager::createTriangleOctTreeSelector(). ISceneManager::createTriangleSelector() or
//! \param outCollisionPoint: If a collision is detected, this will contain the ISceneManager::createTriangleOctTreeSelector().
//! position of the nearest collision. \param outCollisionPoint: If a collision is detected, this will
//! \param outTriangle: If a collision is detected, this will contain the triangle contain the position of the nearest collision.
//! with which the ray collided. \param outTriangle: If a collision is detected, this will
//! \return Returns true if a collision was detected and false if not. contain the triangle with which the ray collided.
\return True if a collision was detected and false if not. */
virtual bool getCollisionPoint(const core::line3d<f32>& ray, virtual bool getCollisionPoint(const core::line3d<f32>& ray,
ITriangleSelector* selector, core::vector3df& outCollisionPoint, ITriangleSelector* selector, core::vector3df& outCollisionPoint,
core::triangle3df& outTriangle) = 0; core::triangle3df& outTriangle) = 0;
//! Collides a moving ellipsoid with a 3d world with gravity and returns //! Collides a moving ellipsoid with a 3d world with gravity and returns the resulting new position of the ellipsoid.
//! the resulting new position of the ellipsoid. This can be used for moving /** This can be used for moving a character in a 3d world: The
//! a character in a 3d world: The character will slide at walls and is able character will slide at walls and is able to walk up stairs.
//! to walk up stairs. The method used how to calculate the collision result The method used how to calculate the collision result position
//! position is based on the paper "Improved Collision detection and Response" is based on the paper "Improved Collision detection and
//! by Kasper Fauerby. Response" by Kasper Fauerby.
//! \param selector: TriangleSelector containing the triangles of the world. \param selector: TriangleSelector containing the triangles of
//! It can be created for example using ISceneManager::createTriangleSelector() or the world. It can be created for example using
//! ISceneManager::createTriangleOctTreeSelector(). ISceneManager::createTriangleSelector() or
//! \param ellipsoidPosition: Position of the ellipsoid. ISceneManager::createTriangleOctTreeSelector().
//! \param ellipsoidRadius: Radius of the ellipsoid. \param ellipsoidPosition: Position of the ellipsoid.
//! \param ellipsoidDirectionAndSpeed: Direction and speed of \param ellipsoidRadius: Radius of the ellipsoid.
//! the movement of the ellipsoid. \param ellipsoidDirectionAndSpeed: Direction and speed of the
//! \param triout: Optional parameter where the last triangle causing a movement of the ellipsoid.
//! collision is stored, if there is a collision. \param triout: Optional parameter where the last triangle
//! \param outFalling: Is set to true if the ellipsoid is falling down, caused causing a collision is stored, if there is a collision.
//! by gravity. \param outFalling: Is set to true if the ellipsoid is falling
//! \param slidingSpeed: DOCUMENTATION NEEDED. down, caused by gravity.
//! \param gravityDirectionAndSpeed: Direction and force of gravity. \param slidingSpeed: DOCUMENTATION NEEDED.
//! \return Returns the new position of the ellipsoid. \param gravityDirectionAndSpeed: Direction and force of gravity.
\return New position of the ellipsoid. */
virtual core::vector3df getCollisionResultPosition( virtual core::vector3df getCollisionResultPosition(
ITriangleSelector* selector, ITriangleSelector* selector,
const core::vector3df &ellipsoidPosition, const core::vector3df &ellipsoidPosition,
const core::vector3df& ellipsoidRadius, const core::vector3df& ellipsoidRadius,
const core::vector3df& ellipsoidDirectionAndSpeed, const core::vector3df& ellipsoidDirectionAndSpeed,
core::triangle3df& triout, core::triangle3df& triout,
bool& outFalling, bool& outFalling,
f32 slidingSpeed = 0.0005f, f32 slidingSpeed = 0.0005f,
const core::vector3df& gravityDirectionAndSpeed const core::vector3df& gravityDirectionAndSpeed
= core::vector3df(0.0f, 0.0f, 0.0f)) = 0; = core::vector3df(0.0f, 0.0f, 0.0f)) = 0;
//! Returns a 3d ray which would go through the 2d screen coodinates. //! Returns a 3d ray which would go through the 2d screen coodinates.
//! \param pos: Screen coordinates in pixels. /** \param pos: Screen coordinates in pixels.
//! \param camera: Camera from which the ray starts. If null, the \param camera: Camera from which the ray starts. If null, the
//! active camera is used. active camera is used.
//! \return Returns a ray starting from the position of the camera \return Ray starting from the position of the camera and ending
//! and ending at a length of the far value of the camera at a position at a length of the far value of the camera at a position which
//! which would be behind the 2d screen coodinates. would be behind the 2d screen coodinates. */
virtual core::line3d<f32> getRayFromScreenCoordinates( virtual core::line3d<f32> getRayFromScreenCoordinates(
core::position2d<s32> pos, ICameraSceneNode* camera = 0) = 0; core::position2d<s32> pos, ICameraSceneNode* camera = 0) = 0;
//! Calculates 2d screen position from a 3d position. //! Calculates 2d screen position from a 3d position.
//! \param pos: 3D position in world space to be transformed into /** \param pos: 3D position in world space to be transformed
//! 2d. into 2d.
//! \param camera: Camera to be used. If null, the currently active \param camera: Camera to be used. If null, the currently active
//! camera is used. camera is used.
//! \return Returns the 2d screen coordinates which a object in the \return 2d screen coordinates which a object in the 3d world
//! 3d world would have if it would be rendered to the screen. If the would have if it would be rendered to the screen. If the 3d
//! 3d position is behind the camera, it is set to (-10000,-10000). In position is behind the camera, it is set to (-10000,-10000). In
//! most cases you can ignore this fact, because if you use this method most cases you can ignore this fact, because if you use this
//! for drawing a decorator over a 3d object, it will be clipped by the method for drawing a decorator over a 3d object, it will be
//! screen borders. clipped by the screen borders. */
virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition( virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition(
core::vector3df pos, ICameraSceneNode* camera=0) = 0; core::vector3df pos, ICameraSceneNode* camera=0) = 0;
//! Returns the scene node, which is currently visible under the overgiven //! Gets the scene node, which is currently visible under the given screencoordinates, viewed from the currently active camera.
//! screencoordinates, viewed from the currently active camera. The collision /** The collision tests are done using a bounding box for each
//! tests are done using a bounding box for each scene node. scene node.
//! \param pos: Position in pixel screen coordinates, under which the returned \param pos: Position in pixel screen coordinates, under which
//! scene node will be. the returned scene node will be.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask \param idBitMask: Only scene nodes with an id with bits set
//! will be tested. If the BitMask is 0, this feature is disabled. like in this mask will be tested. If the BitMask is 0, this
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These feature is disabled.
// are scene nodes with IsDebugObject() = true. \param bNoDebugObjects: Doesn't take debug objects into account
//! \return Returns the visible scene node under screen coordinates with matching when true. These are scene nodes with IsDebugObject() = true.
//! bits in its id. If there is no scene node under this position, 0 is returned. \return Visible scene node under screen coordinates with
matching bits in its id. If there is no scene node under this
position, 0 is returned. */
virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(core::position2d<s32> pos, virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(core::position2d<s32> pos,
s32 idBitMask=0, bool bNoDebugObjects = false) = 0; s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
//! Returns the nearest scene node which collides with a 3d ray and //! Get the nearest scene node which collides with a 3d ray and whose id matches a bitmask.
//! which id matches a bitmask. The collision tests are done using a bounding /** The collision tests are done using a bounding box for each
//! box for each scene node. scene node.
//! \param ray: Line with witch collisions are tested. \param ray: Line with witch collisions are tested.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask \param idBitMask: Only scene nodes with an id with bits set
//! will be tested. If the BitMask is 0, this feature is disabled. like in this mask will be tested. If the BitMask is 0, this
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These feature is disabled.
// are scene nodes with IsDebugObject() = true. \param bNoDebugObjects: Doesn't take debug objects into account
//! \return Returns the scene node nearest to ray.start, which collides with the when true. These are scene nodes with IsDebugObject() = true.
//! ray and matches the idBitMask, if the mask is not null. If no scene \return Scene node nearest to ray.start, which collides with
//! node is found, 0 is returned. the ray and matches the idBitMask, if the mask is not null. If
virtual ISceneNode* getSceneNodeFromRayBB(core::line3d<f32> ray, no scene node is found, 0 is returned. */
virtual ISceneNode* getSceneNodeFromRayBB(core::line3d<f32> ray,
s32 idBitMask=0, bool bNoDebugObjects = false) = 0; s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
//! Returns the scene node, at which the overgiven camera is looking at and //! Get the scene node, which the overgiven camera is looking at and whose id matches the bitmask.
//! which id matches the bitmask. A ray is simply casted from the position /** A ray is simply casted from the position of the camera to
//! of the camera to the view target position, and all scene nodes are tested the view target position, and all scene nodes are tested
//! against this ray. The collision tests are done using a bounding against this ray. The collision tests are done using a bounding
//! box for each scene node. box for each scene node.
//! \param camera: Camera from which the ray is casted. \param camera: Camera from which the ray is casted.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask \param idBitMask: Only scene nodes with an id with bits set
//! will be tested. If the BitMask is 0, this feature is disabled. like in this mask will be tested. If the BitMask is 0, this
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These feature is disabled.
// are scene nodes with IsDebugObject() = true. \param bNoDebugObjects: Doesn't take debug objects into account
//! \return Returns the scene node nearest to the camera, which collides with the when true. These are scene nodes with IsDebugObject() = true.
//! ray and matches the idBitMask, if the mask is not null. If no scene \return Scene node nearest to the camera, which collides with
//! node is found, 0 is returned. the ray and matches the idBitMask, if the mask is not null. If
no scene node is found, 0 is returned. */
virtual ISceneNode* getSceneNodeFromCameraBB(ICameraSceneNode* camera, virtual ISceneNode* getSceneNodeFromCameraBB(ICameraSceneNode* camera,
s32 idBitMask=0, bool bNoDebugObjects = false) = 0; s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
}; };

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More