* Update Irrlicht to 1.7.2

ouch
This commit is contained in:
Shlainn 2011-11-29 18:14:52 +01:00
parent f098525843
commit 17a6316098
968 changed files with 150418 additions and 63236 deletions

View File

@ -66,11 +66,11 @@ void CCursorController::render()
void CCursorController::addMouseCursorTexture(c8* Cursor_file, bool top_left)
{
m_pMouseCursor = videoDriver->getTexture(Cursor_file);
bool isAlreadyLoaded = false;
for(u32 i = 0; i < m_aMouseCursors.size() && !isAlreadyLoaded; i++)
{
if(m_aMouseCursors[i].tex->getName() == m_pMouseCursor->getName())
if(m_aMouseCursors[i].tex->getName().getInternalName() == m_pMouseCursor->getName().getInternalName())
{
isAlreadyLoaded = !isAlreadyLoaded;
break;

View File

@ -1,5 +1,3 @@
#include <iostream>
#include <string>
#include "common.h"
#include "irrlicht/irrlicht.h"
#include "SImage.h"
@ -12,10 +10,10 @@ namespace video
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".tga")
bool CImageLoaderBLP::isALoadableFileExtension(const c8* fileName) const
bool CImageLoaderBLP::isALoadableFileExtension(const io::path& fileName) const
{
// Checking for file extension
return strstr(fileName, ".blp")!=0;
return core::hasFileExtension ( fileName, "blp" );
}
@ -57,20 +55,14 @@ IImage* CImageLoaderBLP::loadImage(io::IReadFile* file) const
return 0;
BLPHeader header;
// std::cout<<"Trying to load the image\n";
// std::cout<<"Checking Header\n";
file->read(&header,sizeof(BLPHeader));
// std::cout<<"Header data: "<<header.fileID<<"\n Alpha depth:"<<(u32)header.alpha_bitdepth<<"bit\nCompression:"<<(u32)header.compression<<"\n";
// std::cout<<"Mystery factor:"<<(u32)header.alpha_unk<<"\n";
// std::cout<<"X-Res: "<< header.x_res<<"\nY-Res:"<<header.y_res<<"\n";
u32 usedMips=0;
for(u32 i=0;i<16;i++)
{
if(header.mip_ofs[i]!=0&&header.mip_size[i]!=0)
usedMips++;
}
// std::cout<<"Mip Levels:"<< usedMips<<"\n";
core::array<PaletteColor> palette;
PaletteColor tempColor;
palette.reallocate(256);
@ -81,11 +73,10 @@ IImage* CImageLoaderBLP::loadImage(io::IReadFile* file) const
}
// std::cout<<"Loading Mip 0 Length is "<<header.mip_size[0]<<"\n";
file->seek(header.mip_ofs[0]);
video::IImage* image = 0;
image = new SImage(ECF_A8R8G8B8, core::dimension2d<s32>(header.x_res, header.y_res));
image = new SImage(ECF_A8R8G8B8, core::dimension2d<u32>(header.x_res, header.y_res));
if(header.compression==2)
{
@ -117,7 +108,6 @@ IImage* CImageLoaderBLP::loadImage(io::IReadFile* file) const
imagedata1.push_back(tempChunk1);
}
// std::cout << "Data read\n";
u32 i=0;
u32 alpha=255;
u32 a[8];
@ -142,15 +132,7 @@ IImage* CImageLoaderBLP::loadImage(io::IReadFile* file) const
}
else
{
/* std::cout << imagedata1[i].color1 <<","<<imagedata1[i].color2<<"\n";
// f32 rgb=256/31;
r1 = (u32)rgb*(imagedata1[i].color1 & 0xF800) >>11;
g1 = (u32)rgb*(imagedata1[i].color1 & 0x07C0) >>6;
b1 = (u32)rgb*(imagedata1[i].color1 & 0x003E) >>1;
r2 = (u32)rgb*(imagedata1[i].color2 & 0xF800) >>11;
g2 = (u32)rgb*(imagedata1[i].color2 & 0x07C0) >>6;
b2 = (u32)rgb*(imagedata1[i].color2 & 0x003E) >>1;
*/ transparency_bit=true;
transparency_bit=true;
}
u32 tempbitmap=imagedata1[i].bitmap;
@ -225,7 +207,6 @@ IImage* CImageLoaderBLP::loadImage(io::IReadFile* file) const
if(transparency_bit==false)
image->setPixel(x+tx,y+ty,video::SColor(alpha,(u32)(0.667f*r1+0.333f*r2),(u32)(0.667f*g1+0.333f*g2),(u32)(0.667f*b1+0.333f*b2)));
else
//image->setPixel(x+tx,y+ty,video::SColor(255,255,0,0));
image->setPixel(x+tx,y+ty,video::SColor(255,(u32)(0.5f*r1+0.5f*r2),(u32)(0.5f*g1+0.5f*g2),(u32)(0.5f*b1+0.5f*b2)));
break;
}

View File

@ -14,7 +14,7 @@ public:
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".blp")
virtual bool isALoadableFileExtension(const c8* fileName) const;
virtual bool isALoadableFileExtension(const io::path& fileName) const;
//! returns true if the file maybe is able to be loaded by this class
virtual bool isALoadableFileFormat(io::IReadFile* file) const;

View File

@ -73,7 +73,7 @@ void CM2Mesh::animateMesh(f32 frame, f32 blend)
LastAnimatedFrame=frame;
SkinnedLastFrame=false;
if (blend<=0.f)
return; //No need to animate
@ -118,7 +118,7 @@ void CM2Mesh::animateMesh(f32 frame, f32 blend)
void CM2Mesh::buildAllAnimatedMatrices(SJoint *joint, SJoint *parentJoint)
{
if (!joint)
{
for (u32 i=0; i<RootJoints.size(); ++i)
@ -138,13 +138,13 @@ void CM2Mesh::buildAllAnimatedMatrices(SJoint *joint, SJoint *parentJoint)
{
joint->GlobalAnimatedMatrix= core::matrix4();
joint->GlobalAnimatedMatrix.setTranslation(joint->LocalMatrix.getTranslation());
core::matrix4 tm;
tm.setTranslation(joint->Animatedposition);
joint->GlobalAnimatedMatrix*=tm;
joint->GlobalAnimatedMatrix*=joint->Animatedrotation.getMatrix();
core::matrix4 ts;
ts.setScale(joint->Animatedscale);
joint->GlobalAnimatedMatrix*=ts;
@ -369,7 +369,7 @@ void CM2Mesh::skinMesh()
{
if ( !HasAnimation || SkinnedLastFrame )
return;
SkinnedLastFrame=true;
if (!HardwareSkinning)
{
@ -544,8 +544,8 @@ void CM2Mesh::setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint,
for (u32 i=0; i<LocalBuffers.size(); ++i)
LocalBuffers[i]->setHardwareMappingHint(newMappingHint, buffer);
}
//! flags the meshbuffer as changed, reloads hardware buffers
void CM2Mesh::setDirty(E_BUFFER_TYPE buffer)
{
@ -1008,7 +1008,7 @@ if (HasAnimation)
Buffer->Transformation=AllJoints[i]->GlobalAnimatedMatrix;
}
}
//calculate bounding box
if (LocalBuffers.empty())
BoundingBox.reset(0,0,0);
@ -1050,7 +1050,7 @@ void CM2Mesh::updateBoundingBox(void)
scene::SSkinMeshBuffer *CM2Mesh::createBuffer()
scene::SSkinMeshBuffer *CM2Mesh::addMeshBuffer()
{
scene::SSkinMeshBuffer *buffer=new scene::SSkinMeshBuffer();
LocalBuffers.push_back(buffer);
@ -1058,7 +1058,7 @@ scene::SSkinMeshBuffer *CM2Mesh::createBuffer()
}
CM2Mesh::SJoint *CM2Mesh::createJoint(SJoint *parent)
CM2Mesh::SJoint *CM2Mesh::addJoint(SJoint *parent)
{
SJoint *joint=new SJoint;
@ -1077,7 +1077,7 @@ CM2Mesh::SJoint *CM2Mesh::createJoint(SJoint *parent)
}
CM2Mesh::SPositionKey *CM2Mesh::createPositionKey(SJoint *joint)
CM2Mesh::SPositionKey *CM2Mesh::addPositionKey(SJoint *joint)
{
if (!joint)
return 0;
@ -1087,7 +1087,7 @@ CM2Mesh::SPositionKey *CM2Mesh::createPositionKey(SJoint *joint)
}
CM2Mesh::SScaleKey *CM2Mesh::createScaleKey(SJoint *joint)
CM2Mesh::SScaleKey *CM2Mesh::addScaleKey(SJoint *joint)
{
if (!joint)
return 0;
@ -1097,7 +1097,7 @@ CM2Mesh::SScaleKey *CM2Mesh::createScaleKey(SJoint *joint)
}
CM2Mesh::SRotationKey *CM2Mesh::createRotationKey(SJoint *joint)
CM2Mesh::SRotationKey *CM2Mesh::addRotationKey(SJoint *joint)
{
if (!joint)
return 0;
@ -1107,7 +1107,7 @@ CM2Mesh::SRotationKey *CM2Mesh::createRotationKey(SJoint *joint)
}
CM2Mesh::SWeight *CM2Mesh::createWeight(SJoint *joint)
CM2Mesh::SWeight *CM2Mesh::addWeight(SJoint *joint)
{
if (!joint)
return 0;
@ -1289,7 +1289,7 @@ void CM2Mesh::convertMeshToTangents()
{
if (LocalBuffers[b])
{
LocalBuffers[b]->MoveTo_Tangents();
LocalBuffers[b]->convertToTangents();
const s32 idxCnt = LocalBuffers[b]->getIndexCount();
@ -1392,11 +1392,11 @@ void CM2Mesh::getFrameLoop(u32 id, s32 &start, s32 &end)
found=true;
}
start = a.begin;
end = a.end;
end = a.end;
}
else
return;
}
void CM2Mesh::newAnimation(u32 id, s32 start, s32 end, f32 probability)
@ -1441,7 +1441,7 @@ bool CM2Mesh::getGeoSetRender(u32 meshbufferNumber)//This gets the render status
{
return GeoSetRender[meshbufferNumber];
}
else
else
return false;
};

View File

@ -69,7 +69,7 @@ namespace scene
//! updates the bounding box
virtual void updateBoundingBox(void);
//! Returns the type of the animated mesh.
virtual E_ANIMATED_MESH_TYPE getMeshType() const;
@ -132,22 +132,22 @@ namespace scene
//! loaders should call this after populating the mesh
virtual void finalize();
SSkinMeshBuffer *createBuffer(u32 id)
SSkinMeshBuffer *addMeshBuffer(u32 id)
{
GeoSetID.push_back(id);
GeoSetRender.push_back((id==0?true:false));//This may be changed later on when we know more about the submesh switching business
return createBuffer();
return addMeshBuffer();
};
virtual SSkinMeshBuffer *createBuffer();
virtual SSkinMeshBuffer *addMeshBuffer();
virtual SJoint *createJoint(SJoint *parent=0);
virtual SJoint *addJoint(SJoint *parent=0);
virtual SPositionKey *createPositionKey(SJoint *joint);
virtual SRotationKey *createRotationKey(SJoint *joint);
virtual SScaleKey *createScaleKey(SJoint *joint);
virtual SPositionKey *addPositionKey(SJoint *joint);
virtual SRotationKey *addRotationKey(SJoint *joint);
virtual SScaleKey *addScaleKey(SJoint *joint);
virtual SWeight *addWeight(SJoint *joint);
virtual SWeight *createWeight(SJoint *joint);
//Retrieve animation information
void getFrameLoop(u32 animId, s32 &start, s32 &end);
void newAnimation(u32 id, s32 start, s32 end, f32 probability);
@ -205,7 +205,7 @@ private:
core::aabbox3d<f32> BoundingBox;
core::array< core::array<bool> > Vertices_Moved;
core::array< M2Animation > Animations;
core::map<u32, core::array<u32> > AnimationLookup;
};

View File

@ -30,9 +30,9 @@ core::quaternion fixQuaternion(core::quaternion q)
{
return core::quaternion(q.X, q.Z, q.Y, q.W);
}
bool CM2MeshFileLoader::isALoadableFileExtension(const c8* filename)const
bool CM2MeshFileLoader::isALoadableFileExtension(const io::path& filename)const
{
return strstr(filename, ".m2")!=0;
return core::hasFileExtension ( filename, "m2" );
}
@ -282,7 +282,7 @@ for(u32 i=0; i<M2MAnimations.size(); i++)
use_animfile = (M2MAnimations[i].flags & 0x20) == 0;
if(use_animfile)
{
std::string AnimName = MeshFile->getFileName();
std::string AnimName = MeshFile->getFileName().c_str();
c8 ext[13];
sprintf(ext,"%04d-%02d.anim",M2MAnimations[i].animationID,M2MAnimations[i].subanimationID);
AnimName = AnimName.substr(0, AnimName.length()-3) + ext;
@ -596,7 +596,7 @@ switch(header.version)
MeshFile->read((u8*)&header+0x54,24);//nColors - nTransparency
MeshFile->read((u8*)&header+0x74,sizeof(ModelHeader)-0x74);//nTexAnims - END
std::string SkinName = MeshFile->getFileName();
std::string SkinName = MeshFile->getFileName().c_str();
SkinName = SkinName.substr(0, SkinName.length()-3) + "00.skin"; // FIX ME if we need more skins
io::IReadFile* SkinFile = io::IrrCreateIReadFileBasic(Device, SkinName.c_str());
if (!SkinFile)
@ -619,7 +619,7 @@ switch(header.version)
}
default:
{
logerror("M2: [%s] Wrong header %0X! File version doesn't match or file is not a M2 file.",MeshFile->getFileName(),header.version);
logerror("M2: [%s] Wrong header %0X! File version doesn't match or file is not a M2 file.",MeshFile->getFileName().c_str(),header.version);
return 0;
}
}
@ -649,13 +649,13 @@ for(u32 i=0;i<M2MBones.size();i++)
{
ParentJoint=AnimatedMesh->getAllJoints()[M2MBones[i].parentBone];
}
Joint=AnimatedMesh->createJoint(ParentJoint);
Joint=AnimatedMesh->addJoint(ParentJoint);
if(M2MBones[i].translation.timestamps.size()>0)
{
for(u32 j=0;j<M2MBones[i].translation.timestamps.size();j++)
{
scene::CM2Mesh::SPositionKey* pos=AnimatedMesh->createPositionKey(Joint);
scene::CM2Mesh::SPositionKey* pos=AnimatedMesh->addPositionKey(Joint);
pos->frame=M2MBones[i].translation.timestamps[j];
pos->position=fixCoordSystem(core::vector3df(M2MBones[i].translation.values[j*3],M2MBones[i].translation.values[j*3+1],M2MBones[i].translation.values[j*3+2]));
}
@ -664,7 +664,7 @@ for(u32 i=0;i<M2MBones.size();i++)
{
for(u32 j=0;j<M2MBones[i].rotation.timestamps.size();j++)
{
scene::CM2Mesh::SRotationKey* rot=AnimatedMesh->createRotationKey(Joint);
scene::CM2Mesh::SRotationKey* rot=AnimatedMesh->addRotationKey(Joint);
rot->frame=M2MBones[i].rotation.timestamps[j];
core::quaternion tempQ=core::quaternion(M2MBones[i].rotation.values[j*4+0],M2MBones[i].rotation.values[j*4+1],M2MBones[i].rotation.values[j*4+2],M2MBones[i].rotation.values[j*4+3]);
tempQ = fixQuaternion(tempQ);
@ -677,7 +677,7 @@ for(u32 i=0;i<M2MBones.size();i++)
{
for(u32 j=0;j<M2MBones[i].scaling.timestamps.size();j++)
{
scene::CM2Mesh::SScaleKey* scale=AnimatedMesh->createScaleKey(Joint);
scene::CM2Mesh::SScaleKey* scale=AnimatedMesh->addScaleKey(Joint);
scale->frame=M2MBones[i].scaling.timestamps[j];
scale->scale=core::vector3df(M2MBones[i].scaling.values[j*3],M2MBones[i].scaling.values[j*3+1],M2MBones[i].scaling.values[j*3+2]);
}
@ -715,7 +715,7 @@ for(u32 i=0;i<M2MVertices.size();i++)
for(u32 i=0; i < currentView.Submesh.num;i++)//
{
//Now, M2MTriangles refers to M2MIndices and not to M2MVertices.
scene::SSkinMeshBuffer *MeshBuffer = AnimatedMesh->createBuffer(M2MSubmeshes[i].meshpartId);
scene::SSkinMeshBuffer *MeshBuffer = AnimatedMesh->addMeshBuffer(M2MSubmeshes[i].meshpartId);
//Put the Indices and Vertices of the Submesh into a mesh buffer
//Each Submesh contains only the Indices and Vertices that belong to it.
@ -735,7 +735,7 @@ for(u32 i=0; i < currentView.Submesh.num;i++)//
if((M2MVertices[j].weights[k])>0)
{
u32 boneIndex = M2MVertices[j].bones[k];
scene::CM2Mesh::SWeight* weight = AnimatedMesh->createWeight(AnimatedMesh->getAllJoints()[boneIndex]);
scene::CM2Mesh::SWeight* weight = AnimatedMesh->addWeight(AnimatedMesh->getAllJoints()[boneIndex]);
weight->strength=M2MVertices[j].weights[k];
weight->vertex_id=MeshBuffer->Vertices_Standard.size()-1;
weight->buffer_id=i;

View File

@ -195,7 +195,7 @@ public:
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".cob")
virtual bool isALoadableFileExtension(const c8* fileName)const;
virtual bool isALoadableFileExtension(const io::path& fileName)const;
//! creates/loads an animated mesh from the file.
//! \return Pointer to the created mesh. Returns 0 if loading failed.

View File

@ -27,7 +27,7 @@ CMDHReadFile::CMDHReadFile(void* memory, long len, const c8* fileName)
CMDHReadFile::~CMDHReadFile()
{
// Drop the Memory, Irrlicht keeps a Model Cache of loaded models
MemoryDataHolder::Delete(getFileName());
MemoryDataHolder::Delete(Filename.c_str());
}
@ -44,7 +44,7 @@ irr::s32 CMDHReadFile::read(void* buffer, irr::u32 sizeToRead)
irr::c8* p = (irr::c8*)Buffer;
memcpy(buffer, p + Pos, amount);
Pos += amount;
return amount;
@ -67,7 +67,7 @@ bool CMDHReadFile::seek(long finalPos, bool relativeMovement)
{
if (finalPos > Len)
return false;
Pos = finalPos;
}
@ -93,9 +93,9 @@ long CMDHReadFile::getPos() const
//! returns name of file
const irr::c8* CMDHReadFile::getFileName() const
const irr::io::path& CMDHReadFile::getFileName() const
{
return Filename.c_str();
return Filename;
}

View File

@ -39,7 +39,7 @@ public:
virtual long getPos() const;
//! returns name of file
virtual const c8* getFileName() const;
virtual const path& getFileName() const;
private:

View File

@ -34,10 +34,9 @@ CWMOMeshFileLoader::~CWMOMeshFileLoader()
}
bool CWMOMeshFileLoader::isALoadableFileExtension(const c8* filename)const
bool CWMOMeshFileLoader::isALoadableFileExtension(const io::path& filename)const
{
return strstr(filename, ".wmo")!=0;
return core::hasFileExtension ( filename, "wmo" );
}
@ -50,7 +49,7 @@ IAnimatedMesh* CWMOMeshFileLoader::createMesh(io::IReadFile* file)
if(!file)
return 0;
MeshFile = file;
std::string filename=MeshFile->getFileName();
std::string filename=MeshFile->getFileName().c_str();
Mesh = new scene::CM2Mesh();
if ( load(true) )//We try loading a root file first!
@ -274,7 +273,7 @@ for(u32 i=0;i<submeshes.size();i++)//The mesh has to be split into submeshes bec
{
if(WMOMTexData[lastindex].textureID!=255)
{
scene::SSkinMeshBuffer *MeshBuffer = Mesh->createBuffer(0);
scene::SSkinMeshBuffer *MeshBuffer = Mesh->addMeshBuffer(0);
//Put the Indices and Vertices of the Submesh into a mesh buffer
for(u32 j=lastindex;j<submeshes[i];j++)

View File

@ -68,7 +68,7 @@ public:
//! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".cob")
virtual bool isALoadableFileExtension(const c8* fileName)const;
virtual bool isALoadableFileExtension(const io::path& fileName)const;
//! creates/loads an animated mesh from the file.
//! \return Pointer to the created mesh. Returns 0 if loading failed.

View File

@ -100,11 +100,11 @@ void PseuGUI::UseShadows(bool b)
// if this fuction is called from another thread the device will not work correctly. o_O
void PseuGUI::_Init(void)
{
_device = createDevice(_driverType,dimension2d<s32>(_xres,_yres),_colordepth,!_windowed,_shadows,_vsync);
_device = createDevice(_driverType,dimension2d<u32>(_xres,_yres),_colordepth,!_windowed,_shadows,_vsync);
if(!_device)
{
logerror("PseuGUI: Can't use specified video driver, trying software mode...");
_device = createDevice(video::EDT_SOFTWARE,dimension2d<s32>(_xres,_yres),_colordepth,!_windowed,false,false);
_device = createDevice(video::EDT_SOFTWARE,dimension2d<u32>(_xres,_yres),_colordepth,!_windowed,false,false);
if(!_device)
{
logerror("ERROR: PseuGUI::_Init() failed, no video driver available!");
@ -117,7 +117,7 @@ void PseuGUI::_Init(void)
}
DEBUG(logdebug("PseuGUI::Init() _device=%X",_device));
_device->setWindowCaption(L"PseuWoW - Initializing");
_device->setResizeAble(true);
_device->setResizable(true);
_driver = _device->getVideoDriver();
_smgr = _device->getSceneManager();
_guienv = _device->getGUIEnvironment();

View File

@ -128,7 +128,7 @@ private:
Scene *_scene;
irr::ITimer *_timer;
uint32 _passtime, _lastpasstime, _passtimediff;
irr::core::dimension2d<irr::s32> _screendimension;
irr::core::dimension2d<irr::u32> _screendimension;
uint32 _throttle;//used for frameratelimiting
bool _updateScene; // manually update scene?

View File

@ -1,343 +1,499 @@
#include "SImage.h"
namespace irr
{
namespace video
{
//! constructor for empty image
//! constructor
SImage::SImage(ECOLOR_FORMAT format, const core::dimension2d<s32>& size): Size(size), Format(format), Data(0)
{
initData();
}
void SImage::initData()
{
setBitMasks();
BitsPerPixel = getBitsPerPixelFromFormat(Format);
BytesPerPixel = BitsPerPixel / 8;
// Pitch should be aligned...
Pitch = BytesPerPixel * Size.Width;
if (!Data)
Data = new s8[Size.Height * Pitch];
}
u32 SImage::getBitsPerPixelFromFormat(ECOLOR_FORMAT format)
{
switch(format)
{
case ECF_A1R5G5B5:
return 16;
case ECF_R5G6B5:
return 16;
case ECF_R8G8B8:
return 24;
case ECF_A8R8G8B8:
return 32;
}
return 0;
}
SImage::~SImage()
{
if (Data)
delete Data;
}
//! Returns width and height of image data.
const core::dimension2d<s32>& SImage::getDimension() const
{
return Size;
}
//! Returns bits per pixel.
u32 SImage::getBitsPerPixel() const
{
return BitsPerPixel;
}
//! Returns bytes per pixel
u32 SImage::getBytesPerPixel() const
{
return BytesPerPixel;
}
//! Returns image data size in bytes
u32 SImage::getImageDataSizeInBytes() const
{
return Pitch * Size.Height;
}
//! Returns image data size in pixels
u32 SImage::getImageDataSizeInPixels() const
{
return Size.Width * Size.Height;
}
//! returns mask for red value of a pixel
u32 SImage::getRedMask() const
{
return RedMask;
}
//! returns mask for green value of a pixel
u32 SImage::getGreenMask() const
{
return GreenMask;
}
//! returns mask for blue value of a pixel
u32 SImage::getBlueMask() const
{
return BlueMask;
}
//! returns mask for alpha value of a pixel
u32 SImage::getAlphaMask() const
{
return AlphaMask;
}
void SImage::setBitMasks()
{
switch(Format)
{
case ECF_A1R5G5B5:
AlphaMask = 0x1<<15;
RedMask = 0x1F<<10;
GreenMask = 0x1F<<5;
BlueMask = 0x1F;
break;
case ECF_R5G6B5:
AlphaMask = 0x0;
RedMask = 0x1F<<11;
GreenMask = 0x3F<<5;
BlueMask = 0x1F;
break;
case ECF_R8G8B8:
AlphaMask = 0x0;
RedMask = 0x00FF0000;
GreenMask = 0x0000FF00;
BlueMask = 0x000000FF;
break;
case ECF_A8R8G8B8:
AlphaMask = 0xFF000000;
RedMask = 0x00FF0000;
GreenMask = 0x0000FF00;
BlueMask = 0x000000FF;
break;
}
}
//! sets a pixel
void SImage::setPixel(u32 x, u32 y, const SColor &color )
{
if (x >= (u32)Size.Width || y >= (u32)Size.Height)
return;
switch(Format)
{
case ECF_A1R5G5B5:
{
u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 ));
*dest = video::A8R8G8B8toA1R5G5B5 ( color.color );
} break;
case ECF_R5G6B5:
{
u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 ));
*dest = video::A8R8G8B8toR5G6B5 ( color.color );
} break;
case ECF_R8G8B8:
{
u8* dest = (u8*) Data + ( y * Pitch ) + ( x * 3 );
dest[0] = color.getRed();
dest[1] = color.getGreen();
dest[2] = color.getBlue();
} break;
case ECF_A8R8G8B8:
{
u32 * dest = (u32*) ((u8*) Data + ( y * Pitch ) + ( x << 2 ));
*dest = color.color;
} break;
}
}
//! returns a pixel
SColor SImage::getPixel(u32 x, u32 y) const
{
if (x >= (u32)Size.Width || y >= (u32)Size.Height)
return SColor(0);
switch(Format)
{
case ECF_A1R5G5B5:
return A1R5G5B5toA8R8G8B8(((u16*)Data)[y*Size.Width + x]);
case ECF_R5G6B5:
return R5G6B5toA8R8G8B8(((u16*)Data)[y*Size.Width + x]);
case ECF_A8R8G8B8:
return ((u32*)Data)[y*Size.Width + x];
case ECF_R8G8B8:
{
u8* p = &((u8*)Data)[(y*3)*Size.Width + (x*3)];
return SColor(255,p[0],p[1],p[2]);
}
}
return SColor(0);
}
//! returns the color format
ECOLOR_FORMAT SImage::getColorFormat() const
{
return Format;
}
//! 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.
void SImage::copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format, u32 pitch)
{
if (!target || !width || !height)
return;
const u32 bpp=getBitsPerPixelFromFormat(format)/8;
if (0==pitch)
pitch = width*bpp;
if (Format==format && Size.Width==width && Size.Height==height)
{
if (pitch==Pitch)
{
memcpy(target, Data, height*pitch);
return;
}
else
{
u8* tgtpos = (u8*) target;
u8* dstpos = (u8*) Data;
const u32 bwidth = width*bpp;
for (s32 y=0; y<height; ++y)
{
memcpy(target, Data, height*pitch);
memset(tgtpos+width, 0, pitch-bwidth);
tgtpos += pitch;
dstpos += Pitch;
}
return;
}
}
const f32 sourceXStep = (f32)Size.Width / (f32)width;
const f32 sourceYStep = (f32)Size.Height / (f32)height;
s32 yval=0, syval=0;
f32 sy = 0.0f;
for (s32 y=0; y<height; ++y)
{
f32 sx = 0.0f;
for (s32 x=0; x<width; ++x)
{
// CColorConverter::convert_viaFormat(((u8*)Data)+ syval + ((s32)sx)*BytesPerPixel, Format, 1, ((u8*)target)+ yval + (x*bpp), format);
sx+=sourceXStep;
}
sy+=sourceYStep;
syval=((s32)sy)*Pitch;
yval+=pitch;
}
}
//! 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.
void SImage::copyToScaling(IImage* target)
{
if (!target)
return;
const core::dimension2d<s32>& targetSize = target->getDimension();
if (targetSize==Size)
{
copyTo(target);
return;
}
copyToScaling(target->lock(), targetSize.Width, targetSize.Height, target->getColorFormat());
target->unlock();
}
//! copies this surface into another
void SImage::copyTo(IImage* target, const core::position2d<s32>& pos)
{
// Blit ( BLITTER_TEXTURE, target, 0, &pos, this, 0, 0 );
}
//! copies this surface into another
void SImage::copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect)
{
// Blit ( BLITTER_TEXTURE, target, clipRect, &pos, this, &sourceRect, 0 );
}
}//video
}//irr
// Copyright (C) 2002-2010 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "SImage.h"
namespace irr
{
namespace video
{
//! Constructor of empty image
SImage::SImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
:Data(0), Size(size), Format(format), DeleteMemory(true)
{
initData();
}
//! Constructor from raw data
SImage::SImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size, void* data,
bool ownForeignMemory, bool deleteForeignMemory)
: Data(0), Size(size), Format(format), DeleteMemory(deleteForeignMemory)
{
if (ownForeignMemory)
{
Data = (u8*)0xbadf00d;
initData();
Data = (u8*)data;
}
else
{
Data = 0;
initData();
memcpy(Data, data, Size.Height * Pitch);
}
}
//! assumes format and size has been set and creates the rest
void SImage::initData()
{
#ifdef _DEBUG
setDebugName("SImage");
#endif
BytesPerPixel = getBitsPerPixelFromFormat(Format) / 8;
// Pitch should be aligned...
Pitch = BytesPerPixel * Size.Width;
if (!Data)
Data = new u8[Size.Height * Pitch];
}
//! destructor
SImage::~SImage()
{
if ( DeleteMemory )
delete [] Data;
}
//! Returns width and height of image data.
const core::dimension2d<u32>& SImage::getDimension() const
{
return Size;
}
//! Returns bits per pixel.
u32 SImage::getBitsPerPixel() const
{
return getBitsPerPixelFromFormat(Format);
}
//! Returns bytes per pixel
u32 SImage::getBytesPerPixel() const
{
return BytesPerPixel;
}
//! Returns image data size in bytes
u32 SImage::getImageDataSizeInBytes() const
{
return Pitch * Size.Height;
}
//! Returns image data size in pixels
u32 SImage::getImageDataSizeInPixels() const
{
return Size.Width * Size.Height;
}
//! returns mask for red value of a pixel
u32 SImage::getRedMask() const
{
switch(Format)
{
case ECF_A1R5G5B5:
return 0x1F<<10;
case ECF_R5G6B5:
return 0x1F<<11;
case ECF_R8G8B8:
return 0x00FF0000;
case ECF_A8R8G8B8:
return 0x00FF0000;
default:
return 0x0;
}
}
//! returns mask for green value of a pixel
u32 SImage::getGreenMask() const
{
switch(Format)
{
case ECF_A1R5G5B5:
return 0x1F<<5;
case ECF_R5G6B5:
return 0x3F<<5;
case ECF_R8G8B8:
return 0x0000FF00;
case ECF_A8R8G8B8:
return 0x0000FF00;
default:
return 0x0;
}
}
//! returns mask for blue value of a pixel
u32 SImage::getBlueMask() const
{
switch(Format)
{
case ECF_A1R5G5B5:
return 0x1F;
case ECF_R5G6B5:
return 0x1F;
case ECF_R8G8B8:
return 0x000000FF;
case ECF_A8R8G8B8:
return 0x000000FF;
default:
return 0x0;
}
}
//! returns mask for alpha value of a pixel
u32 SImage::getAlphaMask() const
{
switch(Format)
{
case ECF_A1R5G5B5:
return 0x1<<15;
case ECF_R5G6B5:
return 0x0;
case ECF_R8G8B8:
return 0x0;
case ECF_A8R8G8B8:
return 0xFF000000;
default:
return 0x0;
}
}
//! sets a pixel
void SImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
{
if (x >= Size.Width || y >= Size.Height)
return;
switch(Format)
{
case ECF_A1R5G5B5:
{
u16 * dest = (u16*) (Data + ( y * Pitch ) + ( x << 1 ));
*dest = video::A8R8G8B8toA1R5G5B5( color.color );
} break;
case ECF_R5G6B5:
{
u16 * dest = (u16*) (Data + ( y * Pitch ) + ( x << 1 ));
*dest = video::A8R8G8B8toR5G6B5( color.color );
} break;
case ECF_R8G8B8:
{
u8* dest = Data + ( y * Pitch ) + ( x * 3 );
dest[0] = (u8)color.getRed();
dest[1] = (u8)color.getGreen();
dest[2] = (u8)color.getBlue();
} break;
case ECF_A8R8G8B8:
{
u32 * dest = (u32*) (Data + ( y * Pitch ) + ( x << 2 ));
*dest = color.color;
} break;
}
}
//! returns a pixel
SColor SImage::getPixel(u32 x, u32 y) const
{
if (x >= Size.Width || y >= Size.Height)
return SColor(0);
switch(Format)
{
case ECF_A1R5G5B5:
return A1R5G5B5toA8R8G8B8(((u16*)Data)[y*Size.Width + x]);
case ECF_R5G6B5:
return R5G6B5toA8R8G8B8(((u16*)Data)[y*Size.Width + x]);
case ECF_A8R8G8B8:
return ((u32*)Data)[y*Size.Width + x];
case ECF_R8G8B8:
{
u8* p = Data+(y*3)*Size.Width + (x*3);
return SColor(255,p[0],p[1],p[2]);
}
}
return SColor(0);
}
//! returns the color format
ECOLOR_FORMAT SImage::getColorFormat() const
{
return Format;
}
//! copies this surface into another at given position
void SImage::copyTo(IImage* target, const core::position2d<s32>& pos)
{
// Blit(BLITTER_TEXTURE, target, 0, &pos, this, 0, 0);
}
//! copies this surface partially into another at given position
void SImage::copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect)
{
// Blit(BLITTER_TEXTURE, target, clipRect, &pos, this, &sourceRect, 0);
}
//! copies this surface into another, using the alpha mask, a 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);
}
//! copies this surface into another, scaling it to the target image size
// note: this is very very slow.
void SImage::copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format, u32 pitch)
{
if (!target || !width || !height)
return;
const u32 bpp=getBitsPerPixelFromFormat(format)/8;
if (0==pitch)
pitch = width*bpp;
if (Format==format && Size.Width==width && Size.Height==height)
{
if (pitch==Pitch)
{
memcpy(target, Data, height*pitch);
return;
}
else
{
u8* tgtpos = (u8*) target;
u8* srcpos = Data;
const u32 bwidth = width*bpp;
const u32 rest = pitch-bwidth;
for (u32 y=0; y<height; ++y)
{
// copy scanline
memcpy(tgtpos, srcpos, bwidth);
// clear pitch
memset(tgtpos+bwidth, 0, rest);
tgtpos += pitch;
srcpos += Pitch;
}
return;
}
}
const f32 sourceXStep = (f32)Size.Width / (f32)width;
const f32 sourceYStep = (f32)Size.Height / (f32)height;
s32 yval=0, syval=0;
f32 sy = 0.0f;
for (u32 y=0; y<height; ++y)
{
f32 sx = 0.0f;
for (u32 x=0; x<width; ++x)
{
// CColorConverter::convert_viaFormat(Data+ syval + ((s32)sx)*BytesPerPixel, Format, 1, ((u8*)target)+ yval + (x*bpp), format);
sx+=sourceXStep;
}
sy+=sourceYStep;
syval=((s32)sy)*Pitch;
yval+=pitch;
}
}
//! copies this surface into another, scaling it to the target image size
// note: this is very very slow.
void SImage::copyToScaling(IImage* target)
{
if (!target)
return;
const core::dimension2d<u32>& targetSize = target->getDimension();
if (targetSize==Size)
{
copyTo(target);
return;
}
copyToScaling(target->lock(), targetSize.Width, targetSize.Height, target->getColorFormat());
target->unlock();
}
//! copies this surface into another, scaling it to fit it.
void SImage::copyToScalingBoxFilter(IImage* target, s32 bias, bool blend)
{
const core::dimension2d<u32> destSize = target->getDimension();
const f32 sourceXStep = (f32) Size.Width / (f32) destSize.Width;
const f32 sourceYStep = (f32) Size.Height / (f32) destSize.Height;
target->lock();
s32 fx = core::ceil32( sourceXStep );
s32 fy = core::ceil32( sourceYStep );
f32 sx;
f32 sy;
sy = 0.f;
for ( u32 y = 0; y != destSize.Height; ++y )
{
sx = 0.f;
for ( u32 x = 0; x != destSize.Width; ++x )
{
target->setPixel( x, y,
getPixelBox( core::floor32(sx), core::floor32(sy), fx, fy, bias ), blend );
sx += sourceXStep;
}
sy += sourceYStep;
}
target->unlock();
}
//! fills the surface with given color
void SImage::fill(const SColor &color)
{
u32 c;
switch ( Format )
{
case ECF_A1R5G5B5:
c = color.toA1R5G5B5();
c |= c << 16;
break;
case ECF_R5G6B5:
c = video::A8R8G8B8toR5G6B5( color.color );
c |= c << 16;
break;
case ECF_A8R8G8B8:
c = color.color;
break;
case ECF_R8G8B8:
{
u8 rgb[3];
// CColorConverter::convert_A8R8G8B8toR8G8B8(&color, 1, rgb);
const u32 size = getImageDataSizeInBytes();
for (u32 i=0; i<size; i+=3)
{
memcpy(Data+i, rgb, 3);
}
return;
}
break;
}
if (Format != ECF_A1R5G5B5 && Format != ECF_R5G6B5 &&
Format != ECF_A8R8G8B8)
return;
// memset32( Data, c, getImageDataSizeInBytes() );
}
//! get a filtered pixel
inline SColor SImage::getPixelBox( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const
{
SColor c;
s32 a = 0, r = 0, g = 0, b = 0;
for ( s32 dx = 0; dx != fx; ++dx )
{
for ( s32 dy = 0; dy != fy; ++dy )
{
c = getPixel( core::s32_min ( x + dx, Size.Width - 1 ) ,
core::s32_min ( y + dy, Size.Height - 1 )
);
a += c.getAlpha();
r += c.getRed();
g += c.getGreen();
b += c.getBlue();
}
}
// s32 sdiv = s32_log2_s32(fx * fy);
// a = core::s32_clamp( ( a >> sdiv ) + bias, 0, 255 );
// r = core::s32_clamp( ( r >> sdiv ) + bias, 0, 255 );
// g = core::s32_clamp( ( g >> sdiv ) + bias, 0, 255 );
// b = core::s32_clamp( ( b >> sdiv ) + bias, 0, 255 );
c.set( a, r, g, b );
return c;
}
// Methods for Software drivers, non-virtual and not necessary to copy into other image classes
//! draws a rectangle
void SImage::drawRectangle(const core::rect<s32>& rect, const SColor &color)
{
// Blit(color.getAlpha() == 0xFF ? BLITTER_COLOR : BLITTER_COLOR_ALPHA,
// this, 0, &rect.UpperLeftCorner, 0, &rect, color.color);
}
//! draws a line from to with color
void SImage::drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color)
{
// AbsRectangle clip;
// GetClip( clip, this );
// core::position2d<s32> p[2];
//
// if ( ClipLine( clip, p[0], p[1], from, to ) )
// {
// u32 alpha = extractAlpha( color.color );
//
// switch ( Format )
// {
// case ECF_A1R5G5B5:
// if ( alpha == 256 )
// {
// RenderLine16_Decal( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ) );
// }
// else
// {
// RenderLine16_Blend( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ), alpha >> 3 );
// }
// break;
// case ECF_A8R8G8B8:
// if ( alpha == 256 )
// {
// RenderLine32_Decal( this, p[0], p[1], color.color );
// }
// else
// {
// RenderLine32_Blend( this, p[0], p[1], color.color, alpha );
// }
// break;
// default:
// break;
// }
// }
}
} // end namespace video
} // end namespace irr

