* 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_LN_S
AC_PROG_RANLIB
# AC_PROG_LIBTOOL
# Checks for libraries.
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([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([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.
AC_PATH_X
@ -65,6 +66,10 @@ AC_CHECK_FUNCS([floor ftime ftruncate getcwd gethostbyaddr gethostbyname gethost
# src/dep/src/irrlicht/libpng])
AC_CONFIG_FILES([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/stuffextract/Makefile
src/tools/stuffextract/StormLib/Makefile

View File

@ -1,32 +1,7 @@
#include <iostream>
#include "CM2MeshFileLoader.h"
#include "SSkinnedMesh.h"
#define _DEBUG
#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
{
@ -207,7 +182,7 @@ for(u32 i=0;i<header.nTexLookup;i++)
{
MeshFile->read(&tempM2TexLookup,sizeof(u16));
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()));
@ -222,7 +197,7 @@ for(u32 i=0;i<header.nTextures;i++)
{
MeshFile->read(&tempM2TexDef,sizeof(TextureDefinition));
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()));
@ -241,10 +216,6 @@ for(u32 i=0;i<header.nTexFlags;i++)
}
DEBUG(logdebug("Read %u Renderflags",M2MRenderFlags.size()));
//std::cout << M2MTextureUnit[0].submeshIndex1 <<","<<M2MTextureUnit[0].submeshIndex1 <<","<<M2MTextureUnit[0].textureIndex<<";\n";
if(!M2MTextureFiles.empty())
M2MTextureFiles.clear();
@ -258,7 +229,6 @@ for(u32 i=0; i<M2MTextureDef.size(); i++)
M2MTextureFiles.push_back(tempTexFileName.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 //
@ -491,7 +461,7 @@ for(u32 i=0; i < currentView.nSub;i++)//
{
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++)
{
MeshBuffer->Vertices_Standard.push_back(M2Vertices[j]);

View File

@ -1,5 +1,5 @@
## 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
noinst_LIBRARIES = libgui.a
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
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
// note: this is very very slow. (i didn't want to write a fast version.
// but hopefully, nobody wants to scale surfaces every frame.

View File

@ -64,6 +64,14 @@ public:
//! 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);
//! 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.
void copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format, u32 pitch=0);

View File

@ -596,6 +596,22 @@ void CSkinnedMesh::setMaterialFlag(video::E_MATERIAL_FLAG flag, bool 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
bool CSkinnedMesh::useAnimationFrom(const ISkinnedMesh *mesh)
@ -837,7 +853,6 @@ void CSkinnedMesh::checkForAnimation()
//! called by loader after populating with mesh and bone data
void CSkinnedMesh::finalize()
{
std::cout<<"Finalize has been called\n";
u32 i;
LastAnimatedFrame=-1;
@ -913,8 +928,8 @@ void CSkinnedMesh::finalize()
//Todo: optimise keys here...
checkForAnimation();
printf("Has Animation %u\n",HasAnimation);
if (HasAnimation)
if (HasAnimation)
{
//--- optimize and check keyframes ---
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
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.
virtual E_ANIMATED_MESH_TYPE getMeshType() const;

View File

@ -418,7 +418,14 @@ void SceneWorld::OnUpdate(s32 timediff)
str += " ## HEAD: ";
str += IRR_TO_O(camera->getHeading());
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 += (int)terrain->getSectorsRendered();
str += L" / ";

View File

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
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
bin_PROGRAMS = pseuwow
pseuwow_SOURCES = Cli.cpp\
@ -18,5 +18,15 @@ pseuwow_SOURCES = Cli.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

View File

@ -1,5 +1,5 @@
## 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
noinst_LIBRARIES = librealm.a
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
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
noinst_LIBRARIES = libworld.a
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
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

View File

@ -8,7 +8,7 @@
<Build>
<Target title="Debug">
<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 type="1" />
<Option compiler="gcc" />
@ -48,6 +48,8 @@
<Add library="Xxf86vm" />
<Add library="/usr/local/ssl/lib/libssl.a" />
<Add library="/usr/local/ssl/lib/libcrypto.a" />
<Add library="../bin/ikpMP3.so" />
<Add library="../bin/libIrrKlang.so" />
</Linker>
<Unit filename="Client/Cli.cpp" />
<Unit filename="Client/Cli.h" />
@ -70,29 +72,55 @@
<Unit filename="Client/DefScriptInterface.cpp" />
<Unit filename="Client/DefScriptInterface.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.h" />
<Unit filename="Client/GUI/CImageLoaderBLP.cpp" />
<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.h" />
<Unit filename="Client/GUI/DrawObjMgr.cpp" />
<Unit filename="Client/GUI/DrawObjMgr.h" />
<Unit filename="Client/GUI/DrawObject.cpp" />
<Unit filename="Client/GUI/DrawObject.h" />
<Unit filename="Client/GUI/GUIEventReceiver.h" />
<Unit filename="Client/GUI/MCamera.h" />
<Unit filename="Client/GUI/MInput.h" />
<Unit filename="Client/GUI/PseuGUI.cpp" />
<Unit filename="Client/GUI/PseuGUI.h" />
<Unit filename="Client/GUI/SImage.cpp" />
<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.h" />
<Unit filename="Client/GUI/SceneCharselection.cpp" />
<Unit filename="Client/GUI/SceneData.h" />
<Unit filename="Client/GUI/SceneGuiStart.cpp" />
<Unit filename="Client/GUI/SceneLogin.cpp" />
<Unit filename="Client/GUI/SceneWorld.cpp" />
<Unit filename="Client/GUI/ShTlTerrainSceneNode.cpp" />
<Unit filename="Client/GUI/ShTlTerrainSceneNode.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/MemoryDataHolder.cpp" />
<Unit filename="Client/MemoryDataHolder.h" />
@ -159,6 +187,8 @@
<Unit filename="shared/Auth/AuthCrypt.h" />
<Unit filename="shared/Auth/BigNumber.cpp" />
<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/Sha1.cpp" />
<Unit filename="shared/Auth/Sha1.h" />
@ -202,6 +232,8 @@
<Unit filename="shared/Network/Utility.h" />
<Unit filename="shared/Network/socket_include.cpp" />
<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/WDTFile.cpp" />
<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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,68 +17,95 @@ namespace scene
class CMeshBuffer : public IMeshBuffer
{
public:
//! constructor
CMeshBuffer() // everything's default constructed
//! Default constructor for empty meshbuffer
CMeshBuffer():ChangedID_Vertex(1),ChangedID_Index(1),MappingHint_Vertex(EHM_NEVER), MappingHint_Index(EHM_NEVER)
{
#ifdef _DEBUG
setDebugName("SMeshBuffer");
#endif
}
//! returns the material of this meshbuffer
//! Get material of this meshbuffer
/** \return Material of this buffer */
virtual const video::SMaterial& getMaterial() const
{
return Material;
}
//! returns the material of this meshbuffer
//! Get material of this meshbuffer
/** \return Material of this buffer */
virtual video::SMaterial& getMaterial()
{
return Material;
}
//! returns pointer to vertices
//! Get pointer to vertices
/** \return Pointer to vertices. */
virtual const void* getVertices() const
{
return Vertices.const_pointer();
}
//! returns pointer to vertices
//! Get pointer to vertices
/** \return Pointer to vertices. */
virtual void* getVertices()
{
return Vertices.pointer();
}
//! returns amount of vertices
//! Get number of vertices
/** \return Number of vertices. */
virtual u32 getVertexCount() const
{
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
{
return Indices.const_pointer();
}
//! returns pointer to Indices
//! Get pointer to indices
/** \return Pointer to indices. */
virtual u16* getIndices()
{
return Indices.pointer();
}
//! returns amount of indices
//! Get number of indices
/** \return Number of indices. */
virtual u32 getIndexCount() const
{
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
{
return BoundingBox;
}
//! Set the axis aligned bounding box
/** \param box New axis aligned bounding box for this buffer. */
//! set user axis aligned bounding 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()
{
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
{
return T().getType();
}
//! returns position of vertex i
virtual const core::vector3df& getPosition(u32 i) const
{
return Vertices[i].Pos;
}
//! append the vertices and indices to the current buffer
//! 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)
{
if (vertices == getVertices())
return;
const u32 vertexCount = getVertexCount();
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)
{
/*
if (this==other)
return;
const u32 vertexCount = getVertexCount();
u32 i;
@ -144,8 +227,56 @@ namespace scene
Indices.push_back(other->getIndices()[i]+vertexCount);
}
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.
video::SMaterial Material;
//! Vertices of this buffer
@ -156,11 +287,15 @@ namespace scene
core::aabbox3d<f32> BoundingBox;
};
//! Standard meshbuffer
typedef CMeshBuffer<video::S3DVertex> SMeshBuffer;
//! Meshbuffer with two texture coords per vertex, e.g. for lightmaps
typedef CMeshBuffer<video::S3DVertex2TCoords> SMeshBufferLightMap;
//! Meshbuffer with vertices having tangents stored, e.g. for normal mapping
typedef CMeshBuffer<video::S3DVertexTangents> SMeshBufferTangents;
} // end namespace scene
} // end namespace irr
#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".
// 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,13 +14,13 @@ namespace scene
enum E_DEBUG_SCENE_TYPE
{
//! No Debug Data ( Default )
EDS_OFF = 0,
EDS_OFF = 0,
//! Show Bounding Boxes of SceneNode
EDS_BBOX = 1,
//! Show Vertex Normals
EDS_NORMALS = 2,
EDS_NORMALS = 2,
//! Shows Skeleton/Tags
EDS_SKELETON = 4,
@ -34,6 +34,9 @@ namespace scene
//! Show Bounding Boxes of all MeshBuffers
EDS_BBOX_BUFFERS = 32,
//! EDS_BBOX | EDS_BBOX_BUFFERS
EDS_BBOX_ALL = EDS_BBOX | EDS_BBOX_BUFFERS,
//! Show all debug infos
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -73,11 +73,20 @@ namespace video
//! Is HLSL supported?
EVDF_HLSL,
//! Are non-square textures supported?
EVDF_TEXTURE_NSQUARE,
//! Are non-power-of-two textures supported?
EVDF_TEXTURE_NPOT,
//! 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

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".
// 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.
enum E_DRIVER_TYPE
{
//! Null device, useful for applications to run the engine without visualisation.
//! The null device is able to load textures, but does not render and display
//! any graphics.
//! 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 any graphics. */
EDT_NULL,
//! The Irrlicht Engine Software renderer, runs on all platforms,
//! with every hardware. It should only be used for 2d graphics,
//! but it can also perform some primitive 3d functions. These 3d drawing
//! functions are quite fast, but very inaccurate, and don't even support
//! clipping in 3D mode.
//! The Irrlicht Engine Software renderer.
/** Runs on all platforms, with every hardware. It should only be used for
2d graphics, but it can also perform some primitive 3d
functions. These 3d drawing functions are quite fast, but
very inaccurate, and don't even support clipping in 3D mode. */
EDT_SOFTWARE,
//! The Burning's Software Renderer, an alternative software renderer for Irrlicht.
//! Basically it can be described as the Irrlicht Software renderer on steroids. It rasterizes
//! 3D geometry perfectly: It is able to perform correct 3d clipping, perspective
//! correct texture mapping, perspective correct color mapping, and renders
//! sub pixel correct, sub texel correct primitives. In addition, it does
//! bilinear texel filtering and supports more materials than the EDT_SOFTWARE driver.
//! This renderer has been written entirely by Thomas Alten, thanks a lot for this huge
//! contribution.
//! The Burning's Software Renderer, an alternative software renderer
/** Basically it can be described as the Irrlicht Software
renderer on steroids. It rasterizes 3D geometry perfectly: It
is able to perform correct 3d clipping, perspective correct
texture mapping, perspective correct color mapping, and renders
sub pixel correct, sub texel correct primitives. In addition,
it does bilinear texel filtering and supports more materials
than the EDT_SOFTWARE driver. This renderer has been written
entirely by Thomas Alten, thanks a lot for this huge
contribution. */
EDT_BURNINGSVIDEO,
//! Direct3D 8 device, only available on Win32 platforms.
//! Performs hardware accelerated rendering of 3D and 2D primitives.
//! Direct3D8 device, only available on Win32 platforms.
/** Performs hardware accelerated rendering of 3D and 2D
primitives. */
EDT_DIRECT3D8,
//! 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,
//! 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
};

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_GUI_ELEMENT_TYPES_H_INCLUDED__
#define __E_GUI_ELEMENT_TYPES_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
namespace gui
@ -59,6 +61,9 @@ enum EGUI_ELEMENT_TYPE
//! A scroll bar (IGUIScrollBar)
EGUIET_SCROLL_BAR,
//! A spin box (IGUISpinBox)
EGUIET_SPIN_BOX,
//! A static text (IGUIStaticText)
EGUIET_STATIC_TEXT,
@ -68,23 +73,22 @@ enum EGUI_ELEMENT_TYPE
//! A tab control
EGUIET_TAB_CONTROL,
//! A Table
EGUIET_TABLE,
//! A tool bar (IGUIToolBar)
EGUIET_TOOL_BAR,
//! A window
EGUIET_WINDOW,
//! A spin box (IGUISpinBox)
EGUIET_SPIN_BOX,
//! Not an element, amount of elements in there
EGUIET_COUNT,
//! Unknown type.
EGUIET_ELEMENT,
//! This enum is never used, it only forces the compiler to
//! compile these enumeration values to 32 bit.
//! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit.
EGUIET_FORCE_32_BIT = 0x7fffffff
};
@ -107,12 +111,13 @@ const c8* const GUIElementTypeNames[] =
"messageBox",
"modalScreen",
"scrollBar",
"spinBox",
"staticText",
"tab",
"tabControl",
"table",
"toolBar",
"window",
"spinBox",
0
};
@ -121,3 +126,6 @@ const c8* const GUIElementTypeNames[] =
#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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -29,34 +29,40 @@ namespace video
EMF_ZBUFFER,
//! 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,
//! Is backfaceculling enabled? Default: true
//! Is backface culling enabled? Default: true
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
EMF_BILINEAR_FILTER,
//! Is trilinear filtering enabled? Default: false
//! If the trilinear filter flag is enabled,
//! the bilinear filtering flag is ignored.
/** If the trilinear filter flag is enabled,
the bilinear filtering flag is ignored. */
EMF_TRILINEAR_FILTER,
//! Is anisotropic filtering? Default: false
//! In Irrlicht you can use anisotropic texture filtering in
//! conjunction with bilinear or trilinear texture filtering
//! to improve rendering results. Primitives will look less
//! blurry with this flag switched on.
/** In Irrlicht you can use anisotropic texture filtering in
conjunction with bilinear or trilinear texture filtering
to improve rendering results. Primitives will look less
blurry with this flag switched on. */
EMF_ANISOTROPIC_FILTER,
//! Is fog enabled? Default: false
EMF_FOG_ENABLE,
//! Normalizes normals.You can enable this if you need
//! to scale a dynamic lighted model. Usually, its normals will get scaled
//! too then and it 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.
//! Normalizes normals. Default: false
/** You can enable this if you need to scale a dynamic lighted
model. Usually, its normals will get scaled too then and it
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,
//! 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".
// 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.
enum E_MATERIAL_TYPE
{
//! Standard solid material. Only first texture is used, which is
//! supposed to be the diffuse material.
//! Standard solid material.
/** Only first texture is used, which is supposed to be the
diffuse material. */
EMT_SOLID = 0,
//! Solid material with 2 texture layers. The second is blended onto the
//! first using the alpha value of the vertex colors.
//! This material is currently not implemented in OpenGL, but it
//! works with DirectX.
//! Solid material with 2 texture layers.
/** The second is blended onto the first using the alpha value
of the vertex colors. This material is currently not implemented in OpenGL.
*/
EMT_SOLID_2_LAYER,
//! Material type with standard lightmap technique:
//! There should be 2 textures: The first texture layer is a diffuse map,
//! the second is a light map. Vertex light is ignored.
//! Material type with standard lightmap technique
/** There should be 2 textures: The first texture layer is a
diffuse map, the second is a light map. Dynamic light is
ignored. */
EMT_LIGHTMAP,
//! Material type with lightmap technique like EMT_LIGHTMAP, but
//! lightmap and diffuse texture are not modulated, but added instead.
//! Material type with lightmap technique like EMT_LIGHTMAP.
/** But lightmap and diffuse texture are added instead of modulated. */
EMT_LIGHTMAP_ADD,
//! Material type with standard lightmap technique:
//! There should be 2 textures: The first texture layer is a diffuse map,
//! the second is a light map. Vertex light is ignored.
//! The texture colors are effectively multiplyied by 2 for brightening.
//! like known in DirectX as D3DTOP_MODULATE2X.
//! Material type with standard lightmap technique
/** There should be 2 textures: The first texture layer is a
diffuse map, the second is a light map. Dynamic light is
ignored. The texture colors are effectively multiplied by 2
for brightening. Like known in DirectX as D3DTOP_MODULATE2X. */
EMT_LIGHTMAP_M2,
//! Material type with standard lightmap technique:
//! There should be 2 textures: The first texture layer is a diffuse map,
//! the second is a light map. Vertex light is ignored.
//! The texture colors are effectively multiplyied by 4 for brightening.
//! like known in DirectX as D3DTOP_MODULATE4X.
//! Material type with standard lightmap technique
/** There should be 2 textures: The first texture layer is a
diffuse map, the second is a light map. Dynamic light is
ignored. The texture colors are effectively multiplyied by 4
for brightening. Like known in DirectX as D3DTOP_MODULATE4X. */
EMT_LIGHTMAP_M4,
//! Like EMT_LIGHTMAP, but also supports dynamic lighting.
@ -55,133 +57,142 @@ namespace video
//! Like EMT_LIGHTMAP_4, but also supports dynamic lighting.
EMT_LIGHTMAP_LIGHTING_M4,
//! Detail mapped material. The first texture is diffuse color map, the
//! second is added to this and usually displayed with a bigger scale value
//! so that it adds more detail. The detail map is added to the diffuse map using
//! ADD_SIGNED, so that it is possible to add and substract color from the diffuse
//! map. For example a value of (127,127,127) will not change the appearance of
//! the diffuse map at all.
//! Often used for terrain rendering.
//! Detail mapped material.
/** The first texture is diffuse color map, the second is added
to this and usually displayed with a bigger scale value so that
it adds more detail. The detail map is added to the diffuse map
using ADD_SIGNED, so that it is possible to add and substract
color from the diffuse map. For example a value of
(127,127,127) will not change the appearance of the diffuse map
at all. Often used for terrain rendering. */
EMT_DETAIL_MAP,
//! Makes the material look like it was reflection the environment
//! around it. To make this possible, a texture called 'sphere map'
//! is used, which must be set as Textures[0].
//! Look like a reflection of the environment around it.
/** To make this possible, a texture called 'sphere map' is
used, which must be set as the first texture. */
EMT_SPHERE_MAP,
//! A reflecting material with an
//! optional additional non reflecting texture layer. The reflection
//! map should be set as Texture 1.
//! A reflecting material with an optional non reflecting texture layer.
/** The reflection map should be set as first texture. */
EMT_REFLECTION_2_LAYER,
//! A transparent material. Only the first texture is used.
//! The new color is calculated by simply adding the source color and
//! the dest color. This means if for example a billboard using a texture with
//! black background and a red circle on it is drawn with this material, the
//! result is that only the red circle will be drawn a little bit transparent,
//! and everything which was black is 100% transparent and not visible.
//! This material type is useful for e.g. particle effects.
//! A transparent material.
/** Only the first texture is used. The new color is calculated
by simply adding the source color and the dest color. This
means if for example a billboard using a texture with black
background and a red circle on it is drawn with this material,
the result is that only the red circle will be drawn a little
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,
//! Makes the material transparent based on the texture alpha channel.
//! The final color is blended together from the destination color and the
//! texture color, using the alpha channel value as blend factor.
//! Only first texture is used. If you are using this material with small
//! textures, it is a good idea to load the texture in 32 bit
//! mode (video::IVideoDriver::setTextureCreationFlag()).
//! Also, an alpha ref is used, which can be manipulated using SMaterial::MaterialTypeParam.
//! If set to 0, the alpha ref gets its default value which is 0.5f and which means
//! that pixels with an alpha value >127 will be written, others not. In other, simple
//! words: this value controls how sharp the edges become when going from a
//! transparent to a solid spot on the texture.
/** The final color is blended together from the destination
color and the texture color, using the alpha channel value as
blend factor. Only first texture is used. If you are using
this material with small textures, it is a good idea to load
the texture in 32 bit mode
(video::IVideoDriver::setTextureCreationFlag()). Also, an alpha
ref is used, which can be manipulated using
SMaterial::MaterialTypeParam. This value controls how sharp the
edges become when going from a transparent to a solid spot on
the texture. */
EMT_TRANSPARENT_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
//! target, otherwise not. This material does not use alpha blending
//! and is a lot faster than EMT_TRANSPARENT_ALPHA_CHANNEL. It
//! is ideal for drawing stuff like leafes of plants, because the borders
//! are not blurry but sharp.
//! Only first texture is used. If you are using this material with small
//! textures and 3d object, it is a good idea to load the texture in 32 bit
//! mode (video::IVideoDriver::setTextureCreationFlag()).
/** If the alpha channel value is greater than 127, a
pixel is written to the target, otherwise not. This
material does not use alpha blending and is a lot faster
than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing
stuff like leafes of plants, because the borders are not
blurry but sharp. Only first texture is used. If you are
using this material with small textures and 3d object, it
is a good idea to load the texture in 32 bit mode
(video::IVideoDriver::setTextureCreationFlag()). */
EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
//! Makes the material transparent based on the vertex alpha value.
EMT_TRANSPARENT_VERTEX_ALPHA,
//! A transparent reflecting material with an
//! optional additional non reflecting texture layer. The reflection
//! map should be set as Texture 1. The transparency depends on the
//! alpha value in the vertex colors. A texture which will not reflect
//! can be set als Texture 2.
//! Please note that this material type is currently not 100% implemented
//! in OpenGL. It works in Direct3D.
//! A transparent reflecting material with an optional additional non reflecting texture layer.
/** The reflection map should be set as first texture. The
transparency depends on the alpha value in the vertex colors. A
texture which will not reflect can be set as second texture.
Please note that this material type is currently not 100%
implemented in OpenGL. */
EMT_TRANSPARENT_REFLECTION_2_LAYER,
//! A solid normal map renderer. First texture is the color map, the
//! second should be the normal map. Note that you should use this material
//! only when drawing geometry consisting of vertices of type S3DVertexTangents
//! (EVT_TANGENTS). You can convert any mesh into this format using
//! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial).
//! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and
//! falls back on a 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. Currently, this shader is only implemented for the D3D8 and D3D9 renderers.
//! A solid normal map renderer.
/** First texture is the color map, the second should be the
normal map. Note that you should use this material only when
drawing geometry consisting of vertices of type
S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
this format using IMeshManipulator::createMeshWithTangents()
(See SpecialFX2 Tutorial). This shader runs on vertex shader
1.1 and pixel shader 1.1 capable hardware and falls back to a
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,
//! A transparent normal map renderer. First texture is the color map, the
//! second should be the normal map. Note that you should use this material
//! only when drawing geometry consisting of vertices of type S3DVertexTangents
//! (EVT_TANGENTS). You can convert any mesh into this format using
//! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial).
//! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and
//! falls back on a 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. Currently, this shader is only implemented for the D3D8 and D3D9 renderers.
//! A transparent normal map renderer.
/** First texture is the color map, the second should be the
normal map. Note that you should use this material only when
drawing geometry consisting of vertices of type
S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
this format using IMeshManipulator::createMeshWithTangents()
(See SpecialFX2 Tutorial). This shader runs on vertex shader
1.1 and pixel shader 1.1 capable hardware and falls back to a
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,
//! A transparent (based on the vertex alpha value) normal map renderer.
//! First texture is the color map, the
//! second should be the normal map. Note that you should use this material
//! only when drawing geometry consisting of vertices of type S3DVertexTangents
//! (EVT_TANGENTS). You can convert any mesh into this format using
//! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial).
//! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and
//! falls back on a 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. Currently, this shader is only implemented for the D3D8 and D3D9 renderers.
/** First texture is the color map, the second should be the
normal map. Note that you should use this material only when
drawing geometry consisting of vertices of type
S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
this format using IMeshManipulator::createMeshWithTangents()
(See SpecialFX2 Tutorial). This shader runs on vertex shader
1.1 and pixel shader 1.1 capable hardware and falls back to a
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_VERTEX_ALPHA,
//! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping too, which
//! looks a lot more realistic. This only works when the hardware supports at
//! least vertex shader 1.1 and pixel shader 1.4.
//! First texture is the color map, the second should be the normal map.
//! The normal map texture should contain the height value in the
//! alpha component. The IVideoDriver::makeNormalMapTexture() method writes
//! this value automaticly when creating normal maps from a heightmap when using a 32 bit
//! texture.
//! The height scale of the material (affecting the bumpiness) is being controlled
//! by the SMaterial::MaterialTypeParam member.
//! If set to zero, the default value (0.02f) will be applied. Otherwise
//! the value set in SMaterial::MaterialTypeParam is taken. This value depends on with which
//! scale the texture is mapped on the material. Too high or low values of MaterialTypeParam
//! can result in strange artifacts.
//! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping.
/** Looks a lot more realistic. This only works when the
hardware supports at least vertex shader 1.1 and pixel shader
1.4. First texture is the color map, the second should be the
normal map. The normal map texture should contain the height
value in the alpha component. The
IVideoDriver::makeNormalMapTexture() method writes this value
automatically when creating normal maps from a heightmap when
using a 32 bit texture. The height scale of the material
(affecting the bumpiness) is being controlled by the
SMaterial::MaterialTypeParam member. If set to zero, the
default value (0.02f) will be applied. Otherwise the value set
in SMaterial::MaterialTypeParam is taken. This value depends on
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,
//! A material just like EMT_PARALLAX_MAP_SOLID, but it is transparent, using
//! EMT_TRANSPARENT_ADD_COLOR as base material.
//! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
/** Using EMT_TRANSPARENT_ADD_COLOR as base material. */
EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR,
//! A material just like EMT_PARALLAX_MAP_SOLID, but it is transparent, using
//! EMT_TRANSPARENT_VERTEX_ALPHA as base material.
//! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
/** Using EMT_TRANSPARENT_VERTEX_ALPHA as base material. */
EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA,
//! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
//! Using only Textures[0]. generic Blender
/** Using only first texture. Generic blending method. */
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
};

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_MESH_WRITER_ENUMS_H_INCLUDED__
#define __E_MESH_WRITER_ENUMS_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
namespace scene
@ -23,7 +25,10 @@ namespace scene
EMWT_COLLADA = MAKE_IRR_ID('c','o','l','l'),
//! 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -33,3 +33,4 @@ enum EMESSAGE_BOX_FLAG
} // namespace irr
#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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -34,14 +34,19 @@ namespace scene
//! Collision respose scene node animator
ESNAT_COLLISION_RESPONSE,
//! FPS camera animator
ESNAT_CAMERA_FPS,
//! Maya camera animator
ESNAT_CAMERA_MAYA,
//! Amount of built-in scene node animators
ESNAT_COUNT,
//! Unknown scene node animator
ESNAT_UNKNOWN,
//! This enum is never used, it only forces the compiler to
//! compile these enumeration values to 32 bit.
//! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit.
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -57,12 +57,6 @@ namespace scene
//! Camera Scene Node
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
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'),
//! 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
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".
// 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -12,7 +12,7 @@ namespace irr
{
namespace scene
{
//! Possible types of (animated) meshes.
enum E_ANIMATED_MESH_TYPE
{
//! Unknown animated mesh type.
@ -36,16 +36,15 @@ namespace scene
//! My3D Mesh, the file format by Zhuck Dimitry
EAMT_MY3D,
//! Pulsar LMTools .lmts file. This Irrlicht loader was
//! written by Jonas Petersen
//! Pulsar LMTools .lmts file. This Irrlicht loader was written by Jonas Petersen
EAMT_LMTS,
//! Cartography Shop .csm file. This loader was created by Saurav Mohapatra.
EAMT_CSM,
//! .oct file for Paul Nette's FSRad or from Murphy McCauley's
//! Blender .oct exporter. The oct file format contains 3D
//! geometry and lightmaps and can be loaded directly by Irrlicht
//! .oct file for Paul Nette's FSRad or from Murphy McCauley's Blender .oct exporter.
/** The oct file format contains 3D geometry and lightmaps and
can be loaded directly by Irrlicht */
EAMT_OCT,
//! generic skinned mesh
@ -61,9 +60,6 @@ namespace scene
{
public:
//! destructor
virtual ~IAnimatedMesh() { }
//! Gets the frame count of the animated mesh.
/** \return Returns the amount of frames. If the amount is 1,
it is a static, non animated mesh. */
@ -81,7 +77,7 @@ namespace scene
outside of this loop.
If startFrameLoop and endFrameLoop are both -1, they are ignored.
\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;
//! 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -46,29 +46,29 @@ namespace scene
{
public:
// Get frame loop data for a default MD2 animation type.
//! \param l: The EMD2_ANIMATION_TYPE to get the frames for.
//! \param outBegin: The returned beginning frame for 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.
//! \return Returns the beginframe, endframe and frames per second 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 outBegin The returned beginning frame for 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.
\return beginframe, endframe and frames per second for a default MD2 animation type. */
virtual void getFrameLoop(EMD2_ANIMATION_TYPE l, s32& outBegin,
s32& outEnd, s32& outFPS) const = 0;
// Get frame loop data for a special MD2 animation type, identified by name.
//! \param name: Name of the animation.
//! \param outBegin: The returned beginning frame for 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.
//! \return Returns the beginframe, endframe and frames per second for a special MD2 animation type.
//! Get frame loop data for a special MD2 animation type, identified by name.
/** \param name Name of the animation.
\param outBegin The returned beginning frame for 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.
\return beginframe, endframe and frames per second for a special MD2 animation type. */
virtual bool getFrameLoop(const c8* name,
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;
//! Returns name of md2 animation.
//! \param nr: Zero based index of animation.
//! Get name of md2 animation.
/** \param nr: Zero based index of animation. */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -23,8 +23,7 @@ namespace scene
EMD3_NUMMODELS
};
// Animation list
//! Animation list
enum EMD3_ANIMATION_TYPE
{
// Animations for both lower and upper parts of the player
@ -64,15 +63,19 @@ namespace scene
struct SMD3AnimationInfo
{
s32 first; // First frame
s32 num; // Last frame
s32 looping; // Looping frames
s32 fps; // Frames per second
//! First frame
s32 first;
//! Last frame
s32 num;
//! Looping frames
s32 looping;
//! Frames per second
s32 fps;
};
// 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( 1 )
# define PACK_STRUCT
@ -82,36 +85,37 @@ namespace scene
# error compiler not supported
#endif
// this holds the header info of the MD3 file
//! this holds the header info of the MD3 file
struct SMD3Header
{
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
s32 numFrames; //number of KeyFrames
s32 numTags; //number of 'tags' per frame
s32 numMeshes; //number of meshes/skins
s32 numFrames; //number of KeyFrames
s32 numTags; //number of 'tags' per frame
s32 numMeshes; //number of meshes/skins
s32 numMaxSkins; //maximum number of unique skins used in md3 file
s32 headerSize; //always equal to the length of this header
s32 tagStart; //starting position of tag-structures
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
s32 headerSize; //always equal to the length of this header
s32 tagStart; //starting position of tag-structures
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
s32 fileSize;
};
//! this holds the header info of an MD3 mesh section
struct SMD3MeshHeader
{
c8 meshID[4]; //id, must be IDP3
c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars
c8 meshID[4]; //id, must be IDP3
c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars
s32 numFrames; //number of meshframes in mesh
s32 numShader; //number of skins in mesh
s32 numVertices; //number of vertices
s32 numTriangles; //number of Triangles
s32 numFrames; //number of meshframes in mesh
s32 numShader; //number of skins in mesh
s32 numVertices; //number of vertices
s32 numTriangles; //number of Triangles
s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header
s32 offset_shaders; //size of 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 offset_shaders; //size of 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 offset_end;
};
@ -123,7 +127,7 @@ namespace scene
u8 normal[2];
};
//! Texure Coordinate
//! Texture Coordinate
struct SMD3TexCoord
{
f32 u;
@ -138,7 +142,7 @@ namespace scene
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
@ -156,7 +160,7 @@ namespace scene
};
//! 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
{
SMD3QuaterionTag() {}
@ -165,12 +169,12 @@ namespace scene
: Name ( name ) {}
// construct from a matrix
SMD3QuaterionTag ( const core::stringc& name, const core::matrix4 &m )
{
Name = name;
position = m.getTranslation ();
rotation = m;
}
SMD3QuaterionTag ( const core::stringc& name, const core::matrix4 &m ) : Name(name), position(m.getTranslation()), rotation(m)
{ }
// construct from a position and euler angles in degrees
SMD3QuaterionTag ( const core::vector3df &pos, const core::vector3df &angle ) : position(pos), rotation(angle * core::DEGTORAD)
{ }
// set to matrix
void setto ( core::matrix4 &m )
@ -179,13 +183,6 @@ namespace scene
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
{
return Name == other.Name;
@ -196,7 +193,7 @@ namespace scene
core::quaternion rotation;
};
// holds a assoziative list of named quaternions
//! holds a associative list of named quaternions
struct SMD3QuaterionTagList : public virtual IReferenceCounted
{
SMD3QuaterionTag* get ( const core::stringc& name )
@ -213,11 +210,22 @@ namespace scene
return Container.size();
}
SMD3QuaterionTag& operator[] (u32 index )
const SMD3QuaterionTag& operator[](u32 index) const
{
return Container[index];
}
SMD3QuaterionTag& operator[](u32 index)
{
return Container[index];
}
SMD3QuaterionTagList & operator = (const SMD3QuaterionTagList & copyMe)
{
Container = copyMe.Container;
return *this;
}
core::array < SMD3QuaterionTag > Container;
};
@ -229,7 +237,7 @@ namespace scene
{
for (u32 i=0; i<Buffer.size(); ++i)
Buffer[i]->drop();
};
}
SMD3Header MD3Header;
core::stringc Name;
@ -243,11 +251,13 @@ namespace scene
{
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;
//! get the tag list of the mesh.
virtual SMD3QuaterionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) = 0;
//! get the original md3 mesh.
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -9,23 +9,22 @@
#include "IBoneSceneNode.h"
#include "IAnimatedMeshMD2.h"
#include "IAnimatedMeshMD3.h"
#include "IShadowVolumeSceneNode.h"
namespace irr
{
namespace scene
{
class IShadowVolumeSceneNode;
enum E_JOINT_UPDATE_ON_RENDER
{
// do nothing
//! do nothing
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,
// 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,
//! count of all available interpolation modes
@ -33,28 +32,27 @@ namespace scene
};
class IAnimatedMeshSceneNode;
//! Callback interface for catching events of ended animations.
/** Implement this interface and use
IAnimatedMeshSceneNode::setAnimationEndCallback to be able to
be notified if an animation playback has ended.
IAnimatedMeshSceneNode::setAnimationEndCallback to be able to
be notified if an animation playback has ended.
**/
class IAnimationEndCallBack : public virtual IReferenceCounted
{
public:
//! Will be called when the animation playback has ended.
//! See IAnimatedMeshSceneNode::setAnimationEndCallback for
//! more informations.
//! \param node: Node of which the animation has ended.
/** See IAnimatedMeshSceneNode::setAnimationEndCallback for
more informations.
\param node: Node of which the animation has ended. */
virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node) = 0;
};
//! 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 IAnimatedMeshSceneNode::createShadowVolumeSceneNode().*/
/** The shadow is optional: If a shadow should be displayed too, just
invoke the IAnimatedMeshSceneNode::createShadowVolumeSceneNode().*/
class IAnimatedMeshSceneNode : public ISceneNode
{
public:
@ -70,88 +68,96 @@ namespace scene
virtual ~IAnimatedMeshSceneNode() {}
//! Sets the current frame number.
//! From now on the animation is played from this frame.
//! \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
//! scene node. Set IAnimatedMesh::getMesh() for details.
/** From now on the animation is played from this frame.
\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
scene node. Set IAnimatedMesh::getMesh() for details. */
virtual void setCurrentFrame(f32 frame) = 0;
//! Sets the frame numbers between the animation is looped.
//! The default is 0 - MaximalFrameCount of the mesh.
//! \param begin: Start frame number of the loop.
//! \param end: End frame number of the loop.
//! \return Returns true if successful, false if not.
/** The default is 0 - MaximalFrameCount of the mesh.
\param begin: Start frame number of the loop.
\param end: End frame number of the loop.
\return True if successful, false if not. */
virtual bool setFrameLoop(s32 begin, s32 end) = 0;
//! 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;
//! Creates shadow volume scene node as child of this node
//! and returns a pointer to it. The shadow can be rendered using the ZPass
//! or the zfail method. ZPass is a little bit faster because the shadow volume
//! creation is easier, but with this method there occur ugly looking artifacs
//! when the camera is inside the shadow volume. These error do not occur
//! with the ZFail method.
//! \param id: Id of the shadow scene node. This id can be used to identify
//! the node later.
//! \param zfailmethod: If set to true, the shadow will use the zfail method,
//! if not, zpass is used.
//! \param infinity: Value used by the shadow volume algorithm to scale the
//! shadow volume.
//! \return Returns pointer to the created shadow scene node.
//! This pointer should not be dropped. See IReferenceCounted::drop() for more information.
virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(s32 id=-1,
bool zfailmethod=true, f32 infinity=10000.0f) = 0;
//! Creates shadow volume scene node as child of this node.
/** The shadow can be rendered using the ZPass or the zfail
method. ZPass is a little bit faster because the shadow volume
creation is easier, but with this method there occur ugly
looking artifacs when the camera is inside the shadow volume.
These error do not occur with the ZFail method.
\param shadowMesh: Optional custom mesh for shadow volume.
\param id: Id of the shadow scene node. This id can be used to
identify the node later.
\param zfailmethod: If set to true, the shadow will use the
zfail method, if not, zpass is used.
\param infinity: Value used by the shadow volume algorithm to
scale the shadow volume.
\return Pointer to the created shadow scene node. This pointer
should not be dropped. See IReferenceCounted::drop() for more
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)
//! With this method it is possible to attach scene nodes to joints
//! for example possible to attach a weapon to the left hand of an
//! animated model. This example shows how:
//! \code
//! ISceneNode* hand =
//! yourAnimatedMeshSceneNode->getJointNode("LeftHand");
//! hand->addChild(weaponSceneNode);
//! \endcode
//! 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.
//! \param jointName: Name of the joint.
//! \return Returns a pointer to the scene node which represents the joint
//! with the specified name. Returns 0 if the contained mesh is not an
//! skinned mesh or the name of the joint could not be found.
//! 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 for example possible to attach a weapon to the left hand
of an animated model. This example shows how:
\code
ISceneNode* hand =
yourAnimatedMeshSceneNode->getJointNode("LeftHand");
hand->addChild(weaponSceneNode);
\endcode
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.
\param jointName: Name of 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 skinned mesh or the name of the joint could not be found. */
virtual IBoneSceneNode* getJointNode(const c8* jointName)=0;
//! same as getJointNode(const c8* jointName), but based on id
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;
//! Redundant command, please use getJointNode (only for backwards compatibility)
//! Deprecated command, please use getJointNode
virtual ISceneNode* getXJointNode(const c8* jointName) = 0;
//! Starts a default MD2 animation.
//! With this method it is easily possible to start a Run, Attack,
//! Die or whatever animation, if the mesh contained in this scene
//! node is an md2 mesh. Otherwise, nothing happens.
//! \param anim: An MD2 animation type, which should be played, for
//! example EMAT_STAND for the standing animation.
//! \return Returns true if successful, and false if not, for example
//! if the mesh in the scene node is not a md2 mesh.
/** With this method it is easily possible to start a Run,
Attack, Die or whatever animation, if the mesh contained in
this scene node is an md2 mesh. Otherwise, nothing happens.
\param anim: An MD2 animation type, which should be played, for
example EMAT_STAND for the standing animation.
\return True if successful, and false if not, for example if
the mesh in the scene node is not a md2 mesh. */
virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim) = 0;
//! Starts a special MD2 animation.
//! With this method it is easily possible to start a Run, Attack,
//! Die or whatever animation, if the mesh contained in this scene
//! node is an md2 mesh. Otherwise, nothing happens. This method uses
//! a character string to identify the animation. If the animation is a
//! standard md2 animation, you might want to start this animation
//! with the EMD2_ANIMATION_TYPE enumeration instead.
//! \param animationName: Name of the animation which should be played.
//! \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.
/** With this method it is easily possible to start a Run,
Attack, Die or whatever animation, if the mesh contained in
this scene node is an md2 mesh. Otherwise, nothing happens.
This method uses a character string to identify the animation.
If the animation is a standard md2 animation, you might want to
start this animation with the EMD2_ANIMATION_TYPE enumeration
instead.
\param animationName: Name of the animation which should be
played.
\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;
//! Returns the current displayed frame number.
@ -161,19 +167,20 @@ namespace scene
//! Returns the current end frame number.
virtual s32 getEndFrame() const = 0;
//! Sets looping mode which is on by default. If set to false,
//! animations will not be played looped.
//! Sets looping mode which is on by default.
/** If set to false, animations will not be played looped. */
virtual void setLoopMode(bool playAnimationLooped) = 0;
//! Sets a callback interface which will be called if an animation
//! playback has ended. Set this to 0 to disable the callback again.
//! Please note that this will only be called when in non looped mode,
//! see IAnimatedMeshSceneNode::setLoopMode().
//! Sets a callback interface which will be called if an animation playback has ended.
/** Set this to 0 to disable the callback again.
Please note that this will only be called when in non looped
mode, see IAnimatedMeshSceneNode::setLoopMode(). */
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.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
referencing this mesh to change too. */
/* In this way it is possible to change the materials a mesh
causing all mesh scene nodes referencing this mesh to change
too. */
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
@ -185,25 +192,32 @@ namespace scene
//! Returns the current mesh
virtual IAnimatedMesh* getMesh(void) = 0;
//! returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh,
//! or the absolutetransformation if it's a normal scenenode
//! 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
virtual const SMD3QuaterionTag& getMD3TagTransformation( const core::stringc & tagname) = 0;
//! 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;
//! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2)
//! you must call animateJoints(), or the mesh will not ani\mate
//! Sets the transition time in seconds
/** 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;
//! 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;
//! 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;
//! 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

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -16,7 +16,7 @@ namespace io
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
{
//! Serialization/Deserializion is done for an xml file
@ -33,7 +33,7 @@ enum E_ATTRIBUTE_READ_WRITE_FLAGS
//! struct holding data describing options
struct SAttributeReadWriteOptions
{
//! constructor
//! Constructor
SAttributeReadWriteOptions()
: Flags(0), Filename(0)
{
@ -42,24 +42,24 @@ struct SAttributeReadWriteOptions
//! Combination of E_ATTRIBUTE_READ_WRITE_FLAGS or other, custom ones
s32 Flags;
//! optional filename
//! Optional filename
const c8* Filename;
};
//! 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:
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
/** Implement this to expose the attributes of your scene node animator for
scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
/** Implement this to set the attributes of your scene node animator for
scripting languages, editors, debuggers or xml deserialization purposes. */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -154,9 +154,10 @@ public:
virtual void clear() = 0;
//! 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.
//! \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.
virtual bool read(io::IXMLReader* reader, bool readCurrentElementOnly=false, const wchar_t* elementName=0) = 0;
@ -236,16 +237,17 @@ public:
virtual core::stringc getAttributeAsString(const c8* attributeName) = 0;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \param target: Buffer where the string is copied to.
//! \param attributeName Name of the attribute to get.
//! \param target Buffer where the string is copied to.
virtual void getAttributeAsString(const c8* attributeName, c8* target) = 0;
//! 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;
//! 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;
// wide strings
@ -274,7 +276,8 @@ public:
virtual core::stringw getAttributeAsStringW(s32 index) = 0;
//! 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;
/*
@ -290,11 +293,17 @@ public:
virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0;
//! 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;
//! 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;
//! Sets an attribute as binary data
@ -302,9 +311,7 @@ public:
/*
Array Attribute
*/
//! Adds an attribute as wide string array
@ -374,15 +381,23 @@ public:
virtual const c8* getAttributeAsEnumeration(const c8* attributeName) = 0;
//! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get.
//! \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()
/** \param attributeName: Name of the attribute to get.
\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(const c8* attributeName, const c8* const* enumerationLiteralsToUse) = 0;
//! 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;
//! Gets an attribute as enumeration
@ -390,11 +405,13 @@ public:
virtual const c8* getAttributeAsEnumeration(s32 index) = 0;
//! 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;
//! Gets the list of enumeration literals of an enumeration attribute
//! \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;
//! Sets an attribute as enumeration
@ -525,9 +542,7 @@ public:
/*
matrix attribute
*/
//! Adds an attribute as matrix

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,7 +21,7 @@ class IBillboardSceneNode : public ISceneNode
{
public:
//! constructor
//! Constructor
IBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0))
: ISceneNode(parent, mgr, id, position) {}
@ -33,19 +33,18 @@ public:
virtual const core::dimension2d<f32>& getSize() const = 0;
//! 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;
//! Set the color of the top and bottom vertices of the billboard
//! \param topColor: the color to set the top vertices
//! \param bottomColor: the color to set the bottom vertices
/** \param topColor: the color to set the top vertices
\param bottomColor: the color to set the bottom vertices */
virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor) = 0;
//! Gets the color of the top and bottom vertices of the billboard
//! \param topColor: stores the color of the top vertices
//! \param bottomColor: stores the color of the bottom vertices
/** \param topColor: stores the color of the top vertices
\param bottomColor: stores the color of the bottom vertices */
virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0;
};
} // 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__
#define __I_BONE_SCENE_NODE_H_INCLUDED__
// Used with ISkinnedMesh and IAnimatedMeshSceneNode, for boned meshes
#include "ISceneNode.h"
namespace irr
@ -16,8 +18,7 @@ namespace scene
//! The bone is usually animated, unless it's parent is not animated
EBAM_AUTOMATIC=0,
//! The bone is animated by the skin, if it's parent is not animated
//! then animation will resume from this bone onward
//! The bone is animated by the skin, if it's parent is not animated then animation will resume from this bone onward
EBAM_ANIMATED,
//! 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
{
public:
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
virtual const c8* getBoneName() const = 0;
//! Get the name of the bone
/** \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;
//! 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;
//! Gets the current animation mode of the bone
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;
//! Returns the relative transformation of the scene node.
//virtual core::matrix4 getRelativeTransformation() const = 0;
//! The animation method.
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() { }
//! How the relative transformation of the bone is used
virtual void setSkinningSpace( E_BONE_SKINNING_SPACE space ) =0;
//! 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;
s32 positionHint;
s32 scaleHint;
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -15,10 +15,10 @@ namespace scene
struct SViewFrustum;
//! Scene Node which is a (controlable) camera.
/** The whole scene will be
rendered from the cameras point of view. Because the ICameraScenNode
is a SceneNode, it can be attached to any other scene node, and will
follow its parents movement, rotation and so on.
/** The whole scene will be rendered from the cameras point of view.
Because the ICameraScenNode is a SceneNode, it can be attached to any
other scene node, and will follow its parents movement, rotation and so
on.
*/
class ICameraSceneNode : public ISceneNode, public IEventReceiver
{
@ -31,63 +31,77 @@ namespace scene
const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f))
: ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {}
//! Destructor
virtual ~ICameraSceneNode() {}
//! Sets the projection matrix of the camera.
/** The core::matrix4 class has some methods
to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH.
Note that the matrix will only stay as set by this method until one of
the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV.
\param projection: The new projection matrix of the camera. */
virtual void setProjectionMatrix(const core::matrix4& projection) = 0;
/** The core::matrix4 class has some methods to build a
projection matrix. e.g:
core::matrix4::buildProjectionMatrixPerspectiveFovLH.
Note that the matrix will only stay as set by this method until
one of the following Methods are called: setNearValue,
setFarValue, setAspectRatio, setFOV.
\param projection The new projection matrix of the camera.
\param isOrthogonal Set this to true if the matrix is an
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.
/** \return Returns the current projection matrix of the camera. */
/** \return The current projection matrix of the camera. */
virtual const core::matrix4& getProjectionMatrix() const = 0;
//! 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;
//! It is possible to send mouse and key events to the camera.
/** Most cameras
may ignore this input, but camera scene nodes which are created for
example with ISceneManager::addMayaCameraSceneNode or
ISceneManager::addMeshViewerCameraSceneNode, may want to get this input
for changing their position, look at target or whatever. */
/** Most cameras may ignore this input, but camera scene nodes
which are created for example with
ISceneManager::addCameraSceneNodeMaya or
ISceneManager::addCameraSceneNodeFPS, may want to get
this input for changing their position, look at target or
whatever. */
virtual bool OnEvent(const SEvent& event) = 0;
//! 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;
//! 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
/** \return Returns the current look at target of the camera */
virtual core::vector3df getTarget() const = 0;
/** \return The current look at target of the camera, in world co-ordinates */
virtual const core::vector3df& getTarget() const = 0;
//! Sets the up vector of the camera.
/** \param pos: New upvector of the camera. */
virtual void setUpVector(const core::vector3df& pos) = 0;
//! Gets the up vector of the camera.
/** \return Returns the up vector of the camera. */
virtual core::vector3df getUpVector() const = 0;
/** \return The up vector of the camera, in world space. */
virtual const core::vector3df& getUpVector() const = 0;
//! 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;
//! 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;
//! 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;
//! 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;
//! 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. */
virtual void setFOV(f32 fovy) = 0;
//! Returns the view frustum.
//! Get the view frustum.
/** 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;
//! Disables or enables the camera to get key or mouse inputs.
/** If this is set to true, the camera will respond to key inputs
otherwise not. */
/** If this is set to true, the camera will respond to key
inputs otherwise not. */
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;
//! Returns if a camera 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. */
//! Checks if a camera is orthogonal.
virtual bool isOrthogonal() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
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;
}
//! 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;
private:
//! 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;
};

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -25,22 +25,24 @@ namespace gui
virtual void setVisible(bool visible) = 0;
//! 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;
/** Sets the new position of the cursor. The position must be
//! Sets the new position of the cursor.
/** 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
render window. */
//! \param pos: New position of the cursor.
render window.
\param pos New position of the cursor. */
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.
/** 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
render window. */
//! \param x: New x-coord of the cursor.
//! \param y: New x-coord of the cursor.
render window.
\param x New x-coord of the cursor.
\param y New x-coord of the cursor. */
virtual void setPosition(f32 x, f32 y) = 0;
//! Sets the new position of the cursor.
@ -48,8 +50,8 @@ namespace gui
virtual void setPosition(const core::position2d<s32> &pos) = 0;
//! Sets the new position of the cursor.
/** \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 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. */
virtual void setPosition(s32 x, s32 y) = 0;
//! Returns the current position of the mouse cursor.
@ -59,9 +61,9 @@ namespace gui
//! Returns the current position of the mouse cursor.
/** \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
the top left corner and (1.0f, 1.0f) is the bottom right corner of the
render window. */
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
render window. */
virtual core::position2d<f32> getRelativePosition() = 0;
//! Sets an absolute reference rect for setting and retrieving the cursor position.

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -24,13 +24,13 @@ class IDummyTransformationSceneNode : public ISceneNode
{
public:
//! constructor
//! Constructor
IDummyTransformationSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
: ISceneNode(parent, mgr, id) {}
//! Returns a reference to the current relative transformation matrix.
//! This is the matrix, this scene node uses instead of scale, translation
//! and rotation.
/** This is the matrix, this scene node uses instead of scale, translation
and rotation. */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -8,6 +8,7 @@
#include "ILogger.h"
#include "position2d.h"
#include "Keycodes.h"
#include "irrString.h"
namespace irr
{
@ -24,24 +25,50 @@ namespace irr
//! A mouse input event.
/** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser
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
many GUI elements), then finally the input receiving scene manager (and possibly the active
camera) */
Mouse events are first passed to the user receiver, then to the GUI environment and its elements,
then finally the input receiving scene manager where it is passed to the active camera.
*/
EET_MOUSE_INPUT_EVENT,
//! A key input evant.
/** Keyboard events are also created by the device and passed to IrrlichtDevice::postEventFromUser.
They take the same path as mouse events. */
//! A key input event.
/** Like mouse events, keyboard events are created by the device and passed to
IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
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
/** 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. */
EET_LOG_TEXT_EVENT,
//! A user event with user data. This is not used by Irrlicht and can be used
//! to send user specific data though the system.
EET_USER_EVENT
//! A user event with user data.
/** This is not used by Irrlicht and can be used to send user
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
@ -85,12 +112,12 @@ namespace irr
enum EGUI_EVENT_TYPE
{
//! A gui element has lost its focus.
//! GUIEvent.Caller is losing the focus to GUIEvent.Element.
//! If the event is absorbed then the focus will not be changed.
/** GUIEvent.Caller is losing the focus to GUIEvent.Element.
If the event is absorbed then the focus will not be changed. */
EGET_ELEMENT_FOCUS_LOST = 0,
//! 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,
//! The mouse cursor hovered over a gui element.
@ -100,8 +127,8 @@ namespace irr
EGET_ELEMENT_LEFT,
//! An element 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.
/** Windows and context menus use this event when they would like to close,
this can be cancelled by absorbing the event. */
EGET_ELEMENT_CLOSED,
//! A button was clicked.
@ -150,7 +177,11 @@ namespace irr
EGET_COMBO_BOX_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
@ -159,6 +190,7 @@ namespace irr
//! SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
struct SEvent
{
//! Any kind of GUI event.
struct SGUIEvent
{
//! IGUIElement who called the event
@ -172,6 +204,7 @@ struct SEvent
};
//! Any kind of mouse event.
struct SMouseInput
{
//! X position of mouse cursor
@ -184,10 +217,11 @@ struct SEvent
/** Only valid if event was EMIE_MOUSE_WHEEL */
f32 Wheel;
//! type of mouse event
//! Type of mouse event
EMOUSE_INPUT_EVENT Event;
};
//! Any kind of keyboard event.
struct SKeyInput
{
//! Character corresponding to the key (0, if not a character)
@ -196,25 +230,87 @@ struct SEvent
//! Key which has been pressed or released
EKEY_CODE Key;
//! if not pressed, then the key was left up
//! If not true, then the key was left up
bool PressedDown;
//! true if shift was also pressed
//! True if shift was also pressed
bool Shift;
//! true if ctrl was also pressed
//! True if ctrl was also pressed
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
{
//! pointer to text which has been logged
//! Pointer to text which has been logged
const c8* Text;
//! log level in which the text has been logged
//! Log level in which the text has been logged
ELOG_LEVEL Level;
};
//! Any kind of user event.
struct SUserEvent
{
//! Some user specified data as int
@ -222,9 +318,6 @@ struct SEvent
//! Another user specified data as int
s32 UserData2;
//! Some user specified data as float
f32 UserData3;
};
EEVENT_TYPE EventType;
@ -233,6 +326,7 @@ struct SEvent
struct SGUIEvent GUIEvent;
struct SMouseInput MouseInput;
struct SKeyInput KeyInput;
struct SJoystickEvent JoystickEvent;
struct SLogEvent LogEvent;
struct SUserEvent UserEvent;
};
@ -240,23 +334,61 @@ struct SEvent
};
//! Interface of an object which can receive events.
/** Many of the engine's classes inherit IEventReceiver so they are able to process events.
Events usually start at a postEventFromUser function and are passed down through a chain of
event receivers until OnEvent returns true.
See irr::EEVENT_TYPE for a description of where each type of event starts, and the path it takes
through the system. */
/** Many of the engine's classes inherit IEventReceiver so they are able to
process events. Events usually start at a postEventFromUser function and are
passed down through a chain of event receivers until OnEvent returns true. See
irr::EEVENT_TYPE for a description of where each type of event starts, and the
path it takes through the system. */
class IEventReceiver
{
public:
//! Destructor
virtual ~IEventReceiver() {}
//! called if an event happened.
//! \return Returns true if the event was processed
//! Called if an event happened.
/** \return True if the event was processed. */
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
#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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -16,37 +16,27 @@ namespace io
class IFileList : public virtual IReferenceCounted
{
public:
//! destructor
virtual ~IFileList() {}
//! Returns the amount of files in the filelist.
//! \return
//! Returns the amount of files and directories in the file list.
//! Get the number of files in the filelist.
/** \return Amount of files and directories in the file list. */
virtual u32 getFileCount() const = 0;
//! 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.
//! \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.
//! \return
//! Returns the file name of the file. Returns 0, if an error occured.
/** 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
be returned. The index has to be smaller than the amount getFileCount() returns.
\return File name of the file. Returns 0, if an error occured. */
virtual const c8* getFileName(u32 index) const = 0;
//! 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
//! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return
//! Returns the file name of the file. Returns 0, if an error occured.
/** \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.
\return File name of the file. Returns 0, if an error occured. */
virtual const c8* getFullFileName(u32 index) = 0;
//! Returns of the file is a directory
//! \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.
//! \return
//! Returns true, if the file is a directory, and false, if it is not.
//! If an error occurs, the result is undefined.
//! Check if the file is a directory
/** \param index The zero based index of the file whose name shall
be returned. The index has to be smaller than the amount getFileCount() returns.
\return True if the file is a directory, else false. */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -25,19 +25,13 @@ class IXMLWriter;
class IAttributes;
//! 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 need to know where every file is located. A file
could be in a .zip-Archive or as file on disk, using the IFileSystem
makes no difference to this.
*/
/** It manages where files are, so that modules which use the the IO do not
need to know where every file is located. A file could be in a .zip-Archive or
as file on disk, using the IFileSystem makes no difference to this. */
class IFileSystem : public virtual IReferenceCounted
{
public:
//! destructor
virtual ~IFileSystem() {}
//! Opens a file for read access.
/** \param filename: Name of file to open.
\return Returns a pointer to the created file interface.
@ -70,8 +64,8 @@ public:
//! Adds an zip archive to the file system.
/** 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
access for example Quake3 .pk3 files, which are nothing different than .zip files.
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.
\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
writing all letters in the right case.
@ -92,8 +86,8 @@ public:
//! Adds an pak archive to the file system.
/** 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
access for example Quake2/KingPin/Hexen2 .pak files
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
\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
writing all letters in the right case.
@ -102,23 +96,34 @@ public:
\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;
//! 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;
//! Changes the current Working Directory.
//! Changes the current working directory.
/** \param newDirectory: A string specifying the new working directory.
The string is operating system dependent. Under Windows it has
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;
//! 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;
//! 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;
//! 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.
/** \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.
@ -130,6 +135,11 @@ public:
\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;
//! 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*).
/** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
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.
/** \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.
\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().
See IReferenceCounted::drop() for more information. */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -70,38 +70,45 @@ const c8* const PIXEL_SHADER_TYPE_NAMES[] = {
"ps_3_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
{
public:
//! destructor
//! Destructor
virtual ~IGPUProgrammingServices() {}
//! Adds a new material renderer to the VideoDriver, based on a high level shading
//! language. Currently only HLSL/D3D9 and GLSL/OpenGL is supported.
//! \param vertexShaderProgram: String containing the source of the vertex shader program.
//! This can be 0 if no vertex program shall be used.
//! \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: String containing the source of the pixel shader program.
//! This can be 0 if no pixel shader shall be used.
//! \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 addHighLevelShaderMaterial(
//! Adds a new high-level shading material renderer to the VideoDriver.
/** Currently only HLSL/D3D9 and GLSL/OpenGL are supported.
\param vertexShaderProgram: String containing the source of the vertex
shader program. This can be 0 if no vertex program shall be used.
\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: String containing the source of the pixel
shader program. This can be 0 if no pixel shader shall be used.
\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 addHighLevelShaderMaterial(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
@ -112,33 +119,42 @@ public:
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 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
//! 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: String containing the source of the pixel shader program.
//! This can be 0 if no pixel shader shall be used.
//! \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.
//! 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 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 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: String containing the source of the pixel
shader program. This can be 0 if no pixel shader shall be used.
\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(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
@ -151,30 +167,38 @@ public:
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.
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads 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",
@ -186,79 +210,89 @@ public:
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.
//! 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 tries to load the
//! programs 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.
//! 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,
io::IReadFile* pixelShaderProgram,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
//! programs from files.
//! \param vertexShaderProgramFileName: Text file name containing the source of the
//! vertex shader program.
//! Set to 0 if no shader shall be created.
//! \param pixelShaderProgramFileName: Text file name containing the source of the
//! pixel shader program. Set to 0 if no shader shall be created.
//! \param callback: Pointer to an IShaderConstantSetCallback object on 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.
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
/** \param vertexShaderProgramFileName: Text file name containing the
source of the vertex shader program. Set to 0 if no shader shall be
created.
\param pixelShaderProgramFileName: Text file name containing the source
of the pixel shader program. Set to 0 if no shader shall be created.
\param callback: Pointer to an IShaderConstantSetCallback object on
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(const c8* vertexShaderProgramFileName,
const c8* pixelShaderProgramFileName,
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -60,12 +60,9 @@ namespace gui
IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIButton() {}
//! Sets another skin independent font.
/** 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;
//! Sets an image which should be displayed on the button when it is in normal state.
@ -74,7 +71,7 @@ namespace gui
//! Sets a background image for the button when it is in normal state.
/** \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;
//! Sets a background image for the button when it is in pressed state.
@ -85,7 +82,7 @@ namespace gui
//! 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 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;
//! Sets the sprite bank used by the button

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".
// 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)
: IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUICheckBox() {}
//! Set if box is checked.
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -20,9 +20,6 @@ namespace gui
//! constructor
IGUIColorSelectDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,6 +11,7 @@ namespace irr
{
namespace gui
{
//! Combobox widget
class IGUIComboBox : public IGUIElement
{
@ -20,9 +21,6 @@ namespace gui
IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIComboBox() {}
//! Returns amount of items in box
virtual u32 getItemCount() const = 0;
@ -33,8 +31,8 @@ namespace gui
virtual u32 addItem(const wchar_t* text) = 0;
//! Removes an item from the combo box.
/** Warning. This will change the IDs of all following items */
virtual void removeItem(u32 id) = 0;
/** Warning. This will change the index of all following items */
virtual void removeItem(u32 idx) = 0;
//! Deletes all items in the combo box
virtual void clear() = 0;
@ -43,7 +41,14 @@ namespace gui
virtual s32 getSelected() const = 0;
//! 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".
// 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)
: IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIContextMenu() {};
//! Get amount of menu items
virtual u32 getItemCount() const = 0;
//! Adds a menu item.
/** \param text: Text of menu item. Set this to 0 to create
an separator instead of a real item, which is the same like
calling addSeparator();
\param commandId: Command id of menu item, a simple id you may
set to whatever you want.
\param enabled: Specifies if the menu item should be enabled.
\param hasSubMenu: Set this to true if there should be a submenu
at this item. You can acess this submenu via getSubMenu().
\param checked: Specifies if the menu item should be initially checked.
\return Returns the index of the new item */
an separator instead of a real item, which is the same like
calling addSeparator();
\param commandId: Command id of menu item, a simple id you may
set to whatever you want.
\param enabled: Specifies if the menu item should be enabled.
\param hasSubMenu: Set this to true if there should be a submenu
at this item. You can acess this submenu via getSubMenu().
\param checked: Specifies if the menu item should be initially checked.
\return Returns the index of the new item */
virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
bool hasSubMenu=false,
bool checked=false
) = 0;
bool hasSubMenu=false, bool checked=false) = 0;
//! Adds a separator item to the menu
virtual void addSeparator() = 0;
@ -52,7 +47,7 @@ namespace gui
//! Sets text 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;
//! Check if a menu item is enabled
@ -61,12 +56,12 @@ namespace gui
//! Sets if the menu item should be enabled.
/** \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;
//! Sets if the menu item should be checked.
/** \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;
//! Check if a menu item is checked
@ -90,14 +85,14 @@ namespace gui
//! Sets the command id of a menu item
/** \param idx: Zero based index of the menu item
\param id: Command id of menu item, a simple id you may
set to whatever you want. */
\param id: Command id of menu item, a simple id you may
set to whatever you want. */
virtual void setItemCommandId(u32 idx, s32 id) = 0;
//! Get a pointer to the submenu of an item.
/** 0 is returned if there is no submenu
\param idx: Zero based index of the menu item
\return Returns a pointer to the submenu of an item. */
\param idx: Zero based index of the menu item
\return Returns a pointer to the submenu of an item. */
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".
// 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)
: IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIEditBox() {};
//! Sets another skin independent font.
/** 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;
//! Sets another color for the text.
/** 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
IGUIEditBox::enableOverrrideColor(true) after this, this is done
by this function.
If you set a color, and you want the text displayed with the color
of the skin again, call IGUIEditBox::enableOverrideColor(false);
\param color: New color of the text. */
in the skin, but the set color instead. You don't need to call
IGUIEditBox::enableOverrrideColor(true) after this, this is done
by this function.
If you set a color, and you want the text displayed with the color
of the skin again, call IGUIEditBox::enableOverrideColor(false);
\param color: New color of the text. */
virtual void setOverrideColor(video::SColor color) = 0;
//! 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
with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */
virtual void enableOverrideColor(bool enable) = 0;
//! Turns the border on or off
@ -53,18 +50,18 @@ namespace gui
//! Sets text justification mode
/** \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,
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;
//! Enables or disables word wrap.
/** \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;
//! 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;
//! Enables or disables newlines.
@ -73,15 +70,15 @@ namespace gui
virtual void setMultiLine(bool enable) = 0;
//! 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;
//! 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;
//! 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;
//! Sets whether the edit box is a password box. Setting this to true will
@ -94,12 +91,12 @@ namespace gui
virtual bool isPasswordBox() const = 0;
//! 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;
//! 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
infinity. */
infinity. */
virtual void setMax(u32 max) = 0;
//! 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,6 +11,7 @@
#include "irrString.h"
#include "IEventReceiver.h"
#include "EGUIElementTypes.h"
#include "EGUIAlignment.h"
#include "IAttributes.h"
namespace irr
@ -20,28 +21,6 @@ namespace gui
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.
class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver
{
@ -104,6 +83,7 @@ public:
//! Sets the relative rectangle of this element.
/** \param r The absolute position to set */
void setRelativePosition(const core::rect<s32>& r)
{
if (Parent)
@ -126,9 +106,23 @@ public:
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)
return;
@ -136,9 +130,9 @@ public:
const core::dimension2di& d = Parent->getAbsolutePosition().getSize();
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.Width * r.LowerRightCorner.X),
core::floor32((f32)d.Width * r.LowerRightCorner.X),
core::floor32((f32)d.Height * r.LowerRightCorner.Y));
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
{
return AbsoluteRect;
@ -162,6 +156,7 @@ public:
//! 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)
{
NoClip = noClip;
@ -169,6 +164,7 @@ public:
//! 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
{
return NoClip;
@ -226,7 +222,6 @@ public:
{
core::rect<s32> parentAbsolute(0,0,0,0);
core::rect<s32> parentAbsoluteClip;
s32 diffx, diffy;
f32 fw=0.f, fh=0.f;
if (Parent)
@ -236,20 +231,16 @@ public:
if (NoClip)
{
IGUIElement* p=this;
while (p && p->NoClip && p->Parent)
p = p->Parent;
if (p->Parent)
parentAbsoluteClip = p->Parent->AbsoluteClippingRect;
else
parentAbsoluteClip = p->AbsoluteClippingRect;
while (p && p->Parent)
p = p->Parent;
parentAbsoluteClip = p->AbsoluteClippingRect;
}
else
parentAbsoluteClip = Parent->AbsoluteClippingRect;
}
diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
fw = (f32)parentAbsolute.getWidth();
@ -257,7 +248,6 @@ public:
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft)
{
case EGUIA_UPPERLEFT:
@ -320,8 +310,8 @@ public:
RelativeRect = DesiredRect;
s32 w = RelativeRect.getWidth();
s32 h = RelativeRect.getHeight();
const s32 w = RelativeRect.getWidth();
const s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed
if (w < MinSize.Width)
@ -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* target = 0;
@ -365,6 +366,7 @@ public:
core::list<IGUIElement*>::Iterator it = Children.getLast();
if (IsVisible)
{
while(it != Children.end())
{
target = (*it)->getElementFromPoint(point);
@ -373,6 +375,7 @@ public:
--it;
}
}
if (IsVisible && isPointInside(point))
target = this;
@ -382,7 +385,7 @@ public:
//! 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
{
return AbsoluteClippingRect.isPointInside(point);
@ -395,7 +398,7 @@ public:
if (child)
{
child->grab();
child->remove(); // remove from old parent
child->remove(); // remove from old parent
child->LastParentRect = getAbsolutePosition();
child->Parent = this;
Children.push_back(child);
@ -480,19 +483,18 @@ public:
}
//! Sets whether this control was created as part of its parent,
//! for example when a scrollbar is part of a listbox.
//! SubElements are not saved to disk when calling guiEnvironment->saveGUI()
//! Sets whether this control was created as part of its parent.
/** For example, it is true when a scrollbar is part of a listbox.
SubElements are not saved to disk when calling guiEnvironment->saveGUI() */
virtual void setSubElement(bool subElement)
{
IsSubElement = subElement;
}
//! If set to true, the focus will visit this element when using
//! the tab key to cycle through elements.
//! If this element is a tab group (see isTabGroup/setTabGroup) then
//! ctrl+tab will be used instead.
//! If set to true, the focus will visit this element when using the tab key to cycle through elements.
/** If this element is a tab group (see isTabGroup/setTabGroup) then
ctrl+tab will be used instead. */
void setTabStop(bool enable)
{
IsTabStop = enable;
@ -507,9 +509,9 @@ public:
}
//! Sets the priority of focus when using the tab key to navigate between a group
//! of elements. See setTabGroup, isTabGroup and getTabGroup for information on tab groups.
//! Elements with a lower number are focused first
//! Sets the priority of focus when using the tab key to navigate between a group of elements.
/** See setTabGroup, isTabGroup and getTabGroup for information on tab groups.
Elements with a lower number are focused first */
void setTabOrder(s32 index)
{
// negative = autonumber
@ -544,9 +546,9 @@ public:
}
//! Sets whether this element is a container for a group of elements which
//! can be navigated using the tab key. For example, windows are tab groups.
//! Groups can be navigated using ctrl+tab, providing isTabStop is true.
//! Sets whether this element is a container for a group of elements which can be navigated using the tab key.
/** For example, windows are tab groups.
Groups can be navigated using ctrl+tab, providing isTabStop is true. */
void setTabGroup(bool isGroup)
{
IsTabGroup = isGroup;
@ -561,8 +563,7 @@ public:
}
//! Returns the container element which holds all elements in this element's
//! tab group.
//! Returns the container element which holds all elements in this element's tab group.
IGUIElement* getTabGroup()
{
IGUIElement *ret=this;
@ -639,7 +640,7 @@ public:
//! 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)
{
core::list<IGUIElement*>::Iterator it = Children.begin();
@ -667,11 +668,11 @@ public:
//! Finds the first element with the given id.
/** \param id: Id to search for.
\param searchchildren: Set this to true, if also children of this
element may contain the element with the searched id and they
should be searched too.
\return Returns the first element with the given id. If no element
with this id was found, 0 is returned. */
\param searchchildren: Set this to true, if also children of this
element may contain the element with the searched id and they
should be searched too.
\return Returns the first element with the given id. If no element
with this id was found, 0 is returned. */
virtual IGUIElement* getElementFromId(s32 id, bool searchchildren=false) const
{
IGUIElement* e = 0;
@ -712,13 +713,13 @@ public:
//! searches elements to find the closest next element to tab to
//! \param startOrder: The TabOrder of the current element, -1 if none
//! \param reverse: true if searching for a lower number
//! \param group: true if searching for a higher one
//! \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 includeInvisible: includes invisible elements in the search (default=false)
//! \return true if successfully found an element, false to continue searching/fail
/** \param startOrder: The TabOrder of the current element, -1 if none
\param reverse: true if searching for a lower number
\param group: true if searching for a higher one
\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 includeInvisible: includes invisible elements in the search (default=false)
\return true if successfully found an element, false to continue searching/fail */
bool getNextElement(s32 startOrder, bool reverse, bool group,
IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const
{
@ -753,7 +754,7 @@ public:
if (closest)
{
closestOrder = closest->getTabOrder();
if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
||(!reverse && currentOrder < closestOrder && currentOrder > startOrder))
{
closest = *it;
@ -815,8 +816,8 @@ public:
//! Writes attributes of the scene node.
//! Implement this to expose the attributes of your scene node for
//! scripting languages, editors, debuggers or xml serialization purposes.
/** Implement this to expose the attributes of your scene node for
scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
out->addInt("Id", ID );
@ -838,8 +839,8 @@ public:
//! Reads attributes of the scene node.
//! Implement this to set the attributes of your scene node for
//! scripting languages, editors, debuggers or xml deserialization purposes.
/** Implement this to set the attributes of your scene node for
scripting languages, editors, debuggers or xml deserialization purposes. */
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
setID(in->getAttributeAsInt("Id"));

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,12 +11,11 @@
namespace irr
{
namespace gui
{
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
scene manager to save and load them, simply implement this interface and register it
in your gui environment via IGUIEnvironment::registerGUIElementFactory.
@ -28,37 +27,34 @@ namespace gui
{
public:
// destructor
virtual ~IGUIElementFactory() {}
//! adds an element to the gui environment based on its type id
/** \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.
\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;
//! adds a GUI element to the GUI Environment based on its type name
/** \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.
\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;
//! 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;
//! 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
getCreatableGUIElementTypeCount() */
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
getCreatableGUIElementTypeCount() */
virtual const c8* getCreateableGUIElementTypeName(s32 idx) const = 0;
//! returns type name of a createable 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;
};

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -49,6 +49,7 @@ class IGUIEditBox;
class IGUISpinBox;
class IGUITabControl;
class IGUITab;
class IGUITable;
class IGUIContextMenu;
class IGUIComboBox;
class IGUIToolBar;
@ -61,349 +62,473 @@ class IGUIEnvironment : public virtual IReferenceCounted
{
public:
//! destructor
virtual ~IGUIEnvironment() {};
//! Draws all gui elements.
//! Draws all gui elements by traversing the GUI environment starting at the root node.
virtual void drawAll() = 0;
//! Sets the focus to an element.
/** Causes a EGET_ELEMENT_FOCUS_LOST event followed by a EGET_ELEMENT_FOCUSED event.
If someone absorbed either of the events, then the focus will not be changed.
\return Returns true on success, false on failure */
/** Causes a EGET_ELEMENT_FOCUS_LOST event followed by a
EGET_ELEMENT_FOCUSED event. If someone absorbed either of the events,
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;
//! 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;
//! Removes the focus from an element.
/** Causes a EGET_ELEMENT_FOCUS_LOST event. If the event is absorbed then the focus
will not be changed.
\return Returns true on success, false on failure */
/** Causes a EGET_ELEMENT_FOCUS_LOST event. If the event is absorbed
then the focus will not be changed.
\param element Pointer to the element which shall lose the focus.
\return True on success, false on failure */
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;
//! Returns the current video driver.
/** \return Pointer to the video driver. */
virtual video::IVideoDriver* getVideoDriver() const = 0;
//! Returns the file system.
/** \return Pointer to the file system. */
virtual io::IFileSystem* getFileSystem() const = 0;
//! returns a pointer to the OS operator
/** \return Pointer to the OS operator. */
virtual IOSOperator* getOSOperator() const = 0;
//! removes all elements from the environment.
//! Removes all elements from the environment.
virtual void clear() = 0;
//! Posts an input event to the environment.
/** 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;
//! This sets a new event receiver for gui events.
/** 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;
//! Returns pointer to the current gui skin.
/** \return Pointer to the GUI skin. */
virtual IGUISkin* getSkin() const = 0;
//! Sets a new GUI Skin
/** You can use this to change the appearance of the whole GUI Environment. You
can set one of the built-in skins or implement your 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:
/** You can use this to change the appearance of the whole GUI
Environment. You can set one of the built-in skins or implement your
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:
\code
gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
environment->setSkin(newskin);
newskin->drop();
\endcode
\param skin New skin to use.
*/
virtual void setSkin(IGUISkin* skin) = 0;
//! Creates a new GUI Skin based on a template.
/** 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().
See IReferenceCounted::drop() for more information. */
virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
//! Returns pointer to the font with the specified file name.
/** Loads the font if it was not loaded before. Returns 0 if the font could not be loaded.
\return
returns a pointer to the font.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
//! Returns pointer to the font with the specified filename.
/** Loads the font if it was not loaded before.
\param filename Filename of 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. */
virtual IGUIFont* getFont(const c8* filename) = 0;
//! 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;
//! 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.
\return
returns a pointer to the sprite bank.
/** Loads the bank if it was not loaded before.
\param filename Filename of the sprite bank's origin.
\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. */
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;
//! Returns the root gui element.
/** This is the first gui element, parent of all other
gui elements. You'll never need to use this method, unless you are not creating
your own gui elements, trying to add them to the gui elements without a parent.
The returned pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** This is the first gui element, the (direct or indirect) parent of all
other gui elements. It is a valid IGUIElement, with dimensions the same
size as the screen. You should not need to use this method directly, unless
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;
//! Adds an button element.
/** \return
Returns a pointer to the created button. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
//! Adds a button element.
/** \param rectangle Rectangle specifying the borders of the button.
\param parent Parent gui element of the button.
\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,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
//! Adds an empty window element.
/** \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
until this messagebox is removed.
\return
Returns a pointer to the created window. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** \param rectangle Rectangle specifying the borders of the window.
\param modal Defines if the dialog is modal. This means, that all other
gui elements which were created before the window cannot be used until
it is removed.
\param text Text displayed as the window title.
\param parent Parent gui element of the window.
\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;
//! Adds a modal screen. This control stops its parent's members from being
//! able to recieve input until its last child is removed, it then deletes its self.
/** \return
Returns a pointer to the created window. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
//! Adds a modal screen.
/** This control stops its parent's members from being able to receive
input until its last child is removed, it then deletes itself.
\param parent Parent gui element of the modal.
\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;
//! Adds a 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 modal: Defines if the dialog is modal. This means, that all other
gui elements which were created before the message box cannot be used
until this messagebox is removed.
\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 (EMBF_OK | EMBF_CANCEL).
\param parent: Parent gui element of the message box.
\param id: Id with which the gui element can be identified.
\return
Returns a pointer to the created message box. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** \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 modal Defines if the dialog is modal. This means, that all other
gui elements which were created before the message box cannot be used
until this messagebox is removed.
\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 (EMBF_OK | EMBF_CANCEL).
\param parent Parent gui element of the message box.
\param id Id with which the gui element can be identified.
\return Pointer to the created message box. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
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;
//! Adds a scrollbar.
/** \return
Returns a pointer to the created scrollbar. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** \param horizontal Specifies if the scroll bar is drawn horizontal
or vertical.
\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,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds an image element.
/** \param image: Image to be displayed.
\param pos: Position of the image. The width and height of the image is taken
from the image.
\param useAlphaChannel: Sets if the image should use the alpha channel of the texture
to draw itself.
\return
Returns a pointer to the created image element. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** \param image Image to be displayed.
\param pos Position of the image. The width and height of the image is
taken from the image.
\param useAlphaChannel Sets if the image should use the alpha channel
of the texture to draw itself.
\param parent Parent gui element of the image.
\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(video::ITexture* image, core::position2d<s32> pos,
bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds an image element.
/** Use IGUIImage::setImage later to set the image to be displayed.
\return
Returns a pointer to the created image element. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
\param rectangle Rectangle specifying the borders of the image.
\param parent Parent gui element of the image.
\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,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds a checkbox element.
/** \return
Returns a pointer to the created check box. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** \param checked Define the initial state of the check box.
\param rectangle Rectangle specifying the borders of the check box.
\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,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
//! Adds a list box element.
/** \return
Returns a pointer to the created list box. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** \param rectangle Rectangle specifying the borders of the list box.
\param parent Parent gui element of the list box.
\param id Id to identify the gui element.
\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;
//! Adds an mesh viewer. Not 100% implemented yet.
/** \return
Returns a 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 mesh viewer. Not 100% implemented yet.
/** \param rectangle Rectangle specifying the borders of the mesh viewer.
\param parent Parent gui element of the mesh viewer.
\param id Id to identify the gui element.
\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.
/** \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
until this messagebox is removed.
\return
Returns a 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. */
/** \param title Text to be displayed as the title of the dialog.
\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
until this messagebox is removed.
\param parent Parent gui element of the dialog.
\param id Id to identify the gui element.
\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;
//! Adds a color select dialog.
/** \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
until this messagebox is removed.
\return
Returns a 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. */
/** \param title The title of the dialog.
\param modal Defines if the dialog is modal. This means, that all other
gui elements which were created before the dialog cannot be used
until it is removed.
\param parent The parent of the dialog.
\param id The ID of the dialog.
\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;
//! Adds a static text.
/** The returned pointer must not be dropped.
\param text is the text to be displayed. Can be altered after creation with SetText().
\param rectangle is the position of the static text.
\param border has to be set to true if the static text should have a 3d border.
\param wordWrap specifies, if the text should be wrapped into multiple lines.
\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 is a s32 to identify the static text element.
\param fillBackground specifies if the background will be filled. Default: false.
\return
Returns a pointer to the created static text. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** \param text Text to be displayed. Can be altered after creation by SetText().
\param rectangle Rectangle specifying the borders of the static text
\param border Set to true if the static text should have a 3d border.
\param wordWrap Enable if the text should wrap into multiple lines.
\param parent Parent item of the element, e.g. a window.
\param id The ID of the element.
\param fillBackground Enable if the background shall be filled.
Defaults to false.
\return Pointer to the created static text. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
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 fillBackground = false) = 0;
//! Adds an edit box.
/** Supports unicode input from every keyboard around the world,
scrolling, copying and pasting (exchanging data with the clipboard directly), maximum
character amount, marking and all shortcuts like ctrl+X, ctrl+V, ctrg+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 rectangle is the position of the edit box.
\param border has to be set to true if the edit box should have a 3d border.
\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 id is a s32 to identify the edit box.
\return
Returns a pointer to the created edit box. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** Supports unicode input from every keyboard around the world,
scrolling, copying and pasting (exchanging data with the clipboard
directly), maximum character amount, marking, and all shortcuts like
ctrl+X, ctrl+V, ctrl+C, shift+Left, shift+Right, Home, End, and so on.
\param text Text to be displayed. Can be altered after creation
by setText().
\param rectangle Rectangle specifying the borders of the edit box.
\param border Set to true if the edit box should have a 3d border.
\param parent Parent item of the element, e.g. a window.
Set it to 0 to place the edit box directly in the environment.
\param id The ID of the element.
\return Pointer to the created edit box. Returns 0 if an error occured.
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;
//! Adds a spin box.
/** An edit box with up and down buttons
\param text is the text to be displayed. Can be altered after creation with setText().
\param rectangle is the position 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 id is a s32 to identify the spin box.
\return
Returns a pointer to the created spin box. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** An edit box with up and down buttons
\param text Text to be displayed. Can be altered after creation by setText().
\param rectangle Rectangle specifying the borders of the spin box.
\param parent Parent item of the element, e.g. a window.
Set it to 0 to place the spin box directly in the environment.
\param id The ID of the element.
\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. */
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds an element for fading in or out.
/* \param rectangle: Pointer to rectangle specifing the borders of the element.
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 id: A s32 to identify the text.
\return
Returns a pointer to the created in-out-fader. Returns 0 if an error occured.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
/** \param rectangle Rectangle specifying the borders of the fader.
If the pointer is NULL, the whole screen is used.
\param parent Parent item of the element, e.g. a window.
\param id An identifier for the fader.
\return Pointer to the created in-out-fader. Returns 0 if an error
occured. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a tab control to the environment.
/** \param rectangle is the position 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 fillbackground specifies if the background of the tab control should be drawn to.
\param border specifiys if a flat 3d border should be drawn.
This is usually not necesarry unless you don't place the control directly into the environment without a window as parent.
\param id is a s32 to identify the tab control.
\return
Returns a 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. */
/** \param rectangle Rectangle specifying the borders of the tab control.
\param parent Parent item of the element, e.g. a window.
Set it to 0 to place the tab control directly in the environment.
\param fillbackground Specifies if the background of the tab control
should be drawn.
\param border Specifies if a flat 3d border should be drawn. This is
usually not necessary unless you place the control directly into
the environment without a window as parent.
\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,
IGUIElement* parent=0, bool fillbackground=false,
bool border=true, s32 id=-1) = 0;
//! Adds tab to the environment.
/** You can use this element to group other elements. This is not used for creating tabs on tab controls,
please use IGUITabControl::addTab() for this instead.
\param rectangle is the position of the tab.
\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 id is a s32 to identify the tab. */
/** You can use this element to group other elements. This is not used
for creating tabs on tab controls, please use IGUITabControl::addTab()
for this instead.
\param rectangle Rectangle specifying the borders of 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,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a context menu to the environment.
/** \param rectangle is the position of the menu. 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 id is a s32 to identify the menu. */
/** \param rectangle Rectangle specifying the borders of the menu.
Note that the menu is resizing itself based on what items you add.
\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 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,
IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds a menu to the environment.
/* This is like the menu you can find on top of most windows in modern graphical user interfaces.
\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 id is a s32 to identify the menu. */
/* This is like the menu you can find on top of most windows in modern
graphical user interfaces.
\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;
//! Adds a toolbar to the environment.
/** It is like a menu is always placed on top
in its parent, and 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 id is a s32 to identify the tool bar. */
/** It is like a menu that is always placed on top of its parent, and
contains buttons.
\param parent Parent item of the element, e.g. a window.
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;
//! 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 id is a s32 to identify the combo box. */
/** \param rectangle Rectangle specifying the borders of 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,
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;
//! Adds an element factory to the gui environment.
/** Use this to extend the gui environment with new element types which it should be
able to create automaticly, for example when loading data from xml files. */
/** Use this to extend the gui environment with new element types which
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;
//! 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;
//! 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;
//! 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;
//! Saves the current gui into a file.
//! \param filename: Name of the file.
//! \param start: The GUIElement to start with. Root if 0.
/** \param filename Name of the file.
\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;
//! Saves the current gui into a file.
//! \param file: The file to write to.
//! \param start: The GUIElement to start with. Root if 0.
/** \param file The file to write to.
\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;
//! Loads the gui. Note that the current gui is not cleared before.
//! \param filename: Name of the file .
//! \param parent: Parent for the loaded GUI, root if 0.
/** \param filename Name of the file .
\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;
//! Loads the gui. Note that the current gui is not cleared before.
//! \param file: The file to load from.
//! \param parent: Parent for the loaded GUI, root if 0.
/** \param file The file to load from.
\param parent Parent for the loaded GUI, root if 0.
\return True if loading succeeded, else false. */
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
//! Writes attributes of the gui environment
@ -417,7 +542,6 @@ public:
//! reads an element
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".
// 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)
: 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.
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,13 +21,13 @@ enum EGUI_FONT_TYPE
EGFT_BITMAP = 0,
//! Scalable vector fonts loaded from an XML file.
//! These fonts reside in system memory and use no video memory
//! until they are displayed. These are slower than bitmap fonts
//! but can be easily scaled and rotated.
/** These fonts reside in system memory and use no video memory
until they are displayed. These are slower than bitmap fonts
but can be easily scaled and rotated. */
EGFT_VECTOR,
//! A font which uses a the native API provided by the operating system.
//! Currently not used.
/** Currently not used. */
EGFT_OS,
//! An external font type provided by the user.
@ -39,24 +39,21 @@ class IGUIFont : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IGUIFont() {}
//! Draws an text and clips it to the specified rectangle if wanted.
/** \param text: Text to draw
\param position: Rectangle specifying position where to draw the text.
\param color: Color of the text
\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 clip: Optional pointer to a rectangle against which the text will be clipped.
If the pointer is null, no clipping will be done. */
\param position: Rectangle specifying position where to draw the text.
\param color: Color of the text
\param hcenter: Specifiies if the text should be centered horizontally 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.
If the pointer is null, no clipping will be done. */
virtual void draw(const wchar_t* text, const core::rect<s32>& position,
video::SColor color, bool hcenter=false, bool vcenter=false,
const core::rect<s32>* clip=0) = 0;
//! Calculates the dimension of a text.
/** \return Returns width and height of the area covered by the text if it would be
drawn. */
/** \return Returns width and height of the area covered by the text if
it would be drawn. */
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.
@ -69,8 +66,10 @@ public:
//! Returns the type of this font
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;
//! Sets global kerning height for the font.
virtual void setKerningHeight (s32 kerning) = 0;
//! Gets kerning values (distance between letters) for the font. If no parameters are provided,

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -18,9 +18,6 @@ class IGUIFontBitmap : public IGUIFont
{
public:
//! Destructor
virtual ~IGUIFontBitmap() {}
//! Returns the type of this font
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".
// 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)
: IGUIElement(EGUIET_IMAGE, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIImage() {}
//! Sets an image
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,7 +14,7 @@ namespace gui
{
//! 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
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.
@ -32,29 +32,27 @@ namespace gui
IGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> 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.
virtual video::SColor getColor() const = 0;
//! 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 source, video::SColor dest) = 0;
//! Starts the fade in process. In the beginning the whole rect is drawn by
//! the set color (black by default) and at the end of the overgiven
//! time the color has faded out.
//! \param time: Time specifing how long it should need to fade in,
//! in milliseconds.
//! Starts the fade in process.
/** In the beginning the whole rect is drawn by the set color
(black by default) and at the end of the overgiven time the
color has faded out.
\param time: Time specifing how long it should need to fade in,
in milliseconds. */
virtual void fadeIn(u32 time) = 0;
//! Starts the fade out process. In the beginning everything is visible,
//! and at the end of 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,
//! in milliseconds.
//! Starts the fade out process.
/** In the beginning everything is visible, and at the end of
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,
in milliseconds. */
virtual void fadeOut(u32 time) = 0;
//! 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -12,7 +12,6 @@ namespace irr
{
namespace gui
{
class IGUIFont;
class IGUISpriteBank;
//! Enumeration for listbox colors
@ -39,9 +38,6 @@ namespace gui
IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIListBox() {}
//! returns amount of list items
virtual u32 getItemCount() const = 0;
@ -52,10 +48,9 @@ namespace gui
virtual u32 addItem(const wchar_t* text) = 0;
//! adds an list item with an icon
//! \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
//! \return
//! returns the id of the new created item
/** \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
\return The id of the new created item */
virtual u32 addItem(const wchar_t* text, s32 icon) = 0;
//! Removes an item from the list
@ -64,10 +59,11 @@ namespace gui
//! Returns the icon of an item
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
//! the built-in-font by default. A sprite can be displayed in front of every list item.
//! An icon is an index within the icon sprite bank. Several default icons are available in the
//! skin through getIcon
//! Sets the sprite bank which should be used to draw list icons.
/** This font is set to the sprite bank of the built-in-font by
default. A sprite can be displayed in front of every list item.
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;
//! 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
virtual void setSelected(s32 index) = 0;
//! set whether the listbox should scroll to show a newly selected item
//! or a new item as it is added to the list.
//! set whether the listbox should scroll to new or newly selected items
virtual void setAutoScrollEnabled(bool scroll) = 0;
//! returns true if automatic scrolling is enabled, false if not.
@ -98,7 +93,7 @@ namespace gui
//! clear item color at index for given colortype
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;
//! return the overwrite color at given item index.
@ -111,7 +106,7 @@ namespace gui
virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0;
//! 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;
//! 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".
// 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)
: IGUIElement(EGUIET_MESH_VIEWER, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIMeshViewer() {}
//! Sets the mesh to be shown
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".
// 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)
: IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {}
//! destructor
~IGUIScrollBar() {};
//! gets the maximum value of the scrollbar.
virtual s32 getMax() const = 0;
@ -33,15 +30,17 @@ namespace gui
//! gets the small step value
virtual s32 getSmallStep() const = 0;
//! Sets the small step, the amount that the value changes by when clicking
//! on the buttons or using the cursor keys.
//! Sets the small step
/** 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;
//! gets the large step value
virtual s32 getLargeStep() const = 0;
//! Sets the large step, the amount that the value changes by when clicking
//! in the tray, or using the page up and page down keys.
//! Sets the large step
/** 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;
//! 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -6,6 +6,7 @@
#define __I_GUI_SKIN_H_INCLUDED__
#include "IAttributeExchangingObject.h"
#include "EGUIAlignment.h"
#include "SColor.h"
#include "rect.h"
@ -325,9 +326,6 @@ namespace gui
{
public:
//! destructor
virtual ~IGUISkin() {};
//! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0;
@ -374,27 +372,27 @@ namespace gui
virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index) = 0;
//! 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
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\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
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
\param clip: Clip area. */
virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! 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
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\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
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
\param clip: Clip area. */
virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
@ -406,11 +404,11 @@ namespace gui
implementations to find out how to draw the part exactly.
\param bgcolor: Background color.
\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
color or not be drawn at all.
\param rect: Defining area where to draw.
\param clip: Clip area. */
\param clip: Clip area. */
virtual void draw3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat, bool fillBackGround,
const core::rect<s32>& rect,
@ -432,50 +430,53 @@ namespace gui
const core::rect<s32>* clip=0) = 0;
//! 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
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\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
implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw.
\param clip: Clip area. */
\param clip: Clip area. */
virtual void draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! 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
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.
\param rect: Defining area where to draw.
\param clip: Clip area. */
\param clip: Clip area. */
virtual void draw3DToolBar(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
//! 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
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.
\param active: Specifies if the tab is currently active.
\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,
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
/** \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
implementations to find out how to draw the part exactly.
\param border: Specifies if the border should be drawn.
\param background: Specifies if the background should be drawn.
\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,
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
/** \param element: Pointer to the element which wishes to draw this icon.
@ -486,7 +487,7 @@ namespace gui
\param starttime: The time at the start of the animation
\param currenttime: The present time, used to calculate the frame number
\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,
const core::position2di position, u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0) = 0;
@ -504,7 +505,7 @@ namespace gui
const core::rect<s32>& pos, const core::rect<s32>* clip = 0) = 0;
//! 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
// This file uses the licence of the Irrlicht Engine.
// Copyright (C) 2006-2009 Michael Zeilfelder
// 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__
#define __I_GUI_SPIN_BOX_H_INCLUDED__
@ -22,13 +23,7 @@ namespace gui
s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUISpinBox() {}
//! 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;
//! 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__
#define __I_GUI_SPRITE_BANK_H_INCLUDED__
@ -18,15 +21,18 @@ namespace video
namespace gui
{
//! A single sprite frame.
struct SGUISpriteFrame
{
u32 textureNumber;
u32 rectNumber;
};
//! A sprite composed of several frames.
struct SGUISprite
{
SGUISprite() : Frames(), frameTime(0) { };
SGUISprite() : Frames(), frameTime(0) {}
core::array<SGUISpriteFrame> Frames;
u32 frameTime;
};
@ -37,9 +43,6 @@ class IGUISpriteBank : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IGUISpriteBank() {}
//! Returns the list of rectangles held by the sprite bank
virtual core::array< core::rect<s32> >& getPositions() = 0;
@ -59,10 +62,11 @@ public:
virtual void setTexture(u32 index, video::ITexture* texture) = 0;
//! 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),
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".
// 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)
: IGUIElement(EGUIET_STATIC_TEXT, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIStaticText() {}
//! Sets another skin independent font.
/** If this is set to zero, the button uses the font of the skin.
\param font: New font to set. */
virtual void setOverrideFont(IGUIFont* font=0) = 0;
//! 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;
//! Sets another color for the text.
/** 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
IGUIStaticText::enableOverrrideColor(true) after this, this is done
by this function.
If you set a color, and you want the text displayed with the color
of the skin again, call IGUIStaticText::enableOverrideColor(false);
\param color: New color of the text. */
in the skin, but the set color instead. You don't need to call
IGUIStaticText::enableOverrrideColor(true) after this, this is done
by this function.
If you set a color, and you want the text displayed with the color
of the skin again, call IGUIStaticText::enableOverrideColor(false);
\param color: New color of the text. */
virtual void setOverrideColor(video::SColor color) = 0;
//! Gets the override color
//! \return: The override color
/** \return: The override color */
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.
@ -56,7 +53,7 @@ namespace gui
virtual void enableOverrideColor(bool enable) = 0;
//! 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;
//! Sets another color for the background.
@ -70,29 +67,29 @@ namespace gui
//! Sets text justification mode
/** \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,
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;
//! 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
broken on to the next line. */
broken on to the next line. */
virtual void setWordWrap(bool enable) = 0;
//! 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;
//! 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
of the multiline text in this element.
\return Returns height of text in pixels. */
of the multiline text in this element.
\return Height of text in pixels. */
virtual s32 getTextHeight() const = 0;
//! Returns the width of the current text, in the current font
/** 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;
};

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -7,6 +7,7 @@
#include "IGUIElement.h"
#include "SColor.h"
#include "IGUISkin.h"
namespace irr
{
@ -21,9 +22,6 @@ namespace gui
IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITab() {}
//! Returns number of tab if in tabcontrol.
/** Can be accessed later IGUITabControl::getTab() by this number. */
virtual s32 getNumber() const = 0;
@ -39,6 +37,12 @@ namespace gui
//! returns the color of the background
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
@ -50,9 +54,6 @@ namespace gui
IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUITabControl() {}
//! Adds a tab
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
/** \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
is corresponding to this tab. */
is corresponding to this tab. */
virtual IGUITab* getTab(s32 idx) const = 0;
//! Brings a tab to front.
/** \param idx: number of the tab.
\return Returns true if successful. */
\return Returns true if successful. */
virtual bool setActiveTab(s32 idx) = 0;
//! Brings a tab to front.
/** \param tab: pointer to the tab.
\return Returns true if successful. */
\return Returns true if successful. */
virtual bool setActiveTab(IGUIElement *tab) = 0;
//! Returns which tab is currently active
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".
// 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)
: IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIToolBar() {}
//! Adds a button to the tool bar
virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=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".
// 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)
: IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {}
//! destructor
virtual ~IGUIWindow() {}
//! Returns pointer to the close button
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -7,6 +7,7 @@
#include "IReferenceCounted.h"
#include "position2d.h"
#include "rect.h"
#include "SColor.h"
namespace irr
@ -18,9 +19,10 @@ namespace video
/** A color format specifies how color information is stored. */
enum ECOLOR_FORMAT
{
//! 16 bit color format used by the software driver, and thus preferred
//! by all other irrlicht engine video drivers. There are 5 bits for every
//! color component, and a single bit is left for alpha information.
//! 16 bit color format used by the software driver.
/** It is thus preferred by all other irrlicht engine video drivers.
There are 5 bits for every color component, and a single bit is left
for alpha information. */
ECF_A1R5G5B5 = 0,
//! 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.
ECF_R8G8B8,
//! Default 32 bit color format. 8 bits are used for every component:
//! red, green, blue and alpha.
//! Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
ECF_A8R8G8B8
};
//! Interface for software image data.
//! Interface for software image data.
/** Image loaders create these images from files. IVideoDrivers convert
these images into their (hardware) textures.
*/
@ -43,20 +44,17 @@ class IImage : public virtual IReferenceCounted
{
public:
//! destructor
virtual ~IImage() {}
//! Lock function. Use this to get a pointer to the image data. After you
//! don't need the pointer anymore, you must call unlock().
//! \return Returns pointer to the image data. What type of data
//! 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.
//! Lock function. Use this to get a pointer to the image data.
/** 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
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;
//! Unlock function.
//! Should be called after the pointer received by lock() is not
//! needed anymore.
/** Should be called after the pointer received by lock() is not
needed anymore. */
virtual void unlock() = 0;
//! Returns width and height of image data.
@ -74,35 +72,49 @@ public:
//! Returns image data size in pixels
virtual u32 getImageDataSizeInPixels() const = 0;
//! returns a pixel
//! Returns a pixel
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;
//! returns the color format
//! Returns the color format
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;
//! returns mask for green value of a pixel
//! Returns mask for green value of a pixel
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;
//! returns mask for alpha value of a pixel
//! Returns mask for alpha value of a pixel
virtual u32 getAlphaMask() const = 0;
//! returns pitch of image
virtual u32 getPitch() const = 0;
//! Returns pitch of image
virtual u32 getPitch() const =0;
//! 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;
//! 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;
//! copies the image into the target, scaling the image to fit
virtual void copyToScaling(IImage* target) = 0;
//! Copies the image into the target, scaling the image to fit
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,7 +17,7 @@ namespace io
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
currently unsupported file formats (e.g .gif), then implement
this and add your new Surface loader with
@ -26,17 +26,21 @@ class IImageLoader : public virtual IReferenceCounted
{
public:
//! destructor
virtual ~IImageLoader() {}
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".tga")
//! Check if the file might be loaded by this class
/** Check is based on the file extension (e.g. ".tga")
\param fileName Name of file to check.
\return True if file seems to be loadable. */
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;
//! 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;
};

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__
#define _I_IMAGE_WRITER_H_INCLUDED__
@ -19,13 +23,16 @@ namespace video
class IImageWriter : public IReferenceCounted
{
public:
//! destructor
virtual ~IImageWriter() { }
//! return true if this writer can write a file with the given extension
//! Check if this writer can write a file with the given extension
/** \param fileName Name of the file to check.
\return True if file extension specifies a writable type. */
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;
};

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,11 +14,10 @@ namespace scene
{
//! Scene node which is a dynamic light.
/** You can switch the light on and off by
making it visible or not, and let it be animated by ordinary scene node animators.
If you set the light type to be directional, you will need to set the direction of the
light source manually in the SLight structure, the position of the scene node will have no
effect on this direction.
/** You can switch the light on and off by making it visible or not. It can be
animated by ordinary scene node animators. If the light type is directional or
spot, the direction of the light source is defined by the rotation of the scene
node (assuming (0,0,1) as the local direction of the light).
*/
class ILightSceneNode : public ISceneNode
{
@ -30,15 +29,47 @@ public:
: ISceneNode(parent, mgr, id, position) {}
//! Sets the light data associated with this ILightSceneNode
/** \param light The new light data. */
virtual void setLightData(const video::SLight& light) = 0;
//! Gets the light data associated with this ILightSceneNode
//! \return Returns the light data.
/** \return The light data. */
virtual const video::SLight& getLightData() const = 0;
//! Gets the light data associated with this ILightSceneNode
//! \return Returns the light data.
/** \return The light data. */
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

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -10,10 +10,10 @@
namespace irr
{
//! Possible log levels.
enum ELOG_LEVEL
{
//! High log level, warnings, errors and important information
//! texts are printed out.
//! High log level, warnings, errors and important information texts are printed out.
ELL_INFORMATION = 0,
//! Default log level, warnings and errors are printed out
@ -32,60 +32,59 @@ class ILogger : public virtual IReferenceCounted
{
public:
//! destructor
//! Destructor
virtual ~ILogger() {}
//! Returns the current set log level.
virtual ELOG_LEVEL getLogLevel() const = 0;
//! Sets a new log level. With this value, texts which are sent to
//! the logger are filtered out. For example setting this value to
//! ELL_WARNING, only warnings and
//! errors are printed out. Setting it to ELL_INFORMATION, which is
//! the default setting, warnings,
//! errors and informational texts are printed out.
//! \param ll: new log level filter value.
//! Sets a new log level.
/** With this value, texts which are sent to the logger are filtered
out. For example setting this value to ELL_WARNING, only warnings and
errors are printed out. Setting it to ELL_INFORMATION, which is the
default setting, warnings, errors and informational texts are printed
out.
\param ll: new log level filter value. */
virtual void setLogLevel(ELOG_LEVEL ll) = 0;
//! Prints out a text into the log
//! \param text: Text to print out.
//! \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
//! is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE.
/** \param text: Text to print out.
\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
is just an informational text, set it to ELL_INFORMATION. Texts are
filtered with these levels. If you want to be a text displayed,
independent on what level filter is set, use ELL_NONE. */
virtual void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log
//! \param text: Text to print out.
//! \param hint: Additional info. This string is added after a " :" to the
//! string.
//! \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
//! is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE.
/** \param text: Text to print out.
\param hint: Additional info. This string is added after a " :" to the
string.
\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
is just an informational text, set it to ELL_INFORMATION. Texts are
filtered with these levels. If you want to be a text displayed,
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;
//! Prints out a text into the log
//! \param text: Text to print out.
//! \param hint: Additional info. This string is added after a " :" to the
//! string.
//! \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
//! is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE.
/** \param text: Text to print out.
\param hint: Additional info. This string is added after a " :" to the
string.
\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
is just an informational text, set it to ELL_INFORMATION. Texts are
filtered with these levels. If you want to be a text displayed,
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;
//! Prints out a text into the log
//! \param text: Text to print out.
//! \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
//! is just an informational text, set it to ELL_INFORMATION. Texts are
//! filtered with these levels. If you want to be a text displayed,
//! independent on what level filter is set, use ELL_NONE.
/** \param text: Text to print out.
\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
is just an informational text, set it to ELL_INFORMATION. Texts are
filtered with these levels. If you want to be a text displayed,
independent on what level filter is set, use ELL_NONE. */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,58 +17,62 @@ namespace video
class IVideoDriver;
class IMaterialRendererServices;
//! Interface for material rendering. Can be used to extend the engine with new materials.
/** Refer to IVideoDriver::addMaterialRenderer() for more informations on how to extend the engine
with new materials.
*/
//! Interface for material rendering.
/** Can be used to extend the engine with new materials. Refer to
IVideoDriver::addMaterialRenderer() for more informations on how to extend the
engine with new materials. */
class IMaterialRenderer : public virtual IReferenceCounted
{
public:
//! destructor
virtual ~IMaterialRenderer() {}
//! Called by the IVideoDriver implementation the let the renderer set its needed render states.
/** This is called during the IVideoDriver::setMaterial() call.
When overriding this, you can set some renderstates or for example a vertex or pixel shader
if you like.
\param material: The new material parameters to be set. The renderer may change the material
flags in this material. For example if this material does not accept the zbuffer = true, it
can set it to false. This is useful, because in the next lastMaterial will be just the material
in this call.
\param lastMaterial: The material parameters which have been set before this material.
\param resetAllRenderstates: True if all renderstates should really be reset. This is usually
true if the last rendering mode was not a usual 3d rendering mode, but for example
a 2d rendering mode.
You should reset really all renderstates if this is true, no matter if the lastMaterial had
some similar settings. This is used because in most cases, some common renderstates are not
changed if they are 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. */
When overriding this, you can set some renderstates or for example a
vertex or pixel shader if you like.
\param material: The new material parameters to be set. The renderer
may change the material flags in this material. For example if this
material does not accept the zbuffer = true, it can set it to false.
This is useful, because in the next lastMaterial will be just the
material in this call.
\param lastMaterial: The material parameters which have been set before
this material.
\param resetAllRenderstates: True if all renderstates should really be
reset. This is usually true if the last rendering mode was not a usual
3d rendering mode, but for example a 2d rendering mode.
You should reset really all renderstates if this is true, no matter if
the lastMaterial had some similar settings. This is used because in
most cases, some common renderstates are not changed if they are
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,
bool resetAllRenderstates, IMaterialRendererServices* services) {};
bool resetAllRenderstates, IMaterialRendererServices* services) {}
//! Called every time before a new bunch of geometry is being drawn using this material with
//! for example drawIndexedTriangleList() call.
/** OnSetMaterial should normally only be called if the renderer decides 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
method will be called every time. This is useful for example for materials with shaders,
which don't only set new renderstates but also shader constants.
\param service: Pointer to interface providing methos for setting constants and other things.
\param vtxtype: Vertex type with which the next rendering will be done. This can be used
by the material renderer to set some specific optimized shaders or if this is an incompatible
vertex type for this renderer, to refuse rendering for example.
\return Returns true if everything is ok, and false if nothing should 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 every time before a new bunch of geometry is being drawn using this material with for example drawIndexedTriangleList() call.
/** OnSetMaterial should normally only be called if the renderer decides
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 method will be called every time. This is useful for
example for materials with shaders, which don't only set new
renderstates but also shader constants.
\param service: Pointer to interface providing methos for setting
constants and other things.
\param vtxtype: Vertex type with which the next rendering will be done.
This can be used by the material renderer to set some specific
optimized shaders or if this is an incompatible vertex type for this
renderer, to refuse rendering for example.
\return Returns true if everything is ok, and false if nothing should
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 during the
IVideoDriver::setMaterial() call before the new material will get the OnSetMaterial()
call. */
/** Called during the IVideoDriver::setMaterial() call before the new
material will get the OnSetMaterial() call. */
virtual void OnUnsetMaterial() {}
//! Returns if the material is transparent.

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -22,67 +22,78 @@ class IMaterialRendererServices
{
public:
//! destructor
//! Destructor
virtual ~IMaterialRendererServices() {}
//! Can be called by an IMaterialRenderer to make its work easier.
//! Sets all basic renderstates if needed.
//! Basic render states are diffuse, ambient, specular, and emissive color, specular power,
//! bilinear and trilinear filtering, wireframe mode,
//! grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and fog enabling.
/** Sets all basic renderstates if needed.
Basic render states are diffuse, ambient, specular, and emissive color,
specular power, bilinear and trilinear filtering, wireframe mode,
grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and
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,
bool resetAllRenderstates) = 0;
//! Sets a constant for the vertex shader based on a name. This can be used if you used
//! a high level shader language like GLSL or HLSL to create a shader. Example: If you
//! created a shader which has variables named 'mWorldViewProj' (containing the
//! WorldViewProjection matrix) and another one named 'fTime' containing one float,
//! you can set them in your IShaderConstantSetCallBack derived class like this:
//! \code
//! virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
//! {
//! video::IVideoDriver* driver = services->getVideoDriver();
//!
//! 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);
//! worldViewProj *= driver->getTransform(video::ETS_WORLD);
//! services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
//! }
//! \endcode
//! \param name: Name of the variable
//! \param floats: Pointer to array of floats
//! \param count: Amount of floats in array.
//! \return: Returns true if successful.
//! Sets a constant for the vertex shader based on a name.
/** This can be used if you used a high level shader language like GLSL
or HLSL to create a shader. Example: If you created a shader which has
variables named 'mWorldViewProj' (containing the WorldViewProjection
matrix) and another one named 'fTime' containing one float, you can set
them in your IShaderConstantSetCallBack derived class like this:
\code
virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
{
video::IVideoDriver* driver = services->getVideoDriver();
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);
worldViewProj *= driver->getTransform(video::ETS_WORLD);
services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
}
\endcode
\param name Name of the variable
\param floats Pointer to array of floats
\param count Amount of floats in array.
\return True if successful.
*/
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
//! pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program.
//! \param data: Data to be set in the constants
//! \param startRegister: First register to be set
//! \param constantAmount: Amount of registers to be set. One register consists of 4 floats.
//! Sets a vertex shader constant.
/** Can be used if you created a shader using pixel/vertex shader
assembler or ARB_fragment_program or ARB_vertex_program.
\param data: Data to be set in the constants
\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;
//! Sets a constant for the pixel shader based on a name. This can be used if you used
//! a high level shader language like GLSL or HLSL to create a shader. See
//! setVertexShaderConstant() for an example on how to use this.
//! \param name: Name of the variable
//! \param floats: Pointer to array of floats
//! \param count: Amount of floats in array.
//! \return: Returns true if successful.
//! Sets a constant for the pixel shader based on a name.
/** This can be used if you used a high level shader language like GLSL
or HLSL to create a shader. See setVertexShaderConstant() for an
example on how to use this.
\param name Name of the variable
\param floats Pointer to array of floats
\param count Amount of floats in array.
\return True if successful. */
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
//! pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program.
//! \param data: Data to be set in the constants
//! \param startRegister: First register to be set.
//! \param constantAmount: Amount of registers to be set. One register consists of 4 floats.
//! Sets a pixel shader constant.
/** Can be used if you created a shader using pixel/vertex shader
assembler or ARB_fragment_program or ARB_vertex_program.
\param data Data to be set in the constants
\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;
//! Returns a pointer to the IVideoDriver interface
//! Get pointer to the IVideoDriver interface
/** \return Pointer to the IVideoDriver interface */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -7,6 +7,7 @@
#include "IReferenceCounted.h"
#include "SMaterial.h"
#include "EHardwareBufferFlags.h"
namespace irr
{
@ -14,45 +15,57 @@ namespace scene
{
class IMeshBuffer;
//! Class for accessing a mesh with multiple mesh buffers.
/** An IMesh is nothing more than a collection of some mesh buffers (IMeshBuffer).
SMesh is a simple implementation of an IMesh.
//! Class which holds the geometry of an object.
/** An IMesh is nothing more than a collection of some mesh buffers
(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
{
public:
//! destructor
virtual ~IMesh() { }
//! Returns the amount of mesh buffers.
/** \return Returns the amount of mesh buffers (IMeshBuffer) in this mesh. */
//! Get the amount of mesh buffers.
/** \return Amount of mesh buffers (IMeshBuffer) in this mesh. */
virtual u32 getMeshBufferCount() const = 0;
//! Returns pointer to a mesh buffer.
/** \param nr: Zero based index of the mesh buffer. The maximum value is
//! Get pointer to a mesh buffer.
/** \param nr: Zero based index of the mesh buffer. The maximum value is
getMeshBufferCount() - 1;
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
\return Pointer to the mesh buffer or 0 if there is no such
mesh buffer. */
virtual IMeshBuffer* getMeshBuffer(u32 nr) const = 0;
//! Returns pointer to a mesh buffer which fits a material
/** \param material: material to search for
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
//! Get pointer to a mesh buffer which fits a material
/** \param material: material to search for
\return Pointer to the mesh buffer or 0 if there is no such
mesh buffer. */
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const = 0;
//! Returns an axis aligned bounding box of the mesh.
/** \return A bounding box of this mesh is returned. */
//! Get an axis aligned bounding box of the mesh.
/** \return Bounding box of this mesh. */
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;
//! Sets a flag of all contained materials to a new value.
/** \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;
//! 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

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -9,6 +9,8 @@
#include "SMaterial.h"
#include "aabbox3d.h"
#include "S3DVertex.h"
#include "SVertexIndex.h"
#include "EHardwareBufferFlags.h"
namespace irr
{
@ -54,60 +56,134 @@ namespace scene
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.
//! Struct for holding a mesh with a single material
/** SMeshBuffer is a simple implementation of a MeshBuffer. */
Since meshbuffers are used for drawing, and hence will be exposed
to the driver, chances are high that they are grab()'ed from somewhere.
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
{
public:
//! destructor
virtual ~IMeshBuffer() { }
//! returns the material of this meshbuffer
//! Get the material of this meshbuffer
/** \return Material of this buffer. */
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;
//! 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;
//! returns pointer to vertex data. The data is an array of vertices. Which vertex
//! type is used can be determined with getVertexType().
//! Get access to vertex data. The data is an array of vertices.
/** Which vertex type is used can be determined by getVertexType().
\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
//! type is used can be determined with getVertexType().
//! Get access to vertex data. The data is an array of vertices.
/** Which vertex type is used can be determined by getVertexType().
\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;
//! 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;
//! returns pointer to Indices
//! Get access to Indices.
/** \return Pointer to indices array. */
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;
//! 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;
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box) = 0;
//! Set axis aligned bounding box
/** \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;
//! 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;
//! 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;
//! 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
@ -115,3 +191,4 @@ namespace scene
#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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -18,96 +18,131 @@ namespace scene
class IAnimatedMeshSceneNode;
class IMeshLoader;
//! The mesh cache stores already loaded meshes and provides an interface to them.
/** You can access it using ISceneManager::getMeshCache(). All existing scene managers
will return a pointer to the same mesh cache, because it is shared between them. With
this interface, it is possible to manually add new loaded meshes (if
ISceneManager::getMesh() is not sufficient), to remove them and to iterate through
already loaded meshes. */
//! The mesh cache stores already loaded meshes and provides an interface to them.
/** You can access it using ISceneManager::getMeshCache(). All existing
scene managers will return a pointer to the same mesh cache, because it
is shared between them. With this interface, it is possible to manually
add new loaded meshes (if ISceneManager::getMesh() is not sufficient),
to remove them and to iterate through already loaded meshes. */
class IMeshCache : public virtual IReferenceCounted
{
public:
//! destructor
//! Destructor
virtual ~IMeshCache() {}
//! Adds a mesh to the internal list of loaded meshes.
/** Usually, ISceneManager::getMesh() is called to load a mesh from a file.
That method searches the list of loaded meshes if a mesh has already been loaded and
returns a pointer to if it is in that list and already in memory. Otherwise it loads
the mesh. With IMeshCache::addMesh(), it is possible to pretend that a mesh already
has been loaded. This method can be used for example by mesh loaders who need to
load more than one mesh with one call. They can add additional meshes with this
method to the scene manager. The COLLADA loader for example uses this method.
\param filename: Filename of the mesh. When called ISceneManager::getMesh() with this
parameter, the method will return the mesh parameter given with this method.
\param mesh: Pointer to a mesh which will now be referenced by this name. */
/** Usually, ISceneManager::getMesh() is called to load a mesh
from a file. That method searches the list of loaded meshes if
a mesh has already been loaded and returns a pointer to if it
is in that list and already in memory. Otherwise it loads the
mesh. With IMeshCache::addMesh(), it is possible to pretend
that a mesh already has been loaded. This method can be used
for example by mesh loaders who need to load more than one mesh
with one call. They can add additional meshes with this method
to the scene manager. The COLLADA loader for example uses this
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;
//! Removes a mesh from the cache.
/** After loading a mesh with getMesh(), the mesh can be removed from the cache
using this method, freeing a lot of memory. */
/** After loading a mesh with getMesh(), the mesh can be
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;
//! Removes a mesh from the cache.
/** After loading a mesh with getMesh(), the mesh can be removed from the cache
using this method, freeing a lot of memory. */
/** After loading a mesh with getMesh(), the mesh can be
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;
//! Returns amount of loaded meshes in the cache.
/** You can load new meshes into the cache using getMesh() and addMesh().
If you ever need to access the internal mesh cache, you can do this using
removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshFilename() */
/** You can load new meshes into the cache using getMesh() and
addMesh(). If you ever need to access the internal mesh cache,
you can do this using removeMesh(), getMeshNumber(),
getMeshByIndex() and getMeshFilename().
\return Number of meshes in cache. */
virtual u32 getMeshCount() const = 0;
//! 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;
//! 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;
//! Returns a mesh based on its index number.
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
Note that this number is only valid until a new mesh is loaded or removed *
\return Returns pointer to the mesh or 0 if there is none with this number. */
/** \param index: Index of the mesh, number between 0 and
getMeshCount()-1.
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;
//! Returns a mesh based on its file name.
/** \return Returns pointer to the mesh or 0 if there is none with this number. */
//! Returns a mesh based on its filename.
/** \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;
//! 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.
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;
//! Returns the filename of a loaded mesh, if there is any.
/** Returns 0 if there is none. */
//! Get the filename of a loaded mesh, if there is any.
/** \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;
//! Returns the filename of a loaded mesh, if there is any.
/* Returns 0 if there is none.*/
//! Get the filename of a loaded mesh, if there is any.
/** \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;
//! Renames a loaded mesh, if possible.
/** Returns true if sucessful. Note that renaming meshes might change
the ordering of the meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. */
//! Renames a loaded mesh.
/** Note that renaming meshes might change the ordering of the
meshes, and so the index of the meshes as returned by
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;
//! Renames a loaded mesh, if possible.
/** Returns true if sucessful. Note that renaming meshes might change
the ordering of the meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. */
//! Renames a loaded mesh.
/** Note that renaming meshes might change the ordering of the
meshes, and so the index of the meshes as returned by
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;
//! Renames a loaded mesh, if possible.
/** Returns true if sucessful. Note that renaming meshes might change
the ordering of the meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. */
//! Renames a loaded mesh.
/** Note that renaming meshes might change the ordering of the
meshes, and so the index of the meshes as returned by
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;
//! 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;
//! Clears the whole mesh cache, removing all meshes.

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,24 +17,28 @@ namespace scene
{
class IAnimatedMesh;
//! Class which is able to load an animated mesh from a file.
/** If you want the Irrlicht Engine be able to load meshes of
currently unsupported file formats (e.g .cob), then implement
this and add your new Surface loader with
//! Class which is able to load an animated mesh from a file.
/** If you want Irrlicht be able to load meshes of
currently unsupported file formats (e.g. .cob), then implement
this and add your new Meshloader with
ISceneManager::addExternalMeshLoader() to the engine. */
class IMeshLoader : public virtual IReferenceCounted
{
public:
//! destructor
//! Destructor
virtual ~IMeshLoader() {}
//! Returns true if the file maybe is able to be loaded by this class.
/** This decision should be based only on the file extension (e.g. ".cob") */
//! Returns true if the file might be loaded by this class.
/** 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;
//! 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().
See IReferenceCounted::drop() for more information. */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,96 +21,165 @@ namespace scene
class IMeshBuffer;
struct SMesh;
//! An interface for easily manipulate meshes.
/** Scale, set alpha value, flip surfaces, and so on. This exists for fixing problems
with wrong imported or exported meshes quickly after loading. It is not intended for doing mesh
modifications and/or animations during runtime.
//! An interface for easy manipulation of meshes.
/** Scale, set alpha value, flip surfaces, and so on. This exists for
fixing problems with wrong imported or exported meshes quickly after
loading. It is not intended for doing mesh modifications and/or
animations during runtime.
*/
class IMeshManipulator : public virtual IReferenceCounted
{
public:
//! destructor
virtual ~IMeshManipulator() {}
//! Flips the direction of surfaces.
/** Changes backfacing triangles to frontfacing
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;
//! Sets the alpha vertex color value of the whole mesh to a new value.
/** \param mesh: Mesh on which the operation is performed.
\param alpha: New alpha value. Must be a value between 0 and 255. */
/** \param mesh Mesh on which the operation is performed.
\param alpha New alpha value. Must be a value between 0 and 255. */
virtual void setVertexColorAlpha(IMesh* mesh, s32 alpha) const = 0;
//! 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;
//! Recalculates all normals of the mesh.
/** \param mesh: Mesh on which the operation is performed.
\param smooth: If the normals shall be smoothed. */
virtual void recalculateNormals(IMesh* mesh, bool smooth = false) const = 0;
\param smooth: If the normals shall be smoothed.
\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.
/** \param buffer: Mesh buffer on which the operation is performed.
\param smooth: If the normals shall be smoothed. */
virtual void recalculateNormals(IMeshBuffer* buffer, bool smooth = false) const = 0;
\param smooth: If the normals shall be smoothed.
\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.
/** \param mesh: Mesh on which the operation is performed.
\param scale: Scale factor. */
virtual void scaleMesh(IMesh* mesh, const core::vector3df& scale) const = 0;
//! Scales the actual mesh, not a scene node.
/** \param mesh Mesh on which the operation is performed.
\param factor Scale factor for each axis. */
virtual void scale(IMesh* mesh, const core::vector3df& factor) const = 0;
//! Applies a transformation
/** \param mesh: Mesh on which the operation is performed.
\param m: transformation matrix. */
virtual void transformMesh(IMesh* mesh, const core::matrix4& m) const = 0;
//! Scales the actual meshbuffer, not a scene node.
/** \param buffer Meshbuffer on which the operation is performed.
\param factor Scale factor for each axis. */
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
are of type SMeshBuffer or SMeshBufferLightMap.
\param mesh: Mesh to copy.
\return Returns the cloned mesh.
If you no longer need the cloned mesh, you should call SMesh::drop().
See IReferenceCounted::drop() for more information. */
\param mesh Mesh to copy.
\return Cloned mesh. If you no longer need the
cloned mesh, you should call SMesh::drop(). See
IReferenceCounted::drop() for more information. */
virtual SMesh* createMeshCopy(IMesh* mesh) const = 0;
//! Creates a planar texture mapping on the mesh
/** \param mesh: Mesh on which the operation is performed.
\param resolution: resolution of the planar mapping. This is the value
specifying which is the relation between world space and
texture coordinate space. */
\param resolution: resolution of the planar mapping. This is
the value specifying which is the relation between world space
and texture coordinate space. */
virtual void makePlanarTextureMapping(IMesh* mesh, f32 resolution=0.001f) const = 0;
//! 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
it calculates the tangent and binormal data which is needed there.
\param mesh: Input mesh
\return Mesh consiting 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) const = 0;
/** This is useful if you want to draw tangent space normal
mapped geometry because it calculates the tangent and binormal
data which is needed there.
\param mesh Input mesh
\param recalculateNormals The normals are recalculated if set,
otherwise the original ones are kept. Note that keeping the
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.
/** \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;
//! 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;
//! 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;
//! 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;
//! 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;
//! 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,
scene::E_ANIMATED_MESH_TYPE type = scene::EAMT_UNKNOWN) const = 0;
};
} // 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -20,24 +20,32 @@ class IMeshSceneNode : public ISceneNode
{
public:
//! constructor
//! Constructor
/** Use setMesh() to set the mesh to display.
*/
IMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position, const core::vector3df& rotation,
const core::vector3df& position,
const core::vector3df& rotation,
const core::vector3df& scale)
: ISceneNode(parent, mgr, id, position, rotation, scale) {}
//! Sets a new mesh to display
/** \param mesh Mesh to display. */
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;
//! 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
referencing this mesh to change too. */
/** In this way it is possible to change the materials of a mesh
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;
//! 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;
};

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__
#define __IRR_I_MESH_WRITER_H_INCLUDED__
@ -15,24 +19,30 @@ namespace scene
{
class IMesh;
// interface for writing meshes
//! Interface for writing meshes
class IMeshWriter : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IMeshWriter() {}
//! Returns the type of the mesh writer
/** For own implementations, use MAKE_IRR_ID as shown in the EMESH_WRITER_TYPE
enumeration to return your own unique mesh type id.*/
//! Get the type of the mesh writer
/** For own implementations, use MAKE_IRR_ID as shown in the
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;
//! writes a static mesh
/** \return Returns true if sucessful */
//! Write a static mesh.
/** \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,
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
/* \return Returns true if sucessful */
//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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,15 +21,14 @@ class IMetaTriangleSelector : public ITriangleSelector
{
public:
//! 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.
//! Adds a triangle selector to the collection of triangle selectors.
/** \param toAdd: Pointer to an triangle selector to add to the list. */
virtual void addTriangleSelector(ITriangleSelector* toAdd) = 0;
//! Removes a specific triangle selector which was added before from the collection.
//! \param toRemove: Pointer to an triangle selector which is in the list
//! but will be removed.
//! \return Returns true if successful, false if not.
//! Removes a specific triangle selector from the collection.
/** \param toRemove: Pointer to an triangle selector which is in the
list but will be removed.
\return True if successful, false if not. */
virtual bool removeTriangleSelector(ITriangleSelector* toRemove) = 0;
//! 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -15,28 +15,28 @@ class IOSOperator : public virtual IReferenceCounted
{
public:
//! destructor
//! Destructor
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;
//! copies text to the clipboard
//! Copies text to the clipboard
virtual void copyToClipboard(const c8* text) const = 0;
//! gets text from the clipboard
//! \return Returns 0 if no string is in there.
//! Get text from the clipboard
/** \return Returns 0 if no string is in there. */
virtual c8* getTextFromClipboard() const = 0;
//! gets the processor speed in megahertz
//! \param MHz: The integer variable to store the speed in.
//! \return Returns true if successful, false if not
//! Get the processor speed in megahertz
/** \param MHz The integer variable to store the speed in.
\return True if successful, false if not */
virtual bool getProcessorSpeedMHz(u32* MHz) const = 0;
//! gets the total and available system RAM
//! \param Total: will contain the total system memory
//! \param Avail: will contain the available memory
//! \return Returns true if successful, false if not
//! Get the total and available system RAM
/** \param Total: will contain the total system memory
\param Avail: will contain the available memory
\return True if successful, false if not */
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".
// 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_GRAVITY,
EPAT_ROTATE,
EPAT_SCALE,
EPAT_COUNT
};
@ -32,6 +33,7 @@ const c8* const ParticleAffectorTypeNames[] =
"FadeOut",
"Gravity",
"Rotate",
"Scale",
0
};
@ -44,9 +46,9 @@ public:
IParticleAffector() : Enabled(true) {}
//! Affects an array of particles.
//! \param now: Current time. (Same as ITimer::getTime() would return)
//! \param particlearray: Array of particles.
//! \param count: Amount of particles in array.
/** \param now Current time. (Same as ITimer::getTime() would return)
\param particlearray Array of particles.
\param count Amount of particles in array. */
virtual void affect(u32 now, SParticle* particlearray, u32 count) = 0;
//! Sets whether or not the affector is currently enabled.
@ -56,17 +58,17 @@ public:
virtual bool getEnabled() const { return Enabled; }
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
/** Implement this to expose the attributes of your scene node animator for
scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
//! \param startIndex: start index where to start reading attributes.
//! \param in: The attributes to work with.
//! \param options: Additional options.
//! \return: returns last index of an attribute read by this affector
/** Implement this to set the attributes of your scene node animator for
scripting languages, editors, debuggers or xml deserialization purposes.
\param startIndex start index where to start reading attributes.
\param in The attributes to work with.
\param options Additional options.
\return Last index of an attribute read by this affector */
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; }
//! 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".
// 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
virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) = 0;
//! Sets whether to emit min<->max particles for every vertex per
//! second, or to pick min<->max vertices every second
//! Sets whether to emit min<->max particles for every vertex or to pick min<->max vertices
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;
//! 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
virtual f32 getNormalDirectionModifier() const = 0;
//! Gets whether to emit min<->max particles for every vertex per
//! second, or to pick min<->max vertices every second
//! Gets whether to emit min<->max particles for every vertex or to pick min<->max vertices
virtual bool getEveryMeshVertex() const = 0;
//! 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".
// 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".
// 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".
// 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -47,12 +47,11 @@ class IParticleEmitter : public virtual io::IAttributeExchangingObject
public:
//! Prepares an array with new particles to emitt into the system
//! and returns how much new particles there are.
//! \param now: Current time.
//! \param timeSinceLastCall: Time elapsed since last call, in milliseconds.
//! \param outArray: Pointer which will point to the array with the new
//! particles to add into the system.
//! \return Returns amount of new particles in the array. Can be 0.
/** \param now Current time.
\param timeSinceLastCall Time elapsed since last call, in milliseconds.
\param outArray Pointer which will point to the array with the new
particles to add into the system.
\return Amount of new particles in the array. Can be 0. */
virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray) = 0;
//! Set direction the emitter emits particles
@ -70,6 +69,12 @@ public:
//! Set maximum starting color for particles
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
virtual const core::vector3df& getDirection() const = 0;
@ -85,19 +90,27 @@ public:
//! Get the maximum starting color for particles
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.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}
/** Implement this to expose the attributes of your scene node animator for
scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out,
io::SAttributeReadWriteOptions* options=0) const {}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
//! \param startIndex: start index where to start reading attributes.
//! \param in: The attributes to work with.
//! \param options: Additional options.
//! \return: returns last index of an attribute read by this affector
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; }
/** Implement this to set the attributes of your scene node animator for
scripting languages, editors, debuggers or xml deserialization purposes.
\param startIndex start index where to start reading attributes.
\param in The attributes to work with.
\param options Additional options.
\return Last index of an attribute read by this affector */
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in,
io::SAttributeReadWriteOptions* options=0) { return 0; }
//! Get emitter type
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,15 +17,13 @@ class IParticleFadeOutAffector : public IParticleAffector
{
public:
//! Sets the targetColor, i.e. the color the particles will interpolate
//! to over time.
//! Sets the targetColor, i.e. the color the particles will interpolate to over time.
virtual void setTargetColor( const video::SColor& targetColor ) = 0;
//! Sets the amount of time it takes for each particle to fade out.
virtual void setFadeOutTime( f32 fadeOutTime ) = 0;
//! Gets the targetColor, i.e. the color the particles will interpolate
//! to over time.
//! Gets the targetColor, i.e. the color the particles will interpolate to over time.
virtual const video::SColor& getTargetColor() const = 0;
//! 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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -17,15 +17,14 @@ class IParticleGravityAffector : public IParticleAffector
{
public:
//! Set the time in milliseconds when the gravity force is totally
//! lost and the particle does not move any more.
//! Set the time in milliseconds when the gravity force is totally lost
/** At that point the particle does not move any more. */
virtual void setTimeForceLost( f32 timeForceLost ) = 0;
//! Set the direction and force of gravity in all 3 dimensions.
virtual void setGravity( const core::vector3df& gravity ) = 0;
//! Get the time in milliseconds when the gravity force is totally
//! lost and the particle does not move any more.
//! Get the time in milliseconds when the gravity force is totally lost
virtual f32 getTimeForceLost() const = 0;
//! 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".
// 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
virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) = 0;
//! Sets whether to emit min<->max particles for every vertex per second, or to pick
//! min<->max vertices every second
//! Sets whether to emit min<->max particles for every vertex or to pick min<->max vertices
virtual void setEveryMeshVertex( bool everyMeshVertex = true ) = 0;
//! 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
virtual f32 getNormalDirectionModifier() const = 0;
//! Gets whether to emit min<->max particles for every vertex per second, or to pick
//! min<->max vertices every second
//! Gets whether to emit min<->max particles for every vertex or to pick min<->max vertices
virtual bool getEveryMeshVertex() const = 0;
//! 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".
// 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".
// 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".
// 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".
// 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 scene node controlling a particle System. The behavior of the particles
can be controlling by setting the right particle emitters and effectors.
You can for example easily a campfire by doing this:
can be controlled by setting the right particle emitters and affectors.
You can for example easily create a campfire by doing this:
\code
scene::IParticleSystemSceneNode* p = scenemgr->addParticleSystemSceneNode();
@ -47,7 +47,7 @@ class IParticleSystemSceneNode : public ISceneNode
{
public:
//! constructor
//! Constructor
IParticleSystemSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& rotation = core::vector3df(0,0,0),
@ -58,101 +58,126 @@ public:
virtual void setParticleSize(
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
//! the movement of the particle system scene node too, otherwise they completely
//! ignore it. Default is true.
virtual void setParticlesAreGlobal(bool global) = 0;
//! Sets if the particles should be global.
/** If they are, the particles are affected by the movement of the
particle system scene node too, otherwise they completely ignore it.
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.
//! A particle emitter can be created using one of the
//! methods. For example to create and use a simple PointEmitter,
//! call IParticleEmitter* p = createPointEmitter(); setEmitter(p); p->drop();
//! \param emitter: Sets the particle emitter. You can set this to 0
//! for removing the current emitter and stopping the particle system
//! emitting new particles.
/** A particle emitter can be created using one of the createEmitter
methods. For example to create and use a simple PointEmitter, call
IParticleEmitter* p = createPointEmitter(); setEmitter(p); p->drop();
\param emitter: Sets the particle emitter. You can set this to 0 for
removing the current emitter and stopping the particle system emitting
new particles. */
virtual void setEmitter(IParticleEmitter* emitter) = 0;
//! Adds new particle effector to the particle system. A particle
//! affector modifies the particles. For example, the FadeOut
//! affector lets all particles fade out after some time. It is created
//! and used in this way: IParticleAffector* p = createFadeOutParticleAffector();
//! addAffector(p); p->drop();
//! Please note that a affector is not necessary for the particle
//! system to work.
//! \param affector: New affector.
//! Adds new particle effector to the particle system.
/** A particle affector modifies the particles. For example, the FadeOut
affector lets all particles fade out after some time. It is created and
used in this way:
\code
IParticleAffector* p = createFadeOutParticleAffector();
addAffector(p);
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;
//! Removes all particle affectors in the particle system.
virtual void removeAllAffectors() = 0;
//! Creates a particle emitter for an animated mesh scene node
//! \param node: Pointer to the animated mesh scene node to emit particles from
//! \param useNormalDirection: If true, the direction of each particle created will
//! be the normal of the vertex that it's emitting from. The normal is divided by the
//! normalDirectionModifier parameter, which defaults to 100.0f.
//! \param direction: Direction and speed of particle emission.
//! \param normalDirectionModifier: If the emitter is using the normal direction
//! then the normal of the vertex that is being emitted from is divided by this number.
//! \param mbNumber: This allows you to specify a specific meshBuffer for the IMesh*
//! to emit particles from. The default value is -1, which means a random meshBuffer
//! picked from all of the meshes meshBuffers will be selected to pick a random vertex from.
//! If the value is 0 or greater, it will only pick random vertices from the meshBuffer
//! specified by this value.
//! \param everyMeshVertex: If true, the emitter will emit between min/max particles every second,
//! for every vertex in the mesh, if false, it will emit between min/max particles from random vertices
//! in the mesh.
//! \param minParticlesPerSecond: Minimal amount of particles emitted
//! per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted
//! per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a 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.
/** \param node: Pointer to the animated mesh scene node to emit
particles from
\param useNormalDirection: If true, the direction of each particle
created will be the normal of the vertex that it's emitting from. The
normal is divided by the normalDirectionModifier parameter, which
defaults to 100.0f.
\param direction: Direction and speed of particle emission.
\param normalDirectionModifier: If the emitter is using the normal
direction then the normal of the vertex that is being emitted from is
divided by this number.
\param mbNumber: This allows you to specify a specific meshBuffer for
the IMesh* to emit particles from. The default value is -1, which
means a random meshBuffer picked from all of the meshes meshBuffers
will be selected to pick a random vertex from. If the value is 0 or
greater, it will only pick random vertices from the meshBuffer
specified by this value.
\param everyMeshVertex: If true, the emitter will emit between min/max
particles every second, for every vertex in the mesh, if false, it will
emit between min/max particles from random vertices in the mesh.
\param minParticlesPerSecond: Minimal amount of particles emitted per
second.
\param maxParticlesPerSecond: Maximal amount of particles emitted per
second.
\param minStartColor: Minimal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param maxStartColor: Maximal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\param maxAngleDegrees: Maximal angle in degrees, the emitting
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 IParticleAnimatedMeshSceneNodeEmitter* createAnimatedMeshSceneNodeEmitter(
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,
bool everyMeshVertex = false,
u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255),
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.
//! \param box: The box for the emitter.
//! \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted
//! per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted
//! per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a 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.
/** \param box: The box for the emitter.
\param direction: Direction and speed of particle emission.
\param minParticlesPerSecond: Minimal amount of particles emitted per
second.
\param maxParticlesPerSecond: Maximal amount of particles emitted per
second.
\param minStartColor: Minimal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param maxStartColor: Maximal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\param maxAngleDegrees: Maximal angle in degrees, the emitting
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 IParticleBoxEmitter* createBoxEmitter(
const core::aabbox3df& box = core::aabbox3df(-10,28,-10,10,30,10),
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& maxStartColor = video::SColor(255,255,255,255),
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
//! \param center: The center of the circle at the base of the cylinder
//! \param radius: The thickness of the cylinder
//! \param normal: Direction of the length of 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 direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a 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.
/** \param center: The center of the circle at the base of the cylinder
\param radius: The thickness of the cylinder
\param normal: Direction of the length of 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 direction: Direction and speed of particle emission.
\param minParticlesPerSecond: Minimal amount of particles emitted per
second.
\param maxParticlesPerSecond: Maximal amount of particles emitted per
second.
\param minStartColor: Minimal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param maxStartColor: Maximal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\param maxAngleDegrees: Maximal angle in degrees, the emitting
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 IParticleCylinderEmitter* createCylinderEmitter(
const core::vector3df& center, f32 radius,
const core::vector3df& normal, f32 length,
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,
const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255),
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.
//! \param mesh: Pointer to mesh to emit particles from
//! \param useNormalDirection: If true, the direction of each particle created will
//! be the normal of the vertex that it's emitting from. The normal is divided by the
//! normalDirectionModifier parameter, which defaults to 100.0f.
//! \param direction: Direction and speed of particle emission.
//! \param normalDirectionModifier: If the emitter is using the normal direction
//! then the normal of the vertex that is being emitted from is divided by this number.
//! \param mbNumber: This allows you to specify a specific meshBuffer for the IMesh*
//! to emit particles from. The default value is -1, which means a random meshBuffer
//! picked from all of the meshes meshBuffers will be selected to pick a random vertex from.
//! If the value is 0 or greater, it will only pick random vertices from the meshBuffer
//! specified by this value.
//! \param everyMeshVertex: If true, the emitter will emit between min/max particles every second,
//! for every vertex in the mesh, if false, it will emit between min/max particles from random vertices
//! in the mesh.
//! \param minParticlesPerSecond: Minimal amount of particles emitted per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a 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.
/** \param mesh: Pointer to mesh to emit particles from
\param useNormalDirection: If true, the direction of each particle
created will be the normal of the vertex that it's emitting from. The
normal is divided by the normalDirectionModifier parameter, which
defaults to 100.0f.
\param direction: Direction and speed of particle emission.
\param normalDirectionModifier: If the emitter is using the normal
direction then the normal of the vertex that is being emitted from is
divided by this number.
\param mbNumber: This allows you to specify a specific meshBuffer for
the IMesh* to emit particles from. The default value is -1, which
means a random meshBuffer picked from all of the meshes meshBuffers
will be selected to pick a random vertex from. If the value is 0 or
greater, it will only pick random vertices from the meshBuffer
specified by this value.
\param everyMeshVertex: If true, the emitter will emit between min/max
particles every second, for every vertex in the mesh, if false, it will
emit between min/max particles from random vertices in the mesh.
\param minParticlesPerSecond: Minimal amount of particles emitted per
second.
\param maxParticlesPerSecond: Maximal amount of particles emitted per
second.
\param minStartColor: Minimal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param maxStartColor: Maximal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\param maxAngleDegrees: Maximal angle in degrees, the emitting
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(
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,
bool everyMeshVertex = false,
u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255),
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.
//! \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted
//! per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted
//! per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a 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.
/** \param direction: Direction and speed of particle emission.
\param minParticlesPerSecond: Minimal amount of particles emitted per
second.
\param maxParticlesPerSecond: Maximal amount of particles emitted per
second.
\param minStartColor: Minimal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param maxStartColor: Maximal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\param maxAngleDegrees: Maximal angle in degrees, the emitting
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 IParticlePointEmitter* createPointEmitter(
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
u32 minParticlesPerSecond = 5,
@ -270,34 +324,41 @@ public:
const video::SColor& minStartColor = video::SColor(255,0,0,0),
const video::SColor& maxStartColor = video::SColor(255,255,255,255),
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.
//! \param center: Center of ring
//! \param radius: Distance of points from center, points will be rotated around the
//! Y axis at a random 360 degrees and will then be shifted by the provided ringThickness
//! values in each axis.
//! \param ringThickness : thickness of the ring or how wide the ring is
//! \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted
//! per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted
//! per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a 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.
/** \param center: Center of ring
\param radius: Distance of points from center, points will be rotated
around the Y axis at a random 360 degrees and will then be shifted by
the provided ringThickness values in each axis.
\param ringThickness : thickness of the ring or how wide the ring is
\param direction: Direction and speed of particle emission.
\param minParticlesPerSecond: Minimal amount of particles emitted per
second.
\param maxParticlesPerSecond: Maximal amount of particles emitted per
second.
\param minStartColor: Minimal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param maxStartColor: Maximal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\param maxAngleDegrees: Maximal angle in degrees, the emitting
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 IParticleRingEmitter* createRingEmitter(
const core::vector3df& center, f32 radius, f32 ringThickness,
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& maxStartColor = video::SColor(255,255,255,255),
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.
//! \param center: Center of sphere
//! \param radius: Radius of sphere
//! \param direction: Direction and speed of particle emission.
//! \param minParticlesPerSecond: Minimal amount of particles emitted
//! per second.
//! \param maxParticlesPerSecond: Maximal amount of particles emitted
//! per second.
//! \param minStartColor: Minimal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param maxStartColor: Maximal initial start color of a particle.
//! The real color of every particle is calculated as random interpolation
//! between minStartColor and maxStartColor.
//! \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
//! \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
//! \param maxAngleDegrees: Maximal angle in degrees, the emitting direction
//! of the particle will differ from the orignial direction.
//! \return Returns a 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.
/** \param center: Center of sphere
\param radius: Radius of sphere
\param direction: Direction and speed of particle emission.
\param minParticlesPerSecond: Minimal amount of particles emitted per
second.
\param maxParticlesPerSecond: Maximal amount of particles emitted per
second.
\param minStartColor: Minimal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param maxStartColor: Maximal initial start color of a particle. The
real color of every particle is calculated as random interpolation
between minStartColor and maxStartColor.
\param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\param maxAngleDegrees: Maximal angle in degrees, the emitting
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 IParticleSphereEmitter* createSphereEmitter(
const core::vector3df& center, f32 radius,
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& maxStartColor = video::SColor(255,255,255,255),
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
//! particles and attracts them to a specified point at a specified speed per second.
//! \param point: Point to attract particles to.
//! \param speed: Speed in units per second, to attract to the specified point.
//! \param attract: Whether the particles attract or detract from this point.
//! \param affectX: Whether or not this will affect the X position of the particle.
//! \param affectY: Whether or not this will affect the Y position of the particle.
//! \param affectZ: Whether or not this will affect the Z position of the particle.
//! \return Returns a 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.
//! Creates a point attraction affector.
/** This affector modifies the positions of the particles and attracts
them to a specified point at a specified speed per second.
\param point: Point to attract particles to.
\param speed: Speed in units per second, to attract to the specified
point.
\param attract: Whether the particles attract or detract from this
point.
\param affectX: Whether or not this will affect the X position of the
particle.
\param affectY: Whether or not this will affect the Y position of the
particle.
\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(
const core::vector3df& point, f32 speed = 1.0f, bool attract = true,
bool affectX = true, bool affectY = true, bool affectZ = true) = 0;
//! Creates a fade out particle affector. This affector modifies
//! the color of every particle and and reaches 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 Returns a 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.
//! Creates a scale particle affector.
/** This affector scales the particle to the a multiple of its size defined
by the scaleTo variable.
\param scaleTo: multiple of the size which the particle will be scaled to until deletion
\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 information. */
virtual IParticleAffector* createScaleParticleAffector(const core::dimension2df& scaleTo = core::dimension2df(1.0f, 1.0f)) = 0;
//! Creates a fade out particle affector.
/** This affector modifies the color of every particle and and reaches
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(
const video::SColor& targetColor = video::SColor(0,0,0,0),
u32 timeNeededToFadeOut = 1000) = 0;
//! Creates a gravity affector. This affector modifies the direction
//! of the particle. It assumes that the particle is fired out of the
//! emitter with huge force, but is loosing this after some time
//! and is catched by the gravity then. This affector is ideal for
//! creating things like fountains.
//! \param gravity: Direction and force of gravity.
//! \param timeForceLost: Time in milli seconds when the force
//! of the emitter is totally lost and the particle does not move any more.
//! This is the time where gravity fully affects the particle.
//! \return Returns a 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.
//! Creates a gravity affector.
/** This affector modifies the direction of the particle. It assumes
that the particle is fired out of the emitter with huge force, but is
loosing this after some time and is catched by the gravity then. This
affector is ideal for creating things like fountains.
\param gravity: Direction and force of gravity.
\param timeForceLost: Time in milli seconds when the force of the
emitter is totally lost and the particle does not move any more. This
is the time where gravity fully affects 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 IParticleGravityAffector* createGravityAffector(
const core::vector3df& gravity = core::vector3df(0.0f,-0.03f,0.0f),
u32 timeForceLost = 1000) = 0;
//! Creates a rotation affector. This affector modifies the positions of the
//! particles and attracts them to a specified point at a specified speed per second.
//! \param speed: Rotation in degrees per second
//! \param pivotPoint: Point to rotate the particles around
//! \return Returns a 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.
//! Creates a rotation affector.
/** This affector modifies the positions of the particles and attracts
them to a specified point at a specified speed per second.
\param speed: Rotation in degrees per second
\param pivotPoint: Point to rotate the particles around
\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 IParticleRotationAffector* createRotationAffector(
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;

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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,18 +21,18 @@ namespace scene
public:
//! releases a Mesh from the Q3 Loader
virtual void releaseMesh ( s32 index ) = 0;
virtual void releaseMesh(s32 index) = 0;
//! loads the shader definition
// either from file ( we assume /scripts on fileNameIsValid == 0 )
virtual const quake3::SShader * getShader ( const c8 * filename, s32 fileNameIsValid ) = 0;
//! loads the shader definition from file
/** \param filename Name of the shaderfile, defaults to /scripts if fileNameIsValid is false.
\param fileNameIsValid Specifies whether the filename is valid in the current situation. */
virtual const quake3::SShader* getShader( const c8* filename, bool fileNameIsValid=true ) = 0;
//! 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
virtual const quake3::tQ3EntityList & getEntityList () = 0;
virtual const quake3::tQ3EntityList& getEntityList() = 0;
};
} // 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".
// 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.
// define the standard multiplication for lightmaps and vertex colors
const video::E_MATERIAL_TYPE defaultLightMap = video::EMT_LIGHTMAP_M2;
const video::E_MODULATE_FUNC defaultModulate = video::EMFN_MODULATE_2X;
const video::E_MATERIAL_TYPE defaultMaterialType = video::EMT_LIGHTMAP_M4;
const video::E_MODULATE_FUNC defaultModulate = video::EMFN_MODULATE_4X;
// some useful typedefs
typedef core::array< core::stringc > tStringList;
@ -132,16 +132,22 @@ namespace quake3
}
//! A blend function for a q3 shader.
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_MODULATE_FUNC modulate;
f32 param;
bool isTransparent;
};
// parses the content of Variable cull
inline bool getBackfaceCulling ( const core::stringc &string )
inline bool isDisabled ( const core::stringc &string )
{
if ( string.size() == 0 )
return true;
@ -168,7 +174,7 @@ namespace quake3
return 1;
u32 ret = 1;
static const c8 * funclist[] = { "lequal","equal" };
static const c8 * funclist[] = { "lequal","equal" };
u32 pos = 0;
switch ( isEqual ( string, pos, funclist, 2 ) )
@ -183,7 +189,6 @@ namespace quake3
}
// parses the content of Variable blendfunc,alphafunc
inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc )
{
@ -231,12 +236,14 @@ namespace quake3
// gl_one gl_zero
case video::EBF_ZERO:
blendfunc.type = video::EMT_SOLID;
blendfunc.isTransparent = false;
resolved = 1;
break;
// gl_one gl_one
case video::EBF_ONE:
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
blendfunc.isTransparent = true;
resolved = 1;
break;
} break;
@ -248,6 +255,7 @@ namespace quake3
case video::EBF_ONE_MINUS_SRC_ALPHA:
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
resolved = 1;
break;
} break;
@ -255,30 +263,35 @@ namespace quake3
case 11:
// add
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
blendfunc.isTransparent = true;
resolved = 1;
break;
case 12:
// filter = gl_dst_color gl_zero
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
blendfunc.param = video::pack_texureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, defaultModulate );
blendfunc.isTransparent = false;
resolved = 1;
break;
case 13:
// blend
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
resolved = 1;
break;
case 14:
// alphafunc ge128
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
blendfunc.param = 0.5f;
blendfunc.isTransparent = true;
resolved = 1;
break;
case 15:
// alphafunc gt0
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
resolved = 1;
break;
}
@ -290,14 +303,24 @@ namespace quake3
blendfunc.param = video::pack_texureBlendFunc (
(video::E_BLEND_FACTOR) srcFact,
(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
{
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) {}
// "tcmod","deformvertexes","rgbgen", "tcgen"
@ -442,6 +465,7 @@ namespace quake3
core::array < SVarGroup > VariableGroup;
};
//! A Parsed Shader Holding Variables ordered in Groups
class SShader
{
@ -470,7 +494,7 @@ namespace quake3
// Shader: shader name ( also first variable in first Vargroup )
// Entity: classname ( variable in Group(1) )
core::stringc name;
SVarGroupList *VarGroup; // reference
SVarGroupList *VarGroup; // reference
};
typedef SShader SEntity;
@ -535,7 +559,7 @@ namespace quake3
for ( u32 i = 0; i != size; ++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 )
@ -554,11 +578,10 @@ namespace quake3
load one or multiple files stored in name started at startPos to the texture array textures
if texture is not loaded 0 will be added ( to find missing textures easier)
*/
inline void getTextures ( tTexArray &textures ,
const core::stringc &name, u32 &startPos,
io::IFileSystem *fileSystem,
video::IVideoDriver* driver
)
inline void getTextures(tTexArray &textures,
const core::stringc &name, u32 &startPos,
io::IFileSystem *fileSystem,
video::IVideoDriver* driver)
{
static const char * extension[2] =
{
@ -594,9 +617,7 @@ namespace quake3
}
/*!
Manages various Quake3 Shader Styles
*/
//! Manages various Quake3 Shader Styles
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -16,33 +16,30 @@ namespace io
class IReadFile : public virtual IReferenceCounted
{
public:
virtual ~IReadFile() {}
//! Reads an amount of bytes from the file.
//! \param buffer: Pointer to buffer where to read bytes will be written to.
//! \param sizeToRead: Amount of bytes to read from the file.
//! \return Returns how much bytes were read.
/** \param buffer Pointer to buffer where read bytes are written to.
\param sizeToRead Amount of bytes to read from the file.
\return How much bytes were read. */
virtual s32 read(void* buffer, u32 sizeToRead) = 0;
//! Changes position in file, returns true if successful.
//! \param finalPos: Destination position in the file.
//! \param relativeMovement: If set to true, the position in the file is
//! changed relative to current position. Otherwise the position is changed
//! from beginning of file.
//! \return Returns true if successful, otherwise false.
//! Changes position in file
/** \param finalPos Destination position in the file.
\param relativeMovement If set to true, the position in the file is
changed relative to current position. Otherwise the position is changed
from beginning of file.
\return True if successful, otherwise false. */
virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
//! Returns size of file.
//! \return Returns the size of the file in bytes.
//! Get size of file.
/** \return Size of the file in bytes. */
virtual long getSize() const = 0;
//! Returns the current position in the file.
//! \return Returns the current position in the file in bytes.
//! Get the current position in the file.
/** \return Current position in the file in bytes. */
virtual long getPos() const = 0;
//! Returns name of file.
//! \return Returns the file name as zero terminated character string.
//! Get name of file.
/** \return File name as zero terminated character string. */
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -54,64 +54,69 @@ namespace irr
}
//! Grabs the object. Increments the reference counter by one.
//! Someone who calls grab() to an object, should later also call
//! drop() to it. If an object never gets as much drop() as grab()
//! calls, it will never be destroyed.
//! The IReferenceCounted class provides a basic reference counting mechanism
//! with its methods grab() and drop(). Most objects of 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
//! 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
//! 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,
//! and the method had a 'create' in it.
//!
//! A simple example:
//!
//! If you want to create a texture, you may want to call an imaginable method
//! IDriver::createTexture. You call
//! ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
//! If you no longer need the texture, call texture->drop().
//! If you want to load a texture, you may want to call imaginable method
//! IDriver::loadTexture. You do this like
//! ITexture* texture = driver->loadTexture("example.jpg");
//! 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.
/** Someone who calls grab() to an object, should later also
call drop() to it. If an object never gets as much drop() as
grab() calls, it will never be destroyed. The
IReferenceCounted class provides a basic reference counting
mechanism with its methods grab() and drop(). Most objects of
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 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 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, and the
method had a 'create' in it.
A simple example:
If you want to create a texture, you may want to call an
imaginable method IDriver::createTexture. You call
ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
If you no longer need the texture, call texture->drop().
If you want to load a texture, you may want to call imaginable
method IDriver::loadTexture. You do this like
ITexture* texture = driver->loadTexture("example.jpg");
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; }
//! Drops the object. Decrements the reference counter by one.
//! Returns true, if the object was deleted.
//! The IReferenceCounted class provides a basic reference counting mechanism
//! with its methods grab() and drop(). Most objects of 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
//! 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
//! 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,
//! and the method had a 'create' in it.
//!
//! A simple example:
//!
//! If you want to create a texture, you may want to call an imaginable method
//! IDriver::createTexture. You call
//! ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
//! If you no longer need the texture, call texture->drop().
//! If you want to load a texture, you may want to call imaginable method
//! IDriver::loadTexture. You do this like
//! ITexture* texture = driver->loadTexture("example.jpg");
//! 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.
/** The IReferenceCounted class provides a basic reference
counting mechanism with its methods grab() and drop(). Most
objects of 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 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 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, and the
method had a 'create' in it.
A simple example:
If you want to create a texture, you may want to call an
imaginable method IDriver::createTexture. You call
ITexture* texture = driver->createTexture(dimension2d<s32>(128, 128));
If you no longer need the texture, call texture->drop().
If you want to load a texture, you may want to call imaginable
method IDriver::loadTexture. You do this like
ITexture* texture = driver->loadTexture("example.jpg");
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.
\return True, if the object was deleted. */
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;
if (!ReferenceCounter)
@ -123,15 +128,17 @@ namespace irr
return false;
}
//! Returns the reference counter.
//! Get the reference count.
/** \return Current value of the reference counter. */
s32 getReferenceCount() const
{
return ReferenceCounter;
}
//! Returns the debug name of the object. The Debugname may only be set and
//! changed by the object itself. This method should only be used in Debug mode.
//! \return Returns a string, previously set by setDebugName();
//! Returns the debug name of the object.
/** The Debugname may only be set and changed by the object
itself. This method should only be used in Debug mode.
\return Returns a string, previously set by setDebugName(); */
const c8* getDebugName() const
{
return DebugName;
@ -139,17 +146,19 @@ namespace irr
protected:
//! Sets the debug name of the object. The Debugname may only be set and
//! changed by the object itself. This method should only be used in Debug mode.
//! \param newName: New debug name to set.
//! Sets the debug name of the object.
/** The Debugname may only be set and changed by the object
itself. This method should only be used in Debug mode.
\param newName: New debug name to set. */
void setDebugName(const c8* newName)
{
DebugName = newName;
}
private:
//! The reference counter. Mutable to do reference counting on const objects.
mutable s32 ReferenceCounter;
//! The debug name.
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".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,55 +14,56 @@
namespace irr
{
namespace scene
{
class ISceneNode;
class ICameraSceneNode;
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
{
public:
//! destructor
//! Destructor
virtual ~ISceneCollisionManager() {}
//! Finds the collision point of a line and lots of triangles, if there is one.
//! \param ray: Line with witch collisions are tested.
//! \param selector: TriangleSelector containing the triangles. It can
//! be created for example using ISceneManager::createTriangleSelector() or
//! ISceneManager::createTriangleOctTreeSelector().
//! \param outCollisionPoint: If a collision is detected, this will contain the
//! position of the nearest collision.
//! \param outTriangle: If a collision is detected, this will contain the triangle
//! with which the ray collided.
//! \return Returns true if a collision was detected and false if not.
/** \param ray: Line with witch collisions are tested.
\param selector: TriangleSelector containing the triangles. It
can be created for example using
ISceneManager::createTriangleSelector() or
ISceneManager::createTriangleOctTreeSelector().
\param outCollisionPoint: If a collision is detected, this will
contain the position of the nearest collision.
\param outTriangle: If a collision is detected, this will
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,
ITriangleSelector* selector, core::vector3df& outCollisionPoint,
core::triangle3df& outTriangle) = 0;
//! Collides a moving ellipsoid with a 3d world with gravity and returns
//! the resulting new position of the ellipsoid. This can be used for moving
//! a character in a 3d world: The character will slide at walls and is able
//! to walk up stairs. The method used how to calculate the collision result
//! position is based on the paper "Improved Collision detection and Response"
//! by Kasper Fauerby.
//! \param selector: TriangleSelector containing the triangles of the world.
//! It can be created for example using ISceneManager::createTriangleSelector() or
//! ISceneManager::createTriangleOctTreeSelector().
//! \param ellipsoidPosition: Position of the ellipsoid.
//! \param ellipsoidRadius: Radius of the ellipsoid.
//! \param ellipsoidDirectionAndSpeed: Direction and speed of
//! the movement of the ellipsoid.
//! \param triout: Optional parameter where the last triangle causing a
//! collision is stored, if there is a collision.
//! \param outFalling: Is set to true if the ellipsoid is falling down, caused
//! by gravity.
//! \param slidingSpeed: DOCUMENTATION NEEDED.
//! \param gravityDirectionAndSpeed: Direction and force of gravity.
//! \return Returns the new position of the ellipsoid.
//! Collides a moving ellipsoid with a 3d world with gravity and returns the resulting new position of the ellipsoid.
/** This can be used for moving a character in a 3d world: The
character will slide at walls and is able to walk up stairs.
The method used how to calculate the collision result position
is based on the paper "Improved Collision detection and
Response" by Kasper Fauerby.
\param selector: TriangleSelector containing the triangles of
the world. It can be created for example using
ISceneManager::createTriangleSelector() or
ISceneManager::createTriangleOctTreeSelector().
\param ellipsoidPosition: Position of the ellipsoid.
\param ellipsoidRadius: Radius of the ellipsoid.
\param ellipsoidDirectionAndSpeed: Direction and speed of the
movement of the ellipsoid.
\param triout: Optional parameter where the last triangle
causing a collision is stored, if there is a collision.
\param outFalling: Is set to true if the ellipsoid is falling
down, caused by gravity.
\param slidingSpeed: DOCUMENTATION NEEDED.
\param gravityDirectionAndSpeed: Direction and force of gravity.
\return New position of the ellipsoid. */
virtual core::vector3df getCollisionResultPosition(
ITriangleSelector* selector,
const core::vector3df &ellipsoidPosition,
@ -75,70 +76,74 @@ namespace scene
= core::vector3df(0.0f, 0.0f, 0.0f)) = 0;
//! Returns a 3d ray which would go through the 2d screen coodinates.
//! \param pos: Screen coordinates in pixels.
//! \param camera: Camera from which the ray starts. If null, the
//! active camera is used.
//! \return Returns a ray starting from the position of the camera
//! and ending at a length of the far value of the camera at a position
//! which would be behind the 2d screen coodinates.
/** \param pos: Screen coordinates in pixels.
\param camera: Camera from which the ray starts. If null, the
active camera is used.
\return Ray starting from the position of the camera and ending
at a length of the far value of the camera at a position which
would be behind the 2d screen coodinates. */
virtual core::line3d<f32> getRayFromScreenCoordinates(
core::position2d<s32> pos, ICameraSceneNode* camera = 0) = 0;
//! Calculates 2d screen position from a 3d position.
//! \param pos: 3D position in world space to be transformed into
//! 2d.
//! \param camera: Camera to be used. If null, the currently active
//! camera is used.
//! \return Returns the 2d screen coordinates which a object in the
//! 3d world would have if it would be rendered to the screen. If the
//! 3d 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
//! for drawing a decorator over a 3d object, it will be clipped by the
//! screen borders.
/** \param pos: 3D position in world space to be transformed
into 2d.
\param camera: Camera to be used. If null, the currently active
camera is used.
\return 2d screen coordinates which a object in the 3d world
would have if it would be rendered to the screen. If the 3d
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 for drawing a decorator over a 3d object, it will be
clipped by the screen borders. */
virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition(
core::vector3df pos, ICameraSceneNode* camera=0) = 0;
//! Returns the scene node, which is currently visible under the overgiven
//! screencoordinates, viewed from the currently active camera. The collision
//! tests are done using a bounding box for each scene node.
//! \param pos: Position in pixel screen coordinates, under which the returned
//! scene node will be.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask
//! will be tested. If the BitMask is 0, this feature is disabled.
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These
// are scene nodes with IsDebugObject() = true.
//! \return Returns the visible scene node under screen coordinates with matching
//! bits in its id. If there is no scene node under this position, 0 is returned.
//! Gets the scene node, which is currently visible under the given screencoordinates, viewed from the currently active camera.
/** The collision tests are done using a bounding box for each
scene node.
\param pos: Position in pixel screen coordinates, under which
the returned scene node will be.
\param idBitMask: Only scene nodes with an id with bits set
like in this mask will be tested. If the BitMask is 0, this
feature is disabled.
\param bNoDebugObjects: Doesn't take debug objects into account
when true. These are scene nodes with IsDebugObject() = true.
\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,
s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
//! Returns the nearest scene node which collides with a 3d ray and
//! which id matches a bitmask. The collision tests are done using a bounding
//! box for each scene node.
//! \param ray: Line with witch collisions are tested.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask
//! will be tested. If the BitMask is 0, this feature is disabled.
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These
// are scene nodes with IsDebugObject() = true.
//! \return Returns the scene node nearest to ray.start, which collides with the
//! ray and matches the idBitMask, if the mask is not null. If no scene
//! node is found, 0 is returned.
//! Get the nearest scene node which collides with a 3d ray and whose id matches a bitmask.
/** The collision tests are done using a bounding box for each
scene node.
\param ray: Line with witch collisions are tested.
\param idBitMask: Only scene nodes with an id with bits set
like in this mask will be tested. If the BitMask is 0, this
feature is disabled.
\param bNoDebugObjects: Doesn't take debug objects into account
when true. These are scene nodes with IsDebugObject() = true.
\return Scene node nearest to ray.start, which collides with
the ray and matches the idBitMask, if the mask is not null. If
no scene node is found, 0 is returned. */
virtual ISceneNode* getSceneNodeFromRayBB(core::line3d<f32> ray,
s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
//! Returns the scene node, at which the overgiven camera is looking at and
//! which id matches the bitmask. A ray is simply casted from the position
//! of the camera to the view target position, and all scene nodes are tested
//! against this ray. The collision tests are done using a bounding
//! box for each scene node.
//! \param camera: Camera from which the ray is casted.
//! \param idBitMask: Only scene nodes with an id with bits set like in this mask
//! will be tested. If the BitMask is 0, this feature is disabled.
//! \param bNoDebugObjects: Doesn't take debug objects into account when true. These
// are scene nodes with IsDebugObject() = true.
//! \return Returns the scene node nearest to the camera, which collides with the
//! ray and matches the idBitMask, if the mask is not null. If no scene
//! node is found, 0 is returned.
//! Get the scene node, which the overgiven camera is looking at and whose id matches the bitmask.
/** A ray is simply casted from the position of the camera to
the view target position, and all scene nodes are tested
against this ray. The collision tests are done using a bounding
box for each scene node.
\param camera: Camera from which the ray is casted.
\param idBitMask: Only scene nodes with an id with bits set
like in this mask will be tested. If the BitMask is 0, this
feature is disabled.
\param bNoDebugObjects: Doesn't take debug objects into account
when true. These are scene nodes with IsDebugObject() = true.
\return Scene node nearest to the camera, which collides with
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,
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