From f74f7586e2ed929234e949c676b7aa4d90c30354 Mon Sep 17 00:00:00 2001 From: hybrid Date: Sun, 16 Sep 2007 23:41:55 +0000 Subject: [PATCH] Some more constification, but still not done. Now we have also SEvent in OnEvent as const ref, so most user apps will need some kind of upgrade for the new library version. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@964 dfc29bdd-3216-0410-991c-e03cc46cb475 --- examples/04.Movement/main.cpp | 2 +- examples/04.Movement/tutorial.html | 2 +- examples/05.UserInterface/main.cpp | 2 +- examples/05.UserInterface/tutorial.html | 2 +- examples/09.Meshviewer/main.cpp | 2 +- examples/09.Meshviewer/tutorial.html | 2 +- examples/11.PerPixelLighting/main.cpp | 2 +- examples/11.PerPixelLighting/tutorial.html | 2 +- examples/12.TerrainRendering/main.cpp | 2 +- examples/12.TerrainRendering/tutorial.html | 2 +- examples/16.Quake3MapShader/main.cpp | 2 +- examples/Demo/CDemo.cpp | 2 +- examples/Demo/CDemo.h | 2 +- examples/Demo/CMainMenu.cpp | 2 +- examples/Demo/CMainMenu.h | 2 +- include/IAnimatedMeshSceneNode.h | 2 +- include/IBillboardSceneNode.h | 4 +- include/IBoneSceneNode.h | 8 +- include/ICameraSceneNode.h | 21 +++-- include/IDummyTransformationSceneNode.h | 2 +- include/IEventReceiver.h | 4 +- include/IFileList.h | 2 +- include/IFileSystem.h | 16 ++-- include/IGUIElement.h | 2 +- include/IGUIEnvironment.h | 2 +- include/IImage.h | 2 +- include/IImageLoader.h | 8 +- include/IImageWriter.h | 14 +-- include/ILogger.h | 2 +- include/IMaterialRenderer.h | 8 +- include/IMeshCache.h | 2 +- include/IMeshLoader.h | 4 +- include/IMeshManipulator.h | 2 +- include/IMeshWriter.h | 2 +- include/ISceneManager.h | 2 +- include/ISceneNode.h | 16 ++-- include/IShadowVolumeSceneNode.h | 2 +- include/IrrlichtDevice.h | 2 +- include/aabbox3d.h | 8 +- include/coreutil.h | 2 +- include/dimension2d.h | 5 +- include/fast_atof.h | 46 +++++----- include/heapsort.h | 6 +- source/Irrlicht/C3DSMeshFileLoader.cpp | 2 +- source/Irrlicht/C3DSMeshFileLoader.h | 2 +- source/Irrlicht/CAnimatedMeshSceneNode.cpp | 2 +- source/Irrlicht/CAnimatedMeshSceneNode.h | 2 +- source/Irrlicht/CB3DMeshFileLoader.cpp | 2 +- source/Irrlicht/CB3DMeshFileLoader.h | 2 +- source/Irrlicht/CBSPMeshFileLoader.cpp | 2 +- source/Irrlicht/CBSPMeshFileLoader.h | 2 +- source/Irrlicht/CBillboardSceneNode.cpp | 30 +++---- source/Irrlicht/CBillboardSceneNode.h | 9 +- source/Irrlicht/CCSMLoader.cpp | 2 +- source/Irrlicht/CCSMLoader.h | 2 +- source/Irrlicht/CCameraFPSSceneNode.cpp | 2 +- source/Irrlicht/CCameraFPSSceneNode.h | 2 +- source/Irrlicht/CCameraMayaSceneNode.cpp | 2 +- source/Irrlicht/CCameraMayaSceneNode.h | 2 +- source/Irrlicht/CCameraSceneNode.cpp | 16 ++-- source/Irrlicht/CCameraSceneNode.h | 16 ++-- source/Irrlicht/CColladaFileLoader.cpp | 2 +- source/Irrlicht/CColladaFileLoader.h | 2 +- source/Irrlicht/CCubeSceneNode.cpp | 2 +- source/Irrlicht/CCubeSceneNode.h | 2 +- source/Irrlicht/CD3D8MaterialRenderer.h | 10 +-- source/Irrlicht/CD3D8NormalMapRenderer.cpp | 2 +- source/Irrlicht/CD3D8NormalMapRenderer.h | 2 +- source/Irrlicht/CD3D8ParallaxMapRenderer.cpp | 2 +- source/Irrlicht/CD3D8ParallaxMapRenderer.h | 2 +- .../Irrlicht/CD3D8ShaderMaterialRenderer.cpp | 2 +- source/Irrlicht/CD3D8ShaderMaterialRenderer.h | 2 +- source/Irrlicht/CD3D9MaterialRenderer.h | 10 +-- source/Irrlicht/CD3D9NormalMapRenderer.cpp | 2 +- source/Irrlicht/CD3D9NormalMapRenderer.h | 2 +- source/Irrlicht/CD3D9ParallaxMapRenderer.cpp | 2 +- source/Irrlicht/CD3D9ParallaxMapRenderer.h | 2 +- .../Irrlicht/CD3D9ShaderMaterialRenderer.cpp | 2 +- source/Irrlicht/CD3D9ShaderMaterialRenderer.h | 28 +++--- source/Irrlicht/CDMFLoader.cpp | 2 +- source/Irrlicht/CDMFLoader.h | 2 +- .../Irrlicht/CDummyTransformationSceneNode.h | 2 +- source/Irrlicht/CFileSystem.cpp | 24 ++---- source/Irrlicht/CFileSystem.h | 9 +- source/Irrlicht/CGUIButton.cpp | 2 +- source/Irrlicht/CGUIButton.h | 2 +- source/Irrlicht/CGUICheckBox.cpp | 2 +- source/Irrlicht/CGUICheckBox.h | 2 +- source/Irrlicht/CGUIColorSelectDialog.cpp | 2 +- source/Irrlicht/CGUIColorSelectDialog.h | 2 +- source/Irrlicht/CGUIComboBox.cpp | 2 +- source/Irrlicht/CGUIComboBox.h | 2 +- source/Irrlicht/CGUIContextMenu.cpp | 2 +- source/Irrlicht/CGUIContextMenu.h | 2 +- source/Irrlicht/CGUIEditBox.cpp | 2 +- source/Irrlicht/CGUIEditBox.h | 2 +- source/Irrlicht/CGUIEnvironment.cpp | 4 +- source/Irrlicht/CGUIEnvironment.h | 4 +- source/Irrlicht/CGUIFileOpenDialog.cpp | 2 +- source/Irrlicht/CGUIFileOpenDialog.h | 2 +- source/Irrlicht/CGUIListBox.cpp | 2 +- source/Irrlicht/CGUIListBox.h | 2 +- source/Irrlicht/CGUIMenu.cpp | 2 +- source/Irrlicht/CGUIMenu.h | 2 +- source/Irrlicht/CGUIMeshViewer.cpp | 2 +- source/Irrlicht/CGUIMeshViewer.h | 2 +- source/Irrlicht/CGUIMessageBox.cpp | 2 +- source/Irrlicht/CGUIMessageBox.h | 2 +- source/Irrlicht/CGUIModalScreen.cpp | 2 +- source/Irrlicht/CGUIModalScreen.h | 2 +- source/Irrlicht/CGUIScrollBar.cpp | 2 +- source/Irrlicht/CGUIScrollBar.h | 2 +- source/Irrlicht/CGUISpinBox.cpp | 2 +- source/Irrlicht/CGUISpinBox.h | 2 +- source/Irrlicht/CGUITabControl.cpp | 2 +- source/Irrlicht/CGUITabControl.h | 2 +- source/Irrlicht/CGUIToolBar.cpp | 2 +- source/Irrlicht/CGUIToolBar.h | 2 +- source/Irrlicht/CGUIWindow.cpp | 2 +- source/Irrlicht/CGUIWindow.h | 2 +- source/Irrlicht/CImageLoaderBMP.cpp | 85 ++++++++----------- source/Irrlicht/CImageLoaderBMP.h | 17 ++-- source/Irrlicht/CImageLoaderJPG.cpp | 6 +- source/Irrlicht/CImageLoaderJPG.h | 6 +- source/Irrlicht/CImageLoaderPCX.cpp | 46 +++------- source/Irrlicht/CImageLoaderPCX.h | 13 +-- source/Irrlicht/CImageLoaderPNG.cpp | 37 ++++---- source/Irrlicht/CImageLoaderPNG.h | 15 +--- source/Irrlicht/CImageLoaderPSD.cpp | 37 +++----- source/Irrlicht/CImageLoaderPSD.h | 21 ++--- source/Irrlicht/CImageLoaderTGA.cpp | 22 +---- source/Irrlicht/CImageLoaderTGA.h | 16 +--- source/Irrlicht/CImageWriterBMP.cpp | 4 +- source/Irrlicht/CImageWriterBMP.h | 5 +- source/Irrlicht/CImageWriterJPG.cpp | 4 +- source/Irrlicht/CImageWriterJPG.h | 4 +- source/Irrlicht/CImageWriterPCX.cpp | 5 +- source/Irrlicht/CImageWriterPCX.h | 5 +- source/Irrlicht/CImageWriterPNG.cpp | 9 +- source/Irrlicht/CImageWriterPNG.h | 6 +- source/Irrlicht/CImageWriterPPM.cpp | 4 +- source/Irrlicht/CImageWriterPPM.h | 5 +- source/Irrlicht/CImageWriterPSD.cpp | 4 +- source/Irrlicht/CImageWriterPSD.h | 4 +- source/Irrlicht/CImageWriterTGA.cpp | 4 +- source/Irrlicht/CImageWriterTGA.h | 4 +- source/Irrlicht/CIrrDeviceStub.cpp | 2 +- source/Irrlicht/CIrrDeviceStub.h | 2 +- source/Irrlicht/CIrrMeshFileLoader.cpp | 2 +- source/Irrlicht/CIrrMeshFileLoader.h | 2 +- source/Irrlicht/CLMTSMeshFileLoader.cpp | 47 +++++----- source/Irrlicht/CLMTSMeshFileLoader.h | 3 +- source/Irrlicht/CLogger.cpp | 2 +- source/Irrlicht/CLogger.h | 2 +- source/Irrlicht/CMD2MeshFileLoader.cpp | 2 +- source/Irrlicht/CMD2MeshFileLoader.h | 2 +- source/Irrlicht/CMD3MeshFileLoader.cpp | 2 +- source/Irrlicht/CMD3MeshFileLoader.h | 2 +- source/Irrlicht/CMS3DMeshFileLoader.cpp | 2 +- source/Irrlicht/CMS3DMeshFileLoader.h | 2 +- source/Irrlicht/CMY3DMeshFileLoader.cpp | 2 +- source/Irrlicht/CMY3DMeshFileLoader.h | 2 +- source/Irrlicht/CMeshSceneNode.cpp | 2 +- source/Irrlicht/CMeshSceneNode.h | 2 +- source/Irrlicht/COBJMeshFileLoader.cpp | 2 +- source/Irrlicht/COBJMeshFileLoader.h | 2 +- source/Irrlicht/COCTLoader.cpp | 2 +- source/Irrlicht/COCTLoader.h | 2 +- source/Irrlicht/COctTreeSceneNode.cpp | 2 +- source/Irrlicht/COctTreeSceneNode.h | 2 +- source/Irrlicht/COgreMeshFileLoader.cpp | 2 +- source/Irrlicht/COgreMeshFileLoader.h | 2 +- source/Irrlicht/COpenGLMaterialRenderer.h | 10 +-- source/Irrlicht/COpenGLNormalMapRenderer.cpp | 2 +- source/Irrlicht/COpenGLNormalMapRenderer.h | 2 +- .../Irrlicht/COpenGLParallaxMapRenderer.cpp | 2 +- source/Irrlicht/COpenGLParallaxMapRenderer.h | 2 +- source/Irrlicht/COpenGLSLMaterialRenderer.cpp | 2 +- source/Irrlicht/COpenGLSLMaterialRenderer.h | 2 +- .../COpenGLShaderMaterialRenderer.cpp | 2 +- .../Irrlicht/COpenGLShaderMaterialRenderer.h | 2 +- source/Irrlicht/CParticleSystemSceneNode.cpp | 2 +- source/Irrlicht/CParticleSystemSceneNode.h | 2 +- source/Irrlicht/CQuake3ShaderSceneNode.cpp | 2 +- source/Irrlicht/CQuake3ShaderSceneNode.h | 2 +- source/Irrlicht/CSceneManager.cpp | 2 +- source/Irrlicht/CSceneManager.h | 2 +- source/Irrlicht/CShadowVolumeSceneNode.cpp | 23 +---- source/Irrlicht/CShadowVolumeSceneNode.h | 8 +- source/Irrlicht/CSkyBoxSceneNode.cpp | 2 +- source/Irrlicht/CSkyBoxSceneNode.h | 2 +- source/Irrlicht/CSkyDomeSceneNode.cpp | 2 +- source/Irrlicht/CSkyDomeSceneNode.h | 2 +- source/Irrlicht/CSoftware2MaterialRenderer.h | 10 +-- source/Irrlicht/CSphereSceneNode.cpp | 2 +- source/Irrlicht/CSphereSceneNode.h | 2 +- source/Irrlicht/CTerrainSceneNode.h | 2 +- source/Irrlicht/CTextSceneNode.cpp | 2 +- source/Irrlicht/CTextSceneNode.h | 2 +- source/Irrlicht/CXMeshFileLoader.cpp | 2 +- source/Irrlicht/CXMeshFileLoader.h | 2 +- 201 files changed, 487 insertions(+), 618 deletions(-) diff --git a/examples/04.Movement/main.cpp b/examples/04.Movement/main.cpp index 9d9ce14f..8f19a894 100644 --- a/examples/04.Movement/main.cpp +++ b/examples/04.Movement/main.cpp @@ -36,7 +36,7 @@ We will use this input to move the scene node with the keys W and S. class MyEventReceiver : public IEventReceiver { public: - virtual bool OnEvent(SEvent event) + virtual bool OnEvent(const SEvent& event) { /* If the key 'W' or 'S' was left up, we get the position of the scene node, diff --git a/examples/04.Movement/tutorial.html b/examples/04.Movement/tutorial.html index 365ac18b..28b207dc 100644 --- a/examples/04.Movement/tutorial.html +++ b/examples/04.Movement/tutorial.html @@ -64,7 +64,7 @@ We will use this input to move the scene node with the keys W and S.

- +
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(const SEvent& event)
{

If the key 'W' or 'S' was left up, we get the position of the scene diff --git a/examples/05.UserInterface/main.cpp b/examples/05.UserInterface/main.cpp index 51a47907..62024990 100644 --- a/examples/05.UserInterface/main.cpp +++ b/examples/05.UserInterface/main.cpp @@ -44,7 +44,7 @@ the pointer to the gui environment. class MyEventReceiver : public IEventReceiver { public: - virtual bool OnEvent(SEvent event) + virtual bool OnEvent(const SEvent& event) { if (event.EventType == EET_GUI_EVENT) { diff --git a/examples/05.UserInterface/tutorial.html b/examples/05.UserInterface/tutorial.html index 22b4be7a..e16141ab 100644 --- a/examples/05.UserInterface/tutorial.html +++ b/examples/05.UserInterface/tutorial.html @@ -68,7 +68,7 @@ IGUIListBox* listbox = 0; event) and get the pointer to the gui environment.

- diff --git a/examples/09.Meshviewer/main.cpp b/examples/09.Meshviewer/main.cpp index 556560bb..dd0020ec 100644 --- a/examples/09.Meshviewer/main.cpp +++ b/examples/09.Meshviewer/main.cpp @@ -188,7 +188,7 @@ void createToolBox() class MyEventReceiver : public IEventReceiver { public: - virtual bool OnEvent(SEvent event) + virtual bool OnEvent(const SEvent& event) { // Escape swaps Camera Input if (event.EventType == EET_KEY_INPUT_EVENT && diff --git a/examples/09.Meshviewer/tutorial.html b/examples/09.Meshviewer/tutorial.html index 4586410f..5475af21 100644 --- a/examples/09.Meshviewer/tutorial.html +++ b/examples/09.Meshviewer/tutorial.html @@ -84,7 +84,7 @@
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
+
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
            switch(event.GUIEvent.EventType)
             {
- +
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = Device->getGUIEnvironment();
switch(event.GUIEvent.EventType)
{
case EGET_MENU_ITEM_SELECTED:
{
// a menu item was clicked
IGUIContextMenu* menu = (IGUIContextMenu*)event.GUIEvent.Caller;
s32 id = menu->getItemCommandId(menu->getSelectedItem());

switch(id)
{
case 100: // File -> Open Model
env->addFileOpenDialog(L"Please select a model file to open");
break;
case 200: // File -> Quit
Device->closeDevice();
break;
case 300: // View -> Skybox
SkyBox->setVisible(!SkyBox->isVisible());
break;
case 400: // View -> Debug Information
if (Model)
Model->setDebugDataVisible(!Model->isDebugDataVisible());
break;
case 500: // Help->About
showAboutText();
break;
case 610: // View -> Material -> Solid
if (Model)
Model->setMaterialType(video::EMT_SOLID);
break;
case 620: // View -> Material -> Transparent
if (Model)
Model->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
break;
case 630: // View -> Material -> Reflection
if (Model)
Model->setMaterialType(video::EMT_SPHERE_MAP);
break;
}
break;
}
case EGET_FILE_SELECTED:
{
// load the model file, selected in the file open dialog
IGUIFileOpenDialog* dialog =
(IGUIFileOpenDialog*)event.GUIEvent.Caller;
loadModel(core::stringc(dialog->getFilename()).c_str());
}
case EGET_BUTTON_CLICKED:
switch(id)
{
case 1101:
{
// set scale
gui::IGUIElement* root = env->getRootGUIElement();
core::vector3df scale;
core::stringc s;
s = root->getElementFromId(901, true)->getText();
scale.X = (f32)atof(s.c_str());
s = root->getElementFromId(902, true)->getText();
scale.Y = (f32)atof(s.c_str());
s = root->getElementFromId(903, true)->getText();
scale.Z = (f32)atof(s.c_str());
if (Model)
Model->setScale(scale);
}
break;
case 1102:
env->addFileOpenDialog(L"Please select a model file to open");
break;
case 1103:
showAboutText();
break;
case 1104:
createToolBox();
break;
}
break;
}
}
return false;
}
};
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = Device->getGUIEnvironment();
switch(event.GUIEvent.EventType)
{
case EGET_MENU_ITEM_SELECTED:
{
// a menu item was clicked
IGUIContextMenu* menu = (IGUIContextMenu*)event.GUIEvent.Caller;
s32 id = menu->getItemCommandId(menu->getSelectedItem());

switch(id)
{
case 100: // File -> Open Model
env->addFileOpenDialog(L"Please select a model file to open");
break;
case 200: // File -> Quit
Device->closeDevice();
break;
case 300: // View -> Skybox
SkyBox->setVisible(!SkyBox->isVisible());
break;
case 400: // View -> Debug Information
if (Model)
Model->setDebugDataVisible(!Model->isDebugDataVisible());
break;
case 500: // Help->About
showAboutText();
break;
case 610: // View -> Material -> Solid
if (Model)
Model->setMaterialType(video::EMT_SOLID);
break;
case 620: // View -> Material -> Transparent
if (Model)
Model->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
break;
case 630: // View -> Material -> Reflection
if (Model)
Model->setMaterialType(video::EMT_SPHERE_MAP);
break;
}
break;
}
case EGET_FILE_SELECTED:
{
// load the model file, selected in the file open dialog
IGUIFileOpenDialog* dialog =
(IGUIFileOpenDialog*)event.GUIEvent.Caller;
loadModel(core::stringc(dialog->getFilename()).c_str());
}
case EGET_BUTTON_CLICKED:
switch(id)
{
case 1101:
{
// set scale
gui::IGUIElement* root = env->getRootGUIElement();
core::vector3df scale;
core::stringc s;
s = root->getElementFromId(901, true)->getText();
scale.X = (f32)atof(s.c_str());
s = root->getElementFromId(902, true)->getText();
scale.Y = (f32)atof(s.c_str());
s = root->getElementFromId(903, true)->getText();
scale.Z = (f32)atof(s.c_str());
if (Model)
Model->setScale(scale);
}
break;
case 1102:
env->addFileOpenDialog(L"Please select a model file to open");
break;
case 1103:
showAboutText();
break;
case 1104:
createToolBox();
break;
}
break;
}
}
return false;
}
};

Most of the hard work is done. We only need to create the Irrlicht diff --git a/examples/11.PerPixelLighting/main.cpp b/examples/11.PerPixelLighting/main.cpp index 14ffab5b..39ad1316 100644 --- a/examples/11.PerPixelLighting/main.cpp +++ b/examples/11.PerPixelLighting/main.cpp @@ -70,7 +70,7 @@ public: setMaterial(); } - bool OnEvent(SEvent event) + bool OnEvent(const SEvent& event) { // check if user presses the key 'E' or 'R' if (event.EventType == irr::EET_KEY_INPUT_EVENT && diff --git a/examples/11.PerPixelLighting/tutorial.html b/examples/11.PerPixelLighting/tutorial.html index 57c3981c..89e87bd8 100644 --- a/examples/11.PerPixelLighting/tutorial.html +++ b/examples/11.PerPixelLighting/tutorial.html @@ -99,7 +99,7 @@ public: setMaterial(); } - bool OnEvent(SEvent event) + bool OnEvent(const SEvent& event) { // check if user presses the key 'E' or 'R' if (event.EventType == irr::EET_KEY_INPUT_EVENT && diff --git a/examples/12.TerrainRendering/main.cpp b/examples/12.TerrainRendering/main.cpp index 90198837..8ac33f4f 100644 --- a/examples/12.TerrainRendering/main.cpp +++ b/examples/12.TerrainRendering/main.cpp @@ -29,7 +29,7 @@ public: Terrain = terrain; } - bool OnEvent(SEvent event) + bool OnEvent(const SEvent& event) { // check if user presses the key 'W' or 'D' if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown) diff --git a/examples/12.TerrainRendering/tutorial.html b/examples/12.TerrainRendering/tutorial.html index 64310059..736cb662 100644 --- a/examples/12.TerrainRendering/tutorial.html +++ b/examples/12.TerrainRendering/tutorial.html @@ -45,7 +45,7 @@ we toggle to material between solid and detail mapped.

- +
#include <irrlicht.h>
#include <iostream>
using namespace irr;

#pragma comment(lib, "Irrlicht.lib")

class MyEventReceiver : public IEventReceiver
{
public:
MyEventReceiver(scene::ISceneNode* terrain)
{
// store pointer to terrain so we can change its drawing mode
Terrain = terrain;
}

bool OnEvent(SEvent event)
{
// check if user presses the key 'W' or 'D'
if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
{
switch (event.KeyInput.Key)
{
case irr::KEY_KEY_W: // switch wire frame mode
Terrain->setMaterialFlag(video::EMF_WIREFRAME, !Terrain->getMaterial(0).Wireframe);
return true;
case irr::KEY_KEY_D: // toggle detail map
Terrain->setMaterialType(
Terrain->getMaterial(0).MaterialType == video::EMT_SOLID ?
video::EMT_DETAIL_MAP : video::EMT_SOLID);
return true;
}
}
return false;
}

private:
scene::ISceneNode* Terrain;
};

#include <irrlicht.h>
#include <iostream>
using namespace irr;

#pragma comment(lib, "Irrlicht.lib")

class MyEventReceiver : public IEventReceiver
{
public:
MyEventReceiver(scene::ISceneNode* terrain)
{
// store pointer to terrain so we can change its drawing mode
Terrain = terrain;
}

bool OnEvent(const SEvent& event)
{
// check if user presses the key 'W' or 'D'
if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
{
switch (event.KeyInput.Key)
{
case irr::KEY_KEY_W: // switch wire frame mode
Terrain->setMaterialFlag(video::EMF_WIREFRAME, !Terrain->getMaterial(0).Wireframe);
return true;
case irr::KEY_KEY_D: // toggle detail map
Terrain->setMaterialType(
Terrain->getMaterial(0).MaterialType == video::EMT_SOLID ?
video::EMT_DETAIL_MAP : video::EMT_SOLID);
return true;
}
}
return false;
}

private:
scene::ISceneNode* Terrain;
};

The start of the main function starts like in most other example. diff --git a/examples/16.Quake3MapShader/main.cpp b/examples/16.Quake3MapShader/main.cpp index 1cc4345f..3095c484 100644 --- a/examples/16.Quake3MapShader/main.cpp +++ b/examples/16.Quake3MapShader/main.cpp @@ -52,7 +52,7 @@ public: FilenameTemplate = templateName; } - bool OnEvent(SEvent event) + bool OnEvent(const SEvent& event) { // check if user presses the key F9 if (event.EventType == EET_KEY_INPUT_EVENT && diff --git a/examples/Demo/CDemo.cpp b/examples/Demo/CDemo.cpp index 9b221281..fbd5517f 100644 --- a/examples/Demo/CDemo.cpp +++ b/examples/Demo/CDemo.cpp @@ -116,7 +116,7 @@ void CDemo::run() } -bool CDemo::OnEvent(SEvent event) +bool CDemo::OnEvent(const SEvent& event) { if (!device) return false; diff --git a/examples/Demo/CDemo.h b/examples/Demo/CDemo.h index ba9c514c..968e7b3e 100644 --- a/examples/Demo/CDemo.h +++ b/examples/Demo/CDemo.h @@ -42,7 +42,7 @@ public: void run(); - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); private: diff --git a/examples/Demo/CMainMenu.cpp b/examples/Demo/CMainMenu.cpp index 9d7e1618..20b978ca 100644 --- a/examples/Demo/CMainMenu.cpp +++ b/examples/Demo/CMainMenu.cpp @@ -317,7 +317,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows, -bool CMainMenu::OnEvent(SEvent event) +bool CMainMenu::OnEvent(const SEvent& event) { if (event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.Key == KEY_F9 && diff --git a/examples/Demo/CMainMenu.h b/examples/Demo/CMainMenu.h index 918e93e4..2b2d8368 100644 --- a/examples/Demo/CMainMenu.h +++ b/examples/Demo/CMainMenu.h @@ -17,7 +17,7 @@ public: bool run(bool& outFullscreen, bool& outMusic, bool& outShadows, bool& outAdditive, bool &outVSync, video::E_DRIVER_TYPE& outDriver); - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); private: diff --git a/include/IAnimatedMeshSceneNode.h b/include/IAnimatedMeshSceneNode.h index 2535b66e..f6d609fd 100644 --- a/include/IAnimatedMeshSceneNode.h +++ b/include/IAnimatedMeshSceneNode.h @@ -48,7 +48,7 @@ namespace scene : ISceneNode(parent, mgr, id, position, rotation, scale) {} //! Destructor - virtual ~IAnimatedMeshSceneNode() {}; + virtual ~IAnimatedMeshSceneNode() {} //! Sets the current frame number. //! From now on the animation is played from this frame. diff --git a/include/IBillboardSceneNode.h b/include/IBillboardSceneNode.h index 2fce0903..80cd37a7 100644 --- a/include/IBillboardSceneNode.h +++ b/include/IBillboardSceneNode.h @@ -30,7 +30,7 @@ public: virtual void setSize(const core::dimension2d& size) = 0; //! Returns the size of the billboard. - virtual const core::dimension2d& getSize() = 0; + virtual const core::dimension2d& getSize() const = 0; //! Set the color of all vertices of the billboard //! \param overallColor: the color to set @@ -44,7 +44,7 @@ public: //! Gets the color of the top and bottom vertices of the billboard //! \param topColor: stores the color of the top vertices //! \param bottomColor: stores the color of the bottom vertices - virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) = 0; + virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0; }; diff --git a/include/IBoneSceneNode.h b/include/IBoneSceneNode.h index b46a4e0f..3cd67739 100644 --- a/include/IBoneSceneNode.h +++ b/include/IBoneSceneNode.h @@ -66,25 +66,23 @@ namespace scene virtual void OnAnimate(u32 timeMs) =0; //! Does nothing as bones are not visible - virtual void render() { }; + virtual void render() { } - virtual void setAbsoluteTransformation(core::matrix4 transformation) + virtual void setAbsoluteTransformation(const core::matrix4& transformation) { AbsoluteTransformation=transformation; } - - //! updates the absolute position based on the relative and the parents position virtual void updateAbsolutePositionOfAllChildren()=0; - s32 positionHint; s32 scaleHint; s32 rotationHint; }; + } // end namespace scene } // end namespace irr diff --git a/include/ICameraSceneNode.h b/include/ICameraSceneNode.h index fd587bee..8db14186 100644 --- a/include/ICameraSceneNode.h +++ b/include/ICameraSceneNode.h @@ -32,7 +32,7 @@ namespace scene : ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {} //! Destructor - virtual ~ICameraSceneNode() {}; + virtual ~ICameraSceneNode() {} //! Sets the projection matrix of the camera. /** The core::matrix4 class has some methods @@ -44,11 +44,11 @@ namespace scene //! Gets the current projection matrix of the camera. /** \return Returns the current projection matrix of the camera. */ - virtual const core::matrix4& getProjectionMatrix() = 0; + virtual const core::matrix4& getProjectionMatrix() const = 0; //! Gets the current view matrix of the camera. /** \return Returns the current view matrix of the camera. */ - virtual const core::matrix4& getViewMatrix() = 0; + virtual const core::matrix4& getViewMatrix() const = 0; //! It is possible to send mouse and key events to the camera. /** Most cameras @@ -56,7 +56,7 @@ namespace scene example with ISceneManager::addMayaCameraSceneNode or ISceneManager::addMeshViewerCameraSceneNode, may want to get this input for changing their position, look at target or whatever. */ - virtual bool OnEvent(SEvent event) = 0; + virtual bool OnEvent(const SEvent& event) = 0; //! Sets the look at target of the camera /** \param pos: Look at target of the camera. */ @@ -76,19 +76,19 @@ namespace scene //! Gets the value of the near plane of the camera. /** \return Returns the value of the near plane of the camera. */ - virtual f32 getNearValue() = 0; + virtual f32 getNearValue() const = 0; //! Gets the value of the far plane of the camera. /** \return Returns the value of the far plane of the camera. */ - virtual f32 getFarValue() = 0; + virtual f32 getFarValue() const = 0; //! Gets the aspect ratio of the camera. /** \return Returns the aspect ratio of the camera. */ - virtual f32 getAspectRatio() = 0; + virtual f32 getAspectRatio() const = 0; //! Gets the field of view of the camera. /** \return Returns the field of view of the camera in radiants. */ - virtual f32 getFOV() = 0; + virtual f32 getFOV() const = 0; //! Sets the value of the near clipping plane. (default: 1.0f) /** \param zn: New z near value. */ @@ -117,12 +117,12 @@ namespace scene virtual void setInputReceiverEnabled(bool enabled) = 0; //! Returns if the input receiver of the camera is currently enabled. - virtual bool isInputReceiverEnabled() = 0; + virtual bool isInputReceiverEnabled() const = 0; //! Returns if a camera is orthogonal. /** This setting does not change anything of the view or projection matrix. However it influences how collision detection and picking is done with this camera. */ - virtual bool isOrthogonal() + virtual bool isOrthogonal() const { _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; return IsOrthogonal; @@ -136,7 +136,6 @@ namespace scene IsOrthogonal = orthogonal; } - private: bool IsOrthogonal; diff --git a/include/IDummyTransformationSceneNode.h b/include/IDummyTransformationSceneNode.h index 3a140c53..e5846a88 100644 --- a/include/IDummyTransformationSceneNode.h +++ b/include/IDummyTransformationSceneNode.h @@ -28,7 +28,7 @@ public: IDummyTransformationSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id) : ISceneNode(parent, mgr, id) {} - //! Returns a reference to the current relative transformation matrix. + //! Returns a reference to the current relative transformation matrix. //! This is the matrix, this scene node uses instead of scale, translation //! and rotation. virtual core::matrix4& getRelativeTransformationMatrix() = 0; diff --git a/include/IEventReceiver.h b/include/IEventReceiver.h index 37e3f886..fce37f91 100644 --- a/include/IEventReceiver.h +++ b/include/IEventReceiver.h @@ -249,11 +249,11 @@ class IEventReceiver { public: - virtual ~IEventReceiver() {}; + virtual ~IEventReceiver() {} //! called if an event happened. //! \return Returns true if the event was processed - virtual bool OnEvent(SEvent event) = 0; + virtual bool OnEvent(const SEvent& event) = 0; }; diff --git a/include/IFileList.h b/include/IFileList.h index 7c4c1a1f..049ce1d6 100644 --- a/include/IFileList.h +++ b/include/IFileList.h @@ -18,7 +18,7 @@ class IFileList : public virtual IReferenceCounted public: //! destructor - virtual ~IFileList() {}; + virtual ~IFileList() {} //! Returns the amount of files in the filelist. //! \return diff --git a/include/IFileSystem.h b/include/IFileSystem.h index cbdc8499..a4ba2f31 100644 --- a/include/IFileSystem.h +++ b/include/IFileSystem.h @@ -36,7 +36,7 @@ class IFileSystem : public virtual IReferenceCounted public: //! destructor - virtual ~IFileSystem() {}; + virtual ~IFileSystem() {} //! Opens a file for read access. /** \param filename: Name of file to open. @@ -113,22 +113,22 @@ public: virtual bool changeWorkingDirectoryTo(const c8* newDirectory) = 0; //! Converts a relative path to an absolute (unique) path, resolving symbolic links if required - virtual irr::core::stringc getAbsolutePath(irr::core::stringc &filename) = 0; + virtual core::stringc getAbsolutePath(const core::stringc& filename) const = 0; //! Returns the directory a file is located in. /** \param filename: The file to get the directory from */ - virtual irr::core::stringc getFileDir(irr::core::stringc &filename) = 0; + virtual core::stringc getFileDir(const core::stringc& filename) 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() = 0; + virtual IFileList* createFileList() const = 0; - //! Determinates if a file exists and would be able to be opened. - /** \param filename is the string identifying the file which should be tested for existance. - \return Returns true if file exsits, and false if it does not exist or an error occured. */ - virtual bool existFile(const c8* filename) = 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; //! 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 diff --git a/include/IGUIElement.h b/include/IGUIElement.h index 05672274..f9ddb48d 100644 --- a/include/IGUIElement.h +++ b/include/IGUIElement.h @@ -632,7 +632,7 @@ public: //! Called if an event happened. - virtual bool OnEvent(SEvent event) + virtual bool OnEvent(const SEvent& event) { return Parent ? Parent->OnEvent(event) : false; } diff --git a/include/IGUIEnvironment.h b/include/IGUIEnvironment.h index 9997a303..6c345389 100644 --- a/include/IGUIEnvironment.h +++ b/include/IGUIEnvironment.h @@ -100,7 +100,7 @@ public: //! Posts an input event to the environment. /** Usually you do not have to use this method, it is used by the internal engine. */ - virtual bool postEventFromUser(SEvent event) = 0; + virtual bool postEventFromUser(const SEvent& event) = 0; //! This sets a new event receiver for gui events. /** Usually you do not have to diff --git a/include/IImage.h b/include/IImage.h index 89dbc3fe..7167656a 100644 --- a/include/IImage.h +++ b/include/IImage.h @@ -44,7 +44,7 @@ class IImage : public virtual IReferenceCounted public: //! destructor - virtual ~IImage() {}; + virtual ~IImage() {} //! Lock function. Use this to get a pointer to the image data. After you //! don't need the pointer anymore, you must call unlock(). diff --git a/include/IImageLoader.h b/include/IImageLoader.h index baa8d9ef..6437cf63 100644 --- a/include/IImageLoader.h +++ b/include/IImageLoader.h @@ -27,17 +27,17 @@ class IImageLoader : public virtual IReferenceCounted public: //! destructor - virtual ~IImageLoader() {}; + virtual ~IImageLoader() {} //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") - virtual bool isALoadableFileExtension(const c8* fileName) = 0; + virtual bool isALoadableFileExtension(const c8* fileName) const = 0; //! returns true if the file maybe is able to be loaded by this class - virtual bool isALoadableFileFormat(irr::io::IReadFile* file) = 0; + virtual bool isALoadableFileFormat(irr::io::IReadFile* file) const = 0; //! creates a surface from the file - virtual IImage* loadImage(irr::io::IReadFile* file) = 0; + virtual IImage* loadImage(irr::io::IReadFile* file) const = 0; }; diff --git a/include/IImageWriter.h b/include/IImageWriter.h index e5fd2564..081b8350 100644 --- a/include/IImageWriter.h +++ b/include/IImageWriter.h @@ -19,24 +19,18 @@ namespace video class IImageWriter : public IReferenceCounted { public: - //! constructor - IImageWriter() - { - } - //! destructor - virtual ~IImageWriter() - { - }; + virtual ~IImageWriter() { } //! return true if this writer can write a file with the given extension - virtual bool isAWriteableFileExtension(const c8* fileName) = 0; + virtual bool isAWriteableFileExtension(const c8* fileName) const = 0; //! write image to file - virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param = 0) = 0; + virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param = 0) const = 0; }; } // namespace video } // namespace irr #endif // _I_IMAGE_WRITER_H_INCLUDED__ + diff --git a/include/ILogger.h b/include/ILogger.h index 8d86f94f..1aefb30c 100644 --- a/include/ILogger.h +++ b/include/ILogger.h @@ -36,7 +36,7 @@ public: virtual ~ILogger() {} //! Returns the current set log level. - virtual ELOG_LEVEL getLogLevel() = 0; + virtual ELOG_LEVEL getLogLevel() const = 0; //! Sets a new log level. With this value, texts which are sent to //! the logger are filtered out. For example setting this value to diff --git a/include/IMaterialRenderer.h b/include/IMaterialRenderer.h index 87229ffb..403c4089 100644 --- a/include/IMaterialRenderer.h +++ b/include/IMaterialRenderer.h @@ -26,7 +26,7 @@ class IMaterialRenderer : public virtual IReferenceCounted public: //! destructor - virtual ~IMaterialRenderer() {}; + virtual ~IMaterialRenderer() {} //! Called by the IVideoDriver implementation the let the renderer set its needed render states. /** This is called during the IVideoDriver::setMaterial() call. @@ -69,12 +69,12 @@ public: /** Called during the IVideoDriver::setMaterial() call before the new material will get the OnSetMaterial() call. */ - virtual void OnUnsetMaterial() {}; + virtual void OnUnsetMaterial() {} //! Returns if the material is transparent. /** The scene managment needs to know this for being able to sort the materials by opaque and transparent. */ - virtual bool isTransparent() { return false; } + virtual bool isTransparent() const { return false; } //! Returns the render capability of the material. /** Because some more complex materials @@ -86,7 +86,7 @@ public: it cannot use the latest shaders. More specific examples: Fixed function pipeline materials should return 0 in most cases, parallax mapped material will only return 0 when at least pixel shader 1.4 is available on that machine. */ - virtual s32 getRenderCapability() { return 0; } + virtual s32 getRenderCapability() const { return 0; } }; diff --git a/include/IMeshCache.h b/include/IMeshCache.h index d5204838..1953e594 100644 --- a/include/IMeshCache.h +++ b/include/IMeshCache.h @@ -29,7 +29,7 @@ namespace scene public: //! destructor - virtual ~IMeshCache() {}; + virtual ~IMeshCache() {} //! Adds a mesh to the internal list of loaded meshes. /** Usually, ISceneManager::getMesh() is called to load a mesh from a file. diff --git a/include/IMeshLoader.h b/include/IMeshLoader.h index 5048cf2c..27413aaf 100644 --- a/include/IMeshLoader.h +++ b/include/IMeshLoader.h @@ -27,11 +27,11 @@ class IMeshLoader : public virtual IReferenceCounted public: //! destructor - virtual ~IMeshLoader() {}; + virtual ~IMeshLoader() {} //! Returns true if the file maybe is able to be loaded by this class. /** This decision should be based only on the file extension (e.g. ".cob") */ - virtual bool isALoadableFileExtension(const c8* fileName) = 0; + virtual bool isALoadableFileExtension(const c8* fileName) const = 0; //! Creates/loads an animated mesh from the file. /** \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/include/IMeshManipulator.h b/include/IMeshManipulator.h index 4942bd33..22939866 100644 --- a/include/IMeshManipulator.h +++ b/include/IMeshManipulator.h @@ -31,7 +31,7 @@ namespace scene public: //! destructor - virtual ~IMeshManipulator() {}; + virtual ~IMeshManipulator() {} //! Flips the direction of surfaces. /** Changes backfacing triangles to frontfacing diff --git a/include/IMeshWriter.h b/include/IMeshWriter.h index e652e32a..523b3637 100644 --- a/include/IMeshWriter.h +++ b/include/IMeshWriter.h @@ -44,7 +44,7 @@ namespace scene { public: - virtual ~IMeshWriter() {}; + virtual ~IMeshWriter() {} //! Returns the type of the mesh writer /** For own implementations, use MAKE_IRR_ID as shown in the EMESH_WRITER_TYPE diff --git a/include/ISceneManager.h b/include/ISceneManager.h index b8d64dc9..3144dd4e 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -1100,7 +1100,7 @@ namespace scene //! Posts an input event to the environment. /** Usually you do not have to use this method, it is used by the internal engine. */ - virtual bool postEventFromUser(SEvent event) = 0; + virtual bool postEventFromUser(const SEvent& event) = 0; //! Clears the whole scene. /** All scene nodes are removed. */ diff --git a/include/ISceneNode.h b/include/ISceneNode.h index 6d220ce4..2d33ad8d 100644 --- a/include/ISceneNode.h +++ b/include/ISceneNode.h @@ -35,10 +35,10 @@ namespace scene public: //! Constructor - ISceneNode( ISceneNode* parent, ISceneManager* mgr, s32 id=-1, - const core::vector3df& position = core::vector3df(0,0,0), - const core::vector3df& rotation = core::vector3df(0,0,0), - const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) + ISceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1, + const core::vector3df& position = core::vector3df(0,0,0), + const core::vector3df& rotation = core::vector3df(0,0,0), + const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) : RelativeTranslation(position), RelativeRotation(rotation), RelativeScale(scale), Parent(parent), ID(id), SceneManager(mgr), TriangleSelector(0), AutomaticCullingState(EAC_BOX), IsVisible(true), @@ -51,7 +51,6 @@ namespace scene } - //! Destructor virtual ~ISceneNode() { @@ -332,7 +331,7 @@ namespace scene //! Returns amount of materials used by this scene node. //! \return Returns current count of materials used by this scene node. - virtual u32 getMaterialCount() + virtual u32 getMaterialCount() const { return 0; } @@ -356,7 +355,7 @@ namespace scene //! \param texture: Texture to be used. void setMaterialTexture(u32 textureLayer, video::ITexture* texture) { - if (textureLayer>= video::MATERIAL_MAX_TEXTURES) + if (textureLayer >= video::MATERIAL_MAX_TEXTURES) return; for (u32 i=0; igrab(); } + //! updates the absolute position based on the relative and the parents position virtual void updateAbsolutePosition() { diff --git a/include/IShadowVolumeSceneNode.h b/include/IShadowVolumeSceneNode.h index ad6d6e3f..2143c182 100644 --- a/include/IShadowVolumeSceneNode.h +++ b/include/IShadowVolumeSceneNode.h @@ -23,7 +23,7 @@ namespace scene : ISceneNode(parent, mgr, id) {} //! sets the mesh from which the shadow volume should be generated. - virtual void setMeshToRenderFrom(IMesh* mesh) = 0; + virtual void setMeshToRenderFrom(const IMesh* mesh) = 0; }; } // end namespace scene diff --git a/include/IrrlichtDevice.h b/include/IrrlichtDevice.h index 14d2c419..f63e2fee 100644 --- a/include/IrrlichtDevice.h +++ b/include/IrrlichtDevice.h @@ -166,7 +166,7 @@ while(device->run()) input library for example for doing joystick input, you can use this to post key or mouse input events to the engine. Internally, this method only delegates the events further to the scene manager and the GUI environment. */ - virtual void postEventFromUser(SEvent event) = 0; + virtual void postEventFromUser(const SEvent& event) = 0; //! Sets the input receiving scene manager. /** If set to null, the main scene manager (returned by GetSceneManager()) will receive the input */ diff --git a/include/aabbox3d.h b/include/aabbox3d.h index 78ac83cc..2827badb 100644 --- a/include/aabbox3d.h +++ b/include/aabbox3d.h @@ -24,10 +24,10 @@ class aabbox3d // Constructors - aabbox3d(): MinEdge(-1,-1,-1), MaxEdge(1,1,1) {}; - aabbox3d(const vector3d& min, const vector3d& max): MinEdge(min), MaxEdge(max) {}; - aabbox3d(const vector3d& init): MinEdge(init), MaxEdge(init) {}; - aabbox3d(T minx, T miny, T minz, T maxx, T maxy, T maxz): MinEdge(minx, miny, minz), MaxEdge(maxx, maxy, maxz) {}; + aabbox3d(): MinEdge(-1,-1,-1), MaxEdge(1,1,1) {} + aabbox3d(const vector3d& min, const vector3d& max): MinEdge(min), MaxEdge(max) {} + aabbox3d(const vector3d& init): MinEdge(init), MaxEdge(init) {} + aabbox3d(T minx, T miny, T minz, T maxx, T maxy, T maxz): MinEdge(minx, miny, minz), MaxEdge(maxx, maxy, maxz) {} // operators diff --git a/include/coreutil.h b/include/coreutil.h index 14aefb7a..b2ba7a06 100644 --- a/include/coreutil.h +++ b/include/coreutil.h @@ -16,7 +16,7 @@ namespace core \brief File containing useful basic utility functions */ -// ----------------------------- some basic quite often used string functions -------------------------- +// ----------- some basic quite often used string functions ----------------- static const stringc irrEmtpyStringc = ""; diff --git a/include/dimension2d.h b/include/dimension2d.h index 9745ac55..3f8228d9 100644 --- a/include/dimension2d.h +++ b/include/dimension2d.h @@ -17,11 +17,10 @@ namespace core class dimension2d { public: - dimension2d() - : Width(0), Height(0) {}; + dimension2d() : Width(0), Height(0) {} dimension2d(const T& width, const T& height) - : Width(width), Height(height) {}; + : Width(width), Height(height) {} bool operator == (const dimension2d& other) const { diff --git a/include/fast_atof.h b/include/fast_atof.h index 4a12170b..ff1977b3 100644 --- a/include/fast_atof.h +++ b/include/fast_atof.h @@ -14,36 +14,34 @@ namespace core { const float fast_atof_table[16] = { // we write [16] here instead of [] to work around a swig bug - 0.f, - 0.1f, - 0.01f, - 0.001f, - 0.0001f, - 0.00001f, - 0.000001f, - 0.0000001f, - 0.00000001f, - 0.000000001f, - 0.0000000001f, - 0.00000000001f, - 0.000000000001f, - 0.0000000000001f, - 0.00000000000001f, - 0.000000000000001f - }; + 0.f, + 0.1f, + 0.01f, + 0.001f, + 0.0001f, + 0.00001f, + 0.000001f, + 0.0000001f, + 0.00000001f, + 0.000000001f, + 0.0000000001f, + 0.00000000001f, + 0.000000000001f, + 0.0000000000001f, + 0.00000000000001f, + 0.000000000000001f +}; inline u32 strtol10(const char* in, const char** out=0) { u32 value = 0; - c8 symbol; while ( 1 ) { - symbol = *in; - if ( symbol < '0' || symbol > '9' ) + if ( *in < '0' || *in > '9' ) break; - value = ( value * 10 ) + ( symbol - '0' ); + value = ( value * 10 ) + ( *in - '0' ); ++in; } if (out) @@ -62,7 +60,7 @@ inline const char* fast_atof_move( const char* c, float& out) if (*c=='-') { - c++; + ++c; inv = true; } @@ -71,7 +69,7 @@ inline const char* fast_atof_move( const char* c, float& out) if (*c == '.') { - c++; + ++c; //float pl = (float)strtol(c, &t, 10); float pl = (float) strtol10 ( c, &t ); @@ -87,7 +85,7 @@ inline const char* fast_atof_move( const char* c, float& out) //float exp = (float)strtol(c, &t, 10); bool einv = (*c=='-'); if (einv) - c++; + ++c; float exp = (float)strtol10(c, &c); if (einv) diff --git a/include/heapsort.h b/include/heapsort.h index 507ebce3..b3463649 100644 --- a/include/heapsort.h +++ b/include/heapsort.h @@ -21,11 +21,11 @@ inline void heapsink(T*array, s32 element, s32 max) s32 j = (element<<1); if (j+1 < max && array[j] < array[j+1]) - j = j+1; // take right child + j = j+1; // take right child if (array[element] < array[j]) { - T t = array[j]; // swap elements + T t = array[j]; // swap elements array[j] = array[element]; array[element] = t; element = j; @@ -67,7 +67,5 @@ inline void heapsort(T* array_, s32 size) } // end namespace core } // end namespace irr - - #endif diff --git a/source/Irrlicht/C3DSMeshFileLoader.cpp b/source/Irrlicht/C3DSMeshFileLoader.cpp index e0bec08d..c7e17993 100644 --- a/source/Irrlicht/C3DSMeshFileLoader.cpp +++ b/source/Irrlicht/C3DSMeshFileLoader.cpp @@ -135,7 +135,7 @@ C3DSMeshFileLoader::~C3DSMeshFileLoader() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool C3DSMeshFileLoader::isALoadableFileExtension(const c8* filename) +bool C3DSMeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".3ds")!=0; } diff --git a/source/Irrlicht/C3DSMeshFileLoader.h b/source/Irrlicht/C3DSMeshFileLoader.h index 8be52221..60e2a2c5 100644 --- a/source/Irrlicht/C3DSMeshFileLoader.h +++ b/source/Irrlicht/C3DSMeshFileLoader.h @@ -31,7 +31,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); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.cpp b/source/Irrlicht/CAnimatedMeshSceneNode.cpp index 5980acd1..1ed3115b 100644 --- a/source/Irrlicht/CAnimatedMeshSceneNode.cpp +++ b/source/Irrlicht/CAnimatedMeshSceneNode.cpp @@ -546,7 +546,7 @@ video::SMaterial& CAnimatedMeshSceneNode::getMaterial(u32 i) //! returns amount of materials used by this scene node. -u32 CAnimatedMeshSceneNode::getMaterialCount() +u32 CAnimatedMeshSceneNode::getMaterialCount() const { return Materials.size(); } diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.h b/source/Irrlicht/CAnimatedMeshSceneNode.h index f0e6d005..d78833f1 100644 --- a/source/Irrlicht/CAnimatedMeshSceneNode.h +++ b/source/Irrlicht/CAnimatedMeshSceneNode.h @@ -68,7 +68,7 @@ namespace scene virtual video::SMaterial& getMaterial(u32 i); //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! Creates shadow volume scene node as child of this node //! and returns a pointer to it. diff --git a/source/Irrlicht/CB3DMeshFileLoader.cpp b/source/Irrlicht/CB3DMeshFileLoader.cpp index 0b1da701..fa34c833 100644 --- a/source/Irrlicht/CB3DMeshFileLoader.cpp +++ b/source/Irrlicht/CB3DMeshFileLoader.cpp @@ -37,7 +37,7 @@ CB3DMeshFileLoader::~CB3DMeshFileLoader() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool CB3DMeshFileLoader::isALoadableFileExtension(const c8* fileName) +bool CB3DMeshFileLoader::isALoadableFileExtension(const c8* fileName) const { return strstr(fileName, ".b3d") != 0; } diff --git a/source/Irrlicht/CB3DMeshFileLoader.h b/source/Irrlicht/CB3DMeshFileLoader.h index d994ecff..5832faed 100644 --- a/source/Irrlicht/CB3DMeshFileLoader.h +++ b/source/Irrlicht/CB3DMeshFileLoader.h @@ -29,7 +29,7 @@ public: //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CBSPMeshFileLoader.cpp b/source/Irrlicht/CBSPMeshFileLoader.cpp index aa6d0cd5..b20933a3 100644 --- a/source/Irrlicht/CBSPMeshFileLoader.cpp +++ b/source/Irrlicht/CBSPMeshFileLoader.cpp @@ -38,7 +38,7 @@ CBSPMeshFileLoader::~CBSPMeshFileLoader() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool CBSPMeshFileLoader::isALoadableFileExtension(const c8* filename) +bool CBSPMeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".bsp") || strstr(filename, ".shader"); } diff --git a/source/Irrlicht/CBSPMeshFileLoader.h b/source/Irrlicht/CBSPMeshFileLoader.h index 2e1d62e6..302b4f0f 100644 --- a/source/Irrlicht/CBSPMeshFileLoader.h +++ b/source/Irrlicht/CBSPMeshFileLoader.h @@ -28,7 +28,7 @@ public: //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CBillboardSceneNode.cpp b/source/Irrlicht/CBillboardSceneNode.cpp index ffb98d65..8a62358c 100644 --- a/source/Irrlicht/CBillboardSceneNode.cpp +++ b/source/Irrlicht/CBillboardSceneNode.cpp @@ -15,10 +15,9 @@ namespace scene //! constructor CBillboardSceneNode::CBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, - const core::vector3df& position, const core::dimension2d& size, - video::SColor shade_top, video::SColor shade_down - ) -: IBillboardSceneNode(parent, mgr, id, position) + const core::vector3df& position, const core::dimension2d& size, + video::SColor shade_top, video::SColor shade_down) + : IBillboardSceneNode(parent, mgr, id, position) { #ifdef _DEBUG setDebugName("CBillboardSceneNode"); @@ -47,13 +46,6 @@ CBillboardSceneNode::CBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, } - -CBillboardSceneNode::~CBillboardSceneNode() -{ -} - - - //! pre render event void CBillboardSceneNode::OnRegisterSceneNode() { @@ -157,14 +149,14 @@ video::SMaterial& CBillboardSceneNode::getMaterial(u32 i) //! returns amount of materials used by this scene node. -u32 CBillboardSceneNode::getMaterialCount() +u32 CBillboardSceneNode::getMaterialCount() const { return 1; } //! gets the size of the billboard -const core::dimension2d& CBillboardSceneNode::getSize() +const core::dimension2d& CBillboardSceneNode::getSize() const { return Size; } @@ -181,6 +173,7 @@ void CBillboardSceneNode::serializeAttributes(io::IAttributes* out, io::SAttribu out->addColor ("Shade_Down", vertices[0].Color ); } + //! Reads attributes of the scene node. void CBillboardSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) { @@ -194,6 +187,7 @@ void CBillboardSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttrib setSize(Size); } + //! Set the color of all vertices of the billboard //! \param overallColor: the color to set void CBillboardSceneNode::setColor(const video::SColor & overallColor) @@ -202,6 +196,7 @@ void CBillboardSceneNode::setColor(const video::SColor & overallColor) vertices[0].Color = overallColor; } + //! Set the color of the top and bottom vertices of the billboard //! \param topColor: the color to set the top vertices //! \param bottomColor: the color to set the bottom vertices @@ -213,10 +208,11 @@ void CBillboardSceneNode::setColor(const video::SColor & topColor, const video:: vertices[3].Color = bottomColor; } + //! Gets the color of the top and bottom vertices of the billboard //! \param[out] topColor: stores the color of the top vertices //! \param[out] bottomColor: stores the color of the bottom vertices -void CBillboardSceneNode::getColor(video::SColor & topColor, video::SColor & bottomColor) +void CBillboardSceneNode::getColor(video::SColor & topColor, video::SColor & bottomColor) const { bottomColor = vertices[0].Color; topColor = vertices[1].Color; @@ -226,8 +222,10 @@ void CBillboardSceneNode::getColor(video::SColor & topColor, video::SColor & bot //! Creates a clone of this scene node and its children. ISceneNode* CBillboardSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager) { - if (!newParent) newParent = Parent; - if (!newManager) newManager = SceneManager; + if (!newParent) + newParent = Parent; + if (!newManager) + newManager = SceneManager; CBillboardSceneNode* nb = new CBillboardSceneNode(newParent, newManager, ID, RelativeTranslation, Size); diff --git a/source/Irrlicht/CBillboardSceneNode.h b/source/Irrlicht/CBillboardSceneNode.h index 3b14f651..1feb93a5 100644 --- a/source/Irrlicht/CBillboardSceneNode.h +++ b/source/Irrlicht/CBillboardSceneNode.h @@ -24,8 +24,6 @@ public: const core::vector3df& position, const core::dimension2d& size, video::SColor shade_top=video::SColor(0xFFFFFFFF),video::SColor shade_down=video::SColor(0xFFFFFFFF)); - virtual ~CBillboardSceneNode(); - //! pre render event virtual void OnRegisterSceneNode(); @@ -39,12 +37,12 @@ public: virtual void setSize(const core::dimension2d& size); //! gets the size of the billboard - virtual const core::dimension2d& getSize(); + virtual const core::dimension2d& getSize() const; virtual video::SMaterial& getMaterial(u32 i); //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! Set the color of all vertices of the billboard //! \param overallColor: the color to set @@ -58,7 +56,7 @@ public: //! Gets the color of the top and bottom vertices of the billboard //! \param[out] topColor: stores the color of the top vertices //! \param[out] bottomColor: stores the color of the bottom vertices - virtual void getColor(video::SColor & topColor, video::SColor & bottomColor); + virtual void getColor(video::SColor& topColor, video::SColor& bottomColor) const; //! Writes attributes of the scene node. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; @@ -86,6 +84,5 @@ private: } // end namespace scene } // end namespace irr - #endif diff --git a/source/Irrlicht/CCSMLoader.cpp b/source/Irrlicht/CCSMLoader.cpp index 8d634c2f..68e7f198 100644 --- a/source/Irrlicht/CCSMLoader.cpp +++ b/source/Irrlicht/CCSMLoader.cpp @@ -368,7 +368,7 @@ namespace scene //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") - bool CCSMLoader::isALoadableFileExtension(const c8* fileName) + bool CCSMLoader::isALoadableFileExtension(const c8* fileName) const { return strstr(fileName, ".csm")!=0; } diff --git a/source/Irrlicht/CCSMLoader.h b/source/Irrlicht/CCSMLoader.h index e2c60515..ab9f33c3 100644 --- a/source/Irrlicht/CCSMLoader.h +++ b/source/Irrlicht/CCSMLoader.h @@ -60,7 +60,7 @@ namespace scene //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. virtual IAnimatedMesh* createMesh(irr::io::IReadFile* file); diff --git a/source/Irrlicht/CCameraFPSSceneNode.cpp b/source/Irrlicht/CCameraFPSSceneNode.cpp index b8b0ec1d..a3650a59 100644 --- a/source/Irrlicht/CCameraFPSSceneNode.cpp +++ b/source/Irrlicht/CCameraFPSSceneNode.cpp @@ -85,7 +85,7 @@ CCameraFPSSceneNode::~CCameraFPSSceneNode() //! example with scene::ISceneManager::addMayaCameraSceneNode or //! scene::ISceneManager::addFPSCameraSceneNode, may want to get this input //! for changing their position, look at target or whatever. -bool CCameraFPSSceneNode::OnEvent(SEvent event) +bool CCameraFPSSceneNode::OnEvent(const SEvent& event) { if (event.EventType == EET_KEY_INPUT_EVENT) { diff --git a/source/Irrlicht/CCameraFPSSceneNode.h b/source/Irrlicht/CCameraFPSSceneNode.h index edb3e47a..5bd3df7e 100644 --- a/source/Irrlicht/CCameraFPSSceneNode.h +++ b/source/Irrlicht/CCameraFPSSceneNode.h @@ -34,7 +34,7 @@ namespace scene //! example with scene::ISceneManager::addMayaCameraSceneNode or //! scene::ISceneManager::addMeshViewerCameraSceneNode, may want to get this input //! for changing their position, look at target or whatever. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! OnAnimate() is called just before rendering the whole scene. //! nodes may calculate or store animations here, and may do other useful things, diff --git a/source/Irrlicht/CCameraMayaSceneNode.cpp b/source/Irrlicht/CCameraMayaSceneNode.cpp index ab8db345..094b43df 100644 --- a/source/Irrlicht/CCameraMayaSceneNode.cpp +++ b/source/Irrlicht/CCameraMayaSceneNode.cpp @@ -43,7 +43,7 @@ CCameraMayaSceneNode::~CCameraMayaSceneNode() //! example with scene::ISceneManager::addMayaCameraSceneNode or //! scene::ISceneManager::addMeshViewerCameraSceneNode, may want to get this input //! for changing their position, look at target or whatever. -bool CCameraMayaSceneNode::OnEvent(SEvent event) +bool CCameraMayaSceneNode::OnEvent(const SEvent& event) { if (event.EventType != EET_MOUSE_INPUT_EVENT || !InputReceiverEnabled) diff --git a/source/Irrlicht/CCameraMayaSceneNode.h b/source/Irrlicht/CCameraMayaSceneNode.h index f0839bad..88c50d29 100644 --- a/source/Irrlicht/CCameraMayaSceneNode.h +++ b/source/Irrlicht/CCameraMayaSceneNode.h @@ -29,7 +29,7 @@ namespace scene //! example with scene::ISceneManager::addMayaCameraSceneNode or //! scene::ISceneManager::addMeshViewerCameraSceneNode, may want to get this input //! for changing their position, look at target or whatever. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! OnAnimate() is called just before rendering the whole scene. //! nodes may calculate or store animations here, and may do other useful things, diff --git a/source/Irrlicht/CCameraSceneNode.cpp b/source/Irrlicht/CCameraSceneNode.cpp index aae9c568..84e70cc3 100644 --- a/source/Irrlicht/CCameraSceneNode.cpp +++ b/source/Irrlicht/CCameraSceneNode.cpp @@ -60,7 +60,7 @@ void CCameraSceneNode::setInputReceiverEnabled(bool enabled) //! Returns if the input receiver of the camera is currently enabled. -bool CCameraSceneNode::isInputReceiverEnabled() +bool CCameraSceneNode::isInputReceiverEnabled() const { _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; return InputReceiverEnabled; @@ -80,7 +80,7 @@ void CCameraSceneNode::setProjectionMatrix(const core::matrix4& projection) //! Gets the current projection matrix of the camera //! \return Returns the current projection matrix of the camera. -const core::matrix4& CCameraSceneNode::getProjectionMatrix() +const core::matrix4& CCameraSceneNode::getProjectionMatrix() const { return ViewArea.Matrices [ video::ETS_PROJECTION ]; } @@ -89,7 +89,7 @@ const core::matrix4& CCameraSceneNode::getProjectionMatrix() //! Gets the current view matrix of the camera //! \return Returns the current view matrix of the camera. -const core::matrix4& CCameraSceneNode::getViewMatrix() +const core::matrix4& CCameraSceneNode::getViewMatrix() const { return ViewArea.Matrices [ video::ETS_VIEW ]; } @@ -101,7 +101,7 @@ const core::matrix4& CCameraSceneNode::getViewMatrix() //! example with scene::ISceneManager::addMayaCameraSceneNode or //! scene::ISceneManager::addFPSCameraSceneNode, may want to get this input //! for changing their position, look at target or whatever. -bool CCameraSceneNode::OnEvent(SEvent event) +bool CCameraSceneNode::OnEvent(const SEvent& event) { return false; } @@ -143,22 +143,22 @@ core::vector3df CCameraSceneNode::getUpVector() const } -f32 CCameraSceneNode::getNearValue() +f32 CCameraSceneNode::getNearValue() const { return ZNear; } -f32 CCameraSceneNode::getFarValue() +f32 CCameraSceneNode::getFarValue() const { return ZFar; } -f32 CCameraSceneNode::getAspectRatio() +f32 CCameraSceneNode::getAspectRatio() const { return Aspect; } -f32 CCameraSceneNode::getFOV() +f32 CCameraSceneNode::getFOV() const { return Fovy; } diff --git a/source/Irrlicht/CCameraSceneNode.h b/source/Irrlicht/CCameraSceneNode.h index 48a2eb83..e280abbd 100644 --- a/source/Irrlicht/CCameraSceneNode.h +++ b/source/Irrlicht/CCameraSceneNode.h @@ -32,18 +32,18 @@ namespace scene //! Gets the current projection matrix of the camera //! \return Returns the current projection matrix of the camera. - virtual const core::matrix4& getProjectionMatrix(); + virtual const core::matrix4& getProjectionMatrix() const; //! Gets the current view matrix of the camera //! \return Returns the current view matrix of the camera. - virtual const core::matrix4& getViewMatrix(); + virtual const core::matrix4& getViewMatrix() const; //! It is possible to send mouse and key events to the camera. Most cameras //! may ignore this input, but camera scene nodes which are created for //! example with scene::ISceneManager::addMayaCameraSceneNode or //! scene::ISceneManager::addMeshViewerCameraSceneNode, may want to get this input //! for changing their position, look at target or whatever. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! sets the look at target of the camera //! \param pos: Look at target of the camera. @@ -63,19 +63,19 @@ namespace scene //! Gets distance from the camera to the near plane. //! \return Value of the near plane of the camera. - virtual f32 getNearValue(); + virtual f32 getNearValue() const; //! Gets the distance from the camera to the far plane. //! \return Value of the far plane of the camera. - virtual f32 getFarValue(); + virtual f32 getFarValue() const; //! Get the aspect ratio of the camera. //! \return The aspect ratio of the camera. - virtual f32 getAspectRatio(); + virtual f32 getAspectRatio() const; //! Gets the field of view of the camera. //! \return Field of view of the camera - virtual f32 getFOV(); + virtual f32 getFOV() const; //! Sets the value of the near clipping plane. (default: 1.0f) virtual void setNearValue(f32 zn); @@ -107,7 +107,7 @@ namespace scene virtual void setInputReceiverEnabled(bool enabled); //! Returns if the input receiver of the camera is currently enabled. - virtual bool isInputReceiverEnabled(); + virtual bool isInputReceiverEnabled() const; //! Writes attributes of the scene node. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; diff --git a/source/Irrlicht/CColladaFileLoader.cpp b/source/Irrlicht/CColladaFileLoader.cpp index ac3489c4..9364e532 100644 --- a/source/Irrlicht/CColladaFileLoader.cpp +++ b/source/Irrlicht/CColladaFileLoader.cpp @@ -205,7 +205,7 @@ CColladaFileLoader::~CColladaFileLoader() //! Returns true if the file maybe is able to be loaded by this class. /** This decision should be based only on the file extension (e.g. ".cob") */ -bool CColladaFileLoader::isALoadableFileExtension(const c8* fileName) +bool CColladaFileLoader::isALoadableFileExtension(const c8* fileName) const { return strstr(fileName, ".xml") || strstr(fileName, ".dae"); diff --git a/source/Irrlicht/CColladaFileLoader.h b/source/Irrlicht/CColladaFileLoader.h index 3a110797..0d4b1806 100644 --- a/source/Irrlicht/CColladaFileLoader.h +++ b/source/Irrlicht/CColladaFileLoader.h @@ -156,7 +156,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); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CCubeSceneNode.cpp b/source/Irrlicht/CCubeSceneNode.cpp index eb01b18d..bcaf82c5 100644 --- a/source/Irrlicht/CCubeSceneNode.cpp +++ b/source/Irrlicht/CCubeSceneNode.cpp @@ -125,7 +125,7 @@ video::SMaterial& CCubeSceneNode::getMaterial(u32 i) //! returns amount of materials used by this scene node. -u32 CCubeSceneNode::getMaterialCount() +u32 CCubeSceneNode::getMaterialCount() const { return 1; } diff --git a/source/Irrlicht/CCubeSceneNode.h b/source/Irrlicht/CCubeSceneNode.h index 55306445..853af777 100644 --- a/source/Irrlicht/CCubeSceneNode.h +++ b/source/Irrlicht/CCubeSceneNode.h @@ -41,7 +41,7 @@ namespace scene virtual video::SMaterial& getMaterial(u32 i); //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const { return ESNT_CUBE; } diff --git a/source/Irrlicht/CD3D8MaterialRenderer.h b/source/Irrlicht/CD3D8MaterialRenderer.h index fe2798b2..d95a24e2 100644 --- a/source/Irrlicht/CD3D8MaterialRenderer.h +++ b/source/Irrlicht/CD3D8MaterialRenderer.h @@ -223,7 +223,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -259,7 +259,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -311,7 +311,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -361,7 +361,7 @@ public: //! Returns if the material is transparent. The scene managment needs to know this //! for being able to sort the materials by opaque and transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return false; // this material is not really transparent because it does no blending. } @@ -573,7 +573,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } diff --git a/source/Irrlicht/CD3D8NormalMapRenderer.cpp b/source/Irrlicht/CD3D8NormalMapRenderer.cpp index 24d602a4..da197b2a 100644 --- a/source/Irrlicht/CD3D8NormalMapRenderer.cpp +++ b/source/Irrlicht/CD3D8NormalMapRenderer.cpp @@ -178,7 +178,7 @@ namespace video } //! Returns the render capability of the material. - s32 CD3D8NormalMapRenderer::getRenderCapability() + s32 CD3D8NormalMapRenderer::getRenderCapability() const { if (Driver->queryFeature(video::EVDF_PIXEL_SHADER_1_1) && Driver->queryFeature(video::EVDF_VERTEX_SHADER_1_1)) diff --git a/source/Irrlicht/CD3D8NormalMapRenderer.h b/source/Irrlicht/CD3D8NormalMapRenderer.h index d98d7fa6..f998f425 100644 --- a/source/Irrlicht/CD3D8NormalMapRenderer.h +++ b/source/Irrlicht/CD3D8NormalMapRenderer.h @@ -36,7 +36,7 @@ public: bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); //! Returns the render capability of the material. - virtual s32 getRenderCapability(); + virtual s32 getRenderCapability() const; private: diff --git a/source/Irrlicht/CD3D8ParallaxMapRenderer.cpp b/source/Irrlicht/CD3D8ParallaxMapRenderer.cpp index 0aac463f..ce0952a8 100644 --- a/source/Irrlicht/CD3D8ParallaxMapRenderer.cpp +++ b/source/Irrlicht/CD3D8ParallaxMapRenderer.cpp @@ -222,7 +222,7 @@ namespace video } //! Returns the render capability of the material. - s32 CD3D8ParallaxMapRenderer::getRenderCapability() + s32 CD3D8ParallaxMapRenderer::getRenderCapability() const { if (Driver->queryFeature(video::EVDF_PIXEL_SHADER_1_4) && Driver->queryFeature(video::EVDF_VERTEX_SHADER_1_1)) diff --git a/source/Irrlicht/CD3D8ParallaxMapRenderer.h b/source/Irrlicht/CD3D8ParallaxMapRenderer.h index 561d2923..771871bb 100644 --- a/source/Irrlicht/CD3D8ParallaxMapRenderer.h +++ b/source/Irrlicht/CD3D8ParallaxMapRenderer.h @@ -40,7 +40,7 @@ public: bool resetAllRenderstates, video::IMaterialRendererServices* services); //! Returns the render capability of the material. - virtual s32 getRenderCapability(); + virtual s32 getRenderCapability() const; private: diff --git a/source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp b/source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp index 12a97b2a..23d75216 100644 --- a/source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp +++ b/source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp @@ -153,7 +153,7 @@ void CD3D8ShaderMaterialRenderer::OnUnsetMaterial() //! Returns if the material is transparent. The scene managment needs to know this //! for being able to sort the materials by opaque and transparent. -bool CD3D8ShaderMaterialRenderer::isTransparent() +bool CD3D8ShaderMaterialRenderer::isTransparent() const { return BaseMaterial ? BaseMaterial->isTransparent() : false; } diff --git a/source/Irrlicht/CD3D8ShaderMaterialRenderer.h b/source/Irrlicht/CD3D8ShaderMaterialRenderer.h index 0f79879d..781fa09c 100644 --- a/source/Irrlicht/CD3D8ShaderMaterialRenderer.h +++ b/source/Irrlicht/CD3D8ShaderMaterialRenderer.h @@ -45,7 +45,7 @@ public: virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); //! Returns if the material is transparent. - virtual bool isTransparent(); + virtual bool isTransparent() const; protected: diff --git a/source/Irrlicht/CD3D9MaterialRenderer.h b/source/Irrlicht/CD3D9MaterialRenderer.h index e9bf68ee..e9970631 100644 --- a/source/Irrlicht/CD3D9MaterialRenderer.h +++ b/source/Irrlicht/CD3D9MaterialRenderer.h @@ -241,7 +241,7 @@ public: //! Returns if the material is transparent. The scene management needs to know this //! for being able to sort the materials by opaque and transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -280,7 +280,7 @@ public: //! Returns if the material is transparent. The scene managment needs to know this //! for being able to sort the materials by opaque and transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -334,7 +334,7 @@ public: //! Returns if the material is transparent. The scene managment needs to know this //! for being able to sort the materials by opaque and transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -385,7 +385,7 @@ public: //! Returns if the material is transparent. The scene managment needs to know this //! for being able to sort the materials by opaque and transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return false; // this material is not really transparent because it does no blending. } @@ -599,7 +599,7 @@ public: //! Returns if the material is transparent. The scene managment needs to know this //! for being able to sort the materials by opaque and transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } diff --git a/source/Irrlicht/CD3D9NormalMapRenderer.cpp b/source/Irrlicht/CD3D9NormalMapRenderer.cpp index a5082d1a..558a0f1f 100644 --- a/source/Irrlicht/CD3D9NormalMapRenderer.cpp +++ b/source/Irrlicht/CD3D9NormalMapRenderer.cpp @@ -235,7 +235,7 @@ namespace video //! Returns the render capability of the material. - s32 CD3D9NormalMapRenderer::getRenderCapability() + s32 CD3D9NormalMapRenderer::getRenderCapability() const { if (Driver->queryFeature(video::EVDF_PIXEL_SHADER_1_1) && Driver->queryFeature(video::EVDF_VERTEX_SHADER_1_1)) diff --git a/source/Irrlicht/CD3D9NormalMapRenderer.h b/source/Irrlicht/CD3D9NormalMapRenderer.h index 40254efc..a1f63ec0 100644 --- a/source/Irrlicht/CD3D9NormalMapRenderer.h +++ b/source/Irrlicht/CD3D9NormalMapRenderer.h @@ -38,7 +38,7 @@ public: virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); //! Returns the render capability of the material. - virtual s32 getRenderCapability(); + virtual s32 getRenderCapability() const; private: diff --git a/source/Irrlicht/CD3D9ParallaxMapRenderer.cpp b/source/Irrlicht/CD3D9ParallaxMapRenderer.cpp index a3a3d2d5..917af486 100644 --- a/source/Irrlicht/CD3D9ParallaxMapRenderer.cpp +++ b/source/Irrlicht/CD3D9ParallaxMapRenderer.cpp @@ -314,7 +314,7 @@ namespace video } //! Returns the render capability of the material. - s32 CD3D9ParallaxMapRenderer::getRenderCapability() + s32 CD3D9ParallaxMapRenderer::getRenderCapability() const { if (Driver->queryFeature(video::EVDF_PIXEL_SHADER_1_4) && Driver->queryFeature(video::EVDF_VERTEX_SHADER_1_1)) diff --git a/source/Irrlicht/CD3D9ParallaxMapRenderer.h b/source/Irrlicht/CD3D9ParallaxMapRenderer.h index 6a5ba8f0..cc433156 100644 --- a/source/Irrlicht/CD3D9ParallaxMapRenderer.h +++ b/source/Irrlicht/CD3D9ParallaxMapRenderer.h @@ -38,7 +38,7 @@ public: virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); //! Returns the render capability of the material. - virtual s32 getRenderCapability(); + virtual s32 getRenderCapability() const; virtual void OnSetMaterial(video::SMaterial& material, const video::SMaterial& lastMaterial, diff --git a/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp b/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp index bca65634..05eb6abf 100644 --- a/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp +++ b/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp @@ -146,7 +146,7 @@ void CD3D9ShaderMaterialRenderer::OnUnsetMaterial() //! Returns if the material is transparent. The scene managment needs to know this //! for being able to sort the materials by opaque and transparent. -bool CD3D9ShaderMaterialRenderer::isTransparent() +bool CD3D9ShaderMaterialRenderer::isTransparent() const { return BaseMaterial ? BaseMaterial->isTransparent() : false; } diff --git a/source/Irrlicht/CD3D9ShaderMaterialRenderer.h b/source/Irrlicht/CD3D9ShaderMaterialRenderer.h index e2ff8e34..c12aa377 100644 --- a/source/Irrlicht/CD3D9ShaderMaterialRenderer.h +++ b/source/Irrlicht/CD3D9ShaderMaterialRenderer.h @@ -44,40 +44,40 @@ public: virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); //! Returns if the material is transparent. - virtual bool isTransparent(); + virtual bool isTransparent() const; protected: //! constructor only for use by derived classes who want to //! create a fall back material for example. CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev, - video::IVideoDriver* driver, - IShaderConstantSetCallBack* callback, - IMaterialRenderer* baseMaterial, s32 userData=0); - + video::IVideoDriver* driver, + IShaderConstantSetCallBack* callback, + IMaterialRenderer* baseMaterial, + s32 userData=0); void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram); bool createPixelShader(const c8* pxsh); bool createVertexShader(const char* vtxsh); HRESULT stubD3DXAssembleShader(LPCSTR pSrcData, UINT SrcDataLen, - CONST D3DXMACRO* pDefines, LPD3DXINCLUDE pInclude, - DWORD Flags, LPD3DXBUFFER* ppShader, - LPD3DXBUFFER* ppErrorMsgs); + CONST D3DXMACRO* pDefines, LPD3DXINCLUDE pInclude, + DWORD Flags, LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); HRESULT stubD3DXAssembleShaderFromFile(LPCSTR pSrcFile, CONST D3DXMACRO* pDefines, LPD3DXINCLUDE pInclude, DWORD Flags, LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs); HRESULT stubD3DXCompileShader(LPCSTR pSrcData, UINT SrcDataLen, CONST D3DXMACRO* pDefines, - LPD3DXINCLUDE pInclude, LPCSTR pFunctionName, - LPCSTR pProfile, DWORD Flags, LPD3DXBUFFER* ppShader, - LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable); + LPD3DXINCLUDE pInclude, LPCSTR pFunctionName, + LPCSTR pProfile, DWORD Flags, LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable); HRESULT stubD3DXCompileShaderFromFile(LPCSTR pSrcFile, CONST D3DXMACRO* pDefines, - LPD3DXINCLUDE pInclude, LPCSTR pFunctionName, - LPCSTR pProfile, DWORD Flags, LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs, - LPD3DXCONSTANTTABLE* ppConstantTable); + LPD3DXINCLUDE pInclude, LPCSTR pFunctionName, + LPCSTR pProfile, DWORD Flags, LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); IDirect3DDevice9* pID3DDevice; video::IVideoDriver* Driver; diff --git a/source/Irrlicht/CDMFLoader.cpp b/source/Irrlicht/CDMFLoader.cpp index 61099b51..946712b2 100644 --- a/source/Irrlicht/CDMFLoader.cpp +++ b/source/Irrlicht/CDMFLoader.cpp @@ -435,7 +435,7 @@ IAnimatedMesh* CDMFLoader::createMesh(io::IReadFile* file) /** \brief Tell us if this file is able to be loaded by this class based on the file extension (e.g. ".bsp") \return true if file is loadable.*/ -bool CDMFLoader::isALoadableFileExtension(const c8* filename) +bool CDMFLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".dmf") != 0; } diff --git a/source/Irrlicht/CDMFLoader.h b/source/Irrlicht/CDMFLoader.h index ba7320db..d58433fe 100644 --- a/source/Irrlicht/CDMFLoader.h +++ b/source/Irrlicht/CDMFLoader.h @@ -57,7 +57,7 @@ namespace scene //! 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); + virtual bool isALoadableFileExtension(const c8* fileName) const; /** creates/loads an animated mesh from the file. \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CDummyTransformationSceneNode.h b/source/Irrlicht/CDummyTransformationSceneNode.h index c7bfe002..eb3c4327 100644 --- a/source/Irrlicht/CDummyTransformationSceneNode.h +++ b/source/Irrlicht/CDummyTransformationSceneNode.h @@ -34,7 +34,7 @@ namespace scene virtual core::matrix4 getRelativeTransformation() const; //! does nothing. - virtual void render() {}; + virtual void render() {} //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const { return ESNT_DUMMY_TRANSFORMATION; } diff --git a/source/Irrlicht/CFileSystem.cpp b/source/Irrlicht/CFileSystem.cpp index 37bdf6bd..2cf1de81 100644 --- a/source/Irrlicht/CFileSystem.cpp +++ b/source/Irrlicht/CFileSystem.cpp @@ -209,10 +209,10 @@ bool CFileSystem::changeWorkingDirectoryTo(const c8* newDirectory) return success; } -irr::core::stringc CFileSystem::getAbsolutePath(irr::core::stringc &filename) +core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const { c8 *p=0; - irr::core::stringc ret; + core::stringc ret; #ifdef _IRR_WINDOWS_API_ @@ -231,34 +231,28 @@ irr::core::stringc CFileSystem::getAbsolutePath(irr::core::stringc &filename) return ret; } -irr::core::stringc CFileSystem::getFileDir(irr::core::stringc &filename) +core::stringc CFileSystem::getFileDir(const core::stringc& filename) const { - irr::core::stringc ret; - // find last forward or backslash s32 lastSlash = filename.findLast('/'); -#ifdef _IRR_WINDOWS_API_ - s32 lastBackSlash = filename.findLast('\\'); + const s32 lastBackSlash = filename.findLast('\\'); lastSlash = lastSlash > lastBackSlash ? lastSlash : lastBackSlash; -#endif - if (lastSlash >= 0 && lastSlash < (s32)filename.size()) - ret = filename.subString(0, lastSlash); + if ((u32)lastSlash < filename.size()) + return filename.subString(0, lastSlash); else - ret = "."; - - return ret; + return "."; } //! Creates a list of files and directories in the current working directory -IFileList* CFileSystem::createFileList() +IFileList* CFileSystem::createFileList() const { return new CFileList(); } //! determines if a file exists and would be able to be opened. -bool CFileSystem::existFile(const c8* filename) +bool CFileSystem::existFile(const c8* filename) const { u32 i; diff --git a/source/Irrlicht/CFileSystem.h b/source/Irrlicht/CFileSystem.h index 26125392..ad8a2d2e 100644 --- a/source/Irrlicht/CFileSystem.h +++ b/source/Irrlicht/CFileSystem.h @@ -56,18 +56,18 @@ public: virtual bool changeWorkingDirectoryTo(const c8* newDirectory); //! Converts a relative path to an absolute (unique) path, resolving symbolic links - virtual irr::core::stringc getAbsolutePath(irr::core::stringc &filename); + virtual core::stringc getAbsolutePath(const core::stringc& filename) const; //! Returns the directory a file is located in. /** \param filename: The file to get the directory from */ - virtual irr::core::stringc getFileDir(irr::core::stringc &filename); + virtual core::stringc getFileDir(const core::stringc& filename) const; //! Creates a list of files and directories in the current working directory //! and returns it. - virtual IFileList* createFileList(); + virtual IFileList* createFileList() const; //! determinates if a file exists and would be able to be opened. - virtual bool existFile(const c8* filename); + virtual bool existFile(const c8* filename) const; //! Creates a XML Reader from a file. virtual IXMLReader* createXMLReader(const c8* filename); @@ -99,7 +99,6 @@ private: }; - } // end namespace irr } // end namespace io diff --git a/source/Irrlicht/CGUIButton.cpp b/source/Irrlicht/CGUIButton.cpp index cf2a1141..fd65ab22 100644 --- a/source/Irrlicht/CGUIButton.cpp +++ b/source/Irrlicht/CGUIButton.cpp @@ -88,7 +88,7 @@ void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor col } //! called if an event happened. -bool CGUIButton::OnEvent(SEvent event) +bool CGUIButton::OnEvent(const SEvent& event) { if (!IsEnabled) return Parent ? Parent->OnEvent(event) : false; diff --git a/source/Irrlicht/CGUIButton.h b/source/Irrlicht/CGUIButton.h index c50a71cd..66c07c2e 100644 --- a/source/Irrlicht/CGUIButton.h +++ b/source/Irrlicht/CGUIButton.h @@ -29,7 +29,7 @@ namespace gui ~CGUIButton(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUICheckBox.cpp b/source/Irrlicht/CGUICheckBox.cpp index cadbfa7f..a99735f1 100644 --- a/source/Irrlicht/CGUICheckBox.cpp +++ b/source/Irrlicht/CGUICheckBox.cpp @@ -33,7 +33,7 @@ CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIEleme //! called if an event happened. -bool CGUICheckBox::OnEvent(SEvent event) +bool CGUICheckBox::OnEvent(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUICheckBox.h b/source/Irrlicht/CGUICheckBox.h index 795bb151..140ce74e 100644 --- a/source/Irrlicht/CGUICheckBox.h +++ b/source/Irrlicht/CGUICheckBox.h @@ -29,7 +29,7 @@ namespace gui virtual bool isChecked() const; //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIColorSelectDialog.cpp b/source/Irrlicht/CGUIColorSelectDialog.cpp index c9aa991b..fa2463ea 100644 --- a/source/Irrlicht/CGUIColorSelectDialog.cpp +++ b/source/Irrlicht/CGUIColorSelectDialog.cpp @@ -337,7 +337,7 @@ void CGUIColorSelectDialog::buildColorRing( const core::dimension2d & dim, //! called if an event happened. -bool CGUIColorSelectDialog::OnEvent(SEvent event) +bool CGUIColorSelectDialog::OnEvent(const SEvent& event) { switch(event.EventType) diff --git a/source/Irrlicht/CGUIColorSelectDialog.h b/source/Irrlicht/CGUIColorSelectDialog.h index aa5ddf5e..f0370150 100644 --- a/source/Irrlicht/CGUIColorSelectDialog.h +++ b/source/Irrlicht/CGUIColorSelectDialog.h @@ -32,7 +32,7 @@ namespace gui virtual ~CGUIColorSelectDialog(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIComboBox.cpp b/source/Irrlicht/CGUIComboBox.cpp index 1204ed3c..f930ca22 100644 --- a/source/Irrlicht/CGUIComboBox.cpp +++ b/source/Irrlicht/CGUIComboBox.cpp @@ -147,7 +147,7 @@ void CGUIComboBox::updateAbsolutePosition() //! called if an event happened. -bool CGUIComboBox::OnEvent(SEvent event) +bool CGUIComboBox::OnEvent(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUIComboBox.h b/source/Irrlicht/CGUIComboBox.h index 769402bb..f6e4a863 100644 --- a/source/Irrlicht/CGUIComboBox.h +++ b/source/Irrlicht/CGUIComboBox.h @@ -56,7 +56,7 @@ namespace gui virtual void updateAbsolutePosition(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIContextMenu.cpp b/source/Irrlicht/CGUIContextMenu.cpp index 47c88aaf..bc0e442e 100644 --- a/source/Irrlicht/CGUIContextMenu.cpp +++ b/source/Irrlicht/CGUIContextMenu.cpp @@ -212,7 +212,7 @@ void CGUIContextMenu::removeAllItems() //! called if an event happened. -bool CGUIContextMenu::OnEvent(SEvent event) +bool CGUIContextMenu::OnEvent(const SEvent& event) { if (!IsEnabled) return Parent ? Parent->OnEvent(event) : false; diff --git a/source/Irrlicht/CGUIContextMenu.h b/source/Irrlicht/CGUIContextMenu.h index 1a7194d2..d4634cd4 100644 --- a/source/Irrlicht/CGUIContextMenu.h +++ b/source/Irrlicht/CGUIContextMenu.h @@ -65,7 +65,7 @@ namespace gui virtual void removeAllItems(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIEditBox.cpp b/source/Irrlicht/CGUIEditBox.cpp index e7ffb201..7fe7ce8a 100644 --- a/source/Irrlicht/CGUIEditBox.cpp +++ b/source/Irrlicht/CGUIEditBox.cpp @@ -174,7 +174,7 @@ void CGUIEditBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT ver //! called if an event happened. -bool CGUIEditBox::OnEvent(SEvent event) +bool CGUIEditBox::OnEvent(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUIEditBox.h b/source/Irrlicht/CGUIEditBox.h index 9da1b60c..d5135b0a 100644 --- a/source/Irrlicht/CGUIEditBox.h +++ b/source/Irrlicht/CGUIEditBox.h @@ -72,7 +72,7 @@ namespace gui virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIEnvironment.cpp b/source/Irrlicht/CGUIEnvironment.cpp index 0b60ed05..6a5b072d 100644 --- a/source/Irrlicht/CGUIEnvironment.cpp +++ b/source/Irrlicht/CGUIEnvironment.cpp @@ -360,7 +360,7 @@ void CGUIEnvironment::clear() //! called by ui if an event happened. -bool CGUIEnvironment::OnEvent(SEvent event) +bool CGUIEnvironment::OnEvent(const SEvent& event) { if (UserReceiver && (event.EventType != EET_GUI_EVENT || event.GUIEvent.Caller != this)) return UserReceiver->OnEvent(event); @@ -483,7 +483,7 @@ void CGUIEnvironment::setUserEventReceiver(IEventReceiver* evr) //! posts an input event to the environment -bool CGUIEnvironment::postEventFromUser(SEvent event) +bool CGUIEnvironment::postEventFromUser(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUIEnvironment.h b/source/Irrlicht/CGUIEnvironment.h index bb3f1129..aa43a07c 100644 --- a/source/Irrlicht/CGUIEnvironment.h +++ b/source/Irrlicht/CGUIEnvironment.h @@ -46,7 +46,7 @@ public: virtual IOSOperator* getOSOperator() const; //! posts an input event to the environment - virtual bool postEventFromUser(SEvent event); + virtual bool postEventFromUser(const SEvent& event); //! This sets a new event receiver for gui events. Usually you do not have to //! use this method, it is used by the internal engine. @@ -56,7 +56,7 @@ public: virtual void clear(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! returns the current gui skin virtual IGUISkin* getSkin() const; diff --git a/source/Irrlicht/CGUIFileOpenDialog.cpp b/source/Irrlicht/CGUIFileOpenDialog.cpp index 1dfb86bb..d7dd05ac 100644 --- a/source/Irrlicht/CGUIFileOpenDialog.cpp +++ b/source/Irrlicht/CGUIFileOpenDialog.cpp @@ -134,7 +134,7 @@ const wchar_t* CGUIFileOpenDialog::getFileName() const //! called if an event happened. -bool CGUIFileOpenDialog::OnEvent(SEvent event) +bool CGUIFileOpenDialog::OnEvent(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUIFileOpenDialog.h b/source/Irrlicht/CGUIFileOpenDialog.h index d3de38f3..c33f3dcc 100644 --- a/source/Irrlicht/CGUIFileOpenDialog.h +++ b/source/Irrlicht/CGUIFileOpenDialog.h @@ -32,7 +32,7 @@ namespace gui virtual const wchar_t* getFileName() const; //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIListBox.cpp b/source/Irrlicht/CGUIListBox.cpp index f3a06e74..2136db96 100644 --- a/source/Irrlicht/CGUIListBox.cpp +++ b/source/Irrlicht/CGUIListBox.cpp @@ -193,7 +193,7 @@ void CGUIListBox::setSelected(s32 id) //! called if an event happened. -bool CGUIListBox::OnEvent(SEvent event) +bool CGUIListBox::OnEvent(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUIListBox.h b/source/Irrlicht/CGUIListBox.h index 3fb7dbe3..6633b2f5 100644 --- a/source/Irrlicht/CGUIListBox.h +++ b/source/Irrlicht/CGUIListBox.h @@ -49,7 +49,7 @@ namespace gui virtual void setSelected(s32 id); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIMenu.cpp b/source/Irrlicht/CGUIMenu.cpp index d2ddf507..b214a9a1 100644 --- a/source/Irrlicht/CGUIMenu.cpp +++ b/source/Irrlicht/CGUIMenu.cpp @@ -90,7 +90,7 @@ void CGUIMenu::draw() //! called if an event happened. -bool CGUIMenu::OnEvent(SEvent event) +bool CGUIMenu::OnEvent(const SEvent& event) { if (!IsEnabled) return Parent ? Parent->OnEvent(event) : false; diff --git a/source/Irrlicht/CGUIMenu.h b/source/Irrlicht/CGUIMenu.h index 4b44accb..c23f3549 100644 --- a/source/Irrlicht/CGUIMenu.h +++ b/source/Irrlicht/CGUIMenu.h @@ -30,7 +30,7 @@ namespace gui virtual void draw(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! Updates the absolute position. virtual void updateAbsolutePosition(); diff --git a/source/Irrlicht/CGUIMeshViewer.cpp b/source/Irrlicht/CGUIMeshViewer.cpp index 14bf3960..0bc35999 100644 --- a/source/Irrlicht/CGUIMeshViewer.cpp +++ b/source/Irrlicht/CGUIMeshViewer.cpp @@ -84,7 +84,7 @@ const video::SMaterial& CGUIMeshViewer::getMaterial() const //! called if an event happened. -bool CGUIMeshViewer::OnEvent(SEvent event) +bool CGUIMeshViewer::OnEvent(const SEvent& event) { return Parent ? Parent->OnEvent(event) : false; } diff --git a/source/Irrlicht/CGUIMeshViewer.h b/source/Irrlicht/CGUIMeshViewer.h index f20d1123..a8e595c8 100644 --- a/source/Irrlicht/CGUIMeshViewer.h +++ b/source/Irrlicht/CGUIMeshViewer.h @@ -41,7 +41,7 @@ namespace gui virtual const video::SMaterial& getMaterial() const; //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIMessageBox.cpp b/source/Irrlicht/CGUIMessageBox.cpp index 40ae084e..d50bc8a3 100644 --- a/source/Irrlicht/CGUIMessageBox.cpp +++ b/source/Irrlicht/CGUIMessageBox.cpp @@ -251,7 +251,7 @@ CGUIMessageBox::~CGUIMessageBox() //! called if an event happened. -bool CGUIMessageBox::OnEvent(SEvent event) +bool CGUIMessageBox::OnEvent(const SEvent& event) { SEvent outevent; outevent.EventType = EET_GUI_EVENT; diff --git a/source/Irrlicht/CGUIMessageBox.h b/source/Irrlicht/CGUIMessageBox.h index 6b3748b4..039620bd 100644 --- a/source/Irrlicht/CGUIMessageBox.h +++ b/source/Irrlicht/CGUIMessageBox.h @@ -29,7 +29,7 @@ namespace gui ~CGUIMessageBox(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! Writes attributes of the element. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const; diff --git a/source/Irrlicht/CGUIModalScreen.cpp b/source/Irrlicht/CGUIModalScreen.cpp index 64dc3b28..3621dc25 100644 --- a/source/Irrlicht/CGUIModalScreen.cpp +++ b/source/Irrlicht/CGUIModalScreen.cpp @@ -37,7 +37,7 @@ CGUIModalScreen::~CGUIModalScreen() //! called if an event happened. -bool CGUIModalScreen::OnEvent(SEvent event) +bool CGUIModalScreen::OnEvent(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUIModalScreen.h b/source/Irrlicht/CGUIModalScreen.h index 6c183222..b0d7dba2 100644 --- a/source/Irrlicht/CGUIModalScreen.h +++ b/source/Irrlicht/CGUIModalScreen.h @@ -26,7 +26,7 @@ namespace gui ~CGUIModalScreen(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! Removes a child. virtual void removeChild(IGUIElement* child); diff --git a/source/Irrlicht/CGUIScrollBar.cpp b/source/Irrlicht/CGUIScrollBar.cpp index f01cb356..b6ca26c4 100644 --- a/source/Irrlicht/CGUIScrollBar.cpp +++ b/source/Irrlicht/CGUIScrollBar.cpp @@ -54,7 +54,7 @@ CGUIScrollBar::~CGUIScrollBar() //! called if an event happened. -bool CGUIScrollBar::OnEvent(SEvent event) +bool CGUIScrollBar::OnEvent(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUIScrollBar.h b/source/Irrlicht/CGUIScrollBar.h index 312d22fd..c5360e63 100644 --- a/source/Irrlicht/CGUIScrollBar.h +++ b/source/Irrlicht/CGUIScrollBar.h @@ -29,7 +29,7 @@ namespace gui ~CGUIScrollBar(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUISpinBox.cpp b/source/Irrlicht/CGUISpinBox.cpp index 669eaff3..2748632c 100644 --- a/source/Irrlicht/CGUISpinBox.cpp +++ b/source/Irrlicht/CGUISpinBox.cpp @@ -159,7 +159,7 @@ void CGUISpinBox::setDecimalPlaces(s32 places) } -bool CGUISpinBox::OnEvent(SEvent event) +bool CGUISpinBox::OnEvent(const SEvent& event) { bool changeEvent = false; switch(event.EventType) diff --git a/source/Irrlicht/CGUISpinBox.h b/source/Irrlicht/CGUISpinBox.h index cfe0eb9a..3e8279de 100644 --- a/source/Irrlicht/CGUISpinBox.h +++ b/source/Irrlicht/CGUISpinBox.h @@ -59,7 +59,7 @@ namespace gui virtual f32 getStepSize() const; //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! Sets the new caption of the element virtual void setText(const wchar_t* text); diff --git a/source/Irrlicht/CGUITabControl.cpp b/source/Irrlicht/CGUITabControl.cpp index 8270bdde..9b8360a2 100644 --- a/source/Irrlicht/CGUITabControl.cpp +++ b/source/Irrlicht/CGUITabControl.cpp @@ -234,7 +234,7 @@ IGUITab* CGUITabControl::getTab(s32 idx) const //! called if an event happened. -bool CGUITabControl::OnEvent(SEvent event) +bool CGUITabControl::OnEvent(const SEvent& event) { if (!IsEnabled) return Parent ? Parent->OnEvent(event) : false; diff --git a/source/Irrlicht/CGUITabControl.h b/source/Irrlicht/CGUITabControl.h index 71dfaaa4..76375d19 100644 --- a/source/Irrlicht/CGUITabControl.h +++ b/source/Irrlicht/CGUITabControl.h @@ -98,7 +98,7 @@ namespace gui virtual s32 getActiveTab() const; //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIToolBar.cpp b/source/Irrlicht/CGUIToolBar.cpp index 43c884f7..e8aaa3f6 100644 --- a/source/Irrlicht/CGUIToolBar.cpp +++ b/source/Irrlicht/CGUIToolBar.cpp @@ -65,7 +65,7 @@ CGUIToolBar::CGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 //! called if an event happened. -bool CGUIToolBar::OnEvent(SEvent event) +bool CGUIToolBar::OnEvent(const SEvent& event) { if (event.EventType == EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) diff --git a/source/Irrlicht/CGUIToolBar.h b/source/Irrlicht/CGUIToolBar.h index 60431488..3f2fcedd 100644 --- a/source/Irrlicht/CGUIToolBar.h +++ b/source/Irrlicht/CGUIToolBar.h @@ -24,7 +24,7 @@ namespace gui CGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! draws the element and its children virtual void draw(); diff --git a/source/Irrlicht/CGUIWindow.cpp b/source/Irrlicht/CGUIWindow.cpp index 77bfa988..e479c67c 100644 --- a/source/Irrlicht/CGUIWindow.cpp +++ b/source/Irrlicht/CGUIWindow.cpp @@ -107,7 +107,7 @@ CGUIWindow::~CGUIWindow() //! called if an event happened. -bool CGUIWindow::OnEvent(SEvent event) +bool CGUIWindow::OnEvent(const SEvent& event) { switch(event.EventType) { diff --git a/source/Irrlicht/CGUIWindow.h b/source/Irrlicht/CGUIWindow.h index 0d61674b..136635d8 100644 --- a/source/Irrlicht/CGUIWindow.h +++ b/source/Irrlicht/CGUIWindow.h @@ -27,7 +27,7 @@ namespace gui virtual ~CGUIWindow(); //! called if an event happened. - virtual bool OnEvent(SEvent event); + virtual bool OnEvent(const SEvent& event); //! update absolute position virtual void updateAbsolutePosition(); diff --git a/source/Irrlicht/CImageLoaderBMP.cpp b/source/Irrlicht/CImageLoaderBMP.cpp index 1a05aa12..b6976228 100644 --- a/source/Irrlicht/CImageLoaderBMP.cpp +++ b/source/Irrlicht/CImageLoaderBMP.cpp @@ -18,7 +18,6 @@ namespace video //! constructor CImageLoaderBMP::CImageLoaderBMP() -: BmpData(0), PaletteData(0) { #ifdef _DEBUG setDebugName("CImageLoaderBMP"); @@ -26,30 +25,16 @@ CImageLoaderBMP::CImageLoaderBMP() } - -//! destructor -CImageLoaderBMP::~CImageLoaderBMP() -{ - if (PaletteData) - delete [] PaletteData; - - if (BmpData) - delete [] BmpData; -} - - - //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") -bool CImageLoaderBMP::isALoadableFileExtension(const c8* fileName) +bool CImageLoaderBMP::isALoadableFileExtension(const c8* fileName) const { return strstr(fileName, ".bmp") != 0; } - //! returns true if the file maybe is able to be loaded by this class -bool CImageLoaderBMP::isALoadableFileFormat(irr::io::IReadFile* file) +bool CImageLoaderBMP::isALoadableFileFormat(irr::io::IReadFile* file) const { u16 headerID; file->read(&headerID, sizeof(u16)); @@ -60,15 +45,15 @@ bool CImageLoaderBMP::isALoadableFileFormat(irr::io::IReadFile* file) } -void CImageLoaderBMP::decompress8BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) +void CImageLoaderBMP::decompress8BitRLE(u8*& bmpData, s32 size, s32 width, s32 height, s32 pitch) const { - u8* p = BmpData; + u8* p = bmpData; u8* newBmp = new u8[(width+pitch)*height]; u8* d = newBmp; u8* destEnd = newBmp + (width+pitch)*height; s32 line = 0; - while (BmpData - p < size && d < destEnd) + while (bmpData - p < size && d < destEnd) { if (*p == 0) { @@ -82,8 +67,8 @@ void CImageLoaderBMP::decompress8BitRLE(u8*& BmpData, s32 size, s32 width, s32 h d = newBmp + (line*(width+pitch)); break; case 1: // end of bmp - delete [] BmpData; - BmpData = newBmp; + delete [] bmpData; + bmpData = newBmp; return; case 2: ++p; d +=(u8)*p; // delta @@ -121,22 +106,22 @@ void CImageLoaderBMP::decompress8BitRLE(u8*& BmpData, s32 size, s32 width, s32 h } } - delete [] BmpData; - BmpData = newBmp; + delete [] bmpData; + bmpData = newBmp; } -void CImageLoaderBMP::decompress4BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) +void CImageLoaderBMP::decompress4BitRLE(u8*& bmpData, s32 size, s32 width, s32 height, s32 pitch) const { s32 lineWidth = (width+1)/2+pitch; - u8* p = BmpData; + u8* p = bmpData; u8* newBmp = new u8[lineWidth*height]; u8* d = newBmp; u8* destEnd = newBmp + lineWidth*height; s32 line = 0; s32 shift = 4; - while (BmpData - p < size && d < destEnd) + while (bmpData - p < size && d < destEnd) { if (*p == 0) { @@ -151,8 +136,8 @@ void CImageLoaderBMP::decompress4BitRLE(u8*& BmpData, s32 size, s32 width, s32 h shift = 4; break; case 1: // end of bmp - delete [] BmpData; - BmpData = newBmp; + delete [] bmpData; + bmpData = newBmp; return; case 2: { @@ -221,14 +206,14 @@ void CImageLoaderBMP::decompress4BitRLE(u8*& BmpData, s32 size, s32 width, s32 h } } - delete [] BmpData; - BmpData = newBmp; + delete [] bmpData; + bmpData = newBmp; } //! creates a surface from the file -IImage* CImageLoaderBMP::loadImage(irr::io::IReadFile* file) +IImage* CImageLoaderBMP::loadImage(irr::io::IReadFile* file) const { SBMPHeader header; @@ -272,13 +257,14 @@ IImage* CImageLoaderBMP::loadImage(irr::io::IReadFile* file) long pos = file->getPos(); s32 paletteSize = (header.BitmapDataOffset - pos) / 4; + s32* paletteData; if (paletteSize) { - PaletteData = new s32[paletteSize]; - file->read(PaletteData, paletteSize * sizeof(s32)); + paletteData = new s32[paletteSize]; + file->read(paletteData, paletteSize * sizeof(s32)); #ifdef __BIG_ENDIAN__ for (u32 i=0; iread(BmpData, header.BitmapDataSize); + u8* bmpData = new u8[header.BitmapDataSize]; + file->read(bmpData, header.BitmapDataSize); // decompress data if needed switch(header.Compression) { case 1: // 8 bit rle - decompress8BitRLE(BmpData, header.BitmapDataSize, header.Width, header.Height, pitch); + decompress8BitRLE(bmpData, header.BitmapDataSize, header.Width, header.Height, pitch); break; case 2: // 4 bit rle - decompress4BitRLE(BmpData, header.BitmapDataSize, header.Width, header.Height, pitch); + decompress4BitRLE(bmpData, header.BitmapDataSize, header.Width, header.Height, pitch); break; } @@ -324,32 +310,32 @@ IImage* CImageLoaderBMP::loadImage(irr::io::IReadFile* file) case 1: image = new CImage(ECF_A1R5G5B5, core::dimension2d(header.Width, header.Height)); if (image) - CColorConverter::convert1BitTo16Bit(BmpData, (s16*)image->lock(), header.Width, header.Height, pitch, true); + CColorConverter::convert1BitTo16Bit(bmpData, (s16*)image->lock(), header.Width, header.Height, pitch, true); break; case 4: image = new CImage(ECF_A1R5G5B5, core::dimension2d(header.Width, header.Height)); if (image) - CColorConverter::convert4BitTo16Bit(BmpData, (s16*)image->lock(), header.Width, header.Height, PaletteData, pitch, true); + CColorConverter::convert4BitTo16Bit(bmpData, (s16*)image->lock(), header.Width, header.Height, paletteData, pitch, true); break; case 8: image = new CImage(ECF_A1R5G5B5, core::dimension2d(header.Width, header.Height)); if (image) - CColorConverter::convert8BitTo16Bit(BmpData, (s16*)image->lock(), header.Width, header.Height, PaletteData, pitch, true); + CColorConverter::convert8BitTo16Bit(bmpData, (s16*)image->lock(), header.Width, header.Height, paletteData, pitch, true); break; case 16: image = new CImage(ECF_A1R5G5B5, core::dimension2d(header.Width, header.Height)); if (image) - CColorConverter::convert16BitTo16Bit((s16*)BmpData, (s16*)image->lock(), header.Width, header.Height, pitch, true); + CColorConverter::convert16BitTo16Bit((s16*)bmpData, (s16*)image->lock(), header.Width, header.Height, pitch, true); break; case 24: image = new CImage(ECF_R8G8B8, core::dimension2d(header.Width, header.Height)); if (image) - CColorConverter::convert24BitTo24Bit(BmpData, (u8*)image->lock(), header.Width, header.Height, pitch, true, true); + CColorConverter::convert24BitTo24Bit(bmpData, (u8*)image->lock(), header.Width, header.Height, pitch, true, true); break; case 32: // thx to Reinhard Ostermeier image = new CImage(ECF_A8R8G8B8, core::dimension2d(header.Width, header.Height)); if (image) - CColorConverter::convert32BitTo32Bit((s32*)BmpData, (s32*)image->lock(), header.Width, header.Height, pitch, true); + CColorConverter::convert32BitTo32Bit((s32*)bmpData, (s32*)image->lock(), header.Width, header.Height, pitch, true); break; }; if (image) @@ -357,17 +343,13 @@ IImage* CImageLoaderBMP::loadImage(irr::io::IReadFile* file) // clean up - delete [] PaletteData; - PaletteData = 0; - - delete [] BmpData; - BmpData = 0; + delete [] paletteData; + delete [] bmpData; return image; } - //! creates a loader which is able to load windows bitmaps IImageLoader* createImageLoaderBMP() { @@ -377,3 +359,4 @@ IImageLoader* createImageLoaderBMP() } // end namespace video } // end namespace irr + diff --git a/source/Irrlicht/CImageLoaderBMP.h b/source/Irrlicht/CImageLoaderBMP.h index 61679a97..727cdb28 100644 --- a/source/Irrlicht/CImageLoaderBMP.h +++ b/source/Irrlicht/CImageLoaderBMP.h @@ -79,28 +79,21 @@ public: //! constructor CImageLoaderBMP(); - //! destructor - virtual ~CImageLoaderBMP(); - //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! returns true if the file maybe is able to be loaded by this class - virtual bool isALoadableFileFormat(irr::io::IReadFile* file); + virtual bool isALoadableFileFormat(irr::io::IReadFile* file) const; //! creates a surface from the file - virtual IImage* loadImage(irr::io::IReadFile* file); + virtual IImage* loadImage(irr::io::IReadFile* file) const; private: - void decompress8BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch); - - void decompress4BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch); - - u8* BmpData; - s32* PaletteData; + void decompress8BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) const; + void decompress4BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) const; }; diff --git a/source/Irrlicht/CImageLoaderJPG.cpp b/source/Irrlicht/CImageLoaderJPG.cpp index dbf76ace..11a5f9f8 100644 --- a/source/Irrlicht/CImageLoaderJPG.cpp +++ b/source/Irrlicht/CImageLoaderJPG.cpp @@ -32,7 +32,7 @@ CImageLoaderJPG::~CImageLoaderJPG() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") -bool CImageLoaderJPG::isALoadableFileExtension(const c8* fileName) +bool CImageLoaderJPG::isALoadableFileExtension(const c8* fileName) const { return strstr(fileName, ".jpg") != 0; } @@ -109,7 +109,7 @@ void CImageLoaderJPG::output_message(j_common_ptr cinfo) #endif // _IRR_COMPILE_WITH_LIBJPEG_ //! returns true if the file maybe is able to be loaded by this class -bool CImageLoaderJPG::isALoadableFileFormat(irr::io::IReadFile* file) +bool CImageLoaderJPG::isALoadableFileFormat(irr::io::IReadFile* file) const { #ifndef _IRR_COMPILE_WITH_LIBJPEG_ return false; @@ -127,7 +127,7 @@ bool CImageLoaderJPG::isALoadableFileFormat(irr::io::IReadFile* file) } //! creates a surface from the file -IImage* CImageLoaderJPG::loadImage(irr::io::IReadFile* file) +IImage* CImageLoaderJPG::loadImage(irr::io::IReadFile* file) const { #ifndef _IRR_COMPILE_WITH_LIBJPEG_ return 0; diff --git a/source/Irrlicht/CImageLoaderJPG.h b/source/Irrlicht/CImageLoaderJPG.h index 24f043a6..2e8656fd 100644 --- a/source/Irrlicht/CImageLoaderJPG.h +++ b/source/Irrlicht/CImageLoaderJPG.h @@ -41,13 +41,13 @@ public: //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! returns true if the file maybe is able to be loaded by this class - virtual bool isALoadableFileFormat(irr::io::IReadFile* file); + virtual bool isALoadableFileFormat(irr::io::IReadFile* file) const; //! creates a surface from the file - virtual IImage* loadImage(irr::io::IReadFile* file); + virtual IImage* loadImage(irr::io::IReadFile* file) const; private: diff --git a/source/Irrlicht/CImageLoaderPCX.cpp b/source/Irrlicht/CImageLoaderPCX.cpp index f6ce4350..89e2dcb5 100644 --- a/source/Irrlicht/CImageLoaderPCX.cpp +++ b/source/Irrlicht/CImageLoaderPCX.cpp @@ -19,7 +19,6 @@ namespace video //! constructor CImageLoaderPCX::CImageLoaderPCX() -: PCXData(0), PaletteData(0) { #ifdef _DEBUG setDebugName("CImageLoaderPCX"); @@ -27,22 +26,9 @@ CImageLoaderPCX::CImageLoaderPCX() } - -//! destructor -CImageLoaderPCX::~CImageLoaderPCX() -{ - if (PaletteData) - delete [] PaletteData; - - if (PCXData) - delete [] PCXData; -} - - - //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") -bool CImageLoaderPCX::isALoadableFileExtension(const c8* fileName) +bool CImageLoaderPCX::isALoadableFileExtension(const c8* fileName) const { return (strstr(fileName, ".PCX") != 0) || (strstr(fileName, ".pcx") != 0); } @@ -50,7 +36,7 @@ bool CImageLoaderPCX::isALoadableFileExtension(const c8* fileName) //! returns true if the file maybe is able to be loaded by this class -bool CImageLoaderPCX::isALoadableFileFormat(irr::io::IReadFile* file) +bool CImageLoaderPCX::isALoadableFileFormat(irr::io::IReadFile* file) const { u8 headerID; file->read(&headerID, sizeof(headerID)); @@ -59,9 +45,10 @@ bool CImageLoaderPCX::isALoadableFileFormat(irr::io::IReadFile* file) //! creates a image from the file -IImage* CImageLoaderPCX::loadImage(irr::io::IReadFile* file) +IImage* CImageLoaderPCX::loadImage(irr::io::IReadFile* file) const { SPCXHeader header; + s32* paletteData = 0; file->read(&header, sizeof(header)); #ifdef __BIG_ENDIAN__ @@ -99,13 +86,13 @@ IImage* CImageLoaderPCX::loadImage(irr::io::IReadFile* file) file->seek( file->getSize()-256*3, false ); u8 *tempPalette = new u8[768]; - PaletteData = new s32[256]; - memset(PaletteData, 0xFF, 256*sizeof(s32)); + paletteData = new s32[256]; + memset(paletteData, 0xFF, 256*sizeof(s32)); file->read( tempPalette, 768 ); for( s32 i=0; i<256; i++ ) { - PaletteData[i] = (tempPalette[i*3+0] << 16) | + paletteData[i] = (tempPalette[i*3+0] << 16) | (tempPalette[i*3+1] << 8) | (tempPalette[i*3+2] ); } @@ -116,11 +103,11 @@ IImage* CImageLoaderPCX::loadImage(irr::io::IReadFile* file) } else if( header.BitsPerPixel == 4 ) { - PaletteData = new s32[16]; - memset(PaletteData, 0, 16*sizeof(s32)); + paletteData = new s32[16]; + memset(paletteData, 0, 16*sizeof(s32)); for( s32 i=0; i<256; i++ ) { - PaletteData[i] = (header.Palette[i*3+0] << 16) | + paletteData[i] = (header.Palette[i*3+0] << 16) | (header.Palette[i*3+1] << 8) | (header.Palette[i*3+2]); } @@ -131,7 +118,7 @@ IImage* CImageLoaderPCX::loadImage(irr::io::IReadFile* file) width = header.XMax - header.XMin + 1; height = header.YMax - header.YMin + 1; imagebytes = header.BytesPerLine * height * header.Planes * header.BitsPerPixel / 8; - PCXData = new u8[imagebytes]; + u8* PCXData = new u8[imagebytes]; u8 cnt, value; for( s32 offset = 0; offset < imagebytes; ) @@ -163,7 +150,7 @@ IImage* CImageLoaderPCX::loadImage(irr::io::IReadFile* file) case 8: image = new CImage(ECF_A1R5G5B5, core::dimension2d(width, height)); if (image) - CColorConverter::convert8BitTo16Bit(PCXData, (s16*)image->lock(), width, height, PaletteData, pitch); + CColorConverter::convert8BitTo16Bit(PCXData, (s16*)image->lock(), width, height, paletteData, pitch); break; case 24: image = new CImage(ECF_R8G8B8, core::dimension2d(width, height)); @@ -176,13 +163,8 @@ IImage* CImageLoaderPCX::loadImage(irr::io::IReadFile* file) // clean up - if( PaletteData ) - delete [] PaletteData; - PaletteData = 0; - - if( PCXData ) - delete [] PCXData; - PCXData = 0; + delete [] paletteData; + delete [] PCXData; return image; } diff --git a/source/Irrlicht/CImageLoaderPCX.h b/source/Irrlicht/CImageLoaderPCX.h index 5db2e1a6..6beb00da 100644 --- a/source/Irrlicht/CImageLoaderPCX.h +++ b/source/Irrlicht/CImageLoaderPCX.h @@ -67,23 +67,16 @@ public: //! constructor CImageLoaderPCX(); - //! destructor - virtual ~CImageLoaderPCX(); - //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! returns true if the file maybe is able to be loaded by this class - virtual bool isALoadableFileFormat(irr::io::IReadFile* file); + virtual bool isALoadableFileFormat(irr::io::IReadFile* file) const; //! creates a surface from the file - virtual IImage* loadImage(irr::io::IReadFile* file); + virtual IImage* loadImage(irr::io::IReadFile* file) const; -private: - - u8* PCXData; - s32* PaletteData; }; diff --git a/source/Irrlicht/CImageLoaderPNG.cpp b/source/Irrlicht/CImageLoaderPNG.cpp index dc88967f..01ae8574 100644 --- a/source/Irrlicht/CImageLoaderPNG.cpp +++ b/source/Irrlicht/CImageLoaderPNG.cpp @@ -36,7 +36,7 @@ void PNGAPI user_read_data_fcn(png_structp png_ptr, png_bytep data, png_size_t l png_size_t check; // changed by zola { - irr::io::IReadFile* file=(irr::io::IReadFile*)png_ptr->io_ptr; + io::IReadFile* file=(io::IReadFile*)png_ptr->io_ptr; check=(png_size_t) file->read((void*)data,length); // } @@ -57,7 +57,7 @@ CImageLoaderPng::~CImageLoaderPng() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") -bool CImageLoaderPng::isALoadableFileExtension(const c8* fileName) +bool CImageLoaderPng::isALoadableFileExtension(const c8* fileName) const { #ifdef _IRR_COMPILE_WITH_LIBPNG_ // added fix for file extension check by jox @@ -72,7 +72,7 @@ bool CImageLoaderPng::isALoadableFileExtension(const c8* fileName) //! returns true if the file maybe is able to be loaded by this class -bool CImageLoaderPng::isALoadableFileFormat(irr::io::IReadFile* file) +bool CImageLoaderPng::isALoadableFileFormat(io::IReadFile* file) const { #ifdef _IRR_COMPILE_WITH_LIBPNG_ if (!file) @@ -92,14 +92,15 @@ bool CImageLoaderPng::isALoadableFileFormat(irr::io::IReadFile* file) // load in the image data -IImage* CImageLoaderPng::loadImage(irr::io::IReadFile* file) +IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const { #ifdef _IRR_COMPILE_WITH_LIBPNG_ if (!file) return 0; - Image = 0; - RowPointers = 0; + video::IImage* image = 0; + //Used to point to image rows + u8** RowPointers = 0; png_byte buffer[8]; // Read the first few bytes of the PNG file @@ -150,6 +151,10 @@ IImage* CImageLoaderPng::loadImage(irr::io::IReadFile* file) png_read_info(png_ptr, info_ptr); // Read the info section of the png file + u32 Width; + u32 Height; + s32 BitDepth; + s32 ColorType; { // Use temporary variables to avoid passing casted pointers png_uint_32 w,h; @@ -208,10 +213,10 @@ IImage* CImageLoaderPng::loadImage(irr::io::IReadFile* file) // Create the image structure to be filled by png data if (ColorType==PNG_COLOR_TYPE_RGB_ALPHA) - Image = new CImage(ECF_A8R8G8B8, core::dimension2d(Width, Height)); + image = new CImage(ECF_A8R8G8B8, core::dimension2d(Width, Height)); else - Image = new CImage(ECF_R8G8B8, core::dimension2d(Width, Height)); - if (!Image) + image = new CImage(ECF_R8G8B8, core::dimension2d(Width, Height)); + if (!image) { os::Printer::log("LOAD PNG: Internal PNG create image struct failure\n", file->getFileName(), ELL_ERROR); png_destroy_read_struct(&png_ptr, NULL, NULL); @@ -224,16 +229,16 @@ IImage* CImageLoaderPng::loadImage(irr::io::IReadFile* file) { os::Printer::log("LOAD PNG: Internal PNG create row pointers failure\n", file->getFileName(), ELL_ERROR); png_destroy_read_struct(&png_ptr, NULL, NULL); - delete Image; + delete image; return 0; } // Fill array of pointers to rows in image data - unsigned char* data = (unsigned char*)Image->lock(); + unsigned char* data = (unsigned char*)image->lock(); for (u32 i=0; igetPitch(); + data += image->getPitch(); } // for proper error handling @@ -241,8 +246,8 @@ IImage* CImageLoaderPng::loadImage(irr::io::IReadFile* file) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); delete [] RowPointers; - Image->unlock(); - delete [] Image; + image->unlock(); + delete [] image; return 0; } @@ -251,10 +256,10 @@ IImage* CImageLoaderPng::loadImage(irr::io::IReadFile* file) png_read_end(png_ptr, NULL); delete [] RowPointers; - Image->unlock(); + image->unlock(); png_destroy_read_struct(&png_ptr,&info_ptr, 0); // Clean up memory - return Image; + return image; #else return 0; #endif // _IRR_COMPILE_WITH_LIBPNG_ diff --git a/source/Irrlicht/CImageLoaderPNG.h b/source/Irrlicht/CImageLoaderPNG.h index c24d188f..75d7ed91 100644 --- a/source/Irrlicht/CImageLoaderPNG.h +++ b/source/Irrlicht/CImageLoaderPNG.h @@ -29,22 +29,13 @@ public: //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".png") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! returns true if the file maybe is able to be loaded by this class - virtual bool isALoadableFileFormat(irr::io::IReadFile* file); + virtual bool isALoadableFileFormat(io::IReadFile* file) const; //! creates a surface from the file - virtual IImage* loadImage(irr::io::IReadFile* file); - -private: - //some variables - u32 Width; - u32 Height; - s32 BitDepth; - s32 ColorType; - video::IImage* Image; - u8** RowPointers; //Used to point to image rows + virtual IImage* loadImage(io::IReadFile* file) const; }; diff --git a/source/Irrlicht/CImageLoaderPSD.cpp b/source/Irrlicht/CImageLoaderPSD.cpp index 03029113..666879e1 100644 --- a/source/Irrlicht/CImageLoaderPSD.cpp +++ b/source/Irrlicht/CImageLoaderPSD.cpp @@ -17,7 +17,6 @@ namespace video //! constructor CImageLoaderPSD::CImageLoaderPSD() -: imageData(0) { #ifdef _DEBUG setDebugName("CImageLoaderPSD"); @@ -25,18 +24,9 @@ CImageLoaderPSD::CImageLoaderPSD() } - -//! destructor -CImageLoaderPSD::~CImageLoaderPSD() -{ - delete [] imageData; -} - - - //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".tga") -bool CImageLoaderPSD::isALoadableFileExtension(const c8* fileName) +bool CImageLoaderPSD::isALoadableFileExtension(const c8* fileName) const { return strstr(fileName, ".psd") != 0; } @@ -44,7 +34,7 @@ bool CImageLoaderPSD::isALoadableFileExtension(const c8* fileName) //! returns true if the file maybe is able to be loaded by this class -bool CImageLoaderPSD::isALoadableFileFormat(irr::io::IReadFile* file) +bool CImageLoaderPSD::isALoadableFileFormat(irr::io::IReadFile* file) const { if (!file) return false; @@ -57,11 +47,11 @@ bool CImageLoaderPSD::isALoadableFileFormat(irr::io::IReadFile* file) //! creates a surface from the file -IImage* CImageLoaderPSD::loadImage(irr::io::IReadFile* file) +IImage* CImageLoaderPSD::loadImage(irr::io::IReadFile* file) const { - delete [] imageData; - imageData = 0; + u32* imageData = 0; + PsdHeader header; file->read(&header, sizeof(PsdHeader)); #ifndef __BIG_ENDIAN__ @@ -149,9 +139,9 @@ IImage* CImageLoaderPSD::loadImage(irr::io::IReadFile* file) bool res = false; if (compressionType == 0) - res = readRawImageData(file); // RAW image data + res = readRawImageData(file, header, imageData); // RAW image data else - res = readRLEImageData(file); // RLE compressed data + res = readRLEImageData(file, header, imageData); // RLE compressed data video::IImage* image = 0; @@ -170,8 +160,7 @@ IImage* CImageLoaderPSD::loadImage(irr::io::IReadFile* file) } - -bool CImageLoaderPSD::readRawImageData(irr::io::IReadFile* file) +bool CImageLoaderPSD::readRawImageData(irr::io::IReadFile* file, const PsdHeader& header, u32* imageData) const { u8* tmpData = new u8[header.width * header.height]; @@ -183,18 +172,20 @@ bool CImageLoaderPSD::readRawImageData(irr::io::IReadFile* file) break; } - s16 shift = getShiftFromChannel(channel); + s16 shift = getShiftFromChannel(channel, header); if (shift != -1) { u32 mask = 0xff << shift; for (u32 x=0; xunlock(); + // Create array of pointers to rows in image data - RowPointers = new png_bytep[image->getDimension().Height]; + + //Used to point to image rows + u8** RowPointers = new png_bytep[image->getDimension().Height]; if (!RowPointers) { os::Printer::log("LOAD PNG: Internal PNG create row pointers failure\n", file->getFileName(), ELL_ERROR); diff --git a/source/Irrlicht/CImageWriterPNG.h b/source/Irrlicht/CImageWriterPNG.h index 441820b1..7fc8cbaa 100644 --- a/source/Irrlicht/CImageWriterPNG.h +++ b/source/Irrlicht/CImageWriterPNG.h @@ -15,12 +15,10 @@ public: CImageWriterPNG(); //! return true if this writer can write a file with the given extension - virtual bool isAWriteableFileExtension(const c8* fileName); + virtual bool isAWriteableFileExtension(const c8* fileName) const; //! write image to file - virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param); -private: - u8** RowPointers; //Used to point to image rows + virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param) const; }; } // namespace video diff --git a/source/Irrlicht/CImageWriterPPM.cpp b/source/Irrlicht/CImageWriterPPM.cpp index 86a21043..2213f003 100644 --- a/source/Irrlicht/CImageWriterPPM.cpp +++ b/source/Irrlicht/CImageWriterPPM.cpp @@ -22,12 +22,12 @@ CImageWriterPPM::CImageWriterPPM() #endif } -bool CImageWriterPPM::isAWriteableFileExtension(const c8* fileName) +bool CImageWriterPPM::isAWriteableFileExtension(const c8* fileName) const { return strstr(fileName, ".ppm") != 0; } -bool CImageWriterPPM::writeImage(io::IWriteFile *file, IImage *image,u32 param) +bool CImageWriterPPM::writeImage(io::IWriteFile *file, IImage *image,u32 param) const { char cache[70]; char size; diff --git a/source/Irrlicht/CImageWriterPPM.h b/source/Irrlicht/CImageWriterPPM.h index b3f91c57..2943fd2e 100644 --- a/source/Irrlicht/CImageWriterPPM.h +++ b/source/Irrlicht/CImageWriterPPM.h @@ -15,13 +15,14 @@ public: CImageWriterPPM(); //! return true if this writer can write a file with the given extension - virtual bool isAWriteableFileExtension(const c8* fileName); + virtual bool isAWriteableFileExtension(const c8* fileName) const; //! write image to file - virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param); + virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param) const; }; } // namespace video } // namespace irr #endif // _C_IMAGE_WRITER_PPM_H_INCLUDED__ + diff --git a/source/Irrlicht/CImageWriterPSD.cpp b/source/Irrlicht/CImageWriterPSD.cpp index d43b84e1..b4d59191 100644 --- a/source/Irrlicht/CImageWriterPSD.cpp +++ b/source/Irrlicht/CImageWriterPSD.cpp @@ -22,12 +22,12 @@ CImageWriterPSD::CImageWriterPSD() #endif } -bool CImageWriterPSD::isAWriteableFileExtension(const c8* fileName) +bool CImageWriterPSD::isAWriteableFileExtension(const c8* fileName) const { return strstr(fileName, ".psd") != 0; } -bool CImageWriterPSD::writeImage(io::IWriteFile *file, IImage *image,u32 param) +bool CImageWriterPSD::writeImage(io::IWriteFile *file, IImage *image,u32 param) const { os::Printer::log("PSD writer not yet implemented. Image not written.", ELL_WARNING); return false; diff --git a/source/Irrlicht/CImageWriterPSD.h b/source/Irrlicht/CImageWriterPSD.h index 3a42f06b..e06f4b2e 100644 --- a/source/Irrlicht/CImageWriterPSD.h +++ b/source/Irrlicht/CImageWriterPSD.h @@ -15,10 +15,10 @@ public: CImageWriterPSD(); //! return true if this writer can write a file with the given extension - virtual bool isAWriteableFileExtension(const c8* fileName); + virtual bool isAWriteableFileExtension(const c8* fileName) const; //! write image to file - virtual bool writeImage(io::IWriteFile *file, IImage *image,u32 param); + virtual bool writeImage(io::IWriteFile *file, IImage *image,u32 param) const; }; } // namespace video diff --git a/source/Irrlicht/CImageWriterTGA.cpp b/source/Irrlicht/CImageWriterTGA.cpp index a655ed9e..012449fb 100644 --- a/source/Irrlicht/CImageWriterTGA.cpp +++ b/source/Irrlicht/CImageWriterTGA.cpp @@ -22,12 +22,12 @@ CImageWriterTGA::CImageWriterTGA() #endif } -bool CImageWriterTGA::isAWriteableFileExtension(const c8* fileName) +bool CImageWriterTGA::isAWriteableFileExtension(const c8* fileName) const { return strstr(fileName, ".tga") != 0; } -bool CImageWriterTGA::writeImage(io::IWriteFile *file, IImage *image,u32 param) +bool CImageWriterTGA::writeImage(io::IWriteFile *file, IImage *image,u32 param) const { STGAHeader imageHeader; imageHeader.IdLength = 0; diff --git a/source/Irrlicht/CImageWriterTGA.h b/source/Irrlicht/CImageWriterTGA.h index 965cfc1b..052315da 100644 --- a/source/Irrlicht/CImageWriterTGA.h +++ b/source/Irrlicht/CImageWriterTGA.h @@ -15,10 +15,10 @@ public: CImageWriterTGA(); //! return true if this writer can write a file with the given extension - virtual bool isAWriteableFileExtension(const c8* fileName); + virtual bool isAWriteableFileExtension(const c8* fileName) const; //! write image to file - virtual bool writeImage(io::IWriteFile *file, IImage *image,u32 param); + virtual bool writeImage(io::IWriteFile *file, IImage *image,u32 param) const; }; } // namespace video diff --git a/source/Irrlicht/CIrrDeviceStub.cpp b/source/Irrlicht/CIrrDeviceStub.cpp index a305f521..607aec18 100644 --- a/source/Irrlicht/CIrrDeviceStub.cpp +++ b/source/Irrlicht/CIrrDeviceStub.cpp @@ -158,7 +158,7 @@ bool CIrrDeviceStub::checkVersion(const char* version) //! send the event to the right receiver -void CIrrDeviceStub::postEventFromUser(SEvent event) +void CIrrDeviceStub::postEventFromUser(const SEvent& event) { bool absorbed = false; diff --git a/source/Irrlicht/CIrrDeviceStub.h b/source/Irrlicht/CIrrDeviceStub.h index 45b11492..6796233b 100644 --- a/source/Irrlicht/CIrrDeviceStub.h +++ b/source/Irrlicht/CIrrDeviceStub.h @@ -80,7 +80,7 @@ namespace irr virtual const char* getVersion(); //! send the event to the right receiver - virtual void postEventFromUser(SEvent event); + virtual void postEventFromUser(const SEvent& event); //! Sets a new event receiver to receive events virtual void setEventReceiver(IEventReceiver* receiver); diff --git a/source/Irrlicht/CIrrMeshFileLoader.cpp b/source/Irrlicht/CIrrMeshFileLoader.cpp index 515882e4..1eba23d6 100644 --- a/source/Irrlicht/CIrrMeshFileLoader.cpp +++ b/source/Irrlicht/CIrrMeshFileLoader.cpp @@ -37,7 +37,7 @@ CIrrMeshFileLoader::~CIrrMeshFileLoader() //! Returns true if the file maybe is able to be loaded by this class. /** This decision should be based only on the file extension (e.g. ".cob") */ -bool CIrrMeshFileLoader::isALoadableFileExtension(const c8* fileName) +bool CIrrMeshFileLoader::isALoadableFileExtension(const c8* fileName) const { return strstr(fileName, ".xml") || strstr(fileName, ".irrmesh"); diff --git a/source/Irrlicht/CIrrMeshFileLoader.h b/source/Irrlicht/CIrrMeshFileLoader.h index 374e0335..4cea889b 100644 --- a/source/Irrlicht/CIrrMeshFileLoader.h +++ b/source/Irrlicht/CIrrMeshFileLoader.h @@ -33,7 +33,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); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CLMTSMeshFileLoader.cpp b/source/Irrlicht/CLMTSMeshFileLoader.cpp index b3eb0e9f..4ef9faab 100644 --- a/source/Irrlicht/CLMTSMeshFileLoader.cpp +++ b/source/Irrlicht/CLMTSMeshFileLoader.cpp @@ -138,19 +138,23 @@ CLMTSMeshFileLoader::~CLMTSMeshFileLoader() FileSystem->drop(); } -void CLMTSMeshFileLoader::cleanup() { +void CLMTSMeshFileLoader::cleanup() +{ delete [] Textures; delete [] TextureIDs; delete [] Subsets; delete [] Triangles; } -bool CLMTSMeshFileLoader::isALoadableFileExtension(const c8* filename) { + +bool CLMTSMeshFileLoader::isALoadableFileExtension(const c8* filename) const +{ return strstr(filename, ".lmts") != 0; } -IAnimatedMesh* CLMTSMeshFileLoader::createMesh(irr::io::IReadFile* file) { +IAnimatedMesh* CLMTSMeshFileLoader::createMesh(irr::io::IReadFile* file) +{ u32 i; u32 id; @@ -175,12 +179,16 @@ IAnimatedMesh* CLMTSMeshFileLoader::createMesh(irr::io::IReadFile* file) { NumLightMaps = NumTextures = 0; - for (i=0; iread(&Textures[i], sizeof(SLMTSTextureInfoEntry)); - if (Textures[i].Flags & 1) { + if (Textures[i].Flags & 1) + { TextureIDs[i] = NumLightMaps; NumLightMaps++; - } else { + } + else + { TextureIDs[i] = NumTextures; NumTextures++; } @@ -235,6 +243,7 @@ IAnimatedMesh* CLMTSMeshFileLoader::createMesh(irr::io::IReadFile* file) { return am; } + void CLMTSMeshFileLoader::constructMesh() { s32 i; @@ -292,6 +301,7 @@ void CLMTSMeshFileLoader::constructMesh() Mesh->recalculateBoundingBox(); } + void CLMTSMeshFileLoader::loadTextures() { if (!Driver || !FileSystem) @@ -328,30 +338,27 @@ void CLMTSMeshFileLoader::loadTextures() } - if (Textures[t].Flags & 1) { + if (Textures[t].Flags & 1) lig[lm_count++] = tmptex; - } else { + else tex[tx_count++] = tmptex; - } - } // attach textures to materials. s32 i; for (i=0; igetMeshBuffer(i); + { + SMeshBufferLightMap* b = (SMeshBufferLightMap*)Mesh->getMeshBuffer(i); - if (Subsets[i].TextID1 < Header.TextureCount) - b->Material.Textures[0] = tex[TextureIDs[Subsets[i].TextID1]]; - if (Subsets[i].TextID2 < Header.TextureCount) - b->Material.Textures[1] = lig[TextureIDs[Subsets[i].TextID2]]; - - if (!b->Material.Textures[1]) - b->Material.MaterialType = video::EMT_SOLID; - } + if (Subsets[i].TextID1 < Header.TextureCount) + b->Material.Textures[0] = tex[TextureIDs[Subsets[i].TextID1]]; + if (Subsets[i].TextID2 < Header.TextureCount) + b->Material.Textures[1] = lig[TextureIDs[Subsets[i].TextID2]]; + if (!b->Material.Textures[1]) + b->Material.MaterialType = video::EMT_SOLID; + } } diff --git a/source/Irrlicht/CLMTSMeshFileLoader.h b/source/Irrlicht/CLMTSMeshFileLoader.h index 0ec908a3..9da8d6a6 100644 --- a/source/Irrlicht/CLMTSMeshFileLoader.h +++ b/source/Irrlicht/CLMTSMeshFileLoader.h @@ -67,7 +67,7 @@ public: void cleanup(); - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; virtual IAnimatedMesh* createMesh(irr::io::IReadFile* file); @@ -159,3 +159,4 @@ private: } // end namespace irr #endif // !defined(__C_LMTS_MESH_FILE_LOADER_H_INCLUDED__) + diff --git a/source/Irrlicht/CLogger.cpp b/source/Irrlicht/CLogger.cpp index e78e69f7..4d4eb689 100644 --- a/source/Irrlicht/CLogger.cpp +++ b/source/Irrlicht/CLogger.cpp @@ -13,7 +13,7 @@ namespace irr } //! Returns the current set log level. - ELOG_LEVEL CLogger::getLogLevel() + ELOG_LEVEL CLogger::getLogLevel() const { return LogLevel; } diff --git a/source/Irrlicht/CLogger.h b/source/Irrlicht/CLogger.h index 740aa200..fc1c63ba 100644 --- a/source/Irrlicht/CLogger.h +++ b/source/Irrlicht/CLogger.h @@ -21,7 +21,7 @@ public: CLogger(IEventReceiver* r); //! Returns the current set log level. - virtual ELOG_LEVEL getLogLevel(); + virtual ELOG_LEVEL getLogLevel() const; //! Sets a new log level. virtual void setLogLevel(ELOG_LEVEL ll); virtual void setLogLevel(ELOG_LEVEL ll); diff --git a/source/Irrlicht/CMD2MeshFileLoader.cpp b/source/Irrlicht/CMD2MeshFileLoader.cpp index b02bd990..87875e1b 100644 --- a/source/Irrlicht/CMD2MeshFileLoader.cpp +++ b/source/Irrlicht/CMD2MeshFileLoader.cpp @@ -21,7 +21,7 @@ CMD2MeshFileLoader::CMD2MeshFileLoader() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool CMD2MeshFileLoader::isALoadableFileExtension(const c8* filename) +bool CMD2MeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".md2")!=0; } diff --git a/source/Irrlicht/CMD2MeshFileLoader.h b/source/Irrlicht/CMD2MeshFileLoader.h index ae27cbf2..1d2f9cf4 100644 --- a/source/Irrlicht/CMD2MeshFileLoader.h +++ b/source/Irrlicht/CMD2MeshFileLoader.h @@ -22,7 +22,7 @@ public: //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CMD3MeshFileLoader.cpp b/source/Irrlicht/CMD3MeshFileLoader.cpp index d2b73556..f5a59485 100644 --- a/source/Irrlicht/CMD3MeshFileLoader.cpp +++ b/source/Irrlicht/CMD3MeshFileLoader.cpp @@ -28,7 +28,7 @@ CMD3MeshFileLoader::~CMD3MeshFileLoader() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool CMD3MeshFileLoader::isALoadableFileExtension(const c8* filename) +bool CMD3MeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".md3") != 0; } diff --git a/source/Irrlicht/CMD3MeshFileLoader.h b/source/Irrlicht/CMD3MeshFileLoader.h index 7417c84e..7352dd63 100644 --- a/source/Irrlicht/CMD3MeshFileLoader.h +++ b/source/Irrlicht/CMD3MeshFileLoader.h @@ -29,7 +29,7 @@ public: //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CMS3DMeshFileLoader.cpp b/source/Irrlicht/CMS3DMeshFileLoader.cpp index f0390077..15cd19cf 100644 --- a/source/Irrlicht/CMS3DMeshFileLoader.cpp +++ b/source/Irrlicht/CMS3DMeshFileLoader.cpp @@ -105,7 +105,7 @@ CMS3DMeshFileLoader::CMS3DMeshFileLoader(video::IVideoDriver *driver) //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool CMS3DMeshFileLoader::isALoadableFileExtension(const c8* filename) +bool CMS3DMeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".ms3d")!=0; } diff --git a/source/Irrlicht/CMS3DMeshFileLoader.h b/source/Irrlicht/CMS3DMeshFileLoader.h index 99e0448f..d22cf891 100644 --- a/source/Irrlicht/CMS3DMeshFileLoader.h +++ b/source/Irrlicht/CMS3DMeshFileLoader.h @@ -24,7 +24,7 @@ public: //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/CMY3DMeshFileLoader.cpp b/source/Irrlicht/CMY3DMeshFileLoader.cpp index 632b7f2b..3efafe31 100644 --- a/source/Irrlicht/CMY3DMeshFileLoader.cpp +++ b/source/Irrlicht/CMY3DMeshFileLoader.cpp @@ -58,7 +58,7 @@ CMY3DMeshFileLoader::~CMY3DMeshFileLoader() -bool CMY3DMeshFileLoader::isALoadableFileExtension(const c8* filename) +bool CMY3DMeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".my3d") != 0; } diff --git a/source/Irrlicht/CMY3DMeshFileLoader.h b/source/Irrlicht/CMY3DMeshFileLoader.h index c393762c..0291acf4 100644 --- a/source/Irrlicht/CMY3DMeshFileLoader.h +++ b/source/Irrlicht/CMY3DMeshFileLoader.h @@ -54,7 +54,7 @@ public: io::IFileSystem* fs, video::IVideoDriver* driver, ISceneManager *scmgr); virtual ~CMY3DMeshFileLoader(); - virtual bool isALoadableFileExtension(const c8* fileName); + virtual bool isALoadableFileExtension(const c8* fileName) const; virtual IAnimatedMesh* createMesh(io::IReadFile* file); diff --git a/source/Irrlicht/CMeshSceneNode.cpp b/source/Irrlicht/CMeshSceneNode.cpp index 1b506a6b..9e510d0f 100644 --- a/source/Irrlicht/CMeshSceneNode.cpp +++ b/source/Irrlicht/CMeshSceneNode.cpp @@ -226,7 +226,7 @@ video::SMaterial& CMeshSceneNode::getMaterial(u32 i) //! returns amount of materials used by this scene node. -u32 CMeshSceneNode::getMaterialCount() +u32 CMeshSceneNode::getMaterialCount() const { if (Mesh && ReadOnlyMaterials) return Mesh->getMeshBufferCount(); diff --git a/source/Irrlicht/CMeshSceneNode.h b/source/Irrlicht/CMeshSceneNode.h index 9478c2f7..5bff6b21 100644 --- a/source/Irrlicht/CMeshSceneNode.h +++ b/source/Irrlicht/CMeshSceneNode.h @@ -43,7 +43,7 @@ namespace scene virtual video::SMaterial& getMaterial(u32 i); //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! Writes attributes of the scene node. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; diff --git a/source/Irrlicht/COBJMeshFileLoader.cpp b/source/Irrlicht/COBJMeshFileLoader.cpp index 96ff37fd..84d72275 100644 --- a/source/Irrlicht/COBJMeshFileLoader.cpp +++ b/source/Irrlicht/COBJMeshFileLoader.cpp @@ -48,7 +48,7 @@ COBJMeshFileLoader::~COBJMeshFileLoader() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool COBJMeshFileLoader::isALoadableFileExtension(const c8* filename) +bool COBJMeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".obj")!=0; } diff --git a/source/Irrlicht/COBJMeshFileLoader.h b/source/Irrlicht/COBJMeshFileLoader.h index 274f7b84..8ec1ba99 100644 --- a/source/Irrlicht/COBJMeshFileLoader.h +++ b/source/Irrlicht/COBJMeshFileLoader.h @@ -30,7 +30,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); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/COCTLoader.cpp b/source/Irrlicht/COCTLoader.cpp index ff79f3da..eec056ab 100644 --- a/source/Irrlicht/COCTLoader.cpp +++ b/source/Irrlicht/COCTLoader.cpp @@ -362,7 +362,7 @@ IAnimatedMesh* COCTLoader::createMesh(irr::io::IReadFile* file) //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool COCTLoader::isALoadableFileExtension(const c8* filename) +bool COCTLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".oct")!=0; } diff --git a/source/Irrlicht/COCTLoader.h b/source/Irrlicht/COCTLoader.h index 1a9340e1..f29dc568 100644 --- a/source/Irrlicht/COCTLoader.h +++ b/source/Irrlicht/COCTLoader.h @@ -69,7 +69,7 @@ namespace scene //! 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); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/COctTreeSceneNode.cpp b/source/Irrlicht/COctTreeSceneNode.cpp index 3b44848c..349acd86 100644 --- a/source/Irrlicht/COctTreeSceneNode.cpp +++ b/source/Irrlicht/COctTreeSceneNode.cpp @@ -343,7 +343,7 @@ video::SMaterial& COctTreeSceneNode::getMaterial(u32 i) } //! returns amount of materials used by this scene node. -u32 COctTreeSceneNode::getMaterialCount() +u32 COctTreeSceneNode::getMaterialCount() const { return Materials.size(); } diff --git a/source/Irrlicht/COctTreeSceneNode.h b/source/Irrlicht/COctTreeSceneNode.h index c58e4651..87f6718b 100644 --- a/source/Irrlicht/COctTreeSceneNode.h +++ b/source/Irrlicht/COctTreeSceneNode.h @@ -44,7 +44,7 @@ namespace scene virtual video::SMaterial& getMaterial(u32 i); //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! Writes attributes of the scene node. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; diff --git a/source/Irrlicht/COgreMeshFileLoader.cpp b/source/Irrlicht/COgreMeshFileLoader.cpp index eb2ce3ee..0b64bdd5 100644 --- a/source/Irrlicht/COgreMeshFileLoader.cpp +++ b/source/Irrlicht/COgreMeshFileLoader.cpp @@ -76,7 +76,7 @@ COgreMeshFileLoader::~COgreMeshFileLoader() //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool COgreMeshFileLoader::isALoadableFileExtension(const c8* filename) +bool COgreMeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".mesh")!=0; } diff --git a/source/Irrlicht/COgreMeshFileLoader.h b/source/Irrlicht/COgreMeshFileLoader.h index 166dd374..c78b94ef 100644 --- a/source/Irrlicht/COgreMeshFileLoader.h +++ b/source/Irrlicht/COgreMeshFileLoader.h @@ -34,7 +34,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); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed. diff --git a/source/Irrlicht/COpenGLMaterialRenderer.h b/source/Irrlicht/COpenGLMaterialRenderer.h index eb674a95..70166bd3 100644 --- a/source/Irrlicht/COpenGLMaterialRenderer.h +++ b/source/Irrlicht/COpenGLMaterialRenderer.h @@ -210,7 +210,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -264,7 +264,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -316,7 +316,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -353,7 +353,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return false; // this material is not really transparent because it does no blending. } @@ -658,7 +658,7 @@ public: } //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } diff --git a/source/Irrlicht/COpenGLNormalMapRenderer.cpp b/source/Irrlicht/COpenGLNormalMapRenderer.cpp index 066879d2..805c1ff6 100644 --- a/source/Irrlicht/COpenGLNormalMapRenderer.cpp +++ b/source/Irrlicht/COpenGLNormalMapRenderer.cpp @@ -233,7 +233,7 @@ COpenGLNormalMapRenderer::~COpenGLNormalMapRenderer() //! Returns the render capability of the material. -s32 COpenGLNormalMapRenderer::getRenderCapability() +s32 COpenGLNormalMapRenderer::getRenderCapability() const { if (Driver->queryFeature(video::EVDF_ARB_FRAGMENT_PROGRAM_1) && Driver->queryFeature(video::EVDF_ARB_VERTEX_PROGRAM_1)) diff --git a/source/Irrlicht/COpenGLNormalMapRenderer.h b/source/Irrlicht/COpenGLNormalMapRenderer.h index c54a37cf..42d46fe1 100644 --- a/source/Irrlicht/COpenGLNormalMapRenderer.h +++ b/source/Irrlicht/COpenGLNormalMapRenderer.h @@ -33,7 +33,7 @@ public: virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData); //! Returns the render capability of the material. - virtual s32 getRenderCapability(); + virtual s32 getRenderCapability() const; protected: diff --git a/source/Irrlicht/COpenGLParallaxMapRenderer.cpp b/source/Irrlicht/COpenGLParallaxMapRenderer.cpp index 23791009..ec237594 100644 --- a/source/Irrlicht/COpenGLParallaxMapRenderer.cpp +++ b/source/Irrlicht/COpenGLParallaxMapRenderer.cpp @@ -279,7 +279,7 @@ void COpenGLParallaxMapRenderer::OnSetMaterial(video::SMaterial& material, //! Returns the render capability of the material. -s32 COpenGLParallaxMapRenderer::getRenderCapability() +s32 COpenGLParallaxMapRenderer::getRenderCapability() const { if (Driver->queryFeature(video::EVDF_ARB_FRAGMENT_PROGRAM_1) && Driver->queryFeature(video::EVDF_ARB_VERTEX_PROGRAM_1)) diff --git a/source/Irrlicht/COpenGLParallaxMapRenderer.h b/source/Irrlicht/COpenGLParallaxMapRenderer.h index 336e9fa6..d895ea6f 100644 --- a/source/Irrlicht/COpenGLParallaxMapRenderer.h +++ b/source/Irrlicht/COpenGLParallaxMapRenderer.h @@ -33,7 +33,7 @@ public: virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData); //! Returns the render capability of the material. - virtual s32 getRenderCapability(); + virtual s32 getRenderCapability() const; virtual void OnSetMaterial(video::SMaterial& material, const video::SMaterial& lastMaterial, diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp index 51cbdd3c..7574c53a 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp @@ -156,7 +156,7 @@ void COpenGLSLMaterialRenderer::OnUnsetMaterial() } //! Returns if the material is transparent. -bool COpenGLSLMaterialRenderer::isTransparent() +bool COpenGLSLMaterialRenderer::isTransparent() const { return BaseMaterial ? BaseMaterial->isTransparent() : false; } diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.h b/source/Irrlicht/COpenGLSLMaterialRenderer.h index 19afebf0..ddb9ea12 100644 --- a/source/Irrlicht/COpenGLSLMaterialRenderer.h +++ b/source/Irrlicht/COpenGLSLMaterialRenderer.h @@ -73,7 +73,7 @@ public: virtual void OnUnsetMaterial(); //! Returns if the material is transparent. - virtual bool isTransparent(); + virtual bool isTransparent() const; // implementations for the render services virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates); diff --git a/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp b/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp index a2437c30..8a90f317 100644 --- a/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp +++ b/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp @@ -145,7 +145,7 @@ void COpenGLShaderMaterialRenderer::OnUnsetMaterial() } //! Returns if the material is transparent. -bool COpenGLShaderMaterialRenderer::isTransparent() +bool COpenGLShaderMaterialRenderer::isTransparent() const { return BaseMaterial ? BaseMaterial->isTransparent() : false; } diff --git a/source/Irrlicht/COpenGLShaderMaterialRenderer.h b/source/Irrlicht/COpenGLShaderMaterialRenderer.h index db544019..31e24e22 100644 --- a/source/Irrlicht/COpenGLShaderMaterialRenderer.h +++ b/source/Irrlicht/COpenGLShaderMaterialRenderer.h @@ -58,7 +58,7 @@ public: virtual void OnUnsetMaterial(); //! Returns if the material is transparent. - virtual bool isTransparent(); + virtual bool isTransparent() const; protected: diff --git a/source/Irrlicht/CParticleSystemSceneNode.cpp b/source/Irrlicht/CParticleSystemSceneNode.cpp index cc380242..615a24a9 100644 --- a/source/Irrlicht/CParticleSystemSceneNode.cpp +++ b/source/Irrlicht/CParticleSystemSceneNode.cpp @@ -105,7 +105,7 @@ video::SMaterial& CParticleSystemSceneNode::getMaterial(u32 i) //! Returns amount of materials used by this scene node. -u32 CParticleSystemSceneNode::getMaterialCount() +u32 CParticleSystemSceneNode::getMaterialCount() const { return 1; } diff --git a/source/Irrlicht/CParticleSystemSceneNode.h b/source/Irrlicht/CParticleSystemSceneNode.h index 852c1016..f706f87b 100644 --- a/source/Irrlicht/CParticleSystemSceneNode.h +++ b/source/Irrlicht/CParticleSystemSceneNode.h @@ -46,7 +46,7 @@ public: virtual video::SMaterial& getMaterial(u32 i); //! Returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! pre render event virtual void OnRegisterSceneNode(); diff --git a/source/Irrlicht/CQuake3ShaderSceneNode.cpp b/source/Irrlicht/CQuake3ShaderSceneNode.cpp index e1101859..5a46f445 100644 --- a/source/Irrlicht/CQuake3ShaderSceneNode.cpp +++ b/source/Irrlicht/CQuake3ShaderSceneNode.cpp @@ -684,7 +684,7 @@ const core::aabbox3d& CQuake3ShaderSceneNode::getBoundingBox() const } -u32 CQuake3ShaderSceneNode::getMaterialCount() +u32 CQuake3ShaderSceneNode::getMaterialCount() const { return Q3Texture.size(); } diff --git a/source/Irrlicht/CQuake3ShaderSceneNode.h b/source/Irrlicht/CQuake3ShaderSceneNode.h index 44bf7664..f2514957 100644 --- a/source/Irrlicht/CQuake3ShaderSceneNode.h +++ b/source/Irrlicht/CQuake3ShaderSceneNode.h @@ -33,7 +33,7 @@ public: virtual void OnAnimate(u32 timeMs); virtual const core::aabbox3d& getBoundingBox() const; - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; virtual video::SMaterial& getMaterial(u32 i); private: diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 74a4e229..be18609d 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -1569,7 +1569,7 @@ void CSceneManager::getSceneNodesFromType(ESCENE_NODE_TYPE type, core::arraygetMeshBufferCount(); - IMeshBuffer* b; + const IMeshBuffer* b; for (i=0; i& CShadowVolumeSceneNode::getBoundingBox() const } - -//! returns the material based on the zero based index i. -video::SMaterial& CShadowVolumeSceneNode::getMaterial(u32 i) -{ - // this should never be called, because a shadow volume has got no - // material - return *((video::SMaterial*)(0)); - -} - - - -//! returns amount of materials used by this scene node. -u32 CShadowVolumeSceneNode::getMaterialCount() -{ - return 0; -} - - //! Generates adjacency information based on mesh indices. void CShadowVolumeSceneNode::calculateAdjacency(f32 epsilon) { diff --git a/source/Irrlicht/CShadowVolumeSceneNode.h b/source/Irrlicht/CShadowVolumeSceneNode.h index be04ca7a..78cec134 100644 --- a/source/Irrlicht/CShadowVolumeSceneNode.h +++ b/source/Irrlicht/CShadowVolumeSceneNode.h @@ -25,7 +25,7 @@ namespace scene virtual ~CShadowVolumeSceneNode(); //! sets the mesh from which the shadow volume should be generated. - virtual void setMeshToRenderFrom(IMesh* mesh); + virtual void setMeshToRenderFrom(const IMesh* mesh); //! pre render method virtual void OnRegisterSceneNode(); @@ -36,12 +36,6 @@ namespace scene //! returns the axis aligned bounding box of this node virtual const core::aabbox3d& getBoundingBox() const; - //! returns the material based on the zero based index i. - virtual video::SMaterial& getMaterial(u32 i); - - //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); - //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const { return ESNT_SHADOW_VOLUME; } diff --git a/source/Irrlicht/CSkyBoxSceneNode.cpp b/source/Irrlicht/CSkyBoxSceneNode.cpp index b3eb3729..70fa1a66 100644 --- a/source/Irrlicht/CSkyBoxSceneNode.cpp +++ b/source/Irrlicht/CSkyBoxSceneNode.cpp @@ -237,7 +237,7 @@ video::SMaterial& CSkyBoxSceneNode::getMaterial(u32 i) //! returns amount of materials used by this scene node. -u32 CSkyBoxSceneNode::getMaterialCount() +u32 CSkyBoxSceneNode::getMaterialCount() const { return 6; } diff --git a/source/Irrlicht/CSkyBoxSceneNode.h b/source/Irrlicht/CSkyBoxSceneNode.h index efd5766e..9608bc29 100644 --- a/source/Irrlicht/CSkyBoxSceneNode.h +++ b/source/Irrlicht/CSkyBoxSceneNode.h @@ -42,7 +42,7 @@ namespace scene virtual video::SMaterial& getMaterial(u32 i); //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const { return ESNT_SKY_BOX; } diff --git a/source/Irrlicht/CSkyDomeSceneNode.cpp b/source/Irrlicht/CSkyDomeSceneNode.cpp index 4d6f6597..eb2d9bc8 100644 --- a/source/Irrlicht/CSkyDomeSceneNode.cpp +++ b/source/Irrlicht/CSkyDomeSceneNode.cpp @@ -161,7 +161,7 @@ video::SMaterial& CSkyDomeSceneNode::getMaterial(u32 i) //! returns amount of materials used by this scene node. -u32 CSkyDomeSceneNode::getMaterialCount() +u32 CSkyDomeSceneNode::getMaterialCount() const { return 1; } diff --git a/source/Irrlicht/CSkyDomeSceneNode.h b/source/Irrlicht/CSkyDomeSceneNode.h index e402b1ec..8422c989 100644 --- a/source/Irrlicht/CSkyDomeSceneNode.h +++ b/source/Irrlicht/CSkyDomeSceneNode.h @@ -25,7 +25,7 @@ class CSkyDomeSceneNode : public ISceneNode virtual void render(); virtual const core::aabbox3d& getBoundingBox() const; virtual video::SMaterial& getMaterial(u32 i); - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; virtual ESCENE_NODE_TYPE getType() const { return ESNT_SKY_BOX; } private: diff --git a/source/Irrlicht/CSoftware2MaterialRenderer.h b/source/Irrlicht/CSoftware2MaterialRenderer.h index 6037f5e5..0ba49e0d 100644 --- a/source/Irrlicht/CSoftware2MaterialRenderer.h +++ b/source/Irrlicht/CSoftware2MaterialRenderer.h @@ -39,7 +39,7 @@ public: :CSoftware2MaterialRenderer ( driver ) {} //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return false; } @@ -53,11 +53,11 @@ class CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR : public CSoftware2Materi { public: CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR ( video::CSoftwareDriver2* driver ) - :CSoftware2MaterialRenderer ( driver ) {} + : CSoftware2MaterialRenderer ( driver ) {} //! Returns if the material is transparent. - virtual bool isTransparent() + virtual bool isTransparent() const { return true; } @@ -69,9 +69,9 @@ class CSoftware2MaterialRenderer_UNSUPPORTED : public CSoftware2MaterialRenderer { public: CSoftware2MaterialRenderer_UNSUPPORTED ( video::CSoftwareDriver2* driver ) - :CSoftware2MaterialRenderer ( driver ) {} + : CSoftware2MaterialRenderer ( driver ) {} - virtual s32 getRenderCapability() { return 1; } + virtual s32 getRenderCapability() const { return 1; } }; diff --git a/source/Irrlicht/CSphereSceneNode.cpp b/source/Irrlicht/CSphereSceneNode.cpp index a36e157c..dbaa081f 100644 --- a/source/Irrlicht/CSphereSceneNode.cpp +++ b/source/Irrlicht/CSphereSceneNode.cpp @@ -90,7 +90,7 @@ video::SMaterial& CSphereSceneNode::getMaterial(u32 i) //! returns amount of materials used by this scene node. -u32 CSphereSceneNode::getMaterialCount() +u32 CSphereSceneNode::getMaterialCount() const { return 1; } diff --git a/source/Irrlicht/CSphereSceneNode.h b/source/Irrlicht/CSphereSceneNode.h index 8a784ebb..24b0ed61 100644 --- a/source/Irrlicht/CSphereSceneNode.h +++ b/source/Irrlicht/CSphereSceneNode.h @@ -41,7 +41,7 @@ namespace scene virtual video::SMaterial& getMaterial(u32 i); //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const { return ESNT_SPHERE; } diff --git a/source/Irrlicht/CTerrainSceneNode.h b/source/Irrlicht/CTerrainSceneNode.h index 2f57402b..23094b13 100644 --- a/source/Irrlicht/CTerrainSceneNode.h +++ b/source/Irrlicht/CTerrainSceneNode.h @@ -70,7 +70,7 @@ namespace scene //! Returns amount of materials used by this scene node ( always 1 ) //! \return Returns current count of materials used by this scene node ( always 1 ) - virtual u32 getMaterialCount() + virtual u32 getMaterialCount() const { return Mesh.getMeshBufferCount(); } diff --git a/source/Irrlicht/CTextSceneNode.cpp b/source/Irrlicht/CTextSceneNode.cpp index 277e0f3f..355989c1 100644 --- a/source/Irrlicht/CTextSceneNode.cpp +++ b/source/Irrlicht/CTextSceneNode.cpp @@ -388,7 +388,7 @@ video::SMaterial& CBillboardTextSceneNode::getMaterial(u32 i) //! returns amount of materials used by this scene node. -u32 CBillboardTextSceneNode::getMaterialCount() +u32 CBillboardTextSceneNode::getMaterialCount() const { if (Mesh) return Mesh->getMeshBufferCount(); diff --git a/source/Irrlicht/CTextSceneNode.h b/source/Irrlicht/CTextSceneNode.h index 0d9adc43..81edb427 100644 --- a/source/Irrlicht/CTextSceneNode.h +++ b/source/Irrlicht/CTextSceneNode.h @@ -91,7 +91,7 @@ namespace scene virtual video::SMaterial& getMaterial(u32 i); //! returns amount of materials used by this scene node. - virtual u32 getMaterialCount(); + virtual u32 getMaterialCount() const; //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const { return ESNT_TEXT; } diff --git a/source/Irrlicht/CXMeshFileLoader.cpp b/source/Irrlicht/CXMeshFileLoader.cpp index 39db26da..88492bd2 100644 --- a/source/Irrlicht/CXMeshFileLoader.cpp +++ b/source/Irrlicht/CXMeshFileLoader.cpp @@ -35,7 +35,7 @@ CXMeshFileLoader::CXMeshFileLoader(scene::ISceneManager* smgr) //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".bsp") -bool CXMeshFileLoader::isALoadableFileExtension(const c8* filename) +bool CXMeshFileLoader::isALoadableFileExtension(const c8* filename) const { return strstr(filename, ".x") != 0; } diff --git a/source/Irrlicht/CXMeshFileLoader.h b/source/Irrlicht/CXMeshFileLoader.h index 885c9bf6..1cd9cbbd 100644 --- a/source/Irrlicht/CXMeshFileLoader.h +++ b/source/Irrlicht/CXMeshFileLoader.h @@ -30,7 +30,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); + virtual bool isALoadableFileExtension(const c8* fileName) const; //! creates/loads an animated mesh from the file. //! \return Pointer to the created mesh. Returns 0 if loading failed.