View File

@ -1,109 +1,130 @@
//most simplistic IImage Implementation, copypasted form irrlichts CImage
#include "irrlicht/irrlicht.h"
namespace irr
{
namespace video
{
class SImage : public IImage
{
public:
//! constructor for empty image
SImage(ECOLOR_FORMAT format, const core::dimension2d<s32>& size);
//! destructor
virtual ~SImage();
//! returns a pixel
virtual SColor getPixel(u32 x, u32 y) const;
//! sets a pixel
virtual void setPixel(u32 x, u32 y, const SColor &color );
//! Lock function.
virtual void* lock()
{
return Data;
};
//! Unlock function.
virtual void unlock() {};
//! Returns width and height of image data.
virtual const core::dimension2d<s32>& getDimension() const;
//! Returns bits per pixel.
virtual u32 getBitsPerPixel() const;
//! Returns bytes per pixel
virtual u32 getBytesPerPixel() const;
//! Returns image data size in bytes
virtual u32 getImageDataSizeInBytes() const;
//! Returns image data size in pixels
virtual u32 getImageDataSizeInPixels() const;
//! returns mask for red value of a pixel
virtual u32 getRedMask() const;
//! returns mask for green value of a pixel
virtual u32 getGreenMask() const;
//! returns mask for blue value of a pixel
virtual u32 getBlueMask() const;
//! returns mask for alpha value of a pixel
virtual u32 getAlphaMask() const;
//! returns the color format
virtual ECOLOR_FORMAT getColorFormat() const;
//! copies this surface into another
void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0));
//! 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);
//! copies this surface into another, scaling it to fit.
void copyToScaling(IImage* target);
//! returns pitch of image
virtual u32 getPitch() const
{
return Pitch;
}
static u32 getBitsPerPixelFromFormat(ECOLOR_FORMAT format);
private:
//! assumes format and size has been set and creates the rest
void initData();
void setBitMasks();
inline SColor getPixelBox ( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const;
void* Data;
core::dimension2d<s32> Size;
u32 BitsPerPixel;
u32 BytesPerPixel;
u32 Pitch;
ECOLOR_FORMAT Format;
u32 RedMask;
u32 GreenMask;
u32 BlueMask;
u32 AlphaMask;
};
}//video
}//irr
//most simplistic IImage Implementation, copypasted form irrlichts CImage
#ifndef __S_IMAGE_H_INCLUDED__
#define __S_IMAGE_H_INCLUDED__
#include "irrlicht/irrlicht.h"
namespace irr
{
namespace video
{
//! IImage implementation with a lot of special image operations for
//! 16 bit A1R5G5B5/32 Bit A8R8G8B8 images, which are used by the SoftwareDevice.
class SImage : public IImage
{
public:
//! constructor from raw image data
/** \param useForeignMemory: If true, the image will use the data pointer
directly and own it from now on, which means it will also try to delete [] the
data when the image will be destructed. If false, the memory will by copied. */
SImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size,
void* data, bool ownForeignMemory=true, bool deleteMemory = true);
//! constructor for empty image
SImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size);
//! destructor
virtual ~SImage();
//! Lock function.
virtual void* lock()
{
return Data;
}
//! Unlock function.
virtual void unlock() {}
//! Returns width and height of image data.
virtual const core::dimension2d<u32>& getDimension() const;
//! Returns bits per pixel.
virtual u32 getBitsPerPixel() const;
//! Returns bytes per pixel
virtual u32 getBytesPerPixel() const;
//! Returns image data size in bytes
virtual u32 getImageDataSizeInBytes() const;
//! Returns image data size in pixels
virtual u32 getImageDataSizeInPixels() const;
//! returns mask for red value of a pixel
virtual u32 getRedMask() const;
//! returns mask for green value of a pixel
virtual u32 getGreenMask() const;
//! returns mask for blue value of a pixel
virtual u32 getBlueMask() const;
//! returns mask for alpha value of a pixel
virtual u32 getAlphaMask() const;
//! returns a pixel
virtual SColor getPixel(u32 x, u32 y) const;
//! sets a pixel
virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false );
//! returns the color format
virtual ECOLOR_FORMAT getColorFormat() const;
//! returns pitch of image
virtual u32 getPitch() const { return Pitch; }
//! copies this surface into another, scaling it to fit.
virtual void copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format, u32 pitch=0);
//! copies this surface into another, scaling it to fit.
virtual void copyToScaling(IImage* target);
//! copies this surface into another
virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(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);
//! 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);
//! copies this surface into another, scaling it to fit, appyling a box filter
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false);
//! fills the surface with black or white
virtual void fill(const SColor &color);
//! draws a rectangle
void drawRectangle(const core::rect<s32>& rect, const SColor &color);
//! draws a line from to
void drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color);
private:
//! assumes format and size has been set and creates the rest
void initData();
inline SColor getPixelBox ( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const;
u8* Data;
core::dimension2d<u32> Size;
u32 BytesPerPixel;
u32 Pitch;
ECOLOR_FORMAT Format;
bool DeleteMemory;
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -13,7 +13,7 @@ using namespace gui;
using namespace irrklang;
inline core::rect<s32> CalcRelativeScreenPos(core::dimension2d<s32> dim, f32 x, f32 y, f32 w, f32 h)
inline core::rect<s32> CalcRelativeScreenPos(core::dimension2d<u32> dim, f32 x, f32 y, f32 w, f32 h)
{
core::rect<s32> r;
r.UpperLeftCorner.X = dim.Width * x;
@ -22,7 +22,7 @@ inline core::rect<s32> CalcRelativeScreenPos(core::dimension2d<s32> dim, f32 x,
r.LowerRightCorner.Y = r.UpperLeftCorner.Y + (dim.Height * h);
return r;
}
//Pure and applied stupidity: the driver returns u32, but guiend->addbutton insists on getting s32
inline core::rect<s32> CalcRelativeScreenPos(video::IVideoDriver* drv, f32 x, f32 y, f32 w, f32 h)
{
return CalcRelativeScreenPos(drv->getScreenSize(),x,y,w,h);

View File

@ -24,7 +24,7 @@ SceneCharSelection::SceneCharSelection(PseuGUI *gui) : Scene(gui)
{
realmwin = NULL;
newcharwin = NULL;
textdb = instance->dbmgr.GetDB("gui_charselect_text");
racedb = instance->dbmgr.GetDB("race");
classdb = instance->dbmgr.GetDB("class");
@ -35,8 +35,8 @@ SceneCharSelection::SceneCharSelection(PseuGUI *gui) : Scene(gui)
eventrecv->customHandledEvents.insert(EGET_LISTBOX_SELECTED_AGAIN);
eventrecv->store_mouse = false; // do not queue mouse input
dimension2d<s32> scrn = driver->getScreenSize();
dimension2d<u32> scrn = driver->getScreenSize();
guienv->addButton(CalcRelativeScreenPos(driver, 0.45f ,0.9f, 0.15f, 0.05f), NULL, BUTTON_ENTER_WORLD,
GetStringFromDB(ISCENE_CHARSEL_BUTTONS, DSCENE_CHARSEL_BUTTON_ENTERWORLD).c_str());
guienv->addButton(CalcRelativeScreenPos(driver, 0.9f, 0.92f, 0.08f, 0.03f), NULL, BUTTON_BACK,
@ -150,7 +150,7 @@ void SceneCharSelection::OnUpdate(s32 timepassed)
}
}
}
}
}
@ -189,7 +189,7 @@ void SceneCharSelection::OnUpdate(s32 timepassed)
}
if(eventrecv->buttons & BUTTON_NEW_CHARACTER && !newcharwin)
{
dimension2d<s32> dim;
dimension2d<u32> dim;
rect<s32> pos;
msgbox_textid = 0;
newcharwin = guienv->addWindow(CalcRelativeScreenPos(driver, 0.2f, 0.2f, 0.6f, 0.6f), true,
@ -227,7 +227,7 @@ void SceneCharSelection::OnUpdate(s32 timepassed)
scenedata[ISCENE_CHARSEL_REALMFIRST] = 0;
if(instance->GetRSession())
{
dimension2d<s32> dim;
dimension2d<u32> dim;
rect<s32> pos;
realmwin = guienv->addWindow(CalcRelativeScreenPos(driver, 0.2f, 0.2f, 0.6f, 0.6f), true,
GetStringFromDB(ISCENE_CHARSEL_LABELS, DSCENE_CHARSEL_LABEL_REALMWIN).c_str());
@ -286,7 +286,7 @@ void SceneCharSelection::OnUpdate(s32 timepassed)
{
guienv->addMessageBox(L"Not yet implemented!", L"This action is not yet supported.\nYou can change the realm only while still connected to the realm server.");
}
}
}
if(eventrecv->buttons & BUTTON_REALMWIN_OK && realmwin)
{
RealmSession *rs = instance->GetRSession();
@ -341,7 +341,7 @@ void SceneCharSelection::OnUpdate(s32 timepassed)
newcharwin->remove();
newcharwin = NULL;
}
if(newcharwin && msgbox_textid != scenedata[ISCENE_CHARSEL_ERRMSG])
{
msgbox_textid = scenedata[ISCENE_CHARSEL_ERRMSG];

View File

@ -27,7 +27,7 @@ SceneLogin::SceneLogin(PseuGUI *gui) : Scene(gui)
eventrecv->keyToButtonMap[KEY_ESCAPE] = BUTTON_QUIT;
device->setEventReceiver(eventrecv);
dimension2d<s32> scrn = driver->getScreenSize();
dimension2d<u32> scrn = driver->getScreenSize();
irrlogo = guienv->addImage(driver->getTexture("data/misc/irrlichtlogo.png"), core::position2d<s32>(5,5),true,rootgui);
background = guienv->addImage(driver->getTexture("data/misc/sky.jpg"), core::position2d<s32>(5,5),true,rootgui);

View File

@ -94,7 +94,7 @@ SceneWorld::SceneWorld(PseuGUI *g) : Scene(g)
logdetail("GUI: Using farclip=%.2f fogfar=%.2f fognear=%.2f", farclip, fogfar, fognear);
driver->setFog(envBasicColor, true, fognear, fogfar, 0.02f);
driver->setFog(envBasicColor, video::EFT_FOG_LINEAR, fognear, fogfar, 0.02f);
// setup cursor
// shlainn: The cursor contrpller is a horrible hack.

View File

@ -195,12 +195,13 @@ ShTlTerrainSceneNode::ShTlTerrainSceneNode(scene::ISceneManager* smgr,
bool mmflag = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
CTexture = driver->addTexture(core::dimension2d<s32>(tw, th), "colortexture", video::ECF_A8R8G8B8);
CTexture = driver->addTexture(core::dimension2d<u32>(tw, th), "colortexture", video::ECF_A8R8G8B8);
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, mmflag);
Material[0].TextureLayer[0].Texture = CTexture;
Material[0].TextureLayer[0].TextureWrap = video::ETC_CLAMP_TO_EDGE;
Material[0].TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
Material[0].TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
// setup UV coordinates of vertices on 2nd texture layer
f32 ax = (f32)MeshSize.Width / CTexture->getSize().Width / MeshSize.Width;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2008 Nikolaus Gebhardt
// Copyright (C) 2008-2010 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) 2008 Nikolaus Gebhardt
// Copyright (C) 2008-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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) 2008 Nikolaus Gebhardt
// Copyright (C) 2008-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -0,0 +1,98 @@
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_ATTRIBUTES_H_INCLUDED__
#define __E_ATTRIBUTES_H_INCLUDED__
namespace irr
{
namespace io
{
//! Types of attributes available for IAttributes
enum E_ATTRIBUTE_TYPE
{
// integer attribute
EAT_INT = 0,
// float attribute
EAT_FLOAT,
// string attribute
EAT_STRING,
// boolean attribute
EAT_BOOL,
// enumeration attribute
EAT_ENUM,
// color attribute
EAT_COLOR,
// floating point color attribute
EAT_COLORF,
// 3d vector attribute
EAT_VECTOR3D,
// 2d position attribute
EAT_POSITION2D,
// vector 2d
EAT_VECTOR2D,
// rectangle attribute
EAT_RECT,
// matrix attribute
EAT_MATRIX,
// quaternion attribute
EAT_QUATERNION,
// 3d bounding box
EAT_BBOX,
// plane
EAT_PLANE,
// 3d triangle
EAT_TRIANGLE3D,
// line 2d
EAT_LINE2D,
// line 3d
EAT_LINE3D,
// array of stringws attribute
EAT_STRINGWARRAY,
// array of float
EAT_FLOATARRAY,
// array of int
EAT_INTARRAY,
// binary data attribute
EAT_BINARY,
// texture reference attribute
EAT_TEXTURE,
// user pointer void*
EAT_USER_POINTER,
// known attribute type count
EAT_COUNT,
// unknown attribute
EAT_UNKNOWN
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -0,0 +1,56 @@
#ifndef __E_DEVICE_TYPES_H_INCLUDED__
#define __E_DEVICE_TYPES_H_INCLUDED__
namespace irr
{
//! An enum for the different device types supported by the Irrlicht Engine.
enum E_DEVICE_TYPE
{
//! A device native to Microsoft Windows
/** This device uses the Win32 API and works in all versions of Windows. */
EIDT_WIN32,
//! A device native to Windows CE devices
/** This device works on Windows Mobile, Pocket PC and Microsoft SmartPhone devices */
EIDT_WINCE,
//! A device native to Unix style operating systems.
/** This device uses the X11 windowing system and works in Linux, Solaris, FreeBSD, OSX and
other operating systems which support X11. */
EIDT_X11,
//! A device native to Mac OSX
/** This device uses Apple's Cocoa API and works in Mac OSX 10.2 and above. */
EIDT_OSX,
//! A device which uses Simple DirectMedia Layer
/** The SDL device works under all platforms supported by SDL but first must be compiled
in by defining the IRR_USE_SDL_DEVICE macro in IrrCompileConfig.h */
EIDT_SDL,
//! A device for raw framebuffer access
/** Best used with embedded devices and mobile systems.
Does not need X11 or other graphical subsystems.
May support hw-acceleration via OpenGL-ES for FBDirect */
EIDT_FRAMEBUFFER,
//! A simple text only device supported by all platforms.
/** This device allows applications to run from the command line without opening a window.
It can render the output of the software drivers to the console as ASCII. It only supports
mouse and keyboard in Windows operating systems. */
EIDT_CONSOLE,
//! This selection allows Irrlicht to choose the best device from the ones available.
/** If this selection is chosen then Irrlicht will try to use the IrrlichtDevice native
to your operating system. If this is unavailable then the X11, SDL and then console device
will be tried. This ensures that Irrlicht will run even if your platform is unsupported,
although it may not be able to render anything. */
EIDT_BEST
};
} // end namespace irr
#endif // __E_DEVICE_TYPES_H_INCLUDED__

View File

@ -1,97 +1,118 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_DRIVER_FEATURES_H_INCLUDED__
#define __E_DRIVER_FEATURES_H_INCLUDED__
namespace irr
{
namespace video
{
//! enumeration for querying features of the video driver.
enum E_VIDEO_DRIVER_FEATURE
{
//! Is driver able to render to a surface?
EVDF_RENDER_TO_TARGET = 0,
//! Is hardeware transform and lighting supported?
EVDF_HARDWARE_TL,
//! Are multiple textures per material possible?
EVDF_MULTITEXTURE,
//! Is driver able to render with a bilinear filter applied?
EVDF_BILINEAR_FILTER,
//! Can the driver handle mip maps?
EVDF_MIP_MAP,
//! Can the driver update mip maps automatically?
EVDF_MIP_MAP_AUTO_UPDATE,
//! Are stencilbuffers switched on and does the device support stencil buffers?
EVDF_STENCIL_BUFFER,
//! Is Vertex Shader 1.1 supported?
EVDF_VERTEX_SHADER_1_1,
//! Is Vertex Shader 2.0 supported?
EVDF_VERTEX_SHADER_2_0,
//! Is Vertex Shader 3.0 supported?
EVDF_VERTEX_SHADER_3_0,
//! Is Pixel Shader 1.1 supported?
EVDF_PIXEL_SHADER_1_1,
//! Is Pixel Shader 1.2 supported?
EVDF_PIXEL_SHADER_1_2,
//! Is Pixel Shader 1.3 supported?
EVDF_PIXEL_SHADER_1_3,
//! Is Pixel Shader 1.4 supported?
EVDF_PIXEL_SHADER_1_4,
//! Is Pixel Shader 2.0 supported?
EVDF_PIXEL_SHADER_2_0,
//! Is Pixel Shader 3.0 supported?
EVDF_PIXEL_SHADER_3_0,
//! Are ARB vertex programs v1.0 supported?
EVDF_ARB_VERTEX_PROGRAM_1,
//! Are ARB fragment programs v1.0 supported?
EVDF_ARB_FRAGMENT_PROGRAM_1,
//! Is GLSL supported?
EVDF_ARB_GLSL,
//! 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,
//! Are vertex buffer objects supported?
EVDF_VERTEX_BUFFER_OBJECT,
//! Only used for counting the elements of this enum
EVDF_COUNT
};
} // end namespace video
} // end namespace irr
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_DRIVER_FEATURES_H_INCLUDED__
#define __E_DRIVER_FEATURES_H_INCLUDED__
namespace irr
{
namespace video
{
//! enumeration for querying features of the video driver.
enum E_VIDEO_DRIVER_FEATURE
{
//! Is driver able to render to a surface?
EVDF_RENDER_TO_TARGET = 0,
//! Is hardeware transform and lighting supported?
EVDF_HARDWARE_TL,
//! Are multiple textures per material possible?
EVDF_MULTITEXTURE,
//! Is driver able to render with a bilinear filter applied?
EVDF_BILINEAR_FILTER,
//! Can the driver handle mip maps?
EVDF_MIP_MAP,
//! Can the driver update mip maps automatically?
EVDF_MIP_MAP_AUTO_UPDATE,
//! Are stencilbuffers switched on and does the device support stencil buffers?
EVDF_STENCIL_BUFFER,
//! Is Vertex Shader 1.1 supported?
EVDF_VERTEX_SHADER_1_1,
//! Is Vertex Shader 2.0 supported?
EVDF_VERTEX_SHADER_2_0,
//! Is Vertex Shader 3.0 supported?
EVDF_VERTEX_SHADER_3_0,
//! Is Pixel Shader 1.1 supported?
EVDF_PIXEL_SHADER_1_1,
//! Is Pixel Shader 1.2 supported?
EVDF_PIXEL_SHADER_1_2,
//! Is Pixel Shader 1.3 supported?
EVDF_PIXEL_SHADER_1_3,
//! Is Pixel Shader 1.4 supported?
EVDF_PIXEL_SHADER_1_4,
//! Is Pixel Shader 2.0 supported?
EVDF_PIXEL_SHADER_2_0,
//! Is Pixel Shader 3.0 supported?
EVDF_PIXEL_SHADER_3_0,
//! Are ARB vertex programs v1.0 supported?
EVDF_ARB_VERTEX_PROGRAM_1,
//! Are ARB fragment programs v1.0 supported?
EVDF_ARB_FRAGMENT_PROGRAM_1,
//! Is GLSL supported?
EVDF_ARB_GLSL,
//! 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,
//! Are vertex buffer objects supported?
EVDF_VERTEX_BUFFER_OBJECT,
//! Supports Alpha To Coverage
EVDF_ALPHA_TO_COVERAGE,
//! Supports Color masks (disabling color planes in output)
EVDF_COLOR_MASK,
//! Supports multiple render targets at once
EVDF_MULTIPLE_RENDER_TARGETS,
//! Supports separate blend settings for multiple render targets
EVDF_MRT_BLEND,
//! Supports separate color masks for multiple render targets
EVDF_MRT_COLOR_MASK,
//! Supports separate blend functions for multiple render targets
EVDF_MRT_BLEND_FUNC,
//! Supports geometry shaders
EVDF_GEOMETRY_SHADER,
//! Only used for counting the elements of this enum
EVDF_COUNT
};
} // end namespace video
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -13,45 +13,47 @@ namespace video
//! An enum for all types of drivers the Irrlicht Engine supports.
enum E_DRIVER_TYPE
{
//! 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.
//! 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,
//! Direct3D8 device, only available on Win32 platforms.
//! Performs hardware accelerated rendering of 3D and 2D
//! primitives.
/** Performs hardware accelerated rendering of 3D and 2D
primitives. */
EDT_DIRECT3D8,
//! 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.
EDT_OPENGL
/** Performs hardware accelerated rendering of 3D and 2D
primitives. */
EDT_OPENGL,
//! No driver, just for counting the elements
EDT_COUNT
};
} // end namespace video

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -35,3 +35,4 @@ const c8* const GUIAlignmentNames[] =
} // namespace irr
#endif // __E_GUI_ALIGNMENT_H_INCLUDED__

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -79,17 +79,19 @@ enum EGUI_ELEMENT_TYPE
//! A tool bar (IGUIToolBar)
EGUIET_TOOL_BAR,
//! A Tree View
EGUIET_TREE_VIEW,
//! A window
EGUIET_WINDOW,
//! 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.
//! Not an element, amount of elements in there
EGUIET_COUNT,
//! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit.
EGUIET_FORCE_32_BIT = 0x7fffffff
};
@ -118,7 +120,9 @@ const c8* const GUIElementTypeNames[] =
"tabControl",
"table",
"toolBar",
"treeview",
"window",
"element",
0
};

View File

@ -1,40 +1,44 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_HARDWARE_BUFFER_FLAGS_INCLUDED__
#define __E_HARDWARE_BUFFER_FLAGS_INCLUDED__
namespace irr
{
namespace scene
{
enum E_HARDWARE_MAPPING
{
//! Don't load in hardware
EHM_NEVER=0,
//! Rarely changed
EHM_STATIC,
//! Sometimes changed
EHM_DYNAMIC,
//! Always changed
EHM_STREAM
};
enum E_BUFFER_TYPE
{
EBT_NONE=0,
EBT_VERTEX,
EBT_INDEX,
EBT_VERTEX_AND_INDEX
};
} // end namespace scene
} // end namespace irr
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_HARDWARE_BUFFER_FLAGS_INCLUDED__
#define __E_HARDWARE_BUFFER_FLAGS_INCLUDED__
namespace irr
{
namespace scene
{
enum E_HARDWARE_MAPPING
{
//! Don't store on the hardware
EHM_NEVER=0,
//! Rarely changed, usually stored completely on the hardware
EHM_STATIC,
//! Sometimes changed, driver optimized placement
EHM_DYNAMIC,
//! Always changed, cache optimizing on the GPU
EHM_STREAM
};
enum E_BUFFER_TYPE
{
//! Does not change anything
EBT_NONE=0,
//! Change the vertex mapping
EBT_VERTEX,
//! Change the index mapping
EBT_INDEX,
//! Change both vertex and index mapping to the same value
EBT_VERTEX_AND_INDEX
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -14,48 +14,48 @@ namespace video
enum E_MATERIAL_FLAG
{
//! Draw as wireframe or filled triangles? Default: false
EMF_WIREFRAME = 0,
EMF_WIREFRAME = 0x1,
//! Draw as point cloud or filled triangles? Default: false
EMF_POINTCLOUD,
EMF_POINTCLOUD = 0x2,
//! Flat or Gouraud shading? Default: true
EMF_GOURAUD_SHADING,
EMF_GOURAUD_SHADING = 0x4,
//! Will this material be lighted? Default: true
EMF_LIGHTING,
EMF_LIGHTING = 0x8,
//! Is the ZBuffer enabled? Default: true
EMF_ZBUFFER,
EMF_ZBUFFER = 0x10,
//! May be written to the zbuffer or is it readonly. Default: true
/** This flag is ignored, if the material type is a transparent type. */
EMF_ZWRITE_ENABLE,
EMF_ZWRITE_ENABLE = 0x20,
//! Is backface culling enabled? Default: true
EMF_BACK_FACE_CULLING,
EMF_BACK_FACE_CULLING = 0x40,
//! Is frontface culling enabled? Default: false
/** Overrides EMF_BACK_FACE_CULLING if both are enabled. */
EMF_FRONT_FACE_CULLING,
EMF_FRONT_FACE_CULLING = 0x80,
//! Is bilinear filtering enabled? Default: true
EMF_BILINEAR_FILTER,
EMF_BILINEAR_FILTER = 0x100,
//! Is trilinear filtering enabled? Default: false
/** If the trilinear filter flag is enabled,
the bilinear filtering flag is ignored. */
EMF_TRILINEAR_FILTER,
EMF_TRILINEAR_FILTER = 0x200,
//! 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. */
EMF_ANISOTROPIC_FILTER,
EMF_ANISOTROPIC_FILTER = 0x400,
//! Is fog enabled? Default: false
EMF_FOG_ENABLE,
EMF_FOG_ENABLE = 0x800,
//! Normalizes normals. Default: false
/** You can enable this if you need to scale a dynamic lighted
@ -63,13 +63,19 @@ namespace video
will get darker. If you enable the EMF_NORMALIZE_NORMALS flag,
the normals will be normalized again, and the model will look
as bright as it should. */
EMF_NORMALIZE_NORMALS,
EMF_NORMALIZE_NORMALS = 0x1000,
//! Access to all layers texture wrap settings. Overwrites separate layer settings.
EMF_TEXTURE_WRAP,
EMF_TEXTURE_WRAP = 0x2000,
//! This is not a flag, but a value indicating how much flags there are.
EMF_MATERIAL_FLAG_COUNT
//! AntiAliasing mode
EMF_ANTI_ALIASING = 0x4000,
//! ColorMask bits, for enabling the color planes
EMF_COLOR_MASK = 0x8000,
//! ColorMaterial enum for vertex color interpretation
EMF_COLOR_MATERIAL = 0x10000
};
} // end namespace video

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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.
//! 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. Dynamic 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 added instead of modulated.
//! 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. Dynamic light is
//! ignored. The texture colors are effectively multiplied 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. Dynamic 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,153 +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 the first
//! texture.
//! 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 first texture.
//! 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 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 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.
//! 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. 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()).
//! 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()). */
EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
//! Makes the material transparent based on the vertex alpha
//! value.
//! Makes the material transparent based on the vertex alpha value.
EMT_TRANSPARENT_VERTEX_ALPHA,
//! 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.
//! 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 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.
//! 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 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.
//! 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 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.
//! 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 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 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.
//! 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 first texture. Generic blending method.
/** 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,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -18,7 +18,7 @@ namespace scene
name clashes with external mesh writers.*/
enum EMESH_WRITER_TYPE
{
//! Irrlicht Native mesh writer, for static .irrmesh files.
//! Irrlicht native mesh writer, for static .irrmesh files.
EMWT_IRR_MESH = MAKE_IRR_ID('i','r','r','m'),
//! COLLADA mesh writer for .dae and .xml files
@ -28,7 +28,10 @@ namespace scene
EMWT_STL = MAKE_IRR_ID('s','t','l',0),
//! OBJ mesh writer for .obj files
EMWT_OBJ = MAKE_IRR_ID('o','b','j',0)
EMWT_OBJ = MAKE_IRR_ID('o','b','j',0),
//! PLY mesh writer for .ply files
EMWT_PLY = MAKE_IRR_ID('p','l','y',0)
};
@ -41,8 +44,11 @@ namespace scene
//! write lightmap textures out if possible
EMWF_WRITE_LIGHTMAPS = 0x1,
//! write in a way that does consume less disk space
EMWF_WRITE_COMPRESSED = 0x2
//! write in a way that consumes less disk space
EMWF_WRITE_COMPRESSED = 0x2,
//! write in binary format rather than text
EMWF_WRITE_BINARY = 0x4
};
} // end namespace scene

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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

@ -0,0 +1,56 @@
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_PRIMITIVE_TYPES_H_INCLUDED__
#define __E_PRIMITIVE_TYPES_H_INCLUDED__
namespace irr
{
namespace scene
{
//! Enumeration for all primitive types there are.
enum E_PRIMITIVE_TYPE
{
//! All vertices are non-connected points.
EPT_POINTS=0,
//! All vertices form a single connected line.
EPT_LINE_STRIP,
//! Just as LINE_STRIP, but the last and the first vertex is also connected.
EPT_LINE_LOOP,
//! Every two vertices are connected creating n/2 lines.
EPT_LINES,
//! After the first two vertices each vertex defines a new triangle.
//! Always the two last and the new one form a new triangle.
EPT_TRIANGLE_STRIP,
//! After the first two vertices each vertex defines a new triangle.
//! All around the common first vertex.
EPT_TRIANGLE_FAN,
//! Explicitly set all vertices for each triangle.
EPT_TRIANGLES,
//! After the first two vertices each further tw vetices create a quad with the preceding two.
EPT_QUAD_STRIP,
//! Every four vertices create a quad.
EPT_QUADS,
//! Just as LINE_LOOP, but filled.
EPT_POLYGON,
//! The single vertices are expanded to quad billboards on the GPU.
EPT_POINT_SPRITES
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -46,8 +46,7 @@ namespace scene
//! 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -36,11 +36,14 @@ namespace scene
//! Sky Box Scene Node
ESNT_SKY_BOX = MAKE_IRR_ID('s','k','y','_'),
//! Sky Dome Scene Node
ESNT_SKY_DOME = MAKE_IRR_ID('s','k','y','d'),
//! Shadow Volume Scene Node
ESNT_SHADOW_VOLUME = MAKE_IRR_ID('s','h','d','w'),
//! OctTree Scene Node
ESNT_OCT_TREE = MAKE_IRR_ID('o','c','t','t'),
//! Octree Scene Node
ESNT_OCTREE = MAKE_IRR_ID('o','c','t','r'),
//! Mesh Scene Node
ESNT_MESH = MAKE_IRR_ID('m','e','s','h'),
@ -66,15 +69,21 @@ namespace scene
//! Particle System Scene Node
ESNT_PARTICLE_SYSTEM = MAKE_IRR_ID('p','t','c','l'),
//! Quake3 Shader Scene Node
ESNT_Q3SHADER_SCENE_NODE = MAKE_IRR_ID('q','3','s','h'),
//! Quake3 Model Scene Node ( has tag to link to )
ESNT_MD3_SCENE_NODE = MAKE_IRR_ID('m','d','3','_'),
//! Volume Light Scene Node
ESNT_VOLUME_LIGHT = MAKE_IRR_ID('v','o','l','l'),
//! Maya Camera Scene Node
//! Legacy, for loading version <= 1.4.x .irr files
/** 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
/** Legacy, for loading version <= 1.4.x .irr files */
ESNT_CAMERA_FPS = MAKE_IRR_ID('c','a','m','F'),
//! Unknown scene node

View File

@ -0,0 +1,90 @@
#ifndef __E_SHADER_TYPES_H_INCLUDED__
#define __E_SHADER_TYPES_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
namespace video
{
//! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_VERTEX_SHADER_TYPE
{
EVST_VS_1_1 = 0,
EVST_VS_2_0,
EVST_VS_2_a,
EVST_VS_3_0,
EVST_VS_4_0,
EVST_VS_4_1,
EVST_VS_5_0,
//! This is not a type, but a value indicating how much types there are.
EVST_COUNT
};
//! Names for all vertex shader types, each entry corresponds to a E_VERTEX_SHADER_TYPE entry.
const c8* const VERTEX_SHADER_TYPE_NAMES[] = {
"vs_1_1",
"vs_2_0",
"vs_2_a",
"vs_3_0",
"vs_4_0",
"vs_4_1",
"vs_5_0",
0 };
//! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_PIXEL_SHADER_TYPE
{
EPST_PS_1_1 = 0,
EPST_PS_1_2,
EPST_PS_1_3,
EPST_PS_1_4,
EPST_PS_2_0,
EPST_PS_2_a,
EPST_PS_2_b,
EPST_PS_3_0,
EPST_PS_4_0,
EPST_PS_4_1,
EPST_PS_5_0,
//! This is not a type, but a value indicating how much types there are.
EPST_COUNT
};
//! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry.
const c8* const PIXEL_SHADER_TYPE_NAMES[] = {
"ps_1_1",
"ps_1_2",
"ps_1_3",
"ps_1_4",
"ps_2_0",
"ps_2_a",
"ps_2_b",
"ps_3_0",
"ps_4_0",
"ps_4_1",
"ps_5_0",
0 };
//! Enum for supported geometry shader types
enum E_GEOMETRY_SHADER_TYPE
{
EGST_GS_4_0 = 0,
//! This is not a type, but a value indicating how much types there are.
EGST_COUNT
};
//! String names for supported geometry shader types
const c8* const GEOMETRY_SHADER_TYPE_NAMES[] = {
"gs_4_0",
0 };
} // end namespace video
} // end namespace irr
#endif // __E_SHADER_TYPES_H_INCLUDED__

View File

@ -1,36 +1,36 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_TERRAIN_ELEMENTS_H__
#define __E_TERRAIN_ELEMENTS_H__
namespace irr
{
namespace scene
{
//! enumeration for patch sizes specifying the size of patches in the TerrainSceneNode
enum E_TERRAIN_PATCH_SIZE
{
//! patch size of 9, at most, use 4 levels of detail with this patch size.
ETPS_9 = 9,
//! patch size of 17, at most, use 5 levels of detail with this patch size.
ETPS_17 = 17,
//! patch size of 33, at most, use 6 levels of detail with this patch size.
ETPS_33 = 33,
//! patch size of 65, at most, use 7 levels of detail with this patch size.
ETPS_65 = 65,
//! patch size of 129, at most, use 8 levels of detail with this patch size.
ETPS_129 = 129
};
} // end namespace scene
} // end namespace irr
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_TERRAIN_ELEMENTS_H__
#define __E_TERRAIN_ELEMENTS_H__
namespace irr
{
namespace scene
{
//! enumeration for patch sizes specifying the size of patches in the TerrainSceneNode
enum E_TERRAIN_PATCH_SIZE
{
//! patch size of 9, at most, use 4 levels of detail with this patch size.
ETPS_9 = 9,
//! patch size of 17, at most, use 5 levels of detail with this patch size.
ETPS_17 = 17,
//! patch size of 33, at most, use 6 levels of detail with this patch size.
ETPS_33 = 33,
//! patch size of 65, at most, use 7 levels of detail with this patch size.
ETPS_65 = 65,
//! patch size of 129, at most, use 8 levels of detail with this patch size.
ETPS_129 = 129
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -47,8 +47,10 @@ namespace scene
can be loaded directly by Irrlicht */
EAMT_OCT,
//PSEUWOW
//! WoW M2 files
EAMT_M2,
//PSEUWOW END
//! generic skinned mesh
EAMT_SKINNED

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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) 2007-2008 Nikolaus Gebhardt / Thomas Alten
// Copyright (C) 2007-2010 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -89,15 +89,15 @@ namespace scene
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 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 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. artefact md2
s32 frameStart; //starting position of frame-structur
s32 tagStart; //starting position of tag-structures
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
s32 fileSize;
};
@ -153,7 +153,7 @@ namespace scene
{
SMD3MeshHeader MeshHeader;
core::array < core::stringc > Shader;
core::stringc Shader;
core::array < s32 > Indices;
core::array < SMD3Vertex > Vertices;
core::array < SMD3TexCoord > Tex;
@ -161,44 +161,74 @@ namespace scene
//! hold a tag info for connecting meshes
/** Basically its an alternate way to describe a transformation. */
struct SMD3QuaterionTag
struct SMD3QuaternionTag
{
SMD3QuaterionTag() {}
virtual ~SMD3QuaternionTag()
{
position.X = 0.f;
}
SMD3QuaterionTag( const core::stringc& name )
// construct copy constructor
SMD3QuaternionTag( const SMD3QuaternionTag & copyMe )
{
*this = copyMe;
}
// construct for searching
SMD3QuaternionTag( const core::stringc& name )
: Name ( name ) {}
// construct from a matrix
SMD3QuaterionTag ( const core::stringc& name, const core::matrix4 &m ) : Name(name), position(m.getTranslation()), rotation(m)
{ }
SMD3QuaternionTag ( 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)
{ }
SMD3QuaternionTag ( const core::vector3df &pos, const core::vector3df &angle )
: position(pos), rotation(angle * core::DEGTORAD) {}
// set to matrix
void setto ( core::matrix4 &m )
{
rotation.getMatrix ( m );
m.setTranslation ( position );
rotation.getMatrix ( m, position );
}
bool operator == ( const SMD3QuaterionTag &other ) const
bool operator == ( const SMD3QuaternionTag &other ) const
{
return Name == other.Name;
}
SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe )
{
Name = copyMe.Name;
position = copyMe.position;
rotation = copyMe.rotation;
return *this;
}
core::stringc Name;
core::vector3df position;
core::quaternion rotation;
};
//! holds a associative list of named quaternions
struct SMD3QuaterionTagList : public virtual IReferenceCounted
struct SMD3QuaternionTagList
{
SMD3QuaterionTag* get ( const core::stringc& name )
SMD3QuaternionTagList ()
{
SMD3QuaterionTag search ( name );
Container.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
}
// construct copy constructor
SMD3QuaternionTagList( const SMD3QuaternionTagList & copyMe )
{
*this = copyMe;
}
virtual ~SMD3QuaternionTagList () {}
SMD3QuaternionTag* get ( const core::stringc& name )
{
SMD3QuaternionTag search ( name );
s32 index = Container.linear_search ( search );
if ( index >= 0 )
return &Container[index];
@ -210,39 +240,61 @@ namespace scene
return Container.size();
}
const SMD3QuaterionTag& operator[](u32 index) const
void set_used ( u32 new_size)
{
s32 diff = (s32) new_size - (s32) Container.allocated_size ();
if ( diff > 0 )
{
SMD3QuaternionTag e ( "" );
for ( s32 i = 0; i < diff; ++i )
Container.push_back ( e );
}
}
const SMD3QuaternionTag& operator[](u32 index) const
{
return Container[index];
}
SMD3QuaterionTag& operator[](u32 index)
SMD3QuaternionTag& operator[](u32 index)
{
return Container[index];
}
SMD3QuaterionTagList & operator = (const SMD3QuaterionTagList & copyMe)
void push_back ( const SMD3QuaternionTag& other )
{
Container.push_back ( other );
}
SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe)
{
Container = copyMe.Container;
return *this;
}
core::array < SMD3QuaterionTag > Container;
private:
core::array < SMD3QuaternionTag > Container;
};
//! Holding Frames Buffers and Tag Infos
struct SMD3Mesh: public IReferenceCounted
{
~SMD3Mesh()
SMD3Mesh ()
{
MD3Header.numFrames = 0;
}
virtual ~SMD3Mesh()
{
for (u32 i=0; i<Buffer.size(); ++i)
Buffer[i]->drop();
}
SMD3Header MD3Header;
core::stringc Name;
core::array < SMD3MeshBuffer * > Buffer;
SMD3QuaterionTagList TagList;
SMD3QuaternionTagList TagList;
SMD3Header MD3Header;
};
@ -255,7 +307,7 @@ namespace scene
virtual void setInterpolationShift ( u32 shift, u32 loopMode ) = 0;
//! get the tag list of the mesh.
virtual SMD3QuaterionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) = 0;
virtual SMD3QuaternionTagList *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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -25,10 +25,7 @@ namespace scene
EJUOR_READ,
//! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() )
EJUOR_CONTROL,
//! count of all available interpolation modes
EJUOR_COUNT
EJUOR_CONTROL
};
@ -81,10 +78,14 @@ namespace scene
\return True if successful, false if not. */
virtual bool setFrameLoop(s32 begin, s32 end) = 0;
//! Sets the speed with witch the animation is played.
//! Sets the speed with which the animation is played.
/** \param framesPerSecond: Frames per second played. */
virtual void setAnimationSpeed(f32 framesPerSecond) = 0;
//! Gets the speed with which the animation is played.
/** \return Frames per second played. */
virtual f32 getAnimationSpeed() const =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
@ -135,9 +136,11 @@ namespace scene
//! Deprecated command, please use getJointNode
virtual ISceneNode* getXJointNode(const c8* jointName) = 0;
//PSEUWOW
//! Starts a M2 animation.
virtual bool setM2Animation(u32 anim) = 0;
//PSEUWOW END
//! 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
@ -196,7 +199,7 @@ namespace scene
virtual IAnimatedMesh* getMesh(void) = 0;
//! 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;
virtual const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname) = 0;
//! Set how the joints should be updated on render
virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode)=0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -23,6 +23,7 @@
#include "irrString.h"
#include "irrArray.h"
#include "IXMLReader.h"
#include "EAttributes.h"
namespace irr
{
@ -34,88 +35,6 @@ namespace io
{
class IXMLWriter;
//! Types of attributes available for IAttributes
enum E_ATTRIBUTE_TYPE
{
// integer attribute
EAT_INT = 0,
// float attribute
EAT_FLOAT,
// string attribute
EAT_STRING,
// boolean attribute
EAT_BOOL,
// enumeration attribute
EAT_ENUM,
// color attribute
EAT_COLOR,
// floating point color attribute
EAT_COLORF,
// 3d vector attribute
EAT_VECTOR3D,
// 2d position attribute
EAT_POSITION2D,
// vector 2d
EAT_VECTOR2D,
// rectangle attribute
EAT_RECT,
// matrix attribute
EAT_MATRIX,
// quaternion attribute
EAT_QUATERNION,
// 3d bounding box
EAT_BBOX,
// plane
EAT_PLANE,
// 3d triangle
EAT_TRIANGLE3D,
// line 2d
EAT_LINE2D,
// line 3d
EAT_LINE3D,
// array of stringws attribute
EAT_STRINGWARRAY,
// array of float
EAT_FLOATARRAY,
// array of int
EAT_INTARRAY,
// binary data attribute
EAT_BINARY,
// texture reference attribute
EAT_TEXTURE,
// user pointer void*
EAT_USER_POINTER,
// known attribute type count
EAT_COUNT,
// unknown attribute
EAT_UNKNOWN
};
//! Provides a generic interface for attributes and their values and the possiblity to serialize them
class IAttributes : public virtual IReferenceCounted
{
@ -315,12 +234,12 @@ public:
*/
//! Adds an attribute as wide string array
virtual void addArray(const c8* attributeName, core::array<core::stringw> value) = 0;
virtual void addArray(const c8* attributeName, const core::array<core::stringw>& value) = 0;
//! Sets an attribute value as a wide string array.
//! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const core::array<core::stringw> value) = 0;
virtual void setAttribute(const c8* attributeName, const core::array<core::stringw>& value) = 0;
//! Gets an attribute as an array of wide strings.
//! \param attributeName: Name of the attribute to get.
@ -333,7 +252,7 @@ public:
virtual core::array<core::stringw> getAttributeAsArray(s32 index) = 0;
//! Sets an attribute as an array of wide strings
virtual void setAttribute(s32 index, core::array<core::stringw> value) = 0;
virtual void setAttribute(s32 index, const core::array<core::stringw>& value) = 0;
/*

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -42,15 +42,26 @@ namespace scene
\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;
virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal=false) =0;
//! Gets the current projection matrix of the camera.
/** \return The current projection matrix of the camera. */
virtual const core::matrix4& getProjectionMatrix() const = 0;
virtual const core::matrix4& getProjectionMatrix() const =0;
//! Gets the current view matrix of the camera.
/** \return The current view matrix of the camera. */
virtual const core::matrix4& getViewMatrix() const = 0;
virtual const core::matrix4& getViewMatrix() const =0;
//! Sets a custom view matrix affector.
/** The matrix passed here, will be multiplied with the view
matrix when it gets updated. This allows for custom camera
setups like, for example, a reflection camera.
\param affector The affector matrix. */
virtual void setViewMatrixAffector(const core::matrix4& affector) =0;
//! Get the custom view matrix affector.
/** \return The affector matrix. */
virtual const core::matrix4& getViewMatrixAffector() const =0;
//! It is possible to send mouse and key events to the camera.
/** Most cameras may ignore this input, but camera scene nodes
@ -59,14 +70,14 @@ namespace scene
ISceneManager::addCameraSceneNodeFPS, may want to get
this input for changing their position, look at target or
whatever. */
virtual bool OnEvent(const SEvent& event) = 0;
virtual bool OnEvent(const SEvent& event) =0;
//! Sets the look at target of the camera
/** If the camera's target and rotation are bound ( @see
bindTargetAndRotation() ) then calling this will also change
the camera's scene node rotation to match the target.
\param pos Look at target of the camera, in world co-ordinates. */
virtual void setTarget(const core::vector3df& pos) = 0;
virtual void setTarget(const core::vector3df& pos) =0;
//! Sets the rotation of the node.
/** This only modifies the relative rotation of the node.
@ -74,64 +85,64 @@ namespace scene
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;
virtual void setRotation(const core::vector3df& rotation) =0;
//! Gets the current look at target of the camera
/** \return The current look at target of the camera, in world co-ordinates */
virtual const core::vector3df& getTarget() const = 0;
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;
virtual void setUpVector(const core::vector3df& pos) =0;
//! Gets the up vector of the camera.
/** \return The up vector of the camera, in world space. */
virtual const core::vector3df& getUpVector() const = 0;
virtual const core::vector3df& getUpVector() const =0;
//! Gets the value of the near plane of the camera.
/** \return The value of the near plane of the camera. */
virtual f32 getNearValue() const = 0;
virtual f32 getNearValue() const =0;
//! Gets the value of the far plane of the camera.
/** \return The value of the far plane of the camera. */
virtual f32 getFarValue() const = 0;
virtual f32 getFarValue() const =0;
//! Gets the aspect ratio of the camera.
/** \return The aspect ratio of the camera. */
virtual f32 getAspectRatio() const = 0;
virtual f32 getAspectRatio() const =0;
//! Gets the field of view of the camera.
/** \return The field of view of the camera in radiants. */
virtual f32 getFOV() const = 0;
/** \return The field of view of the camera in radians. */
virtual f32 getFOV() const =0;
//! Sets the value of the near clipping plane. (default: 1.0f)
/** \param zn: New z near value. */
virtual void setNearValue(f32 zn) = 0;
virtual void setNearValue(f32 zn) =0;
//! Sets the value of the far clipping plane (default: 2000.0f)
/** \param zf: New z far value. */
virtual void setFarValue(f32 zf) = 0;
virtual void setFarValue(f32 zf) =0;
//! Sets the aspect ratio (default: 4.0f / 3.0f)
/** \param aspect: New aspect ratio. */
virtual void setAspectRatio(f32 aspect) = 0;
virtual void setAspectRatio(f32 aspect) =0;
//! Sets the field of view (Default: PI / 2.5f)
/** \param fovy: New field of view in radiants. */
virtual void setFOV(f32 fovy) = 0;
/** \param fovy: New field of view in radians. */
virtual void setFOV(f32 fovy) =0;
//! Get the view frustum.
/** Needed sometimes by bspTree or LOD render nodes.
\return The current view frustum. */
virtual const SViewFrustum* getViewFrustum() const = 0;
virtual const SViewFrustum* getViewFrustum() const =0;
//! Disables or enables the camera to get key or mouse inputs.
/** If this is set to true, the camera will respond to key
inputs otherwise not. */
virtual void setInputReceiverEnabled(bool enabled) = 0;
virtual void setInputReceiverEnabled(bool enabled) =0;
//! Checks if the input receiver of the camera is currently enabled.
virtual bool isInputReceiverEnabled() const = 0;
virtual bool isInputReceiverEnabled() const =0;
//! Checks if a camera is orthogonal.
virtual bool isOrthogonal() const
@ -146,14 +157,14 @@ namespace scene
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 binding true to bind the camera's scene node rotation
\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;
virtual void bindTargetAndRotation(bool bound) =0;
//! Queries if the camera scene node's rotation and its target position are bound together.
/** @see bindTargetAndRotation() */
virtual bool getTargetAndRotationBinding(void) const = 0;
virtual bool getTargetAndRotationBinding(void) const =0;
protected:

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -57,7 +57,7 @@ namespace gui
//! Returns the current position of the mouse cursor.
/** \return Returns the current position of the cursor. The returned position
is the position of the mouse cursor in pixel units. */
virtual core::position2d<s32> getPosition() = 0;
virtual const core::position2d<s32>& getPosition() = 0;
//! Returns the current position of the mouse cursor.
/** \return Returns the current position of the cursor. The returned position

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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) 2008 Nikolaus Gebhardt
// Copyright (C) 2008-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -6,7 +6,6 @@
#define __I_EVENT_RECEIVER_H_INCLUDED__
#include "ILogger.h"
#include "position2d.h"
#include "Keycodes.h"
#include "irrString.h"
@ -31,7 +30,7 @@ namespace irr
EET_MOUSE_INPUT_EVENT,
//! A key input event.
/** Like mouse events, keyboard events are created by the device and passed to
/** 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,
@ -43,7 +42,7 @@ namespace irr
Linux: Implemented, with POV hat issues.
MacOS / Other: Not yet implemented.
*/
EET_JOYSTICK_INPUT_EVENT,
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
@ -99,10 +98,50 @@ namespace irr
//! in what direction and how fast.
EMIE_MOUSE_WHEEL,
//! Left mouse button double click.
//! This event is generated after the second EMIE_LMOUSE_PRESSED_DOWN event.
EMIE_LMOUSE_DOUBLE_CLICK,
//! Right mouse button double click.
//! This event is generated after the second EMIE_RMOUSE_PRESSED_DOWN event.
EMIE_RMOUSE_DOUBLE_CLICK,
//! Middle mouse button double click.
//! This event is generated after the second EMIE_MMOUSE_PRESSED_DOWN event.
EMIE_MMOUSE_DOUBLE_CLICK,
//! Left mouse button triple click.
//! This event is generated after the third EMIE_LMOUSE_PRESSED_DOWN event.
EMIE_LMOUSE_TRIPLE_CLICK,
//! Right mouse button triple click.
//! This event is generated after the third EMIE_RMOUSE_PRESSED_DOWN event.
EMIE_RMOUSE_TRIPLE_CLICK,
//! Middle mouse button triple click.
//! This event is generated after the third EMIE_MMOUSE_PRESSED_DOWN event.
EMIE_MMOUSE_TRIPLE_CLICK,
//! No real event. Just for convenience to get number of events
EMIE_COUNT
};
//! Masks for mouse button states
enum E_MOUSE_BUTTON_STATE_MASK
{
EMBSM_LEFT = 0x01,
EMBSM_RIGHT = 0x02,
EMBSM_MIDDLE = 0x04,
//! currently only on windows
EMBSM_EXTRA1 = 0x08,
//! currently only on windows
EMBSM_EXTRA2 = 0x10,
EMBSM_FORCE_32_BIT = 0x7fffffff
};
namespace gui
{
@ -121,9 +160,11 @@ namespace irr
EGET_ELEMENT_FOCUSED,
//! The mouse cursor hovered over a gui element.
/** If an element has sub-elements you also get this message for the subelements */
EGET_ELEMENT_HOVERED,
//! The mouse cursor left the hovered element.
/** If an element has sub-elements you also get this message for the subelements */
EGET_ELEMENT_LEFT,
//! An element would like to close.
@ -140,15 +181,20 @@ namespace irr
//! A checkbox has changed its check state.
EGET_CHECKBOX_CHANGED,
//! A new item in a listbox was seleted.
//! A new item in a listbox was selected.
/** NOTE: You also get this event currently when the same item was clicked again after more than 500 ms. */
EGET_LISTBOX_CHANGED,
//! An item in the listbox was selected, which was already selected.
/** NOTE: You get the event currently only if the item was clicked again within 500 ms or selected by "enter" or "space". */
EGET_LISTBOX_SELECTED_AGAIN,
//! A file has been selected in the file dialog
EGET_FILE_SELECTED,
//! A directory has been selected in the file dialog
EGET_DIRECTORY_SELECTED,
//! A file open dialog has been closed without choosing a file
EGET_FILE_CHOOSE_DIALOG_CANCELLED,
@ -164,9 +210,15 @@ namespace irr
//! 'Cancel' was clicked on a messagebox
EGET_MESSAGEBOX_CANCEL,
//! In an editbox was pressed 'ENTER'
//! In an editbox 'ENTER' was pressed
EGET_EDITBOX_ENTER,
//! The text in an editbox was changed. This does not include automatic changes in text-breaking.
EGET_EDITBOX_CHANGED,
//! The marked area in an editbox was changed.
EGET_EDITBOX_MARKING_CHANGED,
//! The tab was changed in an tab control
EGET_TAB_CHANGED,
@ -178,11 +230,29 @@ namespace irr
//! The value of a spin box has changed
EGET_SPINBOX_CHANGED,
//! A table has changed
EGET_TABLE_CHANGED,
EGET_TABLE_HEADER_CHANGED,
EGET_TABLE_SELECTED_AGAIN
EGET_TABLE_SELECTED_AGAIN,
//! A tree view node lost selection. See IGUITreeView::getLastEventNode().
EGET_TREEVIEW_NODE_DESELECT,
//! A tree view node was selected. See IGUITreeView::getLastEventNode().
EGET_TREEVIEW_NODE_SELECT,
//! A tree view node was expanded. See IGUITreeView::getLastEventNode().
EGET_TREEVIEW_NODE_EXPAND,
//! deprecated - use EGET_TREEVIEW_NODE_COLLAPSE instead
EGET_TREEVIEW_NODE_COLLAPS,
//! A tree view node was collapsed. See IGUITreeView::getLastEventNode().
EGET_TREEVIEW_NODE_COLLAPSE = EGET_TREEVIEW_NODE_COLLAPS,
//! No real event. Just for convenience to get number of events
EGET_COUNT
};
} // end namespace gui
@ -217,6 +287,26 @@ struct SEvent
/** Only valid if event was EMIE_MOUSE_WHEEL */
f32 Wheel;
//! True if shift was also pressed
bool Shift:1;
//! True if ctrl was also pressed
bool Control:1;
//! A bitmap of button states. You can use isButtonPressed() to determine
//! if a button is pressed or not.
//! Currently only valid if the event was EMIE_MOUSE_MOVED
u32 ButtonStates;
//! Is the left button pressed down?
bool isLeftPressed() const { return 0 != ( ButtonStates & EMBSM_LEFT ); }
//! Is the right button pressed down?
bool isRightPressed() const { return 0 != ( ButtonStates & EMBSM_RIGHT ); }
//! Is the middle button pressed down?
bool isMiddlePressed() const { return 0 != ( ButtonStates & EMBSM_MIDDLE ); }
//! Type of mouse event
EMOUSE_INPUT_EVENT Event;
};
@ -231,22 +321,22 @@ struct SEvent
EKEY_CODE Key;
//! If not true, then the key was left up
bool PressedDown;
bool PressedDown:1;
//! True if shift was also pressed
bool Shift;
bool Shift:1;
//! True if ctrl was also pressed
bool Control;
bool Control:1;
};
//! A joystick event.
/** Unlike other events, joystick events represent the result of polling
/** 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()
* not be generated by default. If joystick support is available for the
* active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and
* @ref irr::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
{
@ -269,16 +359,16 @@ struct SEvent
/** 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,
* 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
/** 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. */
@ -298,7 +388,7 @@ struct SEvent
return (ButtonStates & (1 << button)) ? true : false;
}
};
//! Any kind of log event.
struct SLogEvent
@ -347,18 +437,22 @@ public:
virtual ~IEventReceiver() {}
//! Called if an event happened.
/** \return True if the event was processed. */
/** Please take care that you should only return 'true' when you want to _prevent_ Irrlicht
* from processing the event any further. So 'true' does mean that an event is completely done.
* Therefore your return value for all unprocessed events should be 'false'.
\return True if the event was processed.
*/
virtual bool OnEvent(const SEvent& event) = 0;
};
//! Information on a joystick, returned from @ref IrrlichtDevice::activateJoysticks()
//! Information on a joystick, returned from @ref irr::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
* @ref SJoystickEvent Joystick ID. */
* to any particular hardware joystick. It corresponds to the
* irr::SJoystickEvent Joystick ID. */
u8 Joystick;
//! The name that the joystick uses to identify itself.

View File

@ -0,0 +1,129 @@
// Copyright (C) 2002-2010 Nikolaus Gebhardt/ Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_FILE_ARCHIVE_H_INCLUDED__
#define __I_FILE_ARCHIVE_H_INCLUDED__
#include "IReadFile.h"
#include "IFileList.h"
namespace irr
{
namespace io
{
//! FileSystemType: which Filesystem should be used for e.g. browsing
enum EFileSystemType
{
FILESYSTEM_NATIVE = 0, // Native OS FileSystem
FILESYSTEM_VIRTUAL // Virtual FileSystem
};
//! Contains the different types of archives
enum E_FILE_ARCHIVE_TYPE
{
//! A PKZIP archive
EFAT_ZIP = MAKE_IRR_ID('Z','I','P', 0),
//! A gzip archive
EFAT_GZIP = MAKE_IRR_ID('g','z','i','p'),
//! A virtual directory
EFAT_FOLDER = MAKE_IRR_ID('f','l','d','r'),
//! An ID Software PAK archive
EFAT_PAK = MAKE_IRR_ID('P','A','K', 0),
//! A Nebula Device archive
EFAT_NPK = MAKE_IRR_ID('N','P','K', 0),
//! A Tape ARchive
EFAT_TAR = MAKE_IRR_ID('T','A','R', 0),
//! The type of this archive is unknown
EFAT_UNKNOWN = MAKE_IRR_ID('u','n','k','n')
};
//! The FileArchive manages archives and provides access to files inside them.
class IFileArchive : public virtual IReferenceCounted
{
public:
//! Opens a file based on its name
/** Creates and returns a new IReadFile for a file in the archive.
\param filename The file to open
\return Returns A pointer to the created file on success,
or 0 on failure. */
virtual IReadFile* createAndOpenFile(const path& filename) =0;
//! Opens a file based on its position in the file list.
/** Creates and returns
\param index The zero based index of the file.
\return Returns a pointer to the created file on success, or 0 on failure. */
virtual IReadFile* createAndOpenFile(u32 index) =0;
//! Returns the complete file tree
/** \return Returns the complete directory tree for the archive,
including all files and folders */
virtual const IFileList* getFileList() const =0;
//! get the archive type
virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_UNKNOWN; }
//! An optionally used password string
/** This variable is publicly accessible from the interface in order to
avoid single access patterns to this place, and hence allow some more
obscurity.
*/
core::stringc Password;
};
//! Class which is able to create an archive from a file.
/** If you want the Irrlicht Engine be able to load archives of
currently unsupported file formats (e.g .wad), then implement
this and add your new Archive loader with
IFileSystem::addArchiveLoader() to the engine. */
class IArchiveLoader : public virtual IReferenceCounted
{
public:
//! Check if the file might be loaded by this class
/** Check based on the file extension (e.g. ".zip")
\param filename Name of file to check.
\return True if file seems to be loadable. */
virtual bool isALoadableFileFormat(const path& filename) const =0;
//! Check if the file might be loaded by this class
/** This check may 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;
//! Check to see if the loader can create archives of this type.
/** Check based on the archive type.
\param fileType The archive type to check.
\return True if the archile loader supports this type, false if not */
virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const =0;
//! Creates an archive from the filename
/** \param filename File to use.
\param ignoreCase Searching is performed without regarding the case
\param ignorePaths Files are searched for without checking for the directories
\return Pointer to newly created archive, or 0 upon error. */
virtual IFileArchive* createArchive(const path& filename, bool ignoreCase, bool ignorePaths) const =0;
//! Creates an archive from the file
/** \param file File handle to use.
\param ignoreCase Searching is performed without regarding the case
\param ignorePaths Files are searched for without checking for the directories
\return Pointer to newly created archive, or 0 upon error. */
virtual IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const =0;
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -6,13 +6,16 @@
#define __I_FILE_LIST_H_INCLUDED__
#include "IReferenceCounted.h"
#include "path.h"
namespace irr
{
namespace io
{
//! The Filelist lists all files in a directory.
//! Provides a list of files and folders.
/** File lists usually contain a list of all files in a given folder,
but can also contain a complete directory structure. */
class IFileList : public virtual IReferenceCounted
{
public:
@ -23,21 +26,57 @@ public:
//! 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.
be returned. The index must be less 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;
virtual const io::path& getFileName(u32 index) const = 0;
//! Gets the full name of a file in the list, path included, based on an index.
//! Gets the full name of a file in the list including the path, 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 File name of the file. Returns 0, if an error occured. */
virtual const c8* getFullFileName(u32 index) = 0;
be returned. The index must be less than the amount getFileCount() returns.
\return File name of the file. Returns 0 if an error occured. */
virtual const io::path& getFullFileName(u32 index) const = 0;
//! Returns the size of a file in the file list, based on an index.
/** \param index is the zero based index of the file which should be returned.
The index must be less than the amount getFileCount() returns.
\return The size of the file in bytes. */
virtual u32 getFileSize(u32 index) const = 0;
//! Returns the ID of a file in the file list, based on an index.
/** This optional ID can be used to link the file list entry to information held
elsewhere. For example this could be an index in an IFileArchive, linking the entry
to its data offset, uncompressed size and CRC.
\param index is the zero based index of the file which should be returned.
The index must be less than the amount getFileCount() returns.
\return The ID of the file. */
virtual u32 getID(u32 index) const = 0;
//! 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.
/** \param index The zero based index which will be checked. The index
must be less than the amount getFileCount() returns.
\return True if the file is a directory, else false. */
virtual bool isDirectory(u32 index) const = 0;
//! Searches for a file or folder in the list
/** Searches for a file by name
\param filename The name of the file to search for.
\param isFolder True if you are searching for a directory path, false if you are searching for a file
\return Returns the index of the file in the file list, or -1 if
no matching name name was found. */
virtual s32 findFile(const io::path& filename, bool isFolder=false) const = 0;
//! Returns the base path of the file list
virtual const io::path& getPath() const = 0;
//! Add as a file or folder to the list
/** \param fullPath The file name including path, from the root of the file list.
\param isDirectory True if this is a directory rather than a file.
\param size The size of the file in bytes.
\param id The ID of the file in the archive which owns it */
virtual u32 addItem(const io::path& fullPath, u32 size, bool isDirectory, u32 id=0) = 0;
//! Sorts the file list. You should call this after adding any items to the file list
virtual void sort() = 0;
};
} // end namespace irr

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -7,7 +7,7 @@
#include "IReferenceCounted.h"
#include "IXMLReader.h"
#include "irrString.h"
#include "IFileArchive.h"
namespace irr
{
@ -24,6 +24,7 @@ class IFileList;
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
@ -34,10 +35,10 @@ public:
//! Opens a file for read access.
/** \param filename: Name of file to open.
\return Returns a pointer to the created file interface.
\return Pointer to the created file interface.
The returned pointer should be dropped when no longer needed.
See IReferenceCounted::drop() for more information. */
virtual IReadFile* createAndOpenFile(const c8* filename) = 0;
virtual IReadFile* createAndOpenFile(const path& filename) =0;
//! Creates an IReadFile interface for accessing memory like a file.
/** This allows you to use a pointer to memory where an IReadFile is requested.
@ -46,46 +47,147 @@ public:
\param fileName: The name given to this file
\param deleteMemoryWhenDropped: True if the memory should be deleted
along with the IReadFile when it is dropped.
\return Returns a pointer to the created file interface.
\return Pointer to the created file interface.
The returned pointer should be dropped when no longer needed.
See IReferenceCounted::drop() for more information.
*/
virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const c8* fileName, bool deleteMemoryWhenDropped=false) = 0;
virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
//! Creates an IReadFile interface for accessing files inside files.
/** This is useful e.g. for archives.
\param fileName: The name given to this file
\param alreadyOpenedFile: Pointer to the enclosing file
\param pos: Start of the file inside alreadyOpenedFile
\param areaSize: The length of the file
\return A pointer to the created file interface.
The returned pointer should be dropped when no longer needed.
See IReferenceCounted::drop() for more information.
*/
virtual IReadFile* createLimitReadFile(const path& fileName,
IReadFile* alreadyOpenedFile, long pos, long areaSize) =0;
//! Creates an IWriteFile interface for accessing memory like a file.
/** This allows you to use a pointer to memory where an IWriteFile is requested.
You are responsible for allocating enough memory.
\param memory: A pointer to the start of the file in memory (allocated by you)
\param len: The length of the memory in bytes
\param fileName: The name given to this file
\param deleteMemoryWhenDropped: True if the memory should be deleted
along with the IWriteFile when it is dropped.
\return Pointer to the created file interface.
The returned pointer should be dropped when no longer needed.
See IReferenceCounted::drop() for more information.
*/
virtual IWriteFile* createMemoryWriteFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
//! Opens a file for write access.
/** \param filename: Name of file to open.
\param append: If the file already exist, all write operations are
appended to the file.
\return Returns a pointer to the created file interface. 0 is returned, if the
\return Pointer to the created file interface. 0 is returned, if the
file could not created or opened for writing.
The returned pointer should be dropped when no longer needed.
See IReferenceCounted::drop() for more information. */
virtual IWriteFile* createAndWriteFile(const c8* filename, bool append=false) = 0;
virtual IWriteFile* createAndWriteFile(const path& filename, bool append=false) =0;
//! Adds an zip archive to the file system.
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
//! Adds an archive to the file system.
/** After calling this, the Irrlicht Engine will also search and open
files directly from this archive. 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 just renamed .zip files. By
default Irrlicht supports ZIP, PAK, TAR, PNK, and directories as
archives. You can provide your own archive types by implementing
IArchiveLoader and passing an instance to addArchiveLoader.
Irrlicht supports AES-encrypted zip files, and the advanced compression
techniques lzma and bzip2.
\param filename: Filename of the 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.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.
\param archiveType: If no specific E_FILE_ARCHIVE_TYPE is selected then
the type of archive will depend on the extension of the file name. If
you use a different extension then you can use this parameter to force
a specific type of archive.
\param password An optional password, which is used in case of encrypted archives.
\return True if the archive was added successfully, false if not. */
virtual bool addFileArchive(const path& filename, bool ignoreCase=true,
bool ignorePaths=true,
E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
const core::stringc& password="") =0;
//! Adds an external archive loader to the engine.
/** Use this function to add support for new archive types to the
engine, for example proprietary or encrypted file storage. */
virtual void addArchiveLoader(IArchiveLoader* loader) =0;
//! Get the number of archives currently attached to the file system
virtual u32 getFileArchiveCount() const =0;
//! Removes an archive from the file system.
/** This will close the archive and free any file handles, but will not close resources which have already
been loaded and are now cached, for example textures and meshes.
\param index: The index of the archive to remove
\return True on success, false on failure */
virtual bool removeFileArchive(u32 index) =0;
//! Removes an archive from the file system.
/** This will close the archive and free any file handles, but will not
close resources which have already been loaded and are now cached, for
example textures and meshes.
\param filename The archive of the given name will be removed
\return True on success, false on failure */
virtual bool removeFileArchive(const path& filename) =0;
//! Changes the search order of attached archives.
/**
\param sourceIndex: The index of the archive to change
\param relative: The relative change in position, archives with a lower index are searched first */
virtual bool moveFileArchive(u32 sourceIndex, s32 relative) =0;
//! Get the archive at a given index.
virtual IFileArchive* getFileArchive(u32 index) =0;
//! Adds a zip archive to the file system.
/** \deprecated This function is provided for compatibility
with older versions of Irrlicht and may be removed in future versions,
you should use addFileArchive instead.
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.
access for example Quake3 .pk3 files, which are no 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.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.
\return Returns true if the archive was added successful, false if not. */
virtual bool addZipFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
\return True if the archive was added successfully, false if not. */
virtual bool addZipFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
{
return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_ZIP);
}
//! Adds an unzipped archive ( or basedirectory with subdirectories..) to the file system.
/** Useful for handling data which will be in a zip file
//! Adds an unzipped archive (or basedirectory with subdirectories..) to the file system.
/** \deprecated This function is provided for compatibility
with older versions of Irrlicht and may be removed in future versions,
you should use addFileArchive instead.
Useful for handling data which will be in a zip file
\param filename: Filename of the unzipped zip archive base directory 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.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.
\return Returns true if the archive was added successful, false if not. */
virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
\return True if the archive was added successful, false if not. */
virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
{
return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_FOLDER);
}
//! Adds an pak archive to the file system.
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
//! Adds a pak archive to the file system.
/** \deprecated This function is provided for compatibility
with older versions of Irrlicht and may be removed in future versions,
you should use addFileArchive instead.
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
\param filename: Filename of the pak archive to add to the file system.
@ -93,50 +195,62 @@ public:
writing all letters in the right case.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.(should not use with Quake2 paks
\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;
\return True if the archive was added successful, false if not. */
virtual bool addPakFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
{
return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_PAK);
}
//! Get the current working directory.
/** \return Current working directory as a string. */
virtual const c8* getWorkingDirectory() = 0;
virtual const path& getWorkingDirectory() =0;
//! 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 True if successful, otherwise false. */
virtual bool changeWorkingDirectoryTo(const c8* newDirectory) = 0;
virtual bool changeWorkingDirectoryTo(const path& newDirectory) =0;
//! Converts a relative path to an absolute (unique) path, resolving symbolic links if required
/** \param filename Possibly relative filename begin queried.
/** \param filename Possibly relative file or directory name to query.
\result Absolute filename which points to the same file. */
virtual core::stringc getAbsolutePath(const core::stringc& filename) const = 0;
virtual path getAbsolutePath(const path& filename) const =0;
//! Returns the directory a file is located in.
//! Get the directory a file is located in.
/** \param filename: The file to get the directory from.
\return String containing the directory of the file. */
virtual core::stringc getFileDir(const core::stringc& filename) const = 0;
virtual path getFileDir(const path& 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 */
virtual core::stringc getFileBasename(const core::stringc& filename, bool keepExtension=true) const = 0;
//! Get 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 path getFileBasename(const path& filename, bool keepExtension=true) const =0;
//! flatten a path and file name for example: "/you/me/../." becomes "/you"
virtual path& flattenFilename(path& directory, const path& root="/") 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.
See IReferenceCounted::drop() for more information. */
virtual IFileList* createFileList() const = 0;
virtual IFileList* createFileList() =0;
//! Creates an empty filelist
/** \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.
See IReferenceCounted::drop() for more information. */
virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths) =0;
//! Set the active type of file system.
virtual EFileSystemType setFileListSystem(EFileSystemType listType) =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 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;
\return True if file exists, and false if it does not exist or an error occured. */
virtual bool existFile(const path& 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
@ -145,7 +259,7 @@ public:
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReader::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLReader* createXMLReader(const c8* filename) = 0;
virtual IXMLReader* createXMLReader(const path& filename) =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
@ -154,7 +268,7 @@ public:
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReader::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLReader* createXMLReader(IReadFile* file) = 0;
virtual IXMLReader* createXMLReader(IReadFile* file) =0;
//! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
/** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
@ -163,7 +277,7 @@ public:
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReaderUTF8::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLReaderUTF8* createXMLReaderUTF8(const c8* filename) = 0;
virtual IXMLReaderUTF8* createXMLReaderUTF8(const path& filename) =0;
//! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
/** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
@ -172,21 +286,21 @@ public:
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReaderUTF8::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file) = 0;
virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file) =0;
//! Creates a XML Writer from a file.
/** \return 0, if file could not be opened, otherwise a pointer to the created
IXMLWriter is returned. After use, the reader
has to be deleted using its IXMLWriter::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLWriter* createXMLWriter(const c8* filename) = 0;
virtual IXMLWriter* createXMLWriter(const path& filename) =0;
//! Creates a XML Writer from a file.
/** \return 0, if file could not be opened, otherwise a pointer to the created
IXMLWriter is returned. After use, the reader
has to be deleted using its IXMLWriter::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLWriter* createXMLWriter(IWriteFile* file) = 0;
virtual IXMLWriter* createXMLWriter(IWriteFile* file) =0;
//! 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.
@ -194,12 +308,12 @@ public:
\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;
virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) =0;
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,12 +1,14 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
#define __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
#include "IReferenceCounted.h"
#include "SMaterial.h"
#include "EShaderTypes.h"
#include "EMaterialTypes.h"
#include "EPrimitiveTypes.h"
#include "path.h"
namespace irr
{
@ -22,54 +24,6 @@ namespace video
class IVideoDriver;
class IShaderConstantSetCallBack;
//! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_VERTEX_SHADER_TYPE
{
EVST_VS_1_1 = 0,
EVST_VS_2_0,
EVST_VS_2_a,
EVST_VS_3_0,
//! This is not a type, but a value indicating how much types there are.
EVST_COUNT
};
//! Names for all vertex shader types, each entry corresponds to a E_VERTEX_SHADER_TYPE entry.
const c8* const VERTEX_SHADER_TYPE_NAMES[] = {
"vs_1_1",
"vs_2_0",
"vs_2_a",
"vs_3_0",
0 };
//! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_PIXEL_SHADER_TYPE
{
EPST_PS_1_1 = 0,
EPST_PS_1_2,
EPST_PS_1_3,
EPST_PS_1_4,
EPST_PS_2_0,
EPST_PS_2_a,
EPST_PS_2_b,
EPST_PS_3_0,
//! This is not a type, but a value indicating how much types there are.
EPST_COUNT
};
//! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry.
const c8* const PIXEL_SHADER_TYPE_NAMES[] = {
"ps_1_1",
"ps_1_2",
"ps_1_3",
"ps_1_4",
"ps_2_0",
"ps_2_a",
"ps_2_b",
"ps_3_0",
0 };
//! Interface making it possible to create and use programs running on the GPU.
class IGPUProgrammingServices
{
@ -83,18 +37,30 @@ public:
\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.
vertexShaderProgram (p.e. "main")
\param vsCompileTarget: Vertex shader version 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.
pixelShaderProgram (p.e. "main")
\param psCompileTarget: Pixel shader version the high level shader
shall be compiled to.
\param geometryShaderProgram: String containing the source of the
geometry shader program. This can be 0 if no geometry shader shall be
used.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderProgram (p.e. "main")
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader
\param outType Type of vertices created by geometry shader
\param verticesOut Maximal number of vertices created by geometry
shader. If 0, maximal number supported is assumed.
\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.
IShaderConstantSetCallBack in which you can set the needed vertex,
pixel, and geometry 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
@ -102,60 +68,30 @@ public:
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. */
\return 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 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,
const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget,
const c8* pixelShaderProgram,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
const c8* geometryShaderProgram,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
u32 verticesOut = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0 ) = 0;
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
/** \param vertexShaderProgram: Text file containing the source of the
* vertex shader program.
Set to 0 if no shader shall be created.
\param 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(
//! convenience function for use without geometry shaders
s32 addHighLevelShaderMaterial(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
@ -164,25 +100,122 @@ public:
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0 )
{
return addHighLevelShaderMaterial(
vertexShaderProgram, vertexShaderEntryPointName,
vsCompileTarget, pixelShaderProgram,
pixelShaderEntryPointName, psCompileTarget,
0, "main", EGST_GS_4_0,
scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
callback, baseMaterial, userData);
}
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
/** \param vertexShaderProgramFileName: Text file containing the source
of the vertex shader program. Set to empty string if no vertex shader
shall be created.
\param vertexShaderEntryPointName: Name of the entry function of the
vertexShaderProgram (p.e. "main")
\param vsCompileTarget: Vertex shader version the high level shader
shall be compiled to.
\param pixelShaderProgramFileName: Text file containing the source of
the pixel shader program. Set to empty string if no pixel shader shall
be created.
\param pixelShaderEntryPointName: Entry name of the function of the
pixelShaderProgram (p.e. "main")
\param psCompileTarget: Pixel shader version the high level shader
shall be compiled to.
\param geometryShaderProgramFileName: Name of the source of
the geometry shader program. Set to empty string if no geometry shader
shall be created.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderProgram (p.e. "main")
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader
\param outType Type of vertices created by geometry shader
\param verticesOut Maximal number of vertices created by geometry
shader. If 0, maximal number supported is assumed.
\param callback: Pointer to an implementation of
IShaderConstantSetCallBack in which you can set the needed vertex,
pixel, and geometry 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 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 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 io::path& vertexShaderProgramFileName,
const c8* vertexShaderEntryPointName,
E_VERTEX_SHADER_TYPE vsCompileTarget,
const io::path& pixelShaderProgramFileName,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
const io::path& geometryShaderProgramFileName,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
u32 verticesOut = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! convenience function for use without geometry shaders
s32 addHighLevelShaderMaterialFromFiles(
const io::path& vertexShaderProgramFileName,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const io::path& pixelShaderProgramFileName = "",
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0)
{
return addHighLevelShaderMaterialFromFiles(
vertexShaderProgramFileName, vertexShaderEntryPointName,
vsCompileTarget, pixelShaderProgramFileName,
pixelShaderEntryPointName, psCompileTarget,
"", "main", EGST_GS_4_0,
scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
callback, baseMaterial, userData);
}
//! 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.
of the vertex shader program. Set to 0 if no vertex 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 vsCompileTarget: Vertex shader version the high level shader
shall be compiled to.
\param pixelShaderProgram: Text file handle containing the source of
the pixel shader program. Set to 0 if no shader shall be created.
the pixel shader program. Set to 0 if no pixel 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.
pixelShaderProgram (p.e. "main")
\param psCompileTarget: Pixel shader version the high level shader
shall be compiled to.
\param geometryShaderProgram: Text file handle containing the source of
the geometry shader program. Set to 0 if no geometry shader shall be
created.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderProgram (p.e. "main")
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader
\param outType Type of vertices created by geometry shader
\param verticesOut Maximal number of vertices created by geometry
shader. If 0, maximal number supported is assumed.
\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.
@ -193,13 +226,30 @@ public:
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
\return 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. */
error occured, e.g. if a 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,
E_VERTEX_SHADER_TYPE vsCompileTarget,
io::IReadFile* pixelShaderProgram,
const c8* pixelShaderEntryPointName,
E_PIXEL_SHADER_TYPE psCompileTarget,
io::IReadFile* geometryShaderProgram,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
u32 verticesOut = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! convenience function for use without geometry shaders
s32 addHighLevelShaderMaterialFromFiles(
io::IReadFile* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
@ -208,7 +258,16 @@ public:
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
s32 userData = 0)
{
return addHighLevelShaderMaterialFromFiles(
vertexShaderProgram, vertexShaderEntryPointName,
vsCompileTarget, pixelShaderProgram,
pixelShaderEntryPointName, psCompileTarget,
0, "main", EGST_GS_4_0,
scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
callback, baseMaterial, userData);
}
//! Adds a new ASM shader material renderer to the VideoDriver
/** Note that it is a good idea to call IVideoDriver::queryFeature() in
@ -293,8 +352,8 @@ public:
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,
virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
const io::path& pixelShaderProgramFileName,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -67,7 +67,7 @@ namespace gui
//! Sets an image which should be displayed on the button when it is in normal state.
/** \param image: Image to be displayed */
virtual void setImage(video::ITexture* image) = 0;
virtual void setImage(video::ITexture* image=0) = 0;
//! Sets a background image for the button when it is in normal state.
/** \param image: Texture containing the image to be displayed
@ -78,7 +78,7 @@ namespace gui
/** If no images is specified for the pressed state via
setPressedImage(), this image is also drawn in pressed state.
\param image: Image to be displayed */
virtual void setPressedImage(video::ITexture* image) = 0;
virtual void setPressedImage(video::ITexture* image=0) = 0;
//! 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
@ -86,7 +86,7 @@ namespace gui
virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
//! Sets the sprite bank used by the button
virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
virtual void setSpriteBank(IGUISpriteBank* bank=0) = 0;
//! Sets the animated sprite for a specific button state
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
@ -101,16 +101,16 @@ namespace gui
//! Sets if the button should behave like a push button.
/** Which means it can be in two states: Normal or Pressed. With a click on the button,
the user can change the state of the button. */
virtual void setIsPushButton(bool isPushButton) = 0;
virtual void setIsPushButton(bool isPushButton=true) = 0;
//! Sets the pressed state of the button if this is a pushbutton
virtual void setPressed(bool pressed) = 0;
virtual void setPressed(bool pressed=true) = 0;
//! Returns if the button is currently pressed
virtual bool isPressed() const = 0;
//! Sets if the alpha channel should be used for drawing background images on the button (default is false)
virtual void setUseAlphaChannel(bool useAlphaChannel) = 0;
virtual void setUseAlphaChannel(bool useAlphaChannel=true) = 0;
//! Returns if the alpha channel should be used for drawing background images on the button
virtual bool isAlphaChannelUsed() const = 0;
@ -119,10 +119,16 @@ namespace gui
virtual bool isPushButton() const = 0;
//! Sets if the button should use the skin to draw its border and button face (default is true)
virtual void setDrawBorder(bool border) = 0;
virtual void setDrawBorder(bool border=true) = 0;
//! Returns if the border and button face are being drawn using the skin
virtual bool isDrawingBorder() const = 0;
//! Sets if the button should scale the button images to fit
virtual void setScaleImage(bool scaleImage=true) = 0;
//! Checks whether the button scales the used images
virtual bool isScalingImage() const = 0;
};

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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 gui
{
//! Standard file chooser dialog.
//! Standard color chooser dialog.
class IGUIColorSelectDialog : public IGUIElement
{
public:

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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,14 @@ namespace gui
//! Returns string of an item. the idx may be a value from 0 to itemCount-1
virtual const wchar_t* getItem(u32 idx) const = 0;
//! Returns item data of an item. the idx may be a value from 0 to itemCount-1
virtual u32 getItemData(u32 idx) const = 0;
//! Returns index based on item data
virtual s32 getIndexForItemData(u32 data ) const = 0;
//! Adds an item and returns the index of it
virtual u32 addItem(const wchar_t* text) = 0;
virtual u32 addItem(const wchar_t* text, u32 data = 0) = 0;
//! Removes an item from the combo box.
/** Warning. This will change the index of all following items */
@ -44,10 +50,10 @@ namespace gui
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). */
/** \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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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,21 @@ namespace irr
{
namespace gui
{
//! Close behaviour.
//! Default is ECMC_REMOVE
enum ECONTEXT_MENU_CLOSE
{
//! do nothing - menu stays open
ECMC_IGNORE = 0,
//! remove the gui element
ECMC_REMOVE = 1,
//! call setVisible(false)
ECMC_HIDE = 2
// note to implementors - this is planned as bitset, so continue with 4 if you need to add further flags.
};
//! GUI Context menu interface.
class IGUIContextMenu : public IGUIElement
@ -21,6 +36,12 @@ namespace gui
IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
//! set behaviour when menus are closed
virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0;
//! get current behaviour when the menu will be closed
virtual ECONTEXT_MENU_CLOSE getCloseHandling() const = 0;
//! Get amount of menu items
virtual u32 getItemCount() const = 0;
@ -32,13 +53,36 @@ namespace gui
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().
at this item. You can access this submenu via getSubMenu().
\param checked: Specifies if the menu item should be initially checked.
\param autoChecking: Specifies if the item should be checked by clicking
\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, bool autoChecking=false) = 0;
//! Insert a menu item at specified position.
/** \param idx: Position to insert the new element,
should be smaller than itemcount otherwise the item is added to the end.
\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 access this submenu via getSubMenu().
\param checked: Specifies if the menu item should be initially checked.
\param autoChecking: Specifies if the item should be checked by clicking
\return Returns the index of the new item */
virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId=-1, bool enabled=true,
bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
//! Find an item by it's CommandID
/**
\param commandId: We are looking for the first item which has this commandID
\param idxStartSearch: Start searching from this index.
\return Returns the index of the item when found or otherwise -1. */
virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const = 0;
//! Adds a separator item to the menu
virtual void addSeparator() = 0;
@ -96,6 +140,15 @@ namespace gui
\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;
//! should the element change the checked status on clicking
virtual void setItemAutoChecking(u32 idx, bool autoChecking) = 0;
//! does the element change the checked status on clicking
virtual bool getItemAutoChecking(u32 idx) const = 0;
//! When an eventparent is set it receives events instead of the usual parent element
virtual void setEventParent(IGUIElement *parent) = 0;
};
} // end namespace gui

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -38,7 +38,7 @@ namespace gui
\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.
//! Sets if the text should use the override 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. */
@ -61,7 +61,7 @@ namespace gui
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.
@ -70,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 multi-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
@ -91,8 +91,8 @@ 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
virtual core::dimension2di getTextDimension() = 0;
/** \return The size in pixels of the text */
virtual core::dimension2du 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -28,7 +28,7 @@ public:
//! Constructor
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle)
s32 id, const core::rect<s32>& rectangle)
: Parent(0), RelativeRect(rectangle), AbsoluteRect(rectangle),
AbsoluteClippingRect(rectangle), DesiredRect(rectangle),
MaxSize(0,0), MinSize(1,1), IsVisible(true), IsEnabled(true),
@ -42,15 +42,9 @@ public:
// if we were given a parent to attach to
if (parent)
parent->addChild(this);
// if we succeeded in becoming a child
if (Parent)
{
LastParentRect = Parent->getAbsolutePosition();
AbsoluteRect += LastParentRect.UpperLeftCorner;
AbsoluteClippingRect = AbsoluteRect;
AbsoluteClippingRect.clipAgainst(Parent->AbsoluteClippingRect);
parent->addChildToEnd(this);
recalculateAbsolutePosition(true);
}
}
@ -83,7 +77,7 @@ public:
//! Sets the relative rectangle of this element.
/** \param r The absolute position to set */
/** \param r The absolute position to set */
void setRelativePosition(const core::rect<s32>& r)
{
if (Parent)
@ -107,22 +101,22 @@ public:
}
//! 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. */
/** \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);
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 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.
\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)
void setRelativePositionProportional(const core::rect<f32>& r)
{
if (!Parent)
return;
@ -156,10 +150,11 @@ 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. */
/** \param noClip If true, the element will not be clipped by its parent's clipping rectangle. */
void setNotClipped(bool noClip)
{
NoClip = noClip;
updateAbsolutePosition();
}
@ -173,7 +168,7 @@ public:
//! Sets the maximum size allowed for this element
/** If set to 0,0, there is no maximum size */
void setMaxSize(core::dimension2di size)
void setMaxSize(core::dimension2du size)
{
MaxSize = size;
updateAbsolutePosition();
@ -181,7 +176,7 @@ public:
//! Sets the minimum size allowed for this element
void setMinSize(core::dimension2di size)
void setMinSize(core::dimension2du size)
{
MinSize = size;
if (MinSize.Width < 1)
@ -192,6 +187,7 @@ public:
}
//! The alignment defines how the borders of this element will be positioned when the parent element is resized.
void setAlignment(EGUI_ALIGNMENT left, EGUI_ALIGNMENT right, EGUI_ALIGNMENT top, EGUI_ALIGNMENT bottom)
{
AlignLeft = left;
@ -220,121 +216,7 @@ public:
//! Updates the absolute position.
virtual void updateAbsolutePosition()
{
core::rect<s32> parentAbsolute(0,0,0,0);
core::rect<s32> parentAbsoluteClip;
s32 diffx, diffy;
f32 fw=0.f, fh=0.f;
if (Parent)
{
parentAbsolute = Parent->AbsoluteRect;
if (NoClip)
{
IGUIElement* p=this;
while (p && p->Parent)
p = p->Parent;
parentAbsoluteClip = p->AbsoluteClippingRect;
}
else
parentAbsoluteClip = Parent->AbsoluteClippingRect;
}
diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
fw = (f32)parentAbsolute.getWidth();
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.X = (s32)(ScaleRect.UpperLeftCorner.X * fw);
break;
}
switch (AlignRight)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.X = (s32)(ScaleRect.LowerRightCorner.X * fw);
break;
}
switch (AlignTop)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.Y = (s32)(ScaleRect.UpperLeftCorner.Y * fh);
break;
}
switch (AlignBottom)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.Y = (s32)(ScaleRect.LowerRightCorner.Y * fh);
break;
}
RelativeRect = DesiredRect;
const s32 w = RelativeRect.getWidth();
const s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed
if (w < MinSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MinSize.Width;
if (h < MinSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MinSize.Height;
if (MaxSize.Width && w > MaxSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MaxSize.Width;
if (MaxSize.Height && h > MaxSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height;
RelativeRect.repair();
AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
if (!Parent)
parentAbsoluteClip = AbsoluteRect;
AbsoluteClippingRect = AbsoluteRect;
AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
LastParentRect = parentAbsolute;
recalculateAbsolutePosition(false);
// update all children
core::list<IGUIElement*>::Iterator it = Children.begin();
@ -345,7 +227,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;
@ -355,7 +248,8 @@ public:
core::list<IGUIElement*>::Iterator it = Children.getLast();
if (IsVisible)
if (isVisible())
{
while(it != Children.end())
{
target = (*it)->getElementFromPoint(point);
@ -364,8 +258,9 @@ public:
--it;
}
}
if (IsVisible && isPointInside(point))
if (isVisible() && isPointInside(point))
target = this;
return target;
@ -373,26 +268,23 @@ 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);
}
//! Adds a GUI element as new child of this element.
virtual void addChild(IGUIElement* child)
{
addChildToEnd(child);
if (child)
{
child->grab();
child->remove(); // remove from old parent
child->LastParentRect = getAbsolutePosition();
child->Parent = this;
Children.push_back(child);
child->updateAbsolutePosition();
}
}
//! Removes a child.
virtual void removeChild(IGUIElement* child)
{
@ -419,24 +311,24 @@ public:
//! Draws the element and its children.
virtual void draw()
{
if (!IsVisible)
return;
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->draw();
if ( isVisible() )
{
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->draw();
}
}
//! animate the element and its children.
virtual void OnPostRender(u32 timeMs)
{
if (!IsVisible)
return;
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->OnPostRender( timeMs );
if ( isVisible() )
{
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->OnPostRender( timeMs );
}
}
@ -470,19 +362,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;
@ -497,9 +388,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
@ -534,9 +425,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;
@ -551,8 +442,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;
@ -629,7 +519,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();
@ -702,13 +592,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
{
@ -794,6 +684,20 @@ public:
return Type;
}
//! Returns true if the gui element supports the given type.
/** This is mostly used to check if you can cast a gui element to the class that goes with the type.
Most gui elements will only support their own type, but if you derive your own classes from interfaces
you can overload this function and add a check for the type of the base-class additionally.
This allows for checks comparable to the dynamic_cast of c++ with enabled rtti.
Note that you can't do that by calling BaseClass::hasType(type), but you have to do an explicit
comparison check, because otherwise the base class usually just checks for the membervariable
Type which contains the type of your derived class.
*/
virtual bool hasType(EGUI_ELEMENT_TYPE type) const
{
return type == Type;
}
//! Returns the type name of the gui element.
/** This is needed serializing elements. For serializing your own elements, override this function
@ -805,8 +709,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 );
@ -814,7 +718,6 @@ public:
out->addRect("Rect", DesiredRect);
out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
out->addBool("NoClip", NoClip);
out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames);
out->addEnum("RightAlign", AlignRight, GUIAlignmentNames);
out->addEnum("TopAlign", AlignTop, GUIAlignmentNames);
@ -824,12 +727,13 @@ public:
out->addBool("TabStop", IsTabStop);
out->addBool("TabGroup", IsTabGroup);
out->addInt("TabOrder", TabOrder);
out->addBool("NoClip", NoClip);
}
//! 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"));
@ -841,18 +745,162 @@ public:
TabOrder = in->getAttributeAsInt("TabOrder");
core::position2di p = in->getAttributeAsPosition2d("MaxSize");
setMaxSize(core::dimension2di(p.X,p.Y));
setMaxSize(core::dimension2du(p.X,p.Y));
p = in->getAttributeAsPosition2d("MinSize");
setMinSize(core::dimension2di(p.X,p.Y));
setMinSize(core::dimension2du(p.X,p.Y));
setNotClipped(in->getAttributeAsBool("NoClip"));
setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames));
setRelativePosition(in->getAttributeAsRect("Rect"));
setNotClipped(in->getAttributeAsBool("NoClip"));
}
protected:
// not virtual because needed in constructor
void addChildToEnd(IGUIElement* child)
{
if (child)
{
child->grab(); // prevent destruction when removed
child->remove(); // remove from old parent
child->LastParentRect = getAbsolutePosition();
child->Parent = this;
Children.push_back(child);
}
}
// not virtual because needed in constructor
void recalculateAbsolutePosition(bool recursive)
{
core::rect<s32> parentAbsolute(0,0,0,0);
core::rect<s32> parentAbsoluteClip;
f32 fw=0.f, fh=0.f;
if (Parent)
{
parentAbsolute = Parent->AbsoluteRect;
if (NoClip)
{
IGUIElement* p=this;
while (p && p->Parent)
p = p->Parent;
parentAbsoluteClip = p->AbsoluteClippingRect;
}
else
parentAbsoluteClip = Parent->AbsoluteClippingRect;
}
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();
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.X = core::round32(ScaleRect.UpperLeftCorner.X * fw);
break;
}
switch (AlignRight)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.X = core::round32(ScaleRect.LowerRightCorner.X * fw);
break;
}
switch (AlignTop)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.Y = core::round32(ScaleRect.UpperLeftCorner.Y * fh);
break;
}
switch (AlignBottom)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.Y = core::round32(ScaleRect.LowerRightCorner.Y * fh);
break;
}
RelativeRect = DesiredRect;
const s32 w = RelativeRect.getWidth();
const s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed
if (w < (s32)MinSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MinSize.Width;
if (h < (s32)MinSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MinSize.Height;
if (MaxSize.Width && w > (s32)MaxSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MaxSize.Width;
if (MaxSize.Height && h > (s32)MaxSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height;
RelativeRect.repair();
AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
if (!Parent)
parentAbsoluteClip = AbsoluteRect;
AbsoluteClippingRect = AbsoluteRect;
AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
LastParentRect = parentAbsolute;
if ( recursive )
{
// update all children
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
(*it)->recalculateAbsolutePosition(recursive);
}
}
}
protected:
@ -883,7 +931,7 @@ protected:
core::rect<f32> ScaleRect;
//! maximum and minimum size of the element
core::dimension2di MaxSize, MinSize;
core::dimension2du MaxSize, MinSize;
//! is visible?
bool IsVisible;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -15,7 +15,7 @@ namespace gui
{
class IGUIElement;
//! Interface making it possible to dynamicly create GUI elements
//! Interface making it possible to dynamically 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.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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 "EMessageBoxFlags.h"
#include "IEventReceiver.h"
#include "IXMLReader.h"
#include "path.h"
namespace irr
{
@ -41,6 +42,8 @@ class IGUIImage;
class IGUIMeshViewer;
class IGUICheckBox;
class IGUIListBox;
class IGUITreeView;
class IGUIImageList;
class IGUIFileOpenDialog;
class IGUIColorSelectDialog;
class IGUIInOutFader;
@ -62,8 +65,7 @@ class IGUIEnvironment : public virtual IReferenceCounted
{
public:
//! Draws all gui elements by traversing the GUI environment starting
//! at the root node.
//! Draws all gui elements by traversing the GUI environment starting at the root node.
virtual void drawAll() = 0;
//! Sets the focus to an element.
@ -75,7 +77,7 @@ public:
virtual bool setFocus(IGUIElement* element) = 0;
//! Returns the element which holds the focus.
//! \return Pointer to the element with focus.
/** \return Pointer to the element with focus. */
virtual IGUIElement* getFocus() const = 0;
//! Removes the focus from an element.
@ -91,15 +93,15 @@ public:
virtual bool hasFocus(IGUIElement* element) const = 0;
//! Returns the current video driver.
//! \return Pointer to the video driver.
/** \return Pointer to the video driver. */
virtual video::IVideoDriver* getVideoDriver() const = 0;
//! Returns the file system.
//! \return Pointer to 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.
/** \return Pointer to the OS operator. */
virtual IOSOperator* getOSOperator() const = 0;
//! Removes all elements from the environment.
@ -119,7 +121,7 @@ public:
virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
//! Returns pointer to the current gui skin.
//! \return Pointer to the GUI skin.
/** \return Pointer to the GUI skin. */
virtual IGUISkin* getSkin() const = 0;
//! Sets a new GUI Skin
@ -145,13 +147,32 @@ public:
See IReferenceCounted::drop() for more information. */
virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
//! Creates the image list from the given texture.
/** \param texture Texture to split into images
\param imageSize Dimension of each image
\param useAlphaChannel Flag whether alpha channel of the texture should be honored.
\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 IGUIImageList* createImageList( video::ITexture* texture,
core::dimension2d<s32> imageSize, bool useAlphaChannel ) = 0;
//! 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;
virtual IGUIFont* getFont(const io::path& filename) = 0;
//! Adds an externally loaded font to the font list.
/** This method allows to attach an already loaded font to the list of
existing fonts. The font is grabbed if non-null and adding was successful.
\param name Name the font should be stored as.
\param font Pointer to font to add.
\return Pointer to the font stored. This can differ from given parameter if the name previously existed. */
virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
//! Returns the default built-in font.
/** \return Pointer to the default built-in font.
@ -164,55 +185,55 @@ public:
\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;
virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
//! Adds an empty sprite bank to the manager
/** \param name Name of the new sprite bank.
\return Pointer to the sprite bank.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0;
virtual IGUISpriteBank* addEmptySpriteBank(const io::path& 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
creating your own gui elements, trying to add them to the gui elements
without a parent.
/** 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 a button element.
/** \param rectangle Position and dimension of the button.
/** \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.
\return Pointer to the created button. Returns 0 if an error occurred.
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 rectangle Position and dimension of the window.
/** \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.
\return Pointer to the created window. Returns 0 if an error occurred.
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 itself.
/** \param parent Parent gui element of the modal.
\return Pointer to the created modal. Returns 0 if an error occured.
//! 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 occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
@ -228,20 +249,21 @@ public:
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.
\param image Optional texture which will be displayed beside the text as an image
\return Pointer to the created message box. Returns 0 if an error
occured. This pointer should not be dropped. See
occurred. 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;
bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
//! Adds a scrollbar.
/** \param horizontal Specifies if the scroll bar is drawn horizontal
or vertical.
\param rectangle Position and dimension of the scroll bar.
\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
occurred. 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;
@ -256,53 +278,67 @@ public:
\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
occurred. 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.
\param rectangle Position and dimension of the image.
\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
occurred. 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.
/** \param checked Define the initial state of the check box.
\param rectangle Position and dimension of 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
occurred. 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.
/** \param rectangle Position and dimension of list box.
/** \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.
\return Pointer to the created list box. Returns 0 if an error occurred.
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 a tree view element.
/** \param rectangle Position and dimension of 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.
\param scrollBarVertical Flag whether a vertical scrollbar should be used
\param scrollBarHorizontal Flag whether a horizontal scrollbar should be used
\return Pointer to the created list box. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
//! Adds a mesh viewer. Not 100% implemented yet.
/** \param rectangle Position and dimension of mesh viewer.
/** \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
occurred. 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;
@ -315,7 +351,7 @@ public:
\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
occurred. 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;
@ -328,14 +364,14 @@ public:
\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
occurred. 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.
/** \param text Text to be displayed. Can be altered after creation by SetText().
\param rectangle Position and dimension of the static text.
\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.
@ -343,7 +379,7 @@ public:
\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
occurred. 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,
@ -356,12 +392,12 @@ public:
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 Position and dimension of the edit box.
\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.
\return Pointer to the created edit box. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
@ -370,28 +406,29 @@ public:
//! Adds a spin box.
/** An edit box with up and down buttons
\param text Text to be displayed. Can be altered after creation by setText().
\param rectangle Position and dimension of the spin box.
\param rectangle Rectangle specifying the borders of the spin box.
\param border Set to true if the spin box should have a 3d border.
\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.
\return Pointer to the created spin box. Returns 0 if an error occurred.
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;
bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
//! Adds an element for fading in or out.
/* \param rectangle Rectangle specifying the borders of the element.
/** \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
occurred. 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 Position and dimension of the tab control.
/** \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
@ -401,7 +438,7 @@ public:
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
error occurred. 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,
@ -411,36 +448,36 @@ public:
/** 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 Position and dimension of the tab.
\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
error occurred. 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 Position and dimension of the menu. Note that the
menu is resizing itself based on what items you add.
/** \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
error occurred. 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
/** 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
error occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
@ -451,26 +488,34 @@ public:
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
error occurred. 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 rectangle Position and dimension of 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
error occurred. 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;
//! Adds a table to the environment
virtual IGUITable* addTable(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, bool drawBackground = false) = 0;
/** \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 element directly in the environment.
\param id An identifier for the table.
\param drawBackground Flag whether the background should be drawn.
\return Pointer to the created table. Returns 0 if an error occurred.
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;
//! Returns the default element factory which can create all built in elements
//! 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. */
@ -483,34 +528,45 @@ public:
\param factoryToAdd Pointer to new factory. */
virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
//! Returns amount of registered gui element factories.
//! \return 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.
virtual bool saveGUI(const c8* filename, IGUIElement* start=0) = 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 io::path& 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.
virtual bool loadGUI(const c8* filename, IGUIElement* parent=0) = 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 io::path& 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
@ -523,7 +579,7 @@ public:
virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
//! reads an element
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent) =0;
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
};

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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_FILE_OPEN_DIALOG_H_INCLUDED__
#include "IGUIElement.h"
#include "path.h"
namespace irr
{
@ -23,6 +24,9 @@ namespace gui
//! Returns the filename of the selected file. Returns NULL, if no file was selected.
virtual const wchar_t* getFileName() const = 0;
//! Returns the directory of the selected file. Returns NULL, if no directory was selected.
virtual const io::path& getDirectoryName() = 0;
};

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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 "IReferenceCounted.h"
#include "SColor.h"
#include "rect.h"
#include "irrString.h"
namespace irr
{
@ -21,13 +22,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,22 +40,22 @@ class IGUIFont : public virtual IReferenceCounted
{
public:
//! Draws an text and clips it to the specified rectangle if wanted.
//! Draws some 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 hcenter: Specifies 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,
virtual void draw(const core::stringw& 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.
//! Calculates the width and height of a given string of text.
/** \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;
virtual core::dimension2d<u32> getDimension(const wchar_t* text) const = 0;
//! Calculates the index of the character in the text which is on a specific position.
/** \param text: Text string.
@ -66,23 +67,34 @@ 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,
/** the global kerning distance is returned.
\param thisLetter: If this parameter is provided, the left side kerning for this letter is added
to the global kerning value. For example, a space might only be one pixel wide, but it may
be displayed as several pixels.
\param previousLetter: If provided, kerning is calculated for both letters and added to the global
kerning value. For example, in a font which supports kerning pairs a string such as 'Wo' may have
the 'o' tucked neatly under the 'W'.
\param thisLetter: If this parameter is provided, the left side kerning
for this letter is added to the global kerning value. For example, a
space might only be one pixel wide, but it may be displayed as several
pixels.
\param previousLetter: If provided, kerning is calculated for both
letters and added to the global kerning value. For example, in a font
which supports kerning pairs a string such as 'Wo' may have the 'o'
tucked neatly under the 'W'.
*/
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0;
//! Returns the distance between letters
virtual s32 getKerningHeight() const = 0;
//! Define which characters should not be drawn by the font.
/** For example " " would not draw any space which is usually blank in
most fonts.
\param s String of symbols which are not send down to the videodriver
*/
virtual void setInvisibleCharacters( const wchar_t *s ) = 0;
};
} // end namespace gui

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h

View File

@ -0,0 +1,45 @@
// This file is part of the "Irrlicht Engine".
// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de
#ifndef __I_GUI_IMAGE_LIST_H_INCLUDED__
#define __I_GUI_IMAGE_LIST_H_INCLUDED__
#include "IGUIElement.h"
#include "rect.h"
#include "irrTypes.h"
namespace irr
{
namespace gui
{
//! Font interface.
class IGUIImageList : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IGUIImageList() {};
//! Draws an image and clips it to the specified rectangle if wanted
//! \param index: Index of the image
//! \param destPos: Position of the image to draw
//! \param clip: Optional pointer to a rectalgle against which the text will be clipped.
//! If the pointer is null, no clipping will be done.
virtual void draw(s32 index, const core::position2d<s32>& destPos,
const core::rect<s32>* clip = 0) = 0;
//! Returns the count of Images in the list.
//! \return Returns the count of Images in the list.
virtual s32 getImageCount() const = 0;
//! Returns the size of the images in the list.
//! \return Returns the size of the images in the list.
virtual core::dimension2d<s32> getImageSize() const = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -36,22 +36,23 @@ namespace gui
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 specifying 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 specifying 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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
@ -49,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
@ -61,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
@ -76,8 +75,10 @@ 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.
//! sets the selected item. Set this to 0 if no item should be selected
virtual void setSelected(const wchar_t *item) = 0;
//! set whether the listbox should scroll to newly selected items
virtual void setAutoScrollEnabled(bool scroll) = 0;
//! returns true if automatic scrolling is enabled, false if not.
@ -108,11 +109,17 @@ 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
virtual void swapItems(u32 index1, u32 index2) = 0;
//! set global itemHeight
virtual void setItemHeight( s32 height ) = 0;
//! Sets whether to draw the background
virtual void setDrawBackground(bool draw) = 0;
};

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -21,24 +21,30 @@ namespace gui
IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {}
//! sets the maximum value of the scrollbar.
virtual void setMax(s32 max) = 0;
//! gets the maximum value of the scrollbar.
virtual s32 getMax() const = 0;
//! sets the maximum value of the scrollbar.
virtual void setMax(s32 max) = 0;
//! sets the minimum value of the scrollbar.
virtual void setMin(s32 min) = 0;
//! gets the minimum value of the scrollbar.
virtual s32 getMin() const = 0;
//! 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-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -37,11 +37,14 @@ namespace gui
EGST_BURNING_SKIN,
//! An unknown skin, not serializable at present
EGST_UNKNOWN
EGST_UNKNOWN,
//! this value is not used, it only specifies the number of skin types
EGST_COUNT
};
//! Names for gui element types
const c8* const GUISkinTypeNames[] =
const c8* const GUISkinTypeNames[EGST_COUNT+1] =
{
"windowsClassic",
"windowsMetallic",
@ -102,7 +105,7 @@ namespace gui
};
//! Names for default skin colors
const c8* const GUISkinColorNames[] =
const c8* const GUISkinColorNames[EGDC_COUNT+1] =
{
"3DDarkShadow",
"3DShadow",
@ -139,9 +142,9 @@ namespace gui
EGDS_WINDOW_BUTTON_WIDTH,
//! width of a checkbox check
EGDS_CHECK_BOX_WIDTH,
//! width of a messagebox
//! deprecated
EGDS_MESSAGE_BOX_WIDTH,
//! height of a messagebox
//! deprecated
EGDS_MESSAGE_BOX_HEIGHT,
//! width of a default button
EGDS_BUTTON_WIDTH,
@ -151,6 +154,23 @@ namespace gui
EGDS_TEXT_DISTANCE_X,
//! distance for text from background
EGDS_TEXT_DISTANCE_Y,
//! distance for text in the title bar, from the left of the window rect
EGDS_TITLEBARTEXT_DISTANCE_X,
//! distance for text in the title bar, from the top of the window rect
EGDS_TITLEBARTEXT_DISTANCE_Y,
//! free space in a messagebox between borders and contents on all sides
EGDS_MESSAGE_BOX_GAP_SPACE,
//! minimal space to reserve for messagebox text-width
EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH,
//! maximal space to reserve for messagebox text-width
EGDS_MESSAGE_BOX_MAX_TEXT_WIDTH,
//! deprecated - this was a typo. Should be removed for 1.8
EGDS_MESSAGE_BOX_MAX_TEST_WIDTH = EGDS_MESSAGE_BOX_MAX_TEXT_WIDTH,
//! minimal space to reserve for messagebox text-height
EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT,
//! maximal space to reserve for messagebox text-height
EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT,
//! this value is not used, it only specifies the amount of default sizes
//! available.
EGDS_COUNT
@ -158,7 +178,7 @@ namespace gui
//! Names for default skin sizes
const c8* const GUISkinSizeNames[] =
const c8* const GUISkinSizeNames[EGDS_COUNT+1] =
{
"ScrollBarSize",
"MenuHeight",
@ -170,7 +190,14 @@ namespace gui
"ButtonHeight",
"TextDistanceX",
"TextDistanceY",
0,
"TitleBarTextX",
"TitleBarTextY",
"MessageBoxGapSpace",
"MessageBoxMinTextWidth",
"MessageBoxMaxTextWidth",
"MessageBoxMinTextHeight",
"MessageBoxMaxTextHeight",
0
};
@ -198,7 +225,7 @@ namespace gui
};
//! Names for default skin sizes
const c8* const GUISkinTextNames[] =
const c8* const GUISkinTextNames[EGDT_COUNT+1] =
{
"MessageBoxOkay",
"MessageBoxCancel",
@ -208,7 +235,7 @@ namespace gui
"WindowButtonMaximize",
"WindowButtonMinimize",
"WindowButtonRestore",
0,
0
};
//! Customizable symbols for GUI
@ -265,7 +292,7 @@ namespace gui
EGDI_COUNT
};
const c8* const GUISkinIconNames[] =
const c8* const GUISkinIconNames[EGDI_COUNT+1] =
{
"windowMaximize",
"windowRestore",
@ -311,7 +338,7 @@ namespace gui
EGDF_COUNT
};
const c8* const GUISkinFontNames[] =
const c8* const GUISkinFontNames[EGDF_COUNT+1] =
{
"defaultFont",
"buttonFont",
@ -423,11 +450,16 @@ namespace gui
\param drawTitleBar: True to enable title drawing.
\param rect: Defining area where to draw.
\param clip: Clip area.
\return Returns rect where it would be good to draw title bar text. */
\param checkClientArea: When set to non-null the function will not draw anything,
but will instead return the clientArea which can be used for drawing by the calling window.
That is the area without borders and without titlebar.
\return Returns rect where it would be good to draw title bar text. This will
work even when checkClientArea is set to a non-null value.*/
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0;
const core::rect<s32>* clip=0,
core::rect<s32>* checkClientArea=0) = 0;
//! draws a standard 3d menu pane
/** Used for drawing for menus and context menus.
@ -460,7 +492,8 @@ namespace gui
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, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT) = 0;
@ -471,7 +504,9 @@ namespace gui
\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, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT ) = 0;
@ -511,6 +546,3 @@ namespace gui
#endif

View File

@ -1,65 +1,65 @@
// Copyright (C) 2006-2008 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__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
class IGUIEditBox;
//! Single line edit box + spin buttons
class IGUISpinBox : public IGUIElement
{
public:
//! constructor
IGUISpinBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
//! Access the edit box used in the spin control
virtual IGUIEditBox* getEditBox() const = 0;
//! set the current value of the spinbox
/** \param val: value to be set in the spinbox */
virtual void setValue(f32 val) = 0;
//! Get the current value of the spinbox
virtual f32 getValue() const = 0;
//! set the range of values which can be used in the spinbox
/** \param min: minimum value
\param max: maximum value */
virtual void setRange(f32 min, f32 max) = 0;
//! get the minimum value which can be used in the spinbox
virtual f32 getMin() const = 0;
//! get the maximum value which can be used in the spinbox
virtual f32 getMax() const = 0;
//! Step size by which values are changed when pressing the spinbuttons
/** The step size also determines the number of decimal places to display
\param step: stepsize used for value changes when pressing spinbuttons */
virtual void setStepSize(f32 step=1.f) = 0;
//! Sets the number of decimal places to display.
/** \param places: The number of decimal places to display, use -1 to reset */
virtual void setDecimalPlaces(s32 places) = 0;
//! get the current step size
virtual f32 getStepSize() const = 0;
};
} // end namespace gui
} // end namespace irr
#endif // __I_GUI_SPIN_BOX_H_INCLUDED__
// Copyright (C) 2006-2010 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__
#include "IGUIElement.h"
namespace irr
{
namespace gui
{
class IGUIEditBox;
//! Single line edit box + spin buttons
class IGUISpinBox : public IGUIElement
{
public:
//! constructor
IGUISpinBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
//! Access the edit box used in the spin control
virtual IGUIEditBox* getEditBox() const = 0;
//! set the current value of the spinbox
/** \param val: value to be set in the spinbox */
virtual void setValue(f32 val) = 0;
//! Get the current value of the spinbox
virtual f32 getValue() const = 0;
//! set the range of values which can be used in the spinbox
/** \param min: minimum value
\param max: maximum value */
virtual void setRange(f32 min, f32 max) = 0;
//! get the minimum value which can be used in the spinbox
virtual f32 getMin() const = 0;
//! get the maximum value which can be used in the spinbox
virtual f32 getMax() const = 0;
//! Step size by which values are changed when pressing the spinbuttons
/** The step size also determines the number of decimal places to display
\param step: stepsize used for value changes when pressing spinbuttons */
virtual void setStepSize(f32 step=1.f) = 0;
//! Sets the number of decimal places to display.
/** \param places: The number of decimal places to display, use -1 to reset */
virtual void setDecimalPlaces(s32 places) = 0;
//! get the current step size
virtual f32 getStepSize() const = 0;
};
} // end namespace gui
} // end namespace irr
#endif // __I_GUI_SPIN_BOX_H_INCLUDED__

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -39,6 +39,9 @@ struct SGUISprite
//! Sprite bank interface.
/** See http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=25742&highlight=spritebank
* for more information how to use the spritebank.
*/
class IGUISpriteBank : public virtual IReferenceCounted
{
public:
@ -61,12 +64,27 @@ public:
//! Changes one of the textures in the sprite bank
virtual void setTexture(u32 index, video::ITexture* texture) = 0;
//! Add the texture and use it for a single non-animated sprite.
//! The texture and the corresponding rectangle and sprite will all be added to the end of each array.
//! returns the index of the sprite or -1 on failure
virtual s32 addTextureAsSprite(video::ITexture* texture) = 0;
//! clears sprites, rectangles and textures
virtual void clear() = 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,
const video::SColor& color= video::SColor(255,255,255,255),
u32 starttime=0, u32 currenttime=0,
bool loop=true, bool center=false) = 0;
//! Draws a sprite batch in 2d using an array of positions and a color
virtual void draw2DSpriteBatch(const core::array<u32>& indices, const core::array<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;
};

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -29,7 +29,7 @@ namespace gui
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.
@ -43,7 +43,7 @@ namespace gui
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.
@ -53,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.
@ -78,7 +78,7 @@ namespace gui
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.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -13,7 +13,8 @@ namespace irr
{
namespace gui
{
//! A tab, onto which other gui elements could be added.
//! A tab-page, onto which other gui elements could be added.
/** IGUITab refers to the page itself, not to the tab in the tabbar of an IGUITabControl. */
class IGUITab : public IGUIElement
{
public:
@ -86,8 +87,14 @@ namespace gui
/** return Returns the height of the tabs */
virtual s32 getTabHeight() const = 0;
//! set the maximal width of a tab. Per default width is 0 which means "no width restriction".
virtual void setTabMaxWidth(s32 width ) = 0;
//! get the maximal width of a tab
virtual s32 getTabMaxWidth() const = 0;
//! Set the alignment of the tabs
//! Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT
/** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */
virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0;
//! Get the alignment of the tabs
@ -108,7 +115,3 @@ namespace gui
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Nikolaus Gebhardt
// Copyright (C) 2003-2010 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 @@ namespace gui
//! Do not use ordering
EGCO_NONE,
//! Send a EGET_TABLE_HEADER_CHANGED message when a column header is clicked.
//! Send a EGET_TABLE_HEADER_CHANGED message when a column header is clicked.
EGCO_CUSTOM,
//! Sort it ascending by it's ascii value like: a,b,c,...
@ -48,7 +48,7 @@ namespace gui
0,
};
enum EGUI_ORDERING_MODE
enum EGUI_ORDERING_MODE
{
//! No element ordering
EGOM_NONE,
@ -66,6 +66,7 @@ namespace gui
const c8* const GUIOrderingModeNames[] =
{
"none",
"ascending",
"descending",
0
@ -79,8 +80,6 @@ namespace gui
EGTDF_COUNT
};
class IGUIFont;
//! Default list box GUI element.
class IGUITable : public IGUIElement
{
@ -90,7 +89,7 @@ namespace gui
: IGUIElement(EGUIET_TABLE, environment, parent, id, rectangle) {}
//! Adds a column
//! If columnIndex is outside the current range, do push new colum at the end
/** If columnIndex is outside the current range, do push new colum at the end */
virtual void addColumn(const wchar_t* caption, s32 columnIndex=-1) = 0;
//! remove a column from the table
@ -101,8 +100,8 @@ namespace gui
//! Makes a column active. This will trigger an ordering process.
/** \param idx: The id of the column to make active.
//! \param doOrder: Do also the ordering which depending on mode for active column
\return Returns true if successful. */
\param doOrder: Do also the ordering which depending on mode for active column
\return True if successful. */
virtual bool setActiveColumn(s32 idx, bool doOrder=false) = 0;
//! Returns which header is currently active
@ -113,32 +112,36 @@ namespace gui
//! Set the width of a column
virtual void setColumnWidth(u32 columnIndex, u32 width) = 0;
//! columns can be resized by drag 'n drop
virtual void setResizableColumns(bool resizable) = 0;
//! can columns be resized by dran 'n drop?
virtual bool hasResizableColumns() const = 0;
//! This tells the table control which ordering mode should be used when
//! a column header is clicked.
/** \param columnIndex: The index of the column header.
\param state: If true, a EGET_TABLE_HEADER_CHANGED message will be sent and you can order the table data as you whish.*/
//! \param mode: One of the modes defined in EGUI_COLUMN_ORDERING
//! This tells the table control which ordering mode should be used when a column header is clicked.
/** \param columnIndex The index of the column header.
\param mode: One of the modes defined in EGUI_COLUMN_ORDERING */
virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode) = 0;
//! Returns which row is currently selected
virtual s32 getSelected() const = 0;
//! Returns amount of rows in the tabcontrol
//! set wich row is currently selected
virtual void setSelected( s32 index ) = 0;
//! Get amount of rows in the tabcontrol
virtual s32 getRowCount() const = 0;
//! adds a row to the table
/** \param rowIndex: zero based index of rows. The row will be inserted at this
position, if a row already exist there, it will be placed after it. If the row
is larger than the actual number of row by more than one, it won't be created.
Note that if you create a row that's not at the end, there might be performance issues*/
virtual void addRow(u32 rowIndex) = 0;
/** \param rowIndex Zero based index of rows. The row will be
inserted at this position, if a row already exist there, it
will be placed after it. If the row is larger than the actual
number of row by more than one, it won't be created. Note that
if you create a row that's not at the end, there might be
performance issues.
\return index of inserted row. */
virtual u32 addRow(u32 rowIndex) = 0;
//! Remove a row from the table
virtual void removeRow(u32 rowIndex) = 0;
@ -146,21 +149,23 @@ namespace gui
//! clears the table rows, but keeps the columns intact
virtual void clearRows() = 0;
//! Swap two row positions. This is useful for a custom ordering algo.
//! Swap two row positions.
virtual void swapRows(u32 rowIndexA, u32 rowIndexB) = 0;
//! This tells the table to start ordering all the rows. You need to explicitly
//! tell the table to re order the rows when a new row is added or the cells data is
//! changed. This makes the system more flexible and doesn't make you pay the cost of
//! ordering when adding a lot of rows.
//! \param columnIndex: When set to -1 the active column is used.
//! This tells the table to start ordering all the rows.
/** You need to explicitly tell the table to re order the rows
when a new row is added or the cells data is changed. This
makes the system more flexible and doesn't make you pay the
cost of ordering when adding a lot of rows.
\param columnIndex: When set to -1 the active column is used.
\param mode Ordering mode of the rows. */
virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE) = 0;
//! Set the text of a cell
virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text) = 0;
virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text) = 0;
//! Set the text of a cell, and set a color of this cell.
virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text, video::SColor color) = 0;
virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text, video::SColor color) = 0;
//! Set the data of a cell
virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data) = 0;

View File

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

View File

@ -0,0 +1,255 @@
// This file is part of the "Irrlicht Engine".
// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de
#ifndef __I_GUI_TREE_VIEW_H_INCLUDED__
#define __I_GUI_TREE_VIEW_H_INCLUDED__
#include "IGUIElement.h"
#include "IGUIImageList.h"
#include "irrTypes.h"
namespace irr
{
namespace gui
{
class IGUIFont;
class IGUITreeView;
//! Node for gui tree view
class IGUITreeViewNode : public IReferenceCounted
{
public:
//! returns the owner (tree view) of this node
virtual IGUITreeView* getOwner() const = 0;
//! Returns the parent node of this node.
/** For the root node this will return 0. */
virtual IGUITreeViewNode* getParent() const = 0;
//! returns the text of the node
virtual const wchar_t* getText() const = 0;
//! sets the text of the node
virtual void setText( const wchar_t* text ) = 0;
//! returns the icon text of the node
virtual const wchar_t* getIcon() const = 0;
//! sets the icon text of the node
virtual void setIcon( const wchar_t* icon ) = 0;
//! returns the image index of the node
virtual u32 getImageIndex() const = 0;
//! sets the image index of the node
virtual void setImageIndex( u32 imageIndex ) = 0;
//! returns the image index of the node
virtual u32 getSelectedImageIndex() const = 0;
//! sets the image index of the node
virtual void setSelectedImageIndex( u32 imageIndex ) = 0;
//! returns the user data (void*) of this node
virtual void* getData() const = 0;
//! sets the user data (void*) of this node
virtual void setData( void* data ) = 0;
//! returns the user data2 (IReferenceCounted) of this node
virtual IReferenceCounted* getData2() const = 0;
//! sets the user data2 (IReferenceCounted) of this node
virtual void setData2( IReferenceCounted* data ) = 0;
//! returns the child item count
virtual u32 getChildCount() const = 0;
//! removes all childs (recursive) from this node
virtual void clearChilds() = 0;
//! returns true if this node has child nodes
virtual bool hasChilds() const = 0;
//! Adds a new node behind the last child node.
/** \param text text of the new node
\param icon icon text of the new node
\param imageIndex index of the image for the new node (-1 = none)
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
\param data user data (void*) of the new node
\param data2 user data2 (IReferenceCounted*) of the new node
\return The new node
*/
virtual IGUITreeViewNode* addChildBack(
const wchar_t* text, const wchar_t* icon = 0,
s32 imageIndex=-1, s32 selectedImageIndex=-1,
void* data=0, IReferenceCounted* data2=0) =0;
//! Adds a new node before the first child node.
/** \param text text of the new node
\param icon icon text of the new node
\param imageIndex index of the image for the new node (-1 = none)
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
\param data user data (void*) of the new node
\param data2 user data2 (IReferenceCounted*) of the new node
\return The new node
*/
virtual IGUITreeViewNode* addChildFront(
const wchar_t* text, const wchar_t* icon = 0,
s32 imageIndex=-1, s32 selectedImageIndex=-1,
void* data=0, IReferenceCounted* data2=0 ) =0;
//! Adds a new node behind the other node.
/** The other node has also te be a child node from this node.
\param other Node to insert after
\param text text of the new node
\param icon icon text of the new node
\param imageIndex index of the image for the new node (-1 = none)
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
\param data user data (void*) of the new node
\param data2 user data2 (IReferenceCounted*) of the new node
\return The new node or 0 if other is no child node from this
*/
virtual IGUITreeViewNode* insertChildAfter(
IGUITreeViewNode* other,
const wchar_t* text, const wchar_t* icon = 0,
s32 imageIndex=-1, s32 selectedImageIndex=-1,
void* data=0, IReferenceCounted* data2=0) =0;
//! Adds a new node before the other node.
/** The other node has also te be a child node from this node.
\param other Node to insert before
\param text text of the new node
\param icon icon text of the new node
\param imageIndex index of the image for the new node (-1 = none)
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
\param data user data (void*) of the new node
\param data2 user data2 (IReferenceCounted*) of the new node
\return The new node or 0 if other is no child node from this
*/
virtual IGUITreeViewNode* insertChildBefore(
IGUITreeViewNode* other,
const wchar_t* text, const wchar_t* icon = 0,
s32 imageIndex=-1, s32 selectedImageIndex=-1,
void* data=0, IReferenceCounted* data2=0) = 0;
//! Return the first child node from this node.
/** \return The first child node or 0 if this node has no childs. */
virtual IGUITreeViewNode* getFirstChild() const = 0;
//! Return the last child node from this node.
/** \return The last child node or 0 if this node has no childs. */
virtual IGUITreeViewNode* getLastChild() const = 0;
//! Returns the previous sibling node from this node.
/** \return The previous sibling node from this node or 0 if this is
the first node from the parent node.
*/
virtual IGUITreeViewNode* getPrevSibling() const = 0;
//! Returns the next sibling node from this node.
/** \return The next sibling node from this node or 0 if this is
the last node from the parent node.
*/
virtual IGUITreeViewNode* getNextSibling() const = 0;
//! Returns the next visible (expanded, may be out of scrolling) node from this node.
/** \return The next visible node from this node or 0 if this is
the last visible node. */
virtual IGUITreeViewNode* getNextVisible() const = 0;
//! Deletes a child node.
/** \return Returns true if the node was found as a child and is deleted. */
virtual bool deleteChild( IGUITreeViewNode* child ) = 0;
//! Moves a child node one position up.
/** \return True if the node was found as achild node and was not already the first child. */
virtual bool moveChildUp( IGUITreeViewNode* child ) = 0;
//! Moves a child node one position down.
/** \return True if the node was found as achild node and was not already the last child. */
virtual bool moveChildDown( IGUITreeViewNode* child ) = 0;
//! Returns true if the node is expanded (childs are visible).
virtual bool getExpanded() const = 0;
//! Sets if the node is expanded.
virtual void setExpanded( bool expanded ) = 0;
//! Returns true if the node is currently selected.
virtual bool getSelected() const = 0;
//! Sets this node as selected.
virtual void setSelected( bool selected ) = 0;
//! Returns true if this node is the root node.
virtual bool isRoot() const = 0;
//! Returns the level of this node.
/** The root node has level 0. Direct childs of the root has level 1 ... */
virtual s32 getLevel() const = 0;
//! Returns true if this node is visible (all parents are expanded).
virtual bool isVisible() const = 0;
};
//! Default tree view GUI element.
/** Displays a windows like tree buttons to expand/collaps the child
nodes of an node and optional tree lines. Each node consits of an
text, an icon text and a void pointer for user data. */
class IGUITreeView : public IGUIElement
{
public:
//! constructor
IGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle)
: IGUIElement( EGUIET_TREE_VIEW, environment, parent, id, rectangle ) {}
//! returns the root node (not visible) from the tree.
virtual IGUITreeViewNode* getRoot() const = 0;
//! returns the selected node of the tree or 0 if none is selected
virtual IGUITreeViewNode* getSelected() const = 0;
//! returns true if the tree lines are visible
virtual bool getLinesVisible() const = 0;
//! sets if the tree lines are visible
/** \param visible true for visible, false for invisible */
virtual void setLinesVisible( bool visible ) = 0;
//! Sets the font which should be used as icon font.
/** This font is set to the Irrlicht engine built-in-font by
default. Icons can be displayed in front of every list item.
An icon is a string, displayed with the icon font. When using
the build-in-font of the Irrlicht engine as icon font, the icon
strings defined in GUIIcons.h can be used.
*/
virtual void setIconFont( IGUIFont* font ) = 0;
//! Sets the image list which should be used for the image and selected image of every node.
/** The default is 0 (no images). */
virtual void setImageList( IGUIImageList* imageList ) = 0;
//! Returns the image list which is used for the nodes.
virtual IGUIImageList* getImageList() const = 0;
//! Sets if the image is left of the icon. Default is true.
virtual void setImageLeftOfIcon( bool bLeftOf ) = 0;
//! Returns if the Image is left of the icon. Default is true.
virtual bool getImageLeftOfIcon() const = 0;
//! Returns the node which is associated to the last event.
/** This pointer is only valid inside the OnEvent call! */
virtual IGUITreeViewNode* getLastEventNode() const = 0;
};
} // end namespace gui
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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,43 @@ namespace gui
: IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {}
//! Returns pointer to the close button
/** You can hide the button by calling setVisible(false) on the result. */
virtual IGUIButton* getCloseButton() const = 0;
//! Returns pointer to the minimize button
/** You can hide the button by calling setVisible(false) on the result. */
virtual IGUIButton* getMinimizeButton() const = 0;
//! Returns pointer to the maximize button
/** You can hide the button by calling setVisible(false) on the result. */
virtual IGUIButton* getMaximizeButton() const = 0;
//! Returns true if the window can be dragged with the mouse, false if not
virtual bool isDraggable() const = 0;
//! Sets whether the window can be dragged by the mouse
virtual void setDraggable(bool draggable) = 0;
//! Set if the window background will be drawn
virtual void setDrawBackground(bool draw) = 0;
//! Get if the window background will be drawn
virtual bool getDrawBackground() const = 0;
//! Set if the window titlebar will be drawn
//! Note: If the background is not drawn, then the titlebar is automatically also not drawn
virtual void setDrawTitlebar(bool draw) = 0;
//! Get if the window titlebar will be drawn
virtual bool getDrawTitlebar() const = 0;
//! Returns the rectangle of the drawable area (without border and without titlebar)
/** The coordinates are given relative to the top-left position of the gui element.<br>
So to get absolute positions you have to add the resulting rectangle to getAbsolutePosition().UpperLeftCorner.<br>
To get it relative to the parent element you have to add the resulting rectangle to getRelativePosition().UpperLeftCorner.
Beware that adding a menu will not change the clientRect as menus are own gui elements, so in that case you might want to subtract
the menu area additionally. */
virtual core::rect<s32> getClientRect() const = 0;
};

View File

@ -0,0 +1,177 @@
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GEOMETRY_CREATOR_H_INCLUDED__
#define __I_GEOMETRY_CREATOR_H_INCLUDED__
#include "IReferenceCounted.h"
#include "IMesh.h"
#include "IImage.h"
namespace irr
{
namespace video
{
class IVideoDriver;
class SMaterial;
}
namespace scene
{
//! Helper class for creating geometry on the fly.
/** You can get an instance of this class through ISceneManager::getGeometryCreator() */
class IGeometryCreator : public IReferenceCounted
{
public:
//! Creates a simple cube mesh.
/**
\param size Dimensions of the cube.
\return Generated mesh.
*/
virtual IMesh* createCubeMesh(const core::vector3df& size=core::vector3df(5.f,5.f,5.f)) const =0;
//! Create a pseudo-random mesh representing a hilly terrain.
/**
\param tileSize The size of each tile.
\param tileCount The number of tiles in each dimension.
\param material The material to apply to the mesh.
\param hillHeight The maximum height of the hills.
\param countHills The number of hills along each dimension.
\param textureRepeatCount The number of times to repeat the material texture along each dimension.
\return Generated mesh.
*/
virtual IMesh* createHillPlaneMesh(
const core::dimension2d<f32>& tileSize,
const core::dimension2d<u32>& tileCount,
video::SMaterial* material, f32 hillHeight,
const core::dimension2d<f32>& countHills,
const core::dimension2d<f32>& textureRepeatCount) const =0;
//! Create a simple rectangular textured plane mesh.
/**
\param tileSize The size of each tile.
\param tileCount The number of tiles in each dimension.
\param material The material to apply to the mesh.
\param textureRepeatCount The number of times to repeat the material texture along each dimension.
\return Generated mesh.
*/
IMesh* createPlaneMesh(
const core::dimension2d<f32>& tileSize,
const core::dimension2d<u32>& tileCount,
video::SMaterial* material,
const core::dimension2d<f32>& textureRepeatCount) const
{
return createHillPlaneMesh(tileSize, tileCount, material, 0.f, core::dimension2df(), textureRepeatCount);
}
//! Create a terrain mesh from an image representing a heightfield.
/**
\param texture The texture to apply to the terrain.
\param heightmap An image that will be interpreted as a heightmap. The
brightness (average colour) of each pixel is interpreted as a height,
with a 255 brightness pixel producing the maximum height.
\param stretchSize The size that each pixel will produce, i.e. a
512x512 heightmap
and a stretchSize of (10.f, 20.f) will produce a mesh of size
5120.f x 10240.f
\param maxHeight The maximum height of the terrain.
\param driver The current video driver.
\param defaultVertexBlockSize (to be documented)
\param debugBorders (to be documented)
\return Generated mesh.
*/
virtual IMesh* createTerrainMesh(video::IImage* texture,
video::IImage* heightmap,
const core::dimension2d<f32>& stretchSize,
f32 maxHeight, video::IVideoDriver* driver,
const core::dimension2d<u32>& defaultVertexBlockSize,
bool debugBorders=false) const =0;
//! Create an arrow mesh, composed of a cylinder and a cone.
/**
\param tesselationCylinder Number of quads composing the cylinder.
\param tesselationCone Number of triangles composing the cone's roof.
\param height Total height of the arrow
\param cylinderHeight Total height of the cylinder, should be lesser
than total height
\param widthCylinder Diameter of the cylinder
\param widthCone Diameter of the cone's base, should be not smaller
than the cylinder's diameter
\param colorCylinder color of the cylinder
\param colorCone color of the cone
\return Generated mesh.
*/
virtual IMesh* createArrowMesh(const u32 tesselationCylinder = 4,
const u32 tesselationCone = 8, const f32 height = 1.f,
const f32 cylinderHeight = 0.6f, const f32 widthCylinder = 0.05f,
const f32 widthCone = 0.3f, const video::SColor colorCylinder = 0xFFFFFFFF,
const video::SColor colorCone = 0xFFFFFFFF) const =0;
//! Create a sphere mesh.
/**
\param radius Radius of the sphere
\param polyCountX Number of quads used for the horizontal tiling
\param polyCountY Number of quads used for the vertical tiling
\return Generated mesh.
*/
virtual IMesh* createSphereMesh(f32 radius = 5.f,
u32 polyCountX = 16, u32 polyCountY = 16) const =0;
//! Create a cylinder mesh.
/**
\param radius Radius of the cylinder.
\param length Length of the cylinder.
\param tesselation Number of quads around the circumference of the cylinder.
\param color The color of the cylinder.
\param closeTop If true, close the ends of the cylinder, otherwise leave them open.
\param oblique (to be documented)
\return Generated mesh.
*/
virtual IMesh* createCylinderMesh(f32 radius, f32 length,
u32 tesselation,
const video::SColor& color=video::SColor(0xffffffff),
bool closeTop=true, f32 oblique=0.f) const =0;
//! Create a cone mesh.
/**
\param radius Radius of the cone.
\param length Length of the cone.
\param tesselation Number of quads around the circumference of the cone.
\param colorTop The color of the top of the cone.
\param colorBottom The color of the bottom of the cone.
\param oblique (to be documented)
\return Generated mesh.
*/
virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tesselation,
const video::SColor& colorTop=video::SColor(0xffffffff),
const video::SColor& colorBottom=video::SColor(0xffffffff),
f32 oblique=0.f) const =0;
//! Create a volume light mesh.
/**
\param subdivideU Horizontal patch count.
\param subdivideV Vertical patch count.
\param footColor Color at the bottom of the light.
\param tailColor Color at the mid of the light.
\param lpDistance Virtual distance of the light point for normals.
\param lightDim Dimensions of the light.
\return Generated mesh.
*/
virtual IMesh* createVolumeLightMesh(
const u32 subdivideU=32, const u32 subdivideV=32,
const video::SColor footColor = 0xffffffff,
const video::SColor tailColor = 0xffffffff,
const f32 lpDistance = 8.f,
const core::vector3df& lightDim = core::vector3df(1.f,1.2f,1.f)) const =0;
};
} // end namespace scene
} // end namespace irr
#endif // __I_GEOMETRY_CREATOR_H_INCLUDED__

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -32,7 +32,30 @@ enum ECOLOR_FORMAT
ECF_R8G8B8,
//! Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
ECF_A8R8G8B8
ECF_A8R8G8B8,
/** Floating Point formats. The following formats may only be used for render target textures. */
//! 16 bit floating point format using 16 bits for the red channel.
ECF_R16F,
//! 32 bit floating point format using 16 bits for the red channel and 16 bits for the green channel.
ECF_G16R16F,
//! 64 bit floating point format 16 bits are used for the red, green, blue and alpha channels.
ECF_A16B16G16R16F,
//! 32 bit floating point format using 32 bits for the red channel.
ECF_R32F,
//! 64 bit floating point format using 32 bits for the red channel and 32 bits for the green channel.
ECF_G32R32F,
//! 128 bit floating point format. 32 bits are used for the red, green, blue and alpha channels.
ECF_A32B32G32R32F,
//! Unknown color format:
ECF_UNKNOWN
};
@ -58,7 +81,7 @@ public:
virtual void unlock() = 0;
//! Returns width and height of image data.
virtual const core::dimension2d<s32>& getDimension() const = 0;
virtual const core::dimension2d<u32>& getDimension() const = 0;
//! Returns bits per pixel.
virtual u32 getBitsPerPixel() const = 0;
@ -76,7 +99,7 @@ public:
virtual SColor getPixel(u32 x, u32 y) const = 0;
//! Sets a pixel
virtual void setPixel(u32 x, u32 y, const SColor &color ) = 0;
virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ) = 0;
//! Returns the color format
virtual ECOLOR_FORMAT getColorFormat() const = 0;
@ -97,7 +120,7 @@ public:
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;
virtual void copyToScaling(void* target, u32 width, u32 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;
@ -108,14 +131,65 @@ public:
//! 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
//! copies this surface into another, using the alpha mask and 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;
//! copies this surface into another, scaling it to fit, appyling a box filter
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false) = 0;
//! fills the surface with black or white
virtual void fill(const SColor &color) =0;
//! get the amount of Bits per Pixel of the given color format
static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
{
switch(format)
{
case ECF_A1R5G5B5:
return 16;
case ECF_R5G6B5:
return 16;
case ECF_R8G8B8:
return 24;
case ECF_A8R8G8B8:
return 32;
case ECF_R16F:
return 16;
case ECF_G16R16F:
return 32;
case ECF_A16B16G16R16F:
return 64;
case ECF_R32F:
return 32;
case ECF_G32R32F:
return 64;
case ECF_A32B32G32R32F:
return 128;
default:
return 0;
}
}
//! test if the color format is only viable for RenderTarget textures
/** Since we don't have support for e.g. floating point IImage formats
one should test if the color format can be used for arbitrary usage, or
if it is restricted to RTTs. */
static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
{
switch(format)
{
case ECF_A1R5G5B5:
case ECF_R5G6B5:
case ECF_R8G8B8:
case ECF_A8R8G8B8:
return false;
default:
return true;
}
}
};
} // end namespace video

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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 "IImage.h"
#include "path.h"
namespace irr
{
@ -28,9 +29,9 @@ public:
//! 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.
\param filename Name of file to check.
\return True if file seems to be loadable. */
virtual bool isALoadableFileExtension(const c8* fileName) const = 0;
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
//! Check if the file might be loaded by this class
/** Check might look into the file.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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,8 @@
#define _I_IMAGE_WRITER_H_INCLUDED__
#include "IReferenceCounted.h"
#include "irrString.h"
#include "coreutil.h"
namespace irr
{
@ -24,9 +26,9 @@ class IImageWriter : public IReferenceCounted
{
public:
//! Check if this writer can write a file with the given extension
/** \param fileName Name of the file to check.
/** \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;
virtual bool isAWriteableFileExtension(const io::path& filename) const = 0;
//! Write image to file
/** \param file File handle to write to.

View File

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

View File

@ -0,0 +1,62 @@
// Written by Colin MacDonald - all rights assigned to Nikolaus Gebhardt
// Copyright (C) 2008-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_LIGHT_MANAGER_H_INCLUDED__
#define __I_LIGHT_MANAGER_H_INCLUDED__
#include "IReferenceCounted.h"
#include "irrArray.h"
namespace irr
{
namespace scene
{
class ILightSceneNode;
//! ILightManager provides an interface for user applications to manipulate the list of lights in the scene.
/** The light list can be trimmed or re-ordered before device/ hardware
lights are created, and/or individual lights can be switched on and off
before or after each scene node is rendered. It is assumed that the
ILightManager implementation will store any data that it wishes to
retain, i.e. the ISceneManager to which it is assigned, the lightList,
the current render pass, and the current scene node. */
class ILightManager : public IReferenceCounted
{
public:
//! Called after the scene's light list has been built, but before rendering has begun.
/** As actual device/hardware lights are not created until the
ESNRP_LIGHT render pass, this provides an opportunity for the
light manager to trim or re-order the light list, before any
device/hardware lights have actually been created.
\param lightList: the Scene Manager's light list, which
the light manager may modify. This reference will remain valid
until OnPostRender().
*/
virtual void OnPreRender(core::array<ILightSceneNode*> & lightList) = 0;
//! Called after the last scene node is rendered.
/** After this call returns, the lightList passed to OnPreRender() becomes invalid. */
virtual void OnPostRender(void) = 0;
//! Called before a render pass begins
/** \param renderPass: the render pass that's about to begin */
virtual void OnRenderPassPreRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0;
//! Called after the render pass specified in OnRenderPassPreRender() ends
/** \param[in] renderPass: the render pass that has finished */
virtual void OnRenderPassPostRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0;
//! Called before the given scene node is rendered
/** \param[in] node: the scene node that's about to be rendered */
virtual void OnNodePreRender(ISceneNode* node) = 0;
//! Called after the the node specified in OnNodePreRender() has been rendered
/** \param[in] node: the scene node that has just been rendered */
virtual void OnNodePostRender(ISceneNode* node) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -40,6 +40,12 @@ public:
/** \return The light data. */
virtual video::SLight& getLightData() = 0;
//! Sets if the node should be visible or not.
/** All children of this node won't be visible either, when set
to true.
\param isVisible If the node shall be visible. */
virtual void setVisible(bool isVisible) = 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -66,6 +66,7 @@ public:
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;
virtual void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
//! Prints out a text into the log
/** \param text: Text to print out.

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 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,11 +1,10 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__
#define __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__
#include "IReferenceCounted.h"
#include "SMaterial.h"
#include "S3DVertex.h"

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -15,36 +15,37 @@ namespace scene
{
class IMeshBuffer;
//! Class for accessing a mesh with multiple mesh buffers.
//! Class which holds the geometry of an object.
/** An IMesh is nothing more than a collection of some mesh buffers
(IMeshBuffer). 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:
//! 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.
//! 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
//! Get 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. */
\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;
@ -53,10 +54,17 @@ namespace scene
\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, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) = 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;
//! flags the meshbuffer as changed, reloads hardware buffers
//! 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;
};

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -11,58 +11,29 @@
#include "S3DVertex.h"
#include "SVertexIndex.h"
#include "EHardwareBufferFlags.h"
#include "EPrimitiveTypes.h"
namespace irr
{
namespace scene
{
//! Enumeration for all primitive types there are.
enum E_PRIMITIVE_TYPE
{
//! All vertices are non-connected points.
EPT_POINTS=0,
//! All vertices form a single connected line.
EPT_LINE_STRIP,
//! Just as LINE_STRIP, but the last and the first vertex is also connected.
EPT_LINE_LOOP,
//! Every two vertices are connected creating n/2 lines.
EPT_LINES,
//! After the first two vertices each vertex defines a new triangle.
//! Always the two last and the new one form a new triangle.
EPT_TRIANGLE_STRIP,
//! After the first two vertices each vertex defines a new triangle.
//! All around the common first vertex.
EPT_TRIANGLE_FAN,
//! Explicitly set all vertices for each triangle.
EPT_TRIANGLES,
//! After the first two vertices each further tw vetices create a quad with the preceding two.
EPT_QUAD_STRIP,
//! Every four vertices create a quad.
EPT_QUADS,
//! Just as LINE_LOOP, but filled.
EPT_POLYGON,
//! The single vertices are expanded to quad billboards on the GPU.
EPT_POINT_SPRITES
};
//! Struct for holding a mesh with a single material
/** SMeshBuffer is a simple implementation of a MeshBuffer.
//! Struct for holding a mesh with a single material.
/** A part of an IMesh which has the same material on each face of that
group. Logical groups of an IMesh need not be put into separate mesh
buffers, but can be. Separately animated parts of the mesh must be put
into separate mesh buffers.
Some mesh buffer implementations have limitations on the number of
vertices the buffer can hold. In that case, logical grouping can help.
Moreover, the number of vertices should be optimized for the GPU upload,
which often depends on the type of gfx card. Typial figures are
1000-10000 vertices per buffer.
SMeshBuffer is a simple implementation of a MeshBuffer, which supports
up to 65535 vertices.
Since meshbuffers are used for drawing, and hence will be exposed
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 hte buffer once it's not used in
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
@ -166,7 +137,6 @@ namespace scene
//! 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;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2002-2008 Nikolaus Gebhardt
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@ -6,7 +6,7 @@
#define __I_MESH_CACHE_H_INCLUDED__
#include "IReferenceCounted.h"
#include "irrString.h"
#include "path.h"
namespace irr
{
@ -42,12 +42,12 @@ namespace scene
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
\param name Name of the mesh. When calling
ISceneManager::getMesh() with this name it will return the mesh
set by this method.
\param mesh Pointer to a mesh which will now be referenced by
this name. */
virtual void addMesh(const c8* filename, IAnimatedMesh* mesh) = 0;
virtual void addMesh(const io::path& name, IAnimatedMesh* mesh) = 0;
//! Removes a mesh from the cache.
/** After loading a mesh with getMesh(), the mesh can be
@ -67,7 +67,7 @@ namespace scene
/** 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().
getMeshByIndex() and getMeshName().
\return Number of meshes in cache. */
virtual u32 getMeshCount() const = 0;
@ -90,60 +90,106 @@ namespace scene
number. */
virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0;
//! Returns a mesh based on its filename.
/** \param filename Name of the mesh.
//! Returns a mesh based on its name (often a filename).
/** \deprecated Use getMeshByName() instead. */
_IRR_DEPRECATED_ IAnimatedMesh* getMeshByFilename(const io::path& filename)
{
return getMeshByName(filename);
}
//! Get the name of a loaded mesh, based on its index. (Name is often identical to the filename).
/** \deprecated Use getMeshName() instead. */
_IRR_DEPRECATED_ const io::path& getMeshFilename(u32 index) const
{
return getMeshName(index).getInternalName();
}
//! Get the name of a loaded mesh, if there is any. (Name is often identical to the filename).
/** \deprecated Use getMeshName() instead. */
_IRR_DEPRECATED_ const io::path& getMeshFilename(const IAnimatedMesh* const mesh) const
{
return getMeshName(mesh).getInternalName();
}
//! Get the name of a loaded mesh, if there is any. (Name is often identical to the filename).
/** \deprecated Use getMeshName() instead. */
_IRR_DEPRECATED_ const io::path& getMeshFilename(const IMesh* const mesh) const
{
return getMeshName(mesh).getInternalName();
}
//! Renames a loaded mesh.
/** \deprecated Use renameMesh() instead. */
_IRR_DEPRECATED_ bool setMeshFilename(u32 index, const io::path& filename)
{
return renameMesh(index, filename);
}
//! Renames a loaded mesh.
/** \deprecated Use renameMesh() instead. */
_IRR_DEPRECATED_ bool setMeshFilename(const IAnimatedMesh* const mesh, const io::path& filename)
{
return renameMesh(mesh, filename);
}
//! Renames a loaded mesh.
/** \deprecated Use renameMesh() instead. */
_IRR_DEPRECATED_ bool setMeshFilename(const IMesh* const mesh, const io::path& filename)
{
return renameMesh(mesh, filename);
}
//! Returns a mesh based on its name.
/** \param name Name of the mesh. Usually a filename.
\return Pointer to the mesh or 0 if there is none with this number. */
virtual IAnimatedMesh* getMeshByFilename(const c8* filename) = 0;
virtual IAnimatedMesh* getMeshByName(const io::path& name) = 0;
//! Get the filename of a loaded mesh, based on its index.
//! Get the name of a loaded mesh, based on its index.
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
\return String with name if mesh was found and has a name, else
0. */
virtual const c8* getMeshFilename(u32 index) const = 0;
\return The name if mesh was found and has a name, else the path is empty. */
virtual const io::SNamedPath& getMeshName(u32 index) const = 0;
//! Get the filename of a loaded mesh, if there is any.
//! Get the name 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;
\return The name if mesh was found and has a name, else the path is empty. */
virtual const io::SNamedPath& getMeshName(const IAnimatedMesh* const mesh) const = 0;
//! Get the filename of a loaded mesh, if there is any.
//! Get the name 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;
\return The name if mesh was found and has a name, else the path is empty. */
virtual const io::SNamedPath& getMeshName(const IMesh* const mesh) const = 0;
//! 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.
\param name New name for the mesh.
\return True if mesh was renamed. */
virtual bool setMeshFilename(u32 index, const c8* filename) = 0;
virtual bool renameMesh(u32 index, const io::path& name) = 0;
//! 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.
\param name New name for the mesh.
\return True if mesh was renamed. */
virtual bool setMeshFilename(const IAnimatedMesh* const mesh, const c8* filename) = 0;
virtual bool renameMesh(const IAnimatedMesh* const mesh, const io::path& name) = 0;
//! 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.
\param name New name for the mesh.
\return True if mesh was renamed. */
virtual bool setMeshFilename(const IMesh* const mesh, const c8* filename) = 0;
virtual bool renameMesh(const IMesh* const mesh, const io::path& name) = 0;
//! Check if a mesh was already loaded.
/** \param filename Name of the mesh.
/** \param name Name of the mesh. Usually a filename.
\return True if the mesh has been loaded, else false. */
virtual bool isMeshLoaded(const c8* filename) = 0;
virtual bool isMeshLoaded(const io::path& name) = 0;
//! Clears the whole mesh cache, removing all meshes.
/** All meshes will be reloaded completely when using ISceneManager::getMesh()

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