aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/include')
-rw-r--r--src/others/irrlicht-1.8.1/include/CDynamicMeshBuffer.h116
-rw-r--r--src/others/irrlicht-1.8.1/include/CIndexBuffer.h226
-rw-r--r--src/others/irrlicht-1.8.1/include/CMeshBuffer.h301
-rw-r--r--src/others/irrlicht-1.8.1/include/CVertexBuffer.h210
-rw-r--r--src/others/irrlicht-1.8.1/include/EAttributes.h101
-rw-r--r--src/others/irrlicht-1.8.1/include/ECullingTypes.h41
-rw-r--r--src/others/irrlicht-1.8.1/include/EDebugSceneTypes.h50
-rw-r--r--src/others/irrlicht-1.8.1/include/EDeviceTypes.h60
-rw-r--r--src/others/irrlicht-1.8.1/include/EDriverFeatures.h133
-rw-r--r--src/others/irrlicht-1.8.1/include/EDriverTypes.h64
-rw-r--r--src/others/irrlicht-1.8.1/include/EGUIAlignment.h38
-rw-r--r--src/others/irrlicht-1.8.1/include/EGUIElementTypes.h140
-rw-r--r--src/others/irrlicht-1.8.1/include/EHardwareBufferFlags.h44
-rw-r--r--src/others/irrlicht-1.8.1/include/EMaterialFlags.h95
-rw-r--r--src/others/irrlicht-1.8.1/include/EMaterialTypes.h234
-rw-r--r--src/others/irrlicht-1.8.1/include/EMeshWriterEnums.h59
-rw-r--r--src/others/irrlicht-1.8.1/include/EMessageBoxFlags.h36
-rw-r--r--src/others/irrlicht-1.8.1/include/EPrimitiveTypes.h56
-rw-r--r--src/others/irrlicht-1.8.1/include/ESceneNodeAnimatorTypes.h58
-rw-r--r--src/others/irrlicht-1.8.1/include/ESceneNodeTypes.h106
-rw-r--r--src/others/irrlicht-1.8.1/include/EShaderTypes.h90
-rw-r--r--src/others/irrlicht-1.8.1/include/ETerrainElements.h36
-rw-r--r--src/others/irrlicht-1.8.1/include/IAnimatedMesh.h115
-rw-r--r--src/others/irrlicht-1.8.1/include/IAnimatedMeshMD2.h79
-rw-r--r--src/others/irrlicht-1.8.1/include/IAnimatedMeshMD3.h304
-rw-r--r--src/others/irrlicht-1.8.1/include/IAnimatedMeshSceneNode.h228
-rw-r--r--src/others/irrlicht-1.8.1/include/IAttributeExchangingObject.h71
-rw-r--r--src/others/irrlicht-1.8.1/include/IAttributes.h738
-rw-r--r--src/others/irrlicht-1.8.1/include/IBillboardSceneNode.h75
-rw-r--r--src/others/irrlicht-1.8.1/include/IBillboardTextSceneNode.h62
-rw-r--r--src/others/irrlicht-1.8.1/include/IBoneSceneNode.h108
-rw-r--r--src/others/irrlicht-1.8.1/include/ICameraSceneNode.h207
-rw-r--r--src/others/irrlicht-1.8.1/include/IColladaMeshWriter.h405
-rw-r--r--src/others/irrlicht-1.8.1/include/ICursorControl.h192
-rw-r--r--src/others/irrlicht-1.8.1/include/IDummyTransformationSceneNode.h42
-rw-r--r--src/others/irrlicht-1.8.1/include/IDynamicMeshBuffer.h211
-rw-r--r--src/others/irrlicht-1.8.1/include/IEventReceiver.h490
-rw-r--r--src/others/irrlicht-1.8.1/include/IFileArchive.h132
-rw-r--r--src/others/irrlicht-1.8.1/include/IFileList.h94
-rw-r--r--src/others/irrlicht-1.8.1/include/IFileSystem.h385
-rw-r--r--src/others/irrlicht-1.8.1/include/IGPUProgrammingServices.h474
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIButton.h151
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUICheckBox.h38
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIColorSelectDialog.h30
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIComboBox.h74
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIContextMenu.h162
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIEditBox.h135
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIElement.h1037
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIElementFactory.h66
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIEnvironment.h620
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIFileOpenDialog.h44
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIFont.h104
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIFontBitmap.h46
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIImage.h58
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIImageList.h45
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIInOutFader.h67
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIListBox.h138
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIMeshViewer.h53
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIScrollBar.h65
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUISkin.h574
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUISpinBox.h69
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUISpriteBank.h95
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIStaticText.h135
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUITabControl.h136
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUITable.h205
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIToolbar.h40
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUITreeView.h278
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUIWindow.h74
-rw-r--r--src/others/irrlicht-1.8.1/include/IGeometryCreator.h177
-rw-r--r--src/others/irrlicht-1.8.1/include/IImage.h155
-rw-r--r--src/others/irrlicht-1.8.1/include/IImageLoader.h53
-rw-r--r--src/others/irrlicht-1.8.1/include/IImageWriter.h45
-rw-r--r--src/others/irrlicht-1.8.1/include/IIndexBuffer.h65
-rw-r--r--src/others/irrlicht-1.8.1/include/ILightManager.h62
-rw-r--r--src/others/irrlicht-1.8.1/include/ILightSceneNode.h86
-rw-r--r--src/others/irrlicht-1.8.1/include/ILogger.h102
-rw-r--r--src/others/irrlicht-1.8.1/include/IMaterialRenderer.h101
-rw-r--r--src/others/irrlicht-1.8.1/include/IMaterialRendererServices.h115
-rw-r--r--src/others/irrlicht-1.8.1/include/IMesh.h75
-rw-r--r--src/others/irrlicht-1.8.1/include/IMeshBuffer.h154
-rw-r--r--src/others/irrlicht-1.8.1/include/IMeshCache.h177
-rw-r--r--src/others/irrlicht-1.8.1/include/IMeshLoader.h53
-rw-r--r--src/others/irrlicht-1.8.1/include/IMeshManipulator.h393
-rw-r--r--src/others/irrlicht-1.8.1/include/IMeshSceneNode.h79
-rw-r--r--src/others/irrlicht-1.8.1/include/IMeshWriter.h58
-rw-r--r--src/others/irrlicht-1.8.1/include/IMetaTriangleSelector.h43
-rw-r--r--src/others/irrlicht-1.8.1/include/IOSOperator.h50
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleAffector.h72
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleAnimatedMeshSceneNodeEmitter.h54
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleAttractionAffector.h59
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleBoxEmitter.h36
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleCylinderEmitter.h59
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleEmitter.h129
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleFadeOutAffector.h41
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleGravityAffector.h42
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleMeshEmitter.h54
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleRingEmitter.h47
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleRotationAffector.h41
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleSphereEmitter.h41
-rw-r--r--src/others/irrlicht-1.8.1/include/IParticleSystemSceneNode.h512
-rw-r--r--src/others/irrlicht-1.8.1/include/IQ3LevelMesh.h46
-rw-r--r--src/others/irrlicht-1.8.1/include/IQ3Shader.h885
-rw-r--r--src/others/irrlicht-1.8.1/include/IRandomizer.h33
-rw-r--r--src/others/irrlicht-1.8.1/include/IReadFile.h58
-rw-r--r--src/others/irrlicht-1.8.1/include/IReferenceCounted.h170
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneCollisionManager.h205
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneLoader.h62
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneManager.h1663
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneNode.h858
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneNodeAnimator.h78
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCameraFPS.h69
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCameraMaya.h58
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCollisionResponse.h171
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorFactory.h69
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneNodeFactory.h68
-rw-r--r--src/others/irrlicht-1.8.1/include/ISceneUserDataSerializer.h51
-rw-r--r--src/others/irrlicht-1.8.1/include/IShaderConstantSetCallBack.h85
-rw-r--r--src/others/irrlicht-1.8.1/include/IShadowVolumeSceneNode.h38
-rw-r--r--src/others/irrlicht-1.8.1/include/ISkinnedMesh.h219
-rw-r--r--src/others/irrlicht-1.8.1/include/ITerrainSceneNode.h182
-rw-r--r--src/others/irrlicht-1.8.1/include/ITextSceneNode.h37
-rw-r--r--src/others/irrlicht-1.8.1/include/ITexture.h219
-rw-r--r--src/others/irrlicht-1.8.1/include/ITimer.h103
-rw-r--r--src/others/irrlicht-1.8.1/include/ITriangleSelector.h131
-rw-r--r--src/others/irrlicht-1.8.1/include/IVertexBuffer.h52
-rw-r--r--src/others/irrlicht-1.8.1/include/IVideoDriver.h1471
-rw-r--r--src/others/irrlicht-1.8.1/include/IVideoModeList.h62
-rw-r--r--src/others/irrlicht-1.8.1/include/IVolumeLightSceneNode.h60
-rw-r--r--src/others/irrlicht-1.8.1/include/IWriteFile.h50
-rw-r--r--src/others/irrlicht-1.8.1/include/IXMLReader.h31
-rw-r--r--src/others/irrlicht-1.8.1/include/IXMLWriter.h77
-rw-r--r--src/others/irrlicht-1.8.1/include/IrrCompileConfig.h832
-rw-r--r--src/others/irrlicht-1.8.1/include/IrrlichtDevice.h322
-rw-r--r--src/others/irrlicht-1.8.1/include/Keycodes.h173
-rw-r--r--src/others/irrlicht-1.8.1/include/S3DVertex.h274
-rw-r--r--src/others/irrlicht-1.8.1/include/SAnimatedMesh.h189
-rw-r--r--src/others/irrlicht-1.8.1/include/SColor.h697
-rw-r--r--src/others/irrlicht-1.8.1/include/SExposedVideoData.h90
-rw-r--r--src/others/irrlicht-1.8.1/include/SIrrCreationParameters.h308
-rw-r--r--src/others/irrlicht-1.8.1/include/SKeyMap.h41
-rw-r--r--src/others/irrlicht-1.8.1/include/SLight.h98
-rw-r--r--src/others/irrlicht-1.8.1/include/SMaterial.h685
-rw-r--r--src/others/irrlicht-1.8.1/include/SMaterialLayer.h228
-rw-r--r--src/others/irrlicht-1.8.1/include/SMesh.h140
-rw-r--r--src/others/irrlicht-1.8.1/include/SMeshBuffer.h7
-rw-r--r--src/others/irrlicht-1.8.1/include/SMeshBufferLightMap.h7
-rw-r--r--src/others/irrlicht-1.8.1/include/SMeshBufferTangents.h7
-rw-r--r--src/others/irrlicht-1.8.1/include/SParticle.h56
-rw-r--r--src/others/irrlicht-1.8.1/include/SSharedMeshBuffer.h242
-rw-r--r--src/others/irrlicht-1.8.1/include/SSkinMeshBuffer.h404
-rw-r--r--src/others/irrlicht-1.8.1/include/SVertexIndex.h79
-rw-r--r--src/others/irrlicht-1.8.1/include/SVertexManipulator.h292
-rw-r--r--src/others/irrlicht-1.8.1/include/SViewFrustum.h370
-rw-r--r--src/others/irrlicht-1.8.1/include/SceneParameters.h182
-rw-r--r--src/others/irrlicht-1.8.1/include/aabbox3d.h332
-rw-r--r--src/others/irrlicht-1.8.1/include/coreutil.h188
-rw-r--r--src/others/irrlicht-1.8.1/include/dimension2d.h224
-rw-r--r--src/others/irrlicht-1.8.1/include/driverChoice.h45
-rw-r--r--src/others/irrlicht-1.8.1/include/fast_atof.h364
-rw-r--r--src/others/irrlicht-1.8.1/include/heapsort.h70
-rw-r--r--src/others/irrlicht-1.8.1/include/irrAllocator.h124
-rw-r--r--src/others/irrlicht-1.8.1/include/irrArray.h627
-rw-r--r--src/others/irrlicht-1.8.1/include/irrList.h416
-rw-r--r--src/others/irrlicht-1.8.1/include/irrMap.h1127
-rw-r--r--src/others/irrlicht-1.8.1/include/irrMath.h732
-rw-r--r--src/others/irrlicht-1.8.1/include/irrString.h1368
-rw-r--r--src/others/irrlicht-1.8.1/include/irrTypes.h250
-rw-r--r--src/others/irrlicht-1.8.1/include/irrXML.h575
-rw-r--r--src/others/irrlicht-1.8.1/include/irrlicht.h394
-rw-r--r--src/others/irrlicht-1.8.1/include/irrpack.h39
-rw-r--r--src/others/irrlicht-1.8.1/include/irrunpack.h20
-rw-r--r--src/others/irrlicht-1.8.1/include/line2d.h274
-rw-r--r--src/others/irrlicht-1.8.1/include/line3d.h144
-rw-r--r--src/others/irrlicht-1.8.1/include/matrix4.h2242
-rw-r--r--src/others/irrlicht-1.8.1/include/path.h88
-rw-r--r--src/others/irrlicht-1.8.1/include/plane3d.h245
-rw-r--r--src/others/irrlicht-1.8.1/include/position2d.h32
-rw-r--r--src/others/irrlicht-1.8.1/include/quaternion.h696
-rw-r--r--src/others/irrlicht-1.8.1/include/rect.h279
-rw-r--r--src/others/irrlicht-1.8.1/include/triangle3d.h279
-rw-r--r--src/others/irrlicht-1.8.1/include/vector2d.h342
-rw-r--r--src/others/irrlicht-1.8.1/include/vector3d.h458
182 files changed, 39533 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/include/CDynamicMeshBuffer.h b/src/others/irrlicht-1.8.1/include/CDynamicMeshBuffer.h
new file mode 100644
index 0000000..9b08f36
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/CDynamicMeshBuffer.h
@@ -0,0 +1,116 @@
1// Copyright (C) 2008-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_DYNAMIC_MESHBUFFER_H_INCLUDED__
6#define __C_DYNAMIC_MESHBUFFER_H_INCLUDED__
7
8#include "IDynamicMeshBuffer.h"
9
10#include "CVertexBuffer.h"
11#include "CIndexBuffer.h"
12
13namespace irr
14{
15namespace scene
16{
17
18 class CDynamicMeshBuffer: public IDynamicMeshBuffer
19 {
20 public:
21 //! constructor
22 CDynamicMeshBuffer(video::E_VERTEX_TYPE vertexType, video::E_INDEX_TYPE indexType)
23 {
24 VertexBuffer=new CVertexBuffer(vertexType);
25 IndexBuffer=new CIndexBuffer(indexType);
26 }
27
28 //! destructor
29 virtual ~CDynamicMeshBuffer()
30 {
31 if (VertexBuffer)
32 VertexBuffer->drop();
33 if (IndexBuffer)
34 IndexBuffer->drop();
35 }
36
37 virtual IVertexBuffer& getVertexBuffer() const
38 {
39 return *VertexBuffer;
40 }
41
42 virtual IIndexBuffer& getIndexBuffer() const
43 {
44 return *IndexBuffer;
45 }
46
47 virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer)
48 {
49 if (newVertexBuffer)
50 newVertexBuffer->grab();
51 if (VertexBuffer)
52 VertexBuffer->drop();
53
54 VertexBuffer=newVertexBuffer;
55 }
56
57 virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer)
58 {
59 if (newIndexBuffer)
60 newIndexBuffer->grab();
61 if (IndexBuffer)
62 IndexBuffer->drop();
63
64 IndexBuffer=newIndexBuffer;
65 }
66
67 //! Get Material of this buffer.
68 virtual const video::SMaterial& getMaterial() const
69 {
70 return Material;
71 }
72
73 //! Get Material of this buffer.
74 virtual video::SMaterial& getMaterial()
75 {
76 return Material;
77 }
78
79 //! Get bounding box
80 virtual const core::aabbox3d<f32>& getBoundingBox() const
81 {
82 return BoundingBox;
83 }
84
85 //! Set bounding box
86 virtual void setBoundingBox( const core::aabbox3df& box)
87 {
88 BoundingBox = box;
89 }
90
91 //! Recalculate bounding box
92 virtual void recalculateBoundingBox()
93 {
94 if (!getVertexBuffer().size())
95 BoundingBox.reset(0,0,0);
96 else
97 {
98 BoundingBox.reset(getVertexBuffer()[0].Pos);
99 for (u32 i=1; i<getVertexBuffer().size(); ++i)
100 BoundingBox.addInternalPoint(getVertexBuffer()[i].Pos);
101 }
102 }
103
104 video::SMaterial Material;
105 core::aabbox3d<f32> BoundingBox;
106 private:
107 IVertexBuffer *VertexBuffer;
108 IIndexBuffer *IndexBuffer;
109 };
110
111
112} // end namespace scene
113} // end namespace irr
114
115#endif
116
diff --git a/src/others/irrlicht-1.8.1/include/CIndexBuffer.h b/src/others/irrlicht-1.8.1/include/CIndexBuffer.h
new file mode 100644
index 0000000..b0bb436
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/CIndexBuffer.h
@@ -0,0 +1,226 @@
1// Copyright (C) 2008-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_INDEX_BUFFER_H_INCLUDED__
6#define __C_INDEX_BUFFER_H_INCLUDED__
7
8#include "IIndexBuffer.h"
9
10namespace irr
11{
12namespace scene
13{
14
15 class CIndexBuffer : public IIndexBuffer
16 {
17
18 class IIndexList
19 {
20 public:
21 virtual ~IIndexList(){};
22
23 virtual u32 stride() const =0;
24 virtual u32 size() const =0;
25 virtual void push_back(const u32 &element) =0;
26 virtual u32 operator [](u32 index) const =0;
27 virtual u32 getLast() =0;
28 virtual void setValue(u32 index, u32 value) =0;
29 virtual void set_used(u32 usedNow) =0;
30 virtual void reallocate(u32 new_size) =0;
31 virtual u32 allocated_size() const =0;
32 virtual void* pointer() =0;
33 virtual video::E_INDEX_TYPE getType() const =0;
34 };
35
36 template <class T>
37 class CSpecificIndexList : public IIndexList
38 {
39 public:
40 core::array<T> Indices;
41
42 virtual u32 stride() const {return sizeof(T);}
43
44 virtual u32 size() const {return Indices.size();}
45
46 virtual void push_back(const u32 &element)
47 {
48 // push const ref due to compiler problem with gcc 4.6, big endian
49 Indices.push_back((const T&)element);
50 }
51
52 virtual u32 operator [](u32 index) const
53 {
54 return (u32)(Indices[index]);
55 }
56
57 virtual u32 getLast() {return (u32)Indices.getLast();}
58
59 virtual void setValue(u32 index, u32 value)
60 {
61 Indices[index]=(T)value;
62 }
63
64 virtual void set_used(u32 usedNow)
65 {
66 Indices.set_used(usedNow);
67 }
68
69 virtual void reallocate(u32 new_size)
70 {
71 Indices.reallocate(new_size);
72 }
73
74 virtual u32 allocated_size() const
75 {
76 return Indices.allocated_size();
77 }
78
79 virtual void* pointer() {return Indices.pointer();}
80
81 virtual video::E_INDEX_TYPE getType() const
82 {
83 if (sizeof(T)==sizeof(u16))
84 return video::EIT_16BIT;
85 else
86 return video::EIT_32BIT;
87 }
88 };
89
90 public:
91 IIndexList *Indices;
92
93 CIndexBuffer(video::E_INDEX_TYPE IndexType) :Indices(0), MappingHint(EHM_NEVER), ChangedID(1)
94 {
95 setType(IndexType);
96 }
97
98 CIndexBuffer(const IIndexBuffer &IndexBufferCopy) :Indices(0), MappingHint(EHM_NEVER), ChangedID(1)
99 {
100 setType(IndexBufferCopy.getType());
101 reallocate(IndexBufferCopy.size());
102
103 for (u32 n=0;n<IndexBufferCopy.size();++n)
104 push_back(IndexBufferCopy[n]);
105 }
106
107 virtual ~CIndexBuffer()
108 {
109 delete Indices;
110 }
111
112 //virtual void setType(video::E_INDEX_TYPE IndexType);
113 virtual void setType(video::E_INDEX_TYPE IndexType)
114 {
115 IIndexList *NewIndices=0;
116
117 switch (IndexType)
118 {
119 case video::EIT_16BIT:
120 {
121 NewIndices=new CSpecificIndexList<u16>;
122 break;
123 }
124 case video::EIT_32BIT:
125 {
126 NewIndices=new CSpecificIndexList<u32>;
127 break;
128 }
129 }
130
131 if (Indices)
132 {
133 NewIndices->reallocate( Indices->size() );
134
135 for(u32 n=0;n<Indices->size();++n)
136 NewIndices->push_back((*Indices)[n]);
137
138 delete Indices;
139 }
140
141 Indices=NewIndices;
142 }
143
144 virtual void* getData() {return Indices->pointer();}
145
146 virtual video::E_INDEX_TYPE getType() const {return Indices->getType();}
147
148 virtual u32 stride() const {return Indices->stride();}
149
150 virtual u32 size() const
151 {
152 return Indices->size();
153 }
154
155 virtual void push_back(const u32 &element)
156 {
157 Indices->push_back(element);
158 }
159
160 virtual u32 operator [](u32 index) const
161 {
162 return (*Indices)[index];
163 }
164
165 virtual u32 getLast()
166 {
167 return Indices->getLast();
168 }
169
170 virtual void setValue(u32 index, u32 value)
171 {
172 Indices->setValue(index, value);
173 }
174
175 virtual void set_used(u32 usedNow)
176 {
177 Indices->set_used(usedNow);
178 }
179
180 virtual void reallocate(u32 new_size)
181 {
182 Indices->reallocate(new_size);
183 }
184
185 virtual u32 allocated_size() const
186 {
187 return Indices->allocated_size();
188 }
189
190 virtual void* pointer()
191 {
192 return Indices->pointer();
193 }
194
195 //! get the current hardware mapping hint
196 virtual E_HARDWARE_MAPPING getHardwareMappingHint() const
197 {
198 return MappingHint;
199 }
200
201 //! set the hardware mapping hint, for driver
202 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint )
203 {
204 MappingHint=NewMappingHint;
205 }
206
207 //! flags the mesh as changed, reloads hardware buffers
208 virtual void setDirty()
209 {
210 ++ChangedID;
211 }
212
213 //! Get the currently used ID for identification of changes.
214 /** This shouldn't be used for anything outside the VideoDriver. */
215 virtual u32 getChangedID() const {return ChangedID;}
216
217 E_HARDWARE_MAPPING MappingHint;
218 u32 ChangedID;
219 };
220
221
222} // end namespace scene
223} // end namespace irr
224
225#endif
226
diff --git a/src/others/irrlicht-1.8.1/include/CMeshBuffer.h b/src/others/irrlicht-1.8.1/include/CMeshBuffer.h
new file mode 100644
index 0000000..7512a38
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/CMeshBuffer.h
@@ -0,0 +1,301 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __T_MESH_BUFFER_H_INCLUDED__
6#define __T_MESH_BUFFER_H_INCLUDED__
7
8#include "irrArray.h"
9#include "IMeshBuffer.h"
10
11namespace irr
12{
13namespace scene
14{
15 //! Template implementation of the IMeshBuffer interface
16 template <class T>
17 class CMeshBuffer : public IMeshBuffer
18 {
19 public:
20 //! Default constructor for empty meshbuffer
21 CMeshBuffer():ChangedID_Vertex(1),ChangedID_Index(1),MappingHint_Vertex(EHM_NEVER), MappingHint_Index(EHM_NEVER)
22 {
23 #ifdef _DEBUG
24 setDebugName("SMeshBuffer");
25 #endif
26 }
27
28
29 //! Get material of this meshbuffer
30 /** \return Material of this buffer */
31 virtual const video::SMaterial& getMaterial() const
32 {
33 return Material;
34 }
35
36
37 //! Get material of this meshbuffer
38 /** \return Material of this buffer */
39 virtual video::SMaterial& getMaterial()
40 {
41 return Material;
42 }
43
44
45 //! Get pointer to vertices
46 /** \return Pointer to vertices. */
47 virtual const void* getVertices() const
48 {
49 return Vertices.const_pointer();
50 }
51
52
53 //! Get pointer to vertices
54 /** \return Pointer to vertices. */
55 virtual void* getVertices()
56 {
57 return Vertices.pointer();
58 }
59
60
61 //! Get number of vertices
62 /** \return Number of vertices. */
63 virtual u32 getVertexCount() const
64 {
65 return Vertices.size();
66 }
67
68 //! Get type of index data which is stored in this meshbuffer.
69 /** \return Index type of this buffer. */
70 virtual video::E_INDEX_TYPE getIndexType() const
71 {
72 return video::EIT_16BIT;
73 }
74
75 //! Get pointer to indices
76 /** \return Pointer to indices. */
77 virtual const u16* getIndices() const
78 {
79 return Indices.const_pointer();
80 }
81
82
83 //! Get pointer to indices
84 /** \return Pointer to indices. */
85 virtual u16* getIndices()
86 {
87 return Indices.pointer();
88 }
89
90
91 //! Get number of indices
92 /** \return Number of indices. */
93 virtual u32 getIndexCount() const
94 {
95 return Indices.size();
96 }
97
98
99 //! Get the axis aligned bounding box
100 /** \return Axis aligned bounding box of this buffer. */
101 virtual const core::aabbox3d<f32>& getBoundingBox() const
102 {
103 return BoundingBox;
104 }
105
106
107 //! Set the axis aligned bounding box
108 /** \param box New axis aligned bounding box for this buffer. */
109 //! set user axis aligned bounding box
110 virtual void setBoundingBox(const core::aabbox3df& box)
111 {
112 BoundingBox = box;
113 }
114
115
116 //! Recalculate the bounding box.
117 /** should be called if the mesh changed. */
118 virtual void recalculateBoundingBox()
119 {
120 if (Vertices.empty())
121 BoundingBox.reset(0,0,0);
122 else
123 {
124 BoundingBox.reset(Vertices[0].Pos);
125 for (u32 i=1; i<Vertices.size(); ++i)
126 BoundingBox.addInternalPoint(Vertices[i].Pos);
127 }
128 }
129
130
131 //! Get type of vertex data stored in this buffer.
132 /** \return Type of vertex data. */
133 virtual video::E_VERTEX_TYPE getVertexType() const
134 {
135 return T().getType();
136 }
137
138 //! returns position of vertex i
139 virtual const core::vector3df& getPosition(u32 i) const
140 {
141 return Vertices[i].Pos;
142 }
143
144 //! returns position of vertex i
145 virtual core::vector3df& getPosition(u32 i)
146 {
147 return Vertices[i].Pos;
148 }
149
150 //! returns normal of vertex i
151 virtual const core::vector3df& getNormal(u32 i) const
152 {
153 return Vertices[i].Normal;
154 }
155
156 //! returns normal of vertex i
157 virtual core::vector3df& getNormal(u32 i)
158 {
159 return Vertices[i].Normal;
160 }
161
162 //! returns texture coord of vertex i
163 virtual const core::vector2df& getTCoords(u32 i) const
164 {
165 return Vertices[i].TCoords;
166 }
167
168 //! returns texture coord of vertex i
169 virtual core::vector2df& getTCoords(u32 i)
170 {
171 return Vertices[i].TCoords;
172 }
173
174
175 //! Append the vertices and indices to the current buffer
176 /** Only works for compatible types, i.e. either the same type
177 or the main buffer is of standard type. Otherwise, behavior is
178 undefined.
179 */
180 virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices)
181 {
182 if (vertices == getVertices())
183 return;
184
185 const u32 vertexCount = getVertexCount();
186 u32 i;
187
188 Vertices.reallocate(vertexCount+numVertices);
189 for (i=0; i<numVertices; ++i)
190 {
191 Vertices.push_back(reinterpret_cast<const T*>(vertices)[i]);
192 BoundingBox.addInternalPoint(reinterpret_cast<const T*>(vertices)[i].Pos);
193 }
194
195 Indices.reallocate(getIndexCount()+numIndices);
196 for (i=0; i<numIndices; ++i)
197 {
198 Indices.push_back(indices[i]+vertexCount);
199 }
200 }
201
202
203 //! Append the meshbuffer to the current buffer
204 /** Only works for compatible types, i.e. either the same type
205 or the main buffer is of standard type. Otherwise, behavior is
206 undefined.
207 \param other Meshbuffer to be appended to this one.
208 */
209 virtual void append(const IMeshBuffer* const other)
210 {
211 /*
212 if (this==other)
213 return;
214
215 const u32 vertexCount = getVertexCount();
216 u32 i;
217
218 Vertices.reallocate(vertexCount+other->getVertexCount());
219 for (i=0; i<other->getVertexCount(); ++i)
220 {
221 Vertices.push_back(reinterpret_cast<const T*>(other->getVertices())[i]);
222 }
223
224 Indices.reallocate(getIndexCount()+other->getIndexCount());
225 for (i=0; i<other->getIndexCount(); ++i)
226 {
227 Indices.push_back(other->getIndices()[i]+vertexCount);
228 }
229 BoundingBox.addInternalBox(other->getBoundingBox());
230 */
231 }
232
233
234 //! get the current hardware mapping hint
235 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const
236 {
237 return MappingHint_Vertex;
238 }
239
240 //! get the current hardware mapping hint
241 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const
242 {
243 return MappingHint_Index;
244 }
245
246 //! set the hardware mapping hint, for driver
247 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX )
248 {
249 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
250 MappingHint_Vertex=NewMappingHint;
251 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
252 MappingHint_Index=NewMappingHint;
253 }
254
255
256 //! flags the mesh as changed, reloads hardware buffers
257 virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX)
258 {
259 if (Buffer==EBT_VERTEX_AND_INDEX ||Buffer==EBT_VERTEX)
260 ++ChangedID_Vertex;
261 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
262 ++ChangedID_Index;
263 }
264
265 //! Get the currently used ID for identification of changes.
266 /** This shouldn't be used for anything outside the VideoDriver. */
267 virtual u32 getChangedID_Vertex() const {return ChangedID_Vertex;}
268
269 //! Get the currently used ID for identification of changes.
270 /** This shouldn't be used for anything outside the VideoDriver. */
271 virtual u32 getChangedID_Index() const {return ChangedID_Index;}
272
273 u32 ChangedID_Vertex;
274 u32 ChangedID_Index;
275
276 //! hardware mapping hint
277 E_HARDWARE_MAPPING MappingHint_Vertex;
278 E_HARDWARE_MAPPING MappingHint_Index;
279
280 //! Material for this meshbuffer.
281 video::SMaterial Material;
282 //! Vertices of this buffer
283 core::array<T> Vertices;
284 //! Indices into the vertices of this buffer.
285 core::array<u16> Indices;
286 //! Bounding box of this meshbuffer.
287 core::aabbox3d<f32> BoundingBox;
288 };
289
290 //! Standard meshbuffer
291 typedef CMeshBuffer<video::S3DVertex> SMeshBuffer;
292 //! Meshbuffer with two texture coords per vertex, e.g. for lightmaps
293 typedef CMeshBuffer<video::S3DVertex2TCoords> SMeshBufferLightMap;
294 //! Meshbuffer with vertices having tangents stored, e.g. for normal mapping
295 typedef CMeshBuffer<video::S3DVertexTangents> SMeshBufferTangents;
296} // end namespace scene
297} // end namespace irr
298
299#endif
300
301
diff --git a/src/others/irrlicht-1.8.1/include/CVertexBuffer.h b/src/others/irrlicht-1.8.1/include/CVertexBuffer.h
new file mode 100644
index 0000000..c721419
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/CVertexBuffer.h
@@ -0,0 +1,210 @@
1// Copyright (C) 2008-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_VERTEX_BUFFER_H_INCLUDED__
6#define __C_VERTEX_BUFFER_H_INCLUDED__
7
8#include "IVertexBuffer.h"
9
10
11namespace irr
12{
13namespace scene
14{
15
16 class CVertexBuffer : public IVertexBuffer
17 {
18 class IVertexList
19 {
20 public:
21 virtual ~IVertexList(){};
22
23 virtual u32 stride() const =0;
24
25 virtual u32 size() const =0;
26
27 virtual void push_back (const video::S3DVertex &element) =0;
28 virtual video::S3DVertex& operator [](const u32 index) const =0;
29 virtual video::S3DVertex& getLast() =0;
30 virtual void set_used(u32 usedNow) =0;
31 virtual void reallocate(u32 new_size) =0;
32 virtual u32 allocated_size() const =0;
33 virtual video::S3DVertex* pointer() =0;
34 virtual video::E_VERTEX_TYPE getType() const =0;
35 };
36
37 template <class T>
38 class CSpecificVertexList : public IVertexList
39 {
40 public:
41 core::array<T> Vertices;
42
43 virtual u32 stride() const {return sizeof(T);}
44
45 virtual u32 size() const {return Vertices.size();}
46
47 virtual void push_back (const video::S3DVertex &element)
48 {Vertices.push_back((T&)element);}
49
50 virtual video::S3DVertex& operator [](const u32 index) const
51 {return (video::S3DVertex&)Vertices[index];}
52
53 virtual video::S3DVertex& getLast()
54 {return (video::S3DVertex&)Vertices.getLast();}
55
56 virtual void set_used(u32 usedNow)
57 {Vertices.set_used(usedNow);}
58
59 virtual void reallocate(u32 new_size)
60 {Vertices.reallocate(new_size);}
61
62 virtual u32 allocated_size() const
63 {
64 return Vertices.allocated_size();
65 }
66
67 virtual video::S3DVertex* pointer() {return Vertices.pointer();}
68
69 virtual video::E_VERTEX_TYPE getType() const {return T().getType();}
70 };
71
72 public:
73 IVertexList *Vertices;
74
75 CVertexBuffer(video::E_VERTEX_TYPE vertexType) : Vertices(0),
76 MappingHint(EHM_NEVER), ChangedID(1)
77 {
78 setType(vertexType);
79 }
80
81 CVertexBuffer(const IVertexBuffer &VertexBufferCopy) :
82 Vertices(0), MappingHint(EHM_NEVER),
83 ChangedID(1)
84 {
85 setType(VertexBufferCopy.getType());
86 reallocate(VertexBufferCopy.size());
87
88 for (u32 n=0;n<VertexBufferCopy.size();++n)
89 push_back(VertexBufferCopy[n]);
90 }
91
92 virtual ~CVertexBuffer()
93 {
94 delete Vertices;
95 }
96
97
98 virtual void setType(video::E_VERTEX_TYPE vertexType)
99 {
100 IVertexList *NewVertices=0;
101
102 switch (vertexType)
103 {
104 case video::EVT_STANDARD:
105 {
106 NewVertices=new CSpecificVertexList<video::S3DVertex>;
107 break;
108 }
109 case video::EVT_2TCOORDS:
110 {
111 NewVertices=new CSpecificVertexList<video::S3DVertex2TCoords>;
112 break;
113 }
114 case video::EVT_TANGENTS:
115 {
116 NewVertices=new CSpecificVertexList<video::S3DVertexTangents>;
117 break;
118 }
119 }
120 if (Vertices)
121 {
122 NewVertices->reallocate( Vertices->size() );
123
124 for(u32 n=0;n<Vertices->size();++n)
125 NewVertices->push_back((*Vertices)[n]);
126
127 delete Vertices;
128 }
129
130 Vertices=NewVertices;
131 }
132
133 virtual void* getData() {return Vertices->pointer();}
134
135 virtual video::E_VERTEX_TYPE getType() const {return Vertices->getType();}
136
137 virtual u32 stride() const {return Vertices->stride();}
138
139 virtual u32 size() const
140 {
141 return Vertices->size();
142 }
143
144 virtual void push_back (const video::S3DVertex &element)
145 {
146 Vertices->push_back(element);
147 }
148
149 virtual video::S3DVertex& operator [](const u32 index) const
150 {
151 return (*Vertices)[index];
152 }
153
154 virtual video::S3DVertex& getLast()
155 {
156 return Vertices->getLast();
157 }
158
159 virtual void set_used(u32 usedNow)
160 {
161 Vertices->set_used(usedNow);
162 }
163
164 virtual void reallocate(u32 new_size)
165 {
166 Vertices->reallocate(new_size);
167 }
168
169 virtual u32 allocated_size() const
170 {
171 return Vertices->allocated_size();
172 }
173
174 virtual video::S3DVertex* pointer()
175 {
176 return Vertices->pointer();
177 }
178
179 //! get the current hardware mapping hint
180 virtual E_HARDWARE_MAPPING getHardwareMappingHint() const
181 {
182 return MappingHint;
183 }
184
185 //! set the hardware mapping hint, for driver
186 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint )
187 {
188 MappingHint=NewMappingHint;
189 }
190
191 //! flags the mesh as changed, reloads hardware buffers
192 virtual void setDirty()
193 {
194 ++ChangedID;
195 }
196
197 //! Get the currently used ID for identification of changes.
198 /** This shouldn't be used for anything outside the VideoDriver. */
199 virtual u32 getChangedID() const {return ChangedID;}
200
201 E_HARDWARE_MAPPING MappingHint;
202 u32 ChangedID;
203 };
204
205
206} // end namespace scene
207} // end namespace irr
208
209#endif
210
diff --git a/src/others/irrlicht-1.8.1/include/EAttributes.h b/src/others/irrlicht-1.8.1/include/EAttributes.h
new file mode 100644
index 0000000..51f102b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EAttributes.h
@@ -0,0 +1,101 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_ATTRIBUTES_H_INCLUDED__
6#define __E_ATTRIBUTES_H_INCLUDED__
7
8namespace irr
9{
10namespace io
11{
12
13//! Types of attributes available for IAttributes
14enum E_ATTRIBUTE_TYPE
15{
16 // integer attribute
17 EAT_INT = 0,
18
19 // float attribute
20 EAT_FLOAT,
21
22 // string attribute
23 EAT_STRING,
24
25 // boolean attribute
26 EAT_BOOL,
27
28 // enumeration attribute
29 EAT_ENUM,
30
31 // color attribute
32 EAT_COLOR,
33
34 // floating point color attribute
35 EAT_COLORF,
36
37 // 3d vector attribute
38 EAT_VECTOR3D,
39
40 // 2d position attribute
41 EAT_POSITION2D,
42
43 // vector 2d attribute
44 EAT_VECTOR2D,
45
46 // rectangle attribute
47 EAT_RECT,
48
49 // matrix attribute
50 EAT_MATRIX,
51
52 // quaternion attribute
53 EAT_QUATERNION,
54
55 // 3d bounding box
56 EAT_BBOX,
57
58 // plane
59 EAT_PLANE,
60
61 // 3d triangle
62 EAT_TRIANGLE3D,
63
64 // line 2d
65 EAT_LINE2D,
66
67 // line 3d
68 EAT_LINE3D,
69
70 // array of stringws attribute
71 EAT_STRINGWARRAY,
72
73 // array of float
74 EAT_FLOATARRAY,
75
76 // array of int
77 EAT_INTARRAY,
78
79 // binary data attribute
80 EAT_BINARY,
81
82 // texture reference attribute
83 EAT_TEXTURE,
84
85 // user pointer void*
86 EAT_USER_POINTER,
87
88 // dimension attribute
89 EAT_DIMENSION2D,
90
91 // known attribute type count
92 EAT_COUNT,
93
94 // unknown attribute
95 EAT_UNKNOWN
96};
97
98} // end namespace io
99} // end namespace irr
100
101#endif
diff --git a/src/others/irrlicht-1.8.1/include/ECullingTypes.h b/src/others/irrlicht-1.8.1/include/ECullingTypes.h
new file mode 100644
index 0000000..4a562a4
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ECullingTypes.h
@@ -0,0 +1,41 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_CULLING_TYPES_H_INCLUDED__
6#define __E_CULLING_TYPES_H_INCLUDED__
7
8#include "irrTypes.h"
9
10namespace irr
11{
12namespace scene
13{
14
15 //! An enumeration for all types of automatic culling for built-in scene nodes
16 enum E_CULLING_TYPE
17 {
18 EAC_OFF = 0,
19 EAC_BOX = 1,
20 EAC_FRUSTUM_BOX = 2,
21 EAC_FRUSTUM_SPHERE = 4,
22 EAC_OCC_QUERY = 8
23 };
24
25 //! Names for culling type
26 const c8* const AutomaticCullingNames[] =
27 {
28 "false",
29 "box", // camera box against node box
30 "frustum_box", // camera frustum against node box
31 "frustum_sphere", // camera frustum against node sphere
32 "occ_query", // occlusion query
33 0
34 };
35
36} // end namespace scene
37} // end namespace irr
38
39
40#endif // __E_CULLING_TYPES_H_INCLUDED__
41
diff --git a/src/others/irrlicht-1.8.1/include/EDebugSceneTypes.h b/src/others/irrlicht-1.8.1/include/EDebugSceneTypes.h
new file mode 100644
index 0000000..987b790
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EDebugSceneTypes.h
@@ -0,0 +1,50 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_DEBUG_SCENE_TYPES_H_INCLUDED__
6#define __E_DEBUG_SCENE_TYPES_H_INCLUDED__
7
8namespace irr
9{
10namespace scene
11{
12
13 //! An enumeration for all types of debug data for built-in scene nodes (flags)
14 enum E_DEBUG_SCENE_TYPE
15 {
16 //! No Debug Data ( Default )
17 EDS_OFF = 0,
18
19 //! Show Bounding Boxes of SceneNode
20 EDS_BBOX = 1,
21
22 //! Show Vertex Normals
23 EDS_NORMALS = 2,
24
25 //! Shows Skeleton/Tags
26 EDS_SKELETON = 4,
27
28 //! Overlays Mesh Wireframe
29 EDS_MESH_WIRE_OVERLAY = 8,
30
31 //! Temporary use transparency Material Type
32 EDS_HALF_TRANSPARENCY = 16,
33
34 //! Show Bounding Boxes of all MeshBuffers
35 EDS_BBOX_BUFFERS = 32,
36
37 //! EDS_BBOX | EDS_BBOX_BUFFERS
38 EDS_BBOX_ALL = EDS_BBOX | EDS_BBOX_BUFFERS,
39
40 //! Show all debug infos
41 EDS_FULL = 0xffffffff
42 };
43
44
45} // end namespace scene
46} // end namespace irr
47
48
49#endif // __E_DEBUG_SCENE_TYPES_H_INCLUDED__
50
diff --git a/src/others/irrlicht-1.8.1/include/EDeviceTypes.h b/src/others/irrlicht-1.8.1/include/EDeviceTypes.h
new file mode 100644
index 0000000..44b0094
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EDeviceTypes.h
@@ -0,0 +1,60 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_DEVICE_TYPES_H_INCLUDED__
6#define __E_DEVICE_TYPES_H_INCLUDED__
7
8namespace irr
9{
10
11 //! An enum for the different device types supported by the Irrlicht Engine.
12 enum E_DEVICE_TYPE
13 {
14
15 //! A device native to Microsoft Windows
16 /** This device uses the Win32 API and works in all versions of Windows. */
17 EIDT_WIN32,
18
19 //! A device native to Windows CE devices
20 /** This device works on Windows Mobile, Pocket PC and Microsoft SmartPhone devices */
21 EIDT_WINCE,
22
23 //! A device native to Unix style operating systems.
24 /** This device uses the X11 windowing system and works in Linux, Solaris, FreeBSD, OSX and
25 other operating systems which support X11. */
26 EIDT_X11,
27
28 //! A device native to Mac OSX
29 /** This device uses Apple's Cocoa API and works in Mac OSX 10.2 and above. */
30 EIDT_OSX,
31
32 //! A device which uses Simple DirectMedia Layer
33 /** The SDL device works under all platforms supported by SDL but first must be compiled
34 in by defining the IRR_USE_SDL_DEVICE macro in IrrCompileConfig.h */
35 EIDT_SDL,
36
37 //! A device for raw framebuffer access
38 /** Best used with embedded devices and mobile systems.
39 Does not need X11 or other graphical subsystems.
40 May support hw-acceleration via OpenGL-ES for FBDirect */
41 EIDT_FRAMEBUFFER,
42
43 //! A simple text only device supported by all platforms.
44 /** This device allows applications to run from the command line without opening a window.
45 It can render the output of the software drivers to the console as ASCII. It only supports
46 mouse and keyboard in Windows operating systems. */
47 EIDT_CONSOLE,
48
49 //! This selection allows Irrlicht to choose the best device from the ones available.
50 /** If this selection is chosen then Irrlicht will try to use the IrrlichtDevice native
51 to your operating system. If this is unavailable then the X11, SDL and then console device
52 will be tried. This ensures that Irrlicht will run even if your platform is unsupported,
53 although it may not be able to render anything. */
54 EIDT_BEST
55 };
56
57} // end namespace irr
58
59#endif // __E_DEVICE_TYPES_H_INCLUDED__
60
diff --git a/src/others/irrlicht-1.8.1/include/EDriverFeatures.h b/src/others/irrlicht-1.8.1/include/EDriverFeatures.h
new file mode 100644
index 0000000..a0bf307
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EDriverFeatures.h
@@ -0,0 +1,133 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_DRIVER_FEATURES_H_INCLUDED__
6#define __E_DRIVER_FEATURES_H_INCLUDED__
7
8namespace irr
9{
10namespace video
11{
12
13 //! enumeration for querying features of the video driver.
14 enum E_VIDEO_DRIVER_FEATURE
15 {
16 //! Is driver able to render to a surface?
17 EVDF_RENDER_TO_TARGET = 0,
18
19 //! Is hardeware transform and lighting supported?
20 EVDF_HARDWARE_TL,
21
22 //! Are multiple textures per material possible?
23 EVDF_MULTITEXTURE,
24
25 //! Is driver able to render with a bilinear filter applied?
26 EVDF_BILINEAR_FILTER,
27
28 //! Can the driver handle mip maps?
29 EVDF_MIP_MAP,
30
31 //! Can the driver update mip maps automatically?
32 EVDF_MIP_MAP_AUTO_UPDATE,
33
34 //! Are stencilbuffers switched on and does the device support stencil buffers?
35 EVDF_STENCIL_BUFFER,
36
37 //! Is Vertex Shader 1.1 supported?
38 EVDF_VERTEX_SHADER_1_1,
39
40 //! Is Vertex Shader 2.0 supported?
41 EVDF_VERTEX_SHADER_2_0,
42
43 //! Is Vertex Shader 3.0 supported?
44 EVDF_VERTEX_SHADER_3_0,
45
46 //! Is Pixel Shader 1.1 supported?
47 EVDF_PIXEL_SHADER_1_1,
48
49 //! Is Pixel Shader 1.2 supported?
50 EVDF_PIXEL_SHADER_1_2,
51
52 //! Is Pixel Shader 1.3 supported?
53 EVDF_PIXEL_SHADER_1_3,
54
55 //! Is Pixel Shader 1.4 supported?
56 EVDF_PIXEL_SHADER_1_4,
57
58 //! Is Pixel Shader 2.0 supported?
59 EVDF_PIXEL_SHADER_2_0,
60
61 //! Is Pixel Shader 3.0 supported?
62 EVDF_PIXEL_SHADER_3_0,
63
64 //! Are ARB vertex programs v1.0 supported?
65 EVDF_ARB_VERTEX_PROGRAM_1,
66
67 //! Are ARB fragment programs v1.0 supported?
68 EVDF_ARB_FRAGMENT_PROGRAM_1,
69
70 //! Is GLSL supported?
71 EVDF_ARB_GLSL,
72
73 //! Is HLSL supported?
74 EVDF_HLSL,
75
76 //! Are non-square textures supported?
77 EVDF_TEXTURE_NSQUARE,
78
79 //! Are non-power-of-two textures supported?
80 EVDF_TEXTURE_NPOT,
81
82 //! Are framebuffer objects supported?
83 EVDF_FRAMEBUFFER_OBJECT,
84
85 //! Are vertex buffer objects supported?
86 EVDF_VERTEX_BUFFER_OBJECT,
87
88 //! Supports Alpha To Coverage
89 EVDF_ALPHA_TO_COVERAGE,
90
91 //! Supports Color masks (disabling color planes in output)
92 EVDF_COLOR_MASK,
93
94 //! Supports multiple render targets at once
95 EVDF_MULTIPLE_RENDER_TARGETS,
96
97 //! Supports separate blend settings for multiple render targets
98 EVDF_MRT_BLEND,
99
100 //! Supports separate color masks for multiple render targets
101 EVDF_MRT_COLOR_MASK,
102
103 //! Supports separate blend functions for multiple render targets
104 EVDF_MRT_BLEND_FUNC,
105
106 //! Supports geometry shaders
107 EVDF_GEOMETRY_SHADER,
108
109 //! Supports occlusion queries
110 EVDF_OCCLUSION_QUERY,
111
112 //! Supports polygon offset/depth bias for avoiding z-fighting
113 EVDF_POLYGON_OFFSET,
114
115 //! Support for different blend functions. Without, only ADD is available
116 EVDF_BLEND_OPERATIONS,
117
118 //! Support for texture coord transformation via texture matrix
119 EVDF_TEXTURE_MATRIX,
120
121 //! Support for NVidia's CG shader language
122 EVDF_CG,
123
124 //! Only used for counting the elements of this enum
125 EVDF_COUNT
126 };
127
128} // end namespace video
129} // end namespace irr
130
131
132#endif
133
diff --git a/src/others/irrlicht-1.8.1/include/EDriverTypes.h b/src/others/irrlicht-1.8.1/include/EDriverTypes.h
new file mode 100644
index 0000000..25237b9
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EDriverTypes.h
@@ -0,0 +1,64 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_DRIVER_TYPES_H_INCLUDED__
6#define __E_DRIVER_TYPES_H_INCLUDED__
7
8namespace irr
9{
10namespace video
11{
12
13 //! An enum for all types of drivers the Irrlicht Engine supports.
14 enum E_DRIVER_TYPE
15 {
16 //! Null driver, useful for applications to run the engine without visualisation.
17 /** The null device is able to load textures, but does not
18 render and display any graphics. */
19 EDT_NULL,
20
21 //! The Irrlicht Engine Software renderer.
22 /** Runs on all platforms, with every hardware. It should only
23 be used for 2d graphics, but it can also perform some primitive
24 3d functions. These 3d drawing functions are quite fast, but
25 very inaccurate, and don't even support clipping in 3D mode. */
26 EDT_SOFTWARE,
27
28 //! The Burning's Software Renderer, an alternative software renderer
29 /** Basically it can be described as the Irrlicht Software
30 renderer on steroids. It rasterizes 3D geometry perfectly: It
31 is able to perform correct 3d clipping, perspective correct
32 texture mapping, perspective correct color mapping, and renders
33 sub pixel correct, sub texel correct primitives. In addition,
34 it does bilinear texel filtering and supports more materials
35 than the EDT_SOFTWARE driver. This renderer has been written
36 entirely by Thomas Alten, thanks a lot for this huge
37 contribution. */
38 EDT_BURNINGSVIDEO,
39
40 //! Direct3D8 device, only available on Win32 platforms.
41 /** Performs hardware accelerated rendering of 3D and 2D
42 primitives. */
43 EDT_DIRECT3D8,
44
45 //! Direct3D 9 device, only available on Win32 platforms.
46 /** Performs hardware accelerated rendering of 3D and 2D
47 primitives. */
48 EDT_DIRECT3D9,
49
50 //! OpenGL device, available on most platforms.
51 /** Performs hardware accelerated rendering of 3D and 2D
52 primitives. */
53 EDT_OPENGL,
54
55 //! No driver, just for counting the elements
56 EDT_COUNT
57 };
58
59} // end namespace video
60} // end namespace irr
61
62
63#endif
64
diff --git a/src/others/irrlicht-1.8.1/include/EGUIAlignment.h b/src/others/irrlicht-1.8.1/include/EGUIAlignment.h
new file mode 100644
index 0000000..85f81b4
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EGUIAlignment.h
@@ -0,0 +1,38 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_GUI_ALIGNMENT_H_INCLUDED__
6#define __E_GUI_ALIGNMENT_H_INCLUDED__
7
8namespace irr
9{
10namespace gui
11{
12enum EGUI_ALIGNMENT
13{
14 //! Aligned to parent's top or left side (default)
15 EGUIA_UPPERLEFT=0,
16 //! Aligned to parent's bottom or right side
17 EGUIA_LOWERRIGHT,
18 //! Aligned to the center of parent
19 EGUIA_CENTER,
20 //! Stretched to fit parent
21 EGUIA_SCALE
22};
23
24//! Names for alignments
25const c8* const GUIAlignmentNames[] =
26{
27 "upperLeft",
28 "lowerRight",
29 "center",
30 "scale",
31 0
32};
33
34} // namespace gui
35} // namespace irr
36
37#endif // __E_GUI_ALIGNMENT_H_INCLUDED__
38
diff --git a/src/others/irrlicht-1.8.1/include/EGUIElementTypes.h b/src/others/irrlicht-1.8.1/include/EGUIElementTypes.h
new file mode 100644
index 0000000..a02afad
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EGUIElementTypes.h
@@ -0,0 +1,140 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_GUI_ELEMENT_TYPES_H_INCLUDED__
6#define __E_GUI_ELEMENT_TYPES_H_INCLUDED__
7
8#include "irrTypes.h"
9
10namespace irr
11{
12namespace gui
13{
14
15//! List of all basic Irrlicht GUI elements.
16/** An IGUIElement returns this when calling IGUIElement::getType(); */
17enum EGUI_ELEMENT_TYPE
18{
19 //! A button (IGUIButton)
20 EGUIET_BUTTON = 0,
21
22 //! A check box (IGUICheckBox)
23 EGUIET_CHECK_BOX,
24
25 //! A combo box (IGUIComboBox)
26 EGUIET_COMBO_BOX,
27
28 //! A context menu (IGUIContextMenu)
29 EGUIET_CONTEXT_MENU,
30
31 //! A menu (IGUIMenu)
32 EGUIET_MENU,
33
34 //! An edit box (IGUIEditBox)
35 EGUIET_EDIT_BOX,
36
37 //! A file open dialog (IGUIFileOpenDialog)
38 EGUIET_FILE_OPEN_DIALOG,
39
40 //! A color select open dialog (IGUIColorSelectDialog)
41 EGUIET_COLOR_SELECT_DIALOG,
42
43 //! A in/out fader (IGUIInOutFader)
44 EGUIET_IN_OUT_FADER,
45
46 //! An image (IGUIImage)
47 EGUIET_IMAGE,
48
49 //! A list box (IGUIListBox)
50 EGUIET_LIST_BOX,
51
52 //! A mesh viewer (IGUIMeshViewer)
53 EGUIET_MESH_VIEWER,
54
55 //! A message box (IGUIWindow)
56 EGUIET_MESSAGE_BOX,
57
58 //! A modal screen
59 EGUIET_MODAL_SCREEN,
60
61 //! A scroll bar (IGUIScrollBar)
62 EGUIET_SCROLL_BAR,
63
64 //! A spin box (IGUISpinBox)
65 EGUIET_SPIN_BOX,
66
67 //! A static text (IGUIStaticText)
68 EGUIET_STATIC_TEXT,
69
70 //! A tab (IGUITab)
71 EGUIET_TAB,
72
73 //! A tab control
74 EGUIET_TAB_CONTROL,
75
76 //! A Table
77 EGUIET_TABLE,
78
79 //! A tool bar (IGUIToolBar)
80 EGUIET_TOOL_BAR,
81
82 //! A Tree View
83 EGUIET_TREE_VIEW,
84
85 //! A window
86 EGUIET_WINDOW,
87
88 //! Unknown type.
89 EGUIET_ELEMENT,
90
91 //! The root of the GUI
92 EGUIET_ROOT,
93
94 //! Not an element, amount of elements in there
95 EGUIET_COUNT,
96
97 //! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit.
98 EGUIET_FORCE_32_BIT = 0x7fffffff
99
100};
101
102//! Names for built-in element types
103const c8* const GUIElementTypeNames[] =
104{
105 "button",
106 "checkBox",
107 "comboBox",
108 "contextMenu",
109 "menu",
110 "editBox",
111 "fileOpenDialog",
112 "colorSelectDialog",
113 "inOutFader",
114 "image",
115 "listBox",
116 "meshViewer",
117 "messageBox",
118 "modalScreen",
119 "scrollBar",
120 "spinBox",
121 "staticText",
122 "tab",
123 "tabControl",
124 "table",
125 "toolBar",
126 "treeview",
127 "window",
128 "element",
129 "root",
130 0
131};
132
133} // end namespace gui
134} // end namespace irr
135
136#endif
137
138
139
140
diff --git a/src/others/irrlicht-1.8.1/include/EHardwareBufferFlags.h b/src/others/irrlicht-1.8.1/include/EHardwareBufferFlags.h
new file mode 100644
index 0000000..d759455
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EHardwareBufferFlags.h
@@ -0,0 +1,44 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_HARDWARE_BUFFER_FLAGS_INCLUDED__
6#define __E_HARDWARE_BUFFER_FLAGS_INCLUDED__
7
8namespace irr
9{
10namespace scene
11{
12
13 enum E_HARDWARE_MAPPING
14 {
15 //! Don't store on the hardware
16 EHM_NEVER=0,
17
18 //! Rarely changed, usually stored completely on the hardware
19 EHM_STATIC,
20
21 //! Sometimes changed, driver optimized placement
22 EHM_DYNAMIC,
23
24 //! Always changed, cache optimizing on the GPU
25 EHM_STREAM
26 };
27
28 enum E_BUFFER_TYPE
29 {
30 //! Does not change anything
31 EBT_NONE=0,
32 //! Change the vertex mapping
33 EBT_VERTEX,
34 //! Change the index mapping
35 EBT_INDEX,
36 //! Change both vertex and index mapping to the same value
37 EBT_VERTEX_AND_INDEX
38 };
39
40} // end namespace scene
41} // end namespace irr
42
43#endif
44
diff --git a/src/others/irrlicht-1.8.1/include/EMaterialFlags.h b/src/others/irrlicht-1.8.1/include/EMaterialFlags.h
new file mode 100644
index 0000000..0adc702
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EMaterialFlags.h
@@ -0,0 +1,95 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_MATERIAL_FLAGS_H_INCLUDED__
6#define __E_MATERIAL_FLAGS_H_INCLUDED__
7
8namespace irr
9{
10namespace video
11{
12
13 //! Material flags
14 enum E_MATERIAL_FLAG
15 {
16 //! Draw as wireframe or filled triangles? Default: false
17 EMF_WIREFRAME = 0x1,
18
19 //! Draw as point cloud or filled triangles? Default: false
20 EMF_POINTCLOUD = 0x2,
21
22 //! Flat or Gouraud shading? Default: true
23 EMF_GOURAUD_SHADING = 0x4,
24
25 //! Will this material be lighted? Default: true
26 EMF_LIGHTING = 0x8,
27
28 //! Is the ZBuffer enabled? Default: true
29 EMF_ZBUFFER = 0x10,
30
31 //! May be written to the zbuffer or is it readonly. Default: true
32 /** This flag is ignored, if the material type is a transparent type. */
33 EMF_ZWRITE_ENABLE = 0x20,
34
35 //! Is backface culling enabled? Default: true
36 EMF_BACK_FACE_CULLING = 0x40,
37
38 //! Is frontface culling enabled? Default: false
39 /** Overrides EMF_BACK_FACE_CULLING if both are enabled. */
40 EMF_FRONT_FACE_CULLING = 0x80,
41
42 //! Is bilinear filtering enabled? Default: true
43 EMF_BILINEAR_FILTER = 0x100,
44
45 //! Is trilinear filtering enabled? Default: false
46 /** If the trilinear filter flag is enabled,
47 the bilinear filtering flag is ignored. */
48 EMF_TRILINEAR_FILTER = 0x200,
49
50 //! Is anisotropic filtering? Default: false
51 /** In Irrlicht you can use anisotropic texture filtering in
52 conjunction with bilinear or trilinear texture filtering
53 to improve rendering results. Primitives will look less
54 blurry with this flag switched on. */
55 EMF_ANISOTROPIC_FILTER = 0x400,
56
57 //! Is fog enabled? Default: false
58 EMF_FOG_ENABLE = 0x800,
59
60 //! Normalizes normals. Default: false
61 /** You can enable this if you need to scale a dynamic lighted
62 model. Usually, its normals will get scaled too then and it
63 will get darker. If you enable the EMF_NORMALIZE_NORMALS flag,
64 the normals will be normalized again, and the model will look
65 as bright as it should. */
66 EMF_NORMALIZE_NORMALS = 0x1000,
67
68 //! Access to all layers texture wrap settings. Overwrites separate layer settings.
69 EMF_TEXTURE_WRAP = 0x2000,
70
71 //! AntiAliasing mode
72 EMF_ANTI_ALIASING = 0x4000,
73
74 //! ColorMask bits, for enabling the color planes
75 EMF_COLOR_MASK = 0x8000,
76
77 //! ColorMaterial enum for vertex color interpretation
78 EMF_COLOR_MATERIAL = 0x10000,
79
80 //! Flag for enabling/disabling mipmap usage
81 EMF_USE_MIP_MAPS = 0x20000,
82
83 //! Flag for blend operation
84 EMF_BLEND_OPERATION = 0x40000,
85
86 //! Flag for polygon offset
87 EMF_POLYGON_OFFSET = 0x80000
88 };
89
90} // end namespace video
91} // end namespace irr
92
93
94#endif // __E_MATERIAL_FLAGS_H_INCLUDED__
95
diff --git a/src/others/irrlicht-1.8.1/include/EMaterialTypes.h b/src/others/irrlicht-1.8.1/include/EMaterialTypes.h
new file mode 100644
index 0000000..086ca34
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EMaterialTypes.h
@@ -0,0 +1,234 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_MATERIAL_TYPES_H_INCLUDED__
6#define __E_MATERIAL_TYPES_H_INCLUDED__
7
8namespace irr
9{
10namespace video
11{
12
13 //! Abstracted and easy to use fixed function/programmable pipeline material modes.
14 enum E_MATERIAL_TYPE
15 {
16 //! Standard solid material.
17 /** Only first texture is used, which is supposed to be the
18 diffuse material. */
19 EMT_SOLID = 0,
20
21 //! Solid material with 2 texture layers.
22 /** The second is blended onto the first using the alpha value
23 of the vertex colors. This material is currently not implemented in OpenGL.
24 */
25 EMT_SOLID_2_LAYER,
26
27 //! Material type with standard lightmap technique
28 /** There should be 2 textures: The first texture layer is a
29 diffuse map, the second is a light map. Dynamic light is
30 ignored. */
31 EMT_LIGHTMAP,
32
33 //! Material type with lightmap technique like EMT_LIGHTMAP.
34 /** But lightmap and diffuse texture are added instead of modulated. */
35 EMT_LIGHTMAP_ADD,
36
37 //! Material type with standard lightmap technique
38 /** There should be 2 textures: The first texture layer is a
39 diffuse map, the second is a light map. Dynamic light is
40 ignored. The texture colors are effectively multiplied by 2
41 for brightening. Like known in DirectX as D3DTOP_MODULATE2X. */
42 EMT_LIGHTMAP_M2,
43
44 //! Material type with standard lightmap technique
45 /** There should be 2 textures: The first texture layer is a
46 diffuse map, the second is a light map. Dynamic light is
47 ignored. The texture colors are effectively multiplyied by 4
48 for brightening. Like known in DirectX as D3DTOP_MODULATE4X. */
49 EMT_LIGHTMAP_M4,
50
51 //! Like EMT_LIGHTMAP, but also supports dynamic lighting.
52 EMT_LIGHTMAP_LIGHTING,
53
54 //! Like EMT_LIGHTMAP_M2, but also supports dynamic lighting.
55 EMT_LIGHTMAP_LIGHTING_M2,
56
57 //! Like EMT_LIGHTMAP_4, but also supports dynamic lighting.
58 EMT_LIGHTMAP_LIGHTING_M4,
59
60 //! Detail mapped material.
61 /** The first texture is diffuse color map, the second is added
62 to this and usually displayed with a bigger scale value so that
63 it adds more detail. The detail map is added to the diffuse map
64 using ADD_SIGNED, so that it is possible to add and substract
65 color from the diffuse map. For example a value of
66 (127,127,127) will not change the appearance of the diffuse map
67 at all. Often used for terrain rendering. */
68 EMT_DETAIL_MAP,
69
70 //! Look like a reflection of the environment around it.
71 /** To make this possible, a texture called 'sphere map' is
72 used, which must be set as the first texture. */
73 EMT_SPHERE_MAP,
74
75 //! A reflecting material with an optional non reflecting texture layer.
76 /** The reflection map should be set as first texture. */
77 EMT_REFLECTION_2_LAYER,
78
79 //! A transparent material.
80 /** Only the first texture is used. The new color is calculated
81 by simply adding the source color and the dest color. This
82 means if for example a billboard using a texture with black
83 background and a red circle on it is drawn with this material,
84 the result is that only the red circle will be drawn a little
85 bit transparent, and everything which was black is 100%
86 transparent and not visible. This material type is useful for
87 particle effects. */
88 EMT_TRANSPARENT_ADD_COLOR,
89
90 //! Makes the material transparent based on the texture alpha channel.
91 /** The final color is blended together from the destination
92 color and the texture color, using the alpha channel value as
93 blend factor. Only first texture is used. If you are using
94 this material with small textures, it is a good idea to load
95 the texture in 32 bit mode
96 (video::IVideoDriver::setTextureCreationFlag()). Also, an alpha
97 ref is used, which can be manipulated using
98 SMaterial::MaterialTypeParam. This value controls how sharp the
99 edges become when going from a transparent to a solid spot on
100 the texture. */
101 EMT_TRANSPARENT_ALPHA_CHANNEL,
102
103 //! Makes the material transparent based on the texture alpha channel.
104 /** If the alpha channel value is greater than 127, a
105 pixel is written to the target, otherwise not. This
106 material does not use alpha blending and is a lot faster
107 than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing
108 stuff like leafes of plants, because the borders are not
109 blurry but sharp. Only first texture is used. If you are
110 using this material with small textures and 3d object, it
111 is a good idea to load the texture in 32 bit mode
112 (video::IVideoDriver::setTextureCreationFlag()). */
113 EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
114
115 //! Makes the material transparent based on the vertex alpha value.
116 EMT_TRANSPARENT_VERTEX_ALPHA,
117
118 //! A transparent reflecting material with an optional additional non reflecting texture layer.
119 /** The reflection map should be set as first texture. The
120 transparency depends on the alpha value in the vertex colors. A
121 texture which will not reflect can be set as second texture.
122 Please note that this material type is currently not 100%
123 implemented in OpenGL. */
124 EMT_TRANSPARENT_REFLECTION_2_LAYER,
125
126 //! A solid normal map renderer.
127 /** First texture is the color map, the second should be the
128 normal map. Note that you should use this material only when
129 drawing geometry consisting of vertices of type
130 S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
131 this format using IMeshManipulator::createMeshWithTangents()
132 (See SpecialFX2 Tutorial). This shader runs on vertex shader
133 1.1 and pixel shader 1.1 capable hardware and falls back to a
134 fixed function lighted material if this hardware is not
135 available. Only two lights are supported by this shader, if
136 there are more, the nearest two are chosen. */
137 EMT_NORMAL_MAP_SOLID,
138
139 //! A transparent normal map renderer.
140 /** First texture is the color map, the second should be the
141 normal map. Note that you should use this material only when
142 drawing geometry consisting of vertices of type
143 S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
144 this format using IMeshManipulator::createMeshWithTangents()
145 (See SpecialFX2 Tutorial). This shader runs on vertex shader
146 1.1 and pixel shader 1.1 capable hardware and falls back to a
147 fixed function lighted material if this hardware is not
148 available. Only two lights are supported by this shader, if
149 there are more, the nearest two are chosen. */
150 EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR,
151
152 //! A transparent (based on the vertex alpha value) normal map renderer.
153 /** First texture is the color map, the second should be the
154 normal map. Note that you should use this material only when
155 drawing geometry consisting of vertices of type
156 S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
157 this format using IMeshManipulator::createMeshWithTangents()
158 (See SpecialFX2 Tutorial). This shader runs on vertex shader
159 1.1 and pixel shader 1.1 capable hardware and falls back to a
160 fixed function lighted material if this hardware is not
161 available. Only two lights are supported by this shader, if
162 there are more, the nearest two are chosen. */
163 EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA,
164
165 //! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping.
166 /** Looks a lot more realistic. This only works when the
167 hardware supports at least vertex shader 1.1 and pixel shader
168 1.4. First texture is the color map, the second should be the
169 normal map. The normal map texture should contain the height
170 value in the alpha component. The
171 IVideoDriver::makeNormalMapTexture() method writes this value
172 automatically when creating normal maps from a heightmap when
173 using a 32 bit texture. The height scale of the material
174 (affecting the bumpiness) is being controlled by the
175 SMaterial::MaterialTypeParam member. If set to zero, the
176 default value (0.02f) will be applied. Otherwise the value set
177 in SMaterial::MaterialTypeParam is taken. This value depends on
178 with which scale the texture is mapped on the material. Too
179 high or low values of MaterialTypeParam can result in strange
180 artifacts. */
181 EMT_PARALLAX_MAP_SOLID,
182
183 //! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
184 /** Using EMT_TRANSPARENT_ADD_COLOR as base material. */
185 EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR,
186
187 //! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
188 /** Using EMT_TRANSPARENT_VERTEX_ALPHA as base material. */
189 EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA,
190
191 //! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
192 /** Using only first texture. Generic blending method. */
193 EMT_ONETEXTURE_BLEND,
194
195 //! This value is not used. It only forces this enumeration to compile to 32 bit.
196 EMT_FORCE_32BIT = 0x7fffffff
197 };
198
199 //! Array holding the built in material type names
200 const char* const sBuiltInMaterialTypeNames[] =
201 {
202 "solid",
203 "solid_2layer",
204 "lightmap",
205 "lightmap_add",
206 "lightmap_m2",
207 "lightmap_m4",
208 "lightmap_light",
209 "lightmap_light_m2",
210 "lightmap_light_m4",
211 "detail_map",
212 "sphere_map",
213 "reflection_2layer",
214 "trans_add",
215 "trans_alphach",
216 "trans_alphach_ref",
217 "trans_vertex_alpha",
218 "trans_reflection_2layer",
219 "normalmap_solid",
220 "normalmap_trans_add",
221 "normalmap_trans_vertexalpha",
222 "parallaxmap_solid",
223 "parallaxmap_trans_add",
224 "parallaxmap_trans_vertexalpha",
225 "onetexture_blend",
226 0
227 };
228
229} // end namespace video
230} // end namespace irr
231
232
233#endif // __E_MATERIAL_TYPES_H_INCLUDED__
234
diff --git a/src/others/irrlicht-1.8.1/include/EMeshWriterEnums.h b/src/others/irrlicht-1.8.1/include/EMeshWriterEnums.h
new file mode 100644
index 0000000..fb2cfa4
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EMeshWriterEnums.h
@@ -0,0 +1,59 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_MESH_WRITER_ENUMS_H_INCLUDED__
6#define __E_MESH_WRITER_ENUMS_H_INCLUDED__
7
8#include "irrTypes.h"
9
10namespace irr
11{
12namespace scene
13{
14
15 //! An enumeration for all supported types of built-in mesh writers
16 /** A scene mesh writers is represented by a four character code
17 such as 'irrm' or 'coll' instead of simple numbers, to avoid
18 name clashes with external mesh writers.*/
19 enum EMESH_WRITER_TYPE
20 {
21 //! Irrlicht native mesh writer, for static .irrmesh files.
22 EMWT_IRR_MESH = MAKE_IRR_ID('i','r','r','m'),
23
24 //! COLLADA mesh writer for .dae and .xml files
25 EMWT_COLLADA = MAKE_IRR_ID('c','o','l','l'),
26
27 //! STL mesh writer for .stl files
28 EMWT_STL = MAKE_IRR_ID('s','t','l',0),
29
30 //! OBJ mesh writer for .obj files
31 EMWT_OBJ = MAKE_IRR_ID('o','b','j',0),
32
33 //! PLY mesh writer for .ply files
34 EMWT_PLY = MAKE_IRR_ID('p','l','y',0)
35 };
36
37
38 //! flags configuring mesh writing
39 enum E_MESH_WRITER_FLAGS
40 {
41 //! no writer flags
42 EMWF_NONE = 0,
43
44 //! write lightmap textures out if possible
45 EMWF_WRITE_LIGHTMAPS = 0x1,
46
47 //! write in a way that consumes less disk space
48 EMWF_WRITE_COMPRESSED = 0x2,
49
50 //! write in binary format rather than text
51 EMWF_WRITE_BINARY = 0x4
52 };
53
54} // end namespace scene
55} // end namespace irr
56
57
58#endif // __E_MESH_WRITER_ENUMS_H_INCLUDED__
59
diff --git a/src/others/irrlicht-1.8.1/include/EMessageBoxFlags.h b/src/others/irrlicht-1.8.1/include/EMessageBoxFlags.h
new file mode 100644
index 0000000..878db7f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EMessageBoxFlags.h
@@ -0,0 +1,36 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_MESSAGE_BOX_FLAGS_H_INCLUDED__
6#define __E_MESSAGE_BOX_FLAGS_H_INCLUDED__
7
8namespace irr
9{
10namespace gui
11{
12
13//! enumeration for message box layout flags
14enum EMESSAGE_BOX_FLAG
15{
16 //! Flag for the ok button
17 EMBF_OK = 0x1,
18
19 //! Flag for the cancel button
20 EMBF_CANCEL = 0x2,
21
22 //! Flag for the yes button
23 EMBF_YES = 0x4,
24
25 //! Flag for the no button
26 EMBF_NO = 0x8,
27
28 //! This value is not used. It only forces this enumeration to compile in 32 bit.
29 EMBF_FORCE_32BIT = 0x7fffffff
30};
31
32} // namespace gui
33} // namespace irr
34
35#endif
36
diff --git a/src/others/irrlicht-1.8.1/include/EPrimitiveTypes.h b/src/others/irrlicht-1.8.1/include/EPrimitiveTypes.h
new file mode 100644
index 0000000..6b082c1
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EPrimitiveTypes.h
@@ -0,0 +1,56 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_PRIMITIVE_TYPES_H_INCLUDED__
6#define __E_PRIMITIVE_TYPES_H_INCLUDED__
7
8namespace irr
9{
10namespace scene
11{
12
13 //! Enumeration for all primitive types there are.
14 enum E_PRIMITIVE_TYPE
15 {
16 //! All vertices are non-connected points.
17 EPT_POINTS=0,
18
19 //! All vertices form a single connected line.
20 EPT_LINE_STRIP,
21
22 //! Just as LINE_STRIP, but the last and the first vertex is also connected.
23 EPT_LINE_LOOP,
24
25 //! Every two vertices are connected creating n/2 lines.
26 EPT_LINES,
27
28 //! After the first two vertices each vertex defines a new triangle.
29 //! Always the two last and the new one form a new triangle.
30 EPT_TRIANGLE_STRIP,
31
32 //! After the first two vertices each vertex defines a new triangle.
33 //! All around the common first vertex.
34 EPT_TRIANGLE_FAN,
35
36 //! Explicitly set all vertices for each triangle.
37 EPT_TRIANGLES,
38
39 //! After the first two vertices each further tw vetices create a quad with the preceding two.
40 EPT_QUAD_STRIP,
41
42 //! Every four vertices create a quad.
43 EPT_QUADS,
44
45 //! Just as LINE_LOOP, but filled.
46 EPT_POLYGON,
47
48 //! The single vertices are expanded to quad billboards on the GPU.
49 EPT_POINT_SPRITES
50 };
51
52} // end namespace scene
53} // end namespace irr
54
55#endif
56
diff --git a/src/others/irrlicht-1.8.1/include/ESceneNodeAnimatorTypes.h b/src/others/irrlicht-1.8.1/include/ESceneNodeAnimatorTypes.h
new file mode 100644
index 0000000..d3e0936
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ESceneNodeAnimatorTypes.h
@@ -0,0 +1,58 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_SCENE_NODE_ANIMATOR_TYPES_H_INCLUDED__
6#define __E_SCENE_NODE_ANIMATOR_TYPES_H_INCLUDED__
7
8namespace irr
9{
10namespace scene
11{
12
13 //! An enumeration for all types of built-in scene node animators
14 enum ESCENE_NODE_ANIMATOR_TYPE
15 {
16 //! Fly circle scene node animator
17 ESNAT_FLY_CIRCLE = 0,
18
19 //! Fly straight scene node animator
20 ESNAT_FLY_STRAIGHT,
21
22 //! Follow spline scene node animator
23 ESNAT_FOLLOW_SPLINE,
24
25 //! Rotation scene node animator
26 ESNAT_ROTATION,
27
28 //! Texture scene node animator
29 ESNAT_TEXTURE,
30
31 //! Deletion scene node animator
32 ESNAT_DELETION,
33
34 //! Collision respose scene node animator
35 ESNAT_COLLISION_RESPONSE,
36
37 //! FPS camera animator
38 ESNAT_CAMERA_FPS,
39
40 //! Maya camera animator
41 ESNAT_CAMERA_MAYA,
42
43 //! Amount of built-in scene node animators
44 ESNAT_COUNT,
45
46 //! Unknown scene node animator
47 ESNAT_UNKNOWN,
48
49 //! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit.
50 ESNAT_FORCE_32_BIT = 0x7fffffff
51 };
52
53} // end namespace scene
54} // end namespace irr
55
56
57#endif
58
diff --git a/src/others/irrlicht-1.8.1/include/ESceneNodeTypes.h b/src/others/irrlicht-1.8.1/include/ESceneNodeTypes.h
new file mode 100644
index 0000000..a0d5aa4
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ESceneNodeTypes.h
@@ -0,0 +1,106 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_SCENE_NODE_TYPES_H_INCLUDED__
6#define __E_SCENE_NODE_TYPES_H_INCLUDED__
7
8#include "irrTypes.h"
9
10namespace irr
11{
12namespace scene
13{
14
15 //! An enumeration for all types of built-in scene nodes
16 /** A scene node type is represented by a four character code
17 such as 'cube' or 'mesh' instead of simple numbers, to avoid
18 name clashes with external scene nodes.*/
19 enum ESCENE_NODE_TYPE
20 {
21 //! of type CSceneManager (note that ISceneManager is not(!) an ISceneNode)
22 ESNT_SCENE_MANAGER = MAKE_IRR_ID('s','m','n','g'),
23
24 //! simple cube scene node
25 ESNT_CUBE = MAKE_IRR_ID('c','u','b','e'),
26
27 //! Sphere scene node
28 ESNT_SPHERE = MAKE_IRR_ID('s','p','h','r'),
29
30 //! Text Scene Node
31 ESNT_TEXT = MAKE_IRR_ID('t','e','x','t'),
32
33 //! Water Surface Scene Node
34 ESNT_WATER_SURFACE = MAKE_IRR_ID('w','a','t','r'),
35
36 //! Terrain Scene Node
37 ESNT_TERRAIN = MAKE_IRR_ID('t','e','r','r'),
38
39 //! Sky Box Scene Node
40 ESNT_SKY_BOX = MAKE_IRR_ID('s','k','y','_'),
41
42 //! Sky Dome Scene Node
43 ESNT_SKY_DOME = MAKE_IRR_ID('s','k','y','d'),
44
45 //! Shadow Volume Scene Node
46 ESNT_SHADOW_VOLUME = MAKE_IRR_ID('s','h','d','w'),
47
48 //! Octree Scene Node
49 ESNT_OCTREE = MAKE_IRR_ID('o','c','t','r'),
50
51 //! Mesh Scene Node
52 ESNT_MESH = MAKE_IRR_ID('m','e','s','h'),
53
54 //! Light Scene Node
55 ESNT_LIGHT = MAKE_IRR_ID('l','g','h','t'),
56
57 //! Empty Scene Node
58 ESNT_EMPTY = MAKE_IRR_ID('e','m','t','y'),
59
60 //! Dummy Transformation Scene Node
61 ESNT_DUMMY_TRANSFORMATION = MAKE_IRR_ID('d','m','m','y'),
62
63 //! Camera Scene Node
64 ESNT_CAMERA = MAKE_IRR_ID('c','a','m','_'),
65
66 //! Billboard Scene Node
67 ESNT_BILLBOARD = MAKE_IRR_ID('b','i','l','l'),
68
69 //! Animated Mesh Scene Node
70 ESNT_ANIMATED_MESH = MAKE_IRR_ID('a','m','s','h'),
71
72 //! Particle System Scene Node
73 ESNT_PARTICLE_SYSTEM = MAKE_IRR_ID('p','t','c','l'),
74
75 //! Quake3 Shader Scene Node
76 ESNT_Q3SHADER_SCENE_NODE = MAKE_IRR_ID('q','3','s','h'),
77
78 //! Quake3 Model Scene Node ( has tag to link to )
79 ESNT_MD3_SCENE_NODE = MAKE_IRR_ID('m','d','3','_'),
80
81 //! Volume Light Scene Node
82 ESNT_VOLUME_LIGHT = MAKE_IRR_ID('v','o','l','l'),
83
84 //! Maya Camera Scene Node
85 /** Legacy, for loading version <= 1.4.x .irr files */
86 ESNT_CAMERA_MAYA = MAKE_IRR_ID('c','a','m','M'),
87
88 //! First Person Shooter Camera
89 /** Legacy, for loading version <= 1.4.x .irr files */
90 ESNT_CAMERA_FPS = MAKE_IRR_ID('c','a','m','F'),
91
92 //! Unknown scene node
93 ESNT_UNKNOWN = MAKE_IRR_ID('u','n','k','n'),
94
95 //! Will match with any scene node when checking types
96 ESNT_ANY = MAKE_IRR_ID('a','n','y','_')
97 };
98
99
100
101} // end namespace scene
102} // end namespace irr
103
104
105#endif
106
diff --git a/src/others/irrlicht-1.8.1/include/EShaderTypes.h b/src/others/irrlicht-1.8.1/include/EShaderTypes.h
new file mode 100644
index 0000000..29eef56
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/EShaderTypes.h
@@ -0,0 +1,90 @@
1#ifndef __E_SHADER_TYPES_H_INCLUDED__
2#define __E_SHADER_TYPES_H_INCLUDED__
3
4#include "irrTypes.h"
5
6namespace irr
7{
8namespace video
9{
10
11//! Compile target enumeration for the addHighLevelShaderMaterial() method.
12enum E_VERTEX_SHADER_TYPE
13{
14 EVST_VS_1_1 = 0,
15 EVST_VS_2_0,
16 EVST_VS_2_a,
17 EVST_VS_3_0,
18 EVST_VS_4_0,
19 EVST_VS_4_1,
20 EVST_VS_5_0,
21
22 //! This is not a type, but a value indicating how much types there are.
23 EVST_COUNT
24};
25
26//! Names for all vertex shader types, each entry corresponds to a E_VERTEX_SHADER_TYPE entry.
27const c8* const VERTEX_SHADER_TYPE_NAMES[] = {
28 "vs_1_1",
29 "vs_2_0",
30 "vs_2_a",
31 "vs_3_0",
32 "vs_4_0",
33 "vs_4_1",
34 "vs_5_0",
35 0 };
36
37//! Compile target enumeration for the addHighLevelShaderMaterial() method.
38enum E_PIXEL_SHADER_TYPE
39{
40 EPST_PS_1_1 = 0,
41 EPST_PS_1_2,
42 EPST_PS_1_3,
43 EPST_PS_1_4,
44 EPST_PS_2_0,
45 EPST_PS_2_a,
46 EPST_PS_2_b,
47 EPST_PS_3_0,
48 EPST_PS_4_0,
49 EPST_PS_4_1,
50 EPST_PS_5_0,
51
52 //! This is not a type, but a value indicating how much types there are.
53 EPST_COUNT
54};
55
56//! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry.
57const c8* const PIXEL_SHADER_TYPE_NAMES[] = {
58 "ps_1_1",
59 "ps_1_2",
60 "ps_1_3",
61 "ps_1_4",
62 "ps_2_0",
63 "ps_2_a",
64 "ps_2_b",
65 "ps_3_0",
66 "ps_4_0",
67 "ps_4_1",
68 "ps_5_0",
69 0 };
70
71//! Enum for supported geometry shader types
72enum E_GEOMETRY_SHADER_TYPE
73{
74 EGST_GS_4_0 = 0,
75
76 //! This is not a type, but a value indicating how much types there are.
77 EGST_COUNT
78};
79
80//! String names for supported geometry shader types
81const c8* const GEOMETRY_SHADER_TYPE_NAMES[] = {
82 "gs_4_0",
83 0 };
84
85
86} // end namespace video
87} // end namespace irr
88
89#endif // __E_SHADER_TYPES_H_INCLUDED__
90
diff --git a/src/others/irrlicht-1.8.1/include/ETerrainElements.h b/src/others/irrlicht-1.8.1/include/ETerrainElements.h
new file mode 100644
index 0000000..5bb48c0
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ETerrainElements.h
@@ -0,0 +1,36 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_TERRAIN_ELEMENTS_H__
6#define __E_TERRAIN_ELEMENTS_H__
7
8namespace irr
9{
10namespace scene
11{
12
13 //! enumeration for patch sizes specifying the size of patches in the TerrainSceneNode
14 enum E_TERRAIN_PATCH_SIZE
15 {
16 //! patch size of 9, at most, use 4 levels of detail with this patch size.
17 ETPS_9 = 9,
18
19 //! patch size of 17, at most, use 5 levels of detail with this patch size.
20 ETPS_17 = 17,
21
22 //! patch size of 33, at most, use 6 levels of detail with this patch size.
23 ETPS_33 = 33,
24
25 //! patch size of 65, at most, use 7 levels of detail with this patch size.
26 ETPS_65 = 65,
27
28 //! patch size of 129, at most, use 8 levels of detail with this patch size.
29 ETPS_129 = 129
30 };
31
32} // end namespace scene
33} // end namespace irr
34
35#endif
36
diff --git a/src/others/irrlicht-1.8.1/include/IAnimatedMesh.h b/src/others/irrlicht-1.8.1/include/IAnimatedMesh.h
new file mode 100644
index 0000000..3e08528
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IAnimatedMesh.h
@@ -0,0 +1,115 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_ANIMATED_MESH_H_INCLUDED__
6#define __I_ANIMATED_MESH_H_INCLUDED__
7
8#include "aabbox3d.h"
9#include "IMesh.h"
10
11namespace irr
12{
13namespace scene
14{
15 //! Possible types of (animated) meshes.
16 enum E_ANIMATED_MESH_TYPE
17 {
18 //! Unknown animated mesh type.
19 EAMT_UNKNOWN = 0,
20
21 //! Quake 2 MD2 model file
22 EAMT_MD2,
23
24 //! Quake 3 MD3 model file
25 EAMT_MD3,
26
27 //! Maya .obj static model
28 EAMT_OBJ,
29
30 //! Quake 3 .bsp static Map
31 EAMT_BSP,
32
33 //! 3D Studio .3ds file
34 EAMT_3DS,
35
36 //! My3D Mesh, the file format by Zhuck Dimitry
37 EAMT_MY3D,
38
39 //! Pulsar LMTools .lmts file. This Irrlicht loader was written by Jonas Petersen
40 EAMT_LMTS,
41
42 //! Cartography Shop .csm file. This loader was created by Saurav Mohapatra.
43 EAMT_CSM,
44
45 //! .oct file for Paul Nette's FSRad or from Murphy McCauley's Blender .oct exporter.
46 /** The oct file format contains 3D geometry and lightmaps and
47 can be loaded directly by Irrlicht */
48 EAMT_OCT,
49
50 //! Halflife MDL model file
51 EAMT_MDL_HALFLIFE,
52
53 //! generic skinned mesh
54 EAMT_SKINNED
55 };
56
57 //! Interface for an animated mesh.
58 /** There are already simple implementations of this interface available so
59 you don't have to implement this interface on your own if you need to:
60 You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh,
61 irr::scene::SMeshBuffer etc. */
62 class IAnimatedMesh : public IMesh
63 {
64 public:
65
66 //! Gets the frame count of the animated mesh.
67 /** \return The amount of frames. If the amount is 1,
68 it is a static, non animated mesh. */
69 virtual u32 getFrameCount() const = 0;
70
71 //! Gets the animation speed of the animated mesh.
72 /** \return The number of frames per second to play the
73 animation with by default. If the amount is 0,
74 it is a static, non animated mesh. */
75 virtual f32 getAnimationSpeed() const = 0;
76
77 //! Sets the animation speed of the animated mesh.
78 /** \param fps Number of frames per second to play the
79 animation with by default. If the amount is 0,
80 it is not animated. The actual speed is set in the
81 scene node the mesh is instantiated in.*/
82 virtual void setAnimationSpeed(f32 fps) =0;
83
84 //! Returns the IMesh interface for a frame.
85 /** \param frame: Frame number as zero based index. The maximum
86 frame number is getFrameCount() - 1;
87 \param detailLevel: Level of detail. 0 is the lowest, 255 the
88 highest level of detail. Most meshes will ignore the detail level.
89 \param startFrameLoop: Because some animated meshes (.MD2) are
90 blended between 2 static frames, and maybe animated in a loop,
91 the startFrameLoop and the endFrameLoop have to be defined, to
92 prevent the animation to be blended between frames which are
93 outside of this loop.
94 If startFrameLoop and endFrameLoop are both -1, they are ignored.
95 \param endFrameLoop: see startFrameLoop.
96 \return Returns the animated mesh based on a detail level. */
97 virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1) = 0;
98
99 //! Returns the type of the animated mesh.
100 /** In most cases it is not neccessary to use this method.
101 This is useful for making a safe downcast. For example,
102 if getMeshType() returns EAMT_MD2 it's safe to cast the
103 IAnimatedMesh to IAnimatedMeshMD2.
104 \returns Type of the mesh. */
105 virtual E_ANIMATED_MESH_TYPE getMeshType() const
106 {
107 return EAMT_UNKNOWN;
108 }
109 };
110
111} // end namespace scene
112} // end namespace irr
113
114#endif
115
diff --git a/src/others/irrlicht-1.8.1/include/IAnimatedMeshMD2.h b/src/others/irrlicht-1.8.1/include/IAnimatedMeshMD2.h
new file mode 100644
index 0000000..6830f37
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IAnimatedMeshMD2.h
@@ -0,0 +1,79 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_ANIMATED_MESH_MD2_H_INCLUDED__
6#define __I_ANIMATED_MESH_MD2_H_INCLUDED__
7
8#include "IAnimatedMesh.h"
9
10namespace irr
11{
12namespace scene
13{
14
15 //! Types of standard md2 animations
16 enum EMD2_ANIMATION_TYPE
17 {
18 EMAT_STAND = 0,
19 EMAT_RUN,
20 EMAT_ATTACK,
21 EMAT_PAIN_A,
22 EMAT_PAIN_B,
23 EMAT_PAIN_C,
24 EMAT_JUMP,
25 EMAT_FLIP,
26 EMAT_SALUTE,
27 EMAT_FALLBACK,
28 EMAT_WAVE,
29 EMAT_POINT,
30 EMAT_CROUCH_STAND,
31 EMAT_CROUCH_WALK,
32 EMAT_CROUCH_ATTACK,
33 EMAT_CROUCH_PAIN,
34 EMAT_CROUCH_DEATH,
35 EMAT_DEATH_FALLBACK,
36 EMAT_DEATH_FALLFORWARD,
37 EMAT_DEATH_FALLBACKSLOW,
38 EMAT_BOOM,
39
40 //! Not an animation, but amount of animation types.
41 EMAT_COUNT
42 };
43
44 //! Interface for using some special functions of MD2 meshes
45 class IAnimatedMeshMD2 : public IAnimatedMesh
46 {
47 public:
48
49 //! Get frame loop data for a default MD2 animation type.
50 /** \param l The EMD2_ANIMATION_TYPE to get the frames for.
51 \param outBegin The returned beginning frame for animation type specified.
52 \param outEnd The returned ending frame for the animation type specified.
53 \param outFPS The number of frames per second, this animation should be played at.
54 \return beginframe, endframe and frames per second for a default MD2 animation type. */
55 virtual void getFrameLoop(EMD2_ANIMATION_TYPE l, s32& outBegin,
56 s32& outEnd, s32& outFPS) const = 0;
57
58 //! Get frame loop data for a special MD2 animation type, identified by name.
59 /** \param name Name of the animation.
60 \param outBegin The returned beginning frame for animation type specified.
61 \param outEnd The returned ending frame for the animation type specified.
62 \param outFPS The number of frames per second, this animation should be played at.
63 \return beginframe, endframe and frames per second for a special MD2 animation type. */
64 virtual bool getFrameLoop(const c8* name,
65 s32& outBegin, s32& outEnd, s32& outFPS) const = 0;
66
67 //! Get amount of md2 animations in this file.
68 virtual s32 getAnimationCount() const = 0;
69
70 //! Get name of md2 animation.
71 /** \param nr: Zero based index of animation. */
72 virtual const c8* getAnimationName(s32 nr) const = 0;
73 };
74
75} // end namespace scene
76} // end namespace irr
77
78#endif
79
diff --git a/src/others/irrlicht-1.8.1/include/IAnimatedMeshMD3.h b/src/others/irrlicht-1.8.1/include/IAnimatedMeshMD3.h
new file mode 100644
index 0000000..35c1c97
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IAnimatedMeshMD3.h
@@ -0,0 +1,304 @@
1// Copyright (C) 2007-2012 Nikolaus Gebhardt / Thomas Alten
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_ANIMATED_MESH_MD3_H_INCLUDED__
6#define __I_ANIMATED_MESH_MD3_H_INCLUDED__
7
8#include "IAnimatedMesh.h"
9#include "IQ3Shader.h"
10#include "quaternion.h"
11
12namespace irr
13{
14namespace scene
15{
16
17 enum eMD3Models
18 {
19 EMD3_HEAD = 0,
20 EMD3_UPPER,
21 EMD3_LOWER,
22 EMD3_WEAPON,
23 EMD3_NUMMODELS
24 };
25
26 //! Animation list
27 enum EMD3_ANIMATION_TYPE
28 {
29 // Animations for both lower and upper parts of the player
30 EMD3_BOTH_DEATH_1 = 0,
31 EMD3_BOTH_DEAD_1,
32 EMD3_BOTH_DEATH_2,
33 EMD3_BOTH_DEAD_2,
34 EMD3_BOTH_DEATH_3,
35 EMD3_BOTH_DEAD_3,
36
37 // Animations for the upper part
38 EMD3_TORSO_GESTURE,
39 EMD3_TORSO_ATTACK_1,
40 EMD3_TORSO_ATTACK_2,
41 EMD3_TORSO_DROP,
42 EMD3_TORSO_RAISE,
43 EMD3_TORSO_STAND_1,
44 EMD3_TORSO_STAND_2,
45
46 // Animations for the lower part
47 EMD3_LEGS_WALK_CROUCH,
48 EMD3_LEGS_WALK,
49 EMD3_LEGS_RUN,
50 EMD3_LEGS_BACK,
51 EMD3_LEGS_SWIM,
52 EMD3_LEGS_JUMP_1,
53 EMD3_LEGS_LAND_1,
54 EMD3_LEGS_JUMP_2,
55 EMD3_LEGS_LAND_2,
56 EMD3_LEGS_IDLE,
57 EMD3_LEGS_IDLE_CROUCH,
58 EMD3_LEGS_TURN,
59
60 //! Not an animation, but amount of animation types.
61 EMD3_ANIMATION_COUNT
62 };
63
64 struct SMD3AnimationInfo
65 {
66 //! First frame
67 s32 first;
68 //! Last frame
69 s32 num;
70 //! Looping frames
71 s32 looping;
72 //! Frames per second
73 s32 fps;
74 };
75
76
77// byte-align structures
78#include "irrpack.h"
79
80 //! this holds the header info of the MD3 file
81 struct SMD3Header
82 {
83 c8 headerID[4]; //id of file, always "IDP3"
84 s32 Version; //this is a version number, always 15
85 s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars
86 s32 numFrames; //number of KeyFrames
87 s32 numTags; //number of 'tags' per frame
88 s32 numMeshes; //number of meshes/skins
89 s32 numMaxSkins; //maximum number of unique skins used in md3 file. artefact md2
90 s32 frameStart; //starting position of frame-structur
91 s32 tagStart; //starting position of tag-structures
92 s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
93 s32 fileSize;
94 } PACK_STRUCT;
95
96 //! this holds the header info of an MD3 mesh section
97 struct SMD3MeshHeader
98 {
99 c8 meshID[4]; //id, must be IDP3
100 c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars
101
102 s32 numFrames; //number of meshframes in mesh
103 s32 numShader; //number of skins in mesh
104 s32 numVertices; //number of vertices
105 s32 numTriangles; //number of Triangles
106
107 s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header
108 s32 offset_shaders; //size of header
109 s32 offset_st; //starting position of texvector data, relative to start of Mesh_Header
110 s32 vertexStart; //starting position of vertex data,relative to start of Mesh_Header
111 s32 offset_end;
112 } PACK_STRUCT;
113
114
115 //! Compressed Vertex Data
116 struct SMD3Vertex
117 {
118 s16 position[3];
119 u8 normal[2];
120 } PACK_STRUCT;
121
122 //! Texture Coordinate
123 struct SMD3TexCoord
124 {
125 f32 u;
126 f32 v;
127 } PACK_STRUCT;
128
129 //! Triangle Index
130 struct SMD3Face
131 {
132 s32 Index[3];
133 } PACK_STRUCT;
134
135
136// Default alignment
137#include "irrunpack.h"
138
139 //! Holding Frame Data for a Mesh
140 struct SMD3MeshBuffer : public IReferenceCounted
141 {
142 SMD3MeshHeader MeshHeader;
143
144 core::stringc Shader;
145 core::array < s32 > Indices;
146 core::array < SMD3Vertex > Vertices;
147 core::array < SMD3TexCoord > Tex;
148 };
149
150 //! hold a tag info for connecting meshes
151 /** Basically its an alternate way to describe a transformation. */
152 struct SMD3QuaternionTag
153 {
154 virtual ~SMD3QuaternionTag()
155 {
156 position.X = 0.f;
157 }
158
159 // construct copy constructor
160 SMD3QuaternionTag( const SMD3QuaternionTag & copyMe )
161 {
162 *this = copyMe;
163 }
164
165 // construct for searching
166 SMD3QuaternionTag( const core::stringc& name )
167 : Name ( name ) {}
168
169 // construct from a position and euler angles in degrees
170 SMD3QuaternionTag ( const core::vector3df &pos, const core::vector3df &angle )
171 : position(pos), rotation(angle * core::DEGTORAD) {}
172
173 // set to matrix
174 void setto ( core::matrix4 &m )
175 {
176 rotation.getMatrix ( m, position );
177 }
178
179 bool operator == ( const SMD3QuaternionTag &other ) const
180 {
181 return Name == other.Name;
182 }
183
184 SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe )
185 {
186 Name = copyMe.Name;
187 position = copyMe.position;
188 rotation = copyMe.rotation;
189 return *this;
190 }
191
192 core::stringc Name;
193 core::vector3df position;
194 core::quaternion rotation;
195 };
196
197 //! holds a associative list of named quaternions
198 struct SMD3QuaternionTagList
199 {
200 SMD3QuaternionTagList()
201 {
202 Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE);
203 }
204
205 // construct copy constructor
206 SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe)
207 {
208 *this = copyMe;
209 }
210
211 virtual ~SMD3QuaternionTagList() {}
212
213 SMD3QuaternionTag* get(const core::stringc& name)
214 {
215 SMD3QuaternionTag search ( name );
216 s32 index = Container.linear_search ( search );
217 if ( index >= 0 )
218 return &Container[index];
219 return 0;
220 }
221
222 u32 size () const
223 {
224 return Container.size();
225 }
226
227 void set_used(u32 new_size)
228 {
229 s32 diff = (s32) new_size - (s32) Container.allocated_size();
230 if ( diff > 0 )
231 {
232 SMD3QuaternionTag e("");
233 for ( s32 i = 0; i < diff; ++i )
234 Container.push_back(e);
235 }
236 }
237
238 const SMD3QuaternionTag& operator[](u32 index) const
239 {
240 return Container[index];
241 }
242
243 SMD3QuaternionTag& operator[](u32 index)
244 {
245 return Container[index];
246 }
247
248 void push_back(const SMD3QuaternionTag& other)
249 {
250 Container.push_back(other);
251 }
252
253 SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe)
254 {
255 Container = copyMe.Container;
256 return *this;
257 }
258
259 private:
260 core::array < SMD3QuaternionTag > Container;
261 };
262
263
264 //! Holding Frames Buffers and Tag Infos
265 struct SMD3Mesh: public IReferenceCounted
266 {
267 SMD3Mesh ()
268 {
269 MD3Header.numFrames = 0;
270 }
271
272 virtual ~SMD3Mesh()
273 {
274 for (u32 i=0; i<Buffer.size(); ++i)
275 Buffer[i]->drop();
276 }
277
278 core::stringc Name;
279 core::array<SMD3MeshBuffer*> Buffer;
280 SMD3QuaternionTagList TagList;
281 SMD3Header MD3Header;
282 };
283
284
285 //! Interface for using some special functions of MD3 meshes
286 class IAnimatedMeshMD3 : public IAnimatedMesh
287 {
288 public:
289
290 //! tune how many frames you want to render inbetween.
291 virtual void setInterpolationShift(u32 shift, u32 loopMode) =0;
292
293 //! get the tag list of the mesh.
294 virtual SMD3QuaternionTagList* getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) =0;
295
296 //! get the original md3 mesh.
297 virtual SMD3Mesh* getOriginalMesh() =0;
298 };
299
300} // end namespace scene
301} // end namespace irr
302
303#endif
304
diff --git a/src/others/irrlicht-1.8.1/include/IAnimatedMeshSceneNode.h b/src/others/irrlicht-1.8.1/include/IAnimatedMeshSceneNode.h
new file mode 100644
index 0000000..84d25a2
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IAnimatedMeshSceneNode.h
@@ -0,0 +1,228 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__
6#define __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9#include "IBoneSceneNode.h"
10#include "IAnimatedMeshMD2.h"
11#include "IAnimatedMeshMD3.h"
12
13namespace irr
14{
15namespace scene
16{
17 class IShadowVolumeSceneNode;
18
19 enum E_JOINT_UPDATE_ON_RENDER
20 {
21 //! do nothing
22 EJUOR_NONE = 0,
23
24 //! get joints positions from the mesh (for attached nodes, etc)
25 EJUOR_READ,
26
27 //! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() )
28 EJUOR_CONTROL
29 };
30
31
32 class IAnimatedMeshSceneNode;
33
34 //! Callback interface for catching events of ended animations.
35 /** Implement this interface and use
36 IAnimatedMeshSceneNode::setAnimationEndCallback to be able to
37 be notified if an animation playback has ended.
38 **/
39 class IAnimationEndCallBack : public virtual IReferenceCounted
40 {
41 public:
42
43 //! Will be called when the animation playback has ended.
44 /** See IAnimatedMeshSceneNode::setAnimationEndCallback for
45 more informations.
46 \param node: Node of which the animation has ended. */
47 virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node) = 0;
48 };
49
50 //! Scene node capable of displaying an animated mesh and its shadow.
51 /** The shadow is optional: If a shadow should be displayed too, just
52 invoke the IAnimatedMeshSceneNode::createShadowVolumeSceneNode().*/
53 class IAnimatedMeshSceneNode : public ISceneNode
54 {
55 public:
56
57 //! Constructor
58 IAnimatedMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
59 const core::vector3df& position = core::vector3df(0,0,0),
60 const core::vector3df& rotation = core::vector3df(0,0,0),
61 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f))
62 : ISceneNode(parent, mgr, id, position, rotation, scale) {}
63
64 //! Destructor
65 virtual ~IAnimatedMeshSceneNode() {}
66
67 //! Sets the current frame number.
68 /** From now on the animation is played from this frame.
69 \param frame: Number of the frame to let the animation be started from.
70 The frame number must be a valid frame number of the IMesh used by this
71 scene node. Set IAnimatedMesh::getMesh() for details. */
72 virtual void setCurrentFrame(f32 frame) = 0;
73
74 //! Sets the frame numbers between the animation is looped.
75 /** The default is 0 - MaximalFrameCount of the mesh.
76 \param begin: Start frame number of the loop.
77 \param end: End frame number of the loop.
78 \return True if successful, false if not. */
79 virtual bool setFrameLoop(s32 begin, s32 end) = 0;
80
81 //! Sets the speed with which the animation is played.
82 /** \param framesPerSecond: Frames per second played. */
83 virtual void setAnimationSpeed(f32 framesPerSecond) = 0;
84
85 //! Gets the speed with which the animation is played.
86 /** \return Frames per second played. */
87 virtual f32 getAnimationSpeed() const =0;
88
89 //! Creates shadow volume scene node as child of this node.
90 /** The shadow can be rendered using the ZPass or the zfail
91 method. ZPass is a little bit faster because the shadow volume
92 creation is easier, but with this method there occur ugly
93 looking artifacs when the camera is inside the shadow volume.
94 These error do not occur with the ZFail method.
95 \param shadowMesh: Optional custom mesh for shadow volume.
96 \param id: Id of the shadow scene node. This id can be used to
97 identify the node later.
98 \param zfailmethod: If set to true, the shadow will use the
99 zfail method, if not, zpass is used.
100 \param infinity: Value used by the shadow volume algorithm to
101 scale the shadow volume (for zfail shadow volume we support only
102 finite shadows, so camera zfar must be larger than shadow back cap,
103 which is depend on infinity parameter).
104 \return Pointer to the created shadow scene node. This pointer
105 should not be dropped. See IReferenceCounted::drop() for more
106 information. */
107 virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh=0,
108 s32 id=-1, bool zfailmethod=true, f32 infinity=1000.0f) = 0;
109
110
111 //! Get a pointer to a joint in the mesh (if the mesh is a bone based mesh).
112 /** With this method it is possible to attach scene nodes to
113 joints for example possible to attach a weapon to the left hand
114 of an animated model. This example shows how:
115 \code
116 ISceneNode* hand =
117 yourAnimatedMeshSceneNode->getJointNode("LeftHand");
118 hand->addChild(weaponSceneNode);
119 \endcode
120 Please note that the joint returned by this method may not exist
121 before this call and the joints in the node were created by it.
122 \param jointName: Name of the joint.
123 \return Pointer to the scene node which represents the joint
124 with the specified name. Returns 0 if the contained mesh is not
125 an skinned mesh or the name of the joint could not be found. */
126 virtual IBoneSceneNode* getJointNode(const c8* jointName)=0;
127
128 //! same as getJointNode(const c8* jointName), but based on id
129 virtual IBoneSceneNode* getJointNode(u32 jointID) = 0;
130
131 //! Gets joint count.
132 /** \return Amount of joints in the mesh. */
133 virtual u32 getJointCount() const = 0;
134
135 //! Starts a default MD2 animation.
136 /** With this method it is easily possible to start a Run,
137 Attack, Die or whatever animation, if the mesh contained in
138 this scene node is an md2 mesh. Otherwise, nothing happens.
139 \param anim: An MD2 animation type, which should be played, for
140 example EMAT_STAND for the standing animation.
141 \return True if successful, and false if not, for example if
142 the mesh in the scene node is not a md2 mesh. */
143 virtual bool setMD2Animation(EMD2_ANIMATION_TYPE anim) = 0;
144
145 //! Starts a special MD2 animation.
146 /** With this method it is easily possible to start a Run,
147 Attack, Die or whatever animation, if the mesh contained in
148 this scene node is an md2 mesh. Otherwise, nothing happens.
149 This method uses a character string to identify the animation.
150 If the animation is a standard md2 animation, you might want to
151 start this animation with the EMD2_ANIMATION_TYPE enumeration
152 instead.
153 \param animationName: Name of the animation which should be
154 played.
155 \return Returns true if successful, and false if not, for
156 example if the mesh in the scene node is not an md2 mesh, or no
157 animation with this name could be found. */
158 virtual bool setMD2Animation(const c8* animationName) = 0;
159
160 //! Returns the currently displayed frame number.
161 virtual f32 getFrameNr() const = 0;
162 //! Returns the current start frame number.
163 virtual s32 getStartFrame() const = 0;
164 //! Returns the current end frame number.
165 virtual s32 getEndFrame() const = 0;
166
167 //! Sets looping mode which is on by default.
168 /** If set to false, animations will not be played looped. */
169 virtual void setLoopMode(bool playAnimationLooped) = 0;
170
171 //! returns the current loop mode
172 /** When true the animations are played looped */
173 virtual bool getLoopMode() const = 0;
174
175 //! Sets a callback interface which will be called if an animation playback has ended.
176 /** Set this to 0 to disable the callback again.
177 Please note that this will only be called when in non looped
178 mode, see IAnimatedMeshSceneNode::setLoopMode(). */
179 virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0) = 0;
180
181 //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
182 /** In this way it is possible to change the materials a mesh
183 causing all mesh scene nodes referencing this mesh to change
184 too. */
185 virtual void setReadOnlyMaterials(bool readonly) = 0;
186
187 //! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
188 virtual bool isReadOnlyMaterials() const = 0;
189
190 //! Sets a new mesh
191 virtual void setMesh(IAnimatedMesh* mesh) = 0;
192
193 //! Returns the current mesh
194 virtual IAnimatedMesh* getMesh(void) = 0;
195
196 //! Get the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, or the absolutetransformation if it's a normal scenenode
197 virtual const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname) = 0;
198
199 //! Set how the joints should be updated on render
200 virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode)=0;
201
202 //! Sets the transition time in seconds
203 /** Note: This needs to enable joints, and setJointmode set to
204 EJUOR_CONTROL. You must call animateJoints(), or the mesh will
205 not animate. */
206 virtual void setTransitionTime(f32 Time) =0;
207
208 //! animates the joints in the mesh based on the current frame.
209 /** Also takes in to account transitions. */
210 virtual void animateJoints(bool CalculateAbsolutePositions=true) = 0;
211
212 //! render mesh ignoring its transformation.
213 /** Culling is unaffected. */
214 virtual void setRenderFromIdentity( bool On )=0;
215
216 //! Creates a clone of this scene node and its children.
217 /** \param newParent An optional new parent.
218 \param newManager An optional new scene manager.
219 \return The newly created clone of this node. */
220 virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) = 0;
221
222 };
223
224} // end namespace scene
225} // end namespace irr
226
227#endif
228
diff --git a/src/others/irrlicht-1.8.1/include/IAttributeExchangingObject.h b/src/others/irrlicht-1.8.1/include/IAttributeExchangingObject.h
new file mode 100644
index 0000000..5b13cdb
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IAttributeExchangingObject.h
@@ -0,0 +1,71 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__
6#define __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9
10
11namespace irr
12{
13
14namespace io
15{
16
17class IAttributes;
18
19//! Enumeration flags passed through SAttributeReadWriteOptions to the IAttributeExchangingObject object
20enum E_ATTRIBUTE_READ_WRITE_FLAGS
21{
22 //! Serialization/Deserializion is done for an xml file
23 EARWF_FOR_FILE = 0x00000001,
24
25 //! Serialization/Deserializion is done for an editor property box
26 EARWF_FOR_EDITOR = 0x00000002,
27
28 //! When writing filenames, relative paths should be used
29 EARWF_USE_RELATIVE_PATHS = 0x00000004
30};
31
32
33//! struct holding data describing options
34struct SAttributeReadWriteOptions
35{
36 //! Constructor
37 SAttributeReadWriteOptions()
38 : Flags(0), Filename(0)
39 {
40 }
41
42 //! Combination of E_ATTRIBUTE_READ_WRITE_FLAGS or other, custom ones
43 s32 Flags;
44
45 //! Optional filename
46 const fschar_t* Filename;
47};
48
49
50//! An object which is able to serialize and deserialize its attributes into an attributes object
51class IAttributeExchangingObject : virtual public IReferenceCounted
52{
53public:
54
55 //! Writes attributes of the object.
56 /** Implement this to expose the attributes of your scene node animator for
57 scripting languages, editors, debuggers or xml serialization purposes. */
58 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}
59
60 //! Reads attributes of the object.
61 /** Implement this to set the attributes of your scene node animator for
62 scripting languages, editors, debuggers or xml deserialization purposes. */
63 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) {}
64
65};
66
67} // end namespace io
68} // end namespace irr
69
70#endif
71
diff --git a/src/others/irrlicht-1.8.1/include/IAttributes.h b/src/others/irrlicht-1.8.1/include/IAttributes.h
new file mode 100644
index 0000000..f137635
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IAttributes.h
@@ -0,0 +1,738 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_ATTRIBUTES_H_INCLUDED__
6#define __I_ATTRIBUTES_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "SColor.h"
10#include "vector3d.h"
11#include "vector2d.h"
12#include "line2d.h"
13#include "line3d.h"
14#include "triangle3d.h"
15#include "position2d.h"
16#include "rect.h"
17#include "dimension2d.h"
18#include "matrix4.h"
19#include "quaternion.h"
20#include "plane3d.h"
21#include "triangle3d.h"
22#include "line2d.h"
23#include "line3d.h"
24#include "irrString.h"
25#include "irrArray.h"
26#include "IXMLReader.h"
27#include "EAttributes.h"
28#include "path.h"
29
30namespace irr
31{
32namespace video
33{
34 class ITexture;
35} // end namespace video
36namespace io
37{
38 class IXMLWriter;
39
40//! Provides a generic interface for attributes and their values and the possiblity to serialize them
41class IAttributes : public virtual IReferenceCounted
42{
43public:
44
45 //! Returns amount of attributes in this collection of attributes.
46 virtual u32 getAttributeCount() const = 0;
47
48 //! Returns attribute name by index.
49 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
50 virtual const c8* getAttributeName(s32 index) = 0;
51
52 //! Returns the type of an attribute
53 //! \param attributeName: Name for the attribute
54 virtual E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) = 0;
55
56 //! Returns attribute type by index.
57 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
58 virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) = 0;
59
60 //! Returns the type string of the attribute
61 //! \param attributeName: String for the attribute type
62 virtual const wchar_t* getAttributeTypeString(const c8* attributeName) = 0;
63
64 //! Returns the type string of the attribute by index.
65 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
66 virtual const wchar_t* getAttributeTypeString(s32 index) = 0;
67
68 //! Returns if an attribute with a name exists
69 virtual bool existsAttribute(const c8* attributeName) = 0;
70
71 //! Returns attribute index from name, -1 if not found
72 virtual s32 findAttribute(const c8* attributeName) const =0;
73
74 //! Removes all attributes
75 virtual void clear() = 0;
76
77 //! Reads attributes from a xml file.
78 //! \param reader The XML reader to read from
79 //! \param readCurrentElementOnly If set to true, reading only works if current element has the name 'attributes' or
80 //! the name specified using elementName.
81 //! \param elementName The surrounding element name. If it is null, the default one, "attributes" will be taken.
82 //! If set to false, the first appearing list of attributes are read.
83 virtual bool read(io::IXMLReader* reader, bool readCurrentElementOnly=false, const wchar_t* elementName=0) = 0;
84
85 //! Write these attributes into a xml file
86 //! \param writer: The XML writer to write to
87 //! \param writeXMLHeader: Writes a header to the XML file, required if at the beginning of the file
88 //! \param elementName: The surrounding element name. If it is null, the default one, "attributes" will be taken.
89 virtual bool write(io::IXMLWriter* writer, bool writeXMLHeader=false, const wchar_t* elementName=0) = 0;
90
91
92 /*
93
94 Integer Attribute
95
96 */
97
98 //! Adds an attribute as integer
99 virtual void addInt(const c8* attributeName, s32 value) = 0;
100
101 //! Sets an attribute as integer value
102 virtual void setAttribute(const c8* attributeName, s32 value) = 0;
103
104 //! Gets an attribute as integer value
105 //! \param attributeName: Name of the attribute to get.
106 //! \return Returns value of the attribute previously set by setAttribute()
107 virtual s32 getAttributeAsInt(const c8* attributeName) const =0;
108
109 //! Gets an attribute as integer value
110 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
111 virtual s32 getAttributeAsInt(s32 index) const =0;
112
113 //! Sets an attribute as integer value
114 virtual void setAttribute(s32 index, s32 value) = 0;
115
116 /*
117
118 Float Attribute
119
120 */
121
122 //! Adds an attribute as float
123 virtual void addFloat(const c8* attributeName, f32 value) = 0;
124
125 //! Sets a attribute as float value
126 virtual void setAttribute(const c8* attributeName, f32 value) = 0;
127
128 //! Gets an attribute as float value
129 //! \param attributeName: Name of the attribute to get.
130 //! \return Returns value of the attribute previously set by setAttribute()
131 virtual f32 getAttributeAsFloat(const c8* attributeName) = 0;
132
133 //! Gets an attribute as float value
134 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
135 virtual f32 getAttributeAsFloat(s32 index) = 0;
136
137 //! Sets an attribute as float value
138 virtual void setAttribute(s32 index, f32 value) = 0;
139
140 /*
141
142 String Attribute
143
144 */
145
146 //! Adds an attribute as string
147 virtual void addString(const c8* attributeName, const c8* value) = 0;
148
149 //! Sets an attribute value as string.
150 //! \param attributeName: Name for the attribute
151 //! \param value: Value for the attribute. Set this to 0 to delete the attribute
152 virtual void setAttribute(const c8* attributeName, const c8* value) = 0;
153
154 //! Gets an attribute as string.
155 //! \param attributeName: Name of the attribute to get.
156 //! \return Returns value of the attribute previously set by setAttribute()
157 //! or 0 if attribute is not set.
158 virtual core::stringc getAttributeAsString(const c8* attributeName) = 0;
159
160 //! Gets an attribute as string.
161 //! \param attributeName Name of the attribute to get.
162 //! \param target Buffer where the string is copied to.
163 virtual void getAttributeAsString(const c8* attributeName, c8* target) = 0;
164
165 //! Returns attribute value as string by index.
166 //! \param index Index value, must be between 0 and getAttributeCount()-1.
167 virtual core::stringc getAttributeAsString(s32 index) = 0;
168
169 //! Sets an attribute value as string.
170 //! \param index Index value, must be between 0 and getAttributeCount()-1.
171 //! \param value String to which the attribute is set.
172 virtual void setAttribute(s32 index, const c8* value) = 0;
173
174 // wide strings
175
176 //! Adds an attribute as string
177 virtual void addString(const c8* attributeName, const wchar_t* value) = 0;
178
179 //! Sets an attribute value as string.
180 //! \param attributeName: Name for the attribute
181 //! \param value: Value for the attribute. Set this to 0 to delete the attribute
182 virtual void setAttribute(const c8* attributeName, const wchar_t* value) = 0;
183
184 //! Gets an attribute as string.
185 //! \param attributeName: Name of the attribute to get.
186 //! \return Returns value of the attribute previously set by setAttribute()
187 //! or 0 if attribute is not set.
188 virtual core::stringw getAttributeAsStringW(const c8* attributeName) = 0;
189
190 //! Gets an attribute as string.
191 //! \param attributeName: Name of the attribute to get.
192 //! \param target: Buffer where the string is copied to.
193 virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) = 0;
194
195 //! Returns attribute value as string by index.
196 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
197 virtual core::stringw getAttributeAsStringW(s32 index) = 0;
198
199 //! Sets an attribute value as string.
200 //! \param index Index value, must be between 0 and getAttributeCount()-1.
201 //! \param value String to which the attribute is set.
202 virtual void setAttribute(s32 index, const wchar_t* value) = 0;
203
204 /*
205
206 Binary Data Attribute
207
208 */
209
210 //! Adds an attribute as binary data
211 virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) = 0;
212
213 //! Sets an attribute as binary data
214 virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0;
215
216 //! Gets an attribute as binary data
217 /** \param attributeName: Name of the attribute to get.
218 \param outData Pointer to buffer where data shall be stored.
219 \param maxSizeInBytes Maximum number of bytes to write into outData.
220 */
221 virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) = 0;
222
223 //! Gets an attribute as binary data
224 /** \param index: Index value, must be between 0 and getAttributeCount()-1.
225 \param outData Pointer to buffer where data shall be stored.
226 \param maxSizeInBytes Maximum number of bytes to write into outData.
227 */
228 virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) = 0;
229
230 //! Sets an attribute as binary data
231 virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes ) = 0;
232
233
234 /*
235 Array Attribute
236 */
237
238 //! Adds an attribute as wide string array
239 virtual void addArray(const c8* attributeName, const core::array<core::stringw>& value) = 0;
240
241 //! Sets an attribute value as a wide string array.
242 //! \param attributeName: Name for the attribute
243 //! \param value: Value for the attribute. Set this to 0 to delete the attribute
244 virtual void setAttribute(const c8* attributeName, const core::array<core::stringw>& value) = 0;
245
246 //! Gets an attribute as an array of wide strings.
247 //! \param attributeName: Name of the attribute to get.
248 //! \return Returns value of the attribute previously set by setAttribute()
249 //! or 0 if attribute is not set.
250 virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName) = 0;
251
252 //! Returns attribute value as an array of wide strings by index.
253 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
254 virtual core::array<core::stringw> getAttributeAsArray(s32 index) = 0;
255
256 //! Sets an attribute as an array of wide strings
257 virtual void setAttribute(s32 index, const core::array<core::stringw>& value) = 0;
258
259
260 /*
261
262 Bool Attribute
263
264 */
265
266 //! Adds an attribute as bool
267 virtual void addBool(const c8* attributeName, bool value) = 0;
268
269 //! Sets an attribute as boolean value
270 virtual void setAttribute(const c8* attributeName, bool value) = 0;
271
272 //! Gets an attribute as boolean value
273 //! \param attributeName: Name of the attribute to get.
274 //! \return Returns value of the attribute previously set by setAttribute()
275 virtual bool getAttributeAsBool(const c8* attributeName) = 0;
276
277 //! Gets an attribute as boolean value
278 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
279 virtual bool getAttributeAsBool(s32 index) = 0;
280
281 //! Sets an attribute as boolean value
282 virtual void setAttribute(s32 index, bool value) = 0;
283
284 /*
285
286 Enumeration Attribute
287
288 */
289
290 //! Adds an attribute as enum
291 virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
292
293 //! Adds an attribute as enum
294 virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) = 0;
295
296 //! Sets an attribute as enumeration
297 virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
298
299 //! Gets an attribute as enumeration
300 //! \param attributeName: Name of the attribute to get.
301 //! \return Returns value of the attribute previously set by setAttribute()
302 virtual const c8* getAttributeAsEnumeration(const c8* attributeName) = 0;
303
304 //! Gets an attribute as enumeration
305 /** \param attributeName: Name of the attribute to get.
306 \param enumerationLiteralsToUse: Use these enumeration literals to get
307 the index value instead of the set ones. This is useful when the
308 attribute list maybe was read from an xml file, and only contains the
309 enumeration string, but no information about its index.
310 \return Returns value of the attribute previously set by setAttribute()
311 */
312 virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse) = 0;
313
314 //! Gets an attribute as enumeration
315 /** \param index: Index value, must be between 0 and getAttributeCount()-1.
316 \param enumerationLiteralsToUse: Use these enumeration literals to get
317 the index value instead of the set ones. This is useful when the
318 attribute list maybe was read from an xml file, and only contains the
319 enumeration string, but no information about its index.
320 \return Returns value of the attribute previously set by setAttribute()
321 */
322 virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse) = 0;
323
324 //! Gets an attribute as enumeration
325 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
326 virtual const c8* getAttributeAsEnumeration(s32 index) = 0;
327
328 //! Gets the list of enumeration literals of an enumeration attribute
329 //! \param attributeName Name of the attribute to get.
330 //! \param outLiterals Set of strings to choose the enum name from.
331 virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) = 0;
332
333 //! Gets the list of enumeration literals of an enumeration attribute
334 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
335 //! \param outLiterals Set of strings to choose the enum name from.
336 virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) = 0;
337
338 //! Sets an attribute as enumeration
339 virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
340
341
342 /*
343
344 SColor Attribute
345
346 */
347
348 //! Adds an attribute as color
349 virtual void addColor(const c8* attributeName, video::SColor value) = 0;
350
351
352 //! Sets a attribute as color
353 virtual void setAttribute(const c8* attributeName, video::SColor color) = 0;
354
355 //! Gets an attribute as color
356 //! \param attributeName: Name of the attribute to get.
357 //! \return Returns value of the attribute previously set by setAttribute()
358 virtual video::SColor getAttributeAsColor(const c8* attributeName) = 0;
359
360 //! Gets an attribute as color
361 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
362 virtual video::SColor getAttributeAsColor(s32 index) = 0;
363
364 //! Sets an attribute as color
365 virtual void setAttribute(s32 index, video::SColor color) = 0;
366
367 /*
368
369 SColorf Attribute
370
371 */
372
373 //! Adds an attribute as floating point color
374 virtual void addColorf(const c8* attributeName, video::SColorf value) = 0;
375
376 //! Sets a attribute as floating point color
377 virtual void setAttribute(const c8* attributeName, video::SColorf color) = 0;
378
379 //! Gets an attribute as floating point color
380 //! \param attributeName: Name of the attribute to get.
381 //! \return Returns value of the attribute previously set by setAttribute()
382 virtual video::SColorf getAttributeAsColorf(const c8* attributeName) = 0;
383
384 //! Gets an attribute as floating point color
385 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
386 virtual video::SColorf getAttributeAsColorf(s32 index) = 0;
387
388 //! Sets an attribute as floating point color
389 virtual void setAttribute(s32 index, video::SColorf color) = 0;
390
391
392 /*
393
394 Vector3d Attribute
395
396 */
397
398 //! Adds an attribute as 3d vector
399 virtual void addVector3d(const c8* attributeName, core::vector3df value) = 0;
400
401 //! Sets a attribute as 3d vector
402 virtual void setAttribute(const c8* attributeName, core::vector3df v) = 0;
403
404 //! Gets an attribute as 3d vector
405 //! \param attributeName: Name of the attribute to get.
406 //! \return Returns value of the attribute previously set by setAttribute()
407 virtual core::vector3df getAttributeAsVector3d(const c8* attributeName) = 0;
408
409 //! Gets an attribute as 3d vector
410 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
411 virtual core::vector3df getAttributeAsVector3d(s32 index) = 0;
412
413 //! Sets an attribute as vector
414 virtual void setAttribute(s32 index, core::vector3df v) = 0;
415
416 /*
417
418 Vector2d Attribute
419
420 */
421
422 //! Adds an attribute as 2d vector
423 virtual void addVector2d(const c8* attributeName, core::vector2df value) = 0;
424
425 //! Sets a attribute as 2d vector
426 virtual void setAttribute(const c8* attributeName, core::vector2df v) = 0;
427
428 //! Gets an attribute as vector
429 //! \param attributeName: Name of the attribute to get.
430 //! \return Returns value of the attribute previously set by setAttribute()
431 virtual core::vector2df getAttributeAsVector2d(const c8* attributeName) = 0;
432
433 //! Gets an attribute as position
434 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
435 virtual core::vector2df getAttributeAsVector2d(s32 index) = 0;
436
437 //! Sets an attribute as 2d vector
438 virtual void setAttribute(s32 index, core::vector2df v) = 0;
439
440 /*
441
442 Position2d Attribute
443
444 */
445
446 //! Adds an attribute as 2d position
447 virtual void addPosition2d(const c8* attributeName, core::position2di value) = 0;
448
449 //! Sets a attribute as 2d position
450 virtual void setAttribute(const c8* attributeName, core::position2di v) = 0;
451
452 //! Gets an attribute as position
453 //! \param attributeName: Name of the attribute to get.
454 //! \return Returns value of the attribute previously set by setAttribute()
455 virtual core::position2di getAttributeAsPosition2d(const c8* attributeName) = 0;
456
457 //! Gets an attribute as position
458 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
459 virtual core::position2di getAttributeAsPosition2d(s32 index) = 0;
460
461 //! Sets an attribute as 2d position
462 virtual void setAttribute(s32 index, core::position2di v) = 0;
463
464 /*
465
466 Rectangle Attribute
467
468 */
469
470 //! Adds an attribute as rectangle
471 virtual void addRect(const c8* attributeName, core::rect<s32> value) = 0;
472
473 //! Sets an attribute as rectangle
474 virtual void setAttribute(const c8* attributeName, core::rect<s32> v) = 0;
475
476 //! Gets an attribute as rectangle
477 //! \param attributeName: Name of the attribute to get.
478 //! \return Returns value of the attribute previously set by setAttribute()
479 virtual core::rect<s32> getAttributeAsRect(const c8* attributeName) = 0;
480
481 //! Gets an attribute as rectangle
482 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
483 virtual core::rect<s32> getAttributeAsRect(s32 index) = 0;
484
485 //! Sets an attribute as rectangle
486 virtual void setAttribute(s32 index, core::rect<s32> v) = 0;
487
488
489 /*
490
491 Dimension2d Attribute
492
493 */
494
495 //! Adds an attribute as dimension2d
496 virtual void addDimension2d(const c8* attributeName, core::dimension2d<u32> value) = 0;
497
498 //! Sets an attribute as dimension2d
499 virtual void setAttribute(const c8* attributeName, core::dimension2d<u32> v) = 0;
500
501 //! Gets an attribute as dimension2d
502 //! \param attributeName: Name of the attribute to get.
503 //! \return Returns value of the attribute previously set by setAttribute()
504 virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName) = 0;
505
506 //! Gets an attribute as dimension2d
507 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
508 virtual core::dimension2d<u32> getAttributeAsDimension2d(s32 index) = 0;
509
510 //! Sets an attribute as dimension2d
511 virtual void setAttribute(s32 index, core::dimension2d<u32> v) = 0;
512
513
514 /*
515 matrix attribute
516 */
517
518 //! Adds an attribute as matrix
519 virtual void addMatrix(const c8* attributeName, const core::matrix4& v) = 0;
520
521 //! Sets an attribute as matrix
522 virtual void setAttribute(const c8* attributeName, const core::matrix4& v) = 0;
523
524 //! Gets an attribute as a matrix4
525 //! \param attributeName: Name of the attribute to get.
526 //! \return Returns value of the attribute previously set by setAttribute()
527 virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName) = 0;
528
529 //! Gets an attribute as matrix
530 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
531 virtual core::matrix4 getAttributeAsMatrix(s32 index) = 0;
532
533 //! Sets an attribute as matrix
534 virtual void setAttribute(s32 index, const core::matrix4& v) = 0;
535
536 /*
537 quaternion attribute
538
539 */
540
541 //! Adds an attribute as quaternion
542 virtual void addQuaternion(const c8* attributeName, core::quaternion v) = 0;
543
544 //! Sets an attribute as quaternion
545 virtual void setAttribute(const c8* attributeName, core::quaternion v) = 0;
546
547 //! Gets an attribute as a quaternion
548 //! \param attributeName: Name of the attribute to get.
549 //! \return Returns value of the attribute previously set by setAttribute()
550 virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName) = 0;
551
552 //! Gets an attribute as quaternion
553 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
554 virtual core::quaternion getAttributeAsQuaternion(s32 index) = 0;
555
556 //! Sets an attribute as quaternion
557 virtual void setAttribute(s32 index, core::quaternion v) = 0;
558
559 /*
560
561 3d bounding box
562
563 */
564
565 //! Adds an attribute as axis aligned bounding box
566 virtual void addBox3d(const c8* attributeName, core::aabbox3df v) = 0;
567
568 //! Sets an attribute as axis aligned bounding box
569 virtual void setAttribute(const c8* attributeName, core::aabbox3df v) = 0;
570
571 //! Gets an attribute as a axis aligned bounding box
572 //! \param attributeName: Name of the attribute to get.
573 //! \return Returns value of the attribute previously set by setAttribute()
574 virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName) = 0;
575
576 //! Gets an attribute as axis aligned bounding box
577 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
578 virtual core::aabbox3df getAttributeAsBox3d(s32 index) = 0;
579
580 //! Sets an attribute as axis aligned bounding box
581 virtual void setAttribute(s32 index, core::aabbox3df v) = 0;
582
583 /*
584
585 plane
586
587 */
588
589 //! Adds an attribute as 3d plane
590 virtual void addPlane3d(const c8* attributeName, core::plane3df v) = 0;
591
592 //! Sets an attribute as 3d plane
593 virtual void setAttribute(const c8* attributeName, core::plane3df v) = 0;
594
595 //! Gets an attribute as a 3d plane
596 //! \param attributeName: Name of the attribute to get.
597 //! \return Returns value of the attribute previously set by setAttribute()
598 virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName) = 0;
599
600 //! Gets an attribute as 3d plane
601 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
602 virtual core::plane3df getAttributeAsPlane3d(s32 index) = 0;
603
604 //! Sets an attribute as 3d plane
605 virtual void setAttribute(s32 index, core::plane3df v) = 0;
606
607
608 /*
609
610 3d triangle
611
612 */
613
614 //! Adds an attribute as 3d triangle
615 virtual void addTriangle3d(const c8* attributeName, core::triangle3df v) = 0;
616
617 //! Sets an attribute as 3d trianle
618 virtual void setAttribute(const c8* attributeName, core::triangle3df v) = 0;
619
620 //! Gets an attribute as a 3d triangle
621 //! \param attributeName: Name of the attribute to get.
622 //! \return Returns value of the attribute previously set by setAttribute()
623 virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName) = 0;
624
625 //! Gets an attribute as 3d triangle
626 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
627 virtual core::triangle3df getAttributeAsTriangle3d(s32 index) = 0;
628
629 //! Sets an attribute as 3d triangle
630 virtual void setAttribute(s32 index, core::triangle3df v) = 0;
631
632
633 /*
634
635 line 2d
636
637 */
638
639 //! Adds an attribute as a 2d line
640 virtual void addLine2d(const c8* attributeName, core::line2df v) = 0;
641
642 //! Sets an attribute as a 2d line
643 virtual void setAttribute(const c8* attributeName, core::line2df v) = 0;
644
645 //! Gets an attribute as a 2d line
646 //! \param attributeName: Name of the attribute to get.
647 //! \return Returns value of the attribute previously set by setAttribute()
648 virtual core::line2df getAttributeAsLine2d(const c8* attributeName) = 0;
649
650 //! Gets an attribute as a 2d line
651 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
652 virtual core::line2df getAttributeAsLine2d(s32 index) = 0;
653
654 //! Sets an attribute as a 2d line
655 virtual void setAttribute(s32 index, core::line2df v) = 0;
656
657
658 /*
659
660 line 3d
661
662 */
663
664 //! Adds an attribute as a 3d line
665 virtual void addLine3d(const c8* attributeName, core::line3df v) = 0;
666
667 //! Sets an attribute as a 3d line
668 virtual void setAttribute(const c8* attributeName, core::line3df v) = 0;
669
670 //! Gets an attribute as a 3d line
671 //! \param attributeName: Name of the attribute to get.
672 //! \return Returns value of the attribute previously set by setAttribute()
673 virtual core::line3df getAttributeAsLine3d(const c8* attributeName) = 0;
674
675 //! Gets an attribute as a 3d line
676 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
677 virtual core::line3df getAttributeAsLine3d(s32 index) = 0;
678
679 //! Sets an attribute as a 3d line
680 virtual void setAttribute(s32 index, core::line3df v) = 0;
681
682
683 /*
684
685 Texture Attribute
686
687 */
688
689 //! Adds an attribute as texture reference
690 virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;
691
692 //! Sets an attribute as texture reference
693 virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;
694
695 //! Gets an attribute as texture reference
696 //! \param attributeName: Name of the attribute to get.
697 virtual video::ITexture* getAttributeAsTexture(const c8* attributeName) = 0;
698
699 //! Gets an attribute as texture reference
700 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
701 virtual video::ITexture* getAttributeAsTexture(s32 index) = 0;
702
703 //! Sets an attribute as texture reference
704 virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") = 0;
705
706
707 /*
708
709 User Pointer Attribute
710
711 */
712
713 //! Adds an attribute as user pointner
714 virtual void addUserPointer(const c8* attributeName, void* userPointer) = 0;
715
716 //! Sets an attribute as user pointer
717 virtual void setAttribute(const c8* attributeName, void* userPointer) = 0;
718
719 //! Gets an attribute as user pointer
720 //! \param attributeName: Name of the attribute to get.
721 virtual void* getAttributeAsUserPointer(const c8* attributeName) = 0;
722
723 //! Gets an attribute as user pointer
724 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
725 virtual void* getAttributeAsUserPointer(s32 index) = 0;
726
727 //! Sets an attribute as user pointer
728 virtual void setAttribute(s32 index, void* userPointer) = 0;
729
730};
731
732} // end namespace io
733} // end namespace irr
734
735#endif
736
737
738
diff --git a/src/others/irrlicht-1.8.1/include/IBillboardSceneNode.h b/src/others/irrlicht-1.8.1/include/IBillboardSceneNode.h
new file mode 100644
index 0000000..7776532
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IBillboardSceneNode.h
@@ -0,0 +1,75 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_BILLBOARD_SCENE_NODE_H_INCLUDED__
6#define __I_BILLBOARD_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A billboard scene node.
16/** A billboard is like a 3d sprite: A 2d element,
17which always looks to the camera. It is usually used for explosions, fire,
18lensflares, particles and things like that.
19*/
20class IBillboardSceneNode : public ISceneNode
21{
22public:
23
24 //! Constructor
25 IBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
26 const core::vector3df& position = core::vector3df(0,0,0))
27 : ISceneNode(parent, mgr, id, position) {}
28
29 //! Sets the size of the billboard, making it rectangular.
30 virtual void setSize(const core::dimension2d<f32>& size) = 0;
31
32 //! Sets the size of the billboard with independent widths of the bottom and top edges.
33 /** \param[in] height The height of the billboard.
34 \param[in] bottomEdgeWidth The width of the bottom edge of the billboard.
35 \param[in] topEdgeWidth The width of the top edge of the billboard.
36 */
37 virtual void setSize(f32 height, f32 bottomEdgeWidth, f32 topEdgeWidth) = 0;
38
39 //! Returns the size of the billboard.
40 /** This will return the width of the bottom edge of the billboard.
41 Use getWidths() to retrieve the bottom and top edges independently.
42 \return Size of the billboard.
43 */
44 virtual const core::dimension2d<f32>& getSize() const = 0;
45
46 //! Gets the size of the the billboard and handles independent top and bottom edge widths correctly.
47 /** \param[out] height The height of the billboard.
48 \param[out] bottomEdgeWidth The width of the bottom edge of the billboard.
49 \param[out] topEdgeWidth The width of the top edge of the billboard.
50 */
51 virtual void getSize(f32& height, f32& bottomEdgeWidth, f32& topEdgeWidth) const =0;
52
53 //! Set the color of all vertices of the billboard
54 /** \param[in] overallColor Color to set */
55 virtual void setColor(const video::SColor& overallColor) = 0;
56
57 //! Set the color of the top and bottom vertices of the billboard
58 /** \param[in] topColor Color to set the top vertices
59 \param[in] bottomColor Color to set the bottom vertices */
60 virtual void setColor(const video::SColor& topColor,
61 const video::SColor& bottomColor) = 0;
62
63 //! Gets the color of the top and bottom vertices of the billboard
64 /** \param[out] topColor Stores the color of the top vertices
65 \param[out] bottomColor Stores the color of the bottom vertices */
66 virtual void getColor(video::SColor& topColor,
67 video::SColor& bottomColor) const = 0;
68};
69
70} // end namespace scene
71} // end namespace irr
72
73
74#endif
75
diff --git a/src/others/irrlicht-1.8.1/include/IBillboardTextSceneNode.h b/src/others/irrlicht-1.8.1/include/IBillboardTextSceneNode.h
new file mode 100644
index 0000000..b7f2359
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IBillboardTextSceneNode.h
@@ -0,0 +1,62 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_BILLBOARD_TEXT_SCENE_NODE_H_INCLUDED__
6#define __I_BILLBOARD_TEXT_SCENE_NODE_H_INCLUDED__
7
8#include "IBillboardSceneNode.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A billboard text scene node.
16/** Acts like a billboard which displays the currently set text.
17 Due to the exclusion of RTTI in Irrlicht we have to avoid multiple
18 inheritance. Hence, changes to the ITextSceneNode interface have
19 to be copied here manually.
20*/
21class IBillboardTextSceneNode : public IBillboardSceneNode
22{
23public:
24
25 //! Constructor
26 IBillboardTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
27 const core::vector3df& position = core::vector3df(0,0,0))
28 : IBillboardSceneNode(parent, mgr, id, position) {}
29
30 //! Sets the size of the billboard.
31 virtual void setSize(const core::dimension2d<f32>& size) = 0;
32
33 //! Returns the size of the billboard.
34 virtual const core::dimension2d<f32>& getSize() const = 0;
35
36 //! Set the color of all vertices of the billboard
37 /** \param overallColor: the color to set */
38 virtual void setColor(const video::SColor & overallColor) = 0;
39
40 //! Set the color of the top and bottom vertices of the billboard
41 /** \param topColor: the color to set the top vertices
42 \param bottomColor: the color to set the bottom vertices */
43 virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor) = 0;
44
45 //! Gets the color of the top and bottom vertices of the billboard
46 /** \param topColor: stores the color of the top vertices
47 \param bottomColor: stores the color of the bottom vertices */
48 virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0;
49
50 //! sets the text string
51 virtual void setText(const wchar_t* text) = 0;
52
53 //! sets the color of the text
54 virtual void setTextColor(video::SColor color) = 0;
55};
56
57} // end namespace scene
58} // end namespace irr
59
60
61#endif
62
diff --git a/src/others/irrlicht-1.8.1/include/IBoneSceneNode.h b/src/others/irrlicht-1.8.1/include/IBoneSceneNode.h
new file mode 100644
index 0000000..6342668
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IBoneSceneNode.h
@@ -0,0 +1,108 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_BONE_SCENE_NODE_H_INCLUDED__
6#define __I_BONE_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9
10namespace irr
11{
12namespace scene
13{
14
15 //! Enumeration for different bone animation modes
16 enum E_BONE_ANIMATION_MODE
17 {
18 //! The bone is usually animated, unless it's parent is not animated
19 EBAM_AUTOMATIC=0,
20
21 //! The bone is animated by the skin, if it's parent is not animated then animation will resume from this bone onward
22 EBAM_ANIMATED,
23
24 //! The bone is not animated by the skin
25 EBAM_UNANIMATED,
26
27 //! Not an animation mode, just here to count the available modes
28 EBAM_COUNT
29
30 };
31
32 enum E_BONE_SKINNING_SPACE
33 {
34 //! local skinning, standard
35 EBSS_LOCAL=0,
36
37 //! global skinning
38 EBSS_GLOBAL,
39
40 EBSS_COUNT
41 };
42
43 //! Names for bone animation modes
44 const c8* const BoneAnimationModeNames[] =
45 {
46 "automatic",
47 "animated",
48 "unanimated",
49 0,
50 };
51
52
53 //! Interface for bones used for skeletal animation.
54 /** Used with ISkinnedMesh and IAnimatedMeshSceneNode. */
55 class IBoneSceneNode : public ISceneNode
56 {
57 public:
58
59 IBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1) :
60 ISceneNode(parent, mgr, id),positionHint(-1),scaleHint(-1),rotationHint(-1) { }
61
62 //! Get the name of the bone
63 /** \deprecated Use getName instead. This method may be removed by Irrlicht 1.9 */
64 _IRR_DEPRECATED_ virtual const c8* getBoneName() const { return getName(); }
65
66 //! Get the index of the bone
67 virtual u32 getBoneIndex() const = 0;
68
69 //! Sets the animation mode of the bone.
70 /** \return True if successful. (Unused) */
71 virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0;
72
73 //! Gets the current animation mode of the bone
74 virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
75
76 //! Get the axis aligned bounding box of this node
77 virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
78
79 //! Returns the relative transformation of the scene node.
80 //virtual core::matrix4 getRelativeTransformation() const = 0;
81
82 //! The animation method.
83 virtual void OnAnimate(u32 timeMs) =0;
84
85 //! The render method.
86 /** Does nothing as bones are not visible. */
87 virtual void render() { }
88
89 //! How the relative transformation of the bone is used
90 virtual void setSkinningSpace( E_BONE_SKINNING_SPACE space ) =0;
91
92 //! How the relative transformation of the bone is used
93 virtual E_BONE_SKINNING_SPACE getSkinningSpace() const =0;
94
95 //! Updates the absolute position based on the relative and the parents position
96 virtual void updateAbsolutePositionOfAllChildren()=0;
97
98 s32 positionHint;
99 s32 scaleHint;
100 s32 rotationHint;
101 };
102
103
104} // end namespace scene
105} // end namespace irr
106
107#endif
108
diff --git a/src/others/irrlicht-1.8.1/include/ICameraSceneNode.h b/src/others/irrlicht-1.8.1/include/ICameraSceneNode.h
new file mode 100644
index 0000000..a71eb95
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ICameraSceneNode.h
@@ -0,0 +1,207 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_CAMERA_SCENE_NODE_H_INCLUDED__
6#define __I_CAMERA_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9#include "IEventReceiver.h"
10
11namespace irr
12{
13namespace scene
14{
15 struct SViewFrustum;
16
17 //! Scene Node which is a (controlable) camera.
18 /** The whole scene will be rendered from the cameras point of view.
19 Because the ICameraScenNode is a SceneNode, it can be attached to any
20 other scene node, and will follow its parents movement, rotation and so
21 on.
22 */
23 class ICameraSceneNode : public ISceneNode, public IEventReceiver
24 {
25 public:
26
27 //! Constructor
28 ICameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
29 const core::vector3df& position = core::vector3df(0,0,0),
30 const core::vector3df& rotation = core::vector3df(0,0,0),
31 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f))
32 : ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {}
33
34 //! Sets the projection matrix of the camera.
35 /** The core::matrix4 class has some methods to build a
36 projection matrix. e.g:
37 core::matrix4::buildProjectionMatrixPerspectiveFovLH.
38 Note that the matrix will only stay as set by this method until
39 one of the following Methods are called: setNearValue,
40 setFarValue, setAspectRatio, setFOV.
41 \param projection The new projection matrix of the camera.
42 \param isOrthogonal Set this to true if the matrix is an
43 orthogonal one (e.g. from matrix4::buildProjectionMatrixOrtho).
44 */
45 virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal=false) =0;
46
47 //! Gets the current projection matrix of the camera.
48 /** \return The current projection matrix of the camera. */
49 virtual const core::matrix4& getProjectionMatrix() const =0;
50
51 //! Gets the current view matrix of the camera.
52 /** \return The current view matrix of the camera. */
53 virtual const core::matrix4& getViewMatrix() const =0;
54
55 //! Sets a custom view matrix affector.
56 /** The matrix passed here, will be multiplied with the view
57 matrix when it gets updated. This allows for custom camera
58 setups like, for example, a reflection camera.
59 \param affector The affector matrix. */
60 virtual void setViewMatrixAffector(const core::matrix4& affector) =0;
61
62 //! Get the custom view matrix affector.
63 /** \return The affector matrix. */
64 virtual const core::matrix4& getViewMatrixAffector() const =0;
65
66 //! It is possible to send mouse and key events to the camera.
67 /** Most cameras may ignore this input, but camera scene nodes
68 which are created for example with
69 ISceneManager::addCameraSceneNodeMaya or
70 ISceneManager::addCameraSceneNodeFPS, may want to get
71 this input for changing their position, look at target or
72 whatever. */
73 virtual bool OnEvent(const SEvent& event) =0;
74
75 //! Sets the look at target of the camera
76 /** If the camera's target and rotation are bound ( @see
77 bindTargetAndRotation() ) then calling this will also change
78 the camera's scene node rotation to match the target.
79 Note that setTarget uses the current absolute position
80 internally, so if you changed setPosition since last rendering you must
81 call updateAbsolutePosition before using this function.
82 \param pos Look at target of the camera, in world co-ordinates. */
83 virtual void setTarget(const core::vector3df& pos) =0;
84
85 //! Sets the rotation of the node.
86 /** This only modifies the relative rotation of the node.
87 If the camera's target and rotation are bound ( @see
88 bindTargetAndRotation() ) then calling this will also change
89 the camera's target to match the rotation.
90 \param rotation New rotation of the node in degrees. */
91 virtual void setRotation(const core::vector3df& rotation) =0;
92
93 //! Gets the current look at target of the camera
94 /** \return The current look at target of the camera, in world co-ordinates */
95 virtual const core::vector3df& getTarget() const =0;
96
97 //! Sets the up vector of the camera.
98 /** \param pos: New upvector of the camera. */
99 virtual void setUpVector(const core::vector3df& pos) =0;
100
101 //! Gets the up vector of the camera.
102 /** \return The up vector of the camera, in world space. */
103 virtual const core::vector3df& getUpVector() const =0;
104
105 //! Gets the value of the near plane of the camera.
106 /** \return The value of the near plane of the camera. */
107 virtual f32 getNearValue() const =0;
108
109 //! Gets the value of the far plane of the camera.
110 /** \return The value of the far plane of the camera. */
111 virtual f32 getFarValue() const =0;
112
113 //! Gets the aspect ratio of the camera.
114 /** \return The aspect ratio of the camera. */
115 virtual f32 getAspectRatio() const =0;
116
117 //! Gets the field of view of the camera.
118 /** \return The field of view of the camera in radians. */
119 virtual f32 getFOV() const =0;
120
121 //! Sets the value of the near clipping plane. (default: 1.0f)
122 /** \param zn: New z near value. */
123 virtual void setNearValue(f32 zn) =0;
124
125 //! Sets the value of the far clipping plane (default: 2000.0f)
126 /** \param zf: New z far value. */
127 virtual void setFarValue(f32 zf) =0;
128
129 //! Sets the aspect ratio (default: 4.0f / 3.0f)
130 /** \param aspect: New aspect ratio. */
131 virtual void setAspectRatio(f32 aspect) =0;
132
133 //! Sets the field of view (Default: PI / 2.5f)
134 /** \param fovy: New field of view in radians. */
135 virtual void setFOV(f32 fovy) =0;
136
137 //! Get the view frustum.
138 /** Needed sometimes by bspTree or LOD render nodes.
139 \return The current view frustum. */
140 virtual const SViewFrustum* getViewFrustum() const =0;
141
142 //! Disables or enables the camera to get key or mouse inputs.
143 /** If this is set to true, the camera will respond to key
144 inputs otherwise not. */
145 virtual void setInputReceiverEnabled(bool enabled) =0;
146
147 //! Checks if the input receiver of the camera is currently enabled.
148 virtual bool isInputReceiverEnabled() const =0;
149
150 //! Checks if a camera is orthogonal.
151 virtual bool isOrthogonal() const
152 {
153 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
154 return IsOrthogonal;
155 }
156
157 //! Binds the camera scene node's rotation to its target position and vice vera, or unbinds them.
158 /** When bound, calling setRotation() will update the camera's
159 target position to be along its +Z axis, and likewise calling
160 setTarget() will update its rotation so that its +Z axis will
161 point at the target point. FPS camera use this binding by
162 default; other cameras do not.
163 \param bound True to bind the camera's scene node rotation
164 and targetting, false to unbind them.
165 @see getTargetAndRotationBinding() */
166 virtual void bindTargetAndRotation(bool bound) =0;
167
168 //! Queries if the camera scene node's rotation and its target position are bound together.
169 /** @see bindTargetAndRotation() */
170 virtual bool getTargetAndRotationBinding(void) const =0;
171
172 //! Writes attributes of the camera node
173 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
174 {
175 ISceneNode::serializeAttributes(out, options);
176
177 if (!out)
178 return;
179 out->addBool ("IsOrthogonal", IsOrthogonal );
180 }
181
182 //! Reads attributes of the camera node
183 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
184 {
185 ISceneNode::deserializeAttributes(in, options);
186 if (!in)
187 return;
188
189 if ( in->findAttribute("IsOrthogonal") )
190 IsOrthogonal = in->getAttributeAsBool("IsOrthogonal");
191 }
192
193 protected:
194
195 void cloneMembers(ICameraSceneNode* toCopyFrom)
196 {
197 IsOrthogonal = toCopyFrom->IsOrthogonal;
198 }
199
200 bool IsOrthogonal;
201 };
202
203} // end namespace scene
204} // end namespace irr
205
206#endif
207
diff --git a/src/others/irrlicht-1.8.1/include/IColladaMeshWriter.h b/src/others/irrlicht-1.8.1/include/IColladaMeshWriter.h
new file mode 100644
index 0000000..e3f48a7
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IColladaMeshWriter.h
@@ -0,0 +1,405 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__
6#define __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__
7
8#include "IMeshWriter.h"
9#include "ISceneNode.h"
10#include "IAnimatedMesh.h"
11#include "SMaterial.h"
12
13namespace irr
14{
15namespace io
16{
17 class IWriteFile;
18} // end namespace io
19
20namespace scene
21{
22 //! Lighting models - more or less the way Collada categorizes materials
23 enum E_COLLADA_TECHNIQUE_FX
24 {
25 //! Blinn-phong which is default for opengl and dx fixed function pipelines.
26 //! But several well-known renderers don't support it and prefer phong.
27 ECTF_BLINN,
28 //! Phong shading, default in many external renderers.
29 ECTF_PHONG,
30 //! diffuse shaded surface that is independent of lighting.
31 ECTF_LAMBERT,
32 // constantly shaded surface that is independent of lighting.
33 ECTF_CONSTANT
34 };
35
36 //! How to interpret the opacity in collada
37 enum E_COLLADA_TRANSPARENT_FX
38 {
39 //! default - only alpha channel of color or texture is used.
40 ECOF_A_ONE = 0,
41
42 //! Alpha values for each RGB channel of color or texture are used.
43 ECOF_RGB_ZERO = 1
44 };
45
46 //! Color names collada uses in it's color samplers
47 enum E_COLLADA_COLOR_SAMPLER
48 {
49 ECCS_DIFFUSE,
50 ECCS_AMBIENT,
51 ECCS_EMISSIVE,
52 ECCS_SPECULAR,
53 ECCS_TRANSPARENT,
54 ECCS_REFLECTIVE
55 };
56
57 //! Irrlicht colors which can be mapped to E_COLLADA_COLOR_SAMPLER values
58 enum E_COLLADA_IRR_COLOR
59 {
60 //! Don't write this element at all
61 ECIC_NONE,
62
63 //! Check IColladaMeshWriterProperties for custom color
64 ECIC_CUSTOM,
65
66 //! Use SMaterial::DiffuseColor
67 ECIC_DIFFUSE,
68
69 //! Use SMaterial::AmbientColor
70 ECIC_AMBIENT,
71
72 //! Use SMaterial::EmissiveColor
73 ECIC_EMISSIVE,
74
75 //! Use SMaterial::SpecularColor
76 ECIC_SPECULAR
77 };
78
79 //! Control when geometry elements are created
80 enum E_COLLADA_GEOMETRY_WRITING
81 {
82 //! Default - write each mesh exactly once to collada. Optimal but will not work with many tools.
83 ECGI_PER_MESH,
84
85 //! Write each mesh as often as it's used with different materials-names in the scene.
86 //! Material names which are used here are created on export, so using the IColladaMeshWriterNames
87 //! interface you have some control over how many geometries are written.
88 ECGI_PER_MESH_AND_MATERIAL
89 };
90
91 //! Callback interface for properties which can be used to influence collada writing
92 class IColladaMeshWriterProperties : public virtual IReferenceCounted
93 {
94 public:
95 virtual ~IColladaMeshWriterProperties () {}
96
97 //! Which lighting model should be used in the technique (FX) section when exporting effects (materials)
98 virtual E_COLLADA_TECHNIQUE_FX getTechniqueFx(const video::SMaterial& material) const = 0;
99
100 //! Which texture index should be used when writing the texture of the given sampler color.
101 /** \return the index to the texture-layer or -1 if that texture should never be exported
102 Note: for ECCS_TRANSPARENT by default the alpha channel is used, if you want to use RGB you have to set
103 also the ECOF_RGB_ZERO flag in getTransparentFx. */
104 virtual s32 getTextureIdx(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
105
106 //! Return which color from Irrlicht should be used for the color requested by collada
107 /** Note that collada allows exporting either texture or color, not both.
108 So color mapping is only checked if we have no valid texture already.
109 By default we try to return best fits when possible. For example ECCS_DIFFUSE is mapped to ECIC_DIFFUSE.
110 When ECIC_CUSTOM is returned then the result of getCustomColor will be used. */
111 virtual E_COLLADA_IRR_COLOR getColorMapping(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
112
113 //! Return custom colors for certain color types requested by collada.
114 /** Only used when getColorMapping returns ECIC_CUSTOM for the same paramters. */
115 virtual video::SColor getCustomColor(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
116
117 //! Return the transparence color interpretation.
118 /** Not this is only about ECCS_TRANSPARENT and does not affect getTransparency. */
119 virtual E_COLLADA_TRANSPARENT_FX getTransparentFx(const video::SMaterial& material) const = 0;
120
121 //! Transparency value for that material.
122 /** This value is additional to transparent settings, if both are set they will be multiplicated.
123 \return 1.0 for fully transparent, 0.0 for not transparent and not written at all when < 0.f */
124 virtual f32 getTransparency(const video::SMaterial& material) const = 0;
125
126 //! Reflectivity value for that material
127 /** The amount of perfect mirror reflection to be added to the reflected light
128 \return 0.0 - 1.0 for reflectivity and element is not written at all when < 0.f */
129 virtual f32 getReflectivity(const video::SMaterial& material) const = 0;
130
131 //! Return index of refraction for that material
132 /** By default we don't write that.
133 \return a value greater equal 0.f to write \<index_of_refraction\> when it is lesser than 0 nothing will be written */
134 virtual f32 getIndexOfRefraction(const video::SMaterial& material) const = 0;
135
136 //! Should node be used in scene export? (only needed for scene-writing, ignored in mesh-writing)
137 //! By default all visible nodes are exported.
138 virtual bool isExportable(const irr::scene::ISceneNode * node) const = 0;
139
140 //! Return the mesh for the given node. If it has no mesh or shouldn't export it's mesh
141 //! you can return 0 in which case only the transformation matrix of the node will be used.
142 // Note: Function is not const because there is no const getMesh() function.
143 virtual IMesh* getMesh(irr::scene::ISceneNode * node) = 0;
144
145 //! Return if the node has it's own material overwriting the mesh-materials
146 /** Usually true except for mesh-nodes which have isReadOnlyMaterials set.
147 This is mostly important for naming (as ISceneNode::getMaterial() already returns the correct material).
148 You have to override it when exporting custom scenenodes with own materials.
149 \return true => The node's own material is used, false => ignore node material and use the one from the mesh */
150 virtual bool useNodeMaterial(const scene::ISceneNode* node) const = 0;
151
152 };
153
154 //! Callback interface to use custom names on collada writing.
155 /** You can either modify names and id's written to collada or you can use
156 this interface to just find out which names are used on writing.
157 */
158 class IColladaMeshWriterNames : public virtual IReferenceCounted
159 {
160 public:
161
162 virtual ~IColladaMeshWriterNames () {}
163
164 //! Return a unique name for the given mesh
165 /** Note that names really must be unique here per mesh-pointer, so
166 mostly it's a good idea to return the nameForMesh from
167 IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow
168 the xs::NCName standard to be valid, you can run them through
169 IColladaMeshWriter::toNCName to ensure that.
170 \param mesh Pointer to the mesh which needs a name
171 \param instance When E_COLLADA_GEOMETRY_WRITING is not ECGI_PER_MESH then
172 several instances of the same mesh can be written and this counts them.
173 */
174 virtual irr::core::stringw nameForMesh(const scene::IMesh* mesh, int instance) = 0;
175
176 //! Return a unique name for the given node
177 /** Note that names really must be unique here per node-pointer, so
178 mostly it's a good idea to return the nameForNode from
179 IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow
180 the xs::NCName standard to be valid, you can run them through
181 IColladaMeshWriter::toNCName to ensure that.
182 */
183 virtual irr::core::stringw nameForNode(const scene::ISceneNode* node) = 0;
184
185 //! Return a name for the material
186 /** There is one material created in the writer for each unique name.
187 So you can use this to control the number of materials which get written.
188 For example Irrlicht does by default write one material for each material
189 instanced by a node. So if you know that in your application material
190 instances per node are identical between different nodes you can reduce
191 the number of exported materials using that knowledge by using identical
192 names for such shared materials.
193 Names must follow the xs::NCName standard to be valid, you can run them
194 through IColladaMeshWriter::toNCName to ensure that.
195 */
196 virtual irr::core::stringw nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0;
197 };
198
199
200 //! Interface for writing meshes
201 class IColladaMeshWriter : public IMeshWriter
202 {
203 public:
204
205 IColladaMeshWriter()
206 : Properties(0), DefaultProperties(0), NameGenerator(0), DefaultNameGenerator(0)
207 , WriteTextures(true), WriteDefaultScene(true), ExportSMaterialOnce(true)
208 , AmbientLight(0.f, 0.f, 0.f, 1.f)
209 , GeometryWriting(ECGI_PER_MESH)
210 {
211 }
212
213 //! Destructor
214 virtual ~IColladaMeshWriter()
215 {
216 if ( Properties )
217 Properties->drop();
218 if ( DefaultProperties )
219 DefaultProperties->drop();
220 if ( NameGenerator )
221 NameGenerator->drop();
222 if ( DefaultNameGenerator )
223 DefaultNameGenerator->drop();
224 }
225
226 //! writes a scene starting with the given node
227 virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root) = 0;
228
229
230 //! Set if texture information should be written
231 virtual void setWriteTextures(bool write)
232 {
233 WriteTextures = write;
234 }
235
236 //! Get if texture information should be written
237 virtual bool getWriteTextures() const
238 {
239 return WriteTextures;
240 }
241
242 //! Set if a default scene should be written when writing meshes.
243 /** Many collada readers fail to read a mesh if the collada files doesn't contain a scene as well.
244 The scene is doing an instantiation of the mesh.
245 When using writeScene this flag is ignored (as we have scene there already)
246 */
247 virtual void setWriteDefaultScene(bool write)
248 {
249 WriteDefaultScene = write;
250 }
251
252 //! Get if a default scene should be written
253 virtual bool getWriteDefaultScene() const
254 {
255 return WriteDefaultScene;
256 }
257
258 //! Sets ambient color of the scene to write
259 virtual void setAmbientLight(const video::SColorf &ambientColor)
260 {
261 AmbientLight = ambientColor;
262 }
263
264 //! Return ambient light of the scene which is written
265 virtual video::SColorf getAmbientLight() const
266 {
267 return AmbientLight;
268 }
269
270 //! Control when and how often a mesh is written
271 /** Optimally ECGI_PER_MESH would be always sufficent - writing geometry once per mesh.
272 Unfortunately many tools (at the time of writing this nearly all of them) have trouble
273 on import when different materials are used per node. So when you override materials
274 per node and importing the resuling collada has materials problems in other tools try
275 using other values here.
276 \param writeStyle One of the E_COLLADA_GEOMETRY_WRITING settings.
277 */
278 virtual void setGeometryWriting(E_COLLADA_GEOMETRY_WRITING writeStyle)
279 {
280 GeometryWriting = writeStyle;
281 }
282
283 //! Get the current style of geometry writing.
284 virtual E_COLLADA_GEOMETRY_WRITING getGeometryWriting() const
285 {
286 return GeometryWriting;
287 }
288
289 //! Make certain there is only one collada material generated per Irrlicht material
290 /** Checks before creating a collada material-name if an identical
291 irr:::video::SMaterial has been exported already. If so don't export it with
292 another name. This is set by default and leads to way smaller .dae files.
293 Note that if you need to disable this flag for some reason you can still
294 get a similar effect using the IColladaMeshWriterNames::nameForMaterial
295 by returning identical names for identical materials there.
296 */
297 virtual void setExportSMaterialsOnlyOnce(bool exportOnce)
298 {
299 ExportSMaterialOnce = exportOnce;
300 }
301
302 virtual bool getExportSMaterialsOnlyOnce() const
303 {
304 return ExportSMaterialOnce;
305 }
306
307 //! Set properties to use by the meshwriter instead of it's default properties.
308 /** Overloading properties with an own class allows modifying the writing process in certain ways.
309 By default properties are set to the DefaultProperties. */
310 virtual void setProperties(IColladaMeshWriterProperties * p)
311 {
312 if ( p == Properties )
313 return;
314 if ( p )
315 p->grab();
316 if ( Properties )
317 Properties->drop();
318 Properties = p;
319 }
320
321 //! Get properties which are currently used.
322 virtual IColladaMeshWriterProperties * getProperties() const
323 {
324 return Properties;
325 }
326
327 //! Return the original default properties of the writer.
328 /** You can use this pointer in your own properties to access and return default values. */
329 IColladaMeshWriterProperties * getDefaultProperties() const
330 {
331 return DefaultProperties;
332 }
333
334 //! Install a generator to create custom names on export.
335 virtual void setNameGenerator(IColladaMeshWriterNames * nameGenerator)
336 {
337 if ( nameGenerator == NameGenerator )
338 return;
339 if ( nameGenerator )
340 nameGenerator->grab();
341 if ( NameGenerator )
342 NameGenerator->drop();
343 NameGenerator = nameGenerator;
344 }
345
346 //! Get currently used name generator
347 virtual IColladaMeshWriterNames * getNameGenerator() const
348 {
349 return NameGenerator;
350 }
351
352 //! Return the original default name generator of the writer.
353 /** You can use this pointer in your own generator to access and return default values. */
354 IColladaMeshWriterNames * getDefaultNameGenerator() const
355 {
356 return DefaultNameGenerator;
357 }
358
359 //! Restrict the characters of oldString a set of allowed characters in xs::NCName and add the prefix.
360 /** A tool function to help when using a custom name generator to generative valid names for collada names and id's. */
361 virtual irr::core::stringw toNCName(const irr::core::stringw& oldString, const irr::core::stringw& prefix=irr::core::stringw(L"_NC_")) const = 0;
362
363
364 protected:
365 // NOTE: You usually should also call setProperties with the same paraemter when using setDefaultProperties
366 virtual void setDefaultProperties(IColladaMeshWriterProperties * p)
367 {
368 if ( p == DefaultProperties )
369 return;
370 if ( p )
371 p->grab();
372 if ( DefaultProperties )
373 DefaultProperties->drop();
374 DefaultProperties = p;
375 }
376
377 // NOTE: You usually should also call setNameGenerator with the same paraemter when using setDefaultProperties
378 virtual void setDefaultNameGenerator(IColladaMeshWriterNames * p)
379 {
380 if ( p == DefaultNameGenerator )
381 return;
382 if ( p )
383 p->grab();
384 if ( DefaultNameGenerator )
385 DefaultNameGenerator->drop();
386 DefaultNameGenerator = p;
387 }
388
389 private:
390 IColladaMeshWriterProperties * Properties;
391 IColladaMeshWriterProperties * DefaultProperties;
392 IColladaMeshWriterNames * NameGenerator;
393 IColladaMeshWriterNames * DefaultNameGenerator;
394 bool WriteTextures;
395 bool WriteDefaultScene;
396 bool ExportSMaterialOnce;
397 video::SColorf AmbientLight;
398 E_COLLADA_GEOMETRY_WRITING GeometryWriting;
399 };
400
401
402} // end namespace
403} // end namespace
404
405#endif
diff --git a/src/others/irrlicht-1.8.1/include/ICursorControl.h b/src/others/irrlicht-1.8.1/include/ICursorControl.h
new file mode 100644
index 0000000..6295781
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ICursorControl.h
@@ -0,0 +1,192 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_CURSOR_CONTROL_H_INCLUDED__
6#define __I_CURSOR_CONTROL_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "position2d.h"
10#include "rect.h"
11
12namespace irr
13{
14namespace gui
15{
16
17 class IGUISpriteBank;
18
19 //! Default icons for cursors
20 enum ECURSOR_ICON
21 {
22 // Following cursors might be system specific, or might use an Irrlicht icon-set. No guarantees so far.
23 ECI_NORMAL, // arrow
24 ECI_CROSS, // Crosshair
25 ECI_HAND, // Hand
26 ECI_HELP, // Arrow and question mark
27 ECI_IBEAM, // typical text-selection cursor
28 ECI_NO, // should not click icon
29 ECI_WAIT, // hourclass
30 ECI_SIZEALL, // arrow in all directions
31 ECI_SIZENESW, // resizes in direction north-east or south-west
32 ECI_SIZENWSE, // resizes in direction north-west or south-east
33 ECI_SIZENS, // resizes in direction north or south
34 ECI_SIZEWE, // resizes in direction west or east
35 ECI_UP, // up-arrow
36
37 // Implementer note: Should we add system specific cursors, which use guaranteed the system icons,
38 // then I would recommend using a naming scheme like ECI_W32_CROSS, ECI_X11_CROSSHAIR and adding those
39 // additionally.
40
41 ECI_COUNT // maximal of defined cursors. Note that higher values can be created at runtime
42 };
43
44 //! Names for ECURSOR_ICON
45 const c8* const GUICursorIconNames[ECI_COUNT+1] =
46 {
47 "normal",
48 "cross",
49 "hand",
50 "help",
51 "ibeam",
52 "no",
53 "wait",
54 "sizeall",
55 "sizenesw",
56 "sizenwse",
57 "sizens",
58 "sizewe",
59 "sizeup",
60 0
61 };
62
63 //! structure used to set sprites as cursors.
64 struct SCursorSprite
65 {
66 SCursorSprite()
67 : SpriteBank(0), SpriteId(-1)
68 {
69 }
70
71 SCursorSprite( gui::IGUISpriteBank * spriteBank, s32 spriteId, const core::position2d<s32> &hotspot=(core::position2d<s32>(0,0)) )
72 : SpriteBank(spriteBank), SpriteId(spriteId), HotSpot(hotspot)
73 {
74 }
75
76 IGUISpriteBank * SpriteBank;
77 s32 SpriteId;
78 core::position2d<s32> HotSpot;
79 };
80
81 //! platform specific behavior flags for the cursor
82 enum ECURSOR_PLATFORM_BEHAVIOR
83 {
84 //! default - no platform specific behavior
85 ECPB_NONE = 0,
86
87 //! On X11 try caching cursor updates as XQueryPointer calls can be expensive.
88 /** Update cursor positions only when the irrlicht timer has been updated or the timer is stopped.
89 This means you usually get one cursor update per device->run() which will be fine in most cases.
90 See this forum-thread for a more detailed explanation:
91 http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=45525
92 */
93 ECPB_X11_CACHE_UPDATES = 1
94 };
95
96 //! Interface to manipulate the mouse cursor.
97 class ICursorControl : public virtual IReferenceCounted
98 {
99 public:
100
101 //! Changes the visible state of the mouse cursor.
102 /** \param visible: The new visible state. If true, the cursor will be visible,
103 if false, it will be invisible. */
104 virtual void setVisible(bool visible) = 0;
105
106 //! Returns if the cursor is currently visible.
107 /** \return True if the cursor is visible, false if not. */
108 virtual bool isVisible() const = 0;
109
110 //! Sets the new position of the cursor.
111 /** The position must be
112 between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
113 the top left corner and (1.0f, 1.0f) is the bottom right corner of the
114 render window.
115 \param pos New position of the cursor. */
116 virtual void setPosition(const core::position2d<f32> &pos) = 0;
117
118 //! Sets the new position of the cursor.
119 /** The position must be
120 between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
121 the top left corner and (1.0f, 1.0f) is the bottom right corner of the
122 render window.
123 \param x New x-coord of the cursor.
124 \param y New x-coord of the cursor. */
125 virtual void setPosition(f32 x, f32 y) = 0;
126
127 //! Sets the new position of the cursor.
128 /** \param pos: New position of the cursor. The coordinates are pixel units. */
129 virtual void setPosition(const core::position2d<s32> &pos) = 0;
130
131 //! Sets the new position of the cursor.
132 /** \param x New x-coord of the cursor. The coordinates are pixel units.
133 \param y New y-coord of the cursor. The coordinates are pixel units. */
134 virtual void setPosition(s32 x, s32 y) = 0;
135
136 //! Returns the current position of the mouse cursor.
137 /** \return Returns the current position of the cursor. The returned position
138 is the position of the mouse cursor in pixel units. */
139 virtual const core::position2d<s32>& getPosition() = 0;
140
141 //! Returns the current position of the mouse cursor.
142 /** \return Returns the current position of the cursor. The returned position
143 is a value between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
144 the top left corner and (1.0f, 1.0f) is the bottom right corner of the
145 render window. */
146 virtual core::position2d<f32> getRelativePosition() = 0;
147
148 //! Sets an absolute reference rect for setting and retrieving the cursor position.
149 /** If this rect is set, the cursor position is not being calculated relative to
150 the rendering window but to this rect. You can set the rect pointer to 0 to disable
151 this feature again. This feature is useful when rendering into parts of foreign windows
152 for example in an editor.
153 \param rect: A pointer to an reference rectangle or 0 to disable the reference rectangle.*/
154 virtual void setReferenceRect(core::rect<s32>* rect=0) = 0;
155
156
157 //! Sets the active cursor icon
158 /** Setting cursor icons is so far only supported on Win32 and Linux */
159 virtual void setActiveIcon(ECURSOR_ICON iconId) {}
160
161 //! Gets the currently active icon
162 virtual ECURSOR_ICON getActiveIcon() const { return gui::ECI_NORMAL; }
163
164 //! Add a custom sprite as cursor icon.
165 /** \return Identification for the icon */
166 virtual ECURSOR_ICON addIcon(const gui::SCursorSprite& icon) { return gui::ECI_NORMAL; }
167
168 //! replace a cursor icon.
169 /** Changing cursor icons is so far only supported on Win32 and Linux
170 Note that this only changes the icons within your application, system cursors outside your
171 application will not be affected.
172 */
173 virtual void changeIcon(ECURSOR_ICON iconId, const gui::SCursorSprite& sprite) {}
174
175 //! Return a system-specific size which is supported for cursors. Larger icons will fail, smaller icons might work.
176 virtual core::dimension2di getSupportedIconSize() const { return core::dimension2di(0,0); }
177
178 //! Set platform specific behavior flags.
179 virtual void setPlatformBehavior(ECURSOR_PLATFORM_BEHAVIOR behavior) {}
180
181 //! Return platform specific behavior.
182 /** \return Behavior set by setPlatformBehavior or ECPB_NONE for platforms not implementing specific behaviors.
183 */
184 virtual ECURSOR_PLATFORM_BEHAVIOR getPlatformBehavior() const { return ECPB_NONE; }
185 };
186
187
188} // end namespace gui
189} // end namespace irr
190
191#endif
192
diff --git a/src/others/irrlicht-1.8.1/include/IDummyTransformationSceneNode.h b/src/others/irrlicht-1.8.1/include/IDummyTransformationSceneNode.h
new file mode 100644
index 0000000..60dfe20
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IDummyTransformationSceneNode.h
@@ -0,0 +1,42 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_DUMMY_TRANSFORMATION_SCENE_NODE_H_INCLUDED__
6#define __I_DUMMY_TRANSFORMATION_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! Dummy scene node for adding additional transformations to the scene graph.
16/** This scene node does not render itself, and does not respond to set/getPosition,
17set/getRotation and set/getScale. Its just a simple scene node that takes a
18matrix as relative transformation, making it possible to insert any transformation
19anywhere into the scene graph.
20This scene node is for example used by the IAnimatedMeshSceneNode for emulating
21joint scene nodes when playing skeletal animations.
22*/
23class IDummyTransformationSceneNode : public ISceneNode
24{
25public:
26
27 //! Constructor
28 IDummyTransformationSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
29 : ISceneNode(parent, mgr, id) {}
30
31 //! Returns a reference to the current relative transformation matrix.
32 /** This is the matrix, this scene node uses instead of scale, translation
33 and rotation. */
34 virtual core::matrix4& getRelativeTransformationMatrix() = 0;
35};
36
37} // end namespace scene
38} // end namespace irr
39
40
41#endif
42
diff --git a/src/others/irrlicht-1.8.1/include/IDynamicMeshBuffer.h b/src/others/irrlicht-1.8.1/include/IDynamicMeshBuffer.h
new file mode 100644
index 0000000..72f2036
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IDynamicMeshBuffer.h
@@ -0,0 +1,211 @@
1// Copyright (C) 2008-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
6#define __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
7
8#include "IMeshBuffer.h"
9#include "IVertexBuffer.h"
10#include "IIndexBuffer.h"
11
12namespace irr
13{
14namespace scene
15{
16
17 /** a dynamic meshBuffer */
18 class IDynamicMeshBuffer : public IMeshBuffer
19 {
20 public:
21 virtual IVertexBuffer &getVertexBuffer() const =0;
22 virtual IIndexBuffer &getIndexBuffer() const =0;
23
24 virtual void setVertexBuffer(IVertexBuffer *vertexBuffer) =0;
25 virtual void setIndexBuffer(IIndexBuffer *indexBuffer) =0;
26
27 //! Get the material of this meshbuffer
28 /** \return Material of this buffer. */
29 virtual video::SMaterial& getMaterial() =0;
30
31 //! Get the material of this meshbuffer
32 /** \return Material of this buffer. */
33 virtual const video::SMaterial& getMaterial() const =0;
34
35 //! Get the axis aligned bounding box of this meshbuffer.
36 /** \return Axis aligned bounding box of this buffer. */
37 virtual const core::aabbox3df& getBoundingBox() const =0;
38
39 //! Set axis aligned bounding box
40 /** \param box User defined axis aligned bounding box to use
41 for this buffer. */
42 virtual void setBoundingBox(const core::aabbox3df& box) =0;
43
44 //! Recalculates the bounding box. Should be called if the mesh changed.
45 virtual void recalculateBoundingBox() =0;
46
47 //! Append the vertices and indices to the current buffer
48 /** Only works for compatible vertex types.
49 \param vertices Pointer to a vertex array.
50 \param numVertices Number of vertices in the array.
51 \param indices Pointer to index array.
52 \param numIndices Number of indices in array. */
53 virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices)
54 {
55
56 }
57
58 //! Append the meshbuffer to the current buffer
59 /** Only works for compatible vertex types
60 \param other Buffer to append to this one. */
61 virtual void append(const IMeshBuffer* const other)
62 {
63
64 }
65
66 // ------------------- To be removed? ------------------- //
67
68 //! get the current hardware mapping hint
69 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const
70 {
71 return getVertexBuffer().getHardwareMappingHint();
72 }
73
74 //! get the current hardware mapping hint
75 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const
76 {
77 return getIndexBuffer().getHardwareMappingHint();
78 }
79
80 //! set the hardware mapping hint, for driver
81 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX )
82 {
83 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
84 getVertexBuffer().setHardwareMappingHint(NewMappingHint);
85 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
86 getIndexBuffer().setHardwareMappingHint(NewMappingHint);
87 }
88
89 //! flags the mesh as changed, reloads hardware buffers
90 virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX)
91 {
92 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
93 getVertexBuffer().setDirty();
94 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
95 getIndexBuffer().setDirty();
96 }
97
98 virtual u32 getChangedID_Vertex() const
99 {
100 return getVertexBuffer().getChangedID();
101 }
102
103 virtual u32 getChangedID_Index() const
104 {
105 return getIndexBuffer().getChangedID();
106 }
107
108 // ------------------- Old interface ------------------- //
109
110 //! Get type of vertex data which is stored in this meshbuffer.
111 /** \return Vertex type of this buffer. */
112 virtual video::E_VERTEX_TYPE getVertexType() const
113 {
114 return getVertexBuffer().getType();
115 }
116
117 //! Get access to vertex data. The data is an array of vertices.
118 /** Which vertex type is used can be determined by getVertexType().
119 \return Pointer to array of vertices. */
120 virtual const void* getVertices() const
121 {
122 return getVertexBuffer().getData();
123 }
124
125 //! Get access to vertex data. The data is an array of vertices.
126 /** Which vertex type is used can be determined by getVertexType().
127 \return Pointer to array of vertices. */
128 virtual void* getVertices()
129 {
130 return getVertexBuffer().getData();
131 }
132
133 //! Get amount of vertices in meshbuffer.
134 /** \return Number of vertices in this buffer. */
135 virtual u32 getVertexCount() const
136 {
137 return getVertexBuffer().size();
138 }
139
140 //! Get type of index data which is stored in this meshbuffer.
141 /** \return Index type of this buffer. */
142 virtual video::E_INDEX_TYPE getIndexType() const
143 {
144 return getIndexBuffer().getType();
145 }
146
147 //! Get access to Indices.
148 /** \return Pointer to indices array. */
149 virtual const u16* getIndices() const
150 {
151 return (u16*)getIndexBuffer().getData();
152 }
153
154 //! Get access to Indices.
155 /** \return Pointer to indices array. */
156 virtual u16* getIndices()
157 {
158 return (u16*)getIndexBuffer().getData();
159 }
160
161 //! Get amount of indices in this meshbuffer.
162 /** \return Number of indices in this buffer. */
163 virtual u32 getIndexCount() const
164 {
165 return getIndexBuffer().size();
166 }
167
168 //! returns position of vertex i
169 virtual const core::vector3df& getPosition(u32 i) const
170 {
171 return getVertexBuffer()[i].Pos;
172 }
173
174 //! returns position of vertex i
175 virtual core::vector3df& getPosition(u32 i)
176 {
177 return getVertexBuffer()[i].Pos;
178 }
179
180 //! returns texture coords of vertex i
181 virtual const core::vector2df& getTCoords(u32 i) const
182 {
183 return getVertexBuffer()[i].TCoords;
184 }
185
186 //! returns texture coords of vertex i
187 virtual core::vector2df& getTCoords(u32 i)
188 {
189 return getVertexBuffer()[i].TCoords;
190 }
191
192 //! returns normal of vertex i
193 virtual const core::vector3df& getNormal(u32 i) const
194 {
195 return getVertexBuffer()[i].Normal;
196 }
197
198 //! returns normal of vertex i
199 virtual core::vector3df& getNormal(u32 i)
200 {
201 return getVertexBuffer()[i].Normal;
202 }
203 };
204
205
206} // end namespace scene
207} // end namespace irr
208
209#endif
210
211
diff --git a/src/others/irrlicht-1.8.1/include/IEventReceiver.h b/src/others/irrlicht-1.8.1/include/IEventReceiver.h
new file mode 100644
index 0000000..419ded7
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IEventReceiver.h
@@ -0,0 +1,490 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_EVENT_RECEIVER_H_INCLUDED__
6#define __I_EVENT_RECEIVER_H_INCLUDED__
7
8#include "ILogger.h"
9#include "Keycodes.h"
10#include "irrString.h"
11
12namespace irr
13{
14 //! Enumeration for all event types there are.
15 enum EEVENT_TYPE
16 {
17 //! An event of the graphical user interface.
18 /** GUI events are created by the GUI environment or the GUI elements in response
19 to mouse or keyboard events. When a GUI element receives an event it will either
20 process it and return true, or pass the event to its parent. If an event is not absorbed
21 before it reaches the root element then it will then be passed to the user receiver. */
22 EET_GUI_EVENT = 0,
23
24 //! A mouse input event.
25 /** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser
26 in response to mouse input received from the operating system.
27 Mouse events are first passed to the user receiver, then to the GUI environment and its elements,
28 then finally the input receiving scene manager where it is passed to the active camera.
29 */
30 EET_MOUSE_INPUT_EVENT,
31
32 //! A key input event.
33 /** Like mouse events, keyboard events are created by the device and passed to
34 IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
35 EET_KEY_INPUT_EVENT,
36
37 //! A joystick (joypad, gamepad) input event.
38 /** Joystick events are created by polling all connected joysticks once per
39 device run() and then passing the events to IrrlichtDevice::postEventFromUser.
40 They take the same path as mouse events.
41 Windows, SDL: Implemented.
42 Linux: Implemented, with POV hat issues.
43 MacOS / Other: Not yet implemented.
44 */
45 EET_JOYSTICK_INPUT_EVENT,
46
47 //! A log event
48 /** Log events are only passed to the user receiver if there is one. If they are absorbed by the
49 user receiver then no text will be sent to the console. */
50 EET_LOG_TEXT_EVENT,
51
52 //! A user event with user data.
53 /** This is not used by Irrlicht and can be used to send user
54 specific data though the system. The Irrlicht 'window handle'
55 can be obtained from IrrlichtDevice::getExposedVideoData()
56 The usage and behavior depends on the operating system:
57 Windows: send a WM_USER message to the Irrlicht Window; the
58 wParam and lParam will be used to populate the
59 UserData1 and UserData2 members of the SUserEvent.
60 Linux: send a ClientMessage via XSendEvent to the Irrlicht
61 Window; the data.l[0] and data.l[1] members will be
62 casted to s32 and used as UserData1 and UserData2.
63 MacOS: Not yet implemented
64 */
65 EET_USER_EVENT,
66
67 //! This enum is never used, it only forces the compiler to
68 //! compile these enumeration values to 32 bit.
69 EGUIET_FORCE_32_BIT = 0x7fffffff
70
71 };
72
73 //! Enumeration for all mouse input events
74 enum EMOUSE_INPUT_EVENT
75 {
76 //! Left mouse button was pressed down.
77 EMIE_LMOUSE_PRESSED_DOWN = 0,
78
79 //! Right mouse button was pressed down.
80 EMIE_RMOUSE_PRESSED_DOWN,
81
82 //! Middle mouse button was pressed down.
83 EMIE_MMOUSE_PRESSED_DOWN,
84
85 //! Left mouse button was left up.
86 EMIE_LMOUSE_LEFT_UP,
87
88 //! Right mouse button was left up.
89 EMIE_RMOUSE_LEFT_UP,
90
91 //! Middle mouse button was left up.
92 EMIE_MMOUSE_LEFT_UP,
93
94 //! The mouse cursor changed its position.
95 EMIE_MOUSE_MOVED,
96
97 //! The mouse wheel was moved. Use Wheel value in event data to find out
98 //! in what direction and how fast.
99 EMIE_MOUSE_WHEEL,
100
101 //! Left mouse button double click.
102 //! This event is generated after the second EMIE_LMOUSE_PRESSED_DOWN event.
103 EMIE_LMOUSE_DOUBLE_CLICK,
104
105 //! Right mouse button double click.
106 //! This event is generated after the second EMIE_RMOUSE_PRESSED_DOWN event.
107 EMIE_RMOUSE_DOUBLE_CLICK,
108
109 //! Middle mouse button double click.
110 //! This event is generated after the second EMIE_MMOUSE_PRESSED_DOWN event.
111 EMIE_MMOUSE_DOUBLE_CLICK,
112
113 //! Left mouse button triple click.
114 //! This event is generated after the third EMIE_LMOUSE_PRESSED_DOWN event.
115 EMIE_LMOUSE_TRIPLE_CLICK,
116
117 //! Right mouse button triple click.
118 //! This event is generated after the third EMIE_RMOUSE_PRESSED_DOWN event.
119 EMIE_RMOUSE_TRIPLE_CLICK,
120
121 //! Middle mouse button triple click.
122 //! This event is generated after the third EMIE_MMOUSE_PRESSED_DOWN event.
123 EMIE_MMOUSE_TRIPLE_CLICK,
124
125 //! No real event. Just for convenience to get number of events
126 EMIE_COUNT
127 };
128
129 //! Masks for mouse button states
130 enum E_MOUSE_BUTTON_STATE_MASK
131 {
132 EMBSM_LEFT = 0x01,
133 EMBSM_RIGHT = 0x02,
134 EMBSM_MIDDLE = 0x04,
135
136 //! currently only on windows
137 EMBSM_EXTRA1 = 0x08,
138
139 //! currently only on windows
140 EMBSM_EXTRA2 = 0x10,
141
142 EMBSM_FORCE_32_BIT = 0x7fffffff
143 };
144
145 namespace gui
146 {
147
148 class IGUIElement;
149
150 //! Enumeration for all events which are sendable by the gui system
151 enum EGUI_EVENT_TYPE
152 {
153 //! A gui element has lost its focus.
154 /** GUIEvent.Caller is losing the focus to GUIEvent.Element.
155 If the event is absorbed then the focus will not be changed. */
156 EGET_ELEMENT_FOCUS_LOST = 0,
157
158 //! A gui element has got the focus.
159 /** If the event is absorbed then the focus will not be changed. */
160 EGET_ELEMENT_FOCUSED,
161
162 //! The mouse cursor hovered over a gui element.
163 /** If an element has sub-elements you also get this message for the subelements */
164 EGET_ELEMENT_HOVERED,
165
166 //! The mouse cursor left the hovered element.
167 /** If an element has sub-elements you also get this message for the subelements */
168 EGET_ELEMENT_LEFT,
169
170 //! An element would like to close.
171 /** Windows and context menus use this event when they would like to close,
172 this can be cancelled by absorbing the event. */
173 EGET_ELEMENT_CLOSED,
174
175 //! A button was clicked.
176 EGET_BUTTON_CLICKED,
177
178 //! A scrollbar has changed its position.
179 EGET_SCROLL_BAR_CHANGED,
180
181 //! A checkbox has changed its check state.
182 EGET_CHECKBOX_CHANGED,
183
184 //! A new item in a listbox was selected.
185 /** NOTE: You also get this event currently when the same item was clicked again after more than 500 ms. */
186 EGET_LISTBOX_CHANGED,
187
188 //! An item in the listbox was selected, which was already selected.
189 /** NOTE: You get the event currently only if the item was clicked again within 500 ms or selected by "enter" or "space". */
190 EGET_LISTBOX_SELECTED_AGAIN,
191
192 //! A file has been selected in the file dialog
193 EGET_FILE_SELECTED,
194
195 //! A directory has been selected in the file dialog
196 EGET_DIRECTORY_SELECTED,
197
198 //! A file open dialog has been closed without choosing a file
199 EGET_FILE_CHOOSE_DIALOG_CANCELLED,
200
201 //! 'Yes' was clicked on a messagebox
202 EGET_MESSAGEBOX_YES,
203
204 //! 'No' was clicked on a messagebox
205 EGET_MESSAGEBOX_NO,
206
207 //! 'OK' was clicked on a messagebox
208 EGET_MESSAGEBOX_OK,
209
210 //! 'Cancel' was clicked on a messagebox
211 EGET_MESSAGEBOX_CANCEL,
212
213 //! In an editbox 'ENTER' was pressed
214 EGET_EDITBOX_ENTER,
215
216 //! The text in an editbox was changed. This does not include automatic changes in text-breaking.
217 EGET_EDITBOX_CHANGED,
218
219 //! The marked area in an editbox was changed.
220 EGET_EDITBOX_MARKING_CHANGED,
221
222 //! The tab was changed in an tab control
223 EGET_TAB_CHANGED,
224
225 //! A menu item was selected in a (context) menu
226 EGET_MENU_ITEM_SELECTED,
227
228 //! The selection in a combo box has been changed
229 EGET_COMBO_BOX_CHANGED,
230
231 //! The value of a spin box has changed
232 EGET_SPINBOX_CHANGED,
233
234 //! A table has changed
235 EGET_TABLE_CHANGED,
236 EGET_TABLE_HEADER_CHANGED,
237 EGET_TABLE_SELECTED_AGAIN,
238
239 //! A tree view node lost selection. See IGUITreeView::getLastEventNode().
240 EGET_TREEVIEW_NODE_DESELECT,
241
242 //! A tree view node was selected. See IGUITreeView::getLastEventNode().
243 EGET_TREEVIEW_NODE_SELECT,
244
245 //! A tree view node was expanded. See IGUITreeView::getLastEventNode().
246 EGET_TREEVIEW_NODE_EXPAND,
247
248 //! A tree view node was collapsed. See IGUITreeView::getLastEventNode().
249 EGET_TREEVIEW_NODE_COLLAPSE,
250
251 //! deprecated - use EGET_TREEVIEW_NODE_COLLAPSE instead. This
252 //! may be removed by Irrlicht 1.9
253 EGET_TREEVIEW_NODE_COLLAPS = EGET_TREEVIEW_NODE_COLLAPSE,
254
255 //! No real event. Just for convenience to get number of events
256 EGET_COUNT
257 };
258 } // end namespace gui
259
260
261//! SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
262struct SEvent
263{
264 //! Any kind of GUI event.
265 struct SGUIEvent
266 {
267 //! IGUIElement who called the event
268 gui::IGUIElement* Caller;
269
270 //! If the event has something to do with another element, it will be held here.
271 gui::IGUIElement* Element;
272
273 //! Type of GUI Event
274 gui::EGUI_EVENT_TYPE EventType;
275
276 };
277
278 //! Any kind of mouse event.
279 struct SMouseInput
280 {
281 //! X position of mouse cursor
282 s32 X;
283
284 //! Y position of mouse cursor
285 s32 Y;
286
287 //! mouse wheel delta, often 1.0 or -1.0, but can have other values < 0.f or > 0.f;
288 /** Only valid if event was EMIE_MOUSE_WHEEL */
289 f32 Wheel;
290
291 //! True if shift was also pressed
292 bool Shift:1;
293
294 //! True if ctrl was also pressed
295 bool Control:1;
296
297 //! A bitmap of button states. You can use isButtonPressed() to determine
298 //! if a button is pressed or not.
299 //! Currently only valid if the event was EMIE_MOUSE_MOVED
300 u32 ButtonStates;
301
302 //! Is the left button pressed down?
303 bool isLeftPressed() const { return 0 != ( ButtonStates & EMBSM_LEFT ); }
304
305 //! Is the right button pressed down?
306 bool isRightPressed() const { return 0 != ( ButtonStates & EMBSM_RIGHT ); }
307
308 //! Is the middle button pressed down?
309 bool isMiddlePressed() const { return 0 != ( ButtonStates & EMBSM_MIDDLE ); }
310
311 //! Type of mouse event
312 EMOUSE_INPUT_EVENT Event;
313 };
314
315 //! Any kind of keyboard event.
316 struct SKeyInput
317 {
318 //! Character corresponding to the key (0, if not a character)
319 wchar_t Char;
320
321 //! Key which has been pressed or released
322 EKEY_CODE Key;
323
324 //! If not true, then the key was left up
325 bool PressedDown:1;
326
327 //! True if shift was also pressed
328 bool Shift:1;
329
330 //! True if ctrl was also pressed
331 bool Control:1;
332 };
333
334 //! A joystick event.
335 /** Unlike other events, joystick events represent the result of polling
336 * each connected joystick once per run() of the device. Joystick events will
337 * not be generated by default. If joystick support is available for the
338 * active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and
339 * @ref irr::IrrlichtDevice::activateJoysticks() has been called, an event of
340 * this type will be generated once per joystick per @ref IrrlichtDevice::run()
341 * regardless of whether the state of the joystick has actually changed. */
342 struct SJoystickEvent
343 {
344 enum
345 {
346 NUMBER_OF_BUTTONS = 32,
347
348 AXIS_X = 0, // e.g. analog stick 1 left to right
349 AXIS_Y, // e.g. analog stick 1 top to bottom
350 AXIS_Z, // e.g. throttle, or analog 2 stick 2 left to right
351 AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom
352 AXIS_U,
353 AXIS_V,
354 NUMBER_OF_AXES
355 };
356
357 /** A bitmap of button states. You can use IsButtonPressed() to
358 ( check the state of each button from 0 to (NUMBER_OF_BUTTONS - 1) */
359 u32 ButtonStates;
360
361 /** For AXIS_X, AXIS_Y, AXIS_Z, AXIS_R, AXIS_U and AXIS_V
362 * Values are in the range -32768 to 32767, with 0 representing
363 * the center position. You will receive the raw value from the
364 * joystick, and so will usually want to implement a dead zone around
365 * the center of the range. Axes not supported by this joystick will
366 * always have a value of 0. On Linux, POV hats are represented as axes,
367 * usually the last two active axis.
368 */
369 s16 Axis[NUMBER_OF_AXES];
370
371 /** The POV represents the angle of the POV hat in degrees * 100,
372 * from 0 to 35,900. A value of 65535 indicates that the POV hat
373 * is centered (or not present).
374 * This value is only supported on Windows. On Linux, the POV hat
375 * will be sent as 2 axes instead. */
376 u16 POV;
377
378 //! The ID of the joystick which generated this event.
379 /** This is an internal Irrlicht index; it does not map directly
380 * to any particular hardware joystick. */
381 u8 Joystick;
382
383 //! A helper function to check if a button is pressed.
384 bool IsButtonPressed(u32 button) const
385 {
386 if(button >= (u32)NUMBER_OF_BUTTONS)
387 return false;
388
389 return (ButtonStates & (1 << button)) ? true : false;
390 }
391 };
392
393
394 //! Any kind of log event.
395 struct SLogEvent
396 {
397 //! Pointer to text which has been logged
398 const c8* Text;
399
400 //! Log level in which the text has been logged
401 ELOG_LEVEL Level;
402 };
403
404 //! Any kind of user event.
405 struct SUserEvent
406 {
407 //! Some user specified data as int
408 s32 UserData1;
409
410 //! Another user specified data as int
411 s32 UserData2;
412 };
413
414 EEVENT_TYPE EventType;
415 union
416 {
417 struct SGUIEvent GUIEvent;
418 struct SMouseInput MouseInput;
419 struct SKeyInput KeyInput;
420 struct SJoystickEvent JoystickEvent;
421 struct SLogEvent LogEvent;
422 struct SUserEvent UserEvent;
423 };
424
425};
426
427//! Interface of an object which can receive events.
428/** Many of the engine's classes inherit IEventReceiver so they are able to
429process events. Events usually start at a postEventFromUser function and are
430passed down through a chain of event receivers until OnEvent returns true. See
431irr::EEVENT_TYPE for a description of where each type of event starts, and the
432path it takes through the system. */
433class IEventReceiver
434{
435public:
436
437 //! Destructor
438 virtual ~IEventReceiver() {}
439
440 //! Called if an event happened.
441 /** Please take care that you should only return 'true' when you want to _prevent_ Irrlicht
442 * from processing the event any further. So 'true' does mean that an event is completely done.
443 * Therefore your return value for all unprocessed events should be 'false'.
444 \return True if the event was processed.
445 */
446 virtual bool OnEvent(const SEvent& event) = 0;
447};
448
449
450//! Information on a joystick, returned from @ref irr::IrrlichtDevice::activateJoysticks()
451struct SJoystickInfo
452{
453 //! The ID of the joystick
454 /** This is an internal Irrlicht index; it does not map directly
455 * to any particular hardware joystick. It corresponds to the
456 * irr::SJoystickEvent Joystick ID. */
457 u8 Joystick;
458
459 //! The name that the joystick uses to identify itself.
460 core::stringc Name;
461
462 //! The number of buttons that the joystick has.
463 u32 Buttons;
464
465 //! The number of axes that the joystick has, i.e. X, Y, Z, R, U, V.
466 /** Note: with a Linux device, the POV hat (if any) will use two axes. These
467 * will be included in this count. */
468 u32 Axes;
469
470 //! An indication of whether the joystick has a POV hat.
471 /** A Windows device will identify the presence or absence or the POV hat. A
472 * Linux device cannot, and will always return POV_HAT_UNKNOWN. */
473 enum
474 {
475 //! A hat is definitely present.
476 POV_HAT_PRESENT,
477
478 //! A hat is definitely not present.
479 POV_HAT_ABSENT,
480
481 //! The presence or absence of a hat cannot be determined.
482 POV_HAT_UNKNOWN
483 } PovHat;
484}; // struct SJoystickInfo
485
486
487} // end namespace irr
488
489#endif
490
diff --git a/src/others/irrlicht-1.8.1/include/IFileArchive.h b/src/others/irrlicht-1.8.1/include/IFileArchive.h
new file mode 100644
index 0000000..a2e02a8
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IFileArchive.h
@@ -0,0 +1,132 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt/ Thomas Alten
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_FILE_ARCHIVE_H_INCLUDED__
6#define __I_FILE_ARCHIVE_H_INCLUDED__
7
8#include "IReadFile.h"
9#include "IFileList.h"
10
11namespace irr
12{
13
14namespace io
15{
16
17//! FileSystemType: which Filesystem should be used for e.g. browsing
18enum EFileSystemType
19{
20 FILESYSTEM_NATIVE = 0, // Native OS FileSystem
21 FILESYSTEM_VIRTUAL // Virtual FileSystem
22};
23
24//! Contains the different types of archives
25enum E_FILE_ARCHIVE_TYPE
26{
27 //! A PKZIP archive
28 EFAT_ZIP = MAKE_IRR_ID('Z','I','P', 0),
29
30 //! A gzip archive
31 EFAT_GZIP = MAKE_IRR_ID('g','z','i','p'),
32
33 //! A virtual directory
34 EFAT_FOLDER = MAKE_IRR_ID('f','l','d','r'),
35
36 //! An ID Software PAK archive
37 EFAT_PAK = MAKE_IRR_ID('P','A','K', 0),
38
39 //! A Nebula Device archive
40 EFAT_NPK = MAKE_IRR_ID('N','P','K', 0),
41
42 //! A Tape ARchive
43 EFAT_TAR = MAKE_IRR_ID('T','A','R', 0),
44
45 //! A wad Archive, Quake2, Halflife
46 EFAT_WAD = MAKE_IRR_ID('W','A','D', 0),
47
48 //! The type of this archive is unknown
49 EFAT_UNKNOWN = MAKE_IRR_ID('u','n','k','n')
50};
51
52//! The FileArchive manages archives and provides access to files inside them.
53class IFileArchive : public virtual IReferenceCounted
54{
55public:
56
57 //! Opens a file based on its name
58 /** Creates and returns a new IReadFile for a file in the archive.
59 \param filename The file to open
60 \return Returns A pointer to the created file on success,
61 or 0 on failure. */
62 virtual IReadFile* createAndOpenFile(const path& filename) =0;
63
64 //! Opens a file based on its position in the file list.
65 /** Creates and returns
66 \param index The zero based index of the file.
67 \return Returns a pointer to the created file on success, or 0 on failure. */
68 virtual IReadFile* createAndOpenFile(u32 index) =0;
69
70 //! Returns the complete file tree
71 /** \return Returns the complete directory tree for the archive,
72 including all files and folders */
73 virtual const IFileList* getFileList() const =0;
74
75 //! get the archive type
76 virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_UNKNOWN; }
77
78 //! An optionally used password string
79 /** This variable is publicly accessible from the interface in order to
80 avoid single access patterns to this place, and hence allow some more
81 obscurity.
82 */
83 core::stringc Password;
84};
85
86//! Class which is able to create an archive from a file.
87/** If you want the Irrlicht Engine be able to load archives of
88currently unsupported file formats (e.g .wad), then implement
89this and add your new Archive loader with
90IFileSystem::addArchiveLoader() to the engine. */
91class IArchiveLoader : public virtual IReferenceCounted
92{
93public:
94 //! Check if the file might be loaded by this class
95 /** Check based on the file extension (e.g. ".zip")
96 \param filename Name of file to check.
97 \return True if file seems to be loadable. */
98 virtual bool isALoadableFileFormat(const path& filename) const =0;
99
100 //! Check if the file might be loaded by this class
101 /** This check may look into the file.
102 \param file File handle to check.
103 \return True if file seems to be loadable. */
104 virtual bool isALoadableFileFormat(io::IReadFile* file) const =0;
105
106 //! Check to see if the loader can create archives of this type.
107 /** Check based on the archive type.
108 \param fileType The archive type to check.
109 \return True if the archile loader supports this type, false if not */
110 virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const =0;
111
112 //! Creates an archive from the filename
113 /** \param filename File to use.
114 \param ignoreCase Searching is performed without regarding the case
115 \param ignorePaths Files are searched for without checking for the directories
116 \return Pointer to newly created archive, or 0 upon error. */
117 virtual IFileArchive* createArchive(const path& filename, bool ignoreCase, bool ignorePaths) const =0;
118
119 //! Creates an archive from the file
120 /** \param file File handle to use.
121 \param ignoreCase Searching is performed without regarding the case
122 \param ignorePaths Files are searched for without checking for the directories
123 \return Pointer to newly created archive, or 0 upon error. */
124 virtual IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const =0;
125};
126
127
128} // end namespace io
129} // end namespace irr
130
131#endif
132
diff --git a/src/others/irrlicht-1.8.1/include/IFileList.h b/src/others/irrlicht-1.8.1/include/IFileList.h
new file mode 100644
index 0000000..4c2f8ea
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IFileList.h
@@ -0,0 +1,94 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_FILE_LIST_H_INCLUDED__
6#define __I_FILE_LIST_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "path.h"
10
11namespace irr
12{
13namespace io
14{
15
16//! Provides a list of files and folders.
17/** File lists usually contain a list of all files in a given folder,
18but can also contain a complete directory structure. */
19class IFileList : public virtual IReferenceCounted
20{
21public:
22 //! Get the number of files in the filelist.
23 /** \return Amount of files and directories in the file list. */
24 virtual u32 getFileCount() const = 0;
25
26 //! Gets the name of a file in the list, based on an index.
27 /** The path is not included in this name. Use getFullFileName for this.
28 \param index is the zero based index of the file which name should
29 be returned. The index must be less than the amount getFileCount() returns.
30 \return File name of the file. Returns 0, if an error occured. */
31 virtual const io::path& getFileName(u32 index) const = 0;
32
33 //! Gets the full name of a file in the list including the path, based on an index.
34 /** \param index is the zero based index of the file which name should
35 be returned. The index must be less than the amount getFileCount() returns.
36 \return File name of the file. Returns 0 if an error occured. */
37 virtual const io::path& getFullFileName(u32 index) const = 0;
38
39 //! Returns the size of a file in the file list, based on an index.
40 /** \param index is the zero based index of the file which should be returned.
41 The index must be less than the amount getFileCount() returns.
42 \return The size of the file in bytes. */
43 virtual u32 getFileSize(u32 index) const = 0;
44
45 //! Returns the file offset of a file in the file list, based on an index.
46 /** \param index is the zero based index of the file which should be returned.
47 The index must be less than the amount getFileCount() returns.
48 \return The offset of the file in bytes. */
49 virtual u32 getFileOffset(u32 index) const = 0;
50
51 //! Returns the ID of a file in the file list, based on an index.
52 /** This optional ID can be used to link the file list entry to information held
53 elsewhere. For example this could be an index in an IFileArchive, linking the entry
54 to its data offset, uncompressed size and CRC.
55 \param index is the zero based index of the file which should be returned.
56 The index must be less than the amount getFileCount() returns.
57 \return The ID of the file. */
58 virtual u32 getID(u32 index) const = 0;
59
60 //! Check if the file is a directory
61 /** \param index The zero based index which will be checked. The index
62 must be less than the amount getFileCount() returns.
63 \return True if the file is a directory, else false. */
64 virtual bool isDirectory(u32 index) const = 0;
65
66 //! Searches for a file or folder in the list
67 /** Searches for a file by name
68 \param filename The name of the file to search for.
69 \param isFolder True if you are searching for a directory path, false if you are searching for a file
70 \return Returns the index of the file in the file list, or -1 if
71 no matching name name was found. */
72 virtual s32 findFile(const io::path& filename, bool isFolder=false) const = 0;
73
74 //! Returns the base path of the file list
75 virtual const io::path& getPath() const = 0;
76
77 //! Add as a file or folder to the list
78 /** \param fullPath The file name including path, from the root of the file list.
79 \param isDirectory True if this is a directory rather than a file.
80 \param offset The file offset inside an archive
81 \param size The size of the file in bytes.
82 \param id The ID of the file in the archive which owns it */
83 virtual u32 addItem(const io::path& fullPath, u32 offset, u32 size, bool isDirectory, u32 id=0) = 0;
84
85 //! Sorts the file list. You should call this after adding any items to the file list
86 virtual void sort() = 0;
87};
88
89} // end namespace irr
90} // end namespace io
91
92
93#endif
94
diff --git a/src/others/irrlicht-1.8.1/include/IFileSystem.h b/src/others/irrlicht-1.8.1/include/IFileSystem.h
new file mode 100644
index 0000000..f158363
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IFileSystem.h
@@ -0,0 +1,385 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_FILE_SYSTEM_H_INCLUDED__
6#define __I_FILE_SYSTEM_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "IXMLReader.h"
10#include "IFileArchive.h"
11
12namespace irr
13{
14namespace video
15{
16 class IVideoDriver;
17} // end namespace video
18namespace io
19{
20
21class IReadFile;
22class IWriteFile;
23class IFileList;
24class IXMLWriter;
25class IAttributes;
26
27
28//! The FileSystem manages files and archives and provides access to them.
29/** It manages where files are, so that modules which use the the IO do not
30need to know where every file is located. A file could be in a .zip-Archive or
31as file on disk, using the IFileSystem makes no difference to this. */
32class IFileSystem : public virtual IReferenceCounted
33{
34public:
35
36 //! Opens a file for read access.
37 /** \param filename: Name of file to open.
38 \return Pointer to the created file interface.
39 The returned pointer should be dropped when no longer needed.
40 See IReferenceCounted::drop() for more information. */
41 virtual IReadFile* createAndOpenFile(const path& filename) =0;
42
43 //! Creates an IReadFile interface for accessing memory like a file.
44 /** This allows you to use a pointer to memory where an IReadFile is requested.
45 \param memory: A pointer to the start of the file in memory
46 \param len: The length of the memory in bytes
47 \param fileName: The name given to this file
48 \param deleteMemoryWhenDropped: True if the memory should be deleted
49 along with the IReadFile when it is dropped.
50 \return Pointer to the created file interface.
51 The returned pointer should be dropped when no longer needed.
52 See IReferenceCounted::drop() for more information.
53 */
54 virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
55
56 //! Creates an IReadFile interface for accessing files inside files.
57 /** This is useful e.g. for archives.
58 \param fileName: The name given to this file
59 \param alreadyOpenedFile: Pointer to the enclosing file
60 \param pos: Start of the file inside alreadyOpenedFile
61 \param areaSize: The length of the file
62 \return A pointer to the created file interface.
63 The returned pointer should be dropped when no longer needed.
64 See IReferenceCounted::drop() for more information.
65 */
66 virtual IReadFile* createLimitReadFile(const path& fileName,
67 IReadFile* alreadyOpenedFile, long pos, long areaSize) =0;
68
69 //! Creates an IWriteFile interface for accessing memory like a file.
70 /** This allows you to use a pointer to memory where an IWriteFile is requested.
71 You are responsible for allocating enough memory.
72 \param memory: A pointer to the start of the file in memory (allocated by you)
73 \param len: The length of the memory in bytes
74 \param fileName: The name given to this file
75 \param deleteMemoryWhenDropped: True if the memory should be deleted
76 along with the IWriteFile when it is dropped.
77 \return Pointer to the created file interface.
78 The returned pointer should be dropped when no longer needed.
79 See IReferenceCounted::drop() for more information.
80 */
81 virtual IWriteFile* createMemoryWriteFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
82
83
84 //! Opens a file for write access.
85 /** \param filename: Name of file to open.
86 \param append: If the file already exist, all write operations are
87 appended to the file.
88 \return Pointer to the created file interface. 0 is returned, if the
89 file could not created or opened for writing.
90 The returned pointer should be dropped when no longer needed.
91 See IReferenceCounted::drop() for more information. */
92 virtual IWriteFile* createAndWriteFile(const path& filename, bool append=false) =0;
93
94 //! Adds an archive to the file system.
95 /** After calling this, the Irrlicht Engine will also search and open
96 files directly from this archive. This is useful for hiding data from
97 the end user, speeding up file access and making it possible to access
98 for example Quake3 .pk3 files, which are just renamed .zip files. By
99 default Irrlicht supports ZIP, PAK, TAR, PNK, and directories as
100 archives. You can provide your own archive types by implementing
101 IArchiveLoader and passing an instance to addArchiveLoader.
102 Irrlicht supports AES-encrypted zip files, and the advanced compression
103 techniques lzma and bzip2.
104 \param filename: Filename of the archive to add to the file system.
105 \param ignoreCase: If set to true, files in the archive can be accessed without
106 writing all letters in the right case.
107 \param ignorePaths: If set to true, files in the added archive can be accessed
108 without its complete path.
109 \param archiveType: If no specific E_FILE_ARCHIVE_TYPE is selected then
110 the type of archive will depend on the extension of the file name. If
111 you use a different extension then you can use this parameter to force
112 a specific type of archive.
113 \param password An optional password, which is used in case of encrypted archives.
114 \param retArchive A pointer that will be set to the archive that is added.
115 \return True if the archive was added successfully, false if not. */
116 virtual bool addFileArchive(const path& filename, bool ignoreCase=true,
117 bool ignorePaths=true,
118 E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
119 const core::stringc& password="",
120 IFileArchive** retArchive=0) =0;
121
122 //! Adds an archive to the file system.
123 /** After calling this, the Irrlicht Engine will also search and open
124 files directly from this archive. This is useful for hiding data from
125 the end user, speeding up file access and making it possible to access
126 for example Quake3 .pk3 files, which are just renamed .zip files. By
127 default Irrlicht supports ZIP, PAK, TAR, PNK, and directories as
128 archives. You can provide your own archive types by implementing
129 IArchiveLoader and passing an instance to addArchiveLoader.
130 Irrlicht supports AES-encrypted zip files, and the advanced compression
131 techniques lzma and bzip2.
132 If you want to add a directory as an archive, prefix its name with a
133 slash in order to let Irrlicht recognize it as a folder mount (mypath/).
134 Using this technique one can build up a search order, because archives
135 are read first, and can be used more easily with relative filenames.
136 \param file: Archive to add to the file system.
137 \param ignoreCase: If set to true, files in the archive can be accessed without
138 writing all letters in the right case.
139 \param ignorePaths: If set to true, files in the added archive can be accessed
140 without its complete path.
141 \param archiveType: If no specific E_FILE_ARCHIVE_TYPE is selected then
142 the type of archive will depend on the extension of the file name. If
143 you use a different extension then you can use this parameter to force
144 a specific type of archive.
145 \param password An optional password, which is used in case of encrypted archives.
146 \param retArchive A pointer that will be set to the archive that is added.
147 \return True if the archive was added successfully, false if not. */
148 virtual bool addFileArchive(IReadFile* file, bool ignoreCase=true,
149 bool ignorePaths=true,
150 E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
151 const core::stringc& password="",
152 IFileArchive** retArchive=0) =0;
153
154 //! Adds an archive to the file system.
155 /** \param archive: The archive to add to the file system.
156 \return True if the archive was added successfully, false if not. */
157 virtual bool addFileArchive(IFileArchive* archive) =0;
158
159 //! Get the number of archives currently attached to the file system
160 virtual u32 getFileArchiveCount() const =0;
161
162 //! Removes an archive from the file system.
163 /** This will close the archive and free any file handles, but will not
164 close resources which have already been loaded and are now cached, for
165 example textures and meshes.
166 \param index: The index of the archive to remove
167 \return True on success, false on failure */
168 virtual bool removeFileArchive(u32 index) =0;
169
170 //! Removes an archive from the file system.
171 /** This will close the archive and free any file handles, but will not
172 close resources which have already been loaded and are now cached, for
173 example textures and meshes. Note that a relative filename might be
174 interpreted differently on each call, depending on the current working
175 directory. In case you want to remove an archive that was added using
176 a relative path name, you have to change to the same working directory
177 again. This means, that the filename given on creation is not an
178 identifier for the archive, but just a usual filename that is used for
179 locating the archive to work with.
180 \param filename The archive pointed to by the name will be removed
181 \return True on success, false on failure */
182 virtual bool removeFileArchive(const path& filename) =0;
183
184 //! Removes an archive from the file system.
185 /** This will close the archive and free any file handles, but will not
186 close resources which have already been loaded and are now cached, for
187 example textures and meshes.
188 \param archive The archive to remove.
189 \return True on success, false on failure */
190 virtual bool removeFileArchive(const IFileArchive* archive) =0;
191
192 //! Changes the search order of attached archives.
193 /**
194 \param sourceIndex: The index of the archive to change
195 \param relative: The relative change in position, archives with a lower index are searched first */
196 virtual bool moveFileArchive(u32 sourceIndex, s32 relative) =0;
197
198 //! Get the archive at a given index.
199 virtual IFileArchive* getFileArchive(u32 index) =0;
200
201 //! Adds an external archive loader to the engine.
202 /** Use this function to add support for new archive types to the
203 engine, for example proprietary or encrypted file storage. */
204 virtual void addArchiveLoader(IArchiveLoader* loader) =0;
205
206 //! Gets the number of archive loaders currently added
207 virtual u32 getArchiveLoaderCount() const = 0;
208
209 //! Retrieve the given archive loader
210 /** \param index The index of the loader to retrieve. This parameter is an 0-based
211 array index.
212 \return A pointer to the specified loader, 0 if the index is incorrect. */
213 virtual IArchiveLoader* getArchiveLoader(u32 index) const = 0;
214
215 //! Adds a zip archive to the file system.
216 /** \deprecated This function is provided for compatibility
217 with older versions of Irrlicht and may be removed in Irrlicht 1.9,
218 you should use addFileArchive instead.
219 After calling this, the Irrlicht Engine will search and open files directly from this archive too.
220 This is useful for hiding data from the end user, speeding up file access and making it possible to
221 access for example Quake3 .pk3 files, which are no different than .zip files.
222 \param filename: Filename of the zip archive to add to the file system.
223 \param ignoreCase: If set to true, files in the archive can be accessed without
224 writing all letters in the right case.
225 \param ignorePaths: If set to true, files in the added archive can be accessed
226 without its complete path.
227 \return True if the archive was added successfully, false if not. */
228 _IRR_DEPRECATED_ virtual bool addZipFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
229 {
230 return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_ZIP);
231 }
232
233 //! Adds an unzipped archive (or basedirectory with subdirectories..) to the file system.
234 /** \deprecated This function is provided for compatibility
235 with older versions of Irrlicht and may be removed in Irrlicht 1.9,
236 you should use addFileArchive instead.
237 Useful for handling data which will be in a zip file
238 \param filename: Filename of the unzipped zip archive base directory to add to the file system.
239 \param ignoreCase: If set to true, files in the archive can be accessed without
240 writing all letters in the right case.
241 \param ignorePaths: If set to true, files in the added archive can be accessed
242 without its complete path.
243 \return True if the archive was added successful, false if not. */
244 _IRR_DEPRECATED_ virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
245 {
246 return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_FOLDER);
247 }
248
249 //! Adds a pak archive to the file system.
250 /** \deprecated This function is provided for compatibility
251 with older versions of Irrlicht and may be removed in Irrlicht 1.9,
252 you should use addFileArchive instead.
253 After calling this, the Irrlicht Engine will search and open files directly from this archive too.
254 This is useful for hiding data from the end user, speeding up file access and making it possible to
255 access for example Quake2/KingPin/Hexen2 .pak files
256 \param filename: Filename of the pak archive to add to the file system.
257 \param ignoreCase: If set to true, files in the archive can be accessed without
258 writing all letters in the right case.
259 \param ignorePaths: If set to true, files in the added archive can be accessed
260 without its complete path.(should not use with Quake2 paks
261 \return True if the archive was added successful, false if not. */
262 _IRR_DEPRECATED_ virtual bool addPakFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
263 {
264 return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_PAK);
265 }
266
267 //! Get the current working directory.
268 /** \return Current working directory as a string. */
269 virtual const path& getWorkingDirectory() =0;
270
271 //! Changes the current working directory.
272 /** \param newDirectory: A string specifying the new working directory.
273 The string is operating system dependent. Under Windows it has
274 the form "<drive>:\<directory>\<sudirectory>\<..>". An example would be: "C:\Windows\"
275 \return True if successful, otherwise false. */
276 virtual bool changeWorkingDirectoryTo(const path& newDirectory) =0;
277
278 //! Converts a relative path to an absolute (unique) path, resolving symbolic links if required
279 /** \param filename Possibly relative file or directory name to query.
280 \result Absolute filename which points to the same file. */
281 virtual path getAbsolutePath(const path& filename) const =0;
282
283 //! Get the directory a file is located in.
284 /** \param filename: The file to get the directory from.
285 \return String containing the directory of the file. */
286 virtual path getFileDir(const path& filename) const =0;
287
288 //! Get the base part of a filename, i.e. the name without the directory part.
289 /** If no directory is prefixed, the full name is returned.
290 \param filename: The file to get the basename from
291 \param keepExtension True if filename with extension is returned otherwise everything
292 after the final '.' is removed as well. */
293 virtual path getFileBasename(const path& filename, bool keepExtension=true) const =0;
294
295 //! flatten a path and file name for example: "/you/me/../." becomes "/you"
296 virtual path& flattenFilename(path& directory, const path& root="/") const =0;
297
298 //! Get the relative filename, relative to the given directory
299 virtual path getRelativeFilename(const path& filename, const path& directory) const =0;
300
301 //! Creates a list of files and directories in the current working directory and returns it.
302 /** \return a Pointer to the created IFileList is returned. After the list has been used
303 it has to be deleted using its IFileList::drop() method.
304 See IReferenceCounted::drop() for more information. */
305 virtual IFileList* createFileList() =0;
306
307 //! Creates an empty filelist
308 /** \return a Pointer to the created IFileList is returned. After the list has been used
309 it has to be deleted using its IFileList::drop() method.
310 See IReferenceCounted::drop() for more information. */
311 virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths) =0;
312
313 //! Set the active type of file system.
314 virtual EFileSystemType setFileListSystem(EFileSystemType listType) =0;
315
316 //! Determines if a file exists and could be opened.
317 /** \param filename is the string identifying the file which should be tested for existence.
318 \return True if file exists, and false if it does not exist or an error occured. */
319 virtual bool existFile(const path& filename) const =0;
320
321 //! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
322 /** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
323 more information on how to use the parser.
324 \return 0, if file could not be opened, otherwise a pointer to the created
325 IXMLReader is returned. After use, the reader
326 has to be deleted using its IXMLReader::drop() method.
327 See IReferenceCounted::drop() for more information. */
328 virtual IXMLReader* createXMLReader(const path& filename) =0;
329
330 //! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
331 /** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
332 more information on how to use the parser.
333 \return 0, if file could not be opened, otherwise a pointer to the created
334 IXMLReader is returned. After use, the reader
335 has to be deleted using its IXMLReader::drop() method.
336 See IReferenceCounted::drop() for more information. */
337 virtual IXMLReader* createXMLReader(IReadFile* file) =0;
338
339 //! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
340 /** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
341 more information on how to use the parser.
342 \return 0, if file could not be opened, otherwise a pointer to the created
343 IXMLReader is returned. After use, the reader
344 has to be deleted using its IXMLReaderUTF8::drop() method.
345 See IReferenceCounted::drop() for more information. */
346 virtual IXMLReaderUTF8* createXMLReaderUTF8(const path& filename) =0;
347
348 //! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
349 /** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
350 more information on how to use the parser.
351 \return 0, if file could not be opened, otherwise a pointer to the created
352 IXMLReader is returned. After use, the reader
353 has to be deleted using its IXMLReaderUTF8::drop() method.
354 See IReferenceCounted::drop() for more information. */
355 virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file) =0;
356
357 //! Creates a XML Writer from a file.
358 /** \return 0, if file could not be opened, otherwise a pointer to the created
359 IXMLWriter is returned. After use, the reader
360 has to be deleted using its IXMLWriter::drop() method.
361 See IReferenceCounted::drop() for more information. */
362 virtual IXMLWriter* createXMLWriter(const path& filename) =0;
363
364 //! Creates a XML Writer from a file.
365 /** \return 0, if file could not be opened, otherwise a pointer to the created
366 IXMLWriter is returned. After use, the reader
367 has to be deleted using its IXMLWriter::drop() method.
368 See IReferenceCounted::drop() for more information. */
369 virtual IXMLWriter* createXMLWriter(IWriteFile* file) =0;
370
371 //! Creates a new empty collection of attributes, usable for serialization and more.
372 /** \param driver: Video driver to be used to load textures when specified as attribute values.
373 Can be null to prevent automatic texture loading by attributes.
374 \return Pointer to the created object.
375 If you no longer need the object, you should call IAttributes::drop().
376 See IReferenceCounted::drop() for more information. */
377 virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) =0;
378};
379
380
381} // end namespace io
382} // end namespace irr
383
384#endif
385
diff --git a/src/others/irrlicht-1.8.1/include/IGPUProgrammingServices.h b/src/others/irrlicht-1.8.1/include/IGPUProgrammingServices.h
new file mode 100644
index 0000000..596f094
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGPUProgrammingServices.h
@@ -0,0 +1,474 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
6#define __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
7
8#include "EShaderTypes.h"
9#include "EMaterialTypes.h"
10#include "EPrimitiveTypes.h"
11#include "path.h"
12
13namespace irr
14{
15
16namespace io
17{
18 class IReadFile;
19} // end namespace io
20
21namespace video
22{
23
24class IVideoDriver;
25class IShaderConstantSetCallBack;
26
27//! Enumeration for different types of shading languages
28enum E_GPU_SHADING_LANGUAGE
29{
30 //! The default language, so HLSL for Direct3D and GLSL for OpenGL.
31 EGSL_DEFAULT = 0,
32
33 //! Cg shading language.*/
34 EGSL_CG
35};
36
37//! Interface making it possible to create and use programs running on the GPU.
38class IGPUProgrammingServices
39{
40public:
41
42 //! Destructor
43 virtual ~IGPUProgrammingServices() {}
44
45 //! Adds a new high-level shading material renderer to the VideoDriver.
46 /** Currently only HLSL/D3D9 and GLSL/OpenGL are supported.
47 \param vertexShaderProgram String containing the source of the vertex
48 shader program. This can be 0 if no vertex program shall be used.
49 \param vertexShaderEntryPointName Name of the entry function of the
50 vertexShaderProgram (p.e. "main")
51 \param vsCompileTarget Vertex shader version the high level shader
52 shall be compiled to.
53 \param pixelShaderProgram String containing the source of the pixel
54 shader program. This can be 0 if no pixel shader shall be used.
55 \param pixelShaderEntryPointName Entry name of the function of the
56 pixelShaderProgram (p.e. "main")
57 \param psCompileTarget Pixel shader version the high level shader
58 shall be compiled to.
59 \param geometryShaderProgram String containing the source of the
60 geometry shader program. This can be 0 if no geometry shader shall be
61 used.
62 \param geometryShaderEntryPointName Entry name of the function of the
63 geometryShaderProgram (p.e. "main")
64 \param gsCompileTarget Geometry shader version the high level shader
65 shall be compiled to.
66 \param inType Type of vertices passed to geometry shader
67 \param outType Type of vertices created by geometry shader
68 \param verticesOut Maximal number of vertices created by geometry
69 shader. If 0, maximal number supported is assumed.
70 \param callback Pointer to an implementation of
71 IShaderConstantSetCallBack in which you can set the needed vertex,
72 pixel, and geometry shader program constants. Set this to 0 if you
73 don't need this.
74 \param baseMaterial Base material which renderstates will be used to
75 shade the material.
76 \param userData a user data int. This int can be set to any value and
77 will be set as parameter in the callback method when calling
78 OnSetConstants(). In this way it is easily possible to use the same
79 callback method for multiple materials and distinguish between them
80 during the call.
81 \param shaderLang a type of shading language used in current shader.
82 \return Number of the material type which can be set in
83 SMaterial::MaterialType to use the renderer. -1 is returned if an error
84 occured, e.g. if a shader program could not be compiled or a compile
85 target is not reachable. The error strings are then printed to the
86 error log and can be catched with a custom event receiver. */
87 virtual s32 addHighLevelShaderMaterial(
88 const c8* vertexShaderProgram,
89 const c8* vertexShaderEntryPointName,
90 E_VERTEX_SHADER_TYPE vsCompileTarget,
91 const c8* pixelShaderProgram,
92 const c8* pixelShaderEntryPointName,
93 E_PIXEL_SHADER_TYPE psCompileTarget,
94 const c8* geometryShaderProgram,
95 const c8* geometryShaderEntryPointName = "main",
96 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
97 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
98 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
99 u32 verticesOut = 0,
100 IShaderConstantSetCallBack* callback = 0,
101 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
102 s32 userData = 0,
103 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
104
105 //! convenience function for use without geometry shaders
106 s32 addHighLevelShaderMaterial(
107 const c8* vertexShaderProgram,
108 const c8* vertexShaderEntryPointName="main",
109 E_VERTEX_SHADER_TYPE vsCompileTarget=EVST_VS_1_1,
110 const c8* pixelShaderProgram=0,
111 const c8* pixelShaderEntryPointName="main",
112 E_PIXEL_SHADER_TYPE psCompileTarget=EPST_PS_1_1,
113 IShaderConstantSetCallBack* callback=0,
114 E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID,
115 s32 userData=0,
116 E_GPU_SHADING_LANGUAGE shadingLang=EGSL_DEFAULT)
117 {
118 return addHighLevelShaderMaterial(
119 vertexShaderProgram, vertexShaderEntryPointName,
120 vsCompileTarget, pixelShaderProgram,
121 pixelShaderEntryPointName, psCompileTarget,
122 0, "main", EGST_GS_4_0,
123 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
124 callback, baseMaterial, userData, shadingLang);
125 }
126
127 //! convenience function for use with many defaults, without geometry shader
128 /** All shader names are set to "main" and compile targets are shader
129 type 1.1.
130 */
131 s32 addHighLevelShaderMaterial(
132 const c8* vertexShaderProgram,
133 const c8* pixelShaderProgram=0,
134 IShaderConstantSetCallBack* callback=0,
135 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
136 s32 userData=0)
137 {
138 return addHighLevelShaderMaterial(
139 vertexShaderProgram, "main",
140 EVST_VS_1_1, pixelShaderProgram,
141 "main", EPST_PS_1_1,
142 0, "main", EGST_GS_4_0,
143 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
144 callback, baseMaterial, userData);
145 }
146
147 //! convenience function for use with many defaults, with geometry shader
148 /** All shader names are set to "main" and compile targets are shader
149 type 1.1 and geometry shader 4.0.
150 */
151 s32 addHighLevelShaderMaterial(
152 const c8* vertexShaderProgram,
153 const c8* pixelShaderProgram = 0,
154 const c8* geometryShaderProgram = 0,
155 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
156 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
157 u32 verticesOut = 0,
158 IShaderConstantSetCallBack* callback = 0,
159 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
160 s32 userData = 0 )
161 {
162 return addHighLevelShaderMaterial(
163 vertexShaderProgram, "main",
164 EVST_VS_1_1, pixelShaderProgram,
165 "main", EPST_PS_1_1,
166 geometryShaderProgram, "main", EGST_GS_4_0,
167 inType, outType, verticesOut,
168 callback, baseMaterial, userData);
169 }
170
171 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
172 /** \param vertexShaderProgramFileName Text file containing the source
173 of the vertex shader program. Set to empty string if no vertex shader
174 shall be created.
175 \param vertexShaderEntryPointName Name of the entry function of the
176 vertexShaderProgram (p.e. "main")
177 \param vsCompileTarget Vertex shader version the high level shader
178 shall be compiled to.
179 \param pixelShaderProgramFileName Text file containing the source of
180 the pixel shader program. Set to empty string if no pixel shader shall
181 be created.
182 \param pixelShaderEntryPointName Entry name of the function of the
183 pixelShaderProgram (p.e. "main")
184 \param psCompileTarget Pixel shader version the high level shader
185 shall be compiled to.
186 \param geometryShaderProgramFileName Name of the source of
187 the geometry shader program. Set to empty string if no geometry shader
188 shall be created.
189 \param geometryShaderEntryPointName Entry name of the function of the
190 geometryShaderProgram (p.e. "main")
191 \param gsCompileTarget Geometry shader version the high level shader
192 shall be compiled to.
193 \param inType Type of vertices passed to geometry shader
194 \param outType Type of vertices created by geometry shader
195 \param verticesOut Maximal number of vertices created by geometry
196 shader. If 0, maximal number supported is assumed.
197 \param callback Pointer to an implementation of
198 IShaderConstantSetCallBack in which you can set the needed vertex,
199 pixel, and geometry shader program constants. Set this to 0 if you
200 don't need this.
201 \param baseMaterial Base material which renderstates will be used to
202 shade the material.
203 \param userData a user data int. This int can be set to any value and
204 will be set as parameter in the callback method when calling
205 OnSetConstants(). In this way it is easily possible to use the same
206 callback method for multiple materials and distinguish between them
207 during the call.
208 \param shaderLang a type of shading language used in current shader.
209 \return Number of the material type which can be set in
210 SMaterial::MaterialType to use the renderer. -1 is returned if an error
211 occured, e.g. if a shader program could not be compiled or a compile
212 target is not reachable. The error strings are then printed to the
213 error log and can be catched with a custom event receiver. */
214 virtual s32 addHighLevelShaderMaterialFromFiles(
215 const io::path& vertexShaderProgramFileName,
216 const c8* vertexShaderEntryPointName,
217 E_VERTEX_SHADER_TYPE vsCompileTarget,
218 const io::path& pixelShaderProgramFileName,
219 const c8* pixelShaderEntryPointName,
220 E_PIXEL_SHADER_TYPE psCompileTarget,
221 const io::path& geometryShaderProgramFileName,
222 const c8* geometryShaderEntryPointName = "main",
223 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
224 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
225 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
226 u32 verticesOut = 0,
227 IShaderConstantSetCallBack* callback = 0,
228 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
229 s32 userData = 0,
230 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
231
232 //! convenience function for use without geometry shaders
233 s32 addHighLevelShaderMaterialFromFiles(
234 const io::path& vertexShaderProgramFileName,
235 const c8* vertexShaderEntryPointName = "main",
236 E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
237 const io::path& pixelShaderProgramFileName = "",
238 const c8* pixelShaderEntryPointName = "main",
239 E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
240 IShaderConstantSetCallBack* callback = 0,
241 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
242 s32 userData = 0,
243 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT)
244 {
245 return addHighLevelShaderMaterialFromFiles(
246 vertexShaderProgramFileName, vertexShaderEntryPointName,
247 vsCompileTarget, pixelShaderProgramFileName,
248 pixelShaderEntryPointName, psCompileTarget,
249 "", "main", EGST_GS_4_0,
250 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
251 callback, baseMaterial, userData, shadingLang);
252 }
253
254 //! convenience function for use with many defaults, without geometry shader
255 /** All shader names are set to "main" and compile targets are shader
256 type 1.1.
257 */
258 s32 addHighLevelShaderMaterialFromFiles(
259 const io::path& vertexShaderProgramFileName,
260 const io::path& pixelShaderProgramFileName = "",
261 IShaderConstantSetCallBack* callback = 0,
262 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
263 s32 userData = 0 )
264 {
265 return addHighLevelShaderMaterialFromFiles(
266 vertexShaderProgramFileName, "main",
267 EVST_VS_1_1, pixelShaderProgramFileName,
268 "main", EPST_PS_1_1,
269 "", "main", EGST_GS_4_0,
270 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
271 callback, baseMaterial, userData);
272 }
273
274 //! convenience function for use with many defaults, with geometry shader
275 /** All shader names are set to "main" and compile targets are shader
276 type 1.1 and geometry shader 4.0.
277 */
278 s32 addHighLevelShaderMaterialFromFiles(
279 const io::path& vertexShaderProgramFileName,
280 const io::path& pixelShaderProgramFileName = "",
281 const io::path& geometryShaderProgramFileName = "",
282 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
283 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
284 u32 verticesOut = 0,
285 IShaderConstantSetCallBack* callback = 0,
286 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
287 s32 userData = 0 )
288 {
289 return addHighLevelShaderMaterialFromFiles(
290 vertexShaderProgramFileName, "main",
291 EVST_VS_1_1, pixelShaderProgramFileName,
292 "main", EPST_PS_1_1,
293 geometryShaderProgramFileName, "main", EGST_GS_4_0,
294 inType, outType, verticesOut,
295 callback, baseMaterial, userData);
296 }
297
298 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
299 /** \param vertexShaderProgram Text file handle containing the source
300 of the vertex shader program. Set to 0 if no vertex shader shall be
301 created.
302 \param vertexShaderEntryPointName Name of the entry function of the
303 vertexShaderProgram
304 \param vsCompileTarget Vertex shader version the high level shader
305 shall be compiled to.
306 \param pixelShaderProgram Text file handle containing the source of
307 the pixel shader program. Set to 0 if no pixel shader shall be created.
308 \param pixelShaderEntryPointName Entry name of the function of the
309 pixelShaderProgram (p.e. "main")
310 \param psCompileTarget Pixel shader version the high level shader
311 shall be compiled to.
312 \param geometryShaderProgram Text file handle containing the source of
313 the geometry shader program. Set to 0 if no geometry shader shall be
314 created.
315 \param geometryShaderEntryPointName Entry name of the function of the
316 geometryShaderProgram (p.e. "main")
317 \param gsCompileTarget Geometry shader version the high level shader
318 shall be compiled to.
319 \param inType Type of vertices passed to geometry shader
320 \param outType Type of vertices created by geometry shader
321 \param verticesOut Maximal number of vertices created by geometry
322 shader. If 0, maximal number supported is assumed.
323 \param callback Pointer to an implementation of
324 IShaderConstantSetCallBack in which you can set the needed vertex and
325 pixel shader program constants. Set this to 0 if you don't need this.
326 \param baseMaterial Base material which renderstates will be used to
327 shade the material.
328 \param userData a user data int. This int can be set to any value and
329 will be set as parameter in the callback method when calling
330 OnSetConstants(). In this way it is easily possible to use the same
331 callback method for multiple materials and distinguish between them
332 during the call.
333 \param shaderLang a type of shading language used in current shader.
334 \return Number of the material type which can be set in
335 SMaterial::MaterialType to use the renderer. -1 is returned if an
336 error occured, e.g. if a shader program could not be compiled or a
337 compile target is not reachable. The error strings are then printed to
338 the error log and can be catched with a custom event receiver. */
339 virtual s32 addHighLevelShaderMaterialFromFiles(
340 io::IReadFile* vertexShaderProgram,
341 const c8* vertexShaderEntryPointName,
342 E_VERTEX_SHADER_TYPE vsCompileTarget,
343 io::IReadFile* pixelShaderProgram,
344 const c8* pixelShaderEntryPointName,
345 E_PIXEL_SHADER_TYPE psCompileTarget,
346 io::IReadFile* geometryShaderProgram,
347 const c8* geometryShaderEntryPointName = "main",
348 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
349 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
350 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
351 u32 verticesOut = 0,
352 IShaderConstantSetCallBack* callback = 0,
353 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
354 s32 userData = 0,
355 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
356
357 //! convenience function for use without geometry shaders
358 s32 addHighLevelShaderMaterialFromFiles(
359 io::IReadFile* vertexShaderProgram,
360 const c8* vertexShaderEntryPointName = "main",
361 E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
362 io::IReadFile* pixelShaderProgram = 0,
363 const c8* pixelShaderEntryPointName = "main",
364 E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
365 IShaderConstantSetCallBack* callback = 0,
366 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
367 s32 userData = 0,
368 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT)
369 {
370 return addHighLevelShaderMaterialFromFiles(
371 vertexShaderProgram, vertexShaderEntryPointName,
372 vsCompileTarget, pixelShaderProgram,
373 pixelShaderEntryPointName, psCompileTarget,
374 0, "main", EGST_GS_4_0,
375 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
376 callback, baseMaterial, userData, shadingLang);
377 }
378
379 //! Adds a new ASM shader material renderer to the VideoDriver
380 /** Note that it is a good idea to call IVideoDriver::queryFeature() in
381 advance to check if the IVideoDriver supports the vertex and/or pixel
382 shader version your are using.
383
384 The material is added to the VideoDriver like with
385 IVideoDriver::addMaterialRenderer() and can be used like it had been
386 added with that method.
387 \param vertexShaderProgram String containing the source of the vertex
388 shader program. This can be 0 if no vertex program shall be used.
389
390 For DX8 programs, the will always input registers look like this: v0:
391 position, v1: normal, v2: color, v3: texture cooridnates, v4: texture
392 coordinates 2 if available.
393
394 For DX9 programs, you can manually set the registers using the dcl_
395 statements.
396 \param pixelShaderProgram String containing the source of the pixel
397 shader program. This can be 0 if you don't want to use a pixel shader.
398 \param callback Pointer to an implementation of
399 IShaderConstantSetCallBack in which you can set the needed vertex and
400 pixel shader program constants. Set this to 0 if you don't need this.
401 \param baseMaterial Base material which renderstates will be used to
402 shade the material.
403 \param userData a user data int. This int can be set to any value and
404 will be set as parameter in the callback method when calling
405 OnSetConstants(). In this way it is easily possible to use the same
406 callback method for multiple materials and distinguish between them
407 during the call.
408 \return Returns the number of the material type which can be set in
409 SMaterial::MaterialType to use the renderer. -1 is returned if an
410 error occured. -1 is returned for example if a vertex or pixel shader
411 program could not be compiled, the error strings are then printed out
412 into the error log, and can be catched with a custom event receiver. */
413 virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0,
414 const c8* pixelShaderProgram = 0,
415 IShaderConstantSetCallBack* callback = 0,
416 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
417 s32 userData = 0) = 0;
418
419 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
420 /** \param vertexShaderProgram Text file containing the source of the
421 vertex shader program. Set to 0 if no shader shall be created.
422 \param pixelShaderProgram Text file containing the source of the pixel
423 shader program. Set to 0 if no shader shall be created.
424 \param callback Pointer to an IShaderConstantSetCallback object to
425 which the OnSetConstants function is called.
426 \param baseMaterial baseMaterial
427 \param userData a user data int. This int can be set to any value and
428 will be set as parameter in the callback method when calling
429 OnSetConstants(). In this way it is easily possible to use the same
430 callback method for multiple materials and distinguish between them
431 during the call.
432 \return Returns the number of the material type which can be set in
433 SMaterial::MaterialType to use the renderer. -1 is returned if an
434 error occured. -1 is returned for example if a vertex or pixel shader
435 program could not be compiled, the error strings are then printed out
436 into the error log, and can be catched with a custom event receiver. */
437 virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram,
438 io::IReadFile* pixelShaderProgram,
439 IShaderConstantSetCallBack* callback = 0,
440 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
441 s32 userData = 0) = 0;
442
443 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
444 /** \param vertexShaderProgramFileName Text file name containing the
445 source of the vertex shader program. Set to 0 if no shader shall be
446 created.
447 \param pixelShaderProgramFileName Text file name containing the source
448 of the pixel shader program. Set to 0 if no shader shall be created.
449 \param callback Pointer to an IShaderConstantSetCallback object on
450 which the OnSetConstants function is called.
451 \param baseMaterial baseMaterial
452 \param userData a user data int. This int can be set to any value and
453 will be set as parameter in the callback method when calling
454 OnSetConstants(). In this way it is easily possible to use the same
455 callback method for multiple materials and distinguish between them
456 during the call.
457 \return Returns the number of the material type which can be set in
458 SMaterial::MaterialType to use the renderer. -1 is returned if an
459 error occured. -1 is returned for example if a vertex or pixel shader
460 program could not be compiled, the error strings are then printed out
461 into the error log, and can be catched with a custom event receiver. */
462 virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
463 const io::path& pixelShaderProgramFileName,
464 IShaderConstantSetCallBack* callback = 0,
465 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
466 s32 userData = 0) = 0;
467};
468
469
470} // end namespace video
471} // end namespace irr
472
473#endif
474
diff --git a/src/others/irrlicht-1.8.1/include/IGUIButton.h b/src/others/irrlicht-1.8.1/include/IGUIButton.h
new file mode 100644
index 0000000..1da880e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIButton.h
@@ -0,0 +1,151 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_BUTTON_H_INCLUDED__
6#define __I_GUI_BUTTON_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12
13namespace video
14{
15 class ITexture;
16} // end namespace video
17
18namespace gui
19{
20 class IGUIFont;
21 class IGUISpriteBank;
22
23 enum EGUI_BUTTON_STATE
24 {
25 //! The button is not pressed
26 EGBS_BUTTON_UP=0,
27 //! The button is currently pressed down
28 EGBS_BUTTON_DOWN,
29 //! The mouse cursor is over the button
30 EGBS_BUTTON_MOUSE_OVER,
31 //! The mouse cursor is not over the button
32 EGBS_BUTTON_MOUSE_OFF,
33 //! The button has the focus
34 EGBS_BUTTON_FOCUSED,
35 //! The button doesn't have the focus
36 EGBS_BUTTON_NOT_FOCUSED,
37 //! not used, counts the number of enumerated items
38 EGBS_COUNT
39 };
40
41 //! Names for gui button state icons
42 const c8* const GUIButtonStateNames[] =
43 {
44 "buttonUp",
45 "buttonDown",
46 "buttonMouseOver",
47 "buttonMouseOff",
48 "buttonFocused",
49 "buttonNotFocused",
50 0,
51 0,
52 };
53
54 //! GUI Button interface.
55 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
56 \li EGET_BUTTON_CLICKED
57 */
58 class IGUIButton : public IGUIElement
59 {
60 public:
61
62 //! constructor
63 IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
64 : IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
65
66 //! Sets another skin independent font.
67 /** If this is set to zero, the button uses the font of the skin.
68 \param font: New font to set. */
69 virtual void setOverrideFont(IGUIFont* font=0) = 0;
70
71 //! Gets the override font (if any)
72 /** \return The override font (may be 0) */
73 virtual IGUIFont* getOverrideFont(void) const = 0;
74
75 //! Get the font which is used right now for drawing
76 /** Currently this is the override font when one is set and the
77 font of the active skin otherwise */
78 virtual IGUIFont* getActiveFont() const = 0;
79
80 //! Sets an image which should be displayed on the button when it is in normal state.
81 /** \param image: Image to be displayed */
82 virtual void setImage(video::ITexture* image=0) = 0;
83
84 //! Sets a background image for the button when it is in normal state.
85 /** \param image: Texture containing the image to be displayed
86 \param pos: Position in the texture, where the image is located */
87 virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
88
89 //! Sets a background image for the button when it is in pressed state.
90 /** If no images is specified for the pressed state via
91 setPressedImage(), this image is also drawn in pressed state.
92 \param image: Image to be displayed */
93 virtual void setPressedImage(video::ITexture* image=0) = 0;
94
95 //! Sets an image which should be displayed on the button when it is in pressed state.
96 /** \param image: Texture containing the image to be displayed
97 \param pos: Position in the texture, where the image is located */
98 virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
99
100 //! Sets the sprite bank used by the button
101 virtual void setSpriteBank(IGUISpriteBank* bank=0) = 0;
102
103 //! Sets the animated sprite for a specific button state
104 /** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
105 \param state: State of the button to set the sprite for
106 \param index: The sprite number from the current sprite bank
107 \param color: The color of the sprite
108 \param loop: True if the animation should loop, false if not
109 */
110 virtual void setSprite(EGUI_BUTTON_STATE state, s32 index,
111 video::SColor color=video::SColor(255,255,255,255), bool loop=false) = 0;
112
113 //! Sets if the button should behave like a push button.
114 /** Which means it can be in two states: Normal or Pressed. With a click on the button,
115 the user can change the state of the button. */
116 virtual void setIsPushButton(bool isPushButton=true) = 0;
117
118 //! Sets the pressed state of the button if this is a pushbutton
119 virtual void setPressed(bool pressed=true) = 0;
120
121 //! Returns if the button is currently pressed
122 virtual bool isPressed() const = 0;
123
124 //! Sets if the alpha channel should be used for drawing background images on the button (default is false)
125 virtual void setUseAlphaChannel(bool useAlphaChannel=true) = 0;
126
127 //! Returns if the alpha channel should be used for drawing background images on the button
128 virtual bool isAlphaChannelUsed() const = 0;
129
130 //! Returns whether the button is a push button
131 virtual bool isPushButton() const = 0;
132
133 //! Sets if the button should use the skin to draw its border and button face (default is true)
134 virtual void setDrawBorder(bool border=true) = 0;
135
136 //! Returns if the border and button face are being drawn using the skin
137 virtual bool isDrawingBorder() const = 0;
138
139 //! Sets if the button should scale the button images to fit
140 virtual void setScaleImage(bool scaleImage=true) = 0;
141
142 //! Checks whether the button scales the used images
143 virtual bool isScalingImage() const = 0;
144 };
145
146
147} // end namespace gui
148} // end namespace irr
149
150#endif
151
diff --git a/src/others/irrlicht-1.8.1/include/IGUICheckBox.h b/src/others/irrlicht-1.8.1/include/IGUICheckBox.h
new file mode 100644
index 0000000..5dec952
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUICheckBox.h
@@ -0,0 +1,38 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_CHECKBOX_H_INCLUDED__
6#define __I_GUI_CHECKBOX_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12namespace gui
13{
14
15 //! GUI Check box interface.
16 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
17 \li EGET_CHECKBOX_CHANGED
18 */
19 class IGUICheckBox : public IGUIElement
20 {
21 public:
22
23 //! constructor
24 IGUICheckBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
25 : IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {}
26
27 //! Set if box is checked.
28 virtual void setChecked(bool checked) = 0;
29
30 //! Returns true if box is checked.
31 virtual bool isChecked() const = 0;
32 };
33
34} // end namespace gui
35} // end namespace irr
36
37#endif
38
diff --git a/src/others/irrlicht-1.8.1/include/IGUIColorSelectDialog.h b/src/others/irrlicht-1.8.1/include/IGUIColorSelectDialog.h
new file mode 100644
index 0000000..3d0357b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIColorSelectDialog.h
@@ -0,0 +1,30 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_COLOR_SELECT_DIALOG_H_INCLUDED__
6#define __I_GUI_COLOR_SELECT_DIALOG_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12namespace gui
13{
14
15 //! Standard color chooser dialog.
16 class IGUIColorSelectDialog : public IGUIElement
17 {
18 public:
19
20 //! constructor
21 IGUIColorSelectDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
22 : IGUIElement(EGUIET_COLOR_SELECT_DIALOG, environment, parent, id, rectangle) {}
23 };
24
25
26} // end namespace gui
27} // end namespace irr
28
29#endif
30
diff --git a/src/others/irrlicht-1.8.1/include/IGUIComboBox.h b/src/others/irrlicht-1.8.1/include/IGUIComboBox.h
new file mode 100644
index 0000000..72c4187
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIComboBox.h
@@ -0,0 +1,74 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_COMBO_BOX_H_INCLUDED__
6#define __I_GUI_COMBO_BOX_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12namespace gui
13{
14
15 //! Combobox widget
16 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
17 \li EGET_COMBO_BOX_CHANGED
18 */
19 class IGUIComboBox : public IGUIElement
20 {
21 public:
22
23 //! constructor
24 IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
25 : IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {}
26
27 //! Returns amount of items in box
28 virtual u32 getItemCount() const = 0;
29
30 //! Returns string of an item. the idx may be a value from 0 to itemCount-1
31 virtual const wchar_t* getItem(u32 idx) const = 0;
32
33 //! Returns item data of an item. the idx may be a value from 0 to itemCount-1
34 virtual u32 getItemData(u32 idx) const = 0;
35
36 //! Returns index based on item data
37 virtual s32 getIndexForItemData(u32 data ) const = 0;
38
39 //! Adds an item and returns the index of it
40 virtual u32 addItem(const wchar_t* text, u32 data = 0) = 0;
41
42 //! Removes an item from the combo box.
43 /** Warning. This will change the index of all following items */
44 virtual void removeItem(u32 idx) = 0;
45
46 //! Deletes all items in the combo box
47 virtual void clear() = 0;
48
49 //! Returns id of selected item. returns -1 if no item is selected.
50 virtual s32 getSelected() const = 0;
51
52 //! Sets the selected item. Set this to -1 if no item should be selected
53 virtual void setSelected(s32 idx) = 0;
54
55 //! Sets text justification of the text area
56 /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
57 EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
58 \param vertical: EGUIA_UPPERLEFT to align with top edge,
59 EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
60 virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
61
62 //! Set the maximal number of rows for the selection listbox
63 virtual void setMaxSelectionRows(u32 max) = 0;
64
65 //! Get the maximimal number of rows for the selection listbox
66 virtual u32 getMaxSelectionRows() const = 0;
67 };
68
69
70} // end namespace gui
71} // end namespace irr
72
73#endif
74
diff --git a/src/others/irrlicht-1.8.1/include/IGUIContextMenu.h b/src/others/irrlicht-1.8.1/include/IGUIContextMenu.h
new file mode 100644
index 0000000..c9a0659
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIContextMenu.h
@@ -0,0 +1,162 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_CONTEXT_MENU_H_INCLUDED__
6#define __I_GUI_CONTEXT_MENU_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12namespace gui
13{
14 //! Close behavior.
15 //! Default is ECMC_REMOVE
16 enum ECONTEXT_MENU_CLOSE
17 {
18 //! do nothing - menu stays open
19 ECMC_IGNORE = 0,
20
21 //! remove the gui element
22 ECMC_REMOVE = 1,
23
24 //! call setVisible(false)
25 ECMC_HIDE = 2
26
27 // note to implementors - this is planned as bitset, so continue with 4 if you need to add further flags.
28 };
29
30 //! GUI Context menu interface.
31 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
32 \li EGET_ELEMENT_CLOSED
33 \li EGET_MENU_ITEM_SELECTED
34 */
35 class IGUIContextMenu : public IGUIElement
36 {
37 public:
38
39 //! constructor
40 IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
41 : IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
42
43 //! set behavior when menus are closed
44 virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0;
45
46 //! get current behavior when the menu will be closed
47 virtual ECONTEXT_MENU_CLOSE getCloseHandling() const = 0;
48
49 //! Get amount of menu items
50 virtual u32 getItemCount() const = 0;
51
52 //! Adds a menu item.
53 /** \param text: Text of menu item. Set this to 0 to create
54 an separator instead of a real item, which is the same like
55 calling addSeparator();
56 \param commandId: Command id of menu item, a simple id you may
57 set to whatever you want.
58 \param enabled: Specifies if the menu item should be enabled.
59 \param hasSubMenu: Set this to true if there should be a submenu
60 at this item. You can access this submenu via getSubMenu().
61 \param checked: Specifies if the menu item should be initially checked.
62 \param autoChecking: Specifies if the item should be checked by clicking
63 \return Returns the index of the new item */
64 virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
65 bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
66
67 //! Insert a menu item at specified position.
68 /** \param idx: Position to insert the new element,
69 should be smaller than itemcount otherwise the item is added to the end.
70 \param text: Text of menu item. Set this to 0 to create
71 an separator instead of a real item, which is the same like
72 calling addSeparator();
73 \param commandId: Command id of menu item, a simple id you may
74 set to whatever you want.
75 \param enabled: Specifies if the menu item should be enabled.
76 \param hasSubMenu: Set this to true if there should be a submenu
77 at this item. You can access this submenu via getSubMenu().
78 \param checked: Specifies if the menu item should be initially checked.
79 \param autoChecking: Specifies if the item should be checked by clicking
80 \return Returns the index of the new item */
81 virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId=-1, bool enabled=true,
82 bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
83
84 //! Find an item by it's CommandID
85 /**
86 \param commandId: We are looking for the first item which has this commandID
87 \param idxStartSearch: Start searching from this index.
88 \return Returns the index of the item when found or otherwise -1. */
89 virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const = 0;
90
91 //! Adds a separator item to the menu
92 virtual void addSeparator() = 0;
93
94 //! Get text of the menu item.
95 /** \param idx: Zero based index of the menu item */
96 virtual const wchar_t* getItemText(u32 idx) const = 0;
97
98 //! Sets text of the menu item.
99 /** \param idx: Zero based index of the menu item
100 \param text: New text of the item. */
101 virtual void setItemText(u32 idx, const wchar_t* text) = 0;
102
103 //! Check if a menu item is enabled
104 /** \param idx: Zero based index of the menu item */
105 virtual bool isItemEnabled(u32 idx) const = 0;
106
107 //! Sets if the menu item should be enabled.
108 /** \param idx: Zero based index of the menu item
109 \param enabled: True if it is enabled, otherwise false. */
110 virtual void setItemEnabled(u32 idx, bool enabled) = 0;
111
112 //! Sets if the menu item should be checked.
113 /** \param idx: Zero based index of the menu item
114 \param enabled: True if it is enabled, otherwise false. */
115 virtual void setItemChecked(u32 idx, bool enabled) = 0;
116
117 //! Check if a menu item is checked
118 /** \param idx: Zero based index of the menu item */
119 virtual bool isItemChecked(u32 idx) const = 0;
120
121 //! Removes a menu item
122 /** \param idx: Zero based index of the menu item */
123 virtual void removeItem(u32 idx) = 0;
124
125 //! Removes all menu items
126 virtual void removeAllItems() = 0;
127
128 //! Get the selected item in the menu
129 /** \return Index of the selected item, -1 if none selected. */
130 virtual s32 getSelectedItem() const = 0;
131
132 //! Get the command id of a menu item
133 /** \param idx: Zero based index of the menu item */
134 virtual s32 getItemCommandId(u32 idx) const = 0;
135
136 //! Sets the command id of a menu item
137 /** \param idx: Zero based index of the menu item
138 \param id: Command id of menu item, a simple id you may
139 set to whatever you want. */
140 virtual void setItemCommandId(u32 idx, s32 id) = 0;
141
142 //! Get a pointer to the submenu of an item.
143 /** 0 is returned if there is no submenu
144 \param idx: Zero based index of the menu item
145 \return Returns a pointer to the submenu of an item. */
146 virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0;
147
148 //! should the element change the checked status on clicking
149 virtual void setItemAutoChecking(u32 idx, bool autoChecking) = 0;
150
151 //! does the element change the checked status on clicking
152 virtual bool getItemAutoChecking(u32 idx) const = 0;
153
154 //! When an eventparent is set it receives events instead of the usual parent element
155 virtual void setEventParent(IGUIElement *parent) = 0;
156 };
157
158} // end namespace gui
159} // end namespace irr
160
161#endif
162
diff --git a/src/others/irrlicht-1.8.1/include/IGUIEditBox.h b/src/others/irrlicht-1.8.1/include/IGUIEditBox.h
new file mode 100644
index 0000000..e7b637e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIEditBox.h
@@ -0,0 +1,135 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_EDIT_BOX_H_INCLUDED__
6#define __I_GUI_EDIT_BOX_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "SColor.h"
10
11namespace irr
12{
13namespace gui
14{
15 class IGUIFont;
16
17 //! Single line edit box for editing simple text.
18 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
19 \li EGET_EDITBOX_ENTER
20 \li EGET_EDITBOX_CHANGED
21 \li EGET_EDITBOX_MARKING_CHANGED
22 */
23 class IGUIEditBox : public IGUIElement
24 {
25 public:
26
27 //! constructor
28 IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
29 : IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {}
30
31 //! Sets another skin independent font.
32 /** If this is set to zero, the button uses the font of the skin.
33 \param font: New font to set. */
34 virtual void setOverrideFont(IGUIFont* font=0) = 0;
35
36 //! Gets the override font (if any)
37 /** \return The override font (may be 0) */
38 virtual IGUIFont* getOverrideFont() const = 0;
39
40 //! Get the font which is used right now for drawing
41 /** Currently this is the override font when one is set and the
42 font of the active skin otherwise */
43 virtual IGUIFont* getActiveFont() const = 0;
44
45 //! Sets another color for the text.
46 /** If set, the edit box does not use the EGDC_BUTTON_TEXT color defined
47 in the skin, but the set color instead. You don't need to call
48 IGUIEditBox::enableOverrrideColor(true) after this, this is done
49 by this function.
50 If you set a color, and you want the text displayed with the color
51 of the skin again, call IGUIEditBox::enableOverrideColor(false);
52 \param color: New color of the text. */
53 virtual void setOverrideColor(video::SColor color) = 0;
54
55 //! Gets the override color
56 virtual video::SColor getOverrideColor() const = 0;
57
58 //! Sets if the text should use the override color or the color in the gui skin.
59 /** \param enable: If set to true, the override color, which can be set
60 with IGUIEditBox::setOverrideColor is used, otherwise the
61 EGDC_BUTTON_TEXT color of the skin. */
62 virtual void enableOverrideColor(bool enable) = 0;
63
64 //! Checks if an override color is enabled
65 /** \return true if the override color is enabled, false otherwise */
66 virtual bool isOverrideColorEnabled(void) const = 0;
67
68 //! Sets whether to draw the background
69 virtual void setDrawBackground(bool draw) = 0;
70
71 //! Turns the border on or off
72 /** \param border: true if you want the border to be drawn, false if not */
73 virtual void setDrawBorder(bool border) = 0;
74
75 //! Sets text justification mode
76 /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
77 EGUIA_LOWERRIGHT for right justified, or EGUIA_CENTER for centered text.
78 \param vertical: EGUIA_UPPERLEFT to align with top edge,
79 EGUIA_LOWERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
80 virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
81
82 //! Enables or disables word wrap.
83 /** \param enable: If set to true, words going over one line are
84 broken to the next line. */
85 virtual void setWordWrap(bool enable) = 0;
86
87 //! Checks if word wrap is enabled
88 /** \return true if word wrap is enabled, false otherwise */
89 virtual bool isWordWrapEnabled() const = 0;
90
91 //! Enables or disables newlines.
92 /** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired,
93 instead a newline character will be inserted. */
94 virtual void setMultiLine(bool enable) = 0;
95
96 //! Checks if multi line editing is enabled
97 /** \return true if multi-line is enabled, false otherwise */
98 virtual bool isMultiLineEnabled() const = 0;
99
100 //! Enables or disables automatic scrolling with cursor position
101 /** \param enable: If set to true, the text will move around with the cursor position */
102 virtual void setAutoScroll(bool enable) = 0;
103
104 //! Checks to see if automatic scrolling is enabled
105 /** \return true if automatic scrolling is enabled, false if not */
106 virtual bool isAutoScrollEnabled() const = 0;
107
108 //! Sets whether the edit box is a password box. Setting this to true will
109 /** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x
110 \param passwordBox: true to enable password, false to disable
111 \param passwordChar: the character that is displayed instead of letters */
112 virtual void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*') = 0;
113
114 //! Returns true if the edit box is currently a password box.
115 virtual bool isPasswordBox() const = 0;
116
117 //! Gets the size area of the text in the edit box
118 /** \return The size in pixels of the text */
119 virtual core::dimension2du getTextDimension() = 0;
120
121 //! Sets the maximum amount of characters which may be entered in the box.
122 /** \param max: Maximum amount of characters. If 0, the character amount is
123 infinity. */
124 virtual void setMax(u32 max) = 0;
125
126 //! Returns maximum amount of characters, previously set by setMax();
127 virtual u32 getMax() const = 0;
128 };
129
130
131} // end namespace gui
132} // end namespace irr
133
134#endif
135
diff --git a/src/others/irrlicht-1.8.1/include/IGUIElement.h b/src/others/irrlicht-1.8.1/include/IGUIElement.h
new file mode 100644
index 0000000..40df446
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIElement.h
@@ -0,0 +1,1037 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_ELEMENT_H_INCLUDED__
6#define __I_GUI_ELEMENT_H_INCLUDED__
7
8#include "IAttributeExchangingObject.h"
9#include "irrList.h"
10#include "rect.h"
11#include "irrString.h"
12#include "IEventReceiver.h"
13#include "EGUIElementTypes.h"
14#include "EGUIAlignment.h"
15#include "IAttributes.h"
16
17namespace irr
18{
19namespace gui
20{
21
22class IGUIEnvironment;
23
24//! Base class of all GUI elements.
25class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver
26{
27public:
28
29 //! Constructor
30 IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment* environment, IGUIElement* parent,
31 s32 id, const core::rect<s32>& rectangle)
32 : Parent(0), RelativeRect(rectangle), AbsoluteRect(rectangle),
33 AbsoluteClippingRect(rectangle), DesiredRect(rectangle),
34 MaxSize(0,0), MinSize(1,1), IsVisible(true), IsEnabled(true),
35 IsSubElement(false), NoClip(false), ID(id), IsTabStop(false), TabOrder(-1), IsTabGroup(false),
36 AlignLeft(EGUIA_UPPERLEFT), AlignRight(EGUIA_UPPERLEFT), AlignTop(EGUIA_UPPERLEFT), AlignBottom(EGUIA_UPPERLEFT),
37 Environment(environment), Type(type)
38 {
39 #ifdef _DEBUG
40 setDebugName("IGUIElement");
41 #endif
42
43 // if we were given a parent to attach to
44 if (parent)
45 {
46 parent->addChildToEnd(this);
47 recalculateAbsolutePosition(true);
48 }
49 }
50
51
52 //! Destructor
53 virtual ~IGUIElement()
54 {
55 // delete all children
56 core::list<IGUIElement*>::Iterator it = Children.begin();
57 for (; it != Children.end(); ++it)
58 {
59 (*it)->Parent = 0;
60 (*it)->drop();
61 }
62 }
63
64
65 //! Returns parent of this element.
66 IGUIElement* getParent() const
67 {
68 return Parent;
69 }
70
71
72 //! Returns the relative rectangle of this element.
73 core::rect<s32> getRelativePosition() const
74 {
75 return RelativeRect;
76 }
77
78
79 //! Sets the relative rectangle of this element.
80 /** \param r The absolute position to set */
81 void setRelativePosition(const core::rect<s32>& r)
82 {
83 if (Parent)
84 {
85 const core::rect<s32>& r2 = Parent->getAbsolutePosition();
86
87 core::dimension2df d((f32)(r2.getSize().Width), (f32)(r2.getSize().Height));
88
89 if (AlignLeft == EGUIA_SCALE)
90 ScaleRect.UpperLeftCorner.X = (f32)r.UpperLeftCorner.X / d.Width;
91 if (AlignRight == EGUIA_SCALE)
92 ScaleRect.LowerRightCorner.X = (f32)r.LowerRightCorner.X / d.Width;
93 if (AlignTop == EGUIA_SCALE)
94 ScaleRect.UpperLeftCorner.Y = (f32)r.UpperLeftCorner.Y / d.Height;
95 if (AlignBottom == EGUIA_SCALE)
96 ScaleRect.LowerRightCorner.Y = (f32)r.LowerRightCorner.Y / d.Height;
97 }
98
99 DesiredRect = r;
100 updateAbsolutePosition();
101 }
102
103 //! Sets the relative rectangle of this element, maintaining its current width and height
104 /** \param position The new relative position to set. Width and height will not be changed. */
105 void setRelativePosition(const core::position2di & position)
106 {
107 const core::dimension2di mySize = RelativeRect.getSize();
108 const core::rect<s32> rectangle(position.X, position.Y,
109 position.X + mySize.Width, position.Y + mySize.Height);
110 setRelativePosition(rectangle);
111 }
112
113
114 //! Sets the relative rectangle of this element as a proportion of its parent's area.
115 /** \note This method used to be 'void setRelativePosition(const core::rect<f32>& r)'
116 \param r The rectangle to set, interpreted as a proportion of the parent's area.
117 Meaningful values are in the range [0...1], unless you intend this element to spill
118 outside its parent. */
119 void setRelativePositionProportional(const core::rect<f32>& r)
120 {
121 if (!Parent)
122 return;
123
124 const core::dimension2di& d = Parent->getAbsolutePosition().getSize();
125
126 DesiredRect = core::rect<s32>(
127 core::floor32((f32)d.Width * r.UpperLeftCorner.X),
128 core::floor32((f32)d.Height * r.UpperLeftCorner.Y),
129 core::floor32((f32)d.Width * r.LowerRightCorner.X),
130 core::floor32((f32)d.Height * r.LowerRightCorner.Y));
131
132 ScaleRect = r;
133
134 updateAbsolutePosition();
135 }
136
137
138 //! Gets the absolute rectangle of this element
139 core::rect<s32> getAbsolutePosition() const
140 {
141 return AbsoluteRect;
142 }
143
144
145 //! Returns the visible area of the element.
146 core::rect<s32> getAbsoluteClippingRect() const
147 {
148 return AbsoluteClippingRect;
149 }
150
151
152 //! Sets whether the element will ignore its parent's clipping rectangle
153 /** \param noClip If true, the element will not be clipped by its parent's clipping rectangle. */
154 void setNotClipped(bool noClip)
155 {
156 NoClip = noClip;
157 updateAbsolutePosition();
158 }
159
160
161 //! Gets whether the element will ignore its parent's clipping rectangle
162 /** \return true if the element is not clipped by its parent's clipping rectangle. */
163 bool isNotClipped() const
164 {
165 return NoClip;
166 }
167
168
169 //! Sets the maximum size allowed for this element
170 /** If set to 0,0, there is no maximum size */
171 void setMaxSize(core::dimension2du size)
172 {
173 MaxSize = size;
174 updateAbsolutePosition();
175 }
176
177
178 //! Sets the minimum size allowed for this element
179 void setMinSize(core::dimension2du size)
180 {
181 MinSize = size;
182 if (MinSize.Width < 1)
183 MinSize.Width = 1;
184 if (MinSize.Height < 1)
185 MinSize.Height = 1;
186 updateAbsolutePosition();
187 }
188
189
190 //! The alignment defines how the borders of this element will be positioned when the parent element is resized.
191 void setAlignment(EGUI_ALIGNMENT left, EGUI_ALIGNMENT right, EGUI_ALIGNMENT top, EGUI_ALIGNMENT bottom)
192 {
193 AlignLeft = left;
194 AlignRight = right;
195 AlignTop = top;
196 AlignBottom = bottom;
197
198 if (Parent)
199 {
200 core::rect<s32> r(Parent->getAbsolutePosition());
201
202 core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
203
204 if (AlignLeft == EGUIA_SCALE)
205 ScaleRect.UpperLeftCorner.X = (f32)DesiredRect.UpperLeftCorner.X / d.Width;
206 if (AlignRight == EGUIA_SCALE)
207 ScaleRect.LowerRightCorner.X = (f32)DesiredRect.LowerRightCorner.X / d.Width;
208 if (AlignTop == EGUIA_SCALE)
209 ScaleRect.UpperLeftCorner.Y = (f32)DesiredRect.UpperLeftCorner.Y / d.Height;
210 if (AlignBottom == EGUIA_SCALE)
211 ScaleRect.LowerRightCorner.Y = (f32)DesiredRect.LowerRightCorner.Y / d.Height;
212 }
213 }
214
215
216 //! Updates the absolute position.
217 virtual void updateAbsolutePosition()
218 {
219 recalculateAbsolutePosition(false);
220
221 // update all children
222 core::list<IGUIElement*>::Iterator it = Children.begin();
223 for (; it != Children.end(); ++it)
224 {
225 (*it)->updateAbsolutePosition();
226 }
227 }
228
229
230 //! Returns the topmost GUI element at the specific position.
231 /**
232 This will check this GUI element and all of its descendants, so it
233 may return this GUI element. To check all GUI elements, call this
234 function on device->getGUIEnvironment()->getRootGUIElement(). Note
235 that the root element is the size of the screen, so doing so (with
236 an on-screen point) will always return the root element if no other
237 element is above it at that point.
238 \param point: The point at which to find a GUI element.
239 \return The topmost GUI element at that point, or 0 if there are
240 no candidate elements at this point.
241 */
242 IGUIElement* getElementFromPoint(const core::position2d<s32>& point)
243 {
244 IGUIElement* target = 0;
245
246 // we have to search from back to front, because later children
247 // might be drawn over the top of earlier ones.
248
249 core::list<IGUIElement*>::Iterator it = Children.getLast();
250
251 if (isVisible())
252 {
253 while(it != Children.end())
254 {
255 target = (*it)->getElementFromPoint(point);
256 if (target)
257 return target;
258
259 --it;
260 }
261 }
262
263 if (isVisible() && isPointInside(point))
264 target = this;
265
266 return target;
267 }
268
269
270 //! Returns true if a point is within this element.
271 /** Elements with a shape other than a rectangle should override this method */
272 virtual bool isPointInside(const core::position2d<s32>& point) const
273 {
274 return AbsoluteClippingRect.isPointInside(point);
275 }
276
277
278 //! Adds a GUI element as new child of this element.
279 virtual void addChild(IGUIElement* child)
280 {
281 addChildToEnd(child);
282 if (child)
283 {
284 child->updateAbsolutePosition();
285 }
286 }
287
288 //! Removes a child.
289 virtual void removeChild(IGUIElement* child)
290 {
291 core::list<IGUIElement*>::Iterator it = Children.begin();
292 for (; it != Children.end(); ++it)
293 if ((*it) == child)
294 {
295 (*it)->Parent = 0;
296 (*it)->drop();
297 Children.erase(it);
298 return;
299 }
300 }
301
302
303 //! Removes this element from its parent.
304 virtual void remove()
305 {
306 if (Parent)
307 Parent->removeChild(this);
308 }
309
310
311 //! Draws the element and its children.
312 virtual void draw()
313 {
314 if ( isVisible() )
315 {
316 core::list<IGUIElement*>::Iterator it = Children.begin();
317 for (; it != Children.end(); ++it)
318 (*it)->draw();
319 }
320 }
321
322
323 //! animate the element and its children.
324 virtual void OnPostRender(u32 timeMs)
325 {
326 if ( isVisible() )
327 {
328 core::list<IGUIElement*>::Iterator it = Children.begin();
329 for (; it != Children.end(); ++it)
330 (*it)->OnPostRender( timeMs );
331 }
332 }
333
334
335 //! Moves this element.
336 virtual void move(core::position2d<s32> absoluteMovement)
337 {
338 setRelativePosition(DesiredRect + absoluteMovement);
339 }
340
341
342 //! Returns true if element is visible.
343 virtual bool isVisible() const
344 {
345 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
346 return IsVisible;
347 }
348
349
350 //! Sets the visible state of this element.
351 virtual void setVisible(bool visible)
352 {
353 IsVisible = visible;
354 }
355
356
357 //! Returns true if this element was created as part of its parent control
358 virtual bool isSubElement() const
359 {
360 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
361 return IsSubElement;
362 }
363
364
365 //! Sets whether this control was created as part of its parent.
366 /** For example, it is true when a scrollbar is part of a listbox.
367 SubElements are not saved to disk when calling guiEnvironment->saveGUI() */
368 virtual void setSubElement(bool subElement)
369 {
370 IsSubElement = subElement;
371 }
372
373
374 //! If set to true, the focus will visit this element when using the tab key to cycle through elements.
375 /** If this element is a tab group (see isTabGroup/setTabGroup) then
376 ctrl+tab will be used instead. */
377 void setTabStop(bool enable)
378 {
379 IsTabStop = enable;
380 }
381
382
383 //! Returns true if this element can be focused by navigating with the tab key
384 bool isTabStop() const
385 {
386 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
387 return IsTabStop;
388 }
389
390
391 //! Sets the priority of focus when using the tab key to navigate between a group of elements.
392 /** See setTabGroup, isTabGroup and getTabGroup for information on tab groups.
393 Elements with a lower number are focused first */
394 void setTabOrder(s32 index)
395 {
396 // negative = autonumber
397 if (index < 0)
398 {
399 TabOrder = 0;
400 IGUIElement *el = getTabGroup();
401 while (IsTabGroup && el && el->Parent)
402 el = el->Parent;
403
404 IGUIElement *first=0, *closest=0;
405 if (el)
406 {
407 // find the highest element number
408 el->getNextElement(-1, true, IsTabGroup, first, closest, true);
409 if (first)
410 {
411 TabOrder = first->getTabOrder() + 1;
412 }
413 }
414
415 }
416 else
417 TabOrder = index;
418 }
419
420
421 //! Returns the number in the tab order sequence
422 s32 getTabOrder() const
423 {
424 return TabOrder;
425 }
426
427
428 //! Sets whether this element is a container for a group of elements which can be navigated using the tab key.
429 /** For example, windows are tab groups.
430 Groups can be navigated using ctrl+tab, providing isTabStop is true. */
431 void setTabGroup(bool isGroup)
432 {
433 IsTabGroup = isGroup;
434 }
435
436
437 //! Returns true if this element is a tab group.
438 bool isTabGroup() const
439 {
440 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
441 return IsTabGroup;
442 }
443
444
445 //! Returns the container element which holds all elements in this element's tab group.
446 IGUIElement* getTabGroup()
447 {
448 IGUIElement *ret=this;
449
450 while (ret && !ret->isTabGroup())
451 ret = ret->getParent();
452
453 return ret;
454 }
455
456
457 //! Returns true if element is enabled
458 /** Currently elements do _not_ care about parent-states.
459 So if you want to affect childs you have to enable/disable them all.
460 The only exception to this are sub-elements which also check their parent.
461 */
462 virtual bool isEnabled() const
463 {
464 if ( isSubElement() && IsEnabled && getParent() )
465 return getParent()->isEnabled();
466
467 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
468 return IsEnabled;
469 }
470
471
472 //! Sets the enabled state of this element.
473 virtual void setEnabled(bool enabled)
474 {
475 IsEnabled = enabled;
476 }
477
478
479 //! Sets the new caption of this element.
480 virtual void setText(const wchar_t* text)
481 {
482 Text = text;
483 }
484
485
486 //! Returns caption of this element.
487 virtual const wchar_t* getText() const
488 {
489 return Text.c_str();
490 }
491
492
493 //! Sets the new caption of this element.
494 virtual void setToolTipText(const wchar_t* text)
495 {
496 ToolTipText = text;
497 }
498
499
500 //! Returns caption of this element.
501 virtual const core::stringw& getToolTipText() const
502 {
503 return ToolTipText;
504 }
505
506
507 //! Returns id. Can be used to identify the element.
508 virtual s32 getID() const
509 {
510 return ID;
511 }
512
513
514 //! Sets the id of this element
515 virtual void setID(s32 id)
516 {
517 ID = id;
518 }
519
520
521 //! Called if an event happened.
522 virtual bool OnEvent(const SEvent& event)
523 {
524 return Parent ? Parent->OnEvent(event) : false;
525 }
526
527
528 //! Brings a child to front
529 /** \return True if successful, false if not. */
530 virtual bool bringToFront(IGUIElement* element)
531 {
532 core::list<IGUIElement*>::Iterator it = Children.begin();
533 for (; it != Children.end(); ++it)
534 {
535 if (element == (*it))
536 {
537 Children.erase(it);
538 Children.push_back(element);
539 return true;
540 }
541 }
542
543 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
544 return false;
545 }
546
547
548 //! Moves a child to the back, so it's siblings are drawn on top of it
549 /** \return True if successful, false if not. */
550 virtual bool sendToBack(IGUIElement* child)
551 {
552 core::list<IGUIElement*>::Iterator it = Children.begin();
553 if (child == (*it)) // already there
554 return true;
555 for (; it != Children.end(); ++it)
556 {
557 if (child == (*it))
558 {
559 Children.erase(it);
560 Children.push_front(child);
561 return true;
562 }
563 }
564
565 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
566 return false;
567 }
568
569 //! Returns list with children of this element
570 virtual const core::list<IGUIElement*>& getChildren() const
571 {
572 return Children;
573 }
574
575
576 //! Finds the first element with the given id.
577 /** \param id: Id to search for.
578 \param searchchildren: Set this to true, if also children of this
579 element may contain the element with the searched id and they
580 should be searched too.
581 \return Returns the first element with the given id. If no element
582 with this id was found, 0 is returned. */
583 virtual IGUIElement* getElementFromId(s32 id, bool searchchildren=false) const
584 {
585 IGUIElement* e = 0;
586
587 core::list<IGUIElement*>::ConstIterator it = Children.begin();
588 for (; it != Children.end(); ++it)
589 {
590 if ((*it)->getID() == id)
591 return (*it);
592
593 if (searchchildren)
594 e = (*it)->getElementFromId(id, true);
595
596 if (e)
597 return e;
598 }
599
600 return e;
601 }
602
603
604 //! returns true if the given element is a child of this one.
605 //! \param child: The child element to check
606 bool isMyChild(IGUIElement* child) const
607 {
608 if (!child)
609 return false;
610 do
611 {
612 if (child->Parent)
613 child = child->Parent;
614
615 } while (child->Parent && child != this);
616
617 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
618 return child == this;
619 }
620
621
622 //! searches elements to find the closest next element to tab to
623 /** \param startOrder: The TabOrder of the current element, -1 if none
624 \param reverse: true if searching for a lower number
625 \param group: true if searching for a higher one
626 \param first: element with the highest/lowest known tab order depending on search direction
627 \param closest: the closest match, depending on tab order and direction
628 \param includeInvisible: includes invisible elements in the search (default=false)
629 \return true if successfully found an element, false to continue searching/fail */
630 bool getNextElement(s32 startOrder, bool reverse, bool group,
631 IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const
632 {
633 // we'll stop searching if we find this number
634 s32 wanted = startOrder + ( reverse ? -1 : 1 );
635 if (wanted==-2)
636 wanted = 1073741824; // maximum s32
637
638 core::list<IGUIElement*>::ConstIterator it = Children.begin();
639
640 s32 closestOrder, currentOrder;
641
642 while(it != Children.end())
643 {
644 // ignore invisible elements and their children
645 if ( ( (*it)->isVisible() || includeInvisible ) &&
646 (group == true || (*it)->isTabGroup() == false) )
647 {
648 // only check tab stops and those with the same group status
649 if ((*it)->isTabStop() && ((*it)->isTabGroup() == group))
650 {
651 currentOrder = (*it)->getTabOrder();
652
653 // is this what we're looking for?
654 if (currentOrder == wanted)
655 {
656 closest = *it;
657 return true;
658 }
659
660 // is it closer than the current closest?
661 if (closest)
662 {
663 closestOrder = closest->getTabOrder();
664 if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
665 ||(!reverse && currentOrder < closestOrder && currentOrder > startOrder))
666 {
667 closest = *it;
668 }
669 }
670 else
671 if ( (reverse && currentOrder < startOrder) || (!reverse && currentOrder > startOrder) )
672 {
673 closest = *it;
674 }
675
676 // is it before the current first?
677 if (first)
678 {
679 closestOrder = first->getTabOrder();
680
681 if ( (reverse && closestOrder < currentOrder) || (!reverse && closestOrder > currentOrder) )
682 {
683 first = *it;
684 }
685 }
686 else
687 {
688 first = *it;
689 }
690 }
691 // search within children
692 if ((*it)->getNextElement(startOrder, reverse, group, first, closest))
693 {
694 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
695 return true;
696 }
697 }
698 ++it;
699 }
700 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
701 return false;
702 }
703
704
705 //! Returns the type of the gui element.
706 /** This is needed for the .NET wrapper but will be used
707 later for serializing and deserializing.
708 If you wrote your own GUIElements, you need to set the type for your element as first parameter
709 in the constructor of IGUIElement. For own (=unknown) elements, simply use EGUIET_ELEMENT as type */
710 EGUI_ELEMENT_TYPE getType() const
711 {
712 return Type;
713 }
714
715 //! Returns true if the gui element supports the given type.
716 /** This is mostly used to check if you can cast a gui element to the class that goes with the type.
717 Most gui elements will only support their own type, but if you derive your own classes from interfaces
718 you can overload this function and add a check for the type of the base-class additionally.
719 This allows for checks comparable to the dynamic_cast of c++ with enabled rtti.
720 Note that you can't do that by calling BaseClass::hasType(type), but you have to do an explicit
721 comparison check, because otherwise the base class usually just checks for the membervariable
722 Type which contains the type of your derived class.
723 */
724 virtual bool hasType(EGUI_ELEMENT_TYPE type) const
725 {
726 return type == Type;
727 }
728
729
730 //! Returns the type name of the gui element.
731 /** This is needed serializing elements. For serializing your own elements, override this function
732 and return your own type name which is created by your IGUIElementFactory */
733 virtual const c8* getTypeName() const
734 {
735 return GUIElementTypeNames[Type];
736 }
737
738 //! Returns the name of the element.
739 /** \return Name as character string. */
740 virtual const c8* getName() const
741 {
742 return Name.c_str();
743 }
744
745
746 //! Sets the name of the element.
747 /** \param name New name of the gui element. */
748 virtual void setName(const c8* name)
749 {
750 Name = name;
751 }
752
753
754 //! Sets the name of the element.
755 /** \param name New name of the gui element. */
756 virtual void setName(const core::stringc& name)
757 {
758 Name = name;
759 }
760
761
762 //! Writes attributes of the scene node.
763 /** Implement this to expose the attributes of your scene node for
764 scripting languages, editors, debuggers or xml serialization purposes. */
765 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
766 {
767 out->addString("Name", Name.c_str());
768 out->addInt("Id", ID );
769 out->addString("Caption", getText());
770 out->addRect("Rect", DesiredRect);
771 out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
772 out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
773 out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames);
774 out->addEnum("RightAlign", AlignRight, GUIAlignmentNames);
775 out->addEnum("TopAlign", AlignTop, GUIAlignmentNames);
776 out->addEnum("BottomAlign", AlignBottom, GUIAlignmentNames);
777 out->addBool("Visible", IsVisible);
778 out->addBool("Enabled", IsEnabled);
779 out->addBool("TabStop", IsTabStop);
780 out->addBool("TabGroup", IsTabGroup);
781 out->addInt("TabOrder", TabOrder);
782 out->addBool("NoClip", NoClip);
783 }
784
785
786 //! Reads attributes of the scene node.
787 /** Implement this to set the attributes of your scene node for
788 scripting languages, editors, debuggers or xml deserialization purposes. */
789 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
790 {
791 setName(in->getAttributeAsString("Name"));
792 setID(in->getAttributeAsInt("Id"));
793 setText(in->getAttributeAsStringW("Caption").c_str());
794 setVisible(in->getAttributeAsBool("Visible"));
795 setEnabled(in->getAttributeAsBool("Enabled"));
796 IsTabStop = in->getAttributeAsBool("TabStop");
797 IsTabGroup = in->getAttributeAsBool("TabGroup");
798 TabOrder = in->getAttributeAsInt("TabOrder");
799
800 core::position2di p = in->getAttributeAsPosition2d("MaxSize");
801 setMaxSize(core::dimension2du(p.X,p.Y));
802
803 p = in->getAttributeAsPosition2d("MinSize");
804 setMinSize(core::dimension2du(p.X,p.Y));
805
806 setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames),
807 (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames),
808 (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames),
809 (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames));
810
811 setRelativePosition(in->getAttributeAsRect("Rect"));
812
813 setNotClipped(in->getAttributeAsBool("NoClip"));
814 }
815
816protected:
817 // not virtual because needed in constructor
818 void addChildToEnd(IGUIElement* child)
819 {
820 if (child)
821 {
822 child->grab(); // prevent destruction when removed
823 child->remove(); // remove from old parent
824 child->LastParentRect = getAbsolutePosition();
825 child->Parent = this;
826 Children.push_back(child);
827 }
828 }
829
830 // not virtual because needed in constructor
831 void recalculateAbsolutePosition(bool recursive)
832 {
833 core::rect<s32> parentAbsolute(0,0,0,0);
834 core::rect<s32> parentAbsoluteClip;
835 f32 fw=0.f, fh=0.f;
836
837 if (Parent)
838 {
839 parentAbsolute = Parent->AbsoluteRect;
840
841 if (NoClip)
842 {
843 IGUIElement* p=this;
844 while (p && p->Parent)
845 p = p->Parent;
846 parentAbsoluteClip = p->AbsoluteClippingRect;
847 }
848 else
849 parentAbsoluteClip = Parent->AbsoluteClippingRect;
850 }
851
852 const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
853 const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
854
855 if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
856 fw = (f32)parentAbsolute.getWidth();
857
858 if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
859 fh = (f32)parentAbsolute.getHeight();
860
861 switch (AlignLeft)
862 {
863 case EGUIA_UPPERLEFT:
864 break;
865 case EGUIA_LOWERRIGHT:
866 DesiredRect.UpperLeftCorner.X += diffx;
867 break;
868 case EGUIA_CENTER:
869 DesiredRect.UpperLeftCorner.X += diffx/2;
870 break;
871 case EGUIA_SCALE:
872 DesiredRect.UpperLeftCorner.X = core::round32(ScaleRect.UpperLeftCorner.X * fw);
873 break;
874 }
875
876 switch (AlignRight)
877 {
878 case EGUIA_UPPERLEFT:
879 break;
880 case EGUIA_LOWERRIGHT:
881 DesiredRect.LowerRightCorner.X += diffx;
882 break;
883 case EGUIA_CENTER:
884 DesiredRect.LowerRightCorner.X += diffx/2;
885 break;
886 case EGUIA_SCALE:
887 DesiredRect.LowerRightCorner.X = core::round32(ScaleRect.LowerRightCorner.X * fw);
888 break;
889 }
890
891 switch (AlignTop)
892 {
893 case EGUIA_UPPERLEFT:
894 break;
895 case EGUIA_LOWERRIGHT:
896 DesiredRect.UpperLeftCorner.Y += diffy;
897 break;
898 case EGUIA_CENTER:
899 DesiredRect.UpperLeftCorner.Y += diffy/2;
900 break;
901 case EGUIA_SCALE:
902 DesiredRect.UpperLeftCorner.Y = core::round32(ScaleRect.UpperLeftCorner.Y * fh);
903 break;
904 }
905
906 switch (AlignBottom)
907 {
908 case EGUIA_UPPERLEFT:
909 break;
910 case EGUIA_LOWERRIGHT:
911 DesiredRect.LowerRightCorner.Y += diffy;
912 break;
913 case EGUIA_CENTER:
914 DesiredRect.LowerRightCorner.Y += diffy/2;
915 break;
916 case EGUIA_SCALE:
917 DesiredRect.LowerRightCorner.Y = core::round32(ScaleRect.LowerRightCorner.Y * fh);
918 break;
919 }
920
921 RelativeRect = DesiredRect;
922
923 const s32 w = RelativeRect.getWidth();
924 const s32 h = RelativeRect.getHeight();
925
926 // make sure the desired rectangle is allowed
927 if (w < (s32)MinSize.Width)
928 RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MinSize.Width;
929 if (h < (s32)MinSize.Height)
930 RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MinSize.Height;
931 if (MaxSize.Width && w > (s32)MaxSize.Width)
932 RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MaxSize.Width;
933 if (MaxSize.Height && h > (s32)MaxSize.Height)
934 RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height;
935
936 RelativeRect.repair();
937
938 AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
939
940 if (!Parent)
941 parentAbsoluteClip = AbsoluteRect;
942
943 AbsoluteClippingRect = AbsoluteRect;
944 AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
945
946 LastParentRect = parentAbsolute;
947
948 if ( recursive )
949 {
950 // update all children
951 core::list<IGUIElement*>::Iterator it = Children.begin();
952 for (; it != Children.end(); ++it)
953 {
954 (*it)->recalculateAbsolutePosition(recursive);
955 }
956 }
957 }
958
959protected:
960
961 //! List of all children of this element
962 core::list<IGUIElement*> Children;
963
964 //! Pointer to the parent
965 IGUIElement* Parent;
966
967 //! relative rect of element
968 core::rect<s32> RelativeRect;
969
970 //! absolute rect of element
971 core::rect<s32> AbsoluteRect;
972
973 //! absolute clipping rect of element
974 core::rect<s32> AbsoluteClippingRect;
975
976 //! the rectangle the element would prefer to be,
977 //! if it was not constrained by parent or max/min size
978 core::rect<s32> DesiredRect;
979
980 //! for calculating the difference when resizing parent
981 core::rect<s32> LastParentRect;
982
983 //! relative scale of the element inside its parent
984 core::rect<f32> ScaleRect;
985
986 //! maximum and minimum size of the element
987 core::dimension2du MaxSize, MinSize;
988
989 //! is visible?
990 bool IsVisible;
991
992 //! is enabled?
993 bool IsEnabled;
994
995 //! is a part of a larger whole and should not be serialized?
996 bool IsSubElement;
997
998 //! does this element ignore its parent's clipping rectangle?
999 bool NoClip;
1000
1001 //! caption
1002 core::stringw Text;
1003
1004 //! tooltip
1005 core::stringw ToolTipText;
1006
1007 //! users can set this for identificating the element by string
1008 core::stringc Name;
1009
1010 //! users can set this for identificating the element by integer
1011 s32 ID;
1012
1013 //! tab stop like in windows
1014 bool IsTabStop;
1015
1016 //! tab order
1017 s32 TabOrder;
1018
1019 //! tab groups are containers like windows, use ctrl+tab to navigate
1020 bool IsTabGroup;
1021
1022 //! tells the element how to act when its parent is resized
1023 EGUI_ALIGNMENT AlignLeft, AlignRight, AlignTop, AlignBottom;
1024
1025 //! GUI Environment
1026 IGUIEnvironment* Environment;
1027
1028 //! type of element
1029 EGUI_ELEMENT_TYPE Type;
1030};
1031
1032
1033} // end namespace gui
1034} // end namespace irr
1035
1036#endif
1037
diff --git a/src/others/irrlicht-1.8.1/include/IGUIElementFactory.h b/src/others/irrlicht-1.8.1/include/IGUIElementFactory.h
new file mode 100644
index 0000000..348038a
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIElementFactory.h
@@ -0,0 +1,66 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_ELEMENT_FACTORY_H_INCLUDED__
6#define __I_GUI_ELEMENT_FACTORY_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "EGUIElementTypes.h"
10
11namespace irr
12{
13
14namespace gui
15{
16 class IGUIElement;
17
18 //! Interface making it possible to dynamically create GUI elements
19 /** To be able to add custom elements to Irrlicht and to make it possible for the
20 scene manager to save and load them, simply implement this interface and register it
21 in your gui environment via IGUIEnvironment::registerGUIElementFactory.
22 Note: When implementing your own element factory, don't call IGUIEnvironment::grab() to
23 increase the reference counter of the environment. This is not necessary because the
24 it will grab() the factory anyway, and otherwise cyclic references will be created.
25 */
26 class IGUIElementFactory : public virtual IReferenceCounted
27 {
28 public:
29
30 //! adds an element to the gui environment based on its type id
31 /** \param type: Type of the element to add.
32 \param parent: Parent scene node of the new element, can be null to add to the root.
33 \return Pointer to the new element or null if not successful. */
34 virtual IGUIElement* addGUIElement(EGUI_ELEMENT_TYPE type, IGUIElement* parent=0) = 0;
35
36 //! adds a GUI element to the GUI Environment based on its type name
37 /** \param typeName: Type name of the element to add.
38 \param parent: Parent scene node of the new element, can be null to add it to the root.
39 \return Pointer to the new element or null if not successful. */
40 virtual IGUIElement* addGUIElement(const c8* typeName, IGUIElement* parent=0) = 0;
41
42 //! Get amount of GUI element types this factory is able to create
43 virtual s32 getCreatableGUIElementTypeCount() const = 0;
44
45 //! Get type of a createable element type
46 /** \param idx: Index of the element type in this factory. Must be a value between 0 and
47 getCreatableGUIElementTypeCount() */
48 virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) const = 0;
49
50 //! Get type name of a createable GUI element type by index
51 /** \param idx: Index of the type in this factory. Must be a value between 0 and
52 getCreatableGUIElementTypeCount() */
53 virtual const c8* getCreateableGUIElementTypeName(s32 idx) const = 0;
54
55 //! returns type name of a createable GUI element
56 /** \param type: Type of GUI element.
57 \return Name of the type if this factory can create the type, otherwise 0. */
58 virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const = 0;
59 };
60
61
62} // end namespace gui
63} // end namespace irr
64
65#endif // __I_GUI_ELEMENT_FACTORY_H_INCLUDED__
66
diff --git a/src/others/irrlicht-1.8.1/include/IGUIEnvironment.h b/src/others/irrlicht-1.8.1/include/IGUIEnvironment.h
new file mode 100644
index 0000000..0291107
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIEnvironment.h
@@ -0,0 +1,620 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_ENVIRONMENT_H_INCLUDED__
6#define __I_GUI_ENVIRONMENT_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "IGUISkin.h"
10#include "rect.h"
11#include "EMessageBoxFlags.h"
12#include "IEventReceiver.h"
13#include "IXMLReader.h"
14#include "path.h"
15
16namespace irr
17{
18 class IOSOperator;
19 class IEventReceiver;
20
21 namespace io
22 {
23 class IXMLWriter;
24 class IReadFile;
25 class IWriteFile;
26 class IFileSystem;
27 } // end namespace io
28 namespace video
29 {
30 class IVideoDriver;
31 class ITexture;
32 } // end namespace video
33
34namespace gui
35{
36
37class IGUIElement;
38class IGUIFont;
39class IGUISpriteBank;
40class IGUIScrollBar;
41class IGUIImage;
42class IGUIMeshViewer;
43class IGUICheckBox;
44class IGUIListBox;
45class IGUITreeView;
46class IGUIImageList;
47class IGUIFileOpenDialog;
48class IGUIColorSelectDialog;
49class IGUIInOutFader;
50class IGUIStaticText;
51class IGUIEditBox;
52class IGUISpinBox;
53class IGUITabControl;
54class IGUITab;
55class IGUITable;
56class IGUIContextMenu;
57class IGUIComboBox;
58class IGUIToolBar;
59class IGUIButton;
60class IGUIWindow;
61class IGUIElementFactory;
62
63//! GUI Environment. Used as factory and manager of all other GUI elements.
64/** \par This element can create the following events of type EGUI_EVENT_TYPE (which are passed on to focused sub-elements):
65\li EGET_ELEMENT_FOCUS_LOST
66\li EGET_ELEMENT_FOCUSED
67\li EGET_ELEMENT_LEFT
68\li EGET_ELEMENT_HOVERED
69*/
70class IGUIEnvironment : public virtual IReferenceCounted
71{
72public:
73
74 //! Draws all gui elements by traversing the GUI environment starting at the root node.
75 virtual void drawAll() = 0;
76
77 //! Sets the focus to an element.
78 /** Causes a EGET_ELEMENT_FOCUS_LOST event followed by a
79 EGET_ELEMENT_FOCUSED event. If someone absorbed either of the events,
80 then the focus will not be changed.
81 \param element Pointer to the element which shall get the focus.
82 \return True on success, false on failure */
83 virtual bool setFocus(IGUIElement* element) = 0;
84
85 //! Returns the element which holds the focus.
86 /** \return Pointer to the element with focus. */
87 virtual IGUIElement* getFocus() const = 0;
88
89 //! Returns the element which was last under the mouse cursor
90 /** NOTE: This information is updated _after_ the user-eventreceiver
91 received it's mouse-events. To find the hovered element while catching
92 mouse events you have to use instead:
93 IGUIEnvironment::getRootGUIElement()->getElementFromPoint(mousePos);
94 \return Pointer to the element under the mouse. */
95 virtual IGUIElement* getHovered() const = 0;
96
97 //! Removes the focus from an element.
98 /** Causes a EGET_ELEMENT_FOCUS_LOST event. If the event is absorbed
99 then the focus will not be changed.
100 \param element Pointer to the element which shall lose the focus.
101 \return True on success, false on failure */
102 virtual bool removeFocus(IGUIElement* element) = 0;
103
104 //! Returns whether the element has focus
105 /** \param element Pointer to the element which is tested.
106 \return True if the element has focus, else false. */
107 virtual bool hasFocus(IGUIElement* element) const = 0;
108
109 //! Returns the current video driver.
110 /** \return Pointer to the video driver. */
111 virtual video::IVideoDriver* getVideoDriver() const = 0;
112
113 //! Returns the file system.
114 /** \return Pointer to the file system. */
115 virtual io::IFileSystem* getFileSystem() const = 0;
116
117 //! returns a pointer to the OS operator
118 /** \return Pointer to the OS operator. */
119 virtual IOSOperator* getOSOperator() const = 0;
120
121 //! Removes all elements from the environment.
122 virtual void clear() = 0;
123
124 //! Posts an input event to the environment.
125 /** Usually you do not have to
126 use this method, it is used by the engine internally.
127 \param event The event to post.
128 \return True if succeeded, else false. */
129 virtual bool postEventFromUser(const SEvent& event) = 0;
130
131 //! This sets a new event receiver for gui events.
132 /** Usually you do not have to
133 use this method, it is used by the engine internally.
134 \param evr Pointer to the new receiver. */
135 virtual void setUserEventReceiver(IEventReceiver* evr) = 0;
136
137 //! Returns pointer to the current gui skin.
138 /** \return Pointer to the GUI skin. */
139 virtual IGUISkin* getSkin() const = 0;
140
141 //! Sets a new GUI Skin
142 /** You can use this to change the appearance of the whole GUI
143 Environment. You can set one of the built-in skins or implement your
144 own class derived from IGUISkin and enable it using this method.
145 To set for example the built-in Windows classic skin, use the following
146 code:
147 \code
148 gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
149 environment->setSkin(newskin);
150 newskin->drop();
151 \endcode
152 \param skin New skin to use.
153 */
154 virtual void setSkin(IGUISkin* skin) = 0;
155
156 //! Creates a new GUI Skin based on a template.
157 /** Use setSkin() to set the created skin.
158 \param type The type of the new skin.
159 \return Pointer to the created skin.
160 If you no longer need it, you should call IGUISkin::drop().
161 See IReferenceCounted::drop() for more information. */
162 virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
163
164
165 //! Creates the image list from the given texture.
166 /** \param texture Texture to split into images
167 \param imageSize Dimension of each image
168 \param useAlphaChannel Flag whether alpha channel of the texture should be honored.
169 \return Pointer to the font. Returns 0 if the font could not be loaded.
170 This pointer should not be dropped. See IReferenceCounted::drop() for
171 more information. */
172 virtual IGUIImageList* createImageList( video::ITexture* texture,
173 core::dimension2d<s32> imageSize,
174 bool useAlphaChannel ) = 0;
175
176 //! Returns pointer to the font with the specified filename.
177 /** Loads the font if it was not loaded before.
178 \param filename Filename of the Font.
179 \return Pointer to the font. Returns 0 if the font could not be loaded.
180 This pointer should not be dropped. See IReferenceCounted::drop() for
181 more information. */
182 virtual IGUIFont* getFont(const io::path& filename) = 0;
183
184 //! Adds an externally loaded font to the font list.
185 /** This method allows to attach an already loaded font to the list of
186 existing fonts. The font is grabbed if non-null and adding was successful.
187 \param name Name the font should be stored as.
188 \param font Pointer to font to add.
189 \return Pointer to the font stored. This can differ from given parameter if the name previously existed. */
190 virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
191
192 //! remove loaded font
193 virtual void removeFont(IGUIFont* font) = 0;
194
195 //! Returns the default built-in font.
196 /** \return Pointer to the default built-in font.
197 This pointer should not be dropped. See IReferenceCounted::drop() for
198 more information. */
199 virtual IGUIFont* getBuiltInFont() const = 0;
200
201 //! Returns pointer to the sprite bank with the specified file name.
202 /** Loads the bank if it was not loaded before.
203 \param filename Filename of the sprite bank's origin.
204 \return Pointer to the sprite bank. Returns 0 if it could not be loaded.
205 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
206 virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
207
208 //! Adds an empty sprite bank to the manager
209 /** \param name Name of the new sprite bank.
210 \return Pointer to the sprite bank.
211 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
212 virtual IGUISpriteBank* addEmptySpriteBank(const io::path& name) = 0;
213
214 //! Returns the root gui element.
215 /** This is the first gui element, the (direct or indirect) parent of all
216 other gui elements. It is a valid IGUIElement, with dimensions the same
217 size as the screen.
218 \return Pointer to the root element of the GUI. The returned pointer
219 should not be dropped. See IReferenceCounted::drop() for more
220 information. */
221 virtual IGUIElement* getRootGUIElement() = 0;
222
223 //! Adds a button element.
224 /** \param rectangle Rectangle specifying the borders of the button.
225 \param parent Parent gui element of the button.
226 \param id Id with which the gui element can be identified.
227 \param text Text displayed on the button.
228 \param tooltiptext Text displayed in the tooltip.
229 \return Pointer to the created button. Returns 0 if an error occurred.
230 This pointer should not be dropped. See IReferenceCounted::drop() for
231 more information. */
232 virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
233 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0;
234
235 //! Adds an empty window element.
236 /** \param rectangle Rectangle specifying the borders of the window.
237 \param modal Defines if the dialog is modal. This means, that all other
238 gui elements which were created before the window cannot be used until
239 it is removed.
240 \param text Text displayed as the window title.
241 \param parent Parent gui element of the window.
242 \param id Id with which the gui element can be identified.
243 \return Pointer to the created window. Returns 0 if an error occurred.
244 This pointer should not be dropped. See IReferenceCounted::drop() for
245 more information. */
246 virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
247 const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0;
248
249 //! Adds a modal screen.
250 /** This control stops its parent's members from being able to receive
251 input until its last child is removed, it then deletes itself.
252 \param parent Parent gui element of the modal.
253 \return Pointer to the created modal. Returns 0 if an error occurred.
254 This pointer should not be dropped. See IReferenceCounted::drop() for
255 more information. */
256 virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
257
258 //! Adds a message box.
259 /** \param caption Text to be displayed the title of the message box.
260 \param text Text to be displayed in the body of the message box.
261 \param modal Defines if the dialog is modal. This means, that all other
262 gui elements which were created before the message box cannot be used
263 until this messagebox is removed.
264 \param flags Flags specifying the layout of the message box. For example
265 to create a message box with an OK and a CANCEL button on it, set this
266 to (EMBF_OK | EMBF_CANCEL).
267 \param parent Parent gui element of the message box.
268 \param id Id with which the gui element can be identified.
269 \param image Optional texture which will be displayed beside the text as an image
270 \return Pointer to the created message box. Returns 0 if an error
271 occurred. This pointer should not be dropped. See
272 IReferenceCounted::drop() for more information. */
273 virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
274 bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
275
276 //! Adds a scrollbar.
277 /** \param horizontal Specifies if the scroll bar is drawn horizontal
278 or vertical.
279 \param rectangle Rectangle specifying the borders of the scrollbar.
280 \param parent Parent gui element of the scroll bar.
281 \param id Id to identify the gui element.
282 \return Pointer to the created scrollbar. Returns 0 if an error
283 occurred. This pointer should not be dropped. See
284 IReferenceCounted::drop() for more information. */
285 virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
286 IGUIElement* parent=0, s32 id=-1) = 0;
287
288 //! Adds an image element.
289 /** \param image Image to be displayed.
290 \param pos Position of the image. The width and height of the image is
291 taken from the image.
292 \param useAlphaChannel Sets if the image should use the alpha channel
293 of the texture to draw itself.
294 \param parent Parent gui element of the image.
295 \param id Id to identify the gui element.
296 \param text Title text of the image.
297 \return Pointer to the created image element. Returns 0 if an error
298 occurred. This pointer should not be dropped. See
299 IReferenceCounted::drop() for more information. */
300 virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
301 bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
302
303 //! Adds an image element.
304 /** Use IGUIImage::setImage later to set the image to be displayed.
305 \param rectangle Rectangle specifying the borders of the image.
306 \param parent Parent gui element of the image.
307 \param id Id to identify the gui element.
308 \param text Title text of the image.
309 \param useAlphaChannel Sets if the image should use the alpha channel
310 of the texture to draw itself.
311 \return Pointer to the created image element. Returns 0 if an error
312 occurred. This pointer should not be dropped. See
313 IReferenceCounted::drop() for more information. */
314 virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
315 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, bool useAlphaChannel=true) = 0;
316
317 //! Adds a checkbox element.
318 /** \param checked Define the initial state of the check box.
319 \param rectangle Rectangle specifying the borders of the check box.
320 \param parent Parent gui element of the check box.
321 \param id Id to identify the gui element.
322 \param text Title text of the check box.
323 \return Pointer to the created check box. Returns 0 if an error
324 occurred. This pointer should not be dropped. See
325 IReferenceCounted::drop() for more information. */
326 virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
327 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
328
329 //! Adds a list box element.
330 /** \param rectangle Rectangle specifying the borders of the list box.
331 \param parent Parent gui element of the list box.
332 \param id Id to identify the gui element.
333 \param drawBackground Flag whether the background should be drawn.
334 \return Pointer to the created list box. Returns 0 if an error occurred.
335 This pointer should not be dropped. See IReferenceCounted::drop() for
336 more information. */
337 virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
338 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
339
340 //! Adds a tree view element.
341 /** \param rectangle Position and dimension of list box.
342 \param parent Parent gui element of the list box.
343 \param id Id to identify the gui element.
344 \param drawBackground Flag whether the background should be drawn.
345 \param scrollBarVertical Flag whether a vertical scrollbar should be used
346 \param scrollBarHorizontal Flag whether a horizontal scrollbar should be used
347 \return Pointer to the created list box. Returns 0 if an error occurred.
348 This pointer should not be dropped. See IReferenceCounted::drop() for
349 more information. */
350 virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
351 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
352 bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
353
354 //! Adds a mesh viewer. Not 100% implemented yet.
355 /** \param rectangle Rectangle specifying the borders of the mesh viewer.
356 \param parent Parent gui element of the mesh viewer.
357 \param id Id to identify the gui element.
358 \param text Title text of the mesh viewer.
359 \return Pointer to the created mesh viewer. Returns 0 if an error
360 occurred. This pointer should not be dropped. See
361 IReferenceCounted::drop() for more information. */
362 virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,
363 IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
364
365 //! Adds a file open dialog.
366 /** \param title Text to be displayed as the title of the dialog.
367 \param modal Defines if the dialog is modal. This means, that all other
368 gui elements which were created before the message box cannot be used
369 until this messagebox is removed.
370 \param parent Parent gui element of the dialog.
371 \param id Id to identify the gui element.
372 \param restoreCWD If set to true, the current workingn directory will be
373 restored after the dialog is closed in some way. Otherwise the working
374 directory will be the one that the file dialog was last showing.
375 \param startDir Optional path for which the file dialog will be opened.
376 \return Pointer to the created file open dialog. Returns 0 if an error
377 occurred. This pointer should not be dropped. See
378 IReferenceCounted::drop() for more information. */
379 virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title=0,
380 bool modal=true, IGUIElement* parent=0, s32 id=-1,
381 bool restoreCWD=false, io::path::char_type* startDir=0) = 0;
382
383 //! Adds a color select dialog.
384 /** \param title The title of the dialog.
385 \param modal Defines if the dialog is modal. This means, that all other
386 gui elements which were created before the dialog cannot be used
387 until it is removed.
388 \param parent The parent of the dialog.
389 \param id The ID of the dialog.
390 \return Pointer to the created file open dialog. Returns 0 if an error
391 occurred. This pointer should not be dropped. See
392 IReferenceCounted::drop() for more information. */
393 virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
394 bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
395
396 //! Adds a static text.
397 /** \param text Text to be displayed. Can be altered after creation by SetText().
398 \param rectangle Rectangle specifying the borders of the static text
399 \param border Set to true if the static text should have a 3d border.
400 \param wordWrap Enable if the text should wrap into multiple lines.
401 \param parent Parent item of the element, e.g. a window.
402 \param id The ID of the element.
403 \param fillBackground Enable if the background shall be filled.
404 Defaults to false.
405 \return Pointer to the created static text. Returns 0 if an error
406 occurred. This pointer should not be dropped. See
407 IReferenceCounted::drop() for more information. */
408 virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
409 bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
410 bool fillBackground = false) = 0;
411
412 //! Adds an edit box.
413 /** Supports unicode input from every keyboard around the world,
414 scrolling, copying and pasting (exchanging data with the clipboard
415 directly), maximum character amount, marking, and all shortcuts like
416 ctrl+X, ctrl+V, ctrl+C, shift+Left, shift+Right, Home, End, and so on.
417 \param text Text to be displayed. Can be altered after creation
418 by setText().
419 \param rectangle Rectangle specifying the borders of the edit box.
420 \param border Set to true if the edit box should have a 3d border.
421 \param parent Parent item of the element, e.g. a window.
422 Set it to 0 to place the edit box directly in the environment.
423 \param id The ID of the element.
424 \return Pointer to the created edit box. Returns 0 if an error occurred.
425 This pointer should not be dropped. See IReferenceCounted::drop() for
426 more information. */
427 virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
428 bool border=true, IGUIElement* parent=0, s32 id=-1) = 0;
429
430 //! Adds a spin box.
431 /** An edit box with up and down buttons
432 \param text Text to be displayed. Can be altered after creation by setText().
433 \param rectangle Rectangle specifying the borders of the spin box.
434 \param border Set to true if the spin box should have a 3d border.
435 \param parent Parent item of the element, e.g. a window.
436 Set it to 0 to place the spin box directly in the environment.
437 \param id The ID of the element.
438 \return Pointer to the created spin box. Returns 0 if an error occurred.
439 This pointer should not be dropped. See IReferenceCounted::drop() for
440 more information. */
441 virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
442 bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
443
444 //! Adds an element for fading in or out.
445 /** \param rectangle Rectangle specifying the borders of the fader.
446 If the pointer is NULL, the whole screen is used.
447 \param parent Parent item of the element, e.g. a window.
448 \param id An identifier for the fader.
449 \return Pointer to the created in-out-fader. Returns 0 if an error
450 occurred. This pointer should not be dropped. See
451 IReferenceCounted::drop() for more information. */
452 virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
453
454 //! Adds a tab control to the environment.
455 /** \param rectangle Rectangle specifying the borders of the tab control.
456 \param parent Parent item of the element, e.g. a window.
457 Set it to 0 to place the tab control directly in the environment.
458 \param fillbackground Specifies if the background of the tab control
459 should be drawn.
460 \param border Specifies if a flat 3d border should be drawn. This is
461 usually not necessary unless you place the control directly into
462 the environment without a window as parent.
463 \param id An identifier for the tab control.
464 \return Pointer to the created tab control element. Returns 0 if an
465 error occurred. This pointer should not be dropped. See
466 IReferenceCounted::drop() for more information. */
467 virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
468 IGUIElement* parent=0, bool fillbackground=false,
469 bool border=true, s32 id=-1) = 0;
470
471 //! Adds tab to the environment.
472 /** You can use this element to group other elements. This is not used
473 for creating tabs on tab controls, please use IGUITabControl::addTab()
474 for this instead.
475 \param rectangle Rectangle specifying the borders of the tab.
476 \param parent Parent item of the element, e.g. a window.
477 Set it to 0 to place the tab directly in the environment.
478 \param id An identifier for the tab.
479 \return Pointer to the created tab. Returns 0 if an
480 error occurred. This pointer should not be dropped. See
481 IReferenceCounted::drop() for more information. */
482 virtual IGUITab* addTab(const core::rect<s32>& rectangle,
483 IGUIElement* parent=0, s32 id=-1) = 0;
484
485 //! Adds a context menu to the environment.
486 /** \param rectangle Rectangle specifying the borders of the menu.
487 Note that the menu is resizing itself based on what items you add.
488 \param parent Parent item of the element, e.g. a window.
489 Set it to 0 to place the menu directly in the environment.
490 \param id An identifier for the menu.
491 \return Pointer to the created context menu. Returns 0 if an
492 error occurred. This pointer should not be dropped. See
493 IReferenceCounted::drop() for more information. */
494 virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
495 IGUIElement* parent=0, s32 id=-1) = 0;
496
497 //! Adds a menu to the environment.
498 /** This is like the menu you can find on top of most windows in modern
499 graphical user interfaces.
500 \param parent Parent item of the element, e.g. a window.
501 Set it to 0 to place the menu directly in the environment.
502 \param id An identifier for the menu.
503 \return Pointer to the created menu. Returns 0 if an
504 error occurred. This pointer should not be dropped. See
505 IReferenceCounted::drop() for more information. */
506 virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
507
508 //! Adds a toolbar to the environment.
509 /** It is like a menu that is always placed on top of its parent, and
510 contains buttons.
511 \param parent Parent item of the element, e.g. a window.
512 Set it to 0 to place the tool bar directly in the environment.
513 \param id An identifier for the tool bar.
514 \return Pointer to the created tool bar. Returns 0 if an
515 error occurred. This pointer should not be dropped. See
516 IReferenceCounted::drop() for more information. */
517 virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
518
519 //! Adds a combo box to the environment.
520 /** \param rectangle Rectangle specifying the borders of the combo box.
521 \param parent Parent item of the element, e.g. a window.
522 Set it to 0 to place the combo box directly in the environment.
523 \param id An identifier for the combo box.
524 \return Pointer to the created combo box. Returns 0 if an
525 error occurred. This pointer should not be dropped. See
526 IReferenceCounted::drop() for more information. */
527 virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
528 IGUIElement* parent=0, s32 id=-1) = 0;
529
530 //! Adds a table to the environment
531 /** \param rectangle Rectangle specifying the borders of the table.
532 \param parent Parent item of the element, e.g. a window. Set it to 0
533 to place the element directly in the environment.
534 \param id An identifier for the table.
535 \param drawBackground Flag whether the background should be drawn.
536 \return Pointer to the created table. Returns 0 if an error occurred.
537 This pointer should not be dropped. See IReferenceCounted::drop() for
538 more information. */
539 virtual IGUITable* addTable(const core::rect<s32>& rectangle,
540 IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0;
541
542 //! Get the default element factory which can create all built-in elements
543 /** \return Pointer to the factory.
544 This pointer should not be dropped. See IReferenceCounted::drop() for
545 more information. */
546 virtual IGUIElementFactory* getDefaultGUIElementFactory() const = 0;
547
548 //! Adds an element factory to the gui environment.
549 /** Use this to extend the gui environment with new element types which
550 it should be able to create automatically, for example when loading
551 data from xml files.
552 \param factoryToAdd Pointer to new factory. */
553 virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0;
554
555 //! Get amount of registered gui element factories.
556 /** \return Amount of registered gui element factories. */
557 virtual u32 getRegisteredGUIElementFactoryCount() const = 0;
558
559 //! Get a gui element factory by index
560 /** \param index Index of the factory.
561 \return Factory at given index, or 0 if no such factory exists. */
562 virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0;
563
564 //! Adds a GUI element by its name
565 /** Each factory is checked if it can create an element of the given
566 name. The first match will be created.
567 \param elementName Name of the element to be created.
568 \param parent Parent of the new element, if not 0.
569 \return New GUI element, or 0 if no such element exists. */
570 virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0;
571
572 //! Saves the current gui into a file.
573 /** \param filename Name of the file.
574 \param start The GUIElement to start with. Root if 0.
575 \return True if saving succeeded, else false. */
576 virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;
577
578 //! Saves the current gui into a file.
579 /** \param file The file to write to.
580 \param start The GUIElement to start with. Root if 0.
581 \return True if saving succeeded, else false. */
582 virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0;
583
584 //! Loads the gui. Note that the current gui is not cleared before.
585 /** When a parent is set the elements will be added below the parent, the parent itself does not deserialize.
586 When the file contains skin-settings from the gui-environment those are always serialized into the
587 guienvironment independent of the parent setting.
588 \param filename Name of the file.
589 \param parent Parent for the loaded GUI, root if 0.
590 \return True if loading succeeded, else false. */
591 virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;
592
593 //! Loads the gui. Note that the current gui is not cleared before.
594 /** When a parent is set the elements will be added below the parent, the parent itself does not deserialize.
595 When the file contains skin-settings from the gui-environment those are always serialized into the
596 guienvironment independent of the parent setting.
597 \param file The file to load from.
598 \param parent Parent for the loaded GUI, root if 0.
599 \return True if loading succeeded, else false. */
600 virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
601
602 //! Writes attributes of the gui environment
603 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;
604
605 //! Reads attributes of the gui environment
606 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
607
608 //! writes an element
609 virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* node) =0;
610
611 //! reads an element
612 virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* node) =0;
613};
614
615
616} // end namespace gui
617} // end namespace irr
618
619#endif
620
diff --git a/src/others/irrlicht-1.8.1/include/IGUIFileOpenDialog.h b/src/others/irrlicht-1.8.1/include/IGUIFileOpenDialog.h
new file mode 100644
index 0000000..2384038
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIFileOpenDialog.h
@@ -0,0 +1,44 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
6#define __I_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "path.h"
10
11namespace irr
12{
13namespace gui
14{
15
16 //! Standard file chooser dialog.
17 /** \warning When the user selects a folder this does change the current working directory
18
19 \par This element can create the following events of type EGUI_EVENT_TYPE:
20 \li EGET_DIRECTORY_SELECTED
21 \li EGET_FILE_SELECTED
22 \li EGET_FILE_CHOOSE_DIALOG_CANCELLED
23 */
24 class IGUIFileOpenDialog : public IGUIElement
25 {
26 public:
27
28 //! constructor
29 IGUIFileOpenDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
30 : IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {}
31
32 //! Returns the filename of the selected file. Returns NULL, if no file was selected.
33 virtual const wchar_t* getFileName() const = 0;
34
35 //! Returns the directory of the selected file. Returns NULL, if no directory was selected.
36 virtual const io::path& getDirectoryName() = 0;
37 };
38
39
40} // end namespace gui
41} // end namespace irr
42
43#endif
44
diff --git a/src/others/irrlicht-1.8.1/include/IGUIFont.h b/src/others/irrlicht-1.8.1/include/IGUIFont.h
new file mode 100644
index 0000000..4746c81
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIFont.h
@@ -0,0 +1,104 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_FONT_H_INCLUDED__
6#define __I_GUI_FONT_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "SColor.h"
10#include "rect.h"
11#include "irrString.h"
12
13namespace irr
14{
15namespace gui
16{
17
18//! An enum for the different types of GUI font.
19enum EGUI_FONT_TYPE
20{
21 //! Bitmap fonts loaded from an XML file or a texture.
22 EGFT_BITMAP = 0,
23
24 //! Scalable vector fonts loaded from an XML file.
25 /** These fonts reside in system memory and use no video memory
26 until they are displayed. These are slower than bitmap fonts
27 but can be easily scaled and rotated. */
28 EGFT_VECTOR,
29
30 //! A font which uses a the native API provided by the operating system.
31 /** Currently not used. */
32 EGFT_OS,
33
34 //! An external font type provided by the user.
35 EGFT_CUSTOM
36};
37
38//! Font interface.
39class IGUIFont : public virtual IReferenceCounted
40{
41public:
42
43 //! Draws some text and clips it to the specified rectangle if wanted.
44 /** \param text: Text to draw
45 \param position: Rectangle specifying position where to draw the text.
46 \param color: Color of the text
47 \param hcenter: Specifies if the text should be centered horizontally into the rectangle.
48 \param vcenter: Specifies if the text should be centered vertically into the rectangle.
49 \param clip: Optional pointer to a rectangle against which the text will be clipped.
50 If the pointer is null, no clipping will be done. */
51 virtual void draw(const core::stringw& text, const core::rect<s32>& position,
52 video::SColor color, bool hcenter=false, bool vcenter=false,
53 const core::rect<s32>* clip=0) = 0;
54
55 //! Calculates the width and height of a given string of text.
56 /** \return Returns width and height of the area covered by the text if
57 it would be drawn. */
58 virtual core::dimension2d<u32> getDimension(const wchar_t* text) const = 0;
59
60 //! Calculates the index of the character in the text which is on a specific position.
61 /** \param text: Text string.
62 \param pixel_x: X pixel position of which the index of the character will be returned.
63 \return Returns zero based index of the character in the text, and -1 if no no character
64 is on this position. (=the text is too short). */
65 virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) const = 0;
66
67 //! Returns the type of this font
68 virtual EGUI_FONT_TYPE getType() const { return EGFT_CUSTOM; }
69
70 //! Sets global kerning width for the font.
71 virtual void setKerningWidth (s32 kerning) = 0;
72
73 //! Sets global kerning height for the font.
74 virtual void setKerningHeight (s32 kerning) = 0;
75
76 //! Gets kerning values (distance between letters) for the font. If no parameters are provided,
77 /** the global kerning distance is returned.
78 \param thisLetter: If this parameter is provided, the left side kerning
79 for this letter is added to the global kerning value. For example, a
80 space might only be one pixel wide, but it may be displayed as several
81 pixels.
82 \param previousLetter: If provided, kerning is calculated for both
83 letters and added to the global kerning value. For example, in a font
84 which supports kerning pairs a string such as 'Wo' may have the 'o'
85 tucked neatly under the 'W'.
86 */
87 virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0;
88
89 //! Returns the distance between letters
90 virtual s32 getKerningHeight() const = 0;
91
92 //! Define which characters should not be drawn by the font.
93 /** For example " " would not draw any space which is usually blank in
94 most fonts.
95 \param s String of symbols which are not send down to the videodriver
96 */
97 virtual void setInvisibleCharacters( const wchar_t *s ) = 0;
98};
99
100} // end namespace gui
101} // end namespace irr
102
103#endif
104
diff --git a/src/others/irrlicht-1.8.1/include/IGUIFontBitmap.h b/src/others/irrlicht-1.8.1/include/IGUIFontBitmap.h
new file mode 100644
index 0000000..36ae37e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIFontBitmap.h
@@ -0,0 +1,46 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_FONT_BITMAP_H_INCLUDED__
6#define __I_GUI_FONT_BITMAP_H_INCLUDED__
7
8#include "IGUIFont.h"
9
10namespace irr
11{
12namespace gui
13{
14 class IGUISpriteBank;
15
16//! Font interface.
17class IGUIFontBitmap : public IGUIFont
18{
19public:
20
21 //! Returns the type of this font
22 virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; }
23
24 //! returns the parsed Symbol Information
25 virtual IGUISpriteBank* getSpriteBank() const = 0;
26
27 //! returns the sprite number from a given character
28 virtual u32 getSpriteNoFromChar(const wchar_t *c) const = 0;
29
30 //! Gets kerning values (distance between letters) for the font. If no parameters are provided,
31 /** the global kerning distance is returned.
32 \param thisLetter: If this parameter is provided, the left side kerning for this letter is added
33 to the global kerning value. For example, a space might only be one pixel wide, but it may
34 be displayed as several pixels.
35 \param previousLetter: If provided, kerning is calculated for both letters and added to the global
36 kerning value. For example, EGFT_BITMAP will add the right kerning value of previousLetter to the
37 left side kerning value of thisLetter, then add the global value.
38 */
39 virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0;
40};
41
42} // end namespace gui
43} // end namespace irr
44
45#endif
46
diff --git a/src/others/irrlicht-1.8.1/include/IGUIImage.h b/src/others/irrlicht-1.8.1/include/IGUIImage.h
new file mode 100644
index 0000000..9bca201
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIImage.h
@@ -0,0 +1,58 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_IMAGE_H_INCLUDED__
6#define __I_GUI_IMAGE_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12namespace video
13{
14 class ITexture;
15}
16namespace gui
17{
18
19 //! GUI element displaying an image.
20 class IGUIImage : public IGUIElement
21 {
22 public:
23
24 //! constructor
25 IGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
26 : IGUIElement(EGUIET_IMAGE, environment, parent, id, rectangle) {}
27
28 //! Sets an image texture
29 virtual void setImage(video::ITexture* image) = 0;
30
31 //! Gets the image texture
32 virtual video::ITexture* getImage() const = 0;
33
34 //! Sets the color of the image
35 virtual void setColor(video::SColor color) = 0;
36
37 //! Sets if the image should scale to fit the element
38 virtual void setScaleImage(bool scale) = 0;
39
40 //! Sets if the image should use its alpha channel to draw itself
41 virtual void setUseAlphaChannel(bool use) = 0;
42
43 //! Gets the color of the image
44 virtual video::SColor getColor() const = 0;
45
46 //! Returns true if the image is scaled to fit, false if not
47 virtual bool isImageScaled() const = 0;
48
49 //! Returns true if the image is using the alpha channel, false if not
50 virtual bool isAlphaChannelUsed() const = 0;
51 };
52
53
54} // end namespace gui
55} // end namespace irr
56
57#endif
58
diff --git a/src/others/irrlicht-1.8.1/include/IGUIImageList.h b/src/others/irrlicht-1.8.1/include/IGUIImageList.h
new file mode 100644
index 0000000..f1f50c1
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIImageList.h
@@ -0,0 +1,45 @@
1// This file is part of the "Irrlicht Engine".
2// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de
3
4#ifndef __I_GUI_IMAGE_LIST_H_INCLUDED__
5#define __I_GUI_IMAGE_LIST_H_INCLUDED__
6
7#include "IGUIElement.h"
8#include "rect.h"
9#include "irrTypes.h"
10
11namespace irr
12{
13namespace gui
14{
15
16//! Font interface.
17class IGUIImageList : public virtual IReferenceCounted
18{
19public:
20
21 //! Destructor
22 virtual ~IGUIImageList() {};
23
24 //! Draws an image and clips it to the specified rectangle if wanted
25 //! \param index: Index of the image
26 //! \param destPos: Position of the image to draw
27 //! \param clip: Optional pointer to a rectalgle against which the text will be clipped.
28 //! If the pointer is null, no clipping will be done.
29 virtual void draw(s32 index, const core::position2d<s32>& destPos,
30 const core::rect<s32>* clip = 0) = 0;
31
32 //! Returns the count of Images in the list.
33 //! \return Returns the count of Images in the list.
34 virtual s32 getImageCount() const = 0;
35
36 //! Returns the size of the images in the list.
37 //! \return Returns the size of the images in the list.
38 virtual core::dimension2d<s32> getImageSize() const = 0;
39};
40
41} // end namespace gui
42} // end namespace irr
43
44#endif
45
diff --git a/src/others/irrlicht-1.8.1/include/IGUIInOutFader.h b/src/others/irrlicht-1.8.1/include/IGUIInOutFader.h
new file mode 100644
index 0000000..a89f615
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIInOutFader.h
@@ -0,0 +1,67 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_IN_OUT_FADER_H_INCLUDED__
6#define __I_GUI_IN_OUT_FADER_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "SColor.h"
10
11namespace irr
12{
13namespace gui
14{
15
16 //! Element for fading out or in
17 /** Here is a small example on how the class is used. In this example we fade
18 in from a total red screen in the beginning. As you can see, the fader is not
19 only useful for dramatic in and out fading, but also to show that the player
20 is hit in a first person shooter game for example.
21 \code
22 gui::IGUIInOutFader* fader = device->getGUIEnvironment()->addInOutFader();
23 fader->setColor(video::SColor(0,255,0,0));
24 fader->fadeIn(4000);
25 \endcode
26 */
27 class IGUIInOutFader : public IGUIElement
28 {
29 public:
30
31 //! constructor
32 IGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
33 : IGUIElement(EGUIET_IN_OUT_FADER, environment, parent, id, rectangle) {}
34
35 //! Gets the color to fade out to or to fade in from.
36 virtual video::SColor getColor() const = 0;
37
38 //! Sets the color to fade out to or to fade in from.
39 /** \param color: Color to where it is faded out od from it is faded in. */
40 virtual void setColor(video::SColor color) = 0;
41 virtual void setColor(video::SColor source, video::SColor dest) = 0;
42
43 //! Starts the fade in process.
44 /** In the beginning the whole rect is drawn by the set color
45 (black by default) and at the end of the overgiven time the
46 color has faded out.
47 \param time: Time specifying how long it should need to fade in,
48 in milliseconds. */
49 virtual void fadeIn(u32 time) = 0;
50
51 //! Starts the fade out process.
52 /** In the beginning everything is visible, and at the end of
53 the time only the set color (black by the fault) will be drawn.
54 \param time: Time specifying how long it should need to fade out,
55 in milliseconds. */
56 virtual void fadeOut(u32 time) = 0;
57
58 //! Returns if the fade in or out process is done.
59 virtual bool isReady() const = 0;
60 };
61
62
63} // end namespace gui
64} // end namespace irr
65
66#endif
67
diff --git a/src/others/irrlicht-1.8.1/include/IGUIListBox.h b/src/others/irrlicht-1.8.1/include/IGUIListBox.h
new file mode 100644
index 0000000..0af7d7c
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIListBox.h
@@ -0,0 +1,138 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_LIST_BOX_H_INCLUDED__
6#define __I_GUI_LIST_BOX_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "SColor.h"
10
11namespace irr
12{
13namespace gui
14{
15 class IGUISpriteBank;
16
17 //! Enumeration for listbox colors
18 enum EGUI_LISTBOX_COLOR
19 {
20 //! Color of text
21 EGUI_LBC_TEXT=0,
22 //! Color of selected text
23 EGUI_LBC_TEXT_HIGHLIGHT,
24 //! Color of icon
25 EGUI_LBC_ICON,
26 //! Color of selected icon
27 EGUI_LBC_ICON_HIGHLIGHT,
28 //! Not used, just counts the number of available colors
29 EGUI_LBC_COUNT
30 };
31
32
33 //! Default list box GUI element.
34 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
35 \li EGET_LISTBOX_CHANGED
36 \li EGET_LISTBOX_SELECTED_AGAIN
37 */
38 class IGUIListBox : public IGUIElement
39 {
40 public:
41 //! constructor
42 IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
43 : IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
44
45 //! returns amount of list items
46 virtual u32 getItemCount() const = 0;
47
48 //! returns string of a list item. the may id be a value from 0 to itemCount-1
49 virtual const wchar_t* getListItem(u32 id) const = 0;
50
51 //! adds an list item, returns id of item
52 virtual u32 addItem(const wchar_t* text) = 0;
53
54 //! adds an list item with an icon
55 /** \param text Text of list entry
56 \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
57 \return The id of the new created item */
58 virtual u32 addItem(const wchar_t* text, s32 icon) = 0;
59
60 //! Removes an item from the list
61 virtual void removeItem(u32 index) = 0;
62
63 //! get the the id of the item at the given absolute coordinates
64 /** \return The id of the listitem or -1 when no item is at those coordinates*/
65 virtual s32 getItemAt(s32 xpos, s32 ypos) const = 0;
66
67 //! Returns the icon of an item
68 virtual s32 getIcon(u32 index) const = 0;
69
70 //! Sets the sprite bank which should be used to draw list icons.
71 /** This font is set to the sprite bank of the built-in-font by
72 default. A sprite can be displayed in front of every list item.
73 An icon is an index within the icon sprite bank. Several
74 default icons are available in the skin through getIcon. */
75 virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
76
77 //! clears the list, deletes all items in the listbox
78 virtual void clear() = 0;
79
80 //! returns id of selected item. returns -1 if no item is selected.
81 virtual s32 getSelected() const = 0;
82
83 //! sets the selected item. Set this to -1 if no item should be selected
84 virtual void setSelected(s32 index) = 0;
85
86 //! sets the selected item. Set this to 0 if no item should be selected
87 virtual void setSelected(const wchar_t *item) = 0;
88
89 //! set whether the listbox should scroll to newly selected items
90 virtual void setAutoScrollEnabled(bool scroll) = 0;
91
92 //! returns true if automatic scrolling is enabled, false if not.
93 virtual bool isAutoScrollEnabled() const = 0;
94
95 //! set all item colors at given index to color
96 virtual void setItemOverrideColor(u32 index, video::SColor color) = 0;
97
98 //! set all item colors of specified type at given index to color
99 virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, video::SColor color) = 0;
100
101 //! clear all item colors at index
102 virtual void clearItemOverrideColor(u32 index) = 0;
103
104 //! clear item color at index for given colortype
105 virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) = 0;
106
107 //! has the item at index its color overwritten?
108 virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
109
110 //! return the overwrite color at given item index.
111 virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
112
113 //! return the default color which is used for the given colorType
114 virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0;
115
116 //! set the item at the given index
117 virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0;
118
119 //! Insert the item at the given index
120 /** \return The index on success or -1 on failure. */
121 virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0;
122
123 //! Swap the items at the given indices
124 virtual void swapItems(u32 index1, u32 index2) = 0;
125
126 //! set global itemHeight
127 virtual void setItemHeight( s32 height ) = 0;
128
129 //! Sets whether to draw the background
130 virtual void setDrawBackground(bool draw) = 0;
131};
132
133
134} // end namespace gui
135} // end namespace irr
136
137#endif
138
diff --git a/src/others/irrlicht-1.8.1/include/IGUIMeshViewer.h b/src/others/irrlicht-1.8.1/include/IGUIMeshViewer.h
new file mode 100644
index 0000000..3255f4e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIMeshViewer.h
@@ -0,0 +1,53 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_MESH_VIEWER_H_INCLUDED__
6#define __I_GUI_MESH_VIEWER_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12
13namespace video
14{
15 class SMaterial;
16} // end namespace video
17
18namespace scene
19{
20 class IAnimatedMesh;
21} // end namespace scene
22
23namespace gui
24{
25
26 //! 3d mesh viewing GUI element.
27 class IGUIMeshViewer : public IGUIElement
28 {
29 public:
30
31 //! constructor
32 IGUIMeshViewer(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
33 : IGUIElement(EGUIET_MESH_VIEWER, environment, parent, id, rectangle) {}
34
35 //! Sets the mesh to be shown
36 virtual void setMesh(scene::IAnimatedMesh* mesh) = 0;
37
38 //! Gets the displayed mesh
39 virtual scene::IAnimatedMesh* getMesh() const = 0;
40
41 //! Sets the material
42 virtual void setMaterial(const video::SMaterial& material) = 0;
43
44 //! Gets the material
45 virtual const video::SMaterial& getMaterial() const = 0;
46 };
47
48
49} // end namespace gui
50} // end namespace irr
51
52#endif
53
diff --git a/src/others/irrlicht-1.8.1/include/IGUIScrollBar.h b/src/others/irrlicht-1.8.1/include/IGUIScrollBar.h
new file mode 100644
index 0000000..c75900e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIScrollBar.h
@@ -0,0 +1,65 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_SCROLL_BAR_H_INCLUDED__
6#define __I_GUI_SCROLL_BAR_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12namespace gui
13{
14
15 //! Default scroll bar GUI element.
16 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
17 \li EGET_SCROLL_BAR_CHANGED
18 */
19 class IGUIScrollBar : public IGUIElement
20 {
21 public:
22
23 //! constructor
24 IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
25 : IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {}
26
27 //! sets the maximum value of the scrollbar.
28 virtual void setMax(s32 max) = 0;
29 //! gets the maximum value of the scrollbar.
30 virtual s32 getMax() const = 0;
31
32 //! sets the minimum value of the scrollbar.
33 virtual void setMin(s32 min) = 0;
34 //! gets the minimum value of the scrollbar.
35 virtual s32 getMin() const = 0;
36
37 //! gets the small step value
38 virtual s32 getSmallStep() const = 0;
39
40 //! Sets the small step
41 /** That is the amount that the value changes by when clicking
42 on the buttons or using the cursor keys. */
43 virtual void setSmallStep(s32 step) = 0;
44
45 //! gets the large step value
46 virtual s32 getLargeStep() const = 0;
47
48 //! Sets the large step
49 /** That is the amount that the value changes by when clicking
50 in the tray, or using the page up and page down keys. */
51 virtual void setLargeStep(s32 step) = 0;
52
53 //! gets the current position of the scrollbar
54 virtual s32 getPos() const = 0;
55
56 //! sets the current position of the scrollbar
57 virtual void setPos(s32 pos) = 0;
58 };
59
60
61} // end namespace gui
62} // end namespace irr
63
64#endif
65
diff --git a/src/others/irrlicht-1.8.1/include/IGUISkin.h b/src/others/irrlicht-1.8.1/include/IGUISkin.h
new file mode 100644
index 0000000..d3bf337
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUISkin.h
@@ -0,0 +1,574 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_SKIN_H_INCLUDED__
6#define __I_GUI_SKIN_H_INCLUDED__
7
8#include "IAttributeExchangingObject.h"
9#include "EGUIAlignment.h"
10#include "SColor.h"
11#include "rect.h"
12
13namespace irr
14{
15namespace gui
16{
17 class IGUIFont;
18 class IGUISpriteBank;
19 class IGUIElement;
20
21 //! Enumeration of available default skins.
22 /** To set one of the skins, use the following code, for example to set
23 the Windows classic skin:
24 \code
25 gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
26 environment->setSkin(newskin);
27 newskin->drop();
28 \endcode
29 */
30 enum EGUI_SKIN_TYPE
31 {
32 //! Default windows look and feel
33 EGST_WINDOWS_CLASSIC=0,
34
35 //! Like EGST_WINDOWS_CLASSIC, but with metallic shaded windows and buttons
36 EGST_WINDOWS_METALLIC,
37
38 //! Burning's skin
39 EGST_BURNING_SKIN,
40
41 //! An unknown skin, not serializable at present
42 EGST_UNKNOWN,
43
44 //! this value is not used, it only specifies the number of skin types
45 EGST_COUNT
46 };
47
48 //! Names for gui element types
49 const c8* const GUISkinTypeNames[EGST_COUNT+1] =
50 {
51 "windowsClassic",
52 "windowsMetallic",
53 "burning",
54 "unknown",
55 0,
56 };
57
58
59 //! Enumeration for skin colors
60 enum EGUI_DEFAULT_COLOR
61 {
62 //! Dark shadow for three-dimensional display elements.
63 EGDC_3D_DARK_SHADOW = 0,
64 //! Shadow color for three-dimensional display elements (for edges facing away from the light source).
65 EGDC_3D_SHADOW,
66 //! Face color for three-dimensional display elements and for dialog box backgrounds.
67 EGDC_3D_FACE,
68 //! Highlight color for three-dimensional display elements (for edges facing the light source.)
69 EGDC_3D_HIGH_LIGHT,
70 //! Light color for three-dimensional display elements (for edges facing the light source.)
71 EGDC_3D_LIGHT,
72 //! Active window border.
73 EGDC_ACTIVE_BORDER,
74 //! Active window title bar text.
75 EGDC_ACTIVE_CAPTION,
76 //! Background color of multiple document interface (MDI) applications.
77 EGDC_APP_WORKSPACE,
78 //! Text on a button
79 EGDC_BUTTON_TEXT,
80 //! Grayed (disabled) text.
81 EGDC_GRAY_TEXT,
82 //! Item(s) selected in a control.
83 EGDC_HIGH_LIGHT,
84 //! Text of item(s) selected in a control.
85 EGDC_HIGH_LIGHT_TEXT,
86 //! Inactive window border.
87 EGDC_INACTIVE_BORDER,
88 //! Inactive window caption.
89 EGDC_INACTIVE_CAPTION,
90 //! Tool tip text color
91 EGDC_TOOLTIP,
92 //! Tool tip background color
93 EGDC_TOOLTIP_BACKGROUND,
94 //! Scrollbar gray area
95 EGDC_SCROLLBAR,
96 //! Window background
97 EGDC_WINDOW,
98 //! Window symbols like on close buttons, scroll bars and check boxes
99 EGDC_WINDOW_SYMBOL,
100 //! Icons in a list or tree
101 EGDC_ICON,
102 //! Selected icons in a list or tree
103 EGDC_ICON_HIGH_LIGHT,
104 //! Grayed (disabled) window symbols like on close buttons, scroll bars and check boxes
105 EGDC_GRAY_WINDOW_SYMBOL,
106 //! Window background for editable field (editbox, checkbox-field)
107 EGDC_EDITABLE,
108 //! Grayed (disabled) window background for editable field (editbox, checkbox-field)
109 EGDC_GRAY_EDITABLE,
110 //! Show focus of window background for editable field (editbox or when checkbox-field is pressed)
111 EGDC_FOCUSED_EDITABLE,
112
113 //! this value is not used, it only specifies the amount of default colors
114 //! available.
115 EGDC_COUNT
116 };
117
118 //! Names for default skin colors
119 const c8* const GUISkinColorNames[EGDC_COUNT+1] =
120 {
121 "3DDarkShadow",
122 "3DShadow",
123 "3DFace",
124 "3DHighlight",
125 "3DLight",
126 "ActiveBorder",
127 "ActiveCaption",
128 "AppWorkspace",
129 "ButtonText",
130 "GrayText",
131 "Highlight",
132 "HighlightText",
133 "InactiveBorder",
134 "InactiveCaption",
135 "ToolTip",
136 "ToolTipBackground",
137 "ScrollBar",
138 "Window",
139 "WindowSymbol",
140 "Icon",
141 "IconHighlight",
142 "GrayWindowSymbol",
143 "Editable",
144 "GrayEditable",
145 "FocusedEditable",
146 0,
147 };
148
149 //! Enumeration for default sizes.
150 enum EGUI_DEFAULT_SIZE
151 {
152 //! default with / height of scrollbar
153 EGDS_SCROLLBAR_SIZE = 0,
154 //! height of menu
155 EGDS_MENU_HEIGHT,
156 //! width of a window button
157 EGDS_WINDOW_BUTTON_WIDTH,
158 //! width of a checkbox check
159 EGDS_CHECK_BOX_WIDTH,
160 //! \deprecated This may be removed by Irrlicht 1.9
161 EGDS_MESSAGE_BOX_WIDTH,
162 //! \deprecated This may be removed by Irrlicht 1.9
163 EGDS_MESSAGE_BOX_HEIGHT,
164 //! width of a default button
165 EGDS_BUTTON_WIDTH,
166 //! height of a default button
167 EGDS_BUTTON_HEIGHT,
168 //! distance for text from background
169 EGDS_TEXT_DISTANCE_X,
170 //! distance for text from background
171 EGDS_TEXT_DISTANCE_Y,
172 //! distance for text in the title bar, from the left of the window rect
173 EGDS_TITLEBARTEXT_DISTANCE_X,
174 //! distance for text in the title bar, from the top of the window rect
175 EGDS_TITLEBARTEXT_DISTANCE_Y,
176 //! free space in a messagebox between borders and contents on all sides
177 EGDS_MESSAGE_BOX_GAP_SPACE,
178 //! minimal space to reserve for messagebox text-width
179 EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH,
180 //! maximal space to reserve for messagebox text-width
181 EGDS_MESSAGE_BOX_MAX_TEXT_WIDTH,
182 //! minimal space to reserve for messagebox text-height
183 EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT,
184 //! maximal space to reserve for messagebox text-height
185 EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT,
186 //! pixels to move the button image to the right when a pushbutton is pressed
187 EGDS_BUTTON_PRESSED_IMAGE_OFFSET_X,
188 //! pixels to move the button image down when a pushbutton is pressed
189 EGDS_BUTTON_PRESSED_IMAGE_OFFSET_Y,
190 //! pixels to move the button text to the right when a pushbutton is pressed
191 EGDS_BUTTON_PRESSED_TEXT_OFFSET_X,
192 //! pixels to move the button text down when a pushbutton is pressed
193 EGDS_BUTTON_PRESSED_TEXT_OFFSET_Y,
194
195 //! this value is not used, it only specifies the amount of default sizes
196 //! available.
197 EGDS_COUNT
198 };
199
200
201 //! Names for default skin sizes
202 const c8* const GUISkinSizeNames[EGDS_COUNT+1] =
203 {
204 "ScrollBarSize",
205 "MenuHeight",
206 "WindowButtonWidth",
207 "CheckBoxWidth",
208 "MessageBoxWidth",
209 "MessageBoxHeight",
210 "ButtonWidth",
211 "ButtonHeight",
212 "TextDistanceX",
213 "TextDistanceY",
214 "TitleBarTextX",
215 "TitleBarTextY",
216 "MessageBoxGapSpace",
217 "MessageBoxMinTextWidth",
218 "MessageBoxMaxTextWidth",
219 "MessageBoxMinTextHeight",
220 "MessageBoxMaxTextHeight",
221 "ButtonPressedImageOffsetX",
222 "ButtonPressedImageOffsetY"
223 "ButtonPressedTextOffsetX",
224 "ButtonPressedTextOffsetY",
225 0
226 };
227
228
229 enum EGUI_DEFAULT_TEXT
230 {
231 //! Text for the OK button on a message box
232 EGDT_MSG_BOX_OK = 0,
233 //! Text for the Cancel button on a message box
234 EGDT_MSG_BOX_CANCEL,
235 //! Text for the Yes button on a message box
236 EGDT_MSG_BOX_YES,
237 //! Text for the No button on a message box
238 EGDT_MSG_BOX_NO,
239 //! Tooltip text for window close button
240 EGDT_WINDOW_CLOSE,
241 //! Tooltip text for window maximize button
242 EGDT_WINDOW_MAXIMIZE,
243 //! Tooltip text for window minimize button
244 EGDT_WINDOW_MINIMIZE,
245 //! Tooltip text for window restore button
246 EGDT_WINDOW_RESTORE,
247
248 //! this value is not used, it only specifies the number of default texts
249 EGDT_COUNT
250 };
251
252 //! Names for default skin sizes
253 const c8* const GUISkinTextNames[EGDT_COUNT+1] =
254 {
255 "MessageBoxOkay",
256 "MessageBoxCancel",
257 "MessageBoxYes",
258 "MessageBoxNo",
259 "WindowButtonClose",
260 "WindowButtonMaximize",
261 "WindowButtonMinimize",
262 "WindowButtonRestore",
263 0
264 };
265
266 //! Customizable symbols for GUI
267 enum EGUI_DEFAULT_ICON
268 {
269 //! maximize window button
270 EGDI_WINDOW_MAXIMIZE = 0,
271 //! restore window button
272 EGDI_WINDOW_RESTORE,
273 //! close window button
274 EGDI_WINDOW_CLOSE,
275 //! minimize window button
276 EGDI_WINDOW_MINIMIZE,
277 //! resize icon for bottom right corner of a window
278 EGDI_WINDOW_RESIZE,
279 //! scroll bar up button
280 EGDI_CURSOR_UP,
281 //! scroll bar down button
282 EGDI_CURSOR_DOWN,
283 //! scroll bar left button
284 EGDI_CURSOR_LEFT,
285 //! scroll bar right button
286 EGDI_CURSOR_RIGHT,
287 //! icon for menu children
288 EGDI_MENU_MORE,
289 //! tick for checkbox
290 EGDI_CHECK_BOX_CHECKED,
291 //! down arrow for dropdown menus
292 EGDI_DROP_DOWN,
293 //! smaller up arrow
294 EGDI_SMALL_CURSOR_UP,
295 //! smaller down arrow
296 EGDI_SMALL_CURSOR_DOWN,
297 //! selection dot in a radio button
298 EGDI_RADIO_BUTTON_CHECKED,
299 //! << icon indicating there is more content to the left
300 EGDI_MORE_LEFT,
301 //! >> icon indicating that there is more content to the right
302 EGDI_MORE_RIGHT,
303 //! icon indicating that there is more content above
304 EGDI_MORE_UP,
305 //! icon indicating that there is more content below
306 EGDI_MORE_DOWN,
307 //! plus icon for trees
308 EGDI_EXPAND,
309
310 //! minus icon for trees
311 EGDI_COLLAPSE,
312 //! file icon for file selection
313 EGDI_FILE,
314 //! folder icon for file selection
315 EGDI_DIRECTORY,
316
317 //! value not used, it only specifies the number of icons
318 EGDI_COUNT
319 };
320
321 const c8* const GUISkinIconNames[EGDI_COUNT+1] =
322 {
323 "windowMaximize",
324 "windowRestore",
325 "windowClose",
326 "windowMinimize",
327 "windowResize",
328 "cursorUp",
329 "cursorDown",
330 "cursorLeft",
331 "cursorRight",
332 "menuMore",
333 "checkBoxChecked",
334 "dropDown",
335 "smallCursorUp",
336 "smallCursorDown",
337 "radioButtonChecked",
338 "moreLeft",
339 "moreRight",
340 "moreUp",
341 "moreDown",
342 "expand",
343 "collapse",
344 "file",
345 "directory",
346 0
347 };
348
349 // Customizable fonts
350 enum EGUI_DEFAULT_FONT
351 {
352 //! For static text, edit boxes, lists and most other places
353 EGDF_DEFAULT=0,
354 //! Font for buttons
355 EGDF_BUTTON,
356 //! Font for window title bars
357 EGDF_WINDOW,
358 //! Font for menu items
359 EGDF_MENU,
360 //! Font for tooltips
361 EGDF_TOOLTIP,
362 //! this value is not used, it only specifies the amount of default fonts
363 //! available.
364 EGDF_COUNT
365 };
366
367 const c8* const GUISkinFontNames[EGDF_COUNT+1] =
368 {
369 "defaultFont",
370 "buttonFont",
371 "windowFont",
372 "menuFont",
373 "tooltipFont",
374 0
375 };
376
377 //! A skin modifies the look of the GUI elements.
378 class IGUISkin : public virtual io::IAttributeExchangingObject
379 {
380 public:
381
382 //! returns default color
383 virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0;
384
385 //! sets a default color
386 virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor) = 0;
387
388 //! returns size for the given size type
389 virtual s32 getSize(EGUI_DEFAULT_SIZE size) const = 0;
390
391 //! Returns a default text.
392 /** For example for Message box button captions:
393 "OK", "Cancel", "Yes", "No" and so on. */
394 virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const = 0;
395
396 //! Sets a default text.
397 /** For example for Message box button captions:
398 "OK", "Cancel", "Yes", "No" and so on. */
399 virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText) = 0;
400
401 //! sets a default size
402 virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size) = 0;
403
404 //! returns the default font
405 virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const = 0;
406
407 //! sets a default font
408 virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT) = 0;
409
410 //! returns the sprite bank
411 virtual IGUISpriteBank* getSpriteBank() const = 0;
412
413 //! sets the sprite bank
414 virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
415
416 //! Returns a default icon
417 /** Returns the sprite index within the sprite bank */
418 virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const = 0;
419
420 //! Sets a default icon
421 /** Sets the sprite index used for drawing icons like arrows,
422 close buttons and ticks in checkboxes
423 \param icon: Enum specifying which icon to change
424 \param index: The sprite index used to draw this icon */
425 virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index) = 0;
426
427 //! draws a standard 3d button pane
428 /** Used for drawing for example buttons in normal state.
429 It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
430 EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
431 \param element: Pointer to the element which wishes to draw this. This parameter
432 is usually not used by IGUISkin, but can be used for example by more complex
433 implementations to find out how to draw the part exactly.
434 \param rect: Defining area where to draw.
435 \param clip: Clip area. */
436 virtual void draw3DButtonPaneStandard(IGUIElement* element,
437 const core::rect<s32>& rect,
438 const core::rect<s32>* clip=0) = 0;
439
440 //! draws a pressed 3d button pane
441 /** Used for drawing for example buttons in pressed state.
442 It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
443 EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
444 \param element: Pointer to the element which wishes to draw this. This parameter
445 is usually not used by IGUISkin, but can be used for example by more complex
446 implementations to find out how to draw the part exactly.
447 \param rect: Defining area where to draw.
448 \param clip: Clip area. */
449 virtual void draw3DButtonPanePressed(IGUIElement* element,
450 const core::rect<s32>& rect,
451 const core::rect<s32>* clip=0) = 0;
452
453 //! draws a sunken 3d pane
454 /** Used for drawing the background of edit, combo or check boxes.
455 \param element: Pointer to the element which wishes to draw this. This parameter
456 is usually not used by IGUISkin, but can be used for example by more complex
457 implementations to find out how to draw the part exactly.
458 \param bgcolor: Background color.
459 \param flat: Specifies if the sunken pane should be flat or displayed as sunken
460 deep into the ground.
461 \param fillBackGround: Specifies if the background should be filled with the background
462 color or not be drawn at all.
463 \param rect: Defining area where to draw.
464 \param clip: Clip area. */
465 virtual void draw3DSunkenPane(IGUIElement* element,
466 video::SColor bgcolor, bool flat, bool fillBackGround,
467 const core::rect<s32>& rect,
468 const core::rect<s32>* clip=0) = 0;
469
470 //! draws a window background
471 /** Used for drawing the background of dialogs and windows.
472 \param element: Pointer to the element which wishes to draw this. This parameter
473 is usually not used by IGUISkin, but can be used for example by more complex
474 implementations to find out how to draw the part exactly.
475 \param titleBarColor: Title color.
476 \param drawTitleBar: True to enable title drawing.
477 \param rect: Defining area where to draw.
478 \param clip: Clip area.
479 \param checkClientArea: When set to non-null the function will not draw anything,
480 but will instead return the clientArea which can be used for drawing by the calling window.
481 That is the area without borders and without titlebar.
482 \return Returns rect where it would be good to draw title bar text. This will
483 work even when checkClientArea is set to a non-null value.*/
484 virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
485 bool drawTitleBar, video::SColor titleBarColor,
486 const core::rect<s32>& rect,
487 const core::rect<s32>* clip=0,
488 core::rect<s32>* checkClientArea=0) = 0;
489
490 //! draws a standard 3d menu pane
491 /** Used for drawing for menus and context menus.
492 It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
493 EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
494 \param element: Pointer to the element which wishes to draw this. This parameter
495 is usually not used by IGUISkin, but can be used for example by more complex
496 implementations to find out how to draw the part exactly.
497 \param rect: Defining area where to draw.
498 \param clip: Clip area. */
499 virtual void draw3DMenuPane(IGUIElement* element,
500 const core::rect<s32>& rect,
501 const core::rect<s32>* clip=0) = 0;
502
503 //! draws a standard 3d tool bar
504 /** Used for drawing for toolbars and menus.
505 \param element: Pointer to the element which wishes to draw this. This parameter
506 is usually not used by IGUISkin, but can be used for example by more complex
507 implementations to find out how to draw the part exactly.
508 \param rect: Defining area where to draw.
509 \param clip: Clip area. */
510 virtual void draw3DToolBar(IGUIElement* element,
511 const core::rect<s32>& rect,
512 const core::rect<s32>* clip=0) = 0;
513
514 //! draws a tab button
515 /** Used for drawing for tab buttons on top of tabs.
516 \param element: Pointer to the element which wishes to draw this. This parameter
517 is usually not used by IGUISkin, but can be used for example by more complex
518 implementations to find out how to draw the part exactly.
519 \param active: Specifies if the tab is currently active.
520 \param rect: Defining area where to draw.
521 \param clip: Clip area.
522 \param alignment Alignment of GUI element. */
523 virtual void draw3DTabButton(IGUIElement* element, bool active,
524 const core::rect<s32>& rect, const core::rect<s32>* clip=0, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT) = 0;
525
526 //! draws a tab control body
527 /** \param element: Pointer to the element which wishes to draw this. This parameter
528 is usually not used by IGUISkin, but can be used for example by more complex
529 implementations to find out how to draw the part exactly.
530 \param border: Specifies if the border should be drawn.
531 \param background: Specifies if the background should be drawn.
532 \param rect: Defining area where to draw.
533 \param clip: Clip area.
534 \param tabHeight Height of tab.
535 \param alignment Alignment of GUI element. */
536 virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
537 const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT ) = 0;
538
539 //! draws an icon, usually from the skin's sprite bank
540 /** \param element: Pointer to the element which wishes to draw this icon.
541 This parameter is usually not used by IGUISkin, but can be used for example
542 by more complex implementations to find out how to draw the part exactly.
543 \param icon: Specifies the icon to be drawn.
544 \param position: The position to draw the icon
545 \param starttime: The time at the start of the animation
546 \param currenttime: The present time, used to calculate the frame number
547 \param loop: Whether the animation should loop or not
548 \param clip: Clip area. */
549 virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
550 const core::position2di position, u32 starttime=0, u32 currenttime=0,
551 bool loop=false, const core::rect<s32>* clip=0) = 0;
552
553 //! draws a 2d rectangle.
554 /** \param element: Pointer to the element which wishes to draw this icon.
555 This parameter is usually not used by IGUISkin, but can be used for example
556 by more complex implementations to find out how to draw the part exactly.
557 \param color: Color of the rectangle to draw. The alpha component specifies how
558 transparent the rectangle will be.
559 \param pos: Position of the rectangle.
560 \param clip: Pointer to rectangle against which the rectangle will be clipped.
561 If the pointer is null, no clipping will be performed. */
562 virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
563 const core::rect<s32>& pos, const core::rect<s32>* clip = 0) = 0;
564
565 //! get the type of this skin
566 virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }
567 };
568
569
570} // end namespace gui
571} // end namespace irr
572
573#endif
574
diff --git a/src/others/irrlicht-1.8.1/include/IGUISpinBox.h b/src/others/irrlicht-1.8.1/include/IGUISpinBox.h
new file mode 100644
index 0000000..bef139d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUISpinBox.h
@@ -0,0 +1,69 @@
1// Copyright (C) 2006-2012 Michael Zeilfelder
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_SPIN_BOX_H_INCLUDED__
6#define __I_GUI_SPIN_BOX_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12namespace gui
13{
14 class IGUIEditBox;
15
16 //! Single line edit box + spin buttons
17 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
18 \li EGET_SPINBOX_CHANGED
19 */
20 class IGUISpinBox : public IGUIElement
21 {
22 public:
23
24 //! constructor
25 IGUISpinBox(IGUIEnvironment* environment, IGUIElement* parent,
26 s32 id, core::rect<s32> rectangle)
27 : IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
28
29 //! Access the edit box used in the spin control
30 virtual IGUIEditBox* getEditBox() const = 0;
31
32 //! set the current value of the spinbox
33 /** \param val: value to be set in the spinbox */
34 virtual void setValue(f32 val) = 0;
35
36 //! Get the current value of the spinbox
37 virtual f32 getValue() const = 0;
38
39 //! set the range of values which can be used in the spinbox
40 /** \param min: minimum value
41 \param max: maximum value */
42 virtual void setRange(f32 min, f32 max) = 0;
43
44 //! get the minimum value which can be used in the spinbox
45 virtual f32 getMin() const = 0;
46
47 //! get the maximum value which can be used in the spinbox
48 virtual f32 getMax() const = 0;
49
50 //! Step size by which values are changed when pressing the spinbuttons
51 /** The step size also determines the number of decimal places to display
52 \param step: stepsize used for value changes when pressing spinbuttons */
53 virtual void setStepSize(f32 step=1.f) = 0;
54
55 //! Sets the number of decimal places to display.
56 //! Note that this also rounds the range to the same number of decimal places.
57 /** \param places: The number of decimal places to display, use -1 to reset */
58 virtual void setDecimalPlaces(s32 places) = 0;
59
60 //! get the current step size
61 virtual f32 getStepSize() const = 0;
62 };
63
64
65} // end namespace gui
66} // end namespace irr
67
68#endif // __I_GUI_SPIN_BOX_H_INCLUDED__
69
diff --git a/src/others/irrlicht-1.8.1/include/IGUISpriteBank.h b/src/others/irrlicht-1.8.1/include/IGUISpriteBank.h
new file mode 100644
index 0000000..4a2b5f5
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUISpriteBank.h
@@ -0,0 +1,95 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_SPRITE_BANK_H_INCLUDED__
6#define __I_GUI_SPRITE_BANK_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrArray.h"
10#include "SColor.h"
11#include "rect.h"
12
13namespace irr
14{
15
16namespace video
17{
18 class ITexture;
19} // end namespace video
20
21namespace gui
22{
23
24//! A single sprite frame.
25struct SGUISpriteFrame
26{
27 u32 textureNumber;
28 u32 rectNumber;
29};
30
31//! A sprite composed of several frames.
32struct SGUISprite
33{
34 SGUISprite() : Frames(), frameTime(0) {}
35
36 core::array<SGUISpriteFrame> Frames;
37 u32 frameTime;
38};
39
40
41//! Sprite bank interface.
42/** See http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=25742&highlight=spritebank
43* for more information how to use the spritebank.
44*/
45class IGUISpriteBank : public virtual IReferenceCounted
46{
47public:
48
49 //! Returns the list of rectangles held by the sprite bank
50 virtual core::array< core::rect<s32> >& getPositions() = 0;
51
52 //! Returns the array of animated sprites within the sprite bank
53 virtual core::array< SGUISprite >& getSprites() = 0;
54
55 //! Returns the number of textures held by the sprite bank
56 virtual u32 getTextureCount() const = 0;
57
58 //! Gets the texture with the specified index
59 virtual video::ITexture* getTexture(u32 index) const = 0;
60
61 //! Adds a texture to the sprite bank
62 virtual void addTexture(video::ITexture* texture) = 0;
63
64 //! Changes one of the textures in the sprite bank
65 virtual void setTexture(u32 index, video::ITexture* texture) = 0;
66
67 //! Add the texture and use it for a single non-animated sprite.
68 //! The texture and the corresponding rectangle and sprite will all be added to the end of each array.
69 //! returns the index of the sprite or -1 on failure
70 virtual s32 addTextureAsSprite(video::ITexture* texture) = 0;
71
72 //! clears sprites, rectangles and textures
73 virtual void clear() = 0;
74
75 //! Draws a sprite in 2d with position and color
76 virtual void draw2DSprite(u32 index, const core::position2di& pos,
77 const core::rect<s32>* clip=0,
78 const video::SColor& color= video::SColor(255,255,255,255),
79 u32 starttime=0, u32 currenttime=0,
80 bool loop=true, bool center=false) = 0;
81
82 //! Draws a sprite batch in 2d using an array of positions and a color
83 virtual void draw2DSpriteBatch(const core::array<u32>& indices, const core::array<core::position2di>& pos,
84 const core::rect<s32>* clip=0,
85 const video::SColor& color= video::SColor(255,255,255,255),
86 u32 starttime=0, u32 currenttime=0,
87 bool loop=true, bool center=false) = 0;
88};
89
90
91} // end namespace gui
92} // end namespace irr
93
94#endif // __I_GUI_SPRITE_BANK_H_INCLUDED__
95
diff --git a/src/others/irrlicht-1.8.1/include/IGUIStaticText.h b/src/others/irrlicht-1.8.1/include/IGUIStaticText.h
new file mode 100644
index 0000000..30325bc
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIStaticText.h
@@ -0,0 +1,135 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_STATIC_TEXT_H_INCLUDED__
6#define __I_GUI_STATIC_TEXT_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "SColor.h"
10
11namespace irr
12{
13namespace gui
14{
15 class IGUIFont;
16
17 //! Multi or single line text label.
18 class IGUIStaticText : public IGUIElement
19 {
20 public:
21
22 //! constructor
23 IGUIStaticText(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
24 : IGUIElement(EGUIET_STATIC_TEXT, environment, parent, id, rectangle) {}
25
26 //! Sets another skin independent font.
27 /** If this is set to zero, the button uses the font of the skin.
28 \param font: New font to set. */
29 virtual void setOverrideFont(IGUIFont* font=0) = 0;
30
31 //! Gets the override font (if any)
32 /** \return The override font (may be 0) */
33 virtual IGUIFont* getOverrideFont(void) const = 0;
34
35 //! Get the font which is used right now for drawing
36 /** Currently this is the override font when one is set and the
37 font of the active skin otherwise */
38 virtual IGUIFont* getActiveFont() const = 0;
39
40 //! Sets another color for the text.
41 /** If set, the static text does not use the EGDC_BUTTON_TEXT color defined
42 in the skin, but the set color instead. You don't need to call
43 IGUIStaticText::enableOverrrideColor(true) after this, this is done
44 by this function.
45 If you set a color, and you want the text displayed with the color
46 of the skin again, call IGUIStaticText::enableOverrideColor(false);
47 \param color: New color of the text. */
48 virtual void setOverrideColor(video::SColor color) = 0;
49
50 //! Gets the override color
51 /** \return: The override color */
52 virtual video::SColor getOverrideColor(void) const = 0;
53
54 //! Sets if the static text should use the overide color or the color in the gui skin.
55 /** \param enable: If set to true, the override color, which can be set
56 with IGUIStaticText::setOverrideColor is used, otherwise the
57 EGDC_BUTTON_TEXT color of the skin. */
58 virtual void enableOverrideColor(bool enable) = 0;
59
60 //! Checks if an override color is enabled
61 /** \return true if the override color is enabled, false otherwise */
62 virtual bool isOverrideColorEnabled(void) const = 0;
63
64 //! Sets another color for the background.
65 virtual void setBackgroundColor(video::SColor color) = 0;
66
67 //! Sets whether to draw the background
68 virtual void setDrawBackground(bool draw) = 0;
69
70 //! Gets the background color
71 /** \return: The background color */
72 virtual video::SColor getBackgroundColor() const = 0;
73
74 //! Checks if background drawing is enabled
75 /** \return true if background drawing is enabled, false otherwise */
76 virtual bool isDrawBackgroundEnabled() const = 0;
77
78 //! Sets whether to draw the border
79 virtual void setDrawBorder(bool draw) = 0;
80
81 //! Checks if border drawing is enabled
82 /** \return true if border drawing is enabled, false otherwise */
83 virtual bool isDrawBorderEnabled() const = 0;
84
85 //! Sets text justification mode
86 /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),
87 EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text.
88 \param vertical: EGUIA_UPPERLEFT to align with top edge,
89 EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
90 virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
91
92 //! Enables or disables word wrap for using the static text as multiline text control.
93 /** \param enable: If set to true, words going over one line are
94 broken on to the next line. */
95 virtual void setWordWrap(bool enable) = 0;
96
97 //! Checks if word wrap is enabled
98 /** \return true if word wrap is enabled, false otherwise */
99 virtual bool isWordWrapEnabled(void) const = 0;
100
101 //! Returns the height of the text in pixels when it is drawn.
102 /** This is useful for adjusting the layout of gui elements based on the height
103 of the multiline text in this element.
104 \return Height of text in pixels. */
105 virtual s32 getTextHeight() const = 0;
106
107 //! Returns the width of the current text, in the current font
108 /** If the text is broken, this returns the width of the widest line
109 \return The width of the text, or the widest broken line. */
110 virtual s32 getTextWidth(void) const = 0;
111
112 //! Set whether the text in this label should be clipped if it goes outside bounds
113 virtual void setTextRestrainedInside(bool restrainedInside) = 0;
114
115 //! Checks if the text in this label should be clipped if it goes outside bounds
116 virtual bool isTextRestrainedInside() const = 0;
117
118 //! Set whether the string should be interpreted as right-to-left (RTL) text
119 /** \note This component does not implement the Unicode bidi standard, the
120 text of the component should be already RTL if you call this. The
121 main difference when RTL is enabled is that the linebreaks for multiline
122 elements are performed starting from the end.
123 */
124 virtual void setRightToLeft(bool rtl) = 0;
125
126 //! Checks whether the text in this element should be interpreted as right-to-left
127 virtual bool isRightToLeft() const = 0;
128 };
129
130
131} // end namespace gui
132} // end namespace irr
133
134#endif
135
diff --git a/src/others/irrlicht-1.8.1/include/IGUITabControl.h b/src/others/irrlicht-1.8.1/include/IGUITabControl.h
new file mode 100644
index 0000000..660c4d0
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUITabControl.h
@@ -0,0 +1,136 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_TAB_CONTROL_H_INCLUDED__
6#define __I_GUI_TAB_CONTROL_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "SColor.h"
10#include "IGUISkin.h"
11
12namespace irr
13{
14namespace gui
15{
16 //! A tab-page, onto which other gui elements could be added.
17 /** IGUITab refers to the page itself, not to the tab in the tabbar of an IGUITabControl. */
18 class IGUITab : public IGUIElement
19 {
20 public:
21
22 //! constructor
23 IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
24 : IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
25
26 //! Returns zero based index of tab if in tabcontrol.
27 /** Can be accessed later IGUITabControl::getTab() by this number.
28 Note that this number can change when other tabs are inserted or removed .
29 */
30 virtual s32 getNumber() const = 0;
31
32 //! sets if the tab should draw its background
33 virtual void setDrawBackground(bool draw=true) = 0;
34
35 //! sets the color of the background, if it should be drawn.
36 virtual void setBackgroundColor(video::SColor c) = 0;
37
38 //! returns true if the tab is drawing its background, false if not
39 virtual bool isDrawingBackground() const = 0;
40
41 //! returns the color of the background
42 virtual video::SColor getBackgroundColor() const = 0;
43
44 //! sets the color of the text
45 virtual void setTextColor(video::SColor c) = 0;
46
47 //! gets the color of the text
48 virtual video::SColor getTextColor() const = 0;
49 };
50
51 //! A standard tab control
52 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
53 \li EGET_TAB_CHANGED
54 */
55 class IGUITabControl : public IGUIElement
56 {
57 public:
58
59 //! constructor
60 IGUITabControl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
61 : IGUIElement(EGUIET_TAB_CONTROL, environment, parent, id, rectangle) {}
62
63 //! Adds a tab
64 virtual IGUITab* addTab(const wchar_t* caption, s32 id=-1) = 0;
65
66 //! Insert the tab at the given index
67 /** \return The tab on success or NULL on failure. */
68 virtual IGUITab* insertTab(s32 idx, const wchar_t* caption, s32 id=-1) = 0;
69
70 //! Removes a tab from the tabcontrol
71 virtual void removeTab(s32 idx) = 0;
72
73 //! Clears the tabcontrol removing all tabs
74 virtual void clear() = 0;
75
76 //! Returns amount of tabs in the tabcontrol
77 virtual s32 getTabCount() const = 0;
78
79 //! Returns a tab based on zero based index
80 /** \param idx: zero based index of tab. Is a value betwenn 0 and getTabcount()-1;
81 \return Returns pointer to the Tab. Returns 0 if no tab
82 is corresponding to this tab. */
83 virtual IGUITab* getTab(s32 idx) const = 0;
84
85 //! Brings a tab to front.
86 /** \param idx: number of the tab.
87 \return Returns true if successful. */
88 virtual bool setActiveTab(s32 idx) = 0;
89
90 //! Brings a tab to front.
91 /** \param tab: pointer to the tab.
92 \return Returns true if successful. */
93 virtual bool setActiveTab(IGUITab *tab) = 0;
94
95 //! Returns which tab is currently active
96 virtual s32 getActiveTab() const = 0;
97
98 //! get the the id of the tab at the given absolute coordinates
99 /** \return The id of the tab or -1 when no tab is at those coordinates*/
100 virtual s32 getTabAt(s32 xpos, s32 ypos) const = 0;
101
102 //! Set the height of the tabs
103 virtual void setTabHeight( s32 height ) = 0;
104
105 //! Get the height of the tabs
106 /** return Returns the height of the tabs */
107 virtual s32 getTabHeight() const = 0;
108
109 //! set the maximal width of a tab. Per default width is 0 which means "no width restriction".
110 virtual void setTabMaxWidth(s32 width ) = 0;
111
112 //! get the maximal width of a tab
113 virtual s32 getTabMaxWidth() const = 0;
114
115 //! Set the alignment of the tabs
116 /** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */
117 virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0;
118
119 //! Get the alignment of the tabs
120 /** return Returns the alignment of the tabs */
121 virtual gui::EGUI_ALIGNMENT getTabVerticalAlignment() const = 0;
122
123 //! Set the extra width added to tabs on each side of the text
124 virtual void setTabExtraWidth( s32 extraWidth ) = 0;
125
126 //! Get the extra width added to tabs on each side of the text
127 /** return Returns the extra width of the tabs */
128 virtual s32 getTabExtraWidth() const = 0;
129 };
130
131
132} // end namespace gui
133} // end namespace irr
134
135#endif
136
diff --git a/src/others/irrlicht-1.8.1/include/IGUITable.h b/src/others/irrlicht-1.8.1/include/IGUITable.h
new file mode 100644
index 0000000..4f271a9
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUITable.h
@@ -0,0 +1,205 @@
1// Copyright (C) 2003-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_TABLE_H_INCLUDED__
6#define __I_GUI_TABLE_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "irrTypes.h"
10#include "SColor.h"
11#include "IGUISkin.h"
12
13namespace irr
14{
15namespace gui
16{
17
18 //! modes for ordering used when a column header is clicked
19 enum EGUI_COLUMN_ORDERING
20 {
21 //! Do not use ordering
22 EGCO_NONE,
23
24 //! Send a EGET_TABLE_HEADER_CHANGED message when a column header is clicked.
25 EGCO_CUSTOM,
26
27 //! Sort it ascending by it's ascii value like: a,b,c,...
28 EGCO_ASCENDING,
29
30 //! Sort it descending by it's ascii value like: z,x,y,...
31 EGCO_DESCENDING,
32
33 //! Sort it ascending on first click, descending on next, etc
34 EGCO_FLIP_ASCENDING_DESCENDING,
35
36 //! Not used as mode, only to get maximum value for this enum
37 EGCO_COUNT
38 };
39
40 //! Names for EGUI_COLUMN_ORDERING types
41 const c8* const GUIColumnOrderingNames[] =
42 {
43 "none",
44 "custom",
45 "ascend",
46 "descend",
47 "ascend_descend",
48 0,
49 };
50
51 enum EGUI_ORDERING_MODE
52 {
53 //! No element ordering
54 EGOM_NONE,
55
56 //! Elements are ordered from the smallest to the largest.
57 EGOM_ASCENDING,
58
59 //! Elements are ordered from the largest to the smallest.
60 EGOM_DESCENDING,
61
62 //! this value is not used, it only specifies the amount of default ordering types
63 //! available.
64 EGOM_COUNT
65 };
66
67 const c8* const GUIOrderingModeNames[] =
68 {
69 "none",
70 "ascending",
71 "descending",
72 0
73 };
74
75 enum EGUI_TABLE_DRAW_FLAGS
76 {
77 EGTDF_ROWS = 1,
78 EGTDF_COLUMNS = 2,
79 EGTDF_ACTIVE_ROW = 4,
80 EGTDF_COUNT
81 };
82
83 //! Default list box GUI element.
84 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
85 \li EGET_TABLE_CHANGED
86 \li EGET_TABLE_SELECTED_AGAIN
87 \li EGET_TABLE_HEADER_CHANGED
88 */
89 class IGUITable : public IGUIElement
90 {
91 public:
92 //! constructor
93 IGUITable(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
94 : IGUIElement(EGUIET_TABLE, environment, parent, id, rectangle) {}
95
96 //! Adds a column
97 /** If columnIndex is outside the current range, do push new colum at the end */
98 virtual void addColumn(const wchar_t* caption, s32 columnIndex=-1) = 0;
99
100 //! remove a column from the table
101 virtual void removeColumn(u32 columnIndex) = 0;
102
103 //! Returns the number of columns in the table control
104 virtual s32 getColumnCount() const = 0;
105
106 //! Makes a column active. This will trigger an ordering process.
107 /** \param idx: The id of the column to make active.
108 \param doOrder: Do also the ordering which depending on mode for active column
109 \return True if successful. */
110 virtual bool setActiveColumn(s32 idx, bool doOrder=false) = 0;
111
112 //! Returns which header is currently active
113 virtual s32 getActiveColumn() const = 0;
114
115 //! Returns the ordering used by the currently active column
116 virtual EGUI_ORDERING_MODE getActiveColumnOrdering() const = 0;
117
118 //! Set the width of a column
119 virtual void setColumnWidth(u32 columnIndex, u32 width) = 0;
120
121 //! Get the width of a column
122 virtual u32 getColumnWidth(u32 columnIndex) const = 0;
123
124 //! columns can be resized by drag 'n drop
125 virtual void setResizableColumns(bool resizable) = 0;
126
127 //! can columns be resized by dran 'n drop?
128 virtual bool hasResizableColumns() const = 0;
129
130 //! This tells the table control which ordering mode should be used when a column header is clicked.
131 /** \param columnIndex The index of the column header.
132 \param mode: One of the modes defined in EGUI_COLUMN_ORDERING */
133 virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode) = 0;
134
135 //! Returns which row is currently selected
136 virtual s32 getSelected() const = 0;
137
138 //! set wich row is currently selected
139 virtual void setSelected( s32 index ) = 0;
140
141 //! Get amount of rows in the tabcontrol
142 virtual s32 getRowCount() const = 0;
143
144 //! adds a row to the table
145 /** \param rowIndex Zero based index of rows. The row will be
146 inserted at this position, if a row already exist there, it
147 will be placed after it. If the row is larger than the actual
148 number of row by more than one, it won't be created. Note that
149 if you create a row that's not at the end, there might be
150 performance issues.
151 \return index of inserted row. */
152 virtual u32 addRow(u32 rowIndex) = 0;
153
154 //! Remove a row from the table
155 virtual void removeRow(u32 rowIndex) = 0;
156
157 //! clears the table rows, but keeps the columns intact
158 virtual void clearRows() = 0;
159
160 //! Swap two row positions.
161 virtual void swapRows(u32 rowIndexA, u32 rowIndexB) = 0;
162
163 //! This tells the table to start ordering all the rows.
164 /** You need to explicitly tell the table to re order the rows
165 when a new row is added or the cells data is changed. This
166 makes the system more flexible and doesn't make you pay the
167 cost of ordering when adding a lot of rows.
168 \param columnIndex: When set to -1 the active column is used.
169 \param mode Ordering mode of the rows. */
170 virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE) = 0;
171
172 //! Set the text of a cell
173 virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text) = 0;
174
175 //! Set the text of a cell, and set a color of this cell.
176 virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text, video::SColor color) = 0;
177
178 //! Set the data of a cell
179 virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data) = 0;
180
181 //! Set the color of a cell text
182 virtual void setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color) = 0;
183
184 //! Get the text of a cell
185 virtual const wchar_t* getCellText(u32 rowIndex, u32 columnIndex ) const = 0;
186
187 //! Get the data of a cell
188 virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const = 0;
189
190 //! clears the table, deletes all items in the table
191 virtual void clear() = 0;
192
193 //! Set flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout
194 virtual void setDrawFlags(s32 flags) = 0;
195
196 //! Get the flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout
197 virtual s32 getDrawFlags() const = 0;
198 };
199
200
201} // end namespace gui
202} // end namespace irr
203
204#endif
205
diff --git a/src/others/irrlicht-1.8.1/include/IGUIToolbar.h b/src/others/irrlicht-1.8.1/include/IGUIToolbar.h
new file mode 100644
index 0000000..58796bf
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIToolbar.h
@@ -0,0 +1,40 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_TOOL_BAR_H_INCLUDED__
6#define __I_GUI_TOOL_BAR_H_INCLUDED__
7
8#include "IGUIElement.h"
9
10namespace irr
11{
12namespace video
13{
14 class ITexture;
15} // end namespace video
16namespace gui
17{
18 class IGUIButton;
19
20 //! Stays at the top of its parent like the menu bar and contains tool buttons
21 class IGUIToolBar : public IGUIElement
22 {
23 public:
24
25 //! constructor
26 IGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
27 : IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {}
28
29 //! Adds a button to the tool bar
30 virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0,
31 video::ITexture* img=0, video::ITexture* pressedimg=0,
32 bool isPushButton=false, bool useAlphaChannel=false) = 0;
33 };
34
35
36} // end namespace gui
37} // end namespace irr
38
39#endif
40
diff --git a/src/others/irrlicht-1.8.1/include/IGUITreeView.h b/src/others/irrlicht-1.8.1/include/IGUITreeView.h
new file mode 100644
index 0000000..4552b29
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUITreeView.h
@@ -0,0 +1,278 @@
1// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_TREE_VIEW_H_INCLUDED__
6#define __I_GUI_TREE_VIEW_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "IGUIImageList.h"
10#include "irrTypes.h"
11
12namespace irr
13{
14namespace gui
15{
16 class IGUIFont;
17 class IGUITreeView;
18
19
20 //! Node for gui tree view
21 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
22 \li EGET_TREEVIEW_NODE_EXPAND
23 \li EGET_TREEVIEW_NODE_COLLAPS
24 \li EGET_TREEVIEW_NODE_DESELECT
25 \li EGET_TREEVIEW_NODE_SELECT
26 */
27 class IGUITreeViewNode : public IReferenceCounted
28 {
29 public:
30 //! returns the owner (tree view) of this node
31 virtual IGUITreeView* getOwner() const = 0;
32
33 //! Returns the parent node of this node.
34 /** For the root node this will return 0. */
35 virtual IGUITreeViewNode* getParent() const = 0;
36
37 //! returns the text of the node
38 virtual const wchar_t* getText() const = 0;
39
40 //! sets the text of the node
41 virtual void setText( const wchar_t* text ) = 0;
42
43 //! returns the icon text of the node
44 virtual const wchar_t* getIcon() const = 0;
45
46 //! sets the icon text of the node
47 virtual void setIcon( const wchar_t* icon ) = 0;
48
49 //! returns the image index of the node
50 virtual u32 getImageIndex() const = 0;
51
52 //! sets the image index of the node
53 virtual void setImageIndex( u32 imageIndex ) = 0;
54
55 //! returns the image index of the node
56 virtual u32 getSelectedImageIndex() const = 0;
57
58 //! sets the image index of the node
59 virtual void setSelectedImageIndex( u32 imageIndex ) = 0;
60
61 //! returns the user data (void*) of this node
62 virtual void* getData() const = 0;
63
64 //! sets the user data (void*) of this node
65 virtual void setData( void* data ) = 0;
66
67 //! returns the user data2 (IReferenceCounted) of this node
68 virtual IReferenceCounted* getData2() const = 0;
69
70 //! sets the user data2 (IReferenceCounted) of this node
71 virtual void setData2( IReferenceCounted* data ) = 0;
72
73 //! returns the child item count
74 virtual u32 getChildCount() const = 0;
75
76 //! removes all children (recursive) from this node
77 virtual void clearChildren() = 0;
78
79 //! removes all children (recursive) from this node
80 /** \deprecated Deprecated in 1.8, use clearChildren() instead.
81 This method may be removed by Irrlicht 1.9 */
82 _IRR_DEPRECATED_ void clearChilds()
83 {
84 return clearChildren();
85 }
86
87 //! returns true if this node has child nodes
88 virtual bool hasChildren() const = 0;
89
90 //! returns true if this node has child nodes
91 /** \deprecated Deprecated in 1.8, use hasChildren() instead.
92 This method may be removed by Irrlicht 1.9 */
93 _IRR_DEPRECATED_ bool hasChilds() const
94 {
95 return hasChildren();
96 }
97
98 //! Adds a new node behind the last child node.
99 /** \param text text of the new node
100 \param icon icon text of the new node
101 \param imageIndex index of the image for the new node (-1 = none)
102 \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
103 \param data user data (void*) of the new node
104 \param data2 user data2 (IReferenceCounted*) of the new node
105 \return The new node
106 */
107 virtual IGUITreeViewNode* addChildBack(
108 const wchar_t* text, const wchar_t* icon = 0,
109 s32 imageIndex=-1, s32 selectedImageIndex=-1,
110 void* data=0, IReferenceCounted* data2=0) =0;
111
112 //! Adds a new node before the first child node.
113 /** \param text text of the new node
114 \param icon icon text of the new node
115 \param imageIndex index of the image for the new node (-1 = none)
116 \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
117 \param data user data (void*) of the new node
118 \param data2 user data2 (IReferenceCounted*) of the new node
119 \return The new node
120 */
121 virtual IGUITreeViewNode* addChildFront(
122 const wchar_t* text, const wchar_t* icon = 0,
123 s32 imageIndex=-1, s32 selectedImageIndex=-1,
124 void* data=0, IReferenceCounted* data2=0 ) =0;
125
126 //! Adds a new node behind the other node.
127 /** The other node has also te be a child node from this node.
128 \param other Node to insert after
129 \param text text of the new node
130 \param icon icon text of the new node
131 \param imageIndex index of the image for the new node (-1 = none)
132 \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
133 \param data user data (void*) of the new node
134 \param data2 user data2 (IReferenceCounted*) of the new node
135 \return The new node or 0 if other is no child node from this
136 */
137 virtual IGUITreeViewNode* insertChildAfter(
138 IGUITreeViewNode* other,
139 const wchar_t* text, const wchar_t* icon = 0,
140 s32 imageIndex=-1, s32 selectedImageIndex=-1,
141 void* data=0, IReferenceCounted* data2=0) =0;
142
143 //! Adds a new node before the other node.
144 /** The other node has also te be a child node from this node.
145 \param other Node to insert before
146 \param text text of the new node
147 \param icon icon text of the new node
148 \param imageIndex index of the image for the new node (-1 = none)
149 \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
150 \param data user data (void*) of the new node
151 \param data2 user data2 (IReferenceCounted*) of the new node
152 \return The new node or 0 if other is no child node from this
153 */
154 virtual IGUITreeViewNode* insertChildBefore(
155 IGUITreeViewNode* other,
156 const wchar_t* text, const wchar_t* icon = 0,
157 s32 imageIndex=-1, s32 selectedImageIndex=-1,
158 void* data=0, IReferenceCounted* data2=0) = 0;
159
160 //! Return the first child node from this node.
161 /** \return The first child node or 0 if this node has no children. */
162 virtual IGUITreeViewNode* getFirstChild() const = 0;
163
164 //! Return the last child node from this node.
165 /** \return The last child node or 0 if this node has no children. */
166 virtual IGUITreeViewNode* getLastChild() const = 0;
167
168 //! Returns the previous sibling node from this node.
169 /** \return The previous sibling node from this node or 0 if this is
170 the first node from the parent node.
171 */
172 virtual IGUITreeViewNode* getPrevSibling() const = 0;
173
174 //! Returns the next sibling node from this node.
175 /** \return The next sibling node from this node or 0 if this is
176 the last node from the parent node.
177 */
178 virtual IGUITreeViewNode* getNextSibling() const = 0;
179
180 //! Returns the next visible (expanded, may be out of scrolling) node from this node.
181 /** \return The next visible node from this node or 0 if this is
182 the last visible node. */
183 virtual IGUITreeViewNode* getNextVisible() const = 0;
184
185 //! Deletes a child node.
186 /** \return Returns true if the node was found as a child and is deleted. */
187 virtual bool deleteChild( IGUITreeViewNode* child ) = 0;
188
189 //! Moves a child node one position up.
190 /** \return True if the node was found as achild node and was not already the first child. */
191 virtual bool moveChildUp( IGUITreeViewNode* child ) = 0;
192
193 //! Moves a child node one position down.
194 /** \return True if the node was found as achild node and was not already the last child. */
195 virtual bool moveChildDown( IGUITreeViewNode* child ) = 0;
196
197 //! Returns true if the node is expanded (children are visible).
198 virtual bool getExpanded() const = 0;
199
200 //! Sets if the node is expanded.
201 virtual void setExpanded( bool expanded ) = 0;
202
203 //! Returns true if the node is currently selected.
204 virtual bool getSelected() const = 0;
205
206 //! Sets this node as selected.
207 virtual void setSelected( bool selected ) = 0;
208
209 //! Returns true if this node is the root node.
210 virtual bool isRoot() const = 0;
211
212 //! Returns the level of this node.
213 /** The root node has level 0. Direct children of the root has level 1 ... */
214 virtual s32 getLevel() const = 0;
215
216 //! Returns true if this node is visible (all parents are expanded).
217 virtual bool isVisible() const = 0;
218 };
219
220
221 //! Default tree view GUI element.
222 /** Displays a windows like tree buttons to expand/collaps the child
223 nodes of an node and optional tree lines. Each node consits of an
224 text, an icon text and a void pointer for user data. */
225 class IGUITreeView : public IGUIElement
226 {
227 public:
228 //! constructor
229 IGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
230 s32 id, core::rect<s32> rectangle)
231 : IGUIElement( EGUIET_TREE_VIEW, environment, parent, id, rectangle ) {}
232
233 //! returns the root node (not visible) from the tree.
234 virtual IGUITreeViewNode* getRoot() const = 0;
235
236 //! returns the selected node of the tree or 0 if none is selected
237 virtual IGUITreeViewNode* getSelected() const = 0;
238
239 //! returns true if the tree lines are visible
240 virtual bool getLinesVisible() const = 0;
241
242 //! sets if the tree lines are visible
243 /** \param visible true for visible, false for invisible */
244 virtual void setLinesVisible( bool visible ) = 0;
245
246 //! Sets the font which should be used as icon font.
247 /** This font is set to the Irrlicht engine built-in-font by
248 default. Icons can be displayed in front of every list item.
249 An icon is a string, displayed with the icon font. When using
250 the build-in-font of the Irrlicht engine as icon font, the icon
251 strings defined in GUIIcons.h can be used.
252 */
253 virtual void setIconFont( IGUIFont* font ) = 0;
254
255 //! Sets the image list which should be used for the image and selected image of every node.
256 /** The default is 0 (no images). */
257 virtual void setImageList( IGUIImageList* imageList ) = 0;
258
259 //! Returns the image list which is used for the nodes.
260 virtual IGUIImageList* getImageList() const = 0;
261
262 //! Sets if the image is left of the icon. Default is true.
263 virtual void setImageLeftOfIcon( bool bLeftOf ) = 0;
264
265 //! Returns if the Image is left of the icon. Default is true.
266 virtual bool getImageLeftOfIcon() const = 0;
267
268 //! Returns the node which is associated to the last event.
269 /** This pointer is only valid inside the OnEvent call! */
270 virtual IGUITreeViewNode* getLastEventNode() const = 0;
271 };
272
273
274} // end namespace gui
275} // end namespace irr
276
277#endif
278
diff --git a/src/others/irrlicht-1.8.1/include/IGUIWindow.h b/src/others/irrlicht-1.8.1/include/IGUIWindow.h
new file mode 100644
index 0000000..6383bf0
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUIWindow.h
@@ -0,0 +1,74 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_WINDOW_H_INCLUDED__
6#define __I_GUI_WINDOW_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "EMessageBoxFlags.h"
10
11namespace irr
12{
13namespace gui
14{
15 class IGUIButton;
16
17 //! Default moveable window GUI element with border, caption and close icons.
18 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
19 \li EGET_ELEMENT_CLOSED
20 */
21 class IGUIWindow : public IGUIElement
22 {
23 public:
24
25 //! constructor
26 IGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
27 : IGUIElement(EGUIET_WINDOW, environment, parent, id, rectangle) {}
28
29 //! Returns pointer to the close button
30 /** You can hide the button by calling setVisible(false) on the result. */
31 virtual IGUIButton* getCloseButton() const = 0;
32
33 //! Returns pointer to the minimize button
34 /** You can hide the button by calling setVisible(false) on the result. */
35 virtual IGUIButton* getMinimizeButton() const = 0;
36
37 //! Returns pointer to the maximize button
38 /** You can hide the button by calling setVisible(false) on the result. */
39 virtual IGUIButton* getMaximizeButton() const = 0;
40
41 //! Returns true if the window can be dragged with the mouse, false if not
42 virtual bool isDraggable() const = 0;
43
44 //! Sets whether the window can be dragged by the mouse
45 virtual void setDraggable(bool draggable) = 0;
46
47 //! Set if the window background will be drawn
48 virtual void setDrawBackground(bool draw) = 0;
49
50 //! Get if the window background will be drawn
51 virtual bool getDrawBackground() const = 0;
52
53 //! Set if the window titlebar will be drawn
54 //! Note: If the background is not drawn, then the titlebar is automatically also not drawn
55 virtual void setDrawTitlebar(bool draw) = 0;
56
57 //! Get if the window titlebar will be drawn
58 virtual bool getDrawTitlebar() const = 0;
59
60 //! Returns the rectangle of the drawable area (without border and without titlebar)
61 /** The coordinates are given relative to the top-left position of the gui element.<br>
62 So to get absolute positions you have to add the resulting rectangle to getAbsolutePosition().UpperLeftCorner.<br>
63 To get it relative to the parent element you have to add the resulting rectangle to getRelativePosition().UpperLeftCorner.
64 Beware that adding a menu will not change the clientRect as menus are own gui elements, so in that case you might want to subtract
65 the menu area additionally. */
66 virtual core::rect<s32> getClientRect() const = 0;
67 };
68
69
70} // end namespace gui
71} // end namespace irr
72
73#endif
74
diff --git a/src/others/irrlicht-1.8.1/include/IGeometryCreator.h b/src/others/irrlicht-1.8.1/include/IGeometryCreator.h
new file mode 100644
index 0000000..164e94b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGeometryCreator.h
@@ -0,0 +1,177 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GEOMETRY_CREATOR_H_INCLUDED__
6#define __I_GEOMETRY_CREATOR_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "IMesh.h"
10#include "IImage.h"
11
12namespace irr
13{
14namespace video
15{
16 class IVideoDriver;
17 class SMaterial;
18}
19
20namespace scene
21{
22
23//! Helper class for creating geometry on the fly.
24/** You can get an instance of this class through ISceneManager::getGeometryCreator() */
25class IGeometryCreator : public IReferenceCounted
26{
27public:
28
29 //! Creates a simple cube mesh.
30 /**
31 \param size Dimensions of the cube.
32 \return Generated mesh.
33 */
34 virtual IMesh* createCubeMesh(const core::vector3df& size=core::vector3df(5.f,5.f,5.f)) const =0;
35
36 //! Create a pseudo-random mesh representing a hilly terrain.
37 /**
38 \param tileSize The size of each tile.
39 \param tileCount The number of tiles in each dimension.
40 \param material The material to apply to the mesh.
41 \param hillHeight The maximum height of the hills.
42 \param countHills The number of hills along each dimension.
43 \param textureRepeatCount The number of times to repeat the material texture along each dimension.
44 \return Generated mesh.
45 */
46 virtual IMesh* createHillPlaneMesh(
47 const core::dimension2d<f32>& tileSize,
48 const core::dimension2d<u32>& tileCount,
49 video::SMaterial* material, f32 hillHeight,
50 const core::dimension2d<f32>& countHills,
51 const core::dimension2d<f32>& textureRepeatCount) const =0;
52
53 //! Create a simple rectangular textured plane mesh.
54 /**
55 \param tileSize The size of each tile.
56 \param tileCount The number of tiles in each dimension.
57 \param material The material to apply to the mesh.
58 \param textureRepeatCount The number of times to repeat the material texture along each dimension.
59 \return Generated mesh.
60 */
61 IMesh* createPlaneMesh(
62 const core::dimension2d<f32>& tileSize,
63 const core::dimension2d<u32>& tileCount=core::dimension2du(1,1),
64 video::SMaterial* material=0,
65 const core::dimension2df& textureRepeatCount=core::dimension2df(1.f,1.f)) const
66 {
67 return createHillPlaneMesh(tileSize, tileCount, material, 0.f, core::dimension2df(), textureRepeatCount);
68 }
69
70 //! Create a terrain mesh from an image representing a heightfield.
71 /**
72 \param texture The texture to apply to the terrain.
73 \param heightmap An image that will be interpreted as a heightmap. The
74 brightness (average color) of each pixel is interpreted as a height,
75 with a 255 brightness pixel producing the maximum height.
76 \param stretchSize The size that each pixel will produce, i.e. a
77 512x512 heightmap
78 and a stretchSize of (10.f, 20.f) will produce a mesh of size
79 5120.f x 10240.f
80 \param maxHeight The maximum height of the terrain.
81 \param driver The current video driver.
82 \param defaultVertexBlockSize (to be documented)
83 \param debugBorders (to be documented)
84 \return Generated mesh.
85 */
86 virtual IMesh* createTerrainMesh(video::IImage* texture,
87 video::IImage* heightmap,
88 const core::dimension2d<f32>& stretchSize,
89 f32 maxHeight, video::IVideoDriver* driver,
90 const core::dimension2d<u32>& defaultVertexBlockSize,
91 bool debugBorders=false) const =0;
92
93 //! Create an arrow mesh, composed of a cylinder and a cone.
94 /**
95 \param tesselationCylinder Number of quads composing the cylinder.
96 \param tesselationCone Number of triangles composing the cone's roof.
97 \param height Total height of the arrow
98 \param cylinderHeight Total height of the cylinder, should be lesser
99 than total height
100 \param widthCylinder Diameter of the cylinder
101 \param widthCone Diameter of the cone's base, should be not smaller
102 than the cylinder's diameter
103 \param colorCylinder color of the cylinder
104 \param colorCone color of the cone
105 \return Generated mesh.
106 */
107 virtual IMesh* createArrowMesh(const u32 tesselationCylinder = 4,
108 const u32 tesselationCone = 8, const f32 height = 1.f,
109 const f32 cylinderHeight = 0.6f, const f32 widthCylinder = 0.05f,
110 const f32 widthCone = 0.3f, const video::SColor colorCylinder = 0xFFFFFFFF,
111 const video::SColor colorCone = 0xFFFFFFFF) const =0;
112
113
114 //! Create a sphere mesh.
115 /**
116 \param radius Radius of the sphere
117 \param polyCountX Number of quads used for the horizontal tiling
118 \param polyCountY Number of quads used for the vertical tiling
119 \return Generated mesh.
120 */
121 virtual IMesh* createSphereMesh(f32 radius = 5.f,
122 u32 polyCountX = 16, u32 polyCountY = 16) const =0;
123
124 //! Create a cylinder mesh.
125 /**
126 \param radius Radius of the cylinder.
127 \param length Length of the cylinder.
128 \param tesselation Number of quads around the circumference of the cylinder.
129 \param color The color of the cylinder.
130 \param closeTop If true, close the ends of the cylinder, otherwise leave them open.
131 \param oblique (to be documented)
132 \return Generated mesh.
133 */
134 virtual IMesh* createCylinderMesh(f32 radius, f32 length,
135 u32 tesselation,
136 const video::SColor& color=video::SColor(0xffffffff),
137 bool closeTop=true, f32 oblique=0.f) const =0;
138
139 //! Create a cone mesh.
140 /**
141 \param radius Radius of the cone.
142 \param length Length of the cone.
143 \param tesselation Number of quads around the circumference of the cone.
144 \param colorTop The color of the top of the cone.
145 \param colorBottom The color of the bottom of the cone.
146 \param oblique (to be documented)
147 \return Generated mesh.
148 */
149 virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tesselation,
150 const video::SColor& colorTop=video::SColor(0xffffffff),
151 const video::SColor& colorBottom=video::SColor(0xffffffff),
152 f32 oblique=0.f) const =0;
153
154 //! Create a volume light mesh.
155 /**
156 \param subdivideU Horizontal patch count.
157 \param subdivideV Vertical patch count.
158 \param footColor Color at the bottom of the light.
159 \param tailColor Color at the mid of the light.
160 \param lpDistance Virtual distance of the light point for normals.
161 \param lightDim Dimensions of the light.
162 \return Generated mesh.
163 */
164 virtual IMesh* createVolumeLightMesh(
165 const u32 subdivideU=32, const u32 subdivideV=32,
166 const video::SColor footColor = 0xffffffff,
167 const video::SColor tailColor = 0xffffffff,
168 const f32 lpDistance = 8.f,
169 const core::vector3df& lightDim = core::vector3df(1.f,1.2f,1.f)) const =0;
170};
171
172
173} // end namespace scene
174} // end namespace irr
175
176#endif // __I_GEOMETRY_CREATOR_H_INCLUDED__
177
diff --git a/src/others/irrlicht-1.8.1/include/IImage.h b/src/others/irrlicht-1.8.1/include/IImage.h
new file mode 100644
index 0000000..2cb1f8c
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IImage.h
@@ -0,0 +1,155 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_IMAGE_H_INCLUDED__
6#define __I_IMAGE_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "position2d.h"
10#include "rect.h"
11#include "SColor.h"
12
13namespace irr
14{
15namespace video
16{
17
18//! Interface for software image data.
19/** Image loaders create these images from files. IVideoDrivers convert
20these images into their (hardware) textures.
21*/
22class IImage : public virtual IReferenceCounted
23{
24public:
25
26 //! Lock function. Use this to get a pointer to the image data.
27 /** After you don't need the pointer anymore, you must call unlock().
28 \return Pointer to the image data. What type of data is pointed to
29 depends on the color format of the image. For example if the color
30 format is ECF_A8R8G8B8, it is of u32. Be sure to call unlock() after
31 you don't need the pointer any more. */
32 virtual void* lock() = 0;
33
34 //! Unlock function.
35 /** Should be called after the pointer received by lock() is not
36 needed anymore. */
37 virtual void unlock() = 0;
38
39 //! Returns width and height of image data.
40 virtual const core::dimension2d<u32>& getDimension() const = 0;
41
42 //! Returns bits per pixel.
43 virtual u32 getBitsPerPixel() const = 0;
44
45 //! Returns bytes per pixel
46 virtual u32 getBytesPerPixel() const = 0;
47
48 //! Returns image data size in bytes
49 virtual u32 getImageDataSizeInBytes() const = 0;
50
51 //! Returns image data size in pixels
52 virtual u32 getImageDataSizeInPixels() const = 0;
53
54 //! Returns a pixel
55 virtual SColor getPixel(u32 x, u32 y) const = 0;
56
57 //! Sets a pixel
58 virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ) = 0;
59
60 //! Returns the color format
61 virtual ECOLOR_FORMAT getColorFormat() const = 0;
62
63 //! Returns mask for red value of a pixel
64 virtual u32 getRedMask() const = 0;
65
66 //! Returns mask for green value of a pixel
67 virtual u32 getGreenMask() const = 0;
68
69 //! Returns mask for blue value of a pixel
70 virtual u32 getBlueMask() const = 0;
71
72 //! Returns mask for alpha value of a pixel
73 virtual u32 getAlphaMask() const = 0;
74
75 //! Returns pitch of image
76 virtual u32 getPitch() const =0;
77
78 //! Copies the image into the target, scaling the image to fit
79 virtual void copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0) =0;
80
81 //! Copies the image into the target, scaling the image to fit
82 virtual void copyToScaling(IImage* target) =0;
83
84 //! copies this surface into another
85 virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0)) =0;
86
87 //! copies this surface into another
88 virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0) =0;
89
90 //! copies this surface into another, using the alpha mask and cliprect and a color to add with
91 virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos,
92 const core::rect<s32>& sourceRect, const SColor &color,
93 const core::rect<s32>* clipRect = 0) =0;
94
95 //! copies this surface into another, scaling it to fit, appyling a box filter
96 virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false) = 0;
97
98 //! fills the surface with given color
99 virtual void fill(const SColor &color) =0;
100
101 //! get the amount of Bits per Pixel of the given color format
102 static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
103 {
104 switch(format)
105 {
106 case ECF_A1R5G5B5:
107 return 16;
108 case ECF_R5G6B5:
109 return 16;
110 case ECF_R8G8B8:
111 return 24;
112 case ECF_A8R8G8B8:
113 return 32;
114 case ECF_R16F:
115 return 16;
116 case ECF_G16R16F:
117 return 32;
118 case ECF_A16B16G16R16F:
119 return 64;
120 case ECF_R32F:
121 return 32;
122 case ECF_G32R32F:
123 return 64;
124 case ECF_A32B32G32R32F:
125 return 128;
126 default:
127 return 0;
128 }
129 }
130
131 //! test if the color format is only viable for RenderTarget textures
132 /** Since we don't have support for e.g. floating point IImage formats
133 one should test if the color format can be used for arbitrary usage, or
134 if it is restricted to RTTs. */
135 static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
136 {
137 switch(format)
138 {
139 case ECF_A1R5G5B5:
140 case ECF_R5G6B5:
141 case ECF_R8G8B8:
142 case ECF_A8R8G8B8:
143 return false;
144 default:
145 return true;
146 }
147 }
148
149};
150
151} // end namespace video
152} // end namespace irr
153
154#endif
155
diff --git a/src/others/irrlicht-1.8.1/include/IImageLoader.h b/src/others/irrlicht-1.8.1/include/IImageLoader.h
new file mode 100644
index 0000000..5ff091d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IImageLoader.h
@@ -0,0 +1,53 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SURFACE_LOADER_H_INCLUDED__
6#define __I_SURFACE_LOADER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "IImage.h"
10#include "path.h"
11
12namespace irr
13{
14namespace io
15{
16 class IReadFile;
17} // end namespace io
18namespace video
19{
20
21//! Class which is able to create a image from a file.
22/** If you want the Irrlicht Engine be able to load textures of
23currently unsupported file formats (e.g .gif), then implement
24this and add your new Surface loader with
25IVideoDriver::addExternalImageLoader() to the engine. */
26class IImageLoader : public virtual IReferenceCounted
27{
28public:
29
30 //! Check if the file might be loaded by this class
31 /** Check is based on the file extension (e.g. ".tga")
32 \param filename Name of file to check.
33 \return True if file seems to be loadable. */
34 virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
35
36 //! Check if the file might be loaded by this class
37 /** Check might look into the file.
38 \param file File handle to check.
39 \return True if file seems to be loadable. */
40 virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;
41
42 //! Creates a surface from the file
43 /** \param file File handle to check.
44 \return Pointer to newly created image, or 0 upon error. */
45 virtual IImage* loadImage(io::IReadFile* file) const = 0;
46};
47
48
49} // end namespace video
50} // end namespace irr
51
52#endif
53
diff --git a/src/others/irrlicht-1.8.1/include/IImageWriter.h b/src/others/irrlicht-1.8.1/include/IImageWriter.h
new file mode 100644
index 0000000..884a488
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IImageWriter.h
@@ -0,0 +1,45 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef _I_IMAGE_WRITER_H_INCLUDED__
6#define _I_IMAGE_WRITER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrString.h"
10#include "coreutil.h"
11
12namespace irr
13{
14namespace io
15{
16 class IWriteFile;
17} // end namespace io
18
19namespace video
20{
21 class IImage;
22
23
24//! Interface for writing software image data.
25class IImageWriter : public IReferenceCounted
26{
27public:
28 //! Check if this writer can write a file with the given extension
29 /** \param filename Name of the file to check.
30 \return True if file extension specifies a writable type. */
31 virtual bool isAWriteableFileExtension(const io::path& filename) const = 0;
32
33 //! Write image to file
34 /** \param file File handle to write to.
35 \param image Image to write into file.
36 \param param Writer specific parameter, influencing e.g. quality.
37 \return True if image was successfully written. */
38 virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param = 0) const = 0;
39};
40
41} // namespace video
42} // namespace irr
43
44#endif // _I_IMAGE_WRITER_H_INCLUDED__
45
diff --git a/src/others/irrlicht-1.8.1/include/IIndexBuffer.h b/src/others/irrlicht-1.8.1/include/IIndexBuffer.h
new file mode 100644
index 0000000..5599b0f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IIndexBuffer.h
@@ -0,0 +1,65 @@
1// Copyright (C) 2008-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_INDEX_BUFFER_H_INCLUDED__
6#define __I_INDEX_BUFFER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrArray.h"
10
11#include "SVertexIndex.h"
12
13namespace irr
14{
15
16namespace video
17{
18
19}
20
21namespace scene
22{
23
24 class IIndexBuffer : public virtual IReferenceCounted
25 {
26 public:
27
28 virtual void* getData() =0;
29
30 virtual video::E_INDEX_TYPE getType() const =0;
31 virtual void setType(video::E_INDEX_TYPE IndexType) =0;
32
33 virtual u32 stride() const =0;
34
35 virtual u32 size() const =0;
36 virtual void push_back (const u32 &element) =0;
37 virtual u32 operator [](u32 index) const =0;
38 virtual u32 getLast() =0;
39 virtual void setValue(u32 index, u32 value) =0;
40 virtual void set_used(u32 usedNow) =0;
41 virtual void reallocate(u32 new_size) =0;
42 virtual u32 allocated_size() const=0;
43
44 virtual void* pointer() =0;
45
46 //! get the current hardware mapping hint
47 virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0;
48
49 //! set the hardware mapping hint, for driver
50 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0;
51
52 //! flags the meshbuffer as changed, reloads hardware buffers
53 virtual void setDirty() = 0;
54
55 //! Get the currently used ID for identification of changes.
56 /** This shouldn't be used for anything outside the VideoDriver. */
57 virtual u32 getChangedID() const = 0;
58 };
59
60
61} // end namespace scene
62} // end namespace irr
63
64#endif
65
diff --git a/src/others/irrlicht-1.8.1/include/ILightManager.h b/src/others/irrlicht-1.8.1/include/ILightManager.h
new file mode 100644
index 0000000..ff66798
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ILightManager.h
@@ -0,0 +1,62 @@
1// Written by Colin MacDonald - all rights assigned to Nikolaus Gebhardt
2// Copyright (C) 2008-2012 Nikolaus Gebhardt
3// This file is part of the "Irrlicht Engine".
4// For conditions of distribution and use, see copyright notice in irrlicht.h
5
6#ifndef __I_LIGHT_MANAGER_H_INCLUDED__
7#define __I_LIGHT_MANAGER_H_INCLUDED__
8
9#include "IReferenceCounted.h"
10#include "irrArray.h"
11
12namespace irr
13{
14namespace scene
15{
16 class ILightSceneNode;
17
18 //! ILightManager provides an interface for user applications to manipulate the list of lights in the scene.
19 /** The light list can be trimmed or re-ordered before device/ hardware
20 lights are created, and/or individual lights can be switched on and off
21 before or after each scene node is rendered. It is assumed that the
22 ILightManager implementation will store any data that it wishes to
23 retain, i.e. the ISceneManager to which it is assigned, the lightList,
24 the current render pass, and the current scene node. */
25 class ILightManager : public IReferenceCounted
26 {
27 public:
28 //! Called after the scene's light list has been built, but before rendering has begun.
29 /** As actual device/hardware lights are not created until the
30 ESNRP_LIGHT render pass, this provides an opportunity for the
31 light manager to trim or re-order the light list, before any
32 device/hardware lights have actually been created.
33 \param lightList: the Scene Manager's light list, which
34 the light manager may modify. This reference will remain valid
35 until OnPostRender().
36 */
37 virtual void OnPreRender(core::array<ISceneNode*> & lightList) = 0;
38
39 //! Called after the last scene node is rendered.
40 /** After this call returns, the lightList passed to OnPreRender() becomes invalid. */
41 virtual void OnPostRender(void) = 0;
42
43 //! Called before a render pass begins
44 /** \param renderPass: the render pass that's about to begin */
45 virtual void OnRenderPassPreRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0;
46
47 //! Called after the render pass specified in OnRenderPassPreRender() ends
48 /** \param[in] renderPass: the render pass that has finished */
49 virtual void OnRenderPassPostRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0;
50
51 //! Called before the given scene node is rendered
52 /** \param[in] node: the scene node that's about to be rendered */
53 virtual void OnNodePreRender(ISceneNode* node) = 0;
54
55 //! Called after the the node specified in OnNodePreRender() has been rendered
56 /** \param[in] node: the scene node that has just been rendered */
57 virtual void OnNodePostRender(ISceneNode* node) = 0;
58 };
59} // end namespace scene
60} // end namespace irr
61
62#endif
diff --git a/src/others/irrlicht-1.8.1/include/ILightSceneNode.h b/src/others/irrlicht-1.8.1/include/ILightSceneNode.h
new file mode 100644
index 0000000..445ee2d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ILightSceneNode.h
@@ -0,0 +1,86 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_LIGHT_SCENE_NODE_H_INCLUDED__
6#define __I_LIGHT_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9#include "SLight.h"
10
11namespace irr
12{
13namespace scene
14{
15
16//! Scene node which is a dynamic light.
17/** You can switch the light on and off by making it visible or not. It can be
18animated by ordinary scene node animators. If the light type is directional or
19spot, the direction of the light source is defined by the rotation of the scene
20node (assuming (0,0,1) as the local direction of the light).
21*/
22class ILightSceneNode : public ISceneNode
23{
24public:
25
26 //! constructor
27 ILightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
28 const core::vector3df& position = core::vector3df(0,0,0))
29 : ISceneNode(parent, mgr, id, position) {}
30
31 //! Sets the light data associated with this ILightSceneNode
32 /** \param light The new light data. */
33 virtual void setLightData(const video::SLight& light) = 0;
34
35 //! Gets the light data associated with this ILightSceneNode
36 /** \return The light data. */
37 virtual const video::SLight& getLightData() const = 0;
38
39 //! Gets the light data associated with this ILightSceneNode
40 /** \return The light data. */
41 virtual video::SLight& getLightData() = 0;
42
43 //! Sets if the node should be visible or not.
44 /** All children of this node won't be visible either, when set
45 to true.
46 \param isVisible If the node shall be visible. */
47 virtual void setVisible(bool isVisible) = 0;
48
49 //! Sets the light's radius of influence.
50 /** Outside this radius the light won't lighten geometry and cast no
51 shadows. Setting the radius will also influence the attenuation, setting
52 it to (0,1/radius,0). If you want to override this behavior, set the
53 attenuation after the radius.
54 \param radius The new radius. */
55 virtual void setRadius(f32 radius) = 0;
56
57 //! Gets the light's radius of influence.
58 /** \return The current radius. */
59 virtual f32 getRadius() const = 0;
60
61 //! Sets the light type.
62 /** \param type The new type. */
63 virtual void setLightType(video::E_LIGHT_TYPE type) = 0;
64
65 //! Gets the light type.
66 /** \return The current light type. */
67 virtual video::E_LIGHT_TYPE getLightType() const = 0;
68
69 //! Sets whether this light casts shadows.
70 /** Enabling this flag won't automatically cast shadows, the meshes
71 will still need shadow scene nodes attached. But one can enable or
72 disable distinct lights for shadow casting for performance reasons.
73 \param shadow True if this light shall cast shadows. */
74 virtual void enableCastShadow(bool shadow=true) = 0;
75
76 //! Check whether this light casts shadows.
77 /** \return True if light would cast shadows, else false. */
78 virtual bool getCastShadow() const = 0;
79};
80
81} // end namespace scene
82} // end namespace irr
83
84
85#endif
86
diff --git a/src/others/irrlicht-1.8.1/include/ILogger.h b/src/others/irrlicht-1.8.1/include/ILogger.h
new file mode 100644
index 0000000..b6c9f6f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ILogger.h
@@ -0,0 +1,102 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_LOGGER_H_INCLUDED__
6#define __I_LOGGER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9
10namespace irr
11{
12
13//! Possible log levels.
14//! When used has filter ELL_DEBUG means => log everything and ELL_NONE means => log (nearly) nothing.
15//! When used to print logging information ELL_DEBUG will have lowest priority while ELL_NONE
16//! messages are never filtered and always printed.
17enum ELOG_LEVEL
18{
19 //! Used for printing information helpful in debugging
20 ELL_DEBUG,
21
22 //! Useful information to print. For example hardware infos or something started/stopped.
23 ELL_INFORMATION,
24
25 //! Warnings that something isn't as expected and can cause oddities
26 ELL_WARNING,
27
28 //! Something did go wrong.
29 ELL_ERROR,
30
31 //! Logs with ELL_NONE will never be filtered.
32 //! And used as filter it will remove all logging except ELL_NONE messages.
33 ELL_NONE
34};
35
36
37//! Interface for logging messages, warnings and errors
38class ILogger : public virtual IReferenceCounted
39{
40public:
41
42 //! Destructor
43 virtual ~ILogger() {}
44
45 //! Returns the current set log level.
46 virtual ELOG_LEVEL getLogLevel() const = 0;
47
48 //! Sets a new log level.
49 /** With this value, texts which are sent to the logger are filtered
50 out. For example setting this value to ELL_WARNING, only warnings and
51 errors are printed out. Setting it to ELL_INFORMATION, which is the
52 default setting, warnings, errors and informational texts are printed
53 out.
54 \param ll: new log level filter value. */
55 virtual void setLogLevel(ELOG_LEVEL ll) = 0;
56
57 //! Prints out a text into the log
58 /** \param text: Text to print out.
59 \param ll: Log level of the text. If the text is an error, set
60 it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
61 is just an informational text, set it to ELL_INFORMATION. Texts are
62 filtered with these levels. If you want to be a text displayed,
63 independent on what level filter is set, use ELL_NONE. */
64 virtual void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
65
66 //! Prints out a text into the log
67 /** \param text: Text to print out.
68 \param hint: Additional info. This string is added after a " :" to the
69 string.
70 \param ll: Log level of the text. If the text is an error, set
71 it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
72 is just an informational text, set it to ELL_INFORMATION. Texts are
73 filtered with these levels. If you want to be a text displayed,
74 independent on what level filter is set, use ELL_NONE. */
75 virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
76 virtual void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
77
78 //! Prints out a text into the log
79 /** \param text: Text to print out.
80 \param hint: Additional info. This string is added after a " :" to the
81 string.
82 \param ll: Log level of the text. If the text is an error, set
83 it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
84 is just an informational text, set it to ELL_INFORMATION. Texts are
85 filtered with these levels. If you want to be a text displayed,
86 independent on what level filter is set, use ELL_NONE. */
87 virtual void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
88
89 //! Prints out a text into the log
90 /** \param text: Text to print out.
91 \param ll: Log level of the text. If the text is an error, set
92 it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
93 is just an informational text, set it to ELL_INFORMATION. Texts are
94 filtered with these levels. If you want to be a text displayed,
95 independent on what level filter is set, use ELL_NONE. */
96 virtual void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
97};
98
99} // end namespace
100
101#endif
102
diff --git a/src/others/irrlicht-1.8.1/include/IMaterialRenderer.h b/src/others/irrlicht-1.8.1/include/IMaterialRenderer.h
new file mode 100644
index 0000000..1828a71
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMaterialRenderer.h
@@ -0,0 +1,101 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_MATERIAL_RENDERER_H_INCLUDED__
6#define __I_MATERIAL_RENDERER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "SMaterial.h"
10#include "S3DVertex.h"
11
12namespace irr
13{
14namespace video
15{
16
17class IVideoDriver;
18class IMaterialRendererServices;
19
20//! Interface for material rendering.
21/** Can be used to extend the engine with new materials. Refer to
22IVideoDriver::addMaterialRenderer() for more informations on how to extend the
23engine with new materials. */
24class IMaterialRenderer : public virtual IReferenceCounted
25{
26public:
27
28 //! Called by the IVideoDriver implementation the let the renderer set its needed render states.
29 /** This is called during the IVideoDriver::setMaterial() call.
30 When overriding this, you can set some renderstates or for example a
31 vertex or pixel shader if you like.
32 \param material: The new material parameters to be set. The renderer
33 may change the material flags in this material. For example if this
34 material does not accept the zbuffer = true, it can set it to false.
35 This is useful, because in the next lastMaterial will be just the
36 material in this call.
37 \param lastMaterial: The material parameters which have been set before
38 this material.
39 \param resetAllRenderstates: True if all renderstates should really be
40 reset. This is usually true if the last rendering mode was not a usual
41 3d rendering mode, but for example a 2d rendering mode.
42 You should reset really all renderstates if this is true, no matter if
43 the lastMaterial had some similar settings. This is used because in
44 most cases, some common renderstates are not changed if they are
45 already there, for example bilinear filtering, wireframe,
46 gouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and
47 fogenable.
48 \param services: Interface providing some methods for changing
49 advanced, internal states of a IVideoDriver. */
50 virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
51 bool resetAllRenderstates, IMaterialRendererServices* services) {}
52
53 //! Called every time before a new bunch of geometry is being drawn using this material with for example drawIndexedTriangleList() call.
54 /** OnSetMaterial should normally only be called if the renderer decides
55 that the renderstates should be changed, it won't be called if for
56 example two drawIndexedTriangleList() will be called with the same
57 material set. This method will be called every time. This is useful for
58 example for materials with shaders, which don't only set new
59 renderstates but also shader constants.
60 \param service: Pointer to interface providing methos for setting
61 constants and other things.
62 \param vtxtype: Vertex type with which the next rendering will be done.
63 This can be used by the material renderer to set some specific
64 optimized shaders or if this is an incompatible vertex type for this
65 renderer, to refuse rendering for example.
66 \return Returns true if everything is ok, and false if nothing should
67 be rendered. The material renderer can choose to return false for
68 example if he doesn't support the specified vertex type. This is
69 actually done in D3D8 and D3D9 when using a normal mapped material with
70 a vertex type other than EVT_TANGENTS. */
71 virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) { return true; }
72
73 //! Called by the IVideoDriver to unset this material.
74 /** Called during the IVideoDriver::setMaterial() call before the new
75 material will get the OnSetMaterial() call. */
76 virtual void OnUnsetMaterial() {}
77
78 //! Returns if the material is transparent.
79 /** The scene managment needs to know this
80 for being able to sort the materials by opaque and transparent. */
81 virtual bool isTransparent() const { return false; }
82
83 //! Returns the render capability of the material.
84 /** Because some more complex materials
85 are implemented in multiple ways and need special hardware capabilities, it is possible
86 to query how the current material renderer is performing on the current hardware with this
87 function.
88 \return Returns 0 if everything is running fine. Any other value is material renderer
89 specific and means for example that the renderer switched back to a fall back material because
90 it cannot use the latest shaders. More specific examples:
91 Fixed function pipeline materials should return 0 in most cases, parallax mapped
92 material will only return 0 when at least pixel shader 1.4 is available on that machine. */
93 virtual s32 getRenderCapability() const { return 0; }
94};
95
96
97} // end namespace video
98} // end namespace irr
99
100#endif
101
diff --git a/src/others/irrlicht-1.8.1/include/IMaterialRendererServices.h b/src/others/irrlicht-1.8.1/include/IMaterialRendererServices.h
new file mode 100644
index 0000000..9f045b5
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMaterialRendererServices.h
@@ -0,0 +1,115 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__
6#define __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__
7
8#include "SMaterial.h"
9#include "S3DVertex.h"
10
11namespace irr
12{
13namespace video
14{
15
16class IVideoDriver;
17
18
19//! Interface providing some methods for changing advanced, internal states of a IVideoDriver.
20class IMaterialRendererServices
21{
22public:
23
24 //! Destructor
25 virtual ~IMaterialRendererServices() {}
26
27 //! Can be called by an IMaterialRenderer to make its work easier.
28 /** Sets all basic renderstates if needed.
29 Basic render states are diffuse, ambient, specular, and emissive color,
30 specular power, bilinear and trilinear filtering, wireframe mode,
31 grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and
32 fog enabling.
33 \param material The new material to be used.
34 \param lastMaterial The material used until now.
35 \param resetAllRenderstates Set to true if all renderstates should be
36 set, regardless of their current state. */
37 virtual void setBasicRenderStates(const SMaterial& material,
38 const SMaterial& lastMaterial,
39 bool resetAllRenderstates) = 0;
40
41 //! Sets a constant for the vertex shader based on a name.
42 /** This can be used if you used a high level shader language like GLSL
43 or HLSL to create a shader. Example: If you created a shader which has
44 variables named 'mWorldViewProj' (containing the WorldViewProjection
45 matrix) and another one named 'fTime' containing one float, you can set
46 them in your IShaderConstantSetCallBack derived class like this:
47 \code
48 virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
49 {
50 video::IVideoDriver* driver = services->getVideoDriver();
51
52 f32 time = (f32)os::Timer::getTime()/100000.0f;
53 services->setVertexShaderConstant("fTime", &time, 1);
54
55 core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
56 worldViewProj *= driver->getTransform(video::ETS_VIEW);
57 worldViewProj *= driver->getTransform(video::ETS_WORLD);
58 services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
59 }
60 \endcode
61 \param name Name of the variable
62 \param floats Pointer to array of floats
63 \param count Amount of floats in array.
64 \return True if successful.
65 */
66 virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0;
67
68 //! Bool interface for the above.
69 virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count) = 0;
70
71 //! Int interface for the above.
72 virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count) = 0;
73
74 //! Sets a vertex shader constant.
75 /** Can be used if you created a shader using pixel/vertex shader
76 assembler or ARB_fragment_program or ARB_vertex_program.
77 \param data: Data to be set in the constants
78 \param startRegister: First register to be set
79 \param constantAmount: Amount of registers to be set. One register consists of 4 floats. */
80 virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
81
82 //! Sets a constant for the pixel shader based on a name.
83 /** This can be used if you used a high level shader language like GLSL
84 or HLSL to create a shader. See setVertexShaderConstant() for an
85 example on how to use this.
86 \param name Name of the variable
87 \param floats Pointer to array of floats
88 \param count Amount of floats in array.
89 \return True if successful. */
90 virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0;
91
92 //! Bool interface for the above.
93 virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count) = 0;
94
95 //! Int interface for the above.
96 virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count) = 0;
97
98 //! Sets a pixel shader constant.
99 /** Can be used if you created a shader using pixel/vertex shader
100 assembler or ARB_fragment_program or ARB_vertex_program.
101 \param data Data to be set in the constants
102 \param startRegister First register to be set.
103 \param constantAmount Amount of registers to be set. One register consists of 4 floats. */
104 virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
105
106 //! Get pointer to the IVideoDriver interface
107 /** \return Pointer to the IVideoDriver interface */
108 virtual IVideoDriver* getVideoDriver() = 0;
109};
110
111} // end namespace video
112} // end namespace irr
113
114#endif
115
diff --git a/src/others/irrlicht-1.8.1/include/IMesh.h b/src/others/irrlicht-1.8.1/include/IMesh.h
new file mode 100644
index 0000000..8e0bcc2
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMesh.h
@@ -0,0 +1,75 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_MESH_H_INCLUDED__
6#define __I_MESH_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "SMaterial.h"
10#include "EHardwareBufferFlags.h"
11
12namespace irr
13{
14namespace scene
15{
16 class IMeshBuffer;
17
18 //! Class which holds the geometry of an object.
19 /** An IMesh is nothing more than a collection of some mesh buffers
20 (IMeshBuffer). SMesh is a simple implementation of an IMesh.
21 A mesh is usually added to an IMeshSceneNode in order to be rendered.
22 */
23 class IMesh : public virtual IReferenceCounted
24 {
25 public:
26
27 //! Get the amount of mesh buffers.
28 /** \return Amount of mesh buffers (IMeshBuffer) in this mesh. */
29 virtual u32 getMeshBufferCount() const = 0;
30
31 //! Get pointer to a mesh buffer.
32 /** \param nr: Zero based index of the mesh buffer. The maximum value is
33 getMeshBufferCount() - 1;
34 \return Pointer to the mesh buffer or 0 if there is no such
35 mesh buffer. */
36 virtual IMeshBuffer* getMeshBuffer(u32 nr) const = 0;
37
38 //! Get pointer to a mesh buffer which fits a material
39 /** \param material: material to search for
40 \return Pointer to the mesh buffer or 0 if there is no such
41 mesh buffer. */
42 virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const = 0;
43
44 //! Get an axis aligned bounding box of the mesh.
45 /** \return Bounding box of this mesh. */
46 virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
47
48 //! Set user-defined axis aligned bounding box
49 /** \param box New bounding box to use for the mesh. */
50 virtual void setBoundingBox( const core::aabbox3df& box) = 0;
51
52 //! Sets a flag of all contained materials to a new value.
53 /** \param flag: Flag to set in all materials.
54 \param newvalue: New value to set in all materials. */
55 virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) = 0;
56
57 //! Set the hardware mapping hint
58 /** This methods allows to define optimization hints for the
59 hardware. This enables, e.g., the use of hardware buffers on
60 pltforms that support this feature. This can lead to noticeable
61 performance gains. */
62 virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0;
63
64 //! Flag the meshbuffer as changed, reloads hardware buffers
65 /** This method has to be called every time the vertices or
66 indices have changed. Otherwise, changes won't be updated
67 on the GPU in the next render cycle. */
68 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0;
69 };
70
71} // end namespace scene
72} // end namespace irr
73
74#endif
75
diff --git a/src/others/irrlicht-1.8.1/include/IMeshBuffer.h b/src/others/irrlicht-1.8.1/include/IMeshBuffer.h
new file mode 100644
index 0000000..44b865b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMeshBuffer.h
@@ -0,0 +1,154 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_MESH_BUFFER_H_INCLUDED__
6#define __I_MESH_BUFFER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "SMaterial.h"
10#include "aabbox3d.h"
11#include "S3DVertex.h"
12#include "SVertexIndex.h"
13#include "EHardwareBufferFlags.h"
14#include "EPrimitiveTypes.h"
15
16namespace irr
17{
18namespace scene
19{
20 //! Struct for holding a mesh with a single material.
21 /** A part of an IMesh which has the same material on each face of that
22 group. Logical groups of an IMesh need not be put into separate mesh
23 buffers, but can be. Separately animated parts of the mesh must be put
24 into separate mesh buffers.
25 Some mesh buffer implementations have limitations on the number of
26 vertices the buffer can hold. In that case, logical grouping can help.
27 Moreover, the number of vertices should be optimized for the GPU upload,
28 which often depends on the type of gfx card. Typial figures are
29 1000-10000 vertices per buffer.
30 SMeshBuffer is a simple implementation of a MeshBuffer, which supports
31 up to 65535 vertices.
32
33 Since meshbuffers are used for drawing, and hence will be exposed
34 to the driver, chances are high that they are grab()'ed from somewhere.
35 It's therefore required to dynamically allocate meshbuffers which are
36 passed to a video driver and only drop the buffer once it's not used in
37 the current code block anymore.
38 */
39 class IMeshBuffer : public virtual IReferenceCounted
40 {
41 public:
42
43 //! Get the material of this meshbuffer
44 /** \return Material of this buffer. */
45 virtual video::SMaterial& getMaterial() = 0;
46
47 //! Get the material of this meshbuffer
48 /** \return Material of this buffer. */
49 virtual const video::SMaterial& getMaterial() const = 0;
50
51 //! Get type of vertex data which is stored in this meshbuffer.
52 /** \return Vertex type of this buffer. */
53 virtual video::E_VERTEX_TYPE getVertexType() const = 0;
54
55 //! Get access to vertex data. The data is an array of vertices.
56 /** Which vertex type is used can be determined by getVertexType().
57 \return Pointer to array of vertices. */
58 virtual const void* getVertices() const = 0;
59
60 //! Get access to vertex data. The data is an array of vertices.
61 /** Which vertex type is used can be determined by getVertexType().
62 \return Pointer to array of vertices. */
63 virtual void* getVertices() = 0;
64
65 //! Get amount of vertices in meshbuffer.
66 /** \return Number of vertices in this buffer. */
67 virtual u32 getVertexCount() const = 0;
68
69 //! Get type of index data which is stored in this meshbuffer.
70 /** \return Index type of this buffer. */
71 virtual video::E_INDEX_TYPE getIndexType() const =0;
72
73 //! Get access to Indices.
74 /** \return Pointer to indices array. */
75 virtual const u16* getIndices() const = 0;
76
77 //! Get access to Indices.
78 /** \return Pointer to indices array. */
79 virtual u16* getIndices() = 0;
80
81 //! Get amount of indices in this meshbuffer.
82 /** \return Number of indices in this buffer. */
83 virtual u32 getIndexCount() const = 0;
84
85 //! Get the axis aligned bounding box of this meshbuffer.
86 /** \return Axis aligned bounding box of this buffer. */
87 virtual const core::aabbox3df& getBoundingBox() const = 0;
88
89 //! Set axis aligned bounding box
90 /** \param box User defined axis aligned bounding box to use
91 for this buffer. */
92 virtual void setBoundingBox(const core::aabbox3df& box) = 0;
93
94 //! Recalculates the bounding box. Should be called if the mesh changed.
95 virtual void recalculateBoundingBox() = 0;
96
97 //! returns position of vertex i
98 virtual const core::vector3df& getPosition(u32 i) const = 0;
99
100 //! returns position of vertex i
101 virtual core::vector3df& getPosition(u32 i) = 0;
102
103 //! returns normal of vertex i
104 virtual const core::vector3df& getNormal(u32 i) const = 0;
105
106 //! returns normal of vertex i
107 virtual core::vector3df& getNormal(u32 i) = 0;
108
109 //! returns texture coord of vertex i
110 virtual const core::vector2df& getTCoords(u32 i) const = 0;
111
112 //! returns texture coord of vertex i
113 virtual core::vector2df& getTCoords(u32 i) = 0;
114
115 //! Append the vertices and indices to the current buffer
116 /** Only works for compatible vertex types.
117 \param vertices Pointer to a vertex array.
118 \param numVertices Number of vertices in the array.
119 \param indices Pointer to index array.
120 \param numIndices Number of indices in array. */
121 virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) = 0;
122
123 //! Append the meshbuffer to the current buffer
124 /** Only works for compatible vertex types
125 \param other Buffer to append to this one. */
126 virtual void append(const IMeshBuffer* const other) = 0;
127
128 //! get the current hardware mapping hint
129 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const = 0;
130
131 //! get the current hardware mapping hint
132 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const = 0;
133
134 //! set the hardware mapping hint, for driver
135 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) = 0;
136
137 //! flags the meshbuffer as changed, reloads hardware buffers
138 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0;
139
140 //! Get the currently used ID for identification of changes.
141 /** This shouldn't be used for anything outside the VideoDriver. */
142 virtual u32 getChangedID_Vertex() const = 0;
143
144 //! Get the currently used ID for identification of changes.
145 /** This shouldn't be used for anything outside the VideoDriver. */
146 virtual u32 getChangedID_Index() const = 0;
147 };
148
149} // end namespace scene
150} // end namespace irr
151
152#endif
153
154
diff --git a/src/others/irrlicht-1.8.1/include/IMeshCache.h b/src/others/irrlicht-1.8.1/include/IMeshCache.h
new file mode 100644
index 0000000..083fc5b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMeshCache.h
@@ -0,0 +1,177 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_MESH_CACHE_H_INCLUDED__
6#define __I_MESH_CACHE_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "path.h"
10
11namespace irr
12{
13
14namespace scene
15{
16 class IMesh;
17 class IAnimatedMesh;
18 class IAnimatedMeshSceneNode;
19 class IMeshLoader;
20
21 //! The mesh cache stores already loaded meshes and provides an interface to them.
22 /** You can access it using ISceneManager::getMeshCache(). All existing
23 scene managers will return a pointer to the same mesh cache, because it
24 is shared between them. With this interface, it is possible to manually
25 add new loaded meshes (if ISceneManager::getMesh() is not sufficient),
26 to remove them and to iterate through already loaded meshes. */
27 class IMeshCache : public virtual IReferenceCounted
28 {
29 public:
30
31 //! Destructor
32 virtual ~IMeshCache() {}
33
34 //! Adds a mesh to the internal list of loaded meshes.
35 /** Usually, ISceneManager::getMesh() is called to load a mesh
36 from a file. That method searches the list of loaded meshes if
37 a mesh has already been loaded and returns a pointer to if it
38 is in that list and already in memory. Otherwise it loads the
39 mesh. With IMeshCache::addMesh(), it is possible to pretend
40 that a mesh already has been loaded. This method can be used
41 for example by mesh loaders who need to load more than one mesh
42 with one call. They can add additional meshes with this method
43 to the scene manager. The COLLADA loader for example uses this
44 method.
45 \param name Name of the mesh. When calling
46 ISceneManager::getMesh() with this name it will return the mesh
47 set by this method.
48 \param mesh Pointer to a mesh which will now be referenced by
49 this name. */
50 virtual void addMesh(const io::path& name, IAnimatedMesh* mesh) = 0;
51
52 //! Removes the mesh from the cache.
53 /** After loading a mesh with getMesh(), the mesh can be
54 removed from the cache using this method, freeing a lot of
55 memory.
56 \param mesh Pointer to the mesh which shall be removed. */
57 virtual void removeMesh(const IMesh* const mesh) = 0;
58
59 //! Returns amount of loaded meshes in the cache.
60 /** You can load new meshes into the cache using getMesh() and
61 addMesh(). If you ever need to access the internal mesh cache,
62 you can do this using removeMesh(), getMeshNumber(),
63 getMeshByIndex() and getMeshName().
64 \return Number of meshes in cache. */
65 virtual u32 getMeshCount() const = 0;
66
67 //! Returns current index number of the mesh or -1 when not found.
68 /** \param mesh Pointer to the mesh to search for.
69 \return Index of the mesh in the cache, or -1 if not found. */
70 virtual s32 getMeshIndex(const IMesh* const mesh) const = 0;
71
72 //! Returns a mesh based on its index number.
73 /** \param index: Index of the mesh, number between 0 and
74 getMeshCount()-1.
75 Note that this number is only valid until a new mesh is loaded
76 or removed.
77 \return Pointer to the mesh or 0 if there is none with this
78 number. */
79 virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0;
80
81 //! Returns a mesh based on its name (often a filename).
82 /** \deprecated Use getMeshByName() instead. This method may be removed by
83 Irrlicht 1.9 */
84 _IRR_DEPRECATED_ IAnimatedMesh* getMeshByFilename(const io::path& filename)
85 {
86 return getMeshByName(filename);
87 }
88
89 //! Get the name of a loaded mesh, based on its index. (Name is often identical to the filename).
90 /** \deprecated Use getMeshName() instead. This method may be removed by
91 Irrlicht 1.9 */
92 _IRR_DEPRECATED_ const io::path& getMeshFilename(u32 index) const
93 {
94 return getMeshName(index).getInternalName();
95 }
96
97 //! Get the name of a loaded mesh, if there is any. (Name is often identical to the filename).
98 /** \deprecated Use getMeshName() instead. This method may be removed by
99 Irrlicht 1.9 */
100 _IRR_DEPRECATED_ const io::path& getMeshFilename(const IMesh* const mesh) const
101 {
102 return getMeshName(mesh).getInternalName();
103 }
104
105 //! Renames a loaded mesh.
106 /** \deprecated Use renameMesh() instead. This method may be removed by
107 Irrlicht 1.9 */
108 _IRR_DEPRECATED_ bool setMeshFilename(u32 index, const io::path& filename)
109 {
110 return renameMesh(index, filename);
111 }
112
113 //! Renames a loaded mesh.
114 /** \deprecated Use renameMesh() instead. This method may be removed by
115 Irrlicht 1.9 */
116 _IRR_DEPRECATED_ bool setMeshFilename(const IMesh* const mesh, const io::path& filename)
117 {
118 return renameMesh(mesh, filename);
119 }
120
121 //! Returns a mesh based on its name.
122 /** \param name Name of the mesh. Usually a filename.
123 \return Pointer to the mesh or 0 if there is none with this number. */
124 virtual IAnimatedMesh* getMeshByName(const io::path& name) = 0;
125
126 //! Get the name of a loaded mesh, based on its index.
127 /** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
128 \return The name if mesh was found and has a name, else the path is empty. */
129 virtual const io::SNamedPath& getMeshName(u32 index) const = 0;
130
131 //! Get the name of the loaded mesh if there is any.
132 /** \param mesh Pointer to mesh to query.
133 \return The name if mesh was found and has a name, else the path is empty. */
134 virtual const io::SNamedPath& getMeshName(const IMesh* const mesh) const = 0;
135
136 //! Renames a loaded mesh.
137 /** Note that renaming meshes might change the ordering of the
138 meshes, and so the index of the meshes as returned by
139 getMeshIndex() or taken by some methods will change.
140 \param index The index of the mesh in the cache.
141 \param name New name for the mesh.
142 \return True if mesh was renamed. */
143 virtual bool renameMesh(u32 index, const io::path& name) = 0;
144
145 //! Renames the loaded mesh
146 /** Note that renaming meshes might change the ordering of the
147 meshes, and so the index of the meshes as returned by
148 getMeshIndex() or taken by some methods will change.
149 \param mesh Mesh to be renamed.
150 \param name New name for the mesh.
151 \return True if mesh was renamed. */
152 virtual bool renameMesh(const IMesh* const mesh, const io::path& name) = 0;
153
154 //! Check if a mesh was already loaded.
155 /** \param name Name of the mesh. Usually a filename.
156 \return True if the mesh has been loaded, else false. */
157 virtual bool isMeshLoaded(const io::path& name) = 0;
158
159 //! Clears the whole mesh cache, removing all meshes.
160 /** All meshes will be reloaded completely when using ISceneManager::getMesh()
161 after calling this method.
162 Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh()
163 and you did not grab them, then they may become invalid. */
164 virtual void clear() = 0;
165
166 //! Clears all meshes that are held in the mesh cache but not used anywhere else.
167 /** Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh()
168 and you did not grab them, then they may become invalid. */
169 virtual void clearUnusedMeshes() = 0;
170 };
171
172
173} // end namespace scene
174} // end namespace irr
175
176#endif
177
diff --git a/src/others/irrlicht-1.8.1/include/IMeshLoader.h b/src/others/irrlicht-1.8.1/include/IMeshLoader.h
new file mode 100644
index 0000000..7f874c0
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMeshLoader.h
@@ -0,0 +1,53 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_MESH_LOADER_H_INCLUDED__
6#define __I_MESH_LOADER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "path.h"
10
11namespace irr
12{
13namespace io
14{
15 class IReadFile;
16} // end namespace io
17namespace scene
18{
19 class IAnimatedMesh;
20
21//! Class which is able to load an animated mesh from a file.
22/** If you want Irrlicht be able to load meshes of
23currently unsupported file formats (e.g. .cob), then implement
24this and add your new Meshloader with
25ISceneManager::addExternalMeshLoader() to the engine. */
26class IMeshLoader : public virtual IReferenceCounted
27{
28public:
29
30 //! Destructor
31 virtual ~IMeshLoader() {}
32
33 //! Returns true if the file might be loaded by this class.
34 /** This decision should be based on the file extension (e.g. ".cob")
35 only.
36 \param filename Name of the file to test.
37 \return True if the file might be loaded by this class. */
38 virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
39
40 //! Creates/loads an animated mesh from the file.
41 /** \param file File handler to load the file from.
42 \return Pointer to the created mesh. Returns 0 if loading failed.
43 If you no longer need the mesh, you should call IAnimatedMesh::drop().
44 See IReferenceCounted::drop() for more information. */
45 virtual IAnimatedMesh* createMesh(io::IReadFile* file) = 0;
46};
47
48
49} // end namespace scene
50} // end namespace irr
51
52#endif
53
diff --git a/src/others/irrlicht-1.8.1/include/IMeshManipulator.h b/src/others/irrlicht-1.8.1/include/IMeshManipulator.h
new file mode 100644
index 0000000..3476c57
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMeshManipulator.h
@@ -0,0 +1,393 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_MESH_MANIPULATOR_H_INCLUDED__
6#define __I_MESH_MANIPULATOR_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "vector3d.h"
10#include "aabbox3d.h"
11#include "matrix4.h"
12#include "IAnimatedMesh.h"
13#include "IMeshBuffer.h"
14#include "SVertexManipulator.h"
15
16namespace irr
17{
18namespace scene
19{
20
21 struct SMesh;
22
23 //! An interface for easy manipulation of meshes.
24 /** Scale, set alpha value, flip surfaces, and so on. This exists for
25 fixing problems with wrong imported or exported meshes quickly after
26 loading. It is not intended for doing mesh modifications and/or
27 animations during runtime.
28 */
29 class IMeshManipulator : public virtual IReferenceCounted
30 {
31 public:
32
33 //! Flips the direction of surfaces.
34 /** Changes backfacing triangles to frontfacing
35 triangles and vice versa.
36 \param mesh Mesh on which the operation is performed. */
37 virtual void flipSurfaces(IMesh* mesh) const = 0;
38
39 //! Sets the alpha vertex color value of the whole mesh to a new value.
40 /** \param mesh Mesh on which the operation is performed.
41 \param alpha New alpha value. Must be a value between 0 and 255. */
42 void setVertexColorAlpha(IMesh* mesh, s32 alpha) const
43 {
44 apply(scene::SVertexColorSetAlphaManipulator(alpha), mesh);
45 }
46
47 //! Sets the alpha vertex color value of the whole mesh to a new value.
48 /** \param buffer Meshbuffer on which the operation is performed.
49 \param alpha New alpha value. Must be a value between 0 and 255. */
50 void setVertexColorAlpha(IMeshBuffer* buffer, s32 alpha) const
51 {
52 apply(scene::SVertexColorSetAlphaManipulator(alpha), buffer);
53 }
54
55 //! Sets the colors of all vertices to one color
56 /** \param mesh Mesh on which the operation is performed.
57 \param color New color. */
58 void setVertexColors(IMesh* mesh, video::SColor color) const
59 {
60 apply(scene::SVertexColorSetManipulator(color), mesh);
61 }
62
63 //! Sets the colors of all vertices to one color
64 /** \param buffer Meshbuffer on which the operation is performed.
65 \param color New color. */
66 void setVertexColors(IMeshBuffer* buffer, video::SColor color) const
67 {
68 apply(scene::SVertexColorSetManipulator(color), buffer);
69 }
70
71 //! Recalculates all normals of the mesh.
72 /** \param mesh: Mesh on which the operation is performed.
73 \param smooth: If the normals shall be smoothed.
74 \param angleWeighted: If the normals shall be smoothed in relation to their angles. More expensive, but also higher precision. */
75 virtual void recalculateNormals(IMesh* mesh, bool smooth = false,
76 bool angleWeighted = false) const=0;
77
78 //! Recalculates all normals of the mesh buffer.
79 /** \param buffer: Mesh buffer on which the operation is performed.
80 \param smooth: If the normals shall be smoothed.
81 \param angleWeighted: If the normals shall be smoothed in relation to their angles. More expensive, but also higher precision. */
82 virtual void recalculateNormals(IMeshBuffer* buffer,
83 bool smooth = false, bool angleWeighted = false) const=0;
84
85 //! Recalculates tangents, requires a tangent mesh
86 /** \param mesh Mesh on which the operation is performed.
87 \param recalculateNormals If the normals shall be recalculated, otherwise original normals of the mesh are used unchanged.
88 \param smooth If the normals shall be smoothed.
89 \param angleWeighted If the normals shall be smoothed in relation to their angles. More expensive, but also higher precision.
90 */
91 virtual void recalculateTangents(IMesh* mesh,
92 bool recalculateNormals=false, bool smooth=false,
93 bool angleWeighted=false) const=0;
94
95 //! Recalculates tangents, requires a tangent mesh buffer
96 /** \param buffer Meshbuffer on which the operation is performed.
97 \param recalculateNormals If the normals shall be recalculated, otherwise original normals of the buffer are used unchanged.
98 \param smooth If the normals shall be smoothed.
99 \param angleWeighted If the normals shall be smoothed in relation to their angles. More expensive, but also higher precision.
100 */
101 virtual void recalculateTangents(IMeshBuffer* buffer,
102 bool recalculateNormals=false, bool smooth=false,
103 bool angleWeighted=false) const=0;
104
105 //! Scales the actual mesh, not a scene node.
106 /** \param mesh Mesh on which the operation is performed.
107 \param factor Scale factor for each axis. */
108 void scale(IMesh* mesh, const core::vector3df& factor) const
109 {
110 apply(SVertexPositionScaleManipulator(factor), mesh, true);
111 }
112
113 //! Scales the actual meshbuffer, not a scene node.
114 /** \param buffer Meshbuffer on which the operation is performed.
115 \param factor Scale factor for each axis. */
116 void scale(IMeshBuffer* buffer, const core::vector3df& factor) const
117 {
118 apply(SVertexPositionScaleManipulator(factor), buffer, true);
119 }
120
121 //! Scales the actual mesh, not a scene node.
122 /** \deprecated Use scale() instead. This method may be removed by Irrlicht 1.9
123 \param mesh Mesh on which the operation is performed.
124 \param factor Scale factor for each axis. */
125 _IRR_DEPRECATED_ void scaleMesh(IMesh* mesh, const core::vector3df& factor) const {return scale(mesh,factor);}
126
127 //! Scale the texture coords of a mesh.
128 /** \param mesh Mesh on which the operation is performed.
129 \param factor Vector which defines the scale for each axis.
130 \param level Number of texture coord, starting from 1. Support for level 2 exists for LightMap buffers. */
131 void scaleTCoords(scene::IMesh* mesh, const core::vector2df& factor, u32 level=1) const
132 {
133 apply(SVertexTCoordsScaleManipulator(factor, level), mesh);
134 }
135
136 //! Scale the texture coords of a meshbuffer.
137 /** \param buffer Meshbuffer on which the operation is performed.
138 \param factor Vector which defines the scale for each axis.
139 \param level Number of texture coord, starting from 1. Support for level 2 exists for LightMap buffers. */
140 void scaleTCoords(scene::IMeshBuffer* buffer, const core::vector2df& factor, u32 level=1) const
141 {
142 apply(SVertexTCoordsScaleManipulator(factor, level), buffer);
143 }
144
145 //! Applies a transformation to a mesh
146 /** \param mesh Mesh on which the operation is performed.
147 \param m transformation matrix. */
148 void transform(IMesh* mesh, const core::matrix4& m) const
149 {
150 apply(SVertexPositionTransformManipulator(m), mesh, true);
151 }
152
153 //! Applies a transformation to a meshbuffer
154 /** \param buffer Meshbuffer on which the operation is performed.
155 \param m transformation matrix. */
156 void transform(IMeshBuffer* buffer, const core::matrix4& m) const
157 {
158 apply(SVertexPositionTransformManipulator(m), buffer, true);
159 }
160
161 //! Applies a transformation to a mesh
162 /** \deprecated Use transform() instead. This method may be removed by Irrlicht 1.9
163 \param mesh Mesh on which the operation is performed.
164 \param m transformation matrix. */
165 _IRR_DEPRECATED_ virtual void transformMesh(IMesh* mesh, const core::matrix4& m) const {return transform(mesh,m);}
166
167 //! Creates a planar texture mapping on the mesh
168 /** \param mesh: Mesh on which the operation is performed.
169 \param resolution: resolution of the planar mapping. This is
170 the value specifying which is the relation between world space
171 and texture coordinate space. */
172 virtual void makePlanarTextureMapping(IMesh* mesh, f32 resolution=0.001f) const=0;
173
174 //! Creates a planar texture mapping on the meshbuffer
175 /** \param meshbuffer: Buffer on which the operation is performed.
176 \param resolution: resolution of the planar mapping. This is
177 the value specifying which is the relation between world space
178 and texture coordinate space. */
179 virtual void makePlanarTextureMapping(scene::IMeshBuffer* meshbuffer, f32 resolution=0.001f) const=0;
180
181 //! Creates a planar texture mapping on the buffer
182 /** This method is currently implemented towards the LWO planar mapping. A more general biasing might be required.
183 \param mesh Mesh on which the operation is performed.
184 \param resolutionS Resolution of the planar mapping in horizontal direction. This is the ratio between object space and texture space.
185 \param resolutionT Resolution of the planar mapping in vertical direction. This is the ratio between object space and texture space.
186 \param axis The axis along which the texture is projected. The allowed values are 0 (X), 1(Y), and 2(Z).
187 \param offset Vector added to the vertex positions (in object coordinates).
188 */
189 virtual void makePlanarTextureMapping(scene::IMesh* mesh,
190 f32 resolutionS, f32 resolutionT,
191 u8 axis, const core::vector3df& offset) const=0;
192
193 //! Creates a planar texture mapping on the meshbuffer
194 /** This method is currently implemented towards the LWO planar mapping. A more general biasing might be required.
195 \param buffer Buffer on which the operation is performed.
196 \param resolutionS Resolution of the planar mapping in horizontal direction. This is the ratio between object space and texture space.
197 \param resolutionT Resolution of the planar mapping in vertical direction. This is the ratio between object space and texture space.
198 \param axis The axis along which the texture is projected. The allowed values are 0 (X), 1(Y), and 2(Z).
199 \param offset Vector added to the vertex positions (in object coordinates).
200 */
201 virtual void makePlanarTextureMapping(scene::IMeshBuffer* buffer,
202 f32 resolutionS, f32 resolutionT,
203 u8 axis, const core::vector3df& offset) const=0;
204
205 //! Clones a static IMesh into a modifiable SMesh.
206 /** All meshbuffers in the returned SMesh
207 are of type SMeshBuffer or SMeshBufferLightMap.
208 \param mesh Mesh to copy.
209 \return Cloned mesh. If you no longer need the
210 cloned mesh, you should call SMesh::drop(). See
211 IReferenceCounted::drop() for more information. */
212 virtual SMesh* createMeshCopy(IMesh* mesh) const = 0;
213
214 //! Creates a copy of the mesh, which will only consist of S3DVertexTangents vertices.
215 /** This is useful if you want to draw tangent space normal
216 mapped geometry because it calculates the tangent and binormal
217 data which is needed there.
218 \param mesh Input mesh
219 \param recalculateNormals The normals are recalculated if set,
220 otherwise the original ones are kept. Note that keeping the
221 normals may introduce inaccurate tangents if the normals are
222 very different to those calculated from the faces.
223 \param smooth The normals/tangents are smoothed across the
224 meshbuffer's faces if this flag is set.
225 \param angleWeighted Improved smoothing calculation used
226 \param recalculateTangents Whether are actually calculated, or just the mesh with proper type is created.
227 \return Mesh consisting only of S3DVertexTangents vertices. If
228 you no longer need the cloned mesh, you should call
229 IMesh::drop(). See IReferenceCounted::drop() for more
230 information. */
231 virtual IMesh* createMeshWithTangents(IMesh* mesh,
232 bool recalculateNormals=false, bool smooth=false,
233 bool angleWeighted=false, bool recalculateTangents=true) const=0;
234
235 //! Creates a copy of the mesh, which will only consist of S3DVertex2TCoord vertices.
236 /** \param mesh Input mesh
237 \return Mesh consisting only of S3DVertex2TCoord vertices. If
238 you no longer need the cloned mesh, you should call
239 IMesh::drop(). See IReferenceCounted::drop() for more
240 information. */
241 virtual IMesh* createMeshWith2TCoords(IMesh* mesh) const = 0;
242
243 //! Creates a copy of the mesh, which will only consist of S3DVertex vertices.
244 /** \param mesh Input mesh
245 \return Mesh consisting only of S3DVertex vertices. If
246 you no longer need the cloned mesh, you should call
247 IMesh::drop(). See IReferenceCounted::drop() for more
248 information. */
249 virtual IMesh* createMeshWith1TCoords(IMesh* mesh) const = 0;
250
251 //! Creates a copy of a mesh with all vertices unwelded
252 /** \param mesh Input mesh
253 \return Mesh consisting only of unique faces. All vertices
254 which were previously shared are now duplicated. If you no
255 longer need the cloned mesh, you should call IMesh::drop(). See
256 IReferenceCounted::drop() for more information. */
257 virtual IMesh* createMeshUniquePrimitives(IMesh* mesh) const = 0;
258
259 //! Creates a copy of a mesh with vertices welded
260 /** \param mesh Input mesh
261 \param tolerance The threshold for vertex comparisons.
262 \return Mesh without redundant vertices. If you no longer need
263 the cloned mesh, you should call IMesh::drop(). See
264 IReferenceCounted::drop() for more information. */
265 virtual IMesh* createMeshWelded(IMesh* mesh, f32 tolerance=core::ROUNDING_ERROR_f32) const = 0;
266
267 //! Get amount of polygons in mesh.
268 /** \param mesh Input mesh
269 \return Number of polygons in mesh. */
270 virtual s32 getPolyCount(IMesh* mesh) const = 0;
271
272 //! Get amount of polygons in mesh.
273 /** \param mesh Input mesh
274 \return Number of polygons in mesh. */
275 virtual s32 getPolyCount(IAnimatedMesh* mesh) const = 0;
276
277 //! Create a new AnimatedMesh and adds the mesh to it
278 /** \param mesh Input mesh
279 \param type The type of the animated mesh to create.
280 \return Newly created animated mesh with mesh as its only
281 content. When you don't need the animated mesh anymore, you
282 should call IAnimatedMesh::drop(). See
283 IReferenceCounted::drop() for more information. */
284 virtual IAnimatedMesh * createAnimatedMesh(IMesh* mesh,
285 scene::E_ANIMATED_MESH_TYPE type = scene::EAMT_UNKNOWN) const = 0;
286
287 //! Vertex cache optimization according to the Forsyth paper
288 /** More information can be found at
289 http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
290
291 The function is thread-safe (read: you can optimize several
292 meshes in different threads).
293
294 \param mesh Source mesh for the operation.
295 \return A new mesh optimized for the vertex cache. */
296 virtual IMesh* createForsythOptimizedMesh(const IMesh *mesh) const = 0;
297
298 //! Apply a manipulator on the Meshbuffer
299 /** \param func A functor defining the mesh manipulation.
300 \param buffer The Meshbuffer to apply the manipulator to.
301 \param boundingBoxUpdate Specifies if the bounding box should be updated during manipulation.
302 \return True if the functor was successfully applied, else false. */
303 template <typename Functor>
304 bool apply(const Functor& func, IMeshBuffer* buffer, bool boundingBoxUpdate=false) const
305 {
306 return apply_(func, buffer, boundingBoxUpdate, func);
307 }
308
309
310 //! Apply a manipulator on the Mesh
311 /** \param func A functor defining the mesh manipulation.
312 \param mesh The Mesh to apply the manipulator to.
313 \param boundingBoxUpdate Specifies if the bounding box should be updated during manipulation.
314 \return True if the functor was successfully applied, else false. */
315 template <typename Functor>
316 bool apply(const Functor& func, IMesh* mesh, bool boundingBoxUpdate=false) const
317 {
318 if (!mesh)
319 return true;
320 bool result = true;
321 core::aabbox3df bufferbox;
322 for (u32 i=0; i<mesh->getMeshBufferCount(); ++i)
323 {
324 result &= apply(func, mesh->getMeshBuffer(i), boundingBoxUpdate);
325 if (boundingBoxUpdate)
326 {
327 if (0==i)
328 bufferbox.reset(mesh->getMeshBuffer(i)->getBoundingBox());
329 else
330 bufferbox.addInternalBox(mesh->getMeshBuffer(i)->getBoundingBox());
331 }
332 }
333 if (boundingBoxUpdate)
334 mesh->setBoundingBox(bufferbox);
335 return result;
336 }
337
338protected:
339 //! Apply a manipulator based on the type of the functor
340 /** \param func A functor defining the mesh manipulation.
341 \param buffer The Meshbuffer to apply the manipulator to.
342 \param boundingBoxUpdate Specifies if the bounding box should be updated during manipulation.
343 \param typeTest Unused parameter, which handles the proper call selection based on the type of the Functor which is passed in two times.
344 \return True if the functor was successfully applied, else false. */
345 template <typename Functor>
346 bool apply_(const Functor& func, IMeshBuffer* buffer, bool boundingBoxUpdate, const IVertexManipulator& typeTest) const
347 {
348 if (!buffer)
349 return true;
350
351 core::aabbox3df bufferbox;
352 for (u32 i=0; i<buffer->getVertexCount(); ++i)
353 {
354 switch (buffer->getVertexType())
355 {
356 case video::EVT_STANDARD:
357 {
358 video::S3DVertex* verts = (video::S3DVertex*)buffer->getVertices();
359 func(verts[i]);
360 }
361 break;
362 case video::EVT_2TCOORDS:
363 {
364 video::S3DVertex2TCoords* verts = (video::S3DVertex2TCoords*)buffer->getVertices();
365 func(verts[i]);
366 }
367 break;
368 case video::EVT_TANGENTS:
369 {
370 video::S3DVertexTangents* verts = (video::S3DVertexTangents*)buffer->getVertices();
371 func(verts[i]);
372 }
373 break;
374 }
375 if (boundingBoxUpdate)
376 {
377 if (0==i)
378 bufferbox.reset(buffer->getPosition(0));
379 else
380 bufferbox.addInternalPoint(buffer->getPosition(i));
381 }
382 }
383 if (boundingBoxUpdate)
384 buffer->setBoundingBox(bufferbox);
385 return true;
386 }
387};
388
389} // end namespace scene
390} // end namespace irr
391
392
393#endif
diff --git a/src/others/irrlicht-1.8.1/include/IMeshSceneNode.h b/src/others/irrlicht-1.8.1/include/IMeshSceneNode.h
new file mode 100644
index 0000000..fdffc03
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMeshSceneNode.h
@@ -0,0 +1,79 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_MESH_SCENE_NODE_H_INCLUDED__
6#define __I_MESH_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9
10namespace irr
11{
12namespace scene
13{
14
15class IShadowVolumeSceneNode;
16class IMesh;
17
18
19//! A scene node displaying a static mesh
20class IMeshSceneNode : public ISceneNode
21{
22public:
23
24 //! Constructor
25 /** Use setMesh() to set the mesh to display.
26 */
27 IMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
28 const core::vector3df& position = core::vector3df(0,0,0),
29 const core::vector3df& rotation = core::vector3df(0,0,0),
30 const core::vector3df& scale = core::vector3df(1,1,1))
31 : ISceneNode(parent, mgr, id, position, rotation, scale) {}
32
33 //! Sets a new mesh to display
34 /** \param mesh Mesh to display. */
35 virtual void setMesh(IMesh* mesh) = 0;
36
37 //! Get the currently defined mesh for display.
38 /** \return Pointer to mesh which is displayed by this node. */
39 virtual IMesh* getMesh(void) = 0;
40
41 //! Creates shadow volume scene node as child of this node.
42 /** The shadow can be rendered using the ZPass or the zfail
43 method. ZPass is a little bit faster because the shadow volume
44 creation is easier, but with this method there occur ugly
45 looking artifacs when the camera is inside the shadow volume.
46 These error do not occur with the ZFail method.
47 \param shadowMesh: Optional custom mesh for shadow volume.
48 \param id: Id of the shadow scene node. This id can be used to
49 identify the node later.
50 \param zfailmethod: If set to true, the shadow will use the
51 zfail method, if not, zpass is used.
52 \param infinity: Value used by the shadow volume algorithm to
53 scale the shadow volume (for zfail shadow volume we support only
54 finite shadows, so camera zfar must be larger than shadow back cap,
55 which is depend on infinity parameter).
56 \return Pointer to the created shadow scene node. This pointer
57 should not be dropped. See IReferenceCounted::drop() for more
58 information. */
59 virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh=0,
60 s32 id=-1, bool zfailmethod=true, f32 infinity=1000.0f) = 0;
61
62 //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
63 /** In this way it is possible to change the materials of a mesh
64 causing all mesh scene nodes referencing this mesh to change, too.
65 \param readonly Flag if the materials shall be read-only. */
66 virtual void setReadOnlyMaterials(bool readonly) = 0;
67
68 //! Check if the scene node should not copy the materials of the mesh but use them in a read only style
69 /** This flag can be set by setReadOnlyMaterials().
70 \return Whether the materials are read-only. */
71 virtual bool isReadOnlyMaterials() const = 0;
72};
73
74} // end namespace scene
75} // end namespace irr
76
77
78#endif
79
diff --git a/src/others/irrlicht-1.8.1/include/IMeshWriter.h b/src/others/irrlicht-1.8.1/include/IMeshWriter.h
new file mode 100644
index 0000000..555a798
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMeshWriter.h
@@ -0,0 +1,58 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_I_MESH_WRITER_H_INCLUDED__
6#define __IRR_I_MESH_WRITER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "EMeshWriterEnums.h"
10
11namespace irr
12{
13namespace io
14{
15 class IWriteFile;
16} // end namespace io
17
18namespace scene
19{
20 class IMesh;
21
22 //! Interface for writing meshes
23 class IMeshWriter : public virtual IReferenceCounted
24 {
25 public:
26
27 //! Destructor
28 virtual ~IMeshWriter() {}
29
30 //! Get the type of the mesh writer
31 /** For own implementations, use MAKE_IRR_ID as shown in the
32 EMESH_WRITER_TYPE enumeration to return your own unique mesh
33 type id.
34 \return Type of the mesh writer. */
35 virtual EMESH_WRITER_TYPE getType() const = 0;
36
37 //! Write a static mesh.
38 /** \param file File handle to write the mesh to.
39 \param mesh Pointer to mesh to be written.
40 \param flags Optional flags to set properties of the writer.
41 \return True if sucessful */
42 virtual bool writeMesh(io::IWriteFile* file, scene::IMesh* mesh,
43 s32 flags=EMWF_NONE) = 0;
44
45 // Writes an animated mesh
46 // for future use, no writer is able to write animated meshes currently
47 /* \return Returns true if sucessful */
48 //virtual bool writeAnimatedMesh(io::IWriteFile* file,
49 // scene::IAnimatedMesh* mesh,
50 // s32 flags=EMWF_NONE) = 0;
51 };
52
53
54} // end namespace
55} // end namespace
56
57#endif
58
diff --git a/src/others/irrlicht-1.8.1/include/IMetaTriangleSelector.h b/src/others/irrlicht-1.8.1/include/IMetaTriangleSelector.h
new file mode 100644
index 0000000..2cbb385
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMetaTriangleSelector.h
@@ -0,0 +1,43 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_META_TRIANGLE_SELECTOR_H_INCLUDED__
6#define __I_META_TRIANGLE_SELECTOR_H_INCLUDED__
7
8#include "ITriangleSelector.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! Interface for making multiple triangle selectors work as one big selector.
16/** This is nothing more than a collection of one or more triangle selectors
17providing together the interface of one triangle selector. In this way,
18collision tests can be done with different triangle soups in one pass.
19*/
20class IMetaTriangleSelector : public ITriangleSelector
21{
22public:
23
24 //! Adds a triangle selector to the collection of triangle selectors.
25 /** \param toAdd: Pointer to an triangle selector to add to the list. */
26 virtual void addTriangleSelector(ITriangleSelector* toAdd) = 0;
27
28 //! Removes a specific triangle selector from the collection.
29 /** \param toRemove: Pointer to an triangle selector which is in the
30 list but will be removed.
31 \return True if successful, false if not. */
32 virtual bool removeTriangleSelector(ITriangleSelector* toRemove) = 0;
33
34 //! Removes all triangle selectors from the collection.
35 virtual void removeAllTriangleSelectors() = 0;
36};
37
38} // end namespace scene
39} // end namespace irr
40
41
42#endif
43
diff --git a/src/others/irrlicht-1.8.1/include/IOSOperator.h b/src/others/irrlicht-1.8.1/include/IOSOperator.h
new file mode 100644
index 0000000..22fb691
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IOSOperator.h
@@ -0,0 +1,50 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_OS_OPERATOR_H_INCLUDED__
6#define __I_OS_OPERATOR_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrString.h"
10
11namespace irr
12{
13
14//! The Operating system operator provides operation system specific methods and informations.
15class IOSOperator : public virtual IReferenceCounted
16{
17public:
18 //! Get the current operation system version as string.
19 virtual const core::stringc& getOperatingSystemVersion() const = 0;
20
21 //! Get the current operation system version as string.
22 /** \deprecated Use getOperatingSystemVersion instead. This method will be removed in Irrlicht 1.9. */
23 _IRR_DEPRECATED_ const wchar_t* getOperationSystemVersion() const
24 {
25 return core::stringw(getOperatingSystemVersion()).c_str();
26 }
27
28 //! Copies text to the clipboard
29 virtual void copyToClipboard(const c8* text) const = 0;
30
31 //! Get text from the clipboard
32 /** \return Returns 0 if no string is in there. */
33 virtual const c8* getTextFromClipboard() const = 0;
34
35 //! Get the processor speed in megahertz
36 /** \param MHz The integer variable to store the speed in.
37 \return True if successful, false if not */
38 virtual bool getProcessorSpeedMHz(u32* MHz) const = 0;
39
40 //! Get the total and available system RAM
41 /** \param Total: will contain the total system memory
42 \param Avail: will contain the available memory
43 \return True if successful, false if not */
44 virtual bool getSystemMemory(u32* Total, u32* Avail) const = 0;
45
46};
47
48} // end namespace
49
50#endif
diff --git a/src/others/irrlicht-1.8.1/include/IParticleAffector.h b/src/others/irrlicht-1.8.1/include/IParticleAffector.h
new file mode 100644
index 0000000..e2b83e8
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleAffector.h
@@ -0,0 +1,72 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_AFFECTOR_H_INCLUDED__
6#define __I_PARTICLE_AFFECTOR_H_INCLUDED__
7
8#include "IAttributeExchangingObject.h"
9#include "SParticle.h"
10
11namespace irr
12{
13namespace scene
14{
15
16//! Types of built in particle affectors
17enum E_PARTICLE_AFFECTOR_TYPE
18{
19 EPAT_NONE = 0,
20 EPAT_ATTRACT,
21 EPAT_FADE_OUT,
22 EPAT_GRAVITY,
23 EPAT_ROTATE,
24 EPAT_SCALE,
25 EPAT_COUNT
26};
27
28//! Names for built in particle affectors
29const c8* const ParticleAffectorTypeNames[] =
30{
31 "None",
32 "Attract",
33 "FadeOut",
34 "Gravity",
35 "Rotate",
36 "Scale",
37 0
38};
39
40//! A particle affector modifies particles.
41class IParticleAffector : public virtual io::IAttributeExchangingObject
42{
43public:
44
45 //! constructor
46 IParticleAffector() : Enabled(true) {}
47
48 //! Affects an array of particles.
49 /** \param now Current time. (Same as ITimer::getTime() would return)
50 \param particlearray Array of particles.
51 \param count Amount of particles in array. */
52 virtual void affect(u32 now, SParticle* particlearray, u32 count) = 0;
53
54 //! Sets whether or not the affector is currently enabled.
55 virtual void setEnabled(bool enabled) { Enabled = enabled; }
56
57 //! Gets whether or not the affector is currently enabled.
58 virtual bool getEnabled() const { return Enabled; }
59
60 //! Get emitter type
61 virtual E_PARTICLE_AFFECTOR_TYPE getType() const = 0;
62
63protected:
64 bool Enabled;
65};
66
67} // end namespace scene
68} // end namespace irr
69
70
71#endif
72
diff --git a/src/others/irrlicht-1.8.1/include/IParticleAnimatedMeshSceneNodeEmitter.h b/src/others/irrlicht-1.8.1/include/IParticleAnimatedMeshSceneNodeEmitter.h
new file mode 100644
index 0000000..9be329d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleAnimatedMeshSceneNodeEmitter.h
@@ -0,0 +1,54 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__
6#define __I_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__
7
8#include "IParticleEmitter.h"
9#include "IAnimatedMeshSceneNode.h"
10
11namespace irr
12{
13namespace scene
14{
15
16//! A particle emitter which emits particles from mesh vertices.
17class IParticleAnimatedMeshSceneNodeEmitter : public IParticleEmitter
18{
19public:
20
21 //! Set Mesh to emit particles from
22 virtual void setAnimatedMeshSceneNode( IAnimatedMeshSceneNode* node ) = 0;
23
24 //! Set whether to use vertex normal for direction, or direction specified
25 virtual void setUseNormalDirection( bool useNormalDirection = true ) = 0;
26
27 //! Set the amount that the normal is divided by for getting a particles direction
28 virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) = 0;
29
30 //! Sets whether to emit min<->max particles for every vertex or to pick min<->max vertices
31 virtual void setEveryMeshVertex( bool everyMeshVertex = true ) = 0;
32
33 //! Get mesh we're emitting particles from
34 virtual const IAnimatedMeshSceneNode* getAnimatedMeshSceneNode() const = 0;
35
36 //! Get whether to use vertex normal for direction, or direction specified
37 virtual bool isUsingNormalDirection() const = 0;
38
39 //! Get the amount that the normal is divided by for getting a particles direction
40 virtual f32 getNormalDirectionModifier() const = 0;
41
42 //! Gets whether to emit min<->max particles for every vertex or to pick min<->max vertices
43 virtual bool getEveryMeshVertex() const = 0;
44
45 //! Get emitter type
46 virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_ANIMATED_MESH; }
47};
48
49} // end namespace scene
50} // end namespace irr
51
52
53#endif // __I_PARTICLE_ANIMATED_MESH_SCENE_NODE_EMITTER_H_INCLUDED__
54
diff --git a/src/others/irrlicht-1.8.1/include/IParticleAttractionAffector.h b/src/others/irrlicht-1.8.1/include/IParticleAttractionAffector.h
new file mode 100644
index 0000000..6f9d8ab
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleAttractionAffector.h
@@ -0,0 +1,59 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_ATTRACTION_AFFECTOR_H_INCLUDED__
6#define __I_PARTICLE_ATTRACTION_AFFECTOR_H_INCLUDED__
7
8#include "IParticleAffector.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A particle affector which attracts or detracts particles.
16class IParticleAttractionAffector : public IParticleAffector
17{
18public:
19
20 //! Set the point that particles will attract to
21 virtual void setPoint( const core::vector3df& point ) = 0;
22
23 //! Set whether or not the particles are attracting or detracting
24 virtual void setAttract( bool attract ) = 0;
25
26 //! Set whether or not this will affect particles in the X direction
27 virtual void setAffectX( bool affect ) = 0;
28
29 //! Set whether or not this will affect particles in the Y direction
30 virtual void setAffectY( bool affect ) = 0;
31
32 //! Set whether or not this will affect particles in the Z direction
33 virtual void setAffectZ( bool affect ) = 0;
34
35 //! Get the point that particles are attracted to
36 virtual const core::vector3df& getPoint() const = 0;
37
38 //! Get whether or not the particles are attracting or detracting
39 virtual bool getAttract() const = 0;
40
41 //! Get whether or not the particles X position are affected
42 virtual bool getAffectX() const = 0;
43
44 //! Get whether or not the particles Y position are affected
45 virtual bool getAffectY() const = 0;
46
47 //! Get whether or not the particles Z position are affected
48 virtual bool getAffectZ() const = 0;
49
50 //! Get emitter type
51 virtual E_PARTICLE_AFFECTOR_TYPE getType() const { return EPAT_ATTRACT; }
52};
53
54} // end namespace scene
55} // end namespace irr
56
57
58#endif // __I_PARTICLE_ATTRACTION_AFFECTOR_H_INCLUDED__
59
diff --git a/src/others/irrlicht-1.8.1/include/IParticleBoxEmitter.h b/src/others/irrlicht-1.8.1/include/IParticleBoxEmitter.h
new file mode 100644
index 0000000..d359272
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleBoxEmitter.h
@@ -0,0 +1,36 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_BOX_EMITTER_H_INCLUDED__
6#define __I_PARTICLE_BOX_EMITTER_H_INCLUDED__
7
8#include "IParticleEmitter.h"
9#include "aabbox3d.h"
10
11namespace irr
12{
13namespace scene
14{
15
16//! A particle emitter which emits particles from a box shaped space
17class IParticleBoxEmitter : public IParticleEmitter
18{
19public:
20
21 //! Set the box shape
22 virtual void setBox( const core::aabbox3df& box ) = 0;
23
24 //! Get the box shape set
25 virtual const core::aabbox3df& getBox() const = 0;
26
27 //! Get emitter type
28 virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_BOX; }
29};
30
31} // end namespace scene
32} // end namespace irr
33
34
35#endif
36
diff --git a/src/others/irrlicht-1.8.1/include/IParticleCylinderEmitter.h b/src/others/irrlicht-1.8.1/include/IParticleCylinderEmitter.h
new file mode 100644
index 0000000..dac5ebe
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleCylinderEmitter.h
@@ -0,0 +1,59 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_CYLINDER_EMITTER_H_INCLUDED__
6#define __I_PARTICLE_CYLINDER_EMITTER_H_INCLUDED__
7
8#include "IParticleEmitter.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A particle emitter which emits from a cylindrically shaped space.
16class IParticleCylinderEmitter : public IParticleEmitter
17{
18public:
19
20 //! Set the center of the radius for the cylinder, at one end of the cylinder
21 virtual void setCenter( const core::vector3df& center ) = 0;
22
23 //! Set the normal of the cylinder
24 virtual void setNormal( const core::vector3df& normal ) = 0;
25
26 //! Set the radius of the cylinder
27 virtual void setRadius( f32 radius ) = 0;
28
29 //! Set the length of the cylinder
30 virtual void setLength( f32 length ) = 0;
31
32 //! Set whether or not to draw points inside the cylinder
33 virtual void setOutlineOnly( bool outlineOnly = true ) = 0;
34
35 //! Get the center of the cylinder
36 virtual const core::vector3df& getCenter() const = 0;
37
38 //! Get the normal of the cylinder
39 virtual const core::vector3df& getNormal() const = 0;
40
41 //! Get the radius of the cylinder
42 virtual f32 getRadius() const = 0;
43
44 //! Get the center of the cylinder
45 virtual f32 getLength() const = 0;
46
47 //! Get whether or not to draw points inside the cylinder
48 virtual bool getOutlineOnly() const = 0;
49
50 //! Get emitter type
51 virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_CYLINDER; }
52};
53
54} // end namespace scene
55} // end namespace irr
56
57
58#endif
59
diff --git a/src/others/irrlicht-1.8.1/include/IParticleEmitter.h b/src/others/irrlicht-1.8.1/include/IParticleEmitter.h
new file mode 100644
index 0000000..4b88266
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleEmitter.h
@@ -0,0 +1,129 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_EMITTER_H_INCLUDED__
6#define __I_PARTICLE_EMITTER_H_INCLUDED__
7
8#include "IAttributeExchangingObject.h"
9#include "SParticle.h"
10
11namespace irr
12{
13namespace scene
14{
15
16//! Types of built in particle emitters
17enum E_PARTICLE_EMITTER_TYPE
18{
19 EPET_POINT = 0,
20 EPET_ANIMATED_MESH,
21 EPET_BOX,
22 EPET_CYLINDER,
23 EPET_MESH,
24 EPET_RING,
25 EPET_SPHERE,
26 EPET_COUNT
27};
28
29//! Names for built in particle emitters
30const c8* const ParticleEmitterTypeNames[] =
31{
32 "Point",
33 "AnimatedMesh",
34 "Box",
35 "Cylinder",
36 "Mesh",
37 "Ring",
38 "Sphere",
39 0
40};
41
42//! A particle emitter for using with particle systems.
43/** A Particle emitter emitts new particles into a particle system.
44*/
45class IParticleEmitter : public virtual io::IAttributeExchangingObject
46{
47public:
48
49 //! Prepares an array with new particles to emitt into the system
50 /** \param now Current time.
51 \param timeSinceLastCall Time elapsed since last call, in milliseconds.
52 \param outArray Pointer which will point to the array with the new
53 particles to add into the system.
54 \return Amount of new particles in the array. Can be 0. */
55 virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray) = 0;
56
57 //! Set direction the emitter emits particles
58 virtual void setDirection( const core::vector3df& newDirection ) = 0;
59
60 //! Set minimum number of particles the emitter emits per second
61 virtual void setMinParticlesPerSecond( u32 minPPS ) = 0;
62
63 //! Set maximum number of particles the emitter emits per second
64 virtual void setMaxParticlesPerSecond( u32 maxPPS ) = 0;
65
66 //! Set minimum starting color for particles
67 virtual void setMinStartColor( const video::SColor& color ) = 0;
68
69 //! Set maximum starting color for particles
70 virtual void setMaxStartColor( const video::SColor& color ) = 0;
71
72 //! Set the maximum starting size for particles
73 virtual void setMaxStartSize( const core::dimension2df& size ) = 0;
74
75 //! Set the minimum starting size for particles
76 virtual void setMinStartSize( const core::dimension2df& size ) = 0;
77
78 //! Set the minimum particle life-time in milliseconds
79 virtual void setMinLifeTime( u32 lifeTimeMin ) = 0;
80
81 //! Set the maximum particle life-time in milliseconds
82 virtual void setMaxLifeTime( u32 lifeTimeMax ) = 0;
83
84 //! Set maximal random derivation from the direction
85 virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) = 0;
86
87 //! Get direction the emitter emits particles
88 virtual const core::vector3df& getDirection() const = 0;
89
90 //! Get the minimum number of particles the emitter emits per second
91 virtual u32 getMinParticlesPerSecond() const = 0;
92
93 //! Get the maximum number of particles the emitter emits per second
94 virtual u32 getMaxParticlesPerSecond() const = 0;
95
96 //! Get the minimum starting color for particles
97 virtual const video::SColor& getMinStartColor() const = 0;
98
99 //! Get the maximum starting color for particles
100 virtual const video::SColor& getMaxStartColor() const = 0;
101
102 //! Get the maximum starting size for particles
103 virtual const core::dimension2df& getMaxStartSize() const = 0;
104
105 //! Get the minimum starting size for particles
106 virtual const core::dimension2df& getMinStartSize() const = 0;
107
108 //! Get the minimum particle life-time in milliseconds
109 virtual u32 getMinLifeTime() const = 0;
110
111 //! Get the maximum particle life-time in milliseconds
112 virtual u32 getMaxLifeTime() const = 0;
113
114 //! Get maximal random derivation from the direction
115 virtual s32 getMaxAngleDegrees() const = 0;
116
117
118 //! Get emitter type
119 virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_POINT; }
120};
121
122typedef IParticleEmitter IParticlePointEmitter;
123
124} // end namespace scene
125} // end namespace irr
126
127
128#endif
129
diff --git a/src/others/irrlicht-1.8.1/include/IParticleFadeOutAffector.h b/src/others/irrlicht-1.8.1/include/IParticleFadeOutAffector.h
new file mode 100644
index 0000000..759ba58
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleFadeOutAffector.h
@@ -0,0 +1,41 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_FADE_OUT_AFFECTOR_H_INCLUDED__
6#define __I_PARTICLE_FADE_OUT_AFFECTOR_H_INCLUDED__
7
8#include "IParticleAffector.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A particle affector which fades out the particles.
16class IParticleFadeOutAffector : public IParticleAffector
17{
18public:
19
20 //! Sets the targetColor, i.e. the color the particles will interpolate to over time.
21 virtual void setTargetColor( const video::SColor& targetColor ) = 0;
22
23 //! Sets the time in milliseconds it takes for each particle to fade out (minimal 1 ms)
24 virtual void setFadeOutTime( u32 fadeOutTime ) = 0;
25
26 //! Gets the targetColor, i.e. the color the particles will interpolate to over time.
27 virtual const video::SColor& getTargetColor() const = 0;
28
29 //! Gets the time in milliseconds it takes for each particle to fade out.
30 virtual u32 getFadeOutTime() const = 0;
31
32 //! Get emitter type
33 virtual E_PARTICLE_AFFECTOR_TYPE getType() const { return EPAT_FADE_OUT; }
34};
35
36} // end namespace scene
37} // end namespace irr
38
39
40#endif // __I_PARTICLE_FADE_OUT_AFFECTOR_H_INCLUDED__
41
diff --git a/src/others/irrlicht-1.8.1/include/IParticleGravityAffector.h b/src/others/irrlicht-1.8.1/include/IParticleGravityAffector.h
new file mode 100644
index 0000000..4113888
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleGravityAffector.h
@@ -0,0 +1,42 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_GRAVITY_AFFECTOR_H_INCLUDED__
6#define __I_PARTICLE_GRAVITY_AFFECTOR_H_INCLUDED__
7
8#include "IParticleAffector.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A particle affector which applies gravity to particles.
16class IParticleGravityAffector : public IParticleAffector
17{
18public:
19
20 //! Set the time in milliseconds when the gravity force is totally lost
21 /** At that point the particle does not move any more. */
22 virtual void setTimeForceLost( f32 timeForceLost ) = 0;
23
24 //! Set the direction and force of gravity in all 3 dimensions.
25 virtual void setGravity( const core::vector3df& gravity ) = 0;
26
27 //! Get the time in milliseconds when the gravity force is totally lost
28 virtual f32 getTimeForceLost() const = 0;
29
30 //! Get the direction and force of gravity.
31 virtual const core::vector3df& getGravity() const = 0;
32
33 //! Get emitter type
34 virtual E_PARTICLE_AFFECTOR_TYPE getType() const { return EPAT_GRAVITY; }
35};
36
37} // end namespace scene
38} // end namespace irr
39
40
41#endif // __I_PARTICLE_GRAVITY_AFFECTOR_H_INCLUDED__
42
diff --git a/src/others/irrlicht-1.8.1/include/IParticleMeshEmitter.h b/src/others/irrlicht-1.8.1/include/IParticleMeshEmitter.h
new file mode 100644
index 0000000..6550d24
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleMeshEmitter.h
@@ -0,0 +1,54 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_MESH_EMITTER_H_INCLUDED__
6#define __I_PARTICLE_MESH_EMITTER_H_INCLUDED__
7
8#include "IParticleEmitter.h"
9#include "IMesh.h"
10
11namespace irr
12{
13namespace scene
14{
15
16//! A particle emitter which emits from vertices of a mesh
17class IParticleMeshEmitter : public IParticleEmitter
18{
19public:
20
21 //! Set Mesh to emit particles from
22 virtual void setMesh( IMesh* mesh ) = 0;
23
24 //! Set whether to use vertex normal for direction, or direction specified
25 virtual void setUseNormalDirection( bool useNormalDirection = true ) = 0;
26
27 //! Set the amount that the normal is divided by for getting a particles direction
28 virtual void setNormalDirectionModifier( f32 normalDirectionModifier ) = 0;
29
30 //! Sets whether to emit min<->max particles for every vertex or to pick min<->max vertices
31 virtual void setEveryMeshVertex( bool everyMeshVertex = true ) = 0;
32
33 //! Get Mesh we're emitting particles from
34 virtual const IMesh* getMesh() const = 0;
35
36 //! Get whether to use vertex normal for direction, or direction specified
37 virtual bool isUsingNormalDirection() const = 0;
38
39 //! Get the amount that the normal is divided by for getting a particles direction
40 virtual f32 getNormalDirectionModifier() const = 0;
41
42 //! Gets whether to emit min<->max particles for every vertex or to pick min<->max vertices
43 virtual bool getEveryMeshVertex() const = 0;
44
45 //! Get emitter type
46 virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_MESH; }
47};
48
49} // end namespace scene
50} // end namespace irr
51
52
53#endif
54
diff --git a/src/others/irrlicht-1.8.1/include/IParticleRingEmitter.h b/src/others/irrlicht-1.8.1/include/IParticleRingEmitter.h
new file mode 100644
index 0000000..089b2ae
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleRingEmitter.h
@@ -0,0 +1,47 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_RING_EMITTER_H_INCLUDED__
6#define __I_PARTICLE_RING_EMITTER_H_INCLUDED__
7
8#include "IParticleEmitter.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A particle emitter which emits particles along a ring shaped area.
16class IParticleRingEmitter : public IParticleEmitter
17{
18public:
19
20 //! Set the center of the ring
21 virtual void setCenter( const core::vector3df& center ) = 0;
22
23 //! Set the radius of the ring
24 virtual void setRadius( f32 radius ) = 0;
25
26 //! Set the thickness of the ring
27 virtual void setRingThickness( f32 ringThickness ) = 0;
28
29 //! Get the center of the ring
30 virtual const core::vector3df& getCenter() const = 0;
31
32 //! Get the radius of the ring
33 virtual f32 getRadius() const = 0;
34
35 //! Get the thickness of the ring
36 virtual f32 getRingThickness() const = 0;
37
38 //! Get emitter type
39 virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_RING; }
40};
41
42} // end namespace scene
43} // end namespace irr
44
45
46#endif
47
diff --git a/src/others/irrlicht-1.8.1/include/IParticleRotationAffector.h b/src/others/irrlicht-1.8.1/include/IParticleRotationAffector.h
new file mode 100644
index 0000000..d7d4cce
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleRotationAffector.h
@@ -0,0 +1,41 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_ROTATION_AFFECTOR_H_INCLUDED__
6#define __I_PARTICLE_ROTATION_AFFECTOR_H_INCLUDED__
7
8#include "IParticleAffector.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A particle affector which rotates the particle system.
16class IParticleRotationAffector : public IParticleAffector
17{
18public:
19
20 //! Set the point that particles will rotate around
21 virtual void setPivotPoint( const core::vector3df& point ) = 0;
22
23 //! Set the speed in degrees per second in all 3 dimensions
24 virtual void setSpeed( const core::vector3df& speed ) = 0;
25
26 //! Get the point that particles are attracted to
27 virtual const core::vector3df& getPivotPoint() const = 0;
28
29 //! Get the speed in degrees per second in all 3 dimensions
30 virtual const core::vector3df& getSpeed() const = 0;
31
32 //! Get emitter type
33 virtual E_PARTICLE_AFFECTOR_TYPE getType() const { return EPAT_ROTATE; }
34};
35
36} // end namespace scene
37} // end namespace irr
38
39
40#endif // __I_PARTICLE_ROTATION_AFFECTOR_H_INCLUDED__
41
diff --git a/src/others/irrlicht-1.8.1/include/IParticleSphereEmitter.h b/src/others/irrlicht-1.8.1/include/IParticleSphereEmitter.h
new file mode 100644
index 0000000..75c14a8
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleSphereEmitter.h
@@ -0,0 +1,41 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_SPHERE_EMITTER_H_INCLUDED__
6#define __I_PARTICLE_SPHERE_EMITTER_H_INCLUDED__
7
8#include "IParticleEmitter.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A particle emitter which emits from a spherical space.
16class IParticleSphereEmitter : public IParticleEmitter
17{
18public:
19
20 //! Set the center of the sphere for particle emissions
21 virtual void setCenter( const core::vector3df& center ) = 0;
22
23 //! Set the radius of the sphere for particle emissions
24 virtual void setRadius( f32 radius ) = 0;
25
26 //! Get the center of the sphere for particle emissions
27 virtual const core::vector3df& getCenter() const = 0;
28
29 //! Get the radius of the sphere for particle emissions
30 virtual f32 getRadius() const = 0;
31
32 //! Get emitter type
33 virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_SPHERE; }
34};
35
36} // end namespace scene
37} // end namespace irr
38
39
40#endif
41
diff --git a/src/others/irrlicht-1.8.1/include/IParticleSystemSceneNode.h b/src/others/irrlicht-1.8.1/include/IParticleSystemSceneNode.h
new file mode 100644
index 0000000..adb2050
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IParticleSystemSceneNode.h
@@ -0,0 +1,512 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_PARTICLE_SYSTEM_SCENE_NODE_H_INCLUDED__
6#define __I_PARTICLE_SYSTEM_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9#include "IParticleAnimatedMeshSceneNodeEmitter.h"
10#include "IParticleBoxEmitter.h"
11#include "IParticleCylinderEmitter.h"
12#include "IParticleMeshEmitter.h"
13#include "IParticleRingEmitter.h"
14#include "IParticleSphereEmitter.h"
15#include "IParticleAttractionAffector.h"
16#include "IParticleFadeOutAffector.h"
17#include "IParticleGravityAffector.h"
18#include "IParticleRotationAffector.h"
19#include "dimension2d.h"
20
21namespace irr
22{
23namespace scene
24{
25
26//! A particle system scene node for creating snow, fire, exlosions, smoke...
27/** A scene node controlling a particle System. The behavior of the particles
28can be controlled by setting the right particle emitters and affectors.
29You can for example easily create a campfire by doing this:
30
31\code
32 scene::IParticleSystemSceneNode* p = scenemgr->addParticleSystemSceneNode();
33 p->setParticleSize(core::dimension2d<f32>(20.0f, 10.0f));
34 scene::IParticleEmitter* em = p->createBoxEmitter(
35 core::aabbox3d<f32>(-5,0,-5,5,1,5),
36 core::vector3df(0.0f,0.03f,0.0f),
37 40,80, video::SColor(0,255,255,255),video::SColor(0,255,255,255), 1100,2000);
38 p->setEmitter(em);
39 em->drop();
40 scene::IParticleAffector* paf = p->createFadeOutParticleAffector();
41 p->addAffector(paf);
42 paf->drop();
43\endcode
44
45*/
46class IParticleSystemSceneNode : public ISceneNode
47{
48public:
49
50 //! Constructor
51 IParticleSystemSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
52 const core::vector3df& position = core::vector3df(0,0,0),
53 const core::vector3df& rotation = core::vector3df(0,0,0),
54 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f))
55 : ISceneNode(parent, mgr, id, position, rotation, scale) {}
56
57 //! Sets the size of all particles.
58 virtual void setParticleSize(
59 const core::dimension2d<f32> &size = core::dimension2d<f32>(5.0f, 5.0f)) = 0;
60
61 //! Sets if the particles should be global.
62 /** If they are, the particles are affected by the movement of the
63 particle system scene node too, otherwise they completely ignore it.
64 Default is true. */
65 virtual void setParticlesAreGlobal(bool global=true) = 0;
66
67 //! Remove all currently visible particles
68 virtual void clearParticles() = 0;
69
70 //! Do manually update the particles.
71 //! This should only be called when you want to render the node outside the scenegraph,
72 //! as the node will care about this otherwise automatically.
73 virtual void doParticleSystem(u32 time) = 0;
74
75 //! Gets the particle emitter, which creates the particles.
76 /** \return The particle emitter. Can be 0 if none is set. */
77 virtual IParticleEmitter* getEmitter() =0;
78
79 //! Sets the particle emitter, which creates the particles.
80 /** A particle emitter can be created using one of the createEmitter
81 methods. For example to create and use a simple PointEmitter, call
82 IParticleEmitter* p = createPointEmitter(); setEmitter(p); p->drop();
83 \param emitter: Sets the particle emitter. You can set this to 0 for
84 removing the current emitter and stopping the particle system emitting
85 new particles. */
86 virtual void setEmitter(IParticleEmitter* emitter) = 0;
87
88 //! Adds new particle effector to the particle system.
89 /** A particle affector modifies the particles. For example, the FadeOut
90 affector lets all particles fade out after some time. It is created and
91 used in this way:
92 \code
93 IParticleAffector* p = createFadeOutParticleAffector();
94 addAffector(p);
95 p->drop();
96 \endcode
97 Please note that an affector is not necessary for the particle system to
98 work.
99 \param affector: New affector. */
100 virtual void addAffector(IParticleAffector* affector) = 0;
101
102 //! Get a list of all particle affectors.
103 /** \return The list of particle affectors attached to this node. */
104 virtual const core::list<IParticleAffector*>& getAffectors() const = 0;
105
106 //! Removes all particle affectors in the particle system.
107 virtual void removeAllAffectors() = 0;
108
109 //! Creates a particle emitter for an animated mesh scene node
110 /** \param node: Pointer to the animated mesh scene node to emit
111 particles from
112 \param useNormalDirection: If true, the direction of each particle
113 created will be the normal of the vertex that it's emitting from. The
114 normal is divided by the normalDirectionModifier parameter, which
115 defaults to 100.0f.
116 \param direction: Direction and speed of particle emission.
117 \param normalDirectionModifier: If the emitter is using the normal
118 direction then the normal of the vertex that is being emitted from is
119 divided by this number.
120 \param mbNumber: This allows you to specify a specific meshBuffer for
121 the IMesh* to emit particles from. The default value is -1, which
122 means a random meshBuffer picked from all of the meshes meshBuffers
123 will be selected to pick a random vertex from. If the value is 0 or
124 greater, it will only pick random vertices from the meshBuffer
125 specified by this value.
126 \param everyMeshVertex: If true, the emitter will emit between min/max
127 particles every second, for every vertex in the mesh, if false, it will
128 emit between min/max particles from random vertices in the mesh.
129 \param minParticlesPerSecond: Minimal amount of particles emitted per
130 second.
131 \param maxParticlesPerSecond: Maximal amount of particles emitted per
132 second.
133 \param minStartColor: Minimal initial start color of a particle. The
134 real color of every particle is calculated as random interpolation
135 between minStartColor and maxStartColor.
136 \param maxStartColor: Maximal initial start color of a particle. The
137 real color of every particle is calculated as random interpolation
138 between minStartColor and maxStartColor.
139 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
140 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
141 \param maxAngleDegrees: Maximal angle in degrees, the emitting
142 direction of the particle will differ from the original direction.
143 \param minStartSize: Minimal initial start size of a particle. The
144 real size of every particle is calculated as random interpolation
145 between minStartSize and maxStartSize.
146 \param maxStartSize: Maximal initial start size of a particle. The
147 real size of every particle is calculated as random interpolation
148 between minStartSize and maxStartSize.
149 \return Pointer to the created particle emitter. To set this emitter
150 as new emitter of this particle system, just call setEmitter(). Note
151 that you'll have to drop() the returned pointer, after you don't need
152 it any more, see IReferenceCounted::drop() for more informations. */
153 virtual IParticleAnimatedMeshSceneNodeEmitter* createAnimatedMeshSceneNodeEmitter(
154 scene::IAnimatedMeshSceneNode* node, bool useNormalDirection = true,
155 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
156 f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1,
157 bool everyMeshVertex = false,
158 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
159 const video::SColor& minStartColor = video::SColor(255,0,0,0),
160 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
161 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
162 s32 maxAngleDegrees = 0,
163 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
164 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
165
166 //! Creates a box particle emitter.
167 /** \param box: The box for the emitter.
168 \param direction: Direction and speed of particle emission.
169 \param minParticlesPerSecond: Minimal amount of particles emitted per
170 second.
171 \param maxParticlesPerSecond: Maximal amount of particles emitted per
172 second.
173 \param minStartColor: Minimal initial start color of a particle. The
174 real color of every particle is calculated as random interpolation
175 between minStartColor and maxStartColor.
176 \param maxStartColor: Maximal initial start color of a particle. The
177 real color of every particle is calculated as random interpolation
178 between minStartColor and maxStartColor.
179 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
180 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
181 \param maxAngleDegrees: Maximal angle in degrees, the emitting
182 direction of the particle will differ from the original direction.
183 \param minStartSize: Minimal initial start size of a particle. The
184 real size of every particle is calculated as random interpolation
185 between minStartSize and maxStartSize.
186 \param maxStartSize: Maximal initial start size of a particle. The
187 real size of every particle is calculated as random interpolation
188 between minStartSize and maxStartSize.
189 \return Pointer to the created particle emitter. To set this emitter
190 as new emitter of this particle system, just call setEmitter(). Note
191 that you'll have to drop() the returned pointer, after you don't need
192 it any more, see IReferenceCounted::drop() for more informations. */
193 virtual IParticleBoxEmitter* createBoxEmitter(
194 const core::aabbox3df& box = core::aabbox3df(-10,28,-10,10,30,10),
195 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
196 u32 minParticlesPerSecond = 5,
197 u32 maxParticlesPerSecond = 10,
198 const video::SColor& minStartColor = video::SColor(255,0,0,0),
199 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
200 u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
201 s32 maxAngleDegrees=0,
202 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
203 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
204
205 //! Creates a particle emitter for emitting from a cylinder
206 /** \param center: The center of the circle at the base of the cylinder
207 \param radius: The thickness of the cylinder
208 \param normal: Direction of the length of the cylinder
209 \param length: The length of the the cylinder
210 \param outlineOnly: Whether or not to put points inside the cylinder or
211 on the outline only
212 \param direction: Direction and speed of particle emission.
213 \param minParticlesPerSecond: Minimal amount of particles emitted per
214 second.
215 \param maxParticlesPerSecond: Maximal amount of particles emitted per
216 second.
217 \param minStartColor: Minimal initial start color of a particle. The
218 real color of every particle is calculated as random interpolation
219 between minStartColor and maxStartColor.
220 \param maxStartColor: Maximal initial start color of a particle. The
221 real color of every particle is calculated as random interpolation
222 between minStartColor and maxStartColor.
223 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
224 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
225 \param maxAngleDegrees: Maximal angle in degrees, the emitting
226 direction of the particle will differ from the original direction.
227 \param minStartSize: Minimal initial start size of a particle. The
228 real size of every particle is calculated as random interpolation
229 between minStartSize and maxStartSize.
230 \param maxStartSize: Maximal initial start size of a particle. The
231 real size of every particle is calculated as random interpolation
232 between minStartSize and maxStartSize.
233 \return Pointer to the created particle emitter. To set this emitter
234 as new emitter of this particle system, just call setEmitter(). Note
235 that you'll have to drop() the returned pointer, after you don't need
236 it any more, see IReferenceCounted::drop() for more informations. */
237 virtual IParticleCylinderEmitter* createCylinderEmitter(
238 const core::vector3df& center, f32 radius,
239 const core::vector3df& normal, f32 length,
240 bool outlineOnly = false,
241 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
242 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
243 const video::SColor& minStartColor = video::SColor(255,0,0,0),
244 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
245 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
246 s32 maxAngleDegrees = 0,
247 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
248 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
249
250 //! Creates a mesh particle emitter.
251 /** \param mesh: Pointer to mesh to emit particles from
252 \param useNormalDirection: If true, the direction of each particle
253 created will be the normal of the vertex that it's emitting from. The
254 normal is divided by the normalDirectionModifier parameter, which
255 defaults to 100.0f.
256 \param direction: Direction and speed of particle emission.
257 \param normalDirectionModifier: If the emitter is using the normal
258 direction then the normal of the vertex that is being emitted from is
259 divided by this number.
260 \param mbNumber: This allows you to specify a specific meshBuffer for
261 the IMesh* to emit particles from. The default value is -1, which
262 means a random meshBuffer picked from all of the meshes meshBuffers
263 will be selected to pick a random vertex from. If the value is 0 or
264 greater, it will only pick random vertices from the meshBuffer
265 specified by this value.
266 \param everyMeshVertex: If true, the emitter will emit between min/max
267 particles every second, for every vertex in the mesh, if false, it will
268 emit between min/max particles from random vertices in the mesh.
269 \param minParticlesPerSecond: Minimal amount of particles emitted per
270 second.
271 \param maxParticlesPerSecond: Maximal amount of particles emitted per
272 second.
273 \param minStartColor: Minimal initial start color of a particle. The
274 real color of every particle is calculated as random interpolation
275 between minStartColor and maxStartColor.
276 \param maxStartColor: Maximal initial start color of a particle. The
277 real color of every particle is calculated as random interpolation
278 between minStartColor and maxStartColor.
279 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
280 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
281 \param maxAngleDegrees: Maximal angle in degrees, the emitting
282 direction of the particle will differ from the original direction.
283 \param minStartSize: Minimal initial start size of a particle. The
284 real size of every particle is calculated as random interpolation
285 between minStartSize and maxStartSize.
286 \param maxStartSize: Maximal initial start size of a particle. The
287 real size of every particle is calculated as random interpolation
288 between minStartSize and maxStartSize.
289 \return Pointer to the created particle emitter. To set this emitter
290 as new emitter of this particle system, just call setEmitter(). Note
291 that you'll have to drop() the returned pointer, after you don't need
292 it any more, see IReferenceCounted::drop() for more informations. */
293 virtual IParticleMeshEmitter* createMeshEmitter(
294 scene::IMesh* mesh, bool useNormalDirection = true,
295 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
296 f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1,
297 bool everyMeshVertex = false,
298 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
299 const video::SColor& minStartColor = video::SColor(255,0,0,0),
300 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
301 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
302 s32 maxAngleDegrees = 0,
303 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
304 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
305
306 //! Creates a point particle emitter.
307 /** \param direction: Direction and speed of particle emission.
308 \param minParticlesPerSecond: Minimal amount of particles emitted per
309 second.
310 \param maxParticlesPerSecond: Maximal amount of particles emitted per
311 second.
312 \param minStartColor: Minimal initial start color of a particle. The
313 real color of every particle is calculated as random interpolation
314 between minStartColor and maxStartColor.
315 \param maxStartColor: Maximal initial start color of a particle. The
316 real color of every particle is calculated as random interpolation
317 between minStartColor and maxStartColor.
318 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
319 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
320 \param maxAngleDegrees: Maximal angle in degrees, the emitting
321 direction of the particle will differ from the original direction.
322 \param minStartSize: Minimal initial start size of a particle. The
323 real size of every particle is calculated as random interpolation
324 between minStartSize and maxStartSize.
325 \param maxStartSize: Maximal initial start size of a particle. The
326 real size of every particle is calculated as random interpolation
327 between minStartSize and maxStartSize.
328 \return Pointer to the created particle emitter. To set this emitter
329 as new emitter of this particle system, just call setEmitter(). Note
330 that you'll have to drop() the returned pointer, after you don't need
331 it any more, see IReferenceCounted::drop() for more informations. */
332 virtual IParticlePointEmitter* createPointEmitter(
333 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
334 u32 minParticlesPerSecond = 5,
335 u32 maxParticlesPerSecond = 10,
336 const video::SColor& minStartColor = video::SColor(255,0,0,0),
337 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
338 u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
339 s32 maxAngleDegrees=0,
340 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
341 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
342
343 //! Creates a ring particle emitter.
344 /** \param center: Center of ring
345 \param radius: Distance of points from center, points will be rotated
346 around the Y axis at a random 360 degrees and will then be shifted by
347 the provided ringThickness values in each axis.
348 \param ringThickness : thickness of the ring or how wide the ring is
349 \param direction: Direction and speed of particle emission.
350 \param minParticlesPerSecond: Minimal amount of particles emitted per
351 second.
352 \param maxParticlesPerSecond: Maximal amount of particles emitted per
353 second.
354 \param minStartColor: Minimal initial start color of a particle. The
355 real color of every particle is calculated as random interpolation
356 between minStartColor and maxStartColor.
357 \param maxStartColor: Maximal initial start color of a particle. The
358 real color of every particle is calculated as random interpolation
359 between minStartColor and maxStartColor.
360 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
361 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
362 \param maxAngleDegrees: Maximal angle in degrees, the emitting
363 direction of the particle will differ from the original direction.
364 \param minStartSize: Minimal initial start size of a particle. The
365 real size of every particle is calculated as random interpolation
366 between minStartSize and maxStartSize.
367 \param maxStartSize: Maximal initial start size of a particle. The
368 real size of every particle is calculated as random interpolation
369 between minStartSize and maxStartSize.
370 \return Pointer to the created particle emitter. To set this emitter
371 as new emitter of this particle system, just call setEmitter(). Note
372 that you'll have to drop() the returned pointer, after you don't need
373 it any more, see IReferenceCounted::drop() for more informations. */
374 virtual IParticleRingEmitter* createRingEmitter(
375 const core::vector3df& center, f32 radius, f32 ringThickness,
376 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
377 u32 minParticlesPerSecond = 5,
378 u32 maxParticlesPerSecond = 10,
379 const video::SColor& minStartColor = video::SColor(255,0,0,0),
380 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
381 u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
382 s32 maxAngleDegrees=0,
383 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
384 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
385
386 //! Creates a sphere particle emitter.
387 /** \param center: Center of sphere
388 \param radius: Radius of sphere
389 \param direction: Direction and speed of particle emission.
390 \param minParticlesPerSecond: Minimal amount of particles emitted per
391 second.
392 \param maxParticlesPerSecond: Maximal amount of particles emitted per
393 second.
394 \param minStartColor: Minimal initial start color of a particle. The
395 real color of every particle is calculated as random interpolation
396 between minStartColor and maxStartColor.
397 \param maxStartColor: Maximal initial start color of a particle. The
398 real color of every particle is calculated as random interpolation
399 between minStartColor and maxStartColor.
400 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
401 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
402 \param maxAngleDegrees: Maximal angle in degrees, the emitting
403 direction of the particle will differ from the original direction.
404 \param minStartSize: Minimal initial start size of a particle. The
405 real size of every particle is calculated as random interpolation
406 between minStartSize and maxStartSize.
407 \param maxStartSize: Maximal initial start size of a particle. The
408 real size of every particle is calculated as random interpolation
409 between minStartSize and maxStartSize.
410 \return Pointer to the created particle emitter. To set this emitter
411 as new emitter of this particle system, just call setEmitter(). Note
412 that you'll have to drop() the returned pointer, after you don't need
413 it any more, see IReferenceCounted::drop() for more informations. */
414 virtual IParticleSphereEmitter* createSphereEmitter(
415 const core::vector3df& center, f32 radius,
416 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
417 u32 minParticlesPerSecond = 5,
418 u32 maxParticlesPerSecond = 10,
419 const video::SColor& minStartColor = video::SColor(255,0,0,0),
420 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
421 u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
422 s32 maxAngleDegrees=0,
423 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
424 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
425
426 //! Creates a point attraction affector.
427 /** This affector modifies the positions of the particles and attracts
428 them to a specified point at a specified speed per second.
429 \param point: Point to attract particles to.
430 \param speed: Speed in units per second, to attract to the specified
431 point.
432 \param attract: Whether the particles attract or detract from this
433 point.
434 \param affectX: Whether or not this will affect the X position of the
435 particle.
436 \param affectY: Whether or not this will affect the Y position of the
437 particle.
438 \param affectZ: Whether or not this will affect the Z position of the
439 particle.
440 \return Pointer to the created particle affector. To add this affector
441 as new affector of this particle system, just call addAffector(). Note
442 that you'll have to drop() the returned pointer, after you don't need
443 it any more, see IReferenceCounted::drop() for more informations. */
444 virtual IParticleAttractionAffector* createAttractionAffector(
445 const core::vector3df& point, f32 speed = 1.0f, bool attract = true,
446 bool affectX = true, bool affectY = true, bool affectZ = true) = 0;
447
448 //! Creates a scale particle affector.
449 /** This affector scales the particle to the a multiple of its size defined
450 by the scaleTo variable.
451 \param scaleTo: multiple of the size which the particle will be scaled to until deletion
452 \return Pointer to the created particle affector.
453 To add this affector as new affector of this particle system,
454 just call addAffector(). Note that you'll have to drop() the
455 returned pointer, after you don't need it any more, see
456 IReferenceCounted::drop() for more information. */
457 virtual IParticleAffector* createScaleParticleAffector(const core::dimension2df& scaleTo = core::dimension2df(1.0f, 1.0f)) = 0;
458
459 //! Creates a fade out particle affector.
460 /** This affector modifies the color of every particle and and reaches
461 the final color when the particle dies. This affector looks really
462 good, if the EMT_TRANSPARENT_ADD_COLOR material is used and the
463 targetColor is video::SColor(0,0,0,0): Particles are fading out into
464 void with this setting.
465 \param targetColor: Color whereto the color of the particle is changed.
466 \param timeNeededToFadeOut: How much time in milli seconds should the
467 affector need to change the color to the targetColor.
468 \return Pointer to the created particle affector. To add this affector
469 as new affector of this particle system, just call addAffector(). Note
470 that you'll have to drop() the returned pointer, after you don't need
471 it any more, see IReferenceCounted::drop() for more informations. */
472 virtual IParticleFadeOutAffector* createFadeOutParticleAffector(
473 const video::SColor& targetColor = video::SColor(0,0,0,0),
474 u32 timeNeededToFadeOut = 1000) = 0;
475
476 //! Creates a gravity affector.
477 /** This affector modifies the direction of the particle. It assumes
478 that the particle is fired out of the emitter with huge force, but is
479 loosing this after some time and is catched by the gravity then. This
480 affector is ideal for creating things like fountains.
481 \param gravity: Direction and force of gravity.
482 \param timeForceLost: Time in milli seconds when the force of the
483 emitter is totally lost and the particle does not move any more. This
484 is the time where gravity fully affects the particle.
485 \return Pointer to the created particle affector. To add this affector
486 as new affector of this particle system, just call addAffector(). Note
487 that you'll have to drop() the returned pointer, after you don't need
488 it any more, see IReferenceCounted::drop() for more informations. */
489 virtual IParticleGravityAffector* createGravityAffector(
490 const core::vector3df& gravity = core::vector3df(0.0f,-0.03f,0.0f),
491 u32 timeForceLost = 1000) = 0;
492
493 //! Creates a rotation affector.
494 /** This affector modifies the positions of the particles and attracts
495 them to a specified point at a specified speed per second.
496 \param speed: Rotation in degrees per second
497 \param pivotPoint: Point to rotate the particles around
498 \return Pointer to the created particle affector. To add this affector
499 as new affector of this particle system, just call addAffector(). Note
500 that you'll have to drop() the returned pointer, after you don't need
501 it any more, see IReferenceCounted::drop() for more informations. */
502 virtual IParticleRotationAffector* createRotationAffector(
503 const core::vector3df& speed = core::vector3df(5.0f,5.0f,5.0f),
504 const core::vector3df& pivotPoint = core::vector3df(0.0f,0.0f,0.0f) ) = 0;
505};
506
507} // end namespace scene
508} // end namespace irr
509
510
511#endif
512
diff --git a/src/others/irrlicht-1.8.1/include/IQ3LevelMesh.h b/src/others/irrlicht-1.8.1/include/IQ3LevelMesh.h
new file mode 100644
index 0000000..62feffc
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IQ3LevelMesh.h
@@ -0,0 +1,46 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_Q3_LEVEL_MESH_H_INCLUDED__
6#define __I_Q3_LEVEL_MESH_H_INCLUDED__
7
8#include "IAnimatedMesh.h"
9#include "IQ3Shader.h"
10
11namespace irr
12{
13namespace scene
14{
15 //! Interface for a Mesh which can be loaded directly from a Quake3 .bsp-file.
16 /** The Mesh tries to load all textures of the map.*/
17 class IQ3LevelMesh : public IAnimatedMesh
18 {
19 public:
20
21 //! loads the shader definition from file
22 /** \param filename Name of the shaderfile, defaults to /scripts if fileNameIsValid is false.
23 \param fileNameIsValid Specifies whether the filename is valid in the current situation. */
24 virtual const quake3::IShader* getShader( const c8* filename, bool fileNameIsValid=true ) = 0;
25
26 //! returns a already loaded Shader
27 virtual const quake3::IShader* getShader(u32 index) const = 0;
28
29 //! get's an interface to the entities
30 virtual quake3::tQ3EntityList& getEntityList() = 0;
31
32 //! returns the requested brush entity
33 /** \param num The number from the model key of the entity.
34
35 Use this interface if you parse the entities yourself.*/
36 virtual IMesh* getBrushEntityMesh(s32 num) const = 0;
37
38 //! returns the requested brush entity
39 virtual IMesh* getBrushEntityMesh(quake3::IEntity &ent) const = 0;
40 };
41
42} // end namespace scene
43} // end namespace irr
44
45#endif
46
diff --git a/src/others/irrlicht-1.8.1/include/IQ3Shader.h b/src/others/irrlicht-1.8.1/include/IQ3Shader.h
new file mode 100644
index 0000000..7dc15e5
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IQ3Shader.h
@@ -0,0 +1,885 @@
1// Copyright (C) 2006-2012 Nikolaus Gebhardt / Thomas Alten
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_Q3_LEVEL_SHADER_H_INCLUDED__
6#define __I_Q3_LEVEL_SHADER_H_INCLUDED__
7
8#include "irrArray.h"
9#include "fast_atof.h"
10#include "IFileSystem.h"
11#include "IVideoDriver.h"
12#include "coreutil.h"
13
14namespace irr
15{
16namespace scene
17{
18namespace quake3
19{
20
21 static core::stringc irrEmptyStringc("");
22
23 //! Hold the different Mesh Types used for getMesh
24 enum eQ3MeshIndex
25 {
26 E_Q3_MESH_GEOMETRY = 0,
27 E_Q3_MESH_ITEMS,
28 E_Q3_MESH_BILLBOARD,
29 E_Q3_MESH_FOG,
30 E_Q3_MESH_UNRESOLVED,
31 E_Q3_MESH_SIZE
32 };
33
34 /*! used to customize Quake3 BSP Loader
35 */
36
37 struct Q3LevelLoadParameter
38 {
39 Q3LevelLoadParameter ()
40 :defaultLightMapMaterial ( video::EMT_LIGHTMAP_M4 ),
41 defaultModulate ( video::EMFN_MODULATE_4X ),
42 defaultFilter ( video::EMF_BILINEAR_FILTER ),
43 patchTesselation ( 8 ),
44 verbose ( 0 ),
45 startTime ( 0 ), endTime ( 0 ),
46 mergeShaderBuffer ( 1 ),
47 cleanUnResolvedMeshes ( 1 ),
48 loadAllShaders ( 0 ),
49 loadSkyShader ( 0 ),
50 alpharef ( 1 ),
51 swapLump ( 0 ),
52 #ifdef __BIG_ENDIAN__
53 swapHeader ( 1 )
54 #else
55 swapHeader ( 0 )
56 #endif
57 {
58 memcpy ( scriptDir, "scripts\x0", 8 );
59 }
60
61 video::E_MATERIAL_TYPE defaultLightMapMaterial;
62 video::E_MODULATE_FUNC defaultModulate;
63 video::E_MATERIAL_FLAG defaultFilter;
64 s32 patchTesselation;
65 s32 verbose;
66 u32 startTime;
67 u32 endTime;
68 s32 mergeShaderBuffer;
69 s32 cleanUnResolvedMeshes;
70 s32 loadAllShaders;
71 s32 loadSkyShader;
72 s32 alpharef;
73 s32 swapLump;
74 s32 swapHeader;
75 c8 scriptDir [ 64 ];
76 };
77
78 // some useful typedefs
79 typedef core::array< core::stringc > tStringList;
80 typedef core::array< video::ITexture* > tTexArray;
81
82 // string helper.. TODO: move to generic files
83 inline s16 isEqual ( const core::stringc &string, u32 &pos, const c8 *list[], u16 listSize )
84 {
85 const char * in = string.c_str () + pos;
86
87 for ( u16 i = 0; i != listSize; ++i )
88 {
89 if (string.size() < pos)
90 return -2;
91 u32 len = (u32) strlen ( list[i] );
92 if (string.size() < pos+len)
93 continue;
94 if ( in [len] != 0 && in [len] != ' ' )
95 continue;
96 if ( strncmp ( in, list[i], len ) )
97 continue;
98
99 pos += len + 1;
100 return (s16) i;
101 }
102 return -2;
103 }
104
105 inline f32 getAsFloat ( const core::stringc &string, u32 &pos )
106 {
107 const char * in = string.c_str () + pos;
108
109 f32 value = 0.f;
110 pos += (u32) ( core::fast_atof_move ( in, value ) - in ) + 1;
111 return value;
112 }
113
114 //! get a quake3 vector translated to irrlicht position (x,-z,y )
115 inline core::vector3df getAsVector3df ( const core::stringc &string, u32 &pos )
116 {
117 core::vector3df v;
118
119 v.X = getAsFloat ( string, pos );
120 v.Z = getAsFloat ( string, pos );
121 v.Y = getAsFloat ( string, pos );
122
123 return v;
124 }
125
126
127 /*
128 extract substrings
129 */
130 inline void getAsStringList ( tStringList &list, s32 max, const core::stringc &string, u32 &startPos )
131 {
132 list.clear ();
133
134 s32 finish = 0;
135 s32 endPos;
136 do
137 {
138 endPos = string.findNext ( ' ', startPos );
139 if ( endPos == -1 )
140 {
141 finish = 1;
142 endPos = string.size();
143 }
144
145 list.push_back ( string.subString ( startPos, endPos - startPos ) );
146 startPos = endPos + 1;
147
148 if ( list.size() >= (u32) max )
149 finish = 1;
150
151 } while ( !finish );
152
153 }
154
155 //! A blend function for a q3 shader.
156 struct SBlendFunc
157 {
158 SBlendFunc ( video::E_MODULATE_FUNC mod )
159 : type ( video::EMT_SOLID ), modulate ( mod ),
160 param0( 0.f ),
161 isTransparent ( 0 ) {}
162
163 video::E_MATERIAL_TYPE type;
164 video::E_MODULATE_FUNC modulate;
165
166 f32 param0;
167 u32 isTransparent;
168 };
169
170 // parses the content of Variable cull
171 inline bool getCullingFunction ( const core::stringc &cull )
172 {
173 if ( cull.size() == 0 )
174 return true;
175
176 bool ret = true;
177 static const c8 * funclist[] = { "none", "disable", "twosided" };
178
179 u32 pos = 0;
180 switch ( isEqual ( cull, pos, funclist, 3 ) )
181 {
182 case 0:
183 case 1:
184 case 2:
185 ret = false;
186 break;
187 }
188 return ret;
189 }
190
191 // parses the content of Variable depthfunc
192 // return a z-test
193 inline u8 getDepthFunction ( const core::stringc &string )
194 {
195 u8 ret = video::ECFN_LESSEQUAL;
196
197 if ( string.size() == 0 )
198 return ret;
199
200 static const c8 * funclist[] = { "lequal","equal" };
201
202 u32 pos = 0;
203 switch ( isEqual ( string, pos, funclist, 2 ) )
204 {
205 case 0:
206 ret = video::ECFN_LESSEQUAL;
207 break;
208 case 1:
209 ret = video::ECFN_EQUAL;
210 break;
211 }
212 return ret;
213 }
214
215
216 /*!
217 parses the content of Variable blendfunc,alphafunc
218 it also make a hint for rendering as transparent or solid node.
219
220 we assume a typical quake scene would look like this..
221 1) Big Static Mesh ( solid )
222 2) static scene item ( may use transparency ) but rendered in the solid pass
223 3) additional transparency item in the transparent pass
224
225 it's not 100% accurate! it just empirical..
226 */
227 inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc )
228 {
229 if ( string.size() == 0 )
230 return;
231
232 // maps to E_BLEND_FACTOR
233 static const c8 * funclist[] =
234 {
235 "gl_zero",
236 "gl_one",
237 "gl_dst_color",
238 "gl_one_minus_dst_color",
239 "gl_src_color",
240 "gl_one_minus_src_color",
241 "gl_src_alpha",
242 "gl_one_minus_src_alpha",
243 "gl_dst_alpha",
244 "gl_one_minus_dst_alpha",
245 "gl_src_alpha_sat",
246
247 "add",
248 "filter",
249 "blend",
250
251 "ge128",
252 "gt0",
253 };
254
255
256 u32 pos = 0;
257 s32 srcFact = isEqual ( string, pos, funclist, 16 );
258
259 if ( srcFact < 0 )
260 return;
261
262 u32 resolved = 0;
263 s32 dstFact = isEqual ( string, pos, funclist, 16 );
264
265 switch ( srcFact )
266 {
267 case video::EBF_ZERO:
268 switch ( dstFact )
269 {
270 // gl_zero gl_src_color == gl_dst_color gl_zero
271 case video::EBF_SRC_COLOR:
272 blendfunc.type = video::EMT_ONETEXTURE_BLEND;
273 blendfunc.param0 = video::pack_textureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
274 blendfunc.isTransparent = 1;
275 resolved = 1;
276 break;
277 } break;
278
279 case video::EBF_ONE:
280 switch ( dstFact )
281 {
282 // gl_one gl_zero
283 case video::EBF_ZERO:
284 blendfunc.type = video::EMT_SOLID;
285 blendfunc.isTransparent = 0;
286 resolved = 1;
287 break;
288
289 // gl_one gl_one
290 case video::EBF_ONE:
291 blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
292 blendfunc.isTransparent = 1;
293 resolved = 1;
294 break;
295 } break;
296
297 case video::EBF_SRC_ALPHA:
298 switch ( dstFact )
299 {
300 // gl_src_alpha gl_one_minus_src_alpha
301 case video::EBF_ONE_MINUS_SRC_ALPHA:
302 blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
303 blendfunc.param0 = 1.f/255.f;
304 blendfunc.isTransparent = 1;
305 resolved = 1;
306 break;
307 } break;
308
309 case 11:
310 // add
311 blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
312 blendfunc.isTransparent = 1;
313 resolved = 1;
314 break;
315 case 12:
316 // filter = gl_dst_color gl_zero or gl_zero gl_src_color
317 blendfunc.type = video::EMT_ONETEXTURE_BLEND;
318 blendfunc.param0 = video::pack_textureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
319 blendfunc.isTransparent = 1;
320 resolved = 1;
321 break;
322 case 13:
323 // blend = gl_src_alpha gl_one_minus_src_alpha
324 blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
325 blendfunc.param0 = 1.f/255.f;
326 blendfunc.isTransparent = 1;
327 resolved = 1;
328 break;
329 case 14:
330 // alphafunc ge128
331 blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
332 blendfunc.param0 = 0.5f;
333 blendfunc.isTransparent = 1;
334 resolved = 1;
335 break;
336 case 15:
337 // alphafunc gt0
338 blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
339 blendfunc.param0 = 1.f / 255.f;
340 blendfunc.isTransparent = 1;
341 resolved = 1;
342 break;
343
344 }
345
346 // use the generic blender
347 if ( 0 == resolved )
348 {
349 blendfunc.type = video::EMT_ONETEXTURE_BLEND;
350 blendfunc.param0 = video::pack_textureBlendFunc (
351 (video::E_BLEND_FACTOR) srcFact,
352 (video::E_BLEND_FACTOR) dstFact,
353 blendfunc.modulate);
354
355 blendfunc.isTransparent = 1;
356 }
357 }
358
359 // random noise [-1;1]
360 struct Noiser
361 {
362 static f32 get ()
363 {
364 static u32 RandomSeed = 0x69666966;
365 RandomSeed = (RandomSeed * 3631 + 1);
366
367 f32 value = ( (f32) (RandomSeed & 0x7FFF ) * (1.0f / (f32)(0x7FFF >> 1) ) ) - 1.f;
368 return value;
369 }
370 };
371
372 enum eQ3ModifierFunction
373 {
374 TCMOD = 0,
375 DEFORMVERTEXES = 1,
376 RGBGEN = 2,
377 TCGEN = 3,
378 MAP = 4,
379 ALPHAGEN = 5,
380
381 FUNCTION2 = 0x10,
382 SCROLL = FUNCTION2 + 1,
383 SCALE = FUNCTION2 + 2,
384 ROTATE = FUNCTION2 + 3,
385 STRETCH = FUNCTION2 + 4,
386 TURBULENCE = FUNCTION2 + 5,
387 WAVE = FUNCTION2 + 6,
388
389 IDENTITY = FUNCTION2 + 7,
390 VERTEX = FUNCTION2 + 8,
391 TEXTURE = FUNCTION2 + 9,
392 LIGHTMAP = FUNCTION2 + 10,
393 ENVIRONMENT = FUNCTION2 + 11,
394 DOLLAR_LIGHTMAP = FUNCTION2 + 12,
395 BULGE = FUNCTION2 + 13,
396 AUTOSPRITE = FUNCTION2 + 14,
397 AUTOSPRITE2 = FUNCTION2 + 15,
398 TRANSFORM = FUNCTION2 + 16,
399 EXACTVERTEX = FUNCTION2 + 17,
400 CONSTANT = FUNCTION2 + 18,
401 LIGHTINGSPECULAR = FUNCTION2 + 19,
402 MOVE = FUNCTION2 + 20,
403 NORMAL = FUNCTION2 + 21,
404 IDENTITYLIGHTING = FUNCTION2 + 22,
405
406 WAVE_MODIFIER_FUNCTION = 0x30,
407 SINUS = WAVE_MODIFIER_FUNCTION + 1,
408 COSINUS = WAVE_MODIFIER_FUNCTION + 2,
409 SQUARE = WAVE_MODIFIER_FUNCTION + 3,
410 TRIANGLE = WAVE_MODIFIER_FUNCTION + 4,
411 SAWTOOTH = WAVE_MODIFIER_FUNCTION + 5,
412 SAWTOOTH_INVERSE = WAVE_MODIFIER_FUNCTION + 6,
413 NOISE = WAVE_MODIFIER_FUNCTION + 7,
414
415
416 UNKNOWN = -2
417
418 };
419
420 struct SModifierFunction
421 {
422 SModifierFunction ()
423 : masterfunc0 ( UNKNOWN ), masterfunc1( UNKNOWN ), func ( SINUS ),
424 tcgen( TEXTURE ), rgbgen ( IDENTITY ), alphagen ( UNKNOWN ),
425 base ( 0 ), amp ( 1 ), phase ( 0 ), frequency ( 1 ),
426 wave ( 1 ),
427 x ( 0 ), y ( 0 ), z( 0 ), count( 0 ) {}
428
429 // "tcmod","deformvertexes","rgbgen", "tcgen"
430 eQ3ModifierFunction masterfunc0;
431 // depends
432 eQ3ModifierFunction masterfunc1;
433 // depends
434 eQ3ModifierFunction func;
435
436 eQ3ModifierFunction tcgen;
437 eQ3ModifierFunction rgbgen;
438 eQ3ModifierFunction alphagen;
439
440 union
441 {
442 f32 base;
443 f32 bulgewidth;
444 };
445
446 union
447 {
448 f32 amp;
449 f32 bulgeheight;
450 };
451
452 f32 phase;
453
454 union
455 {
456 f32 frequency;
457 f32 bulgespeed;
458 };
459
460 union
461 {
462 f32 wave;
463 f32 div;
464 };
465
466 f32 x;
467 f32 y;
468 f32 z;
469 u32 count;
470
471 f32 evaluate ( f32 dt ) const
472 {
473 // phase in 0 and 1..
474 f32 x = core::fract( (dt + phase ) * frequency );
475 f32 y = 0.f;
476
477 switch ( func )
478 {
479 case SINUS:
480 y = sinf ( x * core::PI * 2.f );
481 break;
482 case COSINUS:
483 y = cosf ( x * core::PI * 2.f );
484 break;
485 case SQUARE:
486 y = x < 0.5f ? 1.f : -1.f;
487 break;
488 case TRIANGLE:
489 y = x < 0.5f ? ( 4.f * x ) - 1.f : ( -4.f * x ) + 3.f;
490 break;
491 case SAWTOOTH:
492 y = x;
493 break;
494 case SAWTOOTH_INVERSE:
495 y = 1.f - x;
496 break;
497 case NOISE:
498 y = Noiser::get();
499 break;
500 default:
501 break;
502 }
503
504 return base + ( y * amp );
505 }
506
507
508 };
509
510 inline core::vector3df getMD3Normal ( u32 i, u32 j )
511 {
512 const f32 lng = i * 2.0f * core::PI / 255.0f;
513 const f32 lat = j * 2.0f * core::PI / 255.0f;
514 return core::vector3df(cosf ( lat ) * sinf ( lng ),
515 sinf ( lat ) * sinf ( lng ),
516 cosf ( lng ));
517 }
518
519 //
520 inline void getModifierFunc ( SModifierFunction& fill, const core::stringc &string, u32 &pos )
521 {
522 if ( string.size() == 0 )
523 return;
524
525 static const c8 * funclist[] =
526 {
527 "sin","cos","square",
528 "triangle", "sawtooth","inversesawtooth", "noise"
529 };
530
531 fill.func = (eQ3ModifierFunction) isEqual ( string,pos, funclist,7 );
532 fill.func = fill.func == UNKNOWN ? SINUS : (eQ3ModifierFunction) ((u32) fill.func + WAVE_MODIFIER_FUNCTION + 1);
533
534 fill.base = getAsFloat ( string, pos );
535 fill.amp = getAsFloat ( string, pos );
536 fill.phase = getAsFloat ( string, pos );
537 fill.frequency = getAsFloat ( string, pos );
538 }
539
540
541 // name = "a b c .."
542 struct SVariable
543 {
544 core::stringc name;
545 core::stringc content;
546
547 SVariable ( const c8 * n, const c8 *c = 0 ) : name ( n ), content (c) {}
548 virtual ~SVariable () {}
549
550 void clear ()
551 {
552 name = "";
553 content = "";
554 }
555
556 s32 isValid () const
557 {
558 return name.size();
559 }
560
561 bool operator == ( const SVariable &other ) const
562 {
563 return 0 == strcmp ( name.c_str(), other.name.c_str () );
564 }
565
566 bool operator < ( const SVariable &other ) const
567 {
568 return 0 > strcmp ( name.c_str(), other.name.c_str () );
569 }
570
571 };
572
573
574 // string database. "a" = "Hello", "b" = "1234.6"
575 struct SVarGroup
576 {
577 SVarGroup () { Variable.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE ); }
578 virtual ~SVarGroup () {}
579
580 u32 isDefined ( const c8 * name, const c8 * content = 0 ) const
581 {
582 for ( u32 i = 0; i != Variable.size (); ++i )
583 {
584 if ( 0 == strcmp ( Variable[i].name.c_str(), name ) &&
585 ( 0 == content || strstr ( Variable[i].content.c_str(), content ) )
586 )
587 {
588 return i + 1;
589 }
590 }
591 return 0;
592 }
593
594 // searches for Variable name and returns is content
595 // if Variable is not found a reference to an Empty String is returned
596 const core::stringc &get( const c8 * name ) const
597 {
598 SVariable search ( name );
599 s32 index = Variable.linear_search ( search );
600 if ( index < 0 )
601 return irrEmptyStringc;
602
603 return Variable [ index ].content;
604 }
605
606 // set the Variable name
607 void set ( const c8 * name, const c8 * content = 0 )
608 {
609 u32 index = isDefined ( name, 0 );
610 if ( 0 == index )
611 {
612 Variable.push_back ( SVariable ( name, content ) );
613 }
614 else
615 {
616 Variable [ index ].content = content;
617 }
618 }
619
620
621 core::array < SVariable > Variable;
622 };
623
624 //! holding a group a variable
625 struct SVarGroupList: public IReferenceCounted
626 {
627 SVarGroupList ()
628 {
629 VariableGroup.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
630 }
631 virtual ~SVarGroupList () {}
632
633 core::array < SVarGroup > VariableGroup;
634 };
635
636
637 //! A Parsed Shader Holding Variables ordered in Groups
638 struct IShader
639 {
640 IShader ()
641 : ID ( 0 ), VarGroup ( 0 ) {}
642 virtual ~IShader () {}
643
644 void operator = (const IShader &other )
645 {
646 ID = other.ID;
647 VarGroup = other.VarGroup;
648 name = other.name;
649 }
650
651 bool operator == (const IShader &other ) const
652 {
653 return 0 == strcmp ( name.c_str(), other.name.c_str () );
654 //return name == other.name;
655 }
656
657 bool operator < (const IShader &other ) const
658 {
659 return strcmp ( name.c_str(), other.name.c_str () ) < 0;
660 //return name < other.name;
661 }
662
663 u32 getGroupSize () const
664 {
665 if ( 0 == VarGroup )
666 return 0;
667 return VarGroup->VariableGroup.size ();
668 }
669
670 const SVarGroup * getGroup ( u32 stage ) const
671 {
672 if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
673 return 0;
674
675 return &VarGroup->VariableGroup [ stage ];
676 }
677
678 // id
679 s32 ID;
680 SVarGroupList *VarGroup; // reference
681
682 // Shader: shader name ( also first variable in first Vargroup )
683 // Entity: classname ( variable in Group(1) )
684 core::stringc name;
685 };
686
687 typedef IShader IEntity;
688
689 typedef core::array < IEntity > tQ3EntityList;
690
691 /*
692 dump shader like original layout, regardless of internal data holding
693 no recursive folding..
694 */
695 inline void dumpVarGroup ( core::stringc &dest, const SVarGroup * group, s32 stack )
696 {
697 core::stringc buf;
698 s32 i;
699
700
701 if ( stack > 0 )
702 {
703 buf = "";
704 for ( i = 0; i < stack - 1; ++i )
705 buf += '\t';
706
707 buf += "{\n";
708 dest.append ( buf );
709 }
710
711 for ( u32 g = 0; g != group->Variable.size(); ++g )
712 {
713 buf = "";
714 for ( i = 0; i < stack; ++i )
715 buf += '\t';
716
717 buf += group->Variable[g].name;
718 buf += " ";
719 buf += group->Variable[g].content;
720 buf += "\n";
721 dest.append ( buf );
722 }
723
724 if ( stack > 1 )
725 {
726 buf = "";
727 for ( i = 0; i < stack - 1; ++i )
728 buf += '\t';
729
730 buf += "}\n";
731 dest.append ( buf );
732 }
733
734 }
735
736 /*!
737 dump a Shader or an Entity
738 */
739 inline core::stringc & dumpShader ( core::stringc &dest, const IShader * shader, bool entity = false )
740 {
741 if ( 0 == shader )
742 return dest;
743
744 const SVarGroup * group;
745
746 const u32 size = shader->VarGroup->VariableGroup.size ();
747 for ( u32 i = 0; i != size; ++i )
748 {
749 group = &shader->VarGroup->VariableGroup[ i ];
750 dumpVarGroup ( dest, group, core::clamp( (int)i, 0, 2 ) );
751 }
752
753 if ( !entity )
754 {
755 if ( size <= 1 )
756 {
757 dest.append ( "{\n" );
758 }
759 dest.append ( "}\n" );
760 }
761 return dest;
762 }
763
764
765 /*
766 quake3 doesn't care much about tga & jpg
767 load one or multiple files stored in name started at startPos to the texture array textures
768 if texture is not loaded 0 will be added ( to find missing textures easier)
769 */
770 inline void getTextures(tTexArray &textures,
771 const core::stringc &name, u32 &startPos,
772 io::IFileSystem *fileSystem,
773 video::IVideoDriver* driver)
774 {
775 static const char* extension[] =
776 {
777 ".jpg",
778 ".jpeg",
779 ".png",
780 ".dds",
781 ".tga",
782 ".bmp",
783 ".pcx"
784 };
785
786 tStringList stringList;
787 getAsStringList(stringList, -1, name, startPos);
788
789 textures.clear();
790
791 io::path loadFile;
792 for ( u32 i = 0; i!= stringList.size (); ++i )
793 {
794 video::ITexture* texture = 0;
795 for (u32 g = 0; g != 7 ; ++g)
796 {
797 core::cutFilenameExtension ( loadFile, stringList[i] );
798
799 if ( loadFile == "$whiteimage" )
800 {
801 texture = driver->getTexture( "$whiteimage" );
802 if ( 0 == texture )
803 {
804 core::dimension2du s ( 2, 2 );
805 u32 image[4] = { 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF };
806 video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
807 texture = driver->addTexture( "$whiteimage", w );
808 w->drop ();
809 }
810
811 }
812 else
813 if ( loadFile == "$redimage" )
814 {
815 texture = driver->getTexture( "$redimage" );
816 if ( 0 == texture )
817 {
818 core::dimension2du s ( 2, 2 );
819 u32 image[4] = { 0xFFFF0000, 0xFFFF0000,0xFFFF0000,0xFFFF0000 };
820 video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
821 texture = driver->addTexture( "$redimage", w );
822 w->drop ();
823 }
824 }
825 else
826 if ( loadFile == "$blueimage" )
827 {
828 texture = driver->getTexture( "$blueimage" );
829 if ( 0 == texture )
830 {
831 core::dimension2du s ( 2, 2 );
832 u32 image[4] = { 0xFF0000FF, 0xFF0000FF,0xFF0000FF,0xFF0000FF };
833 video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
834 texture = driver->addTexture( "$blueimage", w );
835 w->drop ();
836 }
837 }
838 else
839 if ( loadFile == "$checkerimage" )
840 {
841 texture = driver->getTexture( "$checkerimage" );
842 if ( 0 == texture )
843 {
844 core::dimension2du s ( 2, 2 );
845 u32 image[4] = { 0xFFFFFFFF, 0xFF000000,0xFF000000,0xFFFFFFFF };
846 video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
847 texture = driver->addTexture( "$checkerimage", w );
848 w->drop ();
849 }
850 }
851 else
852 if ( loadFile == "$lightmap" )
853 {
854 texture = 0;
855 }
856 else
857 {
858 loadFile.append ( extension[g] );
859 }
860
861 if ( fileSystem->existFile ( loadFile ) )
862 {
863 texture = driver->getTexture( loadFile );
864 if ( texture )
865 break;
866 texture = 0;
867 }
868 }
869 // take 0 Texture
870 textures.push_back(texture);
871 }
872 }
873
874
875 //! Manages various Quake3 Shader Styles
876 class IShaderManager : public IReferenceCounted
877 {
878 };
879
880} // end namespace quake3
881} // end namespace scene
882} // end namespace irr
883
884#endif
885
diff --git a/src/others/irrlicht-1.8.1/include/IRandomizer.h b/src/others/irrlicht-1.8.1/include/IRandomizer.h
new file mode 100644
index 0000000..a0c0730
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IRandomizer.h
@@ -0,0 +1,33 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_RANDOMIZER_H_INCLUDED__
6#define __I_RANDOMIZER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9
10namespace irr
11{
12
13//! Interface for generating random numbers
14class IRandomizer : public virtual IReferenceCounted
15{
16public:
17 //! resets the randomizer
18 /** \param value Initialization value (seed) */
19 virtual void reset(s32 value=0x0f0f0f0f) =0;
20
21 //! generates a pseudo random number in the range 0..randMax()
22 virtual s32 rand() const =0;
23
24 //! generates a pseudo random number in the range 0..1
25 virtual f32 frand() const =0;
26
27 //! get maxmimum number generated by rand()
28 virtual s32 randMax() const =0;
29};
30
31} // end namespace irr
32
33#endif
diff --git a/src/others/irrlicht-1.8.1/include/IReadFile.h b/src/others/irrlicht-1.8.1/include/IReadFile.h
new file mode 100644
index 0000000..e925690
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IReadFile.h
@@ -0,0 +1,58 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_READ_FILE_H_INCLUDED__
6#define __I_READ_FILE_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "coreutil.h"
10
11namespace irr
12{
13namespace io
14{
15
16 //! Interface providing read acess to a file.
17 class IReadFile : public virtual IReferenceCounted
18 {
19 public:
20 //! Reads an amount of bytes from the file.
21 /** \param buffer Pointer to buffer where read bytes are written to.
22 \param sizeToRead Amount of bytes to read from the file.
23 \return How many bytes were read. */
24 virtual s32 read(void* buffer, u32 sizeToRead) = 0;
25
26 //! Changes position in file
27 /** \param finalPos Destination position in the file.
28 \param relativeMovement If set to true, the position in the file is
29 changed relative to current position. Otherwise the position is changed
30 from beginning of file.
31 \return True if successful, otherwise false. */
32 virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
33
34 //! Get size of file.
35 /** \return Size of the file in bytes. */
36 virtual long getSize() const = 0;
37
38 //! Get the current position in the file.
39 /** \return Current position in the file in bytes. */
40 virtual long getPos() const = 0;
41
42 //! Get name of file.
43 /** \return File name as zero terminated character string. */
44 virtual const io::path& getFileName() const = 0;
45 };
46
47 //! Internal function, please do not use.
48 IReadFile* createReadFile(const io::path& fileName);
49 //! Internal function, please do not use.
50 IReadFile* createLimitReadFile(const io::path& fileName, IReadFile* alreadyOpenedFile, long pos, long areaSize);
51 //! Internal function, please do not use.
52 IReadFile* createMemoryReadFile(void* memory, long size, const io::path& fileName, bool deleteMemoryWhenDropped);
53
54} // end namespace io
55} // end namespace irr
56
57#endif
58
diff --git a/src/others/irrlicht-1.8.1/include/IReferenceCounted.h b/src/others/irrlicht-1.8.1/include/IReferenceCounted.h
new file mode 100644
index 0000000..8a551e8
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IReferenceCounted.h
@@ -0,0 +1,170 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_IREFERENCE_COUNTED_H_INCLUDED__
6#define __I_IREFERENCE_COUNTED_H_INCLUDED__
7
8#include "irrTypes.h"
9
10namespace irr
11{
12
13 //! Base class of most objects of the Irrlicht Engine.
14 /** This class provides reference counting through the methods grab() and drop().
15 It also is able to store a debug string for every instance of an object.
16 Most objects of the Irrlicht
17 Engine are derived from IReferenceCounted, and so they are reference counted.
18
19 When you create an object in the Irrlicht engine, calling a method
20 which starts with 'create', an object is created, and you get a pointer
21 to the new object. If you no longer need the object, you have
22 to call drop(). This will destroy the object, if grab() was not called
23 in another part of you program, because this part still needs the object.
24 Note, that you only need to call drop() to the object, if you created it,
25 and the method had a 'create' in it.
26
27 A simple example:
28
29 If you want to create a texture, you may want to call an imaginable method
30 IDriver::createTexture. You call
31 ITexture* texture = driver->createTexture(dimension2d<u32>(128, 128));
32 If you no longer need the texture, call texture->drop().
33
34 If you want to load a texture, you may want to call imaginable method
35 IDriver::loadTexture. You do this like
36 ITexture* texture = driver->loadTexture("example.jpg");
37 You will not have to drop the pointer to the loaded texture, because
38 the name of the method does not start with 'create'. The texture
39 is stored somewhere by the driver.
40 */
41 class IReferenceCounted
42 {
43 public:
44
45 //! Constructor.
46 IReferenceCounted()
47 : DebugName(0), ReferenceCounter(1)
48 {
49 }
50
51 //! Destructor.
52 virtual ~IReferenceCounted()
53 {
54 }
55
56 //! Grabs the object. Increments the reference counter by one.
57 /** Someone who calls grab() to an object, should later also
58 call drop() to it. If an object never gets as much drop() as
59 grab() calls, it will never be destroyed. The
60 IReferenceCounted class provides a basic reference counting
61 mechanism with its methods grab() and drop(). Most objects of
62 the Irrlicht Engine are derived from IReferenceCounted, and so
63 they are reference counted.
64
65 When you create an object in the Irrlicht engine, calling a
66 method which starts with 'create', an object is created, and
67 you get a pointer to the new object. If you no longer need the
68 object, you have to call drop(). This will destroy the object,
69 if grab() was not called in another part of you program,
70 because this part still needs the object. Note, that you only
71 need to call drop() to the object, if you created it, and the
72 method had a 'create' in it.
73
74 A simple example:
75
76 If you want to create a texture, you may want to call an
77 imaginable method IDriver::createTexture. You call
78 ITexture* texture = driver->createTexture(dimension2d<u32>(128, 128));
79 If you no longer need the texture, call texture->drop().
80 If you want to load a texture, you may want to call imaginable
81 method IDriver::loadTexture. You do this like
82 ITexture* texture = driver->loadTexture("example.jpg");
83 You will not have to drop the pointer to the loaded texture,
84 because the name of the method does not start with 'create'.
85 The texture is stored somewhere by the driver. */
86 void grab() const { ++ReferenceCounter; }
87
88 //! Drops the object. Decrements the reference counter by one.
89 /** The IReferenceCounted class provides a basic reference
90 counting mechanism with its methods grab() and drop(). Most
91 objects of the Irrlicht Engine are derived from
92 IReferenceCounted, and so they are reference counted.
93
94 When you create an object in the Irrlicht engine, calling a
95 method which starts with 'create', an object is created, and
96 you get a pointer to the new object. If you no longer need the
97 object, you have to call drop(). This will destroy the object,
98 if grab() was not called in another part of you program,
99 because this part still needs the object. Note, that you only
100 need to call drop() to the object, if you created it, and the
101 method had a 'create' in it.
102
103 A simple example:
104
105 If you want to create a texture, you may want to call an
106 imaginable method IDriver::createTexture. You call
107 ITexture* texture = driver->createTexture(dimension2d<u32>(128, 128));
108 If you no longer need the texture, call texture->drop().
109 If you want to load a texture, you may want to call imaginable
110 method IDriver::loadTexture. You do this like
111 ITexture* texture = driver->loadTexture("example.jpg");
112 You will not have to drop the pointer to the loaded texture,
113 because the name of the method does not start with 'create'.
114 The texture is stored somewhere by the driver.
115 \return True, if the object was deleted. */
116 bool drop() const
117 {
118 // someone is doing bad reference counting.
119 _IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0)
120
121 --ReferenceCounter;
122 if (!ReferenceCounter)
123 {
124 delete this;
125 return true;
126 }
127
128 return false;
129 }
130
131 //! Get the reference count.
132 /** \return Current value of the reference counter. */
133 s32 getReferenceCount() const
134 {
135 return ReferenceCounter;
136 }
137
138 //! Returns the debug name of the object.
139 /** The Debugname may only be set and changed by the object
140 itself. This method should only be used in Debug mode.
141 \return Returns a string, previously set by setDebugName(); */
142 const c8* getDebugName() const
143 {
144 return DebugName;
145 }
146
147 protected:
148
149 //! Sets the debug name of the object.
150 /** The Debugname may only be set and changed by the object
151 itself. This method should only be used in Debug mode.
152 \param newName: New debug name to set. */
153 void setDebugName(const c8* newName)
154 {
155 DebugName = newName;
156 }
157
158 private:
159
160 //! The debug name.
161 const c8* DebugName;
162
163 //! The reference counter. Mutable to do reference counting on const objects.
164 mutable s32 ReferenceCounter;
165 };
166
167} // end namespace irr
168
169#endif
170
diff --git a/src/others/irrlicht-1.8.1/include/ISceneCollisionManager.h b/src/others/irrlicht-1.8.1/include/ISceneCollisionManager.h
new file mode 100644
index 0000000..5da7d9f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneCollisionManager.h
@@ -0,0 +1,205 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_COLLISION_MANAGER_H_INCLUDED__
6#define __I_SCENE_COLLISION_MANAGER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "vector3d.h"
10#include "triangle3d.h"
11#include "position2d.h"
12#include "line3d.h"
13
14namespace irr
15{
16
17namespace scene
18{
19 class ISceneNode;
20 class ICameraSceneNode;
21 class ITriangleSelector;
22
23 //! The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.
24 class ISceneCollisionManager : public virtual IReferenceCounted
25 {
26 public:
27
28 //! Finds the nearest collision point of a line and lots of triangles, if there is one.
29 /** \param ray: Line with which collisions are tested.
30 \param selector: TriangleSelector containing the triangles. It
31 can be created for example using
32 ISceneManager::createTriangleSelector() or
33 ISceneManager::createTriangleOctreeSelector().
34 \param outCollisionPoint: If a collision is detected, this will
35 contain the position of the nearest collision to the line-start.
36 \param outTriangle: If a collision is detected, this will
37 contain the triangle with which the ray collided.
38 \param outNode: If a collision is detected, this will contain
39 the scene node associated with the triangle that was hit.
40 \return True if a collision was detected and false if not. */
41 virtual bool getCollisionPoint(const core::line3d<f32>& ray,
42 ITriangleSelector* selector, core::vector3df& outCollisionPoint,
43 core::triangle3df& outTriangle, ISceneNode*& outNode) =0;
44
45 //! Collides a moving ellipsoid with a 3d world with gravity and returns the resulting new position of the ellipsoid.
46 /** This can be used for moving a character in a 3d world: The
47 character will slide at walls and is able to walk up stairs.
48 The method used how to calculate the collision result position
49 is based on the paper "Improved Collision detection and
50 Response" by Kasper Fauerby.
51 \param selector: TriangleSelector containing the triangles of
52 the world. It can be created for example using
53 ISceneManager::createTriangleSelector() or
54 ISceneManager::createTriangleOctreeSelector().
55 \param ellipsoidPosition: Position of the ellipsoid.
56 \param ellipsoidRadius: Radius of the ellipsoid.
57 \param ellipsoidDirectionAndSpeed: Direction and speed of the
58 movement of the ellipsoid.
59 \param triout: Optional parameter where the last triangle
60 causing a collision is stored, if there is a collision.
61 \param hitPosition: Return value for the position of the collision
62 \param outFalling: Is set to true if the ellipsoid is falling
63 down, caused by gravity.
64 \param outNode: the node with which the ellipoid collided (if any)
65 \param slidingSpeed: DOCUMENTATION NEEDED.
66 \param gravityDirectionAndSpeed: Direction and force of gravity.
67 \return New position of the ellipsoid. */
68 virtual core::vector3df getCollisionResultPosition(
69 ITriangleSelector* selector,
70 const core::vector3df &ellipsoidPosition,
71 const core::vector3df& ellipsoidRadius,
72 const core::vector3df& ellipsoidDirectionAndSpeed,
73 core::triangle3df& triout,
74 core::vector3df& hitPosition,
75 bool& outFalling,
76 ISceneNode*& outNode,
77 f32 slidingSpeed = 0.0005f,
78 const core::vector3df& gravityDirectionAndSpeed
79 = core::vector3df(0.0f, 0.0f, 0.0f)) = 0;
80
81 //! Returns a 3d ray which would go through the 2d screen coodinates.
82 /** \param pos: Screen coordinates in pixels.
83 \param camera: Camera from which the ray starts. If null, the
84 active camera is used.
85 \return Ray starting from the position of the camera and ending
86 at a length of the far value of the camera at a position which
87 would be behind the 2d screen coodinates. */
88 virtual core::line3d<f32> getRayFromScreenCoordinates(
89 const core::position2d<s32>& pos, ICameraSceneNode* camera = 0) = 0;
90
91 //! Calculates 2d screen position from a 3d position.
92 /** \param pos: 3D position in world space to be transformed
93 into 2d.
94 \param camera: Camera to be used. If null, the currently active
95 camera is used.
96 \param useViewPort: Calculate screen coordinates relative to
97 the current view port. Please note that unless the driver does
98 not take care of the view port, it is usually best to get the
99 result in absolute screen coordinates (flag=false).
100 \return 2d screen coordinates which a object in the 3d world
101 would have if it would be rendered to the screen. If the 3d
102 position is behind the camera, it is set to (-1000,-1000). In
103 most cases you can ignore this fact, because if you use this
104 method for drawing a decorator over a 3d object, it will be
105 clipped by the screen borders. */
106 virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition(
107 const core::vector3df& pos, ICameraSceneNode* camera=0, bool useViewPort=false) = 0;
108
109 //! Gets the scene node, which is currently visible under the given screencoordinates, viewed from the currently active camera.
110 /** The collision tests are done using a bounding box for each
111 scene node. You can limit the recursive search so just all children of the specified root are tested.
112 \param pos: Position in pixel screen coordinates, under which
113 the returned scene node will be.
114 \param idBitMask: Only scene nodes with an id with bits set
115 like in this mask will be tested. If the BitMask is 0, this
116 feature is disabled.
117 Please note that the default node id of -1 will match with
118 every bitmask != 0
119 \param bNoDebugObjects: Doesn't take debug objects into account
120 when true. These are scene nodes with IsDebugObject() = true.
121 \param root If different from 0, the search is limited to the children of this node.
122 \return Visible scene node under screen coordinates with
123 matching bits in its id. If there is no scene node under this
124 position, 0 is returned. */
125 virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(const core::position2d<s32>& pos,
126 s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) =0;
127
128 //! Returns the nearest scene node which collides with a 3d ray and whose id matches a bitmask.
129 /** The collision tests are done using a bounding box for each
130 scene node. The recursive search can be limited be specifying a scene node.
131 \param ray Line with which collisions are tested.
132 \param idBitMask Only scene nodes with an id which matches at
133 least one of the bits contained in this mask will be tested.
134 However, if this parameter is 0, then all nodes are checked.
135 \param bNoDebugObjects: Doesn't take debug objects into account when true. These
136 are scene nodes with IsDebugObject() = true.
137 \param root If different from 0, the search is limited to the children of this node.
138 \return Scene node nearest to ray.start, which collides with
139 the ray and matches the idBitMask, if the mask is not null. If
140 no scene node is found, 0 is returned. */
141 virtual ISceneNode* getSceneNodeFromRayBB(const core::line3d<f32>& ray,
142 s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) =0;
143
144 //! Get the scene node, which the given camera is looking at and whose id matches the bitmask.
145 /** A ray is simply casted from the position of the camera to
146 the view target position, and all scene nodes are tested
147 against this ray. The collision tests are done using a bounding
148 box for each scene node.
149 \param camera: Camera from which the ray is casted.
150 \param idBitMask: Only scene nodes with an id which matches at least one of the
151 bits contained in this mask will be tested. However, if this parameter is 0, then
152 all nodes are checked.
153 feature is disabled.
154 Please note that the default node id of -1 will match with
155 every bitmask != 0
156 \param bNoDebugObjects: Doesn't take debug objects into account
157 when true. These are scene nodes with IsDebugObject() = true.
158 \return Scene node nearest to the camera, which collides with
159 the ray and matches the idBitMask, if the mask is not null. If
160 no scene node is found, 0 is returned. */
161 virtual ISceneNode* getSceneNodeFromCameraBB(ICameraSceneNode* camera,
162 s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
163
164 //! Perform a ray/box and ray/triangle collision check on a heirarchy of scene nodes.
165 /** This checks all scene nodes under the specified one, first by ray/bounding
166 box, and then by accurate ray/triangle collision, finding the nearest collision,
167 and the scene node containg it. It returns the node hit, and (via output
168 parameters) the position of the collision, and the triangle that was hit.
169
170 All scene nodes in the hierarchy tree under the specified node are checked. Only
171 nodes that are visible, with an ID that matches at least one bit in the supplied
172 bitmask, and which have a triangle selector are considered as candidates for being hit.
173 You do not have to build a meta triangle selector; the individual triangle selectors
174 of each candidate scene node are used automatically.
175
176 \param ray: Line with which collisions are tested.
177 \param outCollisionPoint: If a collision is detected, this will contain the
178 position of the nearest collision.
179 \param outTriangle: If a collision is detected, this will contain the triangle
180 with which the ray collided.
181 \param idBitMask: Only scene nodes with an id which matches at least one of the
182 bits contained in this mask will be tested. However, if this parameter is 0, then
183 all nodes are checked.
184 \param collisionRootNode: the scene node at which to begin checking. Only this
185 node and its children will be checked. If you want to check the entire scene,
186 pass 0, and the root scene node will be used (this is the default).
187 \param noDebugObjects: when true, debug objects are not considered viable targets.
188 Debug objects are scene nodes with IsDebugObject() = true.
189 \return Returns the scene node containing the hit triangle nearest to ray.start.
190 If no collision is detected, then 0 is returned. */
191 virtual ISceneNode* getSceneNodeAndCollisionPointFromRay(
192 core::line3df ray,
193 core::vector3df & outCollisionPoint,
194 core::triangle3df & outTriangle,
195 s32 idBitMask = 0,
196 ISceneNode * collisionRootNode = 0,
197 bool noDebugObjects = false) = 0;
198 };
199
200
201} // end namespace scene
202} // end namespace irr
203
204#endif
205
diff --git a/src/others/irrlicht-1.8.1/include/ISceneLoader.h b/src/others/irrlicht-1.8.1/include/ISceneLoader.h
new file mode 100644
index 0000000..c71c15d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneLoader.h
@@ -0,0 +1,62 @@
1// Copyright (C) 2010-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_LOADER_H_INCLUDED__
6#define __I_SCENE_LOADER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "path.h"
10
11namespace irr
12{
13namespace io
14{
15 class IReadFile;
16} // end namespace io
17namespace scene
18{
19 class ISceneNode;
20 class ISceneUserDataSerializer;
21
22//! Class which can load a scene into the scene manager.
23/** If you want Irrlicht to be able to load currently unsupported
24scene file formats (e.g. .vrml), then implement this and add your
25new Sceneloader to the engine with ISceneManager::addExternalSceneLoader(). */
26class ISceneLoader : public virtual IReferenceCounted
27{
28public:
29
30 //! Returns true if the class might be able to load this file.
31 /** This decision should be based on the file extension (e.g. ".vrml")
32 only.
33 \param filename Name of the file to test.
34 \return True if the extension is a recognised type. */
35 virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
36
37 //! Returns true if the class might be able to load this file.
38 /** This decision will be based on a quick look at the contents of the file.
39 \param file The file to test.
40 \return True if the extension is a recognised type. */
41 virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;
42
43 //! Loads the scene into the scene manager.
44 /** \param file File which contains the scene.
45 \param userDataSerializer: If you want to load user data which may be attached
46 to some some scene nodes in the file, implement the ISceneUserDataSerializer
47 interface and provide it as parameter here. Otherwise, simply specify 0 as this
48 parameter.
49 \param rootNode The node to load the scene into, if none is provided then the
50 scene will be loaded into the root node.
51 \return Returns true on success, false on failure. Returns 0 if loading failed. */
52 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0,
53 ISceneNode* rootNode=0) = 0;
54
55};
56
57
58} // end namespace scene
59} // end namespace irr
60
61#endif
62
diff --git a/src/others/irrlicht-1.8.1/include/ISceneManager.h b/src/others/irrlicht-1.8.1/include/ISceneManager.h
new file mode 100644
index 0000000..d0b14a1
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneManager.h
@@ -0,0 +1,1663 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_MANAGER_H_INCLUDED__
6#define __I_SCENE_MANAGER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrArray.h"
10#include "irrString.h"
11#include "path.h"
12#include "vector3d.h"
13#include "dimension2d.h"
14#include "SColor.h"
15#include "ETerrainElements.h"
16#include "ESceneNodeTypes.h"
17#include "ESceneNodeAnimatorTypes.h"
18#include "EMeshWriterEnums.h"
19#include "SceneParameters.h"
20#include "IGeometryCreator.h"
21#include "ISkinnedMesh.h"
22
23namespace irr
24{
25 struct SKeyMap;
26 struct SEvent;
27
28namespace io
29{
30 class IReadFile;
31 class IAttributes;
32 class IWriteFile;
33 class IFileSystem;
34} // end namespace io
35
36namespace gui
37{
38 class IGUIFont;
39 class IGUIEnvironment;
40} // end namespace gui
41
42namespace video
43{
44 class IVideoDriver;
45 class SMaterial;
46 class IImage;
47 class ITexture;
48} // end namespace video
49
50namespace scene
51{
52 //! Enumeration for render passes.
53 /** A parameter passed to the registerNodeForRendering() method of the ISceneManager,
54 specifying when the node wants to be drawn in relation to the other nodes. */
55 enum E_SCENE_NODE_RENDER_PASS
56 {
57 //! No pass currently active
58 ESNRP_NONE =0,
59
60 //! Camera pass. The active view is set up here. The very first pass.
61 ESNRP_CAMERA =1,
62
63 //! In this pass, lights are transformed into camera space and added to the driver
64 ESNRP_LIGHT =2,
65
66 //! This is used for sky boxes.
67 ESNRP_SKY_BOX =4,
68
69 //! All normal objects can use this for registering themselves.
70 /** This value will never be returned by
71 ISceneManager::getSceneNodeRenderPass(). The scene manager
72 will determine by itself if an object is transparent or solid
73 and register the object as SNRT_TRANSPARENT or SNRT_SOLD
74 automatically if you call registerNodeForRendering with this
75 value (which is default). Note that it will register the node
76 only as ONE type. If your scene node has both solid and
77 transparent material types register it twice (one time as
78 SNRT_SOLID, the other time as SNRT_TRANSPARENT) and in the
79 render() method call getSceneNodeRenderPass() to find out the
80 current render pass and render only the corresponding parts of
81 the node. */
82 ESNRP_AUTOMATIC =24,
83
84 //! Solid scene nodes or special scene nodes without materials.
85 ESNRP_SOLID =8,
86
87 //! Transparent scene nodes, drawn after solid nodes. They are sorted from back to front and drawn in that order.
88 ESNRP_TRANSPARENT =16,
89
90 //! Transparent effect scene nodes, drawn after Transparent nodes. They are sorted from back to front and drawn in that order.
91 ESNRP_TRANSPARENT_EFFECT =32,
92
93 //! Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes
94 ESNRP_SHADOW =64
95 };
96
97 class IAnimatedMesh;
98 class IAnimatedMeshSceneNode;
99 class IBillboardSceneNode;
100 class IBillboardTextSceneNode;
101 class ICameraSceneNode;
102 class IDummyTransformationSceneNode;
103 class ILightManager;
104 class ILightSceneNode;
105 class IMesh;
106 class IMeshBuffer;
107 class IMeshCache;
108 class IMeshLoader;
109 class IMeshManipulator;
110 class IMeshSceneNode;
111 class IMeshWriter;
112 class IMetaTriangleSelector;
113 class IParticleSystemSceneNode;
114 class ISceneCollisionManager;
115 class ISceneLoader;
116 class ISceneNode;
117 class ISceneNodeAnimator;
118 class ISceneNodeAnimatorCollisionResponse;
119 class ISceneNodeAnimatorFactory;
120 class ISceneNodeFactory;
121 class ISceneUserDataSerializer;
122 class ITerrainSceneNode;
123 class ITextSceneNode;
124 class ITriangleSelector;
125 class IVolumeLightSceneNode;
126
127 namespace quake3
128 {
129 struct IShader;
130 } // end namespace quake3
131
132 //! The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff.
133 /** All Scene nodes can be created only here. There is a always growing
134 list of scene nodes for lots of purposes: Indoor rendering scene nodes
135 like the Octree (addOctreeSceneNode()) or the terrain renderer
136 (addTerrainSceneNode()), different Camera scene nodes
137 (addCameraSceneNode(), addCameraSceneNodeMaya()), scene nodes for Light
138 (addLightSceneNode()), Billboards (addBillboardSceneNode()) and so on.
139 A scene node is a node in the hierachical scene graph. Every scene node
140 may have children, which are other scene nodes. Children move relative
141 the their parents position. If the parent of a node is not visible, its
142 children won't be visible, too. In this way, it is for example easily
143 possible to attach a light to a moving car or to place a walking
144 character on a moving platform on a moving ship.
145 The SceneManager is also able to load 3d mesh files of different
146 formats. Take a look at getMesh() to find out what formats are
147 supported. If these formats are not enough, use
148 addExternalMeshLoader() to add new formats to the engine.
149 */
150 class ISceneManager : public virtual IReferenceCounted
151 {
152 public:
153
154 //! Get pointer to an animateable mesh. Loads the file if not loaded already.
155 /**
156 * If you want to remove a loaded mesh from the cache again, use removeMesh().
157 * Currently there are the following mesh formats supported:
158 * <TABLE border="1" cellpadding="2" cellspacing="0">
159 * <TR>
160 * <TD>Format</TD>
161 * <TD>Description</TD>
162 * </TR>
163 * <TR>
164 * <TD>3D Studio (.3ds)</TD>
165 * <TD>Loader for 3D-Studio files which lots of 3D packages
166 * are able to export. Only static meshes are currently
167 * supported by this importer.</TD>
168 * </TR>
169 * <TR>
170 * <TD>3D World Studio (.smf)</TD>
171 * <TD>Loader for Leadwerks SMF mesh files, a simple mesh format
172 * containing static geometry for games. The proprietary .STF texture format
173 * is not supported yet. This loader was originally written by Joseph Ellis. </TD>
174 * </TR>
175 * <TR>
176 * <TD>Bliz Basic B3D (.b3d)</TD>
177 * <TD>Loader for blitz basic files, developed by Mark
178 * Sibly. This is the ideal animated mesh format for game
179 * characters as it is both rigidly defined and widely
180 * supported by modeling and animation software.
181 * As this format supports skeletal animations, an
182 * ISkinnedMesh will be returned by this importer.</TD>
183 * </TR>
184 * <TR>
185 * <TD>Cartography shop 4 (.csm)</TD>
186 * <TD>Cartography Shop is a modeling program for creating
187 * architecture and calculating lighting. Irrlicht can
188 * directly import .csm files thanks to the IrrCSM library
189 * created by Saurav Mohapatra which is now integrated
190 * directly in Irrlicht. If you are using this loader,
191 * please note that you'll have to set the path of the
192 * textures before loading .csm files. You can do this
193 * using
194 * SceneManager-&gt;getParameters()-&gt;setAttribute(scene::CSM_TEXTURE_PATH,
195 * &quot;path/to/your/textures&quot;);</TD>
196 * </TR>
197 * <TR>
198 * <TD>COLLADA (.dae, .xml)</TD>
199 * <TD>COLLADA is an open Digital Asset Exchange Schema for
200 * the interactive 3D industry. There are exporters and
201 * importers for this format available for most of the
202 * big 3d packagesat http://collada.org. Irrlicht can
203 * import COLLADA files by using the
204 * ISceneManager::getMesh() method. COLLADA files need
205 * not contain only one single mesh but multiple meshes
206 * and a whole scene setup with lights, cameras and mesh
207 * instances, this loader can set up a scene as
208 * described by the COLLADA file instead of loading and
209 * returning one single mesh. By default, this loader
210 * behaves like the other loaders and does not create
211 * instances, but it can be switched into this mode by
212 * using
213 * SceneManager-&gt;getParameters()-&gt;setAttribute(COLLADA_CREATE_SCENE_INSTANCES, true);
214 * Created scene nodes will be named as the names of the
215 * nodes in the COLLADA file. The returned mesh is just
216 * a dummy object in this mode. Meshes included in the
217 * scene will be added into the scene manager with the
218 * following naming scheme:
219 * "path/to/file/file.dea#meshname". The loading of such
220 * meshes is logged. Currently, this loader is able to
221
222
223 * create meshes (made of only polygons), lights, and
224 * cameras. Materials and animations are currently not
225 * supported but this will change with future releases.
226 * </TD>
227 * </TR>
228 * <TR>
229 * <TD>Delgine DeleD (.dmf)</TD>
230 * <TD>DeleD (delgine.com) is a 3D editor and level-editor
231 * combined into one and is specifically designed for 3D
232 * game-development. With this loader, it is possible to
233 * directly load all geometry is as well as textures and
234 * lightmaps from .dmf files. To set texture and
235 * material paths, see scene::DMF_USE_MATERIALS_DIRS and
236 * scene::DMF_TEXTURE_PATH. It is also possible to flip
237 * the alpha texture by setting
238 * scene::DMF_FLIP_ALPHA_TEXTURES to true and to set the
239 * material transparent reference value by setting
240 * scene::DMF_ALPHA_CHANNEL_REF to a float between 0 and
241 * 1. The loader is based on Salvatore Russo's .dmf
242 * loader, I just changed some parts of it. Thanks to
243 * Salvatore for his work and for allowing me to use his
244 * code in Irrlicht and put it under Irrlicht's license.
245 * For newer and more enchanced versions of the loader,
246 * take a look at delgine.com.
247 * </TD>
248 * </TR>
249 * <TR>
250 * <TD>DirectX (.x)</TD>
251 * <TD>Platform independent importer (so not D3D-only) for
252 * .x files. Most 3D packages can export these natively
253 * and there are several tools for them available, e.g.
254 * the Maya exporter included in the DX SDK.
255 * .x files can include skeletal animations and Irrlicht
256 * is able to play and display them, users can manipulate
257 * the joints via the ISkinnedMesh interface. Currently,
258 * Irrlicht only supports uncompressed .x files.</TD>
259 * </TR>
260 * <TR>
261 * <TD>Half-Life model (.mdl)</TD>
262 * <TD>This loader opens Half-life 1 models, it was contributed
263 * by Fabio Concas and adapted by Thomas Alten.</TD>
264 * </TR>
265 * <TR>
266 * <TD>Irrlicht Mesh (.irrMesh)</TD>
267 * <TD>This is a static mesh format written in XML, native
268 * to Irrlicht and written by the irr mesh writer.
269 * This format is exported by the CopperCube engine's
270 * lightmapper.</TD>
271 * </TR>
272 * <TR>
273 * <TD>LightWave (.lwo)</TD>
274 * <TD>Native to NewTek's LightWave 3D, the LWO format is well
275 * known and supported by many exporters. This loader will
276 * import LWO2 models including lightmaps, bumpmaps and
277 * reflection textures.</TD>
278 * </TR>
279 * <TR>
280 * <TD>Maya (.obj)</TD>
281 * <TD>Most 3D software can create .obj files which contain
282 * static geometry without material data. The material
283 * files .mtl are also supported. This importer for
284 * Irrlicht can load them directly. </TD>
285 * </TR>
286 * <TR>
287 * <TD>Milkshape (.ms3d)</TD>
288 * <TD>.MS3D files contain models and sometimes skeletal
289 * animations from the Milkshape 3D modeling and animation
290 * software. Like the other skeletal mesh loaders, oints
291 * are exposed via the ISkinnedMesh animated mesh type.</TD>
292 * </TR>
293 * <TR>
294 * <TD>My3D (.my3d)</TD>
295 * <TD>.my3D is a flexible 3D file format. The My3DTools
296 * contains plug-ins to export .my3D files from several
297 * 3D packages. With this built-in importer, Irrlicht
298 * can read and display those files directly. This
299 * loader was written by Zhuck Dimitry who also created
300 * the whole My3DTools package. If you are using this
301 * loader, please note that you can set the path of the
302 * textures before loading .my3d files. You can do this
303 * using
304 * SceneManager-&gt;getParameters()-&gt;setAttribute(scene::MY3D_TEXTURE_PATH,
305 * &quot;path/to/your/textures&quot;);
306 * </TD>
307 * </TR>
308 * <TR>
309 * <TD>OCT (.oct)</TD>
310 * <TD>The oct file format contains 3D geometry and
311 * lightmaps and can be loaded directly by Irrlicht. OCT
312 * files<br> can be created by FSRad, Paul Nette's
313 * radiosity processor or exported from Blender using
314 * OCTTools which can be found in the exporters/OCTTools
315 * directory of the SDK. Thanks to Murphy McCauley for
316 * creating all this.</TD>
317 * </TR>
318 * <TR>
319 * <TD>OGRE Meshes (.mesh)</TD>
320 * <TD>Ogre .mesh files contain 3D data for the OGRE 3D
321 * engine. Irrlicht can read and display them directly
322 * with this importer. To define materials for the mesh,
323 * copy a .material file named like the corresponding
324 * .mesh file where the .mesh file is. (For example
325 * ogrehead.material for ogrehead.mesh). Thanks to
326 * Christian Stehno who wrote and contributed this
327 * loader.</TD>
328 * </TR>
329 * <TR>
330 * <TD>Pulsar LMTools (.lmts)</TD>
331 * <TD>LMTools is a set of tools (Windows &amp; Linux) for
332 * creating lightmaps. Irrlicht can directly read .lmts
333 * files thanks to<br> the importer created by Jonas
334 * Petersen. If you are using this loader, please note
335 * that you can set the path of the textures before
336 * loading .lmts files. You can do this using
337 * SceneManager-&gt;getParameters()-&gt;setAttribute(scene::LMTS_TEXTURE_PATH,
338 * &quot;path/to/your/textures&quot;);
339 * Notes for<br> this version of the loader:<br>
340 * - It does not recognise/support user data in the
341 * *.lmts files.<br>
342 * - The TGAs generated by LMTools don't work in
343 * Irrlicht for some reason (the textures are upside
344 * down). Opening and resaving them in a graphics app
345 * will solve the problem.</TD>
346 * </TR>
347 * <TR>
348 * <TD>Quake 3 levels (.bsp)</TD>
349 * <TD>Quake 3 is a popular game by IDSoftware, and .pk3
350 * files contain .bsp files and textures/lightmaps
351 * describing huge prelighted levels. Irrlicht can read
352 * .pk3 and .bsp files directly and thus render Quake 3
353 * levels directly. Written by Nikolaus Gebhardt
354 * enhanced by Dean P. Macri with the curved surfaces
355 * feature. </TD>
356 * </TR>
357 * <TR>
358 * <TD>Quake 2 models (.md2)</TD>
359 * <TD>Quake 2 models are characters with morph target
360 * animation. Irrlicht can read, display and animate
361 * them directly with this importer. </TD>
362 * </TR>
363 * <TR>
364 * <TD>Quake 3 models (.md3)</TD>
365 * <TD>Quake 3 models are characters with morph target
366 * animation, they contain mount points for weapons and body
367 * parts and are typically made of several sections which are
368 * manually joined together.</TD>
369 * </TR>
370 * <TR>
371 * <TD>Stanford Triangle (.ply)</TD>
372 * <TD>Invented by Stanford University and known as the native
373 * format of the infamous "Stanford Bunny" model, this is a
374 * popular static mesh format used by 3D scanning hardware
375 * and software. This loader supports extremely large models
376 * in both ASCII and binary format, but only has rudimentary
377 * material support in the form of vertex colors and texture
378 * coordinates.</TD>
379 * </TR>
380 * <TR>
381 * <TD>Stereolithography (.stl)</TD>
382 * <TD>The STL format is used for rapid prototyping and
383 * computer-aided manufacturing, thus has no support for
384 * materials.</TD>
385 * </TR>
386 * </TABLE>
387 *
388 * To load and display a mesh quickly, just do this:
389 * \code
390 * SceneManager->addAnimatedMeshSceneNode(
391 * SceneManager->getMesh("yourmesh.3ds"));
392 * \endcode
393 * If you would like to implement and add your own file format loader to Irrlicht,
394 * see addExternalMeshLoader().
395 * \param filename: Filename of the mesh to load.
396 * \return Null if failed, otherwise pointer to the mesh.
397 * This pointer should not be dropped. See IReferenceCounted::drop() for more information.
398 **/
399 virtual IAnimatedMesh* getMesh(const io::path& filename) = 0;
400
401 //! Get pointer to an animateable mesh. Loads the file if not loaded already.
402 /** Works just as getMesh(const char* filename). If you want to
403 remove a loaded mesh from the cache again, use removeMesh().
404 \param file File handle of the mesh to load.
405 \return NULL if failed and pointer to the mesh if successful.
406 This pointer should not be dropped. See
407 IReferenceCounted::drop() for more information. */
408 virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0;
409
410 //! Get interface to the mesh cache which is shared beween all existing scene managers.
411 /** With this interface, it is possible to manually add new loaded
412 meshes (if ISceneManager::getMesh() is not sufficient), to remove them and to iterate
413 through already loaded meshes. */
414 virtual IMeshCache* getMeshCache() = 0;
415
416 //! Get the video driver.
417 /** \return Pointer to the video Driver.
418 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
419 virtual video::IVideoDriver* getVideoDriver() = 0;
420
421 //! Get the active GUIEnvironment
422 /** \return Pointer to the GUIEnvironment
423 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
424 virtual gui::IGUIEnvironment* getGUIEnvironment() = 0;
425
426 //! Get the active FileSystem
427 /** \return Pointer to the FileSystem
428 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
429 virtual io::IFileSystem* getFileSystem() = 0;
430
431 //! adds Volume Lighting Scene Node.
432 /** Example Usage:
433 scene::IVolumeLightSceneNode * n = smgr->addVolumeLightSceneNode(0, -1,
434 32, 32, //Subdivide U/V
435 video::SColor(0, 180, 180, 180), //foot color
436 video::SColor(0, 0, 0, 0) //tail color
437 );
438 if (n)
439 {
440 n->setScale(core::vector3df(46.0f, 45.0f, 46.0f));
441 n->getMaterial(0).setTexture(0, smgr->getVideoDriver()->getTexture("lightFalloff.png"));
442 }
443 \return Pointer to the volumeLight if successful, otherwise NULL.
444 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
445 virtual IVolumeLightSceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1,
446 const u32 subdivU = 32, const u32 subdivV = 32,
447 const video::SColor foot = video::SColor(51, 0, 230, 180),
448 const video::SColor tail = video::SColor(0, 0, 0, 0),
449 const core::vector3df& position = core::vector3df(0,0,0),
450 const core::vector3df& rotation = core::vector3df(0,0,0),
451 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
452
453 //! Adds a cube scene node
454 /** \param size: Size of the cube, uniformly in each dimension.
455 \param parent: Parent of the scene node. Can be 0 if no parent.
456 \param id: Id of the node. This id can be used to identify the scene node.
457 \param position: Position of the space relative to its parent
458 where the scene node will be placed.
459 \param rotation: Initital rotation of the scene node.
460 \param scale: Initial scale of the scene node.
461 \return Pointer to the created test scene node. This
462 pointer should not be dropped. See IReferenceCounted::drop()
463 for more information. */
464 virtual IMeshSceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1,
465 const core::vector3df& position = core::vector3df(0,0,0),
466 const core::vector3df& rotation = core::vector3df(0,0,0),
467 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
468
469 //! Adds a sphere scene node of the given radius and detail
470 /** \param radius: Radius of the sphere.
471 \param polyCount: The number of vertices in horizontal and
472 vertical direction. The total polyCount of the sphere is
473 polyCount*polyCount. This parameter must be less than 256 to
474 stay within the 16-bit limit of the indices of a meshbuffer.
475 \param parent: Parent of the scene node. Can be 0 if no parent.
476 \param id: Id of the node. This id can be used to identify the scene node.
477 \param position: Position of the space relative to its parent
478 where the scene node will be placed.
479 \param rotation: Initital rotation of the scene node.
480 \param scale: Initial scale of the scene node.
481 \return Pointer to the created test scene node. This
482 pointer should not be dropped. See IReferenceCounted::drop()
483 for more information. */
484 virtual IMeshSceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16,
485 ISceneNode* parent=0, s32 id=-1,
486 const core::vector3df& position = core::vector3df(0,0,0),
487 const core::vector3df& rotation = core::vector3df(0,0,0),
488 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
489
490 //! Adds a scene node for rendering an animated mesh model.
491 /** \param mesh: Pointer to the loaded animated mesh to be displayed.
492 \param parent: Parent of the scene node. Can be NULL if no parent.
493 \param id: Id of the node. This id can be used to identify the scene node.
494 \param position: Position of the space relative to its parent where the
495 scene node will be placed.
496 \param rotation: Initital rotation of the scene node.
497 \param scale: Initial scale of the scene node.
498 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
499 \return Pointer to the created scene node.
500 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
501 virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh,
502 ISceneNode* parent=0, s32 id=-1,
503 const core::vector3df& position = core::vector3df(0,0,0),
504 const core::vector3df& rotation = core::vector3df(0,0,0),
505 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),
506 bool alsoAddIfMeshPointerZero=false) = 0;
507
508 //! Adds a scene node for rendering a static mesh.
509 /** \param mesh: Pointer to the loaded static mesh to be displayed.
510 \param parent: Parent of the scene node. Can be NULL if no parent.
511 \param id: Id of the node. This id can be used to identify the scene node.
512 \param position: Position of the space relative to its parent where the
513 scene node will be placed.
514 \param rotation: Initital rotation of the scene node.
515 \param scale: Initial scale of the scene node.
516 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
517 \return Pointer to the created scene node.
518 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
519 virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1,
520 const core::vector3df& position = core::vector3df(0,0,0),
521 const core::vector3df& rotation = core::vector3df(0,0,0),
522 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),
523 bool alsoAddIfMeshPointerZero=false) = 0;
524
525 //! Adds a scene node for rendering a animated water surface mesh.
526 /** Looks really good when the Material type EMT_TRANSPARENT_REFLECTION
527 is used.
528 \param waveHeight: Height of the water waves.
529 \param waveSpeed: Speed of the water waves.
530 \param waveLength: Lenght of a water wave.
531 \param mesh: Pointer to the loaded static mesh to be displayed with water waves on it.
532 \param parent: Parent of the scene node. Can be NULL if no parent.
533 \param id: Id of the node. This id can be used to identify the scene node.
534 \param position: Position of the space relative to its parent where the
535 scene node will be placed.
536 \param rotation: Initital rotation of the scene node.
537 \param scale: Initial scale of the scene node.
538 \return Pointer to the created scene node.
539 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
540 virtual ISceneNode* addWaterSurfaceSceneNode(IMesh* mesh,
541 f32 waveHeight=2.0f, f32 waveSpeed=300.0f, f32 waveLength=10.0f,
542 ISceneNode* parent=0, s32 id=-1,
543 const core::vector3df& position = core::vector3df(0,0,0),
544 const core::vector3df& rotation = core::vector3df(0,0,0),
545 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
546
547
548 //! Adds a scene node for rendering using a octree to the scene graph.
549 /** This a good method for rendering
550 scenes with lots of geometry. The Octree is built on the fly from the mesh.
551 \param mesh: The mesh containing all geometry from which the octree will be build.
552 If this animated mesh has more than one frames in it, the first frame is taken.
553 \param parent: Parent node of the octree node.
554 \param id: id of the node. This id can be used to identify the node.
555 \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node.
556 If a node gets less polys than this value it will not be split into
557 smaller nodes.
558 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
559 \return Pointer to the Octree if successful, otherwise 0.
560 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
561 virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
562 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0;
563
564 //! Adds a scene node for rendering using a octree to the scene graph.
565 /** \deprecated Use addOctreeSceneNode instead. This method may be removed by Irrlicht 1.9. */
566 _IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
567 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false)
568 {
569 return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero);
570 }
571
572 //! Adds a scene node for rendering using a octree to the scene graph.
573 /** This a good method for rendering scenes with lots of
574 geometry. The Octree is built on the fly from the mesh, much
575 faster then a bsp tree.
576 \param mesh: The mesh containing all geometry from which the octree will be build.
577 \param parent: Parent node of the octree node.
578 \param id: id of the node. This id can be used to identify the node.
579 \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node.
580 If a node gets less polys than this value it will not be split into
581 smaller nodes.
582 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
583 \return Pointer to the octree if successful, otherwise 0.
584 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
585 virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
586 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
587
588 //! Adds a scene node for rendering using a octree to the scene graph.
589 /** \deprecated Use addOctreeSceneNode instead. This method may be removed by Irrlicht 1.9. */
590 _IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
591 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false)
592 {
593 return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero);
594 }
595
596 //! Adds a camera scene node to the scene graph and sets it as active camera.
597 /** This camera does not react on user input like for example the one created with
598 addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the
599 ISceneNode::setPosition(), ICameraSceneNode::setTarget() etc methods.
600 By default, a camera's look at position (set with setTarget()) and its scene node
601 rotation (set with setRotation()) are independent. If you want to be able to
602 control the direction that the camera looks by using setRotation() then call
603 ICameraSceneNode::bindTargetAndRotation(true) on it.
604 \param position: Position of the space relative to its parent where the camera will be placed.
605 \param lookat: Position where the camera will look at. Also known as target.
606 \param parent: Parent scene node of the camera. Can be null. If the parent moves,
607 the camera will move too.
608 \param id: id of the camera. This id can be used to identify the camera.
609 \param makeActive Flag whether this camera should become the active one.
610 Make sure you always have one active camera.
611 \return Pointer to interface to camera if successful, otherwise 0.
612 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
613 virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
614 const core::vector3df& position = core::vector3df(0,0,0),
615 const core::vector3df& lookat = core::vector3df(0,0,100),
616 s32 id=-1, bool makeActive=true) = 0;
617
618 //! Adds a maya style user controlled camera scene node to the scene graph.
619 /** This is a standard camera with an animator that provides mouse control similar
620 to camera in the 3D Software Maya by Alias Wavefront.
621 The camera does not react on setPosition anymore after applying this animator. Instead
622 use setTarget, to fix the target the camera the camera hovers around. And setDistance
623 to set the current distance from that target, i.e. the radius of the orbit the camera
624 hovers on.
625 \param parent: Parent scene node of the camera. Can be null.
626 \param rotateSpeed: Rotation speed of the camera.
627 \param zoomSpeed: Zoom speed of the camera.
628 \param translationSpeed: TranslationSpeed of the camera.
629 \param id: id of the camera. This id can be used to identify the camera.
630 \param distance Initial distance of the camera from the object
631 \param makeActive Flag whether this camera should become the active one.
632 Make sure you always have one active camera.
633 \return Returns a pointer to the interface of the camera if successful, otherwise 0.
634 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
635 virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent=0,
636 f32 rotateSpeed=-1500.f, f32 zoomSpeed=200.f,
637 f32 translationSpeed=1500.f, s32 id=-1, f32 distance=70.f,
638 bool makeActive=true) =0;
639
640 //! Adds a camera scene node with an animator which provides mouse and keyboard control appropriate for first person shooters (FPS).
641 /** This FPS camera is intended to provide a demonstration of a
642 camera that behaves like a typical First Person Shooter. It is
643 useful for simple demos and prototyping but is not intended to
644 provide a full solution for a production quality game. It binds
645 the camera scene node rotation to the look-at target; @see
646 ICameraSceneNode::bindTargetAndRotation(). With this camera,
647 you look with the mouse, and move with cursor keys. If you want
648 to change the key layout, you can specify your own keymap. For
649 example to make the camera be controlled by the cursor keys AND
650 the keys W,A,S, and D, do something like this:
651 \code
652 SKeyMap keyMap[8];
653 keyMap[0].Action = EKA_MOVE_FORWARD;
654 keyMap[0].KeyCode = KEY_UP;
655 keyMap[1].Action = EKA_MOVE_FORWARD;
656 keyMap[1].KeyCode = KEY_KEY_W;
657
658 keyMap[2].Action = EKA_MOVE_BACKWARD;
659 keyMap[2].KeyCode = KEY_DOWN;
660 keyMap[3].Action = EKA_MOVE_BACKWARD;
661 keyMap[3].KeyCode = KEY_KEY_S;
662
663 keyMap[4].Action = EKA_STRAFE_LEFT;
664 keyMap[4].KeyCode = KEY_LEFT;
665 keyMap[5].Action = EKA_STRAFE_LEFT;
666 keyMap[5].KeyCode = KEY_KEY_A;
667
668 keyMap[6].Action = EKA_STRAFE_RIGHT;
669 keyMap[6].KeyCode = KEY_RIGHT;
670 keyMap[7].Action = EKA_STRAFE_RIGHT;
671 keyMap[7].KeyCode = KEY_KEY_D;
672
673 camera = sceneManager->addCameraSceneNodeFPS(0, 100, 500, -1, keyMap, 8);
674 \endcode
675 \param parent: Parent scene node of the camera. Can be null.
676 \param rotateSpeed: Speed in degress with which the camera is
677 rotated. This can be done only with the mouse.
678 \param moveSpeed: Speed in units per millisecond with which
679 the camera is moved. Movement is done with the cursor keys.
680 \param id: id of the camera. This id can be used to identify
681 the camera.
682 \param keyMapArray: Optional pointer to an array of a keymap,
683 specifying what keys should be used to move the camera. If this
684 is null, the default keymap is used. You can define actions
685 more then one time in the array, to bind multiple keys to the
686 same action.
687 \param keyMapSize: Amount of items in the keymap array.
688 \param noVerticalMovement: Setting this to true makes the
689 camera only move within a horizontal plane, and disables
690 vertical movement as known from most ego shooters. Default is
691 'false', with which it is possible to fly around in space, if
692 no gravity is there.
693 \param jumpSpeed: Speed with which the camera is moved when
694 jumping.
695 \param invertMouse: Setting this to true makes the camera look
696 up when the mouse is moved down and down when the mouse is
697 moved up, the default is 'false' which means it will follow the
698 movement of the mouse cursor.
699 \param makeActive Flag whether this camera should become the active one.
700 Make sure you always have one active camera.
701 \return Pointer to the interface of the camera if successful,
702 otherwise 0. This pointer should not be dropped. See
703 IReferenceCounted::drop() for more information. */
704 virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
705 f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
706 SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
707 f32 jumpSpeed = 0.f, bool invertMouse=false,
708 bool makeActive=true) = 0;
709
710 //! Adds a dynamic light scene node to the scene graph.
711 /** The light will cast dynamic light on all
712 other scene nodes in the scene, which have the material flag video::MTF_LIGHTING
713 turned on. (This is the default setting in most scene nodes).
714 \param parent: Parent scene node of the light. Can be null. If the parent moves,
715 the light will move too.
716 \param position: Position of the space relative to its parent where the light will be placed.
717 \param color: Diffuse color of the light. Ambient or Specular colors can be set manually with
718 the ILightSceneNode::getLightData() method.
719 \param radius: Radius of the light.
720 \param id: id of the node. This id can be used to identify the node.
721 \return Pointer to the interface of the light if successful, otherwise NULL.
722 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
723 virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0,
724 const core::vector3df& position = core::vector3df(0,0,0),
725 video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f),
726 f32 radius=100.0f, s32 id=-1) = 0;
727
728 //! Adds a billboard scene node to the scene graph.
729 /** A billboard is like a 3d sprite: A 2d element,
730 which always looks to the camera. It is usually used for things
731 like explosions, fire, lensflares and things like that.
732 \param parent Parent scene node of the billboard. Can be null.
733 If the parent moves, the billboard will move too.
734 \param size Size of the billboard. This size is 2 dimensional
735 because a billboard only has width and height.
736 \param position Position of the space relative to its parent
737 where the billboard will be placed.
738 \param id An id of the node. This id can be used to identify
739 the node.
740 \param colorTop The color of the vertices at the top of the
741 billboard (default: white).
742 \param colorBottom The color of the vertices at the bottom of
743 the billboard (default: white).
744 \return Pointer to the billboard if successful, otherwise NULL.
745 This pointer should not be dropped. See
746 IReferenceCounted::drop() for more information. */
747 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0,
748 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
749 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
750 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
751
752 //! Adds a skybox scene node to the scene graph.
753 /** A skybox is a big cube with 6 textures on it and
754 is drawn around the camera position.
755 \param top: Texture for the top plane of the box.
756 \param bottom: Texture for the bottom plane of the box.
757 \param left: Texture for the left plane of the box.
758 \param right: Texture for the right plane of the box.
759 \param front: Texture for the front plane of the box.
760 \param back: Texture for the back plane of the box.
761 \param parent: Parent scene node of the skybox. A skybox usually has no parent,
762 so this should be null. Note: If a parent is set to the skybox, the box will not
763 change how it is drawn.
764 \param id: An id of the node. This id can be used to identify the node.
765 \return Pointer to the sky box if successful, otherwise NULL.
766 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
767 virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom,
768 video::ITexture* left, video::ITexture* right, video::ITexture* front,
769 video::ITexture* back, ISceneNode* parent = 0, s32 id=-1) = 0;
770
771 //! Adds a skydome scene node to the scene graph.
772 /** A skydome is a large (half-) sphere with a panoramic texture
773 on the inside and is drawn around the camera position.
774 \param texture: Texture for the dome.
775 \param horiRes: Number of vertices of a horizontal layer of the sphere.
776 \param vertRes: Number of vertices of a vertical layer of the sphere.
777 \param texturePercentage: How much of the height of the
778 texture is used. Should be between 0 and 1.
779 \param spherePercentage: How much of the sphere is drawn.
780 Value should be between 0 and 2, where 1 is an exact
781 half-sphere and 2 is a full sphere.
782 \param radius The Radius of the sphere
783 \param parent: Parent scene node of the dome. A dome usually has no parent,
784 so this should be null. Note: If a parent is set, the dome will not
785 change how it is drawn.
786 \param id: An id of the node. This id can be used to identify the node.
787 \return Pointer to the sky dome if successful, otherwise NULL.
788 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
789 virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
790 u32 horiRes=16, u32 vertRes=8,
791 f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f,
792 ISceneNode* parent=0, s32 id=-1) = 0;
793
794 //! Adds a particle system scene node to the scene graph.
795 /** \param withDefaultEmitter: Creates a default working point emitter
796 which emitts some particles. Set this to true to see a particle system
797 in action. If set to false, you'll have to set the emitter you want by
798 calling IParticleSystemSceneNode::setEmitter().
799 \param parent: Parent of the scene node. Can be NULL if no parent.
800 \param id: Id of the node. This id can be used to identify the scene node.
801 \param position: Position of the space relative to its parent where the
802 scene node will be placed.
803 \param rotation: Initital rotation of the scene node.
804 \param scale: Initial scale of the scene node.
805 \return Pointer to the created scene node.
806 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
807 virtual IParticleSystemSceneNode* addParticleSystemSceneNode(
808 bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1,
809 const core::vector3df& position = core::vector3df(0,0,0),
810 const core::vector3df& rotation = core::vector3df(0,0,0),
811 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
812
813 //! Adds a terrain scene node to the scene graph.
814 /** This node implements is a simple terrain renderer which uses
815 a technique known as geo mip mapping
816 for reducing the detail of triangle blocks which are far away.
817 The code for the TerrainSceneNode is based on the terrain
818 renderer by Soconne and the GeoMipMapSceneNode developed by
819 Spintz. They made their code available for Irrlicht and allowed
820 it to be distributed under this licence. I only modified some
821 parts. A lot of thanks go to them.
822
823 This scene node is capable of loading terrains and updating
824 the indices at runtime to enable viewing very large terrains
825 very quickly. It uses a CLOD (Continuous Level of Detail)
826 algorithm which updates the indices for each patch based on
827 a LOD (Level of Detail) which is determined based on a patch's
828 distance from the camera.
829
830 The patch size of the terrain must always be a size of 2^N+1,
831 i.e. 8+1(9), 16+1(17), etc.
832 The MaxLOD available is directly dependent on the patch size
833 of the terrain. LOD 0 contains all of the indices to draw all
834 the triangles at the max detail for a patch. As each LOD goes
835 up by 1 the step taken, in generating indices increases by
836 -2^LOD, so for LOD 1, the step taken is 2, for LOD 2, the step
837 taken is 4, LOD 3 - 8, etc. The step can be no larger than
838 the size of the patch, so having a LOD of 8, with a patch size
839 of 17, is asking the algoritm to generate indices every 2^8 (
840 256 ) vertices, which is not possible with a patch size of 17.
841 The maximum LOD for a patch size of 17 is 2^4 ( 16 ). So,
842 with a MaxLOD of 5, you'll have LOD 0 ( full detail ), LOD 1 (
843 every 2 vertices ), LOD 2 ( every 4 vertices ), LOD 3 ( every
844 8 vertices ) and LOD 4 ( every 16 vertices ).
845 \param heightMapFileName: The name of the file on disk, to read vertex data from. This should
846 be a gray scale bitmap.
847 \param parent: Parent of the scene node. Can be 0 if no parent.
848 \param id: Id of the node. This id can be used to identify the scene node.
849 \param position: The absolute position of this node.
850 \param rotation: The absolute rotation of this node. ( NOT YET IMPLEMENTED )
851 \param scale: The scale factor for the terrain. If you're
852 using a heightmap of size 129x129 and would like your terrain
853 to be 12900x12900 in game units, then use a scale factor of (
854 core::vector ( 100.0f, 100.0f, 100.0f ). If you use a Y
855 scaling factor of 0.0f, then your terrain will be flat.
856 \param vertexColor: The default color of all the vertices. If no texture is associated
857 with the scene node, then all vertices will be this color. Defaults to white.
858 \param maxLOD: The maximum LOD (level of detail) for the node. Only change if you
859 know what you are doing, this might lead to strange behavior.
860 \param patchSize: patch size of the terrain. Only change if you
861 know what you are doing, this might lead to strange behavior.
862 \param smoothFactor: The number of times the vertices are smoothed.
863 \param addAlsoIfHeightmapEmpty: Add terrain node even with empty heightmap.
864 \return Pointer to the created scene node. Can be null
865 if the terrain could not be created, for example because the
866 heightmap could not be loaded. The returned pointer should
867 not be dropped. See IReferenceCounted::drop() for more
868 information. */
869 virtual ITerrainSceneNode* addTerrainSceneNode(
870 const io::path& heightMapFileName,
871 ISceneNode* parent=0, s32 id=-1,
872 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
873 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
874 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
875 video::SColor vertexColor = video::SColor(255,255,255,255),
876 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
877 bool addAlsoIfHeightmapEmpty = false) = 0;
878
879 //! Adds a terrain scene node to the scene graph.
880 /** Just like the other addTerrainSceneNode() method, but takes an IReadFile
881 pointer as parameter for the heightmap. For more informations take a look
882 at the other function.
883 \param heightMapFile: The file handle to read vertex data from. This should
884 be a gray scale bitmap.
885 \param parent: Parent of the scene node. Can be 0 if no parent.
886 \param id: Id of the node. This id can be used to identify the scene node.
887 \param position: The absolute position of this node.
888 \param rotation: The absolute rotation of this node. ( NOT YET IMPLEMENTED )
889 \param scale: The scale factor for the terrain. If you're
890 using a heightmap of size 129x129 and would like your terrain
891 to be 12900x12900 in game units, then use a scale factor of (
892 core::vector ( 100.0f, 100.0f, 100.0f ). If you use a Y
893 scaling factor of 0.0f, then your terrain will be flat.
894 \param vertexColor: The default color of all the vertices. If no texture is associated
895 with the scene node, then all vertices will be this color. Defaults to white.
896 \param maxLOD: The maximum LOD (level of detail) for the node. Only change if you
897 know what you are doing, this might lead to strange behavior.
898 \param patchSize: patch size of the terrain. Only change if you
899 know what you are doing, this might lead to strange behavior.
900 \param smoothFactor: The number of times the vertices are smoothed.
901 \param addAlsoIfHeightmapEmpty: Add terrain node even with empty heightmap.
902 \return Pointer to the created scene node. Can be null
903 if the terrain could not be created, for example because the
904 heightmap could not be loaded. The returned pointer should
905 not be dropped. See IReferenceCounted::drop() for more
906 information. */
907 virtual ITerrainSceneNode* addTerrainSceneNode(
908 io::IReadFile* heightMapFile,
909 ISceneNode* parent=0, s32 id=-1,
910 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
911 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
912 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
913 video::SColor vertexColor = video::SColor(255,255,255,255),
914 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
915 bool addAlsoIfHeightmapEmpty = false) = 0;
916
917 //! Adds a quake3 scene node to the scene graph.
918 /** A Quake3 Scene renders multiple meshes for a specific HighLanguage Shader (Quake3 Style )
919 \return Pointer to the quake3 scene node if successful, otherwise NULL.
920 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
921 virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
922 ISceneNode* parent=0, s32 id=-1
923 ) = 0;
924
925
926 //! Adds an empty scene node to the scene graph.
927 /** Can be used for doing advanced transformations
928 or structuring the scene graph.
929 \return Pointer to the created scene node.
930 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
931 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0;
932
933 //! Adds a dummy transformation scene node to the scene graph.
934 /** This scene node does not render itself, and does not respond to set/getPosition,
935 set/getRotation and set/getScale. Its just a simple scene node that takes a
936 matrix as relative transformation, making it possible to insert any transformation
937 anywhere into the scene graph.
938 \return Pointer to the created scene node.
939 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
940 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode(
941 ISceneNode* parent=0, s32 id=-1) = 0;
942
943 //! Adds a text scene node, which is able to display 2d text at a position in three dimensional space
944 virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text,
945 video::SColor color=video::SColor(100,255,255,255),
946 ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0),
947 s32 id=-1) = 0;
948
949 //! Adds a text scene node, which uses billboards. The node, and the text on it, will scale with distance.
950 /**
951 \param font The font to use on the billboard. Pass 0 to use the GUI environment's default font.
952 \param text The text to display on the billboard.
953 \param parent The billboard's parent. Pass 0 to use the root scene node.
954 \param size The billboard's width and height.
955 \param position The billboards position relative to its parent.
956 \param id: An id of the node. This id can be used to identify the node.
957 \param colorTop: The color of the vertices at the top of the billboard (default: white).
958 \param colorBottom: The color of the vertices at the bottom of the billboard (default: white).
959 \return Pointer to the billboard if successful, otherwise NULL.
960 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
961 virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text,
962 ISceneNode* parent = 0,
963 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
964 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
965 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
966
967 //! Adds a Hill Plane mesh to the mesh pool.
968 /** The mesh is generated on the fly
969 and looks like a plane with some hills on it. It is uses mostly for quick
970 tests of the engine only. You can specify how many hills there should be
971 on the plane and how high they should be. Also you must specify a name for
972 the mesh, because the mesh is added to the mesh pool, and can be retrieved
973 again using ISceneManager::getMesh() with the name as parameter.
974 \param name: The name of this mesh which must be specified in order
975 to be able to retrieve the mesh later with ISceneManager::getMesh().
976 \param tileSize: Size of a tile of the mesh. (10.0f, 10.0f) would be a
977 good value to start, for example.
978 \param tileCount: Specifies how much tiles there will be. If you specifiy
979 for example that a tile has the size (10.0f, 10.0f) and the tileCount is
980 (10,10), than you get a field of 100 tiles which has the dimension 100.0fx100.0f.
981 \param material: Material of the hill mesh.
982 \param hillHeight: Height of the hills. If you specify a negative value
983 you will get holes instead of hills. If the height is 0, no hills will be
984 created.
985 \param countHills: Amount of hills on the plane. There will be countHills.X
986 hills along the X axis and countHills.Y along the Y axis. So in total there
987 will be countHills.X * countHills.Y hills.
988 \param textureRepeatCount: Defines how often the texture will be repeated in
989 x and y direction.
990 return Null if the creation failed. The reason could be that you
991 specified some invalid parameters or that a mesh with that name already
992 exists. If successful, a pointer to the mesh is returned.
993 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
994 virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name,
995 const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
996 video::SMaterial* material = 0, f32 hillHeight = 0.0f,
997 const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f),
998 const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0;
999
1000 //! Adds a static terrain mesh to the mesh pool.
1001 /** The mesh is generated on the fly
1002 from a texture file and a height map file. Both files may be huge
1003 (8000x8000 pixels would be no problem) because the generator splits the
1004 files into smaller textures if necessary.
1005 You must specify a name for the mesh, because the mesh is added to the mesh pool,
1006 and can be retrieved again using ISceneManager::getMesh() with the name as parameter.
1007 \param meshname: The name of this mesh which must be specified in order
1008 to be able to retrieve the mesh later with ISceneManager::getMesh().
1009 \param texture: Texture for the terrain. Please note that this is not a
1010 hardware texture as usual (ITexture), but an IImage software texture.
1011 You can load this texture with IVideoDriver::createImageFromFile().
1012 \param heightmap: A grayscaled heightmap image. Like the texture,
1013 it can be created with IVideoDriver::createImageFromFile(). The amount
1014 of triangles created depends on the size of this texture, so use a small
1015 heightmap to increase rendering speed.
1016 \param stretchSize: Parameter defining how big a is pixel on the heightmap.
1017 \param maxHeight: Defines how high a white pixel on the heighmap is.
1018 \param defaultVertexBlockSize: Defines the initial dimension between vertices.
1019 \return Null if the creation failed. The reason could be that you
1020 specified some invalid parameters, that a mesh with that name already
1021 exists, or that a texture could not be found. If successful, a pointer to the mesh is returned.
1022 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1023 virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname,
1024 video::IImage* texture, video::IImage* heightmap,
1025 const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f),
1026 f32 maxHeight=200.0f,
1027 const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)) = 0;
1028
1029 //! add a static arrow mesh to the meshpool
1030 /** \param name Name of the mesh
1031 \param vtxColorCylinder color of the cylinder
1032 \param vtxColorCone color of the cone
1033 \param tesselationCylinder Number of quads the cylinder side consists of
1034 \param tesselationCone Number of triangles the cone's roof consits of
1035 \param height Total height of the arrow
1036 \param cylinderHeight Total height of the cylinder, should be lesser than total height
1037 \param widthCylinder Diameter of the cylinder
1038 \param widthCone Diameter of the cone's base, should be not smaller than the cylinder's diameter
1039 \return Pointer to the arrow mesh if successful, otherwise 0.
1040 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1041 virtual IAnimatedMesh* addArrowMesh(const io::path& name,
1042 video::SColor vtxColorCylinder=0xFFFFFFFF,
1043 video::SColor vtxColorCone=0xFFFFFFFF,
1044 u32 tesselationCylinder=4, u32 tesselationCone=8,
1045 f32 height=1.f, f32 cylinderHeight=0.6f,
1046 f32 widthCylinder=0.05f, f32 widthCone=0.3f) = 0;
1047
1048 //! add a static sphere mesh to the meshpool
1049 /** \param name Name of the mesh
1050 \param radius Radius of the sphere
1051 \param polyCountX Number of quads used for the horizontal tiling
1052 \param polyCountY Number of quads used for the vertical tiling
1053 \return Pointer to the sphere mesh if successful, otherwise 0.
1054 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1055 virtual IAnimatedMesh* addSphereMesh(const io::path& name,
1056 f32 radius=5.f, u32 polyCountX = 16,
1057 u32 polyCountY = 16) = 0;
1058
1059 //! Add a volume light mesh to the meshpool
1060 /** \param name Name of the mesh
1061 \param SubdivideU Horizontal subdivision count
1062 \param SubdivideV Vertical subdivision count
1063 \param FootColor Color of the bottom of the light
1064 \param TailColor Color of the top of the light
1065 \return Pointer to the volume light mesh if successful, otherwise 0.
1066 This pointer should not be dropped. See IReferenceCounted::drop() for more information.
1067 */
1068 virtual IAnimatedMesh* addVolumeLightMesh(const io::path& name,
1069 const u32 SubdivideU = 32, const u32 SubdivideV = 32,
1070 const video::SColor FootColor = video::SColor(51, 0, 230, 180),
1071 const video::SColor TailColor = video::SColor(0, 0, 0, 0)) = 0;
1072
1073 //! Gets the root scene node.
1074 /** This is the scene node which is parent
1075 of all scene nodes. The root scene node is a special scene node which
1076 only exists to manage all scene nodes. It will not be rendered and cannot
1077 be removed from the scene.
1078 \return Pointer to the root scene node.
1079 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1080 virtual ISceneNode* getRootSceneNode() = 0;
1081
1082 //! Get the first scene node with the specified id.
1083 /** \param id: The id to search for
1084 \param start: Scene node to start from. All children of this scene
1085 node are searched. If null is specified, the root scene node is
1086 taken.
1087 \return Pointer to the first scene node with this id,
1088 and null if no scene node could be found.
1089 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1090 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0;
1091
1092 //! Get the first scene node with the specified name.
1093 /** \param name: The name to search for
1094 \param start: Scene node to start from. All children of this scene
1095 node are searched. If null is specified, the root scene node is
1096 taken.
1097 \return Pointer to the first scene node with this id,
1098 and null if no scene node could be found.
1099 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1100 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0;
1101
1102 //! Get the first scene node with the specified type.
1103 /** \param type: The type to search for
1104 \param start: Scene node to start from. All children of this scene
1105 node are searched. If null is specified, the root scene node is
1106 taken.
1107 \return Pointer to the first scene node with this type,
1108 and null if no scene node could be found.
1109 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1110 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0;
1111
1112 //! Get scene nodes by type.
1113 /** \param type: Type of scene node to find (ESNT_ANY will return all child nodes).
1114 \param outNodes: array to be filled with results.
1115 \param start: Scene node to start from. All children of this scene
1116 node are searched. If null is specified, the root scene node is
1117 taken. */
1118 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type,
1119 core::array<scene::ISceneNode*>& outNodes,
1120 ISceneNode* start=0) = 0;
1121
1122 //! Get the current active camera.
1123 /** \return The active camera is returned. Note that this can
1124 be NULL, if there was no camera created yet.
1125 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1126 virtual ICameraSceneNode* getActiveCamera() const =0;
1127
1128 //! Sets the currently active camera.
1129 /** The previous active camera will be deactivated.
1130 \param camera: The new camera which should be active. */
1131 virtual void setActiveCamera(ICameraSceneNode* camera) = 0;
1132
1133 //! Sets the color of stencil buffers shadows drawn by the scene manager.
1134 virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0;
1135
1136 //! Get the current color of shadows.
1137 virtual video::SColor getShadowColor() const = 0;
1138
1139 //! Registers a node for rendering it at a specific time.
1140 /** This method should only be used by SceneNodes when they get a
1141 ISceneNode::OnRegisterSceneNode() call.
1142 \param node: Node to register for drawing. Usually scene nodes would set 'this'
1143 as parameter here because they want to be drawn.
1144 \param pass: Specifies when the node wants to be drawn in relation to the other nodes.
1145 For example, if the node is a shadow, it usually wants to be drawn after all other nodes
1146 and will use ESNRP_SHADOW for this. See scene::E_SCENE_NODE_RENDER_PASS for details.
1147 \return scene will be rendered ( passed culling ) */
1148 virtual u32 registerNodeForRendering(ISceneNode* node,
1149 E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
1150
1151 //! Draws all the scene nodes.
1152 /** This can only be invoked between
1153 IVideoDriver::beginScene() and IVideoDriver::endScene(). Please note that
1154 the scene is not only drawn when calling this, but also animated
1155 by existing scene node animators, culling of scene nodes is done, etc. */
1156 virtual void drawAll() = 0;
1157
1158 //! Creates a rotation animator, which rotates the attached scene node around itself.
1159 /** \param rotationSpeed Specifies the speed of the animation in degree per 10 milliseconds.
1160 \return The animator. Attach it to a scene node with ISceneNode::addAnimator()
1161 and the animator will animate it.
1162 If you no longer need the animator, you should call ISceneNodeAnimator::drop().
1163 See IReferenceCounted::drop() for more information. */
1164 virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationSpeed) = 0;
1165
1166 //! Creates a fly circle animator, which lets the attached scene node fly around a center.
1167 /** \param center: Center of the circle.
1168 \param radius: Radius of the circle.
1169 \param speed: The orbital speed, in radians per millisecond.
1170 \param direction: Specifies the upvector used for alignment of the mesh.
1171 \param startPosition: The position on the circle where the animator will
1172 begin. Value is in multiples of a circle, i.e. 0.5 is half way around. (phase)
1173 \param radiusEllipsoid: if radiusEllipsoid != 0 then radius2 froms a ellipsoid
1174 begin. Value is in multiples of a circle, i.e. 0.5 is half way around. (phase)
1175 \return The animator. Attach it to a scene node with ISceneNode::addAnimator()
1176 and the animator will animate it.
1177 If you no longer need the animator, you should call ISceneNodeAnimator::drop().
1178 See IReferenceCounted::drop() for more information. */
1179 virtual ISceneNodeAnimator* createFlyCircleAnimator(
1180 const core::vector3df& center=core::vector3df(0.f,0.f,0.f),
1181 f32 radius=100.f, f32 speed=0.001f,
1182 const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f),
1183 f32 startPosition = 0.f,
1184 f32 radiusEllipsoid = 0.f) = 0;
1185
1186 //! Creates a fly straight animator, which lets the attached scene node fly or move along a line between two points.
1187 /** \param startPoint: Start point of the line.
1188 \param endPoint: End point of the line.
1189 \param timeForWay: Time in milli seconds how long the node should need to
1190 move from the start point to the end point.
1191 \param loop: If set to false, the node stops when the end point is reached.
1192 If loop is true, the node begins again at the start.
1193 \param pingpong Flag to set whether the animator should fly
1194 back from end to start again.
1195 \return The animator. Attach it to a scene node with ISceneNode::addAnimator()
1196 and the animator will animate it.
1197 If you no longer need the animator, you should call ISceneNodeAnimator::drop().
1198 See IReferenceCounted::drop() for more information. */
1199 virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint,
1200 const core::vector3df& endPoint, u32 timeForWay, bool loop=false, bool pingpong = false) = 0;
1201
1202 //! Creates a texture animator, which switches the textures of the target scene node based on a list of textures.
1203 /** \param textures: List of textures to use.
1204 \param timePerFrame: Time in milliseconds, how long any texture in the list
1205 should be visible.
1206 \param loop: If set to to false, the last texture remains set, and the animation
1207 stops. If set to true, the animation restarts with the first texture.
1208 \return The animator. Attach it to a scene node with ISceneNode::addAnimator()
1209 and the animator will animate it.
1210 If you no longer need the animator, you should call ISceneNodeAnimator::drop().
1211 See IReferenceCounted::drop() for more information. */
1212 virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures,
1213 s32 timePerFrame, bool loop=true) = 0;
1214
1215 //! Creates a scene node animator, which deletes the scene node after some time automatically.
1216 /** \param timeMs: Time in milliseconds, after when the node will be deleted.
1217 \return The animator. Attach it to a scene node with ISceneNode::addAnimator()
1218 and the animator will animate it.
1219 If you no longer need the animator, you should call ISceneNodeAnimator::drop().
1220 See IReferenceCounted::drop() for more information. */
1221 virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMs) = 0;
1222
1223 //! Creates a special scene node animator for doing automatic collision detection and response.
1224 /** See ISceneNodeAnimatorCollisionResponse for details.
1225 \param world: Triangle selector holding all triangles of the world with which
1226 the scene node may collide. You can create a triangle selector with
1227 ISceneManager::createTriangleSelector();
1228 \param sceneNode: SceneNode which should be manipulated. After you added this animator
1229 to the scene node, the scene node will not be able to move through walls and is
1230 affected by gravity. If you need to teleport the scene node to a new position without
1231 it being effected by the collision geometry, then call sceneNode->setPosition(); then
1232 animator->setTargetNode(sceneNode);
1233 \param ellipsoidRadius: Radius of the ellipsoid with which collision detection and
1234 response is done. If you have got a scene node, and you are unsure about
1235 how big the radius should be, you could use the following code to determine
1236 it:
1237 \code
1238 const core::aabbox3d<f32>& box = yourSceneNode->getBoundingBox();
1239 core::vector3df radius = box.MaxEdge - box.getCenter();
1240 \endcode
1241 \param gravityPerSecond: Sets the gravity of the environment, as an acceleration in
1242 units per second per second. If your units are equivalent to metres, then
1243 core::vector3df(0,-10.0f,0) would give an approximately realistic gravity.
1244 You can disable gravity by setting it to core::vector3df(0,0,0).
1245 \param ellipsoidTranslation: By default, the ellipsoid for collision detection is created around
1246 the center of the scene node, which means that the ellipsoid surrounds
1247 it completely. If this is not what you want, you may specify a translation
1248 for the ellipsoid.
1249 \param slidingValue: DOCUMENTATION NEEDED.
1250 \return The animator. Attach it to a scene node with ISceneNode::addAnimator()
1251 and the animator will cause it to do collision detection and response.
1252 If you no longer need the animator, you should call ISceneNodeAnimator::drop().
1253 See IReferenceCounted::drop() for more information. */
1254 virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator(
1255 ITriangleSelector* world, ISceneNode* sceneNode,
1256 const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30),
1257 const core::vector3df& gravityPerSecond = core::vector3df(0,-10.0f,0),
1258 const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0),
1259 f32 slidingValue = 0.0005f) = 0;
1260
1261 //! Creates a follow spline animator.
1262 /** The animator modifies the position of
1263 the attached scene node to make it follow a hermite spline.
1264 It uses a subset of hermite splines: either cardinal splines
1265 (tightness != 0.5) or catmull-rom-splines (tightness == 0.5).
1266 The animator moves from one control point to the next in
1267 1/speed seconds. This code was sent in by Matthias Gall.
1268 If you no longer need the animator, you should call ISceneNodeAnimator::drop().
1269 See IReferenceCounted::drop() for more information. */
1270 virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
1271 const core::array< core::vector3df >& points,
1272 f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false) = 0;
1273
1274 //! Creates a simple ITriangleSelector, based on a mesh.
1275 /** Triangle selectors
1276 can be used for doing collision detection. Don't use this selector
1277 for a huge amount of triangles like in Quake3 maps.
1278 Instead, use for example ISceneManager::createOctreeTriangleSelector().
1279 Please note that the created triangle selector is not automaticly attached
1280 to the scene node. You will have to call ISceneNode::setTriangleSelector()
1281 for this. To create and attach a triangle selector is done like this:
1282 \code
1283 ITriangleSelector* s = sceneManager->createTriangleSelector(yourMesh,
1284 yourSceneNode);
1285 yourSceneNode->setTriangleSelector(s);
1286 s->drop();
1287 \endcode
1288 \param mesh: Mesh of which the triangles are taken.
1289 \param node: Scene node of which visibility and transformation is used.
1290 \return The selector, or null if not successful.
1291 If you no longer need the selector, you should call ITriangleSelector::drop().
1292 See IReferenceCounted::drop() for more information. */
1293 virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0;
1294
1295 //! Creates a simple ITriangleSelector, based on an animated mesh scene node.
1296 /** Details of the mesh associated with the node will be extracted internally.
1297 Call ITriangleSelector::update() to have the triangle selector updated based
1298 on the current frame of the animated mesh scene node.
1299 \param node The animated mesh scene node from which to build the selector
1300 */
1301 virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
1302
1303
1304 //! Creates a simple dynamic ITriangleSelector, based on a axis aligned bounding box.
1305 /** Triangle selectors
1306 can be used for doing collision detection. Every time when triangles are
1307 queried, the triangle selector gets the bounding box of the scene node,
1308 an creates new triangles. In this way, it works good with animated scene nodes.
1309 \param node: Scene node of which the bounding box, visibility and transformation is used.
1310 \return The selector, or null if not successful.
1311 If you no longer need the selector, you should call ITriangleSelector::drop().
1312 See IReferenceCounted::drop() for more information. */
1313 virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0;
1314
1315 //! Creates a Triangle Selector, optimized by an octree.
1316 /** Triangle selectors
1317 can be used for doing collision detection. This triangle selector is
1318 optimized for huge amounts of triangle, it organizes them in an octree.
1319 Please note that the created triangle selector is not automaticly attached
1320 to the scene node. You will have to call ISceneNode::setTriangleSelector()
1321 for this. To create and attach a triangle selector is done like this:
1322 \code
1323 ITriangleSelector* s = sceneManager->createOctreeTriangleSelector(yourMesh,
1324 yourSceneNode);
1325 yourSceneNode->setTriangleSelector(s);
1326 s->drop();
1327 \endcode
1328 For more informations and examples on this, take a look at the collision
1329 tutorial in the SDK.
1330 \param mesh: Mesh of which the triangles are taken.
1331 \param node: Scene node of which visibility and transformation is used.
1332 \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node.
1333 If a node gets less polys the this value, it will not be splitted into
1334 smaller nodes.
1335 \return The selector, or null if not successful.
1336 If you no longer need the selector, you should call ITriangleSelector::drop().
1337 See IReferenceCounted::drop() for more information. */
1338 virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh,
1339 ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
1340
1341 //! //! Creates a Triangle Selector, optimized by an octree.
1342 /** \deprecated Use createOctreeTriangleSelector instead. This method may be removed by Irrlicht 1.9. */
1343 _IRR_DEPRECATED_ ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
1344 ISceneNode* node, s32 minimalPolysPerNode=32)
1345 {
1346 return createOctreeTriangleSelector(mesh, node, minimalPolysPerNode);
1347 }
1348
1349 //! Creates a meta triangle selector.
1350 /** A meta triangle selector is nothing more than a
1351 collection of one or more triangle selectors providing together
1352 the interface of one triangle selector. In this way,
1353 collision tests can be done with different triangle soups in one pass.
1354 \return The selector, or null if not successful.
1355 If you no longer need the selector, you should call ITriangleSelector::drop().
1356 See IReferenceCounted::drop() for more information. */
1357 virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0;
1358
1359 //! Creates a triangle selector which can select triangles from a terrain scene node.
1360 /** \param node: Pointer to the created terrain scene node
1361 \param LOD: Level of detail, 0 for highest detail.
1362 \return The selector, or null if not successful.
1363 If you no longer need the selector, you should call ITriangleSelector::drop().
1364 See IReferenceCounted::drop() for more information. */
1365 virtual ITriangleSelector* createTerrainTriangleSelector(
1366 ITerrainSceneNode* node, s32 LOD=0) = 0;
1367
1368 //! Adds an external mesh loader for extending the engine with new file formats.
1369 /** If you want the engine to be extended with
1370 file formats it currently is not able to load (e.g. .cob), just implement
1371 the IMeshLoader interface in your loading class and add it with this method.
1372 Using this method it is also possible to override built-in mesh loaders with
1373 newer or updated versions without the need to recompile the engine.
1374 \param externalLoader: Implementation of a new mesh loader. */
1375 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
1376
1377 //! Returns the number of mesh loaders supported by Irrlicht at this time
1378 virtual u32 getMeshLoaderCount() const = 0;
1379
1380 //! Retrieve the given mesh loader
1381 /** \param index The index of the loader to retrieve. This parameter is an 0-based
1382 array index.
1383 \return A pointer to the specified loader, 0 if the index is incorrect. */
1384 virtual IMeshLoader* getMeshLoader(u32 index) const = 0;
1385
1386 //! Adds an external scene loader for extending the engine with new file formats.
1387 /** If you want the engine to be extended with
1388 file formats it currently is not able to load (e.g. .vrml), just implement
1389 the ISceneLoader interface in your loading class and add it with this method.
1390 Using this method it is also possible to override the built-in scene loaders
1391 with newer or updated versions without the need to recompile the engine.
1392 \param externalLoader: Implementation of a new mesh loader. */
1393 virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0;
1394
1395 //! Returns the number of scene loaders supported by Irrlicht at this time
1396 virtual u32 getSceneLoaderCount() const = 0;
1397
1398 //! Retrieve the given scene loader
1399 /** \param index The index of the loader to retrieve. This parameter is an 0-based
1400 array index.
1401 \return A pointer to the specified loader, 0 if the index is incorrect. */
1402 virtual ISceneLoader* getSceneLoader(u32 index) const = 0;
1403
1404 //! Get pointer to the scene collision manager.
1405 /** \return Pointer to the collision manager
1406 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1407 virtual ISceneCollisionManager* getSceneCollisionManager() = 0;
1408
1409 //! Get pointer to the mesh manipulator.
1410 /** \return Pointer to the mesh manipulator
1411 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1412 virtual IMeshManipulator* getMeshManipulator() = 0;
1413
1414 //! Adds a scene node to the deletion queue.
1415 /** The scene node is immediatly
1416 deleted when it's secure. Which means when the scene node does not
1417 execute animators and things like that. This method is for example
1418 used for deleting scene nodes by their scene node animators. In
1419 most other cases, a ISceneNode::remove() call is enough, using this
1420 deletion queue is not necessary.
1421 See ISceneManager::createDeleteAnimator() for details.
1422 \param node: Node to detete. */
1423 virtual void addToDeletionQueue(ISceneNode* node) = 0;
1424
1425 //! Posts an input event to the environment.
1426 /** Usually you do not have to
1427 use this method, it is used by the internal engine. */
1428 virtual bool postEventFromUser(const SEvent& event) = 0;
1429
1430 //! Clears the whole scene.
1431 /** All scene nodes are removed. */
1432 virtual void clear() = 0;
1433
1434 //! Get interface to the parameters set in this scene.
1435 /** String parameters can be used by plugins and mesh loaders.
1436 For example the CMS and LMTS loader want a parameter named 'CSM_TexturePath'
1437 and 'LMTS_TexturePath' set to the path were attached textures can be found. See
1438 CSM_TEXTURE_PATH, LMTS_TEXTURE_PATH, MY3D_TEXTURE_PATH,
1439 COLLADA_CREATE_SCENE_INSTANCES, DMF_TEXTURE_PATH and DMF_USE_MATERIALS_DIRS*/
1440 virtual io::IAttributes* getParameters() = 0;
1441
1442 //! Get current render pass.
1443 /** All scene nodes are being rendered in a specific order.
1444 First lights, cameras, sky boxes, solid geometry, and then transparent
1445 stuff. During the rendering process, scene nodes may want to know what the scene
1446 manager is rendering currently, because for example they registered for rendering
1447 twice, once for transparent geometry and once for solid. When knowing what rendering
1448 pass currently is active they can render the correct part of their geometry. */
1449 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0;
1450
1451 //! Get the default scene node factory which can create all built in scene nodes
1452 /** \return Pointer to the default scene node factory
1453 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1454 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0;
1455
1456 //! Adds a scene node factory to the scene manager.
1457 /** Use this to extend the scene manager with new scene node types which it should be
1458 able to create automaticly, for example when loading data from xml files. */
1459 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0;
1460
1461 //! Get amount of registered scene node factories.
1462 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0;
1463
1464 //! Get a scene node factory by index
1465 /** \return Pointer to the requested scene node factory, or 0 if it does not exist.
1466 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1467 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0;
1468
1469 //! Get the default scene node animator factory which can create all built-in scene node animators
1470 /** \return Pointer to the default scene node animator factory
1471 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1472 virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0;
1473
1474 //! Adds a scene node animator factory to the scene manager.
1475 /** Use this to extend the scene manager with new scene node animator types which it should be
1476 able to create automaticly, for example when loading data from xml files. */
1477 virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0;
1478
1479 //! Get amount of registered scene node animator factories.
1480 virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0;
1481
1482 //! Get scene node animator factory by index
1483 /** \return Pointer to the requested scene node animator factory, or 0 if it does not exist.
1484 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1485 virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0;
1486
1487 //! Get typename from a scene node type or null if not found
1488 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;
1489
1490 //! Returns a typename from a scene node animator type or null if not found
1491 virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0;
1492
1493 //! Adds a scene node to the scene by name
1494 /** \return Pointer to the scene node added by a factory
1495 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
1496 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0;
1497
1498 //! creates a scene node animator based on its type name
1499 /** \param typeName: Type of the scene node animator to add.
1500 \param target: Target scene node of the new animator.
1501 \return Returns pointer to the new scene node animator or null if not successful. You need to
1502 drop this pointer after calling this, see IReferenceCounted::drop() for details. */
1503 virtual ISceneNodeAnimator* createSceneNodeAnimator(const char* typeName, ISceneNode* target=0) = 0;
1504
1505 //! Creates a new scene manager.
1506 /** This can be used to easily draw and/or store two
1507 independent scenes at the same time. The mesh cache will be
1508 shared between all existing scene managers, which means if you
1509 load a mesh in the original scene manager using for example
1510 getMesh(), the mesh will be available in all other scene
1511 managers too, without loading.
1512 The original/main scene manager will still be there and
1513 accessible via IrrlichtDevice::getSceneManager(). If you need
1514 input event in this new scene manager, for example for FPS
1515 cameras, you'll need to forward input to this manually: Just
1516 implement an IEventReceiver and call
1517 yourNewSceneManager->postEventFromUser(), and return true so
1518 that the original scene manager doesn't get the event.
1519 Otherwise, all input will go to the main scene manager
1520 automatically.
1521 If you no longer need the new scene manager, you should call
1522 ISceneManager::drop().
1523 See IReferenceCounted::drop() for more information. */
1524 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;
1525
1526 //! Saves the current scene into a file.
1527 /** Scene nodes with the option isDebugObject set to true are
1528 not being saved. The scene is usually written to an .irr file,
1529 an xml based format. .irr files can Be edited with the Irrlicht
1530 Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To
1531 load .irr files again, see ISceneManager::loadScene().
1532 \param filename Name of the file.
1533 \param userDataSerializer If you want to save some user data
1534 for every scene node into the file, implement the
1535 ISceneUserDataSerializer interface and provide it as parameter
1536 here. Otherwise, simply specify 0 as this parameter.
1537 \param node Node which is taken as the top node of the scene.
1538 This node and all of its descendants are saved into the scene
1539 file. Pass 0 or the scene manager to save the full scene (which
1540 is also the default).
1541 \return True if successful. */
1542 virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
1543
1544 //! Saves the current scene into a file.
1545 /** Scene nodes with the option isDebugObject set to true are
1546 not being saved. The scene is usually written to an .irr file,
1547 an xml based format. .irr files can Be edited with the Irrlicht
1548 Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To
1549 load .irr files again, see ISceneManager::loadScene().
1550 \param file File where the scene is saved into.
1551 \param userDataSerializer If you want to save some user data
1552 for every scene node into the file, implement the
1553 ISceneUserDataSerializer interface and provide it as parameter
1554 here. Otherwise, simply specify 0 as this parameter.
1555 \param node Node which is taken as the top node of the scene.
1556 This node and all of its descendants are saved into the scene
1557 file. Pass 0 or the scene manager to save the full scene (which
1558 is also the default).
1559 \return True if successful. */
1560 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
1561
1562 //! Saves the current scene into a file.
1563 /** Scene nodes with the option isDebugObject set to true are
1564 not being saved. The scene is usually written to an .irr file,
1565 an xml based format. .irr files can Be edited with the Irrlicht
1566 Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To
1567 load .irr files again, see ISceneManager::loadScene().
1568 \param writer XMLWriter with which the scene is saved.
1569 \param currentPath Path which is used for relative file names.
1570 Usually the directory of the file written into.
1571 \param userDataSerializer If you want to save some user data
1572 for every scene node into the file, implement the
1573 ISceneUserDataSerializer interface and provide it as parameter
1574 here. Otherwise, simply specify 0 as this parameter.
1575 \param node Node which is taken as the top node of the scene.
1576 This node and all of its descendants are saved into the scene
1577 file. Pass 0 or the scene manager to save the full scene (which
1578 is also the default).
1579 \return True if successful. */
1580 virtual bool saveScene(io::IXMLWriter* writer, const io::path& currentPath, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
1581
1582 //! Loads a scene. Note that the current scene is not cleared before.
1583 /** The scene is usually loaded from an .irr file, an xml based
1584 format, but other scene formats can be added to the engine via
1585 ISceneManager::addExternalSceneLoader. .irr files can Be edited
1586 with the Irrlicht Engine Editor, irrEdit
1587 (http://www.ambiera.com/irredit/) or saved directly by the engine
1588 using ISceneManager::saveScene().
1589 \param filename Name of the file to load from.
1590 \param userDataSerializer If you want to load user data
1591 possibily saved in that file for some scene nodes in the file,
1592 implement the ISceneUserDataSerializer interface and provide it
1593 as parameter here. Otherwise, simply specify 0 as this
1594 parameter.
1595 \param rootNode Node which is taken as the root node of the
1596 scene. Pass 0 to add the scene directly to the scene manager
1597 (which is also the default).
1598 \return True if successful. */
1599 virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;
1600
1601 //! Loads a scene. Note that the current scene is not cleared before.
1602 /** The scene is usually loaded from an .irr file, an xml based
1603 format, but other scene formats can be added to the engine via
1604 ISceneManager::addExternalSceneLoader. .irr files can Be edited
1605 with the Irrlicht Engine Editor, irrEdit
1606 (http://www.ambiera.com/irredit/) or saved directly by the engine
1607 using ISceneManager::saveScene().
1608 \param file File where the scene is loaded from.
1609 \param userDataSerializer If you want to load user data
1610 possibily saved in that file for some scene nodes in the file,
1611 implement the ISceneUserDataSerializer interface and provide it
1612 as parameter here. Otherwise, simply specify 0 as this
1613 parameter.
1614 \param rootNode Node which is taken as the root node of the
1615 scene. Pass 0 to add the scene directly to the scene manager
1616 (which is also the default).
1617 \return True if successful. */
1618 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;
1619
1620 //! Get a mesh writer implementation if available
1621 /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop()
1622 for details. */
1623 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0;
1624
1625 //! Get a skinned mesh, which is not available as header-only code
1626 /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop()
1627 for details. */
1628 virtual ISkinnedMesh* createSkinnedMesh() = 0;
1629
1630 //! Sets ambient color of the scene
1631 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0;
1632
1633 //! Get ambient color of the scene
1634 virtual const video::SColorf& getAmbientLight() const = 0;
1635
1636 //! Register a custom callbacks manager which gets callbacks during scene rendering.
1637 /** \param[in] lightManager: the new callbacks manager. You may pass 0 to remove the
1638 current callbacks manager and restore the default behavior. */
1639 virtual void setLightManager(ILightManager* lightManager) = 0;
1640
1641 //! Get an instance of a geometry creator.
1642 /** The geometry creator provides some helper methods to create various types of
1643 basic geometry. This can be useful for custom scene nodes. */
1644 virtual const IGeometryCreator* getGeometryCreator(void) const = 0;
1645
1646 //! Check if node is culled in current view frustum
1647 /** Please note that depending on the used culling method this
1648 check can be rather coarse, or slow. A positive result is
1649 correct, though, i.e. if this method returns true the node is
1650 positively not visible. The node might still be invisible even
1651 if this method returns false.
1652 \param node The scene node which is checked for culling.
1653 \return True if node is not visible in the current scene, else
1654 false. */
1655 virtual bool isCulled(const ISceneNode* node) const =0;
1656 };
1657
1658
1659} // end namespace scene
1660} // end namespace irr
1661
1662#endif
1663
diff --git a/src/others/irrlicht-1.8.1/include/ISceneNode.h b/src/others/irrlicht-1.8.1/include/ISceneNode.h
new file mode 100644
index 0000000..ecaad4a
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneNode.h
@@ -0,0 +1,858 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_NODE_H_INCLUDED__
6#define __I_SCENE_NODE_H_INCLUDED__
7
8#include "IAttributeExchangingObject.h"
9#include "ESceneNodeTypes.h"
10#include "ECullingTypes.h"
11#include "EDebugSceneTypes.h"
12#include "ISceneNodeAnimator.h"
13#include "ITriangleSelector.h"
14#include "SMaterial.h"
15#include "irrString.h"
16#include "aabbox3d.h"
17#include "matrix4.h"
18#include "irrList.h"
19#include "IAttributes.h"
20
21namespace irr
22{
23namespace scene
24{
25 class ISceneManager;
26
27 //! Typedef for list of scene nodes
28 typedef core::list<ISceneNode*> ISceneNodeList;
29 //! Typedef for list of scene node animators
30 typedef core::list<ISceneNodeAnimator*> ISceneNodeAnimatorList;
31
32 //! Scene node interface.
33 /** A scene node is a node in the hierarchical scene graph. Every scene
34 node may have children, which are also scene nodes. Children move
35 relative to their parent's position. If the parent of a node is not
36 visible, its children won't be visible either. In this way, it is for
37 example easily possible to attach a light to a moving car, or to place
38 a walking character on a moving platform on a moving ship.
39 */
40 class ISceneNode : virtual public io::IAttributeExchangingObject
41 {
42 public:
43
44 //! Constructor
45 ISceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1,
46 const core::vector3df& position = core::vector3df(0,0,0),
47 const core::vector3df& rotation = core::vector3df(0,0,0),
48 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f))
49 : RelativeTranslation(position), RelativeRotation(rotation), RelativeScale(scale),
50 Parent(0), SceneManager(mgr), TriangleSelector(0), ID(id),
51 AutomaticCullingState(EAC_BOX), DebugDataVisible(EDS_OFF),
52 IsVisible(true), IsDebugObject(false)
53 {
54 if (parent)
55 parent->addChild(this);
56
57 updateAbsolutePosition();
58 }
59
60
61 //! Destructor
62 virtual ~ISceneNode()
63 {
64 // delete all children
65 removeAll();
66
67 // delete all animators
68 ISceneNodeAnimatorList::Iterator ait = Animators.begin();
69 for (; ait != Animators.end(); ++ait)
70 (*ait)->drop();
71
72 if (TriangleSelector)
73 TriangleSelector->drop();
74 }
75
76
77 //! This method is called just before the rendering process of the whole scene.
78 /** Nodes may register themselves in the render pipeline during this call,
79 precalculate the geometry which should be renderered, and prevent their
80 children from being able to register themselves if they are clipped by simply
81 not calling their OnRegisterSceneNode method.
82 If you are implementing your own scene node, you should overwrite this method
83 with an implementation code looking like this:
84 \code
85 if (IsVisible)
86 SceneManager->registerNodeForRendering(this);
87
88 ISceneNode::OnRegisterSceneNode();
89 \endcode
90 */
91 virtual void OnRegisterSceneNode()
92 {
93 if (IsVisible)
94 {
95 ISceneNodeList::Iterator it = Children.begin();
96 for (; it != Children.end(); ++it)
97 (*it)->OnRegisterSceneNode();
98 }
99 }
100
101
102 //! OnAnimate() is called just before rendering the whole scene.
103 /** Nodes may calculate or store animations here, and may do other useful things,
104 depending on what they are. Also, OnAnimate() should be called for all
105 child scene nodes here. This method will be called once per frame, independent
106 of whether the scene node is visible or not.
107 \param timeMs Current time in milliseconds. */
108 virtual void OnAnimate(u32 timeMs)
109 {
110 if (IsVisible)
111 {
112 // animate this node with all animators
113
114 ISceneNodeAnimatorList::Iterator ait = Animators.begin();
115 while (ait != Animators.end())
116 {
117 // continue to the next node before calling animateNode()
118 // so that the animator may remove itself from the scene
119 // node without the iterator becoming invalid
120 ISceneNodeAnimator* anim = *ait;
121 ++ait;
122 anim->animateNode(this, timeMs);
123 }
124
125 // update absolute position
126 updateAbsolutePosition();
127
128 // perform the post render process on all children
129
130 ISceneNodeList::Iterator it = Children.begin();
131 for (; it != Children.end(); ++it)
132 (*it)->OnAnimate(timeMs);
133 }
134 }
135
136
137 //! Renders the node.
138 virtual void render() = 0;
139
140
141 //! Returns the name of the node.
142 /** \return Name as character string. */
143 virtual const c8* getName() const
144 {
145 return Name.c_str();
146 }
147
148
149 //! Sets the name of the node.
150 /** \param name New name of the scene node. */
151 virtual void setName(const c8* name)
152 {
153 Name = name;
154 }
155
156
157 //! Sets the name of the node.
158 /** \param name New name of the scene node. */
159 virtual void setName(const core::stringc& name)
160 {
161 Name = name;
162 }
163
164
165 //! Get the axis aligned, not transformed bounding box of this node.
166 /** This means that if this node is an animated 3d character,
167 moving in a room, the bounding box will always be around the
168 origin. To get the box in real world coordinates, just
169 transform it with the matrix you receive with
170 getAbsoluteTransformation() or simply use
171 getTransformedBoundingBox(), which does the same.
172 \return The non-transformed bounding box. */
173 virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
174
175
176 //! Get the axis aligned, transformed and animated absolute bounding box of this node.
177 /** \return The transformed bounding box. */
178 virtual const core::aabbox3d<f32> getTransformedBoundingBox() const
179 {
180 core::aabbox3d<f32> box = getBoundingBox();
181 AbsoluteTransformation.transformBoxEx(box);
182 return box;
183 }
184
185
186 //! Get the absolute transformation of the node. Is recalculated every OnAnimate()-call.
187 /** NOTE: For speed reasons the absolute transformation is not
188 automatically recalculated on each change of the relative
189 transformation or by a transformation change of an parent. Instead the
190 update usually happens once per frame in OnAnimate. You can enforce
191 an update with updateAbsolutePosition().
192 \return The absolute transformation matrix. */
193 virtual const core::matrix4& getAbsoluteTransformation() const
194 {
195 return AbsoluteTransformation;
196 }
197
198
199 //! Returns the relative transformation of the scene node.
200 /** The relative transformation is stored internally as 3
201 vectors: translation, rotation and scale. To get the relative
202 transformation matrix, it is calculated from these values.
203 \return The relative transformation matrix. */
204 virtual core::matrix4 getRelativeTransformation() const
205 {
206 core::matrix4 mat;
207 mat.setRotationDegrees(RelativeRotation);
208 mat.setTranslation(RelativeTranslation);
209
210 if (RelativeScale != core::vector3df(1.f,1.f,1.f))
211 {
212 core::matrix4 smat;
213 smat.setScale(RelativeScale);
214 mat *= smat;
215 }
216
217 return mat;
218 }
219
220
221 //! Returns whether the node should be visible (if all of its parents are visible).
222 /** This is only an option set by the user, but has nothing to
223 do with geometry culling
224 \return The requested visibility of the node, true means
225 visible (if all parents are also visible). */
226 virtual bool isVisible() const
227 {
228 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
229 return IsVisible;
230 }
231
232 //! Check whether the node is truly visible, taking into accounts its parents' visibility
233 /** \return true if the node and all its parents are visible,
234 false if this or any parent node is invisible. */
235 virtual bool isTrulyVisible() const
236 {
237 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
238 if(!IsVisible)
239 return false;
240
241 if(!Parent)
242 return true;
243
244 return Parent->isTrulyVisible();
245 }
246
247 //! Sets if the node should be visible or not.
248 /** All children of this node won't be visible either, when set
249 to false. Invisible nodes are not valid candidates for selection by
250 collision manager bounding box methods.
251 \param isVisible If the node shall be visible. */
252 virtual void setVisible(bool isVisible)
253 {
254 IsVisible = isVisible;
255 }
256
257
258 //! Get the id of the scene node.
259 /** This id can be used to identify the node.
260 \return The id. */
261 virtual s32 getID() const
262 {
263 return ID;
264 }
265
266
267 //! Sets the id of the scene node.
268 /** This id can be used to identify the node.
269 \param id The new id. */
270 virtual void setID(s32 id)
271 {
272 ID = id;
273 }
274
275
276 //! Adds a child to this scene node.
277 /** If the scene node already has a parent it is first removed
278 from the other parent.
279 \param child A pointer to the new child. */
280 virtual void addChild(ISceneNode* child)
281 {
282 if (child && (child != this))
283 {
284 // Change scene manager?
285 if (SceneManager != child->SceneManager)
286 child->setSceneManager(SceneManager);
287
288 child->grab();
289 child->remove(); // remove from old parent
290 Children.push_back(child);
291 child->Parent = this;
292 }
293 }
294
295
296 //! Removes a child from this scene node.
297 /** If found in the children list, the child pointer is also
298 dropped and might be deleted if no other grab exists.
299 \param child A pointer to the child which shall be removed.
300 \return True if the child was removed, and false if not,
301 e.g. because it couldn't be found in the children list. */
302 virtual bool removeChild(ISceneNode* child)
303 {
304 ISceneNodeList::Iterator it = Children.begin();
305 for (; it != Children.end(); ++it)
306 if ((*it) == child)
307 {
308 (*it)->Parent = 0;
309 (*it)->drop();
310 Children.erase(it);
311 return true;
312 }
313
314 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
315 return false;
316 }
317
318
319 //! Removes all children of this scene node
320 /** The scene nodes found in the children list are also dropped
321 and might be deleted if no other grab exists on them.
322 */
323 virtual void removeAll()
324 {
325 ISceneNodeList::Iterator it = Children.begin();
326 for (; it != Children.end(); ++it)
327 {
328 (*it)->Parent = 0;
329 (*it)->drop();
330 }
331
332 Children.clear();
333 }
334
335
336 //! Removes this scene node from the scene
337 /** If no other grab exists for this node, it will be deleted.
338 */
339 virtual void remove()
340 {
341 if (Parent)
342 Parent->removeChild(this);
343 }
344
345
346 //! Adds an animator which should animate this node.
347 /** \param animator A pointer to the new animator. */
348 virtual void addAnimator(ISceneNodeAnimator* animator)
349 {
350 if (animator)
351 {
352 Animators.push_back(animator);
353 animator->grab();
354 }
355 }
356
357
358 //! Get a list of all scene node animators.
359 /** \return The list of animators attached to this node. */
360 const core::list<ISceneNodeAnimator*>& getAnimators() const
361 {
362 return Animators;
363 }
364
365
366 //! Removes an animator from this scene node.
367 /** If the animator is found, it is also dropped and might be
368 deleted if not other grab exists for it.
369 \param animator A pointer to the animator to be deleted. */
370 virtual void removeAnimator(ISceneNodeAnimator* animator)
371 {
372 ISceneNodeAnimatorList::Iterator it = Animators.begin();
373 for (; it != Animators.end(); ++it)
374 {
375 if ((*it) == animator)
376 {
377 (*it)->drop();
378 Animators.erase(it);
379 return;
380 }
381 }
382 }
383
384
385 //! Removes all animators from this scene node.
386 /** The animators might also be deleted if no other grab exists
387 for them. */
388 virtual void removeAnimators()
389 {
390 ISceneNodeAnimatorList::Iterator it = Animators.begin();
391 for (; it != Animators.end(); ++it)
392 (*it)->drop();
393
394 Animators.clear();
395 }
396
397
398 //! Returns the material based on the zero based index i.
399 /** To get the amount of materials used by this scene node, use
400 getMaterialCount(). This function is needed for inserting the
401 node into the scene hierarchy at an optimal position for
402 minimizing renderstate changes, but can also be used to
403 directly modify the material of a scene node.
404 \param num Zero based index. The maximal value is getMaterialCount() - 1.
405 \return The material at that index. */
406 virtual video::SMaterial& getMaterial(u32 num)
407 {
408 return video::IdentityMaterial;
409 }
410
411
412 //! Get amount of materials used by this scene node.
413 /** \return Current amount of materials of this scene node. */
414 virtual u32 getMaterialCount() const
415 {
416 return 0;
417 }
418
419
420 //! Sets all material flags at once to a new value.
421 /** Useful, for example, if you want the whole mesh to be
422 affected by light.
423 \param flag Which flag of all materials to be set.
424 \param newvalue New value of that flag. */
425 void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
426 {
427 for (u32 i=0; i<getMaterialCount(); ++i)
428 getMaterial(i).setFlag(flag, newvalue);
429 }
430
431
432 //! Sets the texture of the specified layer in all materials of this scene node to the new texture.
433 /** \param textureLayer Layer of texture to be set. Must be a
434 value smaller than MATERIAL_MAX_TEXTURES.
435 \param texture New texture to be used. */
436 void setMaterialTexture(u32 textureLayer, video::ITexture* texture)
437 {
438 if (textureLayer >= video::MATERIAL_MAX_TEXTURES)
439 return;
440
441 for (u32 i=0; i<getMaterialCount(); ++i)
442 getMaterial(i).setTexture(textureLayer, texture);
443 }
444
445
446 //! Sets the material type of all materials in this scene node to a new material type.
447 /** \param newType New type of material to be set. */
448 void setMaterialType(video::E_MATERIAL_TYPE newType)
449 {
450 for (u32 i=0; i<getMaterialCount(); ++i)
451 getMaterial(i).MaterialType = newType;
452 }
453
454
455 //! Gets the scale of the scene node relative to its parent.
456 /** This is the scale of this node relative to its parent.
457 If you want the absolute scale, use
458 getAbsoluteTransformation().getScale()
459 \return The scale of the scene node. */
460 virtual const core::vector3df& getScale() const
461 {
462 return RelativeScale;
463 }
464
465
466 //! Sets the relative scale of the scene node.
467 /** \param scale New scale of the node, relative to its parent. */
468 virtual void setScale(const core::vector3df& scale)
469 {
470 RelativeScale = scale;
471 }
472
473
474 //! Gets the rotation of the node relative to its parent.
475 /** Note that this is the relative rotation of the node.
476 If you want the absolute rotation, use
477 getAbsoluteTransformation().getRotation()
478 \return Current relative rotation of the scene node. */
479 virtual const core::vector3df& getRotation() const
480 {
481 return RelativeRotation;
482 }
483
484
485 //! Sets the rotation of the node relative to its parent.
486 /** This only modifies the relative rotation of the node.
487 \param rotation New rotation of the node in degrees. */
488 virtual void setRotation(const core::vector3df& rotation)
489 {
490 RelativeRotation = rotation;
491 }
492
493
494 //! Gets the position of the node relative to its parent.
495 /** Note that the position is relative to the parent. If you want
496 the position in world coordinates, use getAbsolutePosition() instead.
497 \return The current position of the node relative to the parent. */
498 virtual const core::vector3df& getPosition() const
499 {
500 return RelativeTranslation;
501 }
502
503
504 //! Sets the position of the node relative to its parent.
505 /** Note that the position is relative to the parent.
506 \param newpos New relative position of the scene node. */
507 virtual void setPosition(const core::vector3df& newpos)
508 {
509 RelativeTranslation = newpos;
510 }
511
512
513 //! Gets the absolute position of the node in world coordinates.
514 /** If you want the position of the node relative to its parent,
515 use getPosition() instead.
516 NOTE: For speed reasons the absolute position is not
517 automatically recalculated on each change of the relative
518 position or by a position change of an parent. Instead the
519 update usually happens once per frame in OnAnimate. You can enforce
520 an update with updateAbsolutePosition().
521 \return The current absolute position of the scene node (updated on last call of updateAbsolutePosition). */
522 virtual core::vector3df getAbsolutePosition() const
523 {
524 return AbsoluteTransformation.getTranslation();
525 }
526
527
528 //! Enables or disables automatic culling based on the bounding box.
529 /** Automatic culling is enabled by default. Note that not
530 all SceneNodes support culling and that some nodes always cull
531 their geometry because it is their only reason for existence,
532 for example the OctreeSceneNode.
533 \param state The culling state to be used. */
534 void setAutomaticCulling( u32 state)
535 {
536 AutomaticCullingState = state;
537 }
538
539
540 //! Gets the automatic culling state.
541 /** \return The automatic culling state. */
542 u32 getAutomaticCulling() const
543 {
544 return AutomaticCullingState;
545 }
546
547
548 //! Sets if debug data like bounding boxes should be drawn.
549 /** A bitwise OR of the types from @ref irr::scene::E_DEBUG_SCENE_TYPE.
550 Please note that not all scene nodes support all debug data types.
551 \param state The debug data visibility state to be used. */
552 virtual void setDebugDataVisible(u32 state)
553 {
554 DebugDataVisible = state;
555 }
556
557 //! Returns if debug data like bounding boxes are drawn.
558 /** \return A bitwise OR of the debug data values from
559 @ref irr::scene::E_DEBUG_SCENE_TYPE that are currently visible. */
560 u32 isDebugDataVisible() const
561 {
562 return DebugDataVisible;
563 }
564
565
566 //! Sets if this scene node is a debug object.
567 /** Debug objects have some special properties, for example they can be easily
568 excluded from collision detection or from serialization, etc. */
569 void setIsDebugObject(bool debugObject)
570 {
571 IsDebugObject = debugObject;
572 }
573
574
575 //! Returns if this scene node is a debug object.
576 /** Debug objects have some special properties, for example they can be easily
577 excluded from collision detection or from serialization, etc.
578 \return If this node is a debug object, true is returned. */
579 bool isDebugObject() const
580 {
581 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
582 return IsDebugObject;
583 }
584
585
586 //! Returns a const reference to the list of all children.
587 /** \return The list of all children of this node. */
588 const core::list<ISceneNode*>& getChildren() const
589 {
590 return Children;
591 }
592
593
594 //! Changes the parent of the scene node.
595 /** \param newParent The new parent to be used. */
596 virtual void setParent(ISceneNode* newParent)
597 {
598 grab();
599 remove();
600
601 Parent = newParent;
602
603 if (Parent)
604 Parent->addChild(this);
605
606 drop();
607 }
608
609
610 //! Returns the triangle selector attached to this scene node.
611 /** The Selector can be used by the engine for doing collision
612 detection. You can create a TriangleSelector with
613 ISceneManager::createTriangleSelector() or
614 ISceneManager::createOctreeTriangleSelector and set it with
615 ISceneNode::setTriangleSelector(). If a scene node got no triangle
616 selector, but collision tests should be done with it, a triangle
617 selector is created using the bounding box of the scene node.
618 \return A pointer to the TriangleSelector or 0, if there
619 is none. */
620 virtual ITriangleSelector* getTriangleSelector() const
621 {
622 return TriangleSelector;
623 }
624
625
626 //! Sets the triangle selector of the scene node.
627 /** The Selector can be used by the engine for doing collision
628 detection. You can create a TriangleSelector with
629 ISceneManager::createTriangleSelector() or
630 ISceneManager::createOctreeTriangleSelector(). Some nodes may
631 create their own selector by default, so it would be good to
632 check if there is already a selector in this node by calling
633 ISceneNode::getTriangleSelector().
634 \param selector New triangle selector for this scene node. */
635 virtual void setTriangleSelector(ITriangleSelector* selector)
636 {
637 if (TriangleSelector != selector)
638 {
639 if (TriangleSelector)
640 TriangleSelector->drop();
641
642 TriangleSelector = selector;
643 if (TriangleSelector)
644 TriangleSelector->grab();
645 }
646 }
647
648
649 //! Updates the absolute position based on the relative and the parents position
650 /** Note: This does not recursively update the parents absolute positions, so if you have a deeper
651 hierarchy you might want to update the parents first.*/
652 virtual void updateAbsolutePosition()
653 {
654 if (Parent)
655 {
656 AbsoluteTransformation =
657 Parent->getAbsoluteTransformation() * getRelativeTransformation();
658 }
659 else
660 AbsoluteTransformation = getRelativeTransformation();
661 }
662
663
664 //! Returns the parent of this scene node
665 /** \return A pointer to the parent. */
666 scene::ISceneNode* getParent() const
667 {
668 return Parent;
669 }
670
671
672 //! Returns type of the scene node
673 /** \return The type of this node. */
674 virtual ESCENE_NODE_TYPE getType() const
675 {
676 return ESNT_UNKNOWN;
677 }
678
679
680 //! Writes attributes of the scene node.
681 /** Implement this to expose the attributes of your scene node
682 for scripting languages, editors, debuggers or xml
683 serialization purposes.
684 \param out The attribute container to write into.
685 \param options Additional options which might influence the
686 serialization. */
687 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
688 {
689 if (!out)
690 return;
691 out->addString ("Name", Name.c_str());
692 out->addInt ("Id", ID );
693
694 out->addVector3d("Position", getPosition() );
695 out->addVector3d("Rotation", getRotation() );
696 out->addVector3d("Scale", getScale() );
697
698 out->addBool ("Visible", IsVisible );
699 out->addInt ("AutomaticCulling", AutomaticCullingState);
700 out->addInt ("DebugDataVisible", DebugDataVisible );
701 out->addBool ("IsDebugObject", IsDebugObject );
702 }
703
704
705 //! Reads attributes of the scene node.
706 /** Implement this to set the attributes of your scene node for
707 scripting languages, editors, debuggers or xml deserialization
708 purposes.
709 \param in The attribute container to read from.
710 \param options Additional options which might influence the
711 deserialization. */
712 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
713 {
714 if (!in)
715 return;
716 Name = in->getAttributeAsString("Name");
717 ID = in->getAttributeAsInt("Id");
718
719 setPosition(in->getAttributeAsVector3d("Position"));
720 setRotation(in->getAttributeAsVector3d("Rotation"));
721 setScale(in->getAttributeAsVector3d("Scale"));
722
723 IsVisible = in->getAttributeAsBool("Visible");
724 s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",
725 scene::AutomaticCullingNames);
726 if (tmpState != -1)
727 AutomaticCullingState = (u32)tmpState;
728 else
729 AutomaticCullingState = in->getAttributeAsInt("AutomaticCulling");
730
731 DebugDataVisible = in->getAttributeAsInt("DebugDataVisible");
732 IsDebugObject = in->getAttributeAsBool("IsDebugObject");
733
734 updateAbsolutePosition();
735 }
736
737 //! Creates a clone of this scene node and its children.
738 /** \param newParent An optional new parent.
739 \param newManager An optional new scene manager.
740 \return The newly created clone of this node. */
741 virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0)
742 {
743 return 0; // to be implemented by derived classes
744 }
745
746 //! Retrieve the scene manager for this node.
747 /** \return The node's scene manager. */
748 virtual ISceneManager* getSceneManager(void) const { return SceneManager; }
749
750 protected:
751
752 //! A clone function for the ISceneNode members.
753 /** This method can be used by clone() implementations of
754 derived classes
755 \param toCopyFrom The node from which the values are copied
756 \param newManager The new scene manager. */
757 void cloneMembers(ISceneNode* toCopyFrom, ISceneManager* newManager)
758 {
759 Name = toCopyFrom->Name;
760 AbsoluteTransformation = toCopyFrom->AbsoluteTransformation;
761 RelativeTranslation = toCopyFrom->RelativeTranslation;
762 RelativeRotation = toCopyFrom->RelativeRotation;
763 RelativeScale = toCopyFrom->RelativeScale;
764 ID = toCopyFrom->ID;
765 setTriangleSelector(toCopyFrom->TriangleSelector);
766 AutomaticCullingState = toCopyFrom->AutomaticCullingState;
767 DebugDataVisible = toCopyFrom->DebugDataVisible;
768 IsVisible = toCopyFrom->IsVisible;
769 IsDebugObject = toCopyFrom->IsDebugObject;
770
771 if (newManager)
772 SceneManager = newManager;
773 else
774 SceneManager = toCopyFrom->SceneManager;
775
776 // clone children
777
778 ISceneNodeList::Iterator it = toCopyFrom->Children.begin();
779 for (; it != toCopyFrom->Children.end(); ++it)
780 (*it)->clone(this, newManager);
781
782 // clone animators
783
784 ISceneNodeAnimatorList::Iterator ait = toCopyFrom->Animators.begin();
785 for (; ait != toCopyFrom->Animators.end(); ++ait)
786 {
787 ISceneNodeAnimator* anim = (*ait)->createClone(this, SceneManager);
788 if (anim)
789 {
790 addAnimator(anim);
791 anim->drop();
792 }
793 }
794 }
795
796 //! Sets the new scene manager for this node and all children.
797 //! Called by addChild when moving nodes between scene managers
798 void setSceneManager(ISceneManager* newManager)
799 {
800 SceneManager = newManager;
801
802 ISceneNodeList::Iterator it = Children.begin();
803 for (; it != Children.end(); ++it)
804 (*it)->setSceneManager(newManager);
805 }
806
807 //! Name of the scene node.
808 core::stringc Name;
809
810 //! Absolute transformation of the node.
811 core::matrix4 AbsoluteTransformation;
812
813 //! Relative translation of the scene node.
814 core::vector3df RelativeTranslation;
815
816 //! Relative rotation of the scene node.
817 core::vector3df RelativeRotation;
818
819 //! Relative scale of the scene node.
820 core::vector3df RelativeScale;
821
822 //! Pointer to the parent
823 ISceneNode* Parent;
824
825 //! List of all children of this node
826 core::list<ISceneNode*> Children;
827
828 //! List of all animator nodes
829 core::list<ISceneNodeAnimator*> Animators;
830
831 //! Pointer to the scene manager
832 ISceneManager* SceneManager;
833
834 //! Pointer to the triangle selector
835 ITriangleSelector* TriangleSelector;
836
837 //! ID of the node.
838 s32 ID;
839
840 //! Automatic culling state
841 u32 AutomaticCullingState;
842
843 //! Flag if debug data should be drawn, such as Bounding Boxes.
844 u32 DebugDataVisible;
845
846 //! Is the node visible?
847 bool IsVisible;
848
849 //! Is debug object?
850 bool IsDebugObject;
851 };
852
853
854} // end namespace scene
855} // end namespace irr
856
857#endif
858
diff --git a/src/others/irrlicht-1.8.1/include/ISceneNodeAnimator.h b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimator.h
new file mode 100644
index 0000000..e03d975
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimator.h
@@ -0,0 +1,78 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_NODE_ANIMATOR_H_INCLUDED__
6#define __I_SCENE_NODE_ANIMATOR_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "vector3d.h"
10#include "ESceneNodeAnimatorTypes.h"
11#include "IAttributeExchangingObject.h"
12#include "IEventReceiver.h"
13
14namespace irr
15{
16namespace io
17{
18 class IAttributes;
19} // end namespace io
20namespace scene
21{
22 class ISceneNode;
23 class ISceneManager;
24
25 //! Animates a scene node. Can animate position, rotation, material, and so on.
26 /** A scene node animator is able to animate a scene node in a very simple way. It may
27 change its position, rotation, scale and/or material. There are lots of animators
28 to choose from. You can create scene node animators with the ISceneManager interface.
29 */
30 class ISceneNodeAnimator : public io::IAttributeExchangingObject, public IEventReceiver
31 {
32 public:
33 //! Animates a scene node.
34 /** \param node Node to animate.
35 \param timeMs Current time in milli seconds. */
36 virtual void animateNode(ISceneNode* node, u32 timeMs) =0;
37
38 //! Creates a clone of this animator.
39 /** Please note that you will have to drop
40 (IReferenceCounted::drop()) the returned pointer after calling this. */
41 virtual ISceneNodeAnimator* createClone(ISceneNode* node,
42 ISceneManager* newManager=0) =0;
43
44 //! Returns true if this animator receives events.
45 /** When attached to an active camera, this animator will be
46 able to respond to events such as mouse and keyboard events. */
47 virtual bool isEventReceiverEnabled() const
48 {
49 return false;
50 }
51
52 //! Event receiver, override this function for camera controlling animators
53 virtual bool OnEvent(const SEvent& event)
54 {
55 return false;
56 }
57
58 //! Returns type of the scene node animator
59 virtual ESCENE_NODE_ANIMATOR_TYPE getType() const
60 {
61 return ESNAT_UNKNOWN;
62 }
63
64 //! Returns if the animator has finished.
65 /** This is only valid for non-looping animators with a discrete end state.
66 \return true if the animator has finished, false if it is still running. */
67 virtual bool hasFinished(void) const
68 {
69 return false;
70 }
71 };
72
73
74} // end namespace scene
75} // end namespace irr
76
77#endif
78
diff --git a/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCameraFPS.h b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCameraFPS.h
new file mode 100644
index 0000000..7b7a867
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCameraFPS.h
@@ -0,0 +1,69 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
6#define __I_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
7
8#include "ISceneNodeAnimator.h"
9#include "IEventReceiver.h"
10#include "irrArray.h"
11
12namespace irr
13{
14 struct SKeyMap;
15
16namespace scene
17{
18
19 //! Special scene node animator for FPS cameras
20 /** This scene node animator can be attached to a camera to make it act
21 like a first person shooter
22 */
23 class ISceneNodeAnimatorCameraFPS : public ISceneNodeAnimator
24 {
25 public:
26
27 //! Returns the speed of movement in units per millisecond
28 virtual f32 getMoveSpeed() const = 0;
29
30 //! Sets the speed of movement in units per millisecond
31 virtual void setMoveSpeed(f32 moveSpeed) = 0;
32
33 //! Returns the rotation speed in degrees
34 /** The degrees are equivalent to a half screen movement of the mouse,
35 i.e. if the mouse cursor had been moved to the border of the screen since
36 the last animation. */
37 virtual f32 getRotateSpeed() const = 0;
38
39 //! Set the rotation speed in degrees
40 virtual void setRotateSpeed(f32 rotateSpeed) = 0;
41
42 //! Sets the keyboard mapping for this animator (old style)
43 /** \param map Array of keyboard mappings, see irr::SKeyMap
44 \param count Size of the keyboard map array. */
45 virtual void setKeyMap(SKeyMap *map, u32 count) = 0;
46
47 //! Sets the keyboard mapping for this animator
48 //! \param keymap The new keymap array
49 virtual void setKeyMap(const core::array<SKeyMap>& keymap) = 0;
50
51 //! Gets the keyboard mapping for this animator
52 virtual const core::array<SKeyMap>& getKeyMap() const = 0;
53
54 //! Sets whether vertical movement should be allowed.
55 /** If vertical movement is enabled then the camera may fight with
56 gravity causing camera shake. Disable this if the camera has
57 a collision animator with gravity enabled. */
58 virtual void setVerticalMovement(bool allow) = 0;
59
60 //! Sets whether the Y axis of the mouse should be inverted.
61 /** If enabled then moving the mouse down will cause
62 the camera to look up. It is disabled by default. */
63 virtual void setInvertMouse(bool invert) = 0;
64 };
65} // end namespace scene
66} // end namespace irr
67
68#endif
69
diff --git a/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCameraMaya.h b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCameraMaya.h
new file mode 100644
index 0000000..94bd2e5
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCameraMaya.h
@@ -0,0 +1,58 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_NODE_ANIMATOR_CAMERA_MAYA_H_INCLUDED__
6#define __I_SCENE_NODE_ANIMATOR_CAMERA_MAYA_H_INCLUDED__
7
8#include "ISceneNodeAnimator.h"
9
10namespace irr
11{
12
13namespace scene
14{
15
16 //! Special scene node animator for Maya-style cameras
17 /** This scene node animator can be attached to a camera to make it act like a 3d
18 modelling tool.
19 The camera is moving relative to the target with the mouse, by pressing either
20 of the three buttons.
21 In order to move the camera, set a new target for the camera. The distance defines
22 the current orbit radius the camera moves on. Distance can be changed via the setter
23 or by mouse events.
24 */
25 class ISceneNodeAnimatorCameraMaya : public ISceneNodeAnimator
26 {
27 public:
28
29 //! Returns the speed of movement
30 virtual f32 getMoveSpeed() const = 0;
31
32 //! Sets the speed of movement
33 virtual void setMoveSpeed(f32 moveSpeed) = 0;
34
35 //! Returns the rotation speed
36 virtual f32 getRotateSpeed() const = 0;
37
38 //! Set the rotation speed
39 virtual void setRotateSpeed(f32 rotateSpeed) = 0;
40
41 //! Returns the zoom speed
42 virtual f32 getZoomSpeed() const = 0;
43
44 //! Set the zoom speed
45 virtual void setZoomSpeed(f32 zoomSpeed) = 0;
46
47 //! Returns the current distance, i.e. orbit radius
48 virtual f32 getDistance() const = 0;
49
50 //! Set the distance
51 virtual void setDistance(f32 distance) = 0;
52 };
53
54} // end namespace scene
55} // end namespace irr
56
57#endif
58
diff --git a/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCollisionResponse.h b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCollisionResponse.h
new file mode 100644
index 0000000..299c0a7
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorCollisionResponse.h
@@ -0,0 +1,171 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_NODE_ANIMATOR_COLLISION_RESPONSE_H_INCLUDED__
6#define __I_SCENE_NODE_ANIMATOR_COLLISION_RESPONSE_H_INCLUDED__
7
8#include "ISceneNode.h"
9
10namespace irr
11{
12namespace scene
13{
14
15 class ISceneNodeAnimatorCollisionResponse;
16
17 //! Callback interface for catching events of collisions.
18 /** Implement this interface and use
19 ISceneNodeAnimatorCollisionResponse::setCollisionCallback to be able to
20 be notified if a collision has occurred.
21 **/
22 class ICollisionCallback : public virtual IReferenceCounted
23 {
24 public:
25
26 //! Will be called when a collision occurrs.
27 /** See ISceneNodeAnimatorCollisionResponse::setCollisionCallback for more information.
28 \param animator: Collision response animator in which the collision occurred. You can call
29 this animator's methods to find the node, collisionPoint and/or collision triangle.
30 \retval true if the collision was handled in the animator. The animator's target
31 node will *not* be stopped at the collision point, but will instead move fully
32 to the location that triggered the collision check.
33 \retval false if the collision was not handled in the animator. The animator's
34 target node will be moved to the collision position.
35 */
36 virtual bool onCollision(const ISceneNodeAnimatorCollisionResponse& animator) = 0;
37 };
38
39 //! Special scene node animator for doing automatic collision detection and response.
40 /** This scene node animator can be attached to any single scene node
41 and will then prevent it from moving through specified collision geometry
42 (e.g. walls and floors of the) world, as well as having it fall under gravity.
43 This animator provides a simple implementation of first person shooter cameras.
44 Attach it to a camera, and the camera will behave as the player control in a
45 first person shooter game: The camera stops and slides at walls, walks up stairs,
46 falls down if there is no floor under it, and so on.
47
48 The animator will treat any change in the position of its target scene
49 node as movement, including a setPosition(), as movement. If you want to
50 teleport the target scene node manually to a location without it being effected
51 by collision geometry, then call setTargetNode(node) after calling node->setPosition().
52 */
53 class ISceneNodeAnimatorCollisionResponse : public ISceneNodeAnimator
54 {
55 public:
56
57 //! Destructor
58 virtual ~ISceneNodeAnimatorCollisionResponse() {}
59
60 //! Check if the attached scene node is falling.
61 /** Falling means that there is no blocking wall from the scene
62 node in the direction of the gravity. The implementation of
63 this method is very fast, no collision detection is done when
64 invoking it.
65 \return True if the scene node is falling, false if not. */
66 virtual bool isFalling() const = 0;
67
68 //! Sets the radius of the ellipsoid for collision detection and response.
69 /** If you have a scene node, and you are unsure about how big
70 the radius should be, you could use the following code to
71 determine it:
72 \code
73 core::aabbox<f32> box = yourSceneNode->getBoundingBox();
74 core::vector3df radius = box.MaxEdge - box.getCenter();
75 \endcode
76 \param radius: New radius of the ellipsoid. */
77 virtual void setEllipsoidRadius(const core::vector3df& radius) = 0;
78
79 //! Returns the radius of the ellipsoid for collision detection and response.
80 /** \return Radius of the ellipsoid. */
81 virtual core::vector3df getEllipsoidRadius() const = 0;
82
83 //! Sets the gravity of the environment.
84 /** A good example value would be core::vector3df(0,-100.0f,0)
85 for letting gravity affect all object to fall down. For bigger
86 gravity, make increase the length of the vector. You can
87 disable gravity by setting it to core::vector3df(0,0,0);
88 \param gravity: New gravity vector. */
89 virtual void setGravity(const core::vector3df& gravity) = 0;
90
91 //! Get current vector of gravity.
92 //! \return Gravity vector. */
93 virtual core::vector3df getGravity() const = 0;
94
95 //! 'Jump' the animator, by adding a jump speed opposite to its gravity
96 /** \param jumpSpeed The initial speed of the jump; the velocity will be opposite
97 to this animator's gravity vector. */
98 virtual void jump(f32 jumpSpeed) = 0;
99
100 //! Should the Target react on collision ( default = true )
101 virtual void setAnimateTarget ( bool enable ) = 0;
102 virtual bool getAnimateTarget () const = 0;
103
104 //! Set translation of the collision ellipsoid.
105 /** By default, the ellipsoid for collision detection is
106 created around the center of the scene node, which means that
107 the ellipsoid surrounds it completely. If this is not what you
108 want, you may specify a translation for the ellipsoid.
109 \param translation: Translation of the ellipsoid relative
110 to the position of the scene node. */
111 virtual void setEllipsoidTranslation(const core::vector3df &translation) = 0;
112
113 //! Get the translation of the ellipsoid for collision detection.
114 /** See
115 ISceneNodeAnimatorCollisionResponse::setEllipsoidTranslation()
116 for more details.
117 \return Translation of the ellipsoid relative to the position
118 of the scene node. */
119 virtual core::vector3df getEllipsoidTranslation() const = 0;
120
121 //! Sets a triangle selector holding all triangles of the world with which the scene node may collide.
122 /** \param newWorld: New triangle selector containing triangles
123 to let the scene node collide with. */
124 virtual void setWorld(ITriangleSelector* newWorld) = 0;
125
126 //! Get the current triangle selector containing all triangles for collision detection.
127 virtual ITriangleSelector* getWorld() const = 0;
128
129 //! Set the single node that this animator will act on.
130 /** \param node The new target node. Setting this will force the animator to update
131 its last target position for the node, allowing setPosition() to teleport
132 the node through collision geometry. */
133 virtual void setTargetNode(ISceneNode * node) = 0;
134
135 //! Gets the single node that this animator is acting on.
136 /** \return The node that this animator is acting on. */
137 virtual ISceneNode* getTargetNode(void) const = 0;
138
139 //! Returns true if a collision occurred during the last animateNode()
140 virtual bool collisionOccurred() const = 0;
141
142 //! Returns the last point of collision.
143 virtual const core::vector3df & getCollisionPoint() const = 0;
144
145 //! Returns the last triangle that caused a collision
146 virtual const core::triangle3df & getCollisionTriangle() const = 0;
147
148 //! Returns the position that the target node will be moved to, unless the collision is consumed in a callback.
149 /**
150 If you have a collision callback registered, and it consumes the collision, then the
151 node will ignore the collision and will not stop at this position. Instead, it will
152 move fully to the position that caused the collision to occur. */
153 virtual const core::vector3df & getCollisionResultPosition(void) const = 0;
154
155 //! Returns the node that was collided with.
156 virtual ISceneNode* getCollisionNode(void) const = 0;
157
158 //! Sets a callback interface which will be called if a collision occurs.
159 /** \param callback: collision callback handler that will be called when a collision
160 occurs. Set this to 0 to disable the callback.
161 */
162 virtual void setCollisionCallback(ICollisionCallback* callback) = 0;
163
164 };
165
166
167} // end namespace scene
168} // end namespace irr
169
170#endif
171
diff --git a/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorFactory.h b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorFactory.h
new file mode 100644
index 0000000..c3f5b3c
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneNodeAnimatorFactory.h
@@ -0,0 +1,69 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_NODE_ANIMATOR_FACTORY_H_INCLUDED__
6#define __I_SCENE_NODE_ANIMATOR_FACTORY_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "ESceneNodeAnimatorTypes.h"
10
11namespace irr
12{
13namespace scene
14{
15 class ISceneNode;
16 class ISceneNodeAnimator;
17
18 //! Interface for dynamic creation of scene node animators
19 /** To be able to add custom scene node animators to Irrlicht and to make it possible for the
20 scene manager to save and load those external animators, simply implement this
21 interface and register it in you scene manager via ISceneManager::registerSceneNodeAnimatorFactory.
22 Note: When implementing your own scene node factory, don't call ISceneNodeManager::grab() to
23 increase the reference counter of the scene node manager. This is not necessary because the
24 scene node manager will grab() the factory anyway, and otherwise cyclic references will
25 be created and the scene manager and all its nodes won't get deallocated.
26 */
27 class ISceneNodeAnimatorFactory : public virtual IReferenceCounted
28 {
29 public:
30
31 //! creates a scene node animator based on its type id
32 /** \param type: Type of the scene node animator to add.
33 \param target: Target scene node of the new animator.
34 \return Returns pointer to the new scene node animator or null if not successful. You need to
35 drop this pointer after calling this, see IReferenceCounted::drop() for details. */
36 virtual ISceneNodeAnimator* createSceneNodeAnimator(ESCENE_NODE_ANIMATOR_TYPE type, ISceneNode* target) = 0;
37
38 //! creates a scene node animator based on its type name
39 /** \param typeName: Type of the scene node animator to add.
40 \param target: Target scene node of the new animator.
41 \return Returns pointer to the new scene node animator or null if not successful. You need to
42 drop this pointer after calling this, see IReferenceCounted::drop() for details. */
43 virtual ISceneNodeAnimator* createSceneNodeAnimator(const c8* typeName, ISceneNode* target) = 0;
44
45 //! returns amount of scene node animator types this factory is able to create
46 virtual u32 getCreatableSceneNodeAnimatorTypeCount() const = 0;
47
48 //! returns type of a createable scene node animator type
49 /** \param idx: Index of scene node animator type in this factory. Must be a value between 0 and
50 getCreatableSceneNodeTypeCount() */
51 virtual ESCENE_NODE_ANIMATOR_TYPE getCreateableSceneNodeAnimatorType(u32 idx) const = 0;
52
53 //! returns type name of a createable scene node animator type
54 /** \param idx: Index of scene node animator type in this factory. Must be a value between 0 and
55 getCreatableSceneNodeAnimatorTypeCount() */
56 virtual const c8* getCreateableSceneNodeAnimatorTypeName(u32 idx) const = 0;
57
58 //! returns type name of a createable scene node animator type
59 /** \param type: Type of scene node animator.
60 \return: Returns name of scene node animator type if this factory can create the type, otherwise 0. */
61 virtual const c8* getCreateableSceneNodeAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) const = 0;
62 };
63
64
65} // end namespace scene
66} // end namespace irr
67
68#endif
69
diff --git a/src/others/irrlicht-1.8.1/include/ISceneNodeFactory.h b/src/others/irrlicht-1.8.1/include/ISceneNodeFactory.h
new file mode 100644
index 0000000..5359d2b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneNodeFactory.h
@@ -0,0 +1,68 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_NODE_FACTORY_H_INCLUDED__
6#define __I_SCENE_NODE_FACTORY_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "ESceneNodeTypes.h"
10
11namespace irr
12{
13
14namespace scene
15{
16 class ISceneNode;
17
18 //! Interface for dynamic creation of scene nodes
19 /** To be able to add custom scene nodes to Irrlicht and to make it possible for the
20 scene manager to save and load those external scene nodes, simply implement this
21 interface and register it in you scene manager via ISceneManager::registerSceneNodeFactory.
22 Note: When implementing your own scene node factory, don't call ISceneNodeManager::grab() to
23 increase the reference counter of the scene node manager. This is not necessary because the
24 scene node manager will grab() the factory anyway, and otherwise cyclic references will
25 be created and the scene manager and all its nodes won't get deallocated.
26 */
27 class ISceneNodeFactory : public virtual IReferenceCounted
28 {
29 public:
30 //! adds a scene node to the scene graph based on its type id
31 /** \param type: Type of the scene node to add.
32 \param parent: Parent scene node of the new node, can be null to add the scene node to the root.
33 \return Returns pointer to the new scene node or null if not successful.
34 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
35 virtual ISceneNode* addSceneNode(ESCENE_NODE_TYPE type, ISceneNode* parent=0) = 0;
36
37 //! adds a scene node to the scene graph based on its type name
38 /** \param typeName: Type name of the scene node to add.
39 \param parent: Parent scene node of the new node, can be null to add the scene node to the root.
40 \return Returns pointer to the new scene node or null if not successful.
41 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
42 virtual ISceneNode* addSceneNode(const c8* typeName, ISceneNode* parent=0) = 0;
43
44 //! returns amount of scene node types this factory is able to create
45 virtual u32 getCreatableSceneNodeTypeCount() const = 0;
46
47 //! returns type of a createable scene node type
48 /** \param idx: Index of scene node type in this factory. Must be a value between 0 and
49 getCreatableSceneNodeTypeCount() */
50 virtual ESCENE_NODE_TYPE getCreateableSceneNodeType(u32 idx) const = 0;
51
52 //! returns type name of a createable scene node type by index
53 /** \param idx: Index of scene node type in this factory. Must be a value between 0 and
54 getCreatableSceneNodeTypeCount() */
55 virtual const c8* getCreateableSceneNodeTypeName(u32 idx) const = 0;
56
57 //! returns type name of a createable scene node type
58 /** \param type: Type of scene node.
59 \return: Returns name of scene node type if this factory can create the type, otherwise 0. */
60 virtual const c8* getCreateableSceneNodeTypeName(ESCENE_NODE_TYPE type) const = 0;
61 };
62
63
64} // end namespace scene
65} // end namespace irr
66
67#endif
68
diff --git a/src/others/irrlicht-1.8.1/include/ISceneUserDataSerializer.h b/src/others/irrlicht-1.8.1/include/ISceneUserDataSerializer.h
new file mode 100644
index 0000000..309443b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISceneUserDataSerializer.h
@@ -0,0 +1,51 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__
6#define __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9
10namespace irr
11{
12namespace io
13{
14 class IAttributes;
15} // end namespace io
16namespace scene
17{
18 class ISceneNode;
19
20//! Interface to read and write user data to and from .irr files.
21/** This interface is to be implemented by the user, to make it possible to read
22and write user data when reading or writing .irr files via ISceneManager.
23To be used with ISceneManager::loadScene() and ISceneManager::saveScene() */
24class ISceneUserDataSerializer
25{
26public:
27
28 virtual ~ISceneUserDataSerializer() {}
29
30 //! Called when the scene manager create a scene node while loading a file.
31 virtual void OnCreateNode(ISceneNode* node) = 0;
32
33 //! Called when the scene manager read a scene node while loading a file.
34 /** The userData pointer contains a list of attributes with userData which
35 were attached to the scene node in the read scene file.*/
36 virtual void OnReadUserData(ISceneNode* forSceneNode, io::IAttributes* userData) = 0;
37
38 //! Called when the scene manager is writing a scene node to an xml file for example.
39 /** Implement this method and return a list of attributes containing the user data
40 you want to be saved together with the scene node. Return 0 if no user data should
41 be added. Please note that the scene manager will call drop() to the returned pointer
42 after it no longer needs it, so if you didn't create a new object for the return value
43 and returning a longer existing IAttributes object, simply call grab() before returning it. */
44 virtual io::IAttributes* createUserData(ISceneNode* forSceneNode) = 0;
45};
46
47} // end namespace scene
48} // end namespace irr
49
50#endif
51
diff --git a/src/others/irrlicht-1.8.1/include/IShaderConstantSetCallBack.h b/src/others/irrlicht-1.8.1/include/IShaderConstantSetCallBack.h
new file mode 100644
index 0000000..fdf9e9a
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IShaderConstantSetCallBack.h
@@ -0,0 +1,85 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__
6#define __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9
10namespace irr
11{
12namespace video
13{
14 class IMaterialRendererServices;
15 class SMaterial;
16
17//! Interface making it possible to set constants for gpu programs every frame.
18/** Implement this interface in an own class and pass a pointer to it to one of
19the methods in IGPUProgrammingServices when creating a shader. The
20OnSetConstants method will be called every frame now. */
21class IShaderConstantSetCallBack : public virtual IReferenceCounted
22{
23public:
24
25 //! Called to let the callBack know the used material (optional method)
26 /**
27 \code
28 class MyCallBack : public IShaderConstantSetCallBack
29 {
30 const video::SMaterial *UsedMaterial;
31
32 OnSetMaterial(const video::SMaterial& material)
33 {
34 UsedMaterial=&material;
35 }
36
37 OnSetConstants(IMaterialRendererServices* services, s32 userData)
38 {
39 services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&UsedMaterial->color), 4);
40 }
41 }
42 \endcode
43 */
44 virtual void OnSetMaterial(const SMaterial& material) { }
45
46 //! Called by the engine when the vertex and/or pixel shader constants for an material renderer should be set.
47 /**
48 Implement the IShaderConstantSetCallBack in an own class and implement your own
49 OnSetConstants method using the given IMaterialRendererServices interface.
50 Pass a pointer to this class to one of the methods in IGPUProgrammingServices
51 when creating a shader. The OnSetConstants method will now be called every time
52 before geometry is being drawn using your shader material. A sample implementation
53 would look like this:
54 \code
55 virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
56 {
57 video::IVideoDriver* driver = services->getVideoDriver();
58
59 // set clip matrix at register 4
60 core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
61 worldViewProj *= driver->getTransform(video::ETS_VIEW);
62 worldViewProj *= driver->getTransform(video::ETS_WORLD);
63 services->setVertexShaderConstant(&worldViewProj.M[0], 4, 4);
64 // for high level shading languages, this would be another solution:
65 //services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
66
67 // set some light color at register 9
68 video::SColorf col(0.0f,1.0f,1.0f,0.0f);
69 services->setVertexShaderConstant(reinterpret_cast<const f32*>(&col), 9, 1);
70 // for high level shading languages, this would be another solution:
71 //services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&col), 4);
72 }
73 \endcode
74 \param services: Pointer to an interface providing methods to set the constants for the shader.
75 \param userData: Userdata int which can be specified when creating the shader.
76 */
77 virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) = 0;
78};
79
80
81} // end namespace video
82} // end namespace irr
83
84#endif
85
diff --git a/src/others/irrlicht-1.8.1/include/IShadowVolumeSceneNode.h b/src/others/irrlicht-1.8.1/include/IShadowVolumeSceneNode.h
new file mode 100644
index 0000000..82c2ad3
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IShadowVolumeSceneNode.h
@@ -0,0 +1,38 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__
6#define __I_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9
10namespace irr
11{
12namespace scene
13{
14 class IMesh;
15
16 //! Scene node for rendering a shadow volume into a stencil buffer.
17 class IShadowVolumeSceneNode : public ISceneNode
18 {
19 public:
20
21 //! constructor
22 IShadowVolumeSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
23 : ISceneNode(parent, mgr, id) {}
24
25 //! Sets the mesh from which the shadow volume should be generated.
26 /** To optimize shadow rendering, use a simpler mesh for shadows.
27 */
28 virtual void setShadowMesh(const IMesh* mesh) = 0;
29
30 //! Updates the shadow volumes for current light positions.
31 virtual void updateShadowVolumes() = 0;
32 };
33
34} // end namespace scene
35} // end namespace irr
36
37#endif
38
diff --git a/src/others/irrlicht-1.8.1/include/ISkinnedMesh.h b/src/others/irrlicht-1.8.1/include/ISkinnedMesh.h
new file mode 100644
index 0000000..03f5016
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ISkinnedMesh.h
@@ -0,0 +1,219 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SKINNED_MESH_H_INCLUDED__
6#define __I_SKINNED_MESH_H_INCLUDED__
7
8#include "irrArray.h"
9#include "IBoneSceneNode.h"
10#include "IAnimatedMesh.h"
11#include "SSkinMeshBuffer.h"
12
13namespace irr
14{
15namespace scene
16{
17
18 enum E_INTERPOLATION_MODE
19 {
20 // constant does use the current key-values without interpolation
21 EIM_CONSTANT = 0,
22
23 // linear interpolation
24 EIM_LINEAR,
25
26 //! count of all available interpolation modes
27 EIM_COUNT
28 };
29
30
31 //! Interface for using some special functions of Skinned meshes
32 class ISkinnedMesh : public IAnimatedMesh
33 {
34 public:
35
36 //! Gets joint count.
37 /** \return Amount of joints in the skeletal animated mesh. */
38 virtual u32 getJointCount() const = 0;
39
40 //! Gets the name of a joint.
41 /** \param number: Zero based index of joint. The last joint
42 has the number getJointCount()-1;
43 \return Name of joint and null if an error happened. */
44 virtual const c8* getJointName(u32 number) const = 0;
45
46 //! Gets a joint number from its name
47 /** \param name: Name of the joint.
48 \return Number of the joint or -1 if not found. */
49 virtual s32 getJointNumber(const c8* name) const = 0;
50
51 //! Use animation from another mesh
52 /** The animation is linked (not copied) based on joint names
53 so make sure they are unique.
54 \return True if all joints in this mesh were
55 matched up (empty names will not be matched, and it's case
56 sensitive). Unmatched joints will not be animated. */
57 virtual bool useAnimationFrom(const ISkinnedMesh *mesh) = 0;
58
59 //! Update Normals when Animating
60 /** \param on If false don't animate, which is faster.
61 Else update normals, which allows for proper lighting of
62 animated meshes. */
63 virtual void updateNormalsWhenAnimating(bool on) = 0;
64
65 //! Sets Interpolation Mode
66 virtual void setInterpolationMode(E_INTERPOLATION_MODE mode) = 0;
67
68 //! Animates this mesh's joints based on frame input
69 virtual void animateMesh(f32 frame, f32 blend)=0;
70
71 //! Preforms a software skin on this mesh based of joint positions
72 virtual void skinMesh() = 0;
73
74 //! converts the vertex type of all meshbuffers to tangents.
75 /** E.g. used for bump mapping. */
76 virtual void convertMeshToTangents() = 0;
77
78 //! Allows to enable hardware skinning.
79 /* This feature is not implementated in Irrlicht yet */
80 virtual bool setHardwareSkinning(bool on) = 0;
81
82 //! A vertex weight
83 struct SWeight
84 {
85 //! Index of the mesh buffer
86 u16 buffer_id; //I doubt 32bits is needed
87
88 //! Index of the vertex
89 u32 vertex_id; //Store global ID here
90
91 //! Weight Strength/Percentage (0-1)
92 f32 strength;
93
94 private:
95 //! Internal members used by CSkinnedMesh
96 friend class CSkinnedMesh;
97 bool *Moved;
98 core::vector3df StaticPos;
99 core::vector3df StaticNormal;
100 };
101
102
103 //! Animation keyframe which describes a new position
104 struct SPositionKey
105 {
106 f32 frame;
107 core::vector3df position;
108 };
109
110 //! Animation keyframe which describes a new scale
111 struct SScaleKey
112 {
113 f32 frame;
114 core::vector3df scale;
115 };
116
117 //! Animation keyframe which describes a new rotation
118 struct SRotationKey
119 {
120 f32 frame;
121 core::quaternion rotation;
122 };
123
124 //! Joints
125 struct SJoint
126 {
127 SJoint() : UseAnimationFrom(0), GlobalSkinningSpace(false),
128 positionHint(-1),scaleHint(-1),rotationHint(-1)
129 {
130 }
131
132 //! The name of this joint
133 core::stringc Name;
134
135 //! Local matrix of this joint
136 core::matrix4 LocalMatrix;
137
138 //! List of child joints
139 core::array<SJoint*> Children;
140
141 //! List of attached meshes
142 core::array<u32> AttachedMeshes;
143
144 //! Animation keys causing translation change
145 core::array<SPositionKey> PositionKeys;
146
147 //! Animation keys causing scale change
148 core::array<SScaleKey> ScaleKeys;
149
150 //! Animation keys causing rotation change
151 core::array<SRotationKey> RotationKeys;
152
153 //! Skin weights
154 core::array<SWeight> Weights;
155
156 //! Unnecessary for loaders, will be overwritten on finalize
157 core::matrix4 GlobalMatrix;
158 core::matrix4 GlobalAnimatedMatrix;
159 core::matrix4 LocalAnimatedMatrix;
160 core::vector3df Animatedposition;
161 core::vector3df Animatedscale;
162 core::quaternion Animatedrotation;
163
164 core::matrix4 GlobalInversedMatrix; //the x format pre-calculates this
165
166 private:
167 //! Internal members used by CSkinnedMesh
168 friend class CSkinnedMesh;
169
170 SJoint *UseAnimationFrom;
171 bool GlobalSkinningSpace;
172
173 s32 positionHint;
174 s32 scaleHint;
175 s32 rotationHint;
176 };
177
178
179 //Interface for the mesh loaders (finalize should lock these functions, and they should have some prefix like loader_
180
181 //these functions will use the needed arrays, set values, etc to help the loaders
182
183 //! exposed for loaders: to add mesh buffers
184 virtual core::array<SSkinMeshBuffer*>& getMeshBuffers() = 0;
185
186 //! exposed for loaders: joints list
187 virtual core::array<SJoint*>& getAllJoints() = 0;
188
189 //! exposed for loaders: joints list
190 virtual const core::array<SJoint*>& getAllJoints() const = 0;
191
192 //! loaders should call this after populating the mesh
193 virtual void finalize() = 0;
194
195 //! Adds a new meshbuffer to the mesh, access it as last one
196 virtual SSkinMeshBuffer* addMeshBuffer() = 0;
197
198 //! Adds a new joint to the mesh, access it as last one
199 virtual SJoint* addJoint(SJoint *parent=0) = 0;
200
201 //! Adds a new weight to the mesh, access it as last one
202 virtual SWeight* addWeight(SJoint *joint) = 0;
203
204 //! Adds a new position key to the mesh, access it as last one
205 virtual SPositionKey* addPositionKey(SJoint *joint) = 0;
206 //! Adds a new scale key to the mesh, access it as last one
207 virtual SScaleKey* addScaleKey(SJoint *joint) = 0;
208 //! Adds a new rotation key to the mesh, access it as last one
209 virtual SRotationKey* addRotationKey(SJoint *joint) = 0;
210
211 //! Check if the mesh is non-animated
212 virtual bool isStatic()=0;
213 };
214
215} // end namespace scene
216} // end namespace irr
217
218#endif
219
diff --git a/src/others/irrlicht-1.8.1/include/ITerrainSceneNode.h b/src/others/irrlicht-1.8.1/include/ITerrainSceneNode.h
new file mode 100644
index 0000000..0706709
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ITerrainSceneNode.h
@@ -0,0 +1,182 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5// The code for the TerrainSceneNode is based on the terrain renderer by
6// Soconne and the GeoMipMapSceneNode developed by Spintz. They made their
7// code available for Irrlicht and allowed it to be distributed under this
8// licence. I only modified some parts. A lot of thanks go to them.
9
10#ifndef __I_TERRAIN_SCENE_NODE_H__
11#define __I_TERRAIN_SCENE_NODE_H__
12
13#include "ETerrainElements.h"
14#include "ISceneNode.h"
15#include "IDynamicMeshBuffer.h"
16#include "irrArray.h"
17
18namespace irr
19{
20namespace io
21{
22 class IReadFile;
23} // end namespace io
24namespace scene
25{
26 class IMesh;
27
28 //! A scene node for displaying terrain using the geo mip map algorithm.
29 /** The code for the TerrainSceneNode is based on the Terrain renderer by Soconne and
30 * the GeoMipMapSceneNode developed by Spintz. They made their code available for Irrlicht
31 * and allowed it to be distributed under this licence. I only modified some parts.
32 * A lot of thanks go to them.
33 *
34 * This scene node is capable of very quickly loading
35 * terrains and updating the indices at runtime to enable viewing very large terrains. It uses a
36 * CLOD (Continuous Level of Detail) algorithm which updates the indices for each patch based on
37 * a LOD (Level of Detail) which is determined based on a patch's distance from the camera.
38 *
39 * The Patch Size of the terrain must always be a size of ( 2^N+1, i.e. 8+1(9), 16+1(17), etc. ).
40 * The MaxLOD available is directly dependent on the patch size of the terrain. LOD 0 contains all
41 * of the indices to draw all the triangles at the max detail for a patch. As each LOD goes up by 1
42 * the step taken, in generating indices increases by - 2^LOD, so for LOD 1, the step taken is 2, for
43 * LOD 2, the step taken is 4, LOD 3 - 8, etc. The step can be no larger than the size of the patch,
44 * so having a LOD of 8, with a patch size of 17, is asking the algoritm to generate indices every
45 * 2^8 ( 256 ) vertices, which is not possible with a patch size of 17. The maximum LOD for a patch
46 * size of 17 is 2^4 ( 16 ). So, with a MaxLOD of 5, you'll have LOD 0 ( full detail ), LOD 1 ( every
47 * 2 vertices ), LOD 2 ( every 4 vertices ), LOD 3 ( every 8 vertices ) and LOD 4 ( every 16 vertices ).
48 **/
49 class ITerrainSceneNode : public ISceneNode
50 {
51 public:
52 //! Constructor
53 ITerrainSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
54 const core::vector3df& position = core::vector3df(0.0f, 0.0f, 0.0f),
55 const core::vector3df& rotation = core::vector3df(0.0f, 0.0f, 0.0f),
56 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f) )
57 : ISceneNode (parent, mgr, id, position, rotation, scale) {}
58
59 //! Get the bounding box of the terrain.
60 /** \return The bounding box of the entire terrain. */
61 virtual const core::aabbox3d<f32>& getBoundingBox() const =0;
62
63 //! Get the bounding box of a patch
64 /** \return The bounding box of the chosen patch. */
65 virtual const core::aabbox3d<f32>& getBoundingBox(s32 patchX, s32 patchZ) const =0;
66
67 //! Get the number of indices currently in the meshbuffer
68 /** \return The index count. */
69 virtual u32 getIndexCount() const =0;
70
71 //! Get pointer to the mesh
72 /** \return Pointer to the mesh. */
73 virtual IMesh* getMesh() =0;
74
75 //! Get pointer to the buffer used by the terrain (most users will not need this)
76 virtual IMeshBuffer* getRenderBuffer() =0;
77
78
79 //! Gets the meshbuffer data based on a specified level of detail.
80 /** \param mb A reference to an IDynamicMeshBuffer object
81 \param LOD The level of detail you want the indices from. */
82 virtual void getMeshBufferForLOD(IDynamicMeshBuffer& mb, s32 LOD=0) const =0;
83
84 //! Gets the indices for a specified patch at a specified Level of Detail.
85 /** \param indices A reference to an array of u32 indices.
86 \param patchX Patch x coordinate.
87 \param patchZ Patch z coordinate.
88 \param LOD The level of detail to get for that patch. If -1,
89 then get the CurrentLOD. If the CurrentLOD is set to -1,
90 meaning it's not shown, then it will retrieve the triangles at
91 the highest LOD (0).
92 \return Number of indices put into the buffer. */
93 virtual s32 getIndicesForPatch(core::array<u32>& indices,
94 s32 patchX, s32 patchZ, s32 LOD=0) =0;
95
96 //! Populates an array with the CurrentLOD of each patch.
97 /** \param LODs A reference to a core::array<s32> to hold the
98 values
99 \return Number of elements in the array */
100 virtual s32 getCurrentLODOfPatches(core::array<s32>& LODs) const =0;
101
102 //! Manually sets the LOD of a patch
103 /** \param patchX Patch x coordinate.
104 \param patchZ Patch z coordinate.
105 \param LOD The level of detail to set the patch to. */
106 virtual void setLODOfPatch(s32 patchX, s32 patchZ, s32 LOD=0) =0;
107
108 //! Get center of terrain.
109 virtual const core::vector3df& getTerrainCenter() const =0;
110
111 //! Get height of a point of the terrain.
112 virtual f32 getHeight(f32 x, f32 y) const =0;
113
114 //! Sets the movement camera threshold.
115 /** It is used to determine when to recalculate
116 indices for the scene node. The default value is 10.0f. */
117 virtual void setCameraMovementDelta(f32 delta) =0;
118
119 //! Sets the rotation camera threshold.
120 /** It is used to determine when to recalculate
121 indices for the scene node. The default value is 1.0f. */
122 virtual void setCameraRotationDelta(f32 delta) =0;
123
124 //! Sets whether or not the node should dynamically update its associated selector when the geomipmap data changes.
125 /** \param bVal: Boolean value representing whether or not to update selector dynamically. */
126 virtual void setDynamicSelectorUpdate(bool bVal) =0;
127
128 //! Override the default generation of distance thresholds.
129 /** For determining the LOD a patch is rendered at. If any LOD
130 is overridden, then the scene node will no longer apply scaling
131 factors to these values. If you override these distances, and
132 then apply a scale to the scene node, it is your responsibility
133 to update the new distances to work best with your new terrain
134 size. */
135 virtual bool overrideLODDistance(s32 LOD, f64 newDistance) =0;
136
137 //! Scales the base texture, similar to makePlanarTextureMapping.
138 /** \param scale The scaling amount. Values above 1.0
139 increase the number of time the texture is drawn on the
140 terrain. Values below 0 will decrease the number of times the
141 texture is drawn on the terrain. Using negative values will
142 flip the texture, as well as still scaling it.
143 \param scale2 If set to 0 (default value), this will set the
144 second texture coordinate set to the same values as in the
145 first set. If this is another value than zero, it will scale
146 the second texture coordinate set by this value. */
147 virtual void scaleTexture(f32 scale = 1.0f, f32 scale2=0.0f) =0;
148
149 //! Initializes the terrain data. Loads the vertices from the heightMapFile.
150 /** The file must contain a loadable image of the heightmap. The heightmap
151 must be square.
152 \param file The file to read the image from. File is not rewinded.
153 \param vertexColor Color of all vertices.
154 \param smoothFactor Number of smoothing passes. */
155 virtual bool loadHeightMap(io::IReadFile* file,
156 video::SColor vertexColor=video::SColor(255,255,255,255),
157 s32 smoothFactor=0) =0;
158
159 //! Initializes the terrain data. Loads the vertices from the heightMapFile.
160 /** The data is interpreted as (signed) integers of the given bit size or
161 floats (with 32bits, signed). Allowed bitsizes for integers are
162 8, 16, and 32. The heightmap must be square.
163 \param file The file to read the RAW data from. File is not rewinded.
164 \param bitsPerPixel Size of data if integers used, for floats always use 32.
165 \param signedData Whether we use signed or unsigned ints, ignored for floats.
166 \param floatVals Whether the data is float or int.
167 \param width Width (and also Height, as it must be square) of the heightmap. Use 0 for autocalculating from the filesize.
168 \param vertexColor Color of all vertices.
169 \param smoothFactor Number of smoothing passes. */
170 virtual bool loadHeightMapRAW(io::IReadFile* file, s32 bitsPerPixel=16,
171 bool signedData=false, bool floatVals=false, s32 width=0,
172 video::SColor vertexColor=video::SColor(255,255,255,255),
173 s32 smoothFactor=0) =0;
174
175 };
176
177} // end namespace scene
178} // end namespace irr
179
180
181#endif // __I_TERRAIN_SCENE_NODE_H__
182
diff --git a/src/others/irrlicht-1.8.1/include/ITextSceneNode.h b/src/others/irrlicht-1.8.1/include/ITextSceneNode.h
new file mode 100644
index 0000000..540d7b7
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ITextSceneNode.h
@@ -0,0 +1,37 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_TEXT_SCENE_NODE_H_INCLUDED__
6#define __I_TEXT_SCENE_NODE_H_INCLUDED__
7
8#include "ISceneNode.h"
9
10namespace irr
11{
12namespace scene
13{
14
15//! A scene node for displaying 2d text at a position in three dimensional space
16class ITextSceneNode : public ISceneNode
17{
18public:
19
20 //! constructor
21 ITextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
22 const core::vector3df& position = core::vector3df(0,0,0))
23 : ISceneNode(parent, mgr, id, position) {}
24
25 //! sets the text string
26 virtual void setText(const wchar_t* text) = 0;
27
28 //! sets the color of the text
29 virtual void setTextColor(video::SColor color) = 0;
30};
31
32} // end namespace scene
33} // end namespace irr
34
35
36#endif
37
diff --git a/src/others/irrlicht-1.8.1/include/ITexture.h b/src/others/irrlicht-1.8.1/include/ITexture.h
new file mode 100644
index 0000000..2f54437
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ITexture.h
@@ -0,0 +1,219 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_TEXTURE_H_INCLUDED__
6#define __I_TEXTURE_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "IImage.h"
10#include "dimension2d.h"
11#include "EDriverTypes.h"
12#include "path.h"
13#include "matrix4.h"
14
15namespace irr
16{
17namespace video
18{
19
20
21//! Enumeration flags telling the video driver in which format textures should be created.
22enum E_TEXTURE_CREATION_FLAG
23{
24 /** Forces the driver to create 16 bit textures always, independent of
25 which format the file on disk has. When choosing this you may lose
26 some color detail, but gain much speed and memory. 16 bit textures can
27 be transferred twice as fast as 32 bit textures and only use half of
28 the space in memory.
29 When using this flag, it does not make sense to use the flags
30 ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or
31 ETCF_OPTIMIZED_FOR_SPEED at the same time. */
32 ETCF_ALWAYS_16_BIT = 0x00000001,
33
34 /** Forces the driver to create 32 bit textures always, independent of
35 which format the file on disk has. Please note that some drivers (like
36 the software device) will ignore this, because they are only able to
37 create and use 16 bit textures.
38 When using this flag, it does not make sense to use the flags
39 ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or
40 ETCF_OPTIMIZED_FOR_SPEED at the same time. */
41 ETCF_ALWAYS_32_BIT = 0x00000002,
42
43 /** Lets the driver decide in which format the textures are created and
44 tries to make the textures look as good as possible. Usually it simply
45 chooses the format in which the texture was stored on disk.
46 When using this flag, it does not make sense to use the flags
47 ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_SPEED at
48 the same time. */
49 ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004,
50
51 /** Lets the driver decide in which format the textures are created and
52 tries to create them maximizing render speed.
53 When using this flag, it does not make sense to use the flags
54 ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY,
55 at the same time. */
56 ETCF_OPTIMIZED_FOR_SPEED = 0x00000008,
57
58 /** Automatically creates mip map levels for the textures. */
59 ETCF_CREATE_MIP_MAPS = 0x00000010,
60
61 /** Discard any alpha layer and use non-alpha color format. */
62 ETCF_NO_ALPHA_CHANNEL = 0x00000020,
63
64 //! Allow the Driver to use Non-Power-2-Textures
65 /** BurningVideo can handle Non-Power-2 Textures in 2D (GUI), but not in 3D. */
66 ETCF_ALLOW_NON_POWER_2 = 0x00000040,
67
68 /** This flag is never used, it only forces the compiler to compile
69 these enumeration values to 32 bit. */
70 ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff
71};
72
73//! Enum for the mode for texture locking. Read-Only, write-only or read/write.
74enum E_TEXTURE_LOCK_MODE
75{
76 //! The default mode. Texture can be read and written to.
77 ETLM_READ_WRITE = 0,
78
79 //! Read only. The texture is downloaded, but not uploaded again.
80 /** Often used to read back shader generated textures. */
81 ETLM_READ_ONLY,
82
83 //! Write only. The texture is not downloaded and might be uninitialised.
84 /** The updated texture is uploaded to the GPU.
85 Used for initialising the shader from the CPU. */
86 ETLM_WRITE_ONLY
87};
88
89//! Interface of a Video Driver dependent Texture.
90/** An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture
91or IVideoDriver::getTexture. After that, the texture may only be used by this
92VideoDriver. As you can imagine, textures of the DirectX and the OpenGL device
93will, e.g., not be compatible. An exception is the Software device and the
94NULL device, their textures are compatible. If you try to use a texture
95created by one device with an other device, the device will refuse to do that
96and write a warning or an error message to the output buffer.
97*/
98class ITexture : public virtual IReferenceCounted
99{
100public:
101
102 //! constructor
103 ITexture(const io::path& name) : NamedPath(name)
104 {
105 }
106
107 //! Lock function.
108 /** Locks the Texture and returns a pointer to access the
109 pixels. After lock() has been called and all operations on the pixels
110 are done, you must call unlock().
111 Locks are not accumulating, hence one unlock will do for an arbitrary
112 number of previous locks. You should avoid locking different levels without
113 unlocking inbetween, though, because only the last level locked will be
114 unlocked.
115 The size of the i-th mipmap level is defined as max(getSize().Width>>i,1)
116 and max(getSize().Height>>i,1)
117 \param mode Specifies what kind of changes to the locked texture are
118 allowed. Unspecified behavior will arise if texture is written in read
119 only mode or read from in write only mode.
120 Support for this feature depends on the driver, so don't rely on the
121 texture being write-protected when locking with read-only, etc.
122 \param mipmapLevel Number of the mipmapLevel to lock. 0 is main texture.
123 Non-existing levels will silently fail and return 0.
124 \return Returns a pointer to the pixel data. The format of the pixel can
125 be determined by using getColorFormat(). 0 is returned, if
126 the texture cannot be locked. */
127 virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) = 0;
128
129 //! Unlock function. Must be called after a lock() to the texture.
130 /** One should avoid to call unlock more than once before another lock.
131 The last locked mip level will be unlocked. */
132 virtual void unlock() = 0;
133
134 //! Get original size of the texture.
135 /** The texture is usually scaled, if it was created with an unoptimal
136 size. For example if the size was not a power of two. This method
137 returns the size of the texture it had before it was scaled. Can be
138 useful when drawing 2d images on the screen, which should have the
139 exact size of the original texture. Use ITexture::getSize() if you want
140 to know the real size it has now stored in the system.
141 \return The original size of the texture. */
142 virtual const core::dimension2d<u32>& getOriginalSize() const = 0;
143
144 //! Get dimension (=size) of the texture.
145 /** \return The size of the texture. */
146 virtual const core::dimension2d<u32>& getSize() const = 0;
147
148 //! Get driver type of texture.
149 /** This is the driver, which created the texture. This method is used
150 internally by the video devices, to check, if they may use a texture
151 because textures may be incompatible between different devices.
152 \return Driver type of texture. */
153 virtual E_DRIVER_TYPE getDriverType() const = 0;
154
155 //! Get the color format of texture.
156 /** \return The color format of texture. */
157 virtual ECOLOR_FORMAT getColorFormat() const = 0;
158
159 //! Get pitch of the main texture (in bytes).
160 /** The pitch is the amount of bytes used for a row of pixels in a
161 texture.
162 \return Pitch of texture in bytes. */
163 virtual u32 getPitch() const = 0;
164
165 //! Check whether the texture has MipMaps
166 /** \return True if texture has MipMaps, else false. */
167 virtual bool hasMipMaps() const { return false; }
168
169 //! Returns if the texture has an alpha channel
170 virtual bool hasAlpha() const {
171 return getColorFormat () == video::ECF_A8R8G8B8 || getColorFormat () == video::ECF_A1R5G5B5;
172 }
173
174 //! Regenerates the mip map levels of the texture.
175 /** Required after modifying the texture, usually after calling unlock().
176 \param mipmapData Optional parameter to pass in image data which will be
177 used instead of the previously stored or automatically generated mipmap
178 data. The data has to be a continuous pixel data for all mipmaps until
179 1x1 pixel. Each mipmap has to be half the width and height of the previous
180 level. At least one pixel will be always kept.*/
181 virtual void regenerateMipMapLevels(void* mipmapData=0) = 0;
182
183 //! Check whether the texture is a render target
184 /** Render targets can be set as such in the video driver, in order to
185 render a scene into the texture. Once unbound as render target, they can
186 be used just as usual textures again.
187 \return True if this is a render target, otherwise false. */
188 virtual bool isRenderTarget() const { return false; }
189
190 //! Get name of texture (in most cases this is the filename)
191 const io::SNamedPath& getName() const { return NamedPath; }
192
193protected:
194
195 //! Helper function, helps to get the desired texture creation format from the flags.
196 /** \return Either ETCF_ALWAYS_32_BIT, ETCF_ALWAYS_16_BIT,
197 ETCF_OPTIMIZED_FOR_QUALITY, or ETCF_OPTIMIZED_FOR_SPEED. */
198 inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
199 {
200 if (flags & ETCF_OPTIMIZED_FOR_SPEED)
201 return ETCF_OPTIMIZED_FOR_SPEED;
202 if (flags & ETCF_ALWAYS_16_BIT)
203 return ETCF_ALWAYS_16_BIT;
204 if (flags & ETCF_ALWAYS_32_BIT)
205 return ETCF_ALWAYS_32_BIT;
206 if (flags & ETCF_OPTIMIZED_FOR_QUALITY)
207 return ETCF_OPTIMIZED_FOR_QUALITY;
208 return ETCF_OPTIMIZED_FOR_SPEED;
209 }
210
211 io::SNamedPath NamedPath;
212};
213
214
215} // end namespace video
216} // end namespace irr
217
218#endif
219
diff --git a/src/others/irrlicht-1.8.1/include/ITimer.h b/src/others/irrlicht-1.8.1/include/ITimer.h
new file mode 100644
index 0000000..815ebd6
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ITimer.h
@@ -0,0 +1,103 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_TIMER_H_INCLUDED__
6#define __I_TIMER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9
10namespace irr
11{
12
13//! Interface for getting and manipulating the virtual time
14class ITimer : public virtual IReferenceCounted
15{
16public:
17 //! Returns current real time in milliseconds of the system.
18 /** This value does not start with 0 when the application starts.
19 For example in one implementation the value returned could be the
20 amount of milliseconds which have elapsed since the system was started.
21 */
22 virtual u32 getRealTime() const = 0;
23
24 enum EWeekday
25 {
26 EWD_SUNDAY=0,
27 EWD_MONDAY,
28 EWD_TUESDAY,
29 EWD_WEDNESDAY,
30 EWD_THURSDAY,
31 EWD_FRIDAY,
32 EWD_SATURDAY
33 };
34
35 struct RealTimeDate
36 {
37 // Hour of the day, from 0 to 23
38 u32 Hour;
39 // Minute of the hour, from 0 to 59
40 u32 Minute;
41 // Second of the minute, due to extra seconds from 0 to 61
42 u32 Second;
43 // Year of the gregorian calender
44 s32 Year;
45 // Month of the year, from 1 to 12
46 u32 Month;
47 // Day of the month, from 1 to 31
48 u32 Day;
49 // Weekday for the current day
50 EWeekday Weekday;
51 // Day of the year, from 1 to 366
52 u32 Yearday;
53 // Whether daylight saving is on
54 bool IsDST;
55 };
56
57 virtual RealTimeDate getRealTimeAndDate() const = 0;
58
59 //! Returns current virtual time in milliseconds.
60 /** This value starts with 0 and can be manipulated using setTime(),
61 stopTimer(), startTimer(), etc. This value depends on the set speed of
62 the timer if the timer is stopped, etc. If you need the system time,
63 use getRealTime() */
64 virtual u32 getTime() const = 0;
65
66 //! sets current virtual time
67 virtual void setTime(u32 time) = 0;
68
69 //! Stops the virtual timer.
70 /** The timer is reference counted, which means everything which calls
71 stop() will also have to call start(), otherwise the timer may not
72 start/stop correctly again. */
73 virtual void stop() = 0;
74
75 //! Starts the virtual timer.
76 /** The timer is reference counted, which means everything which calls
77 stop() will also have to call start(), otherwise the timer may not
78 start/stop correctly again. */
79 virtual void start() = 0;
80
81 //! Sets the speed of the timer
82 /** The speed is the factor with which the time is running faster or
83 slower then the real system time. */
84 virtual void setSpeed(f32 speed = 1.0f) = 0;
85
86 //! Returns current speed of the timer
87 /** The speed is the factor with which the time is running faster or
88 slower then the real system time. */
89 virtual f32 getSpeed() const = 0;
90
91 //! Returns if the virtual timer is currently stopped
92 virtual bool isStopped() const = 0;
93
94 //! Advances the virtual time
95 /** Makes the virtual timer update the time value based on the real
96 time. This is called automatically when calling IrrlichtDevice::run(),
97 but you can call it manually if you don't use this method. */
98 virtual void tick() = 0;
99};
100
101} // end namespace irr
102
103#endif
diff --git a/src/others/irrlicht-1.8.1/include/ITriangleSelector.h b/src/others/irrlicht-1.8.1/include/ITriangleSelector.h
new file mode 100644
index 0000000..e2a2256
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/ITriangleSelector.h
@@ -0,0 +1,131 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_TRIANGLE_SELECTOR_H_INCLUDED__
6#define __I_TRIANGLE_SELECTOR_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "triangle3d.h"
10#include "aabbox3d.h"
11#include "matrix4.h"
12#include "line3d.h"
13
14namespace irr
15{
16namespace scene
17{
18
19class ISceneNode;
20
21//! Interface to return triangles with specific properties.
22/** Every ISceneNode may have a triangle selector, available with
23ISceneNode::getTriangleScelector() or ISceneManager::createTriangleSelector.
24This is used for doing collision detection: For example if you know, that a
25collision may have happened in the area between (1,1,1) and (10,10,10), you
26can get all triangles of the scene node in this area with the
27ITriangleSelector easily and check every triangle if it collided. */
28class ITriangleSelector : public virtual IReferenceCounted
29{
30public:
31
32 //! Get amount of all available triangles in this selector
33 virtual s32 getTriangleCount() const = 0;
34
35 //! Gets the triangles for one associated node.
36 /**
37 This returns all triangles for one scene node associated with this
38 selector. If there is more than one scene node associated (e.g. for
39 an IMetaTriangleSelector) this this function may be called multiple
40 times to retrieve all triangles.
41 \param triangles Array where the resulting triangles will be
42 written to.
43 \param arraySize Size of the target array.
44 \param outTriangleCount: Amount of triangles which have been written
45 into the array.
46 \param transform Pointer to matrix for transforming the triangles
47 before they are returned. Useful for example to scale all triangles
48 down into an ellipsoid space. If this pointer is null, no
49 transformation will be done. */
50 virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
51 s32& outTriangleCount, const core::matrix4* transform=0) const = 0;
52
53 //! Gets the triangles for one associated node which may lie within a specific bounding box.
54 /**
55 This returns all triangles for one scene node associated with this
56 selector. If there is more than one scene node associated (e.g. for
57 an IMetaTriangleSelector) this this function may be called multiple
58 times to retrieve all triangles.
59
60 This method will return at least the triangles that intersect the box,
61 but may return other triangles as well.
62 \param triangles Array where the resulting triangles will be written
63 to.
64 \param arraySize Size of the target array.
65 \param outTriangleCount Amount of triangles which have been written
66 into the array.
67 \param box Only triangles which are in this axis aligned bounding box
68 will be written into the array.
69 \param transform Pointer to matrix for transforming the triangles
70 before they are returned. Useful for example to scale all triangles
71 down into an ellipsoid space. If this pointer is null, no
72 transformation will be done. */
73 virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
74 s32& outTriangleCount, const core::aabbox3d<f32>& box,
75 const core::matrix4* transform=0) const = 0;
76
77 //! Gets the triangles for one associated node which have or may have contact with a 3d line.
78 /**
79 This returns all triangles for one scene node associated with this
80 selector. If there is more than one scene node associated (e.g. for
81 an IMetaTriangleSelector) this this function may be called multiple
82 times to retrieve all triangles.
83
84 Please note that unoptimized triangle selectors also may return
85 triangles which are not in contact at all with the 3d line.
86 \param triangles Array where the resulting triangles will be written
87 to.
88 \param arraySize Size of the target array.
89 \param outTriangleCount Amount of triangles which have been written
90 into the array.
91 \param line Only triangles which may be in contact with this 3d line
92 will be written into the array.
93 \param transform Pointer to matrix for transforming the triangles
94 before they are returned. Useful for example to scale all triangles
95 down into an ellipsoid space. If this pointer is null, no
96 transformation will be done. */
97 virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
98 s32& outTriangleCount, const core::line3d<f32>& line,
99 const core::matrix4* transform=0) const = 0;
100
101 //! Get scene node associated with a given triangle.
102 /**
103 This allows to find which scene node (potentially of several) is
104 associated with a specific triangle.
105
106 \param triangleIndex: the index of the triangle for which you want to find
107 the associated scene node.
108 \return The scene node associated with that triangle.
109 */
110 virtual ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const = 0;
111
112 //! Get number of TriangleSelectors that are part of this one
113 /** Only useful for MetaTriangleSelector, others return 1
114 */
115 virtual u32 getSelectorCount() const = 0;
116
117 //! Get TriangleSelector based on index based on getSelectorCount
118 /** Only useful for MetaTriangleSelector, others return 'this' or 0
119 */
120 virtual ITriangleSelector* getSelector(u32 index) = 0;
121
122 //! Get TriangleSelector based on index based on getSelectorCount
123 /** Only useful for MetaTriangleSelector, others return 'this' or 0
124 */
125 virtual const ITriangleSelector* getSelector(u32 index) const = 0;
126};
127
128} // end namespace scene
129} // end namespace irr
130
131#endif
diff --git a/src/others/irrlicht-1.8.1/include/IVertexBuffer.h b/src/others/irrlicht-1.8.1/include/IVertexBuffer.h
new file mode 100644
index 0000000..87603de
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IVertexBuffer.h
@@ -0,0 +1,52 @@
1// Copyright (C) 2008-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_VERTEX_BUFFER_H_INCLUDED__
6#define __I_VERTEX_BUFFER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrArray.h"
10#include "S3DVertex.h"
11
12namespace irr
13{
14namespace scene
15{
16
17 class IVertexBuffer : public virtual IReferenceCounted
18 {
19 public:
20 virtual void* getData() =0;
21 virtual video::E_VERTEX_TYPE getType() const =0;
22 virtual void setType(video::E_VERTEX_TYPE vertexType) =0;
23 virtual u32 stride() const =0;
24 virtual u32 size() const =0;
25 virtual void push_back(const video::S3DVertex &element) =0;
26 virtual video::S3DVertex& operator [](const u32 index) const =0;
27 virtual video::S3DVertex& getLast() =0;
28 virtual void set_used(u32 usedNow) =0;
29 virtual void reallocate(u32 new_size) =0;
30 virtual u32 allocated_size() const =0;
31 virtual video::S3DVertex* pointer() =0;
32
33 //! get the current hardware mapping hint
34 virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0;
35
36 //! set the hardware mapping hint, for driver
37 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0;
38
39 //! flags the meshbuffer as changed, reloads hardware buffers
40 virtual void setDirty() =0;
41
42 //! Get the currently used ID for identification of changes.
43 /** This shouldn't be used for anything outside the VideoDriver. */
44 virtual u32 getChangedID() const = 0;
45 };
46
47
48} // end namespace scene
49} // end namespace irr
50
51#endif
52
diff --git a/src/others/irrlicht-1.8.1/include/IVideoDriver.h b/src/others/irrlicht-1.8.1/include/IVideoDriver.h
new file mode 100644
index 0000000..8af6607
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IVideoDriver.h
@@ -0,0 +1,1471 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_I_VIDEO_DRIVER_H_INCLUDED__
6#define __IRR_I_VIDEO_DRIVER_H_INCLUDED__
7
8#include "rect.h"
9#include "SColor.h"
10#include "ITexture.h"
11#include "irrArray.h"
12#include "matrix4.h"
13#include "plane3d.h"
14#include "dimension2d.h"
15#include "position2d.h"
16#include "SMaterial.h"
17#include "IMeshBuffer.h"
18#include "triangle3d.h"
19#include "EDriverTypes.h"
20#include "EDriverFeatures.h"
21#include "SExposedVideoData.h"
22
23namespace irr
24{
25namespace io
26{
27 class IAttributes;
28 struct SAttributeReadWriteOptions;
29 class IReadFile;
30 class IWriteFile;
31} // end namespace io
32namespace scene
33{
34 class IMeshBuffer;
35 class IMesh;
36 class IMeshManipulator;
37 class ISceneNode;
38} // end namespace scene
39
40namespace video
41{
42 struct S3DVertex;
43 struct S3DVertex2TCoords;
44 struct S3DVertexTangents;
45 struct SLight;
46 class IImageLoader;
47 class IImageWriter;
48 class IMaterialRenderer;
49 class IGPUProgrammingServices;
50
51 //! enumeration for geometry transformation states
52 enum E_TRANSFORMATION_STATE
53 {
54 //! View transformation
55 ETS_VIEW = 0,
56 //! World transformation
57 ETS_WORLD,
58 //! Projection transformation
59 ETS_PROJECTION,
60 //! Texture transformation
61 ETS_TEXTURE_0,
62 //! Texture transformation
63 ETS_TEXTURE_1,
64 //! Texture transformation
65 ETS_TEXTURE_2,
66 //! Texture transformation
67 ETS_TEXTURE_3,
68#if _IRR_MATERIAL_MAX_TEXTURES_>4
69 //! Texture transformation
70 ETS_TEXTURE_4,
71#if _IRR_MATERIAL_MAX_TEXTURES_>5
72 //! Texture transformation
73 ETS_TEXTURE_5,
74#if _IRR_MATERIAL_MAX_TEXTURES_>6
75 //! Texture transformation
76 ETS_TEXTURE_6,
77#if _IRR_MATERIAL_MAX_TEXTURES_>7
78 //! Texture transformation
79 ETS_TEXTURE_7,
80#endif
81#endif
82#endif
83#endif
84 //! Not used
85 ETS_COUNT
86 };
87
88 //! enumeration for signaling resources which were lost after the last render cycle
89 /** These values can be signaled by the driver, telling the app that some resources
90 were lost and need to be recreated. Irrlicht will sometimes recreate the actual objects,
91 but the content needs to be recreated by the application. */
92 enum E_LOST_RESOURCE
93 {
94 //! The whole device/driver is lost
95 ELR_DEVICE = 1,
96 //! All texture are lost, rare problem
97 ELR_TEXTURES = 2,
98 //! The Render Target Textures are lost, typical problem for D3D
99 ELR_RTTS = 4,
100 //! The HW buffers are lost, will be recreated automatically, but might require some more time this frame
101 ELR_HW_BUFFERS = 8
102 };
103
104 //! Special render targets, which usually map to dedicated hardware
105 /** These render targets (besides 0 and 1) need not be supported by gfx cards */
106 enum E_RENDER_TARGET
107 {
108 //! Render target is the main color frame buffer
109 ERT_FRAME_BUFFER=0,
110 //! Render target is a render texture
111 ERT_RENDER_TEXTURE,
112 //! Multi-Render target textures
113 ERT_MULTI_RENDER_TEXTURES,
114 //! Render target is the main color frame buffer
115 ERT_STEREO_LEFT_BUFFER,
116 //! Render target is the right color buffer (left is the main buffer)
117 ERT_STEREO_RIGHT_BUFFER,
118 //! Render to both stereo buffers at once
119 ERT_STEREO_BOTH_BUFFERS,
120 //! Auxiliary buffer 0
121 ERT_AUX_BUFFER0,
122 //! Auxiliary buffer 1
123 ERT_AUX_BUFFER1,
124 //! Auxiliary buffer 2
125 ERT_AUX_BUFFER2,
126 //! Auxiliary buffer 3
127 ERT_AUX_BUFFER3,
128 //! Auxiliary buffer 4
129 ERT_AUX_BUFFER4
130 };
131
132 //! Enum for the types of fog distributions to choose from
133 enum E_FOG_TYPE
134 {
135 EFT_FOG_EXP=0,
136 EFT_FOG_LINEAR,
137 EFT_FOG_EXP2
138 };
139
140 const c8* const FogTypeNames[] =
141 {
142 "FogExp",
143 "FogLinear",
144 "FogExp2",
145 0
146 };
147
148 struct SOverrideMaterial
149 {
150 //! The Material values
151 SMaterial Material;
152 //! Which values are taken for override
153 /** OR'ed values from E_MATERIAL_FLAGS. */
154 u32 EnableFlags;
155 //! Set in which render passes the material override is active.
156 /** OR'ed values from E_SCENE_NODE_RENDER_PASS. */
157 u16 EnablePasses;
158 //! Global enable flag, overwritten by the SceneManager in each pass
159 /** The Scenemanager uses the EnablePass array and sets Enabled to
160 true if the Override material is enabled in the current pass. */
161 bool Enabled;
162
163 //! Default constructor
164 SOverrideMaterial() : EnableFlags(0), EnablePasses(0), Enabled(false) {}
165
166 //! Apply the enabled overrides
167 void apply(SMaterial& material)
168 {
169 if (Enabled)
170 {
171 for (u32 i=0; i<32; ++i)
172 {
173 const u32 num=(1<<i);
174 if (EnableFlags & num)
175 {
176 switch (num)
177 {
178 case EMF_WIREFRAME: material.Wireframe = Material.Wireframe; break;
179 case EMF_POINTCLOUD: material.PointCloud = Material.PointCloud; break;
180 case EMF_GOURAUD_SHADING: material.GouraudShading = Material.GouraudShading; break;
181 case EMF_LIGHTING: material.Lighting = Material.Lighting; break;
182 case EMF_ZBUFFER: material.ZBuffer = Material.ZBuffer; break;
183 case EMF_ZWRITE_ENABLE: material.ZWriteEnable = Material.ZWriteEnable; break;
184 case EMF_BACK_FACE_CULLING: material.BackfaceCulling = Material.BackfaceCulling; break;
185 case EMF_FRONT_FACE_CULLING: material.FrontfaceCulling = Material.FrontfaceCulling; break;
186 case EMF_BILINEAR_FILTER: material.TextureLayer[0].BilinearFilter = Material.TextureLayer[0].BilinearFilter; break;
187 case EMF_TRILINEAR_FILTER: material.TextureLayer[0].TrilinearFilter = Material.TextureLayer[0].TrilinearFilter; break;
188 case EMF_ANISOTROPIC_FILTER: material.TextureLayer[0].AnisotropicFilter = Material.TextureLayer[0].AnisotropicFilter; break;
189 case EMF_FOG_ENABLE: material.FogEnable = Material.FogEnable; break;
190 case EMF_NORMALIZE_NORMALS: material.NormalizeNormals = Material.NormalizeNormals; break;
191 case EMF_TEXTURE_WRAP:
192 material.TextureLayer[0].TextureWrapU = Material.TextureLayer[0].TextureWrapU;
193 material.TextureLayer[0].TextureWrapV = Material.TextureLayer[0].TextureWrapV;
194 break;
195 case EMF_ANTI_ALIASING: material.AntiAliasing = Material.AntiAliasing; break;
196 case EMF_COLOR_MASK: material.ColorMask = Material.ColorMask; break;
197 case EMF_COLOR_MATERIAL: material.ColorMaterial = Material.ColorMaterial; break;
198 case EMF_USE_MIP_MAPS: material.UseMipMaps = Material.UseMipMaps; break;
199 case EMF_BLEND_OPERATION: material.BlendOperation = Material.BlendOperation; break;
200 case EMF_POLYGON_OFFSET:
201 material.PolygonOffsetDirection = Material.PolygonOffsetDirection;
202 material.PolygonOffsetFactor = Material.PolygonOffsetFactor; break;
203 }
204 }
205 }
206 }
207 }
208
209 };
210
211 struct IRenderTarget
212 {
213 IRenderTarget(ITexture* texture,
214 E_COLOR_PLANE colorMask=ECP_ALL,
215 E_BLEND_FACTOR blendFuncSrc=EBF_ONE,
216 E_BLEND_FACTOR blendFuncDst=EBF_ONE_MINUS_SRC_ALPHA,
217 E_BLEND_OPERATION blendOp=EBO_NONE) :
218 RenderTexture(texture),
219 TargetType(ERT_RENDER_TEXTURE), ColorMask(colorMask),
220 BlendFuncSrc(blendFuncSrc), BlendFuncDst(blendFuncDst),
221 BlendOp(blendOp) {}
222 IRenderTarget(E_RENDER_TARGET target,
223 E_COLOR_PLANE colorMask=ECP_ALL,
224 E_BLEND_FACTOR blendFuncSrc=EBF_ONE,
225 E_BLEND_FACTOR blendFuncDst=EBF_ONE_MINUS_SRC_ALPHA,
226 E_BLEND_OPERATION blendOp=EBO_NONE) :
227 RenderTexture(0),
228 TargetType(target), ColorMask(colorMask),
229 BlendFuncSrc(blendFuncSrc), BlendFuncDst(blendFuncDst),
230 BlendOp(blendOp) {}
231 bool operator!=(const IRenderTarget& other) const
232 {
233 return ((RenderTexture != other.RenderTexture) ||
234 (TargetType != other.TargetType) ||
235 (ColorMask != other.ColorMask) ||
236 (BlendFuncSrc != other.BlendFuncSrc) ||
237 (BlendFuncDst != other.BlendFuncDst) ||
238 (BlendOp != other.BlendOp));
239 }
240 ITexture* RenderTexture;
241 E_RENDER_TARGET TargetType:8;
242 E_COLOR_PLANE ColorMask:8;
243 E_BLEND_FACTOR BlendFuncSrc:4;
244 E_BLEND_FACTOR BlendFuncDst:4;
245 E_BLEND_OPERATION BlendOp:4;
246 };
247
248 //! Interface to driver which is able to perform 2d and 3d graphics functions.
249 /** This interface is one of the most important interfaces of
250 the Irrlicht Engine: All rendering and texture manipulation is done with
251 this interface. You are able to use the Irrlicht Engine by only
252 invoking methods of this interface if you like to, although the
253 irr::scene::ISceneManager interface provides a lot of powerful classes
254 and methods to make the programmer's life easier.
255 */
256 class IVideoDriver : public virtual IReferenceCounted
257 {
258 public:
259
260 //! Applications must call this method before performing any rendering.
261 /** This method can clear the back- and the z-buffer.
262 \param backBuffer Specifies if the back buffer should be
263 cleared, which means that the screen is filled with the color
264 specified. If this parameter is false, the back buffer will
265 not be cleared and the color parameter is ignored.
266 \param zBuffer Specifies if the depth buffer (z buffer) should
267 be cleared. It is not nesesarry to do so if only 2d drawing is
268 used.
269 \param color The color used for back buffer clearing
270 \param videoData Handle of another window, if you want the
271 bitmap to be displayed on another window. If this is an empty
272 element, everything will be displayed in the default window.
273 Note: This feature is not fully implemented for all devices.
274 \param sourceRect Pointer to a rectangle defining the source
275 rectangle of the area to be presented. Set to null to present
276 everything. Note: not implemented in all devices.
277 \return False if failed. */
278 virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
279 SColor color=SColor(255,0,0,0),
280 const SExposedVideoData& videoData=SExposedVideoData(),
281 core::rect<s32>* sourceRect=0) =0;
282
283 //! Presents the rendered image to the screen.
284 /** Applications must call this method after performing any
285 rendering.
286 \return False if failed and true if succeeded. */
287 virtual bool endScene() =0;
288
289 //! Queries the features of the driver.
290 /** Returns true if a feature is available
291 \param feature Feature to query.
292 \return True if the feature is available, false if not. */
293 virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const =0;
294
295 //! Disable a feature of the driver.
296 /** Can also be used to enable the features again. It is not
297 possible to enable unsupported features this way, though.
298 \param feature Feature to disable.
299 \param flag When true the feature is disabled, otherwise it is enabled. */
300 virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag=true) =0;
301
302 //! Get attributes of the actual video driver
303 /** The following names can be queried for the given types:
304 MaxTextures (int) The maximum number of simultaneous textures supported by the driver. This can be less than the supported number of textures of the driver. Use _IRR_MATERIAL_MAX_TEXTURES_ to adapt the number.
305 MaxSupportedTextures (int) The maximum number of simultaneous textures supported by the fixed function pipeline of the (hw) driver. The actual supported number of textures supported by the engine can be lower.
306 MaxLights (int) Number of hardware lights supported in the fixed function pipieline of the driver, typically 6-8. Use light manager or deferred shading for more.
307 MaxAnisotropy (int) Number of anisotropy levels supported for filtering. At least 1, max is typically at 16 or 32.
308 MaxUserClipPlanes (int) Number of additional clip planes, which can be set by the user via dedicated driver methods.
309 MaxAuxBuffers (int) Special render buffers, which are currently not really usable inside Irrlicht. Only supported by OpenGL
310 MaxMultipleRenderTargets (int) Number of render targets which can be bound simultaneously. Rendering to MRTs is done via shaders.
311 MaxIndices (int) Number of indices which can be used in one render call (i.e. one mesh buffer).
312 MaxTextureSize (int) Dimension that a texture may have, both in width and height.
313 MaxGeometryVerticesOut (int) Number of vertices the geometry shader can output in one pass. Only OpenGL so far.
314 MaxTextureLODBias (float) Maximum value for LOD bias. Is usually at around 16, but can be lower on some systems.
315 Version (int) Version of the driver. Should be Major*100+Minor
316 ShaderLanguageVersion (int) Version of the high level shader language. Should be Major*100+Minor.
317 AntiAlias (int) Number of Samples the driver uses for each pixel. 0 and 1 means anti aliasing is off, typical values are 2,4,8,16,32
318 */
319 virtual const io::IAttributes& getDriverAttributes() const=0;
320
321 //! Check if the driver was recently reset.
322 /** For d3d devices you will need to recreate the RTTs if the
323 driver was reset. Should be queried right after beginScene().
324 */
325 virtual bool checkDriverReset() =0;
326
327 //! Sets transformation matrices.
328 /** \param state Transformation type to be set, e.g. view,
329 world, or projection.
330 \param mat Matrix describing the transformation. */
331 virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) =0;
332
333 //! Returns the transformation set by setTransform
334 /** \param state Transformation type to query
335 \return Matrix describing the transformation. */
336 virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const =0;
337
338 //! Retrieve the number of image loaders
339 /** \return Number of image loaders */
340 virtual u32 getImageLoaderCount() const = 0;
341
342 //! Retrieve the given image loader
343 /** \param n The index of the loader to retrieve. This parameter is an 0-based
344 array index.
345 \return A pointer to the specified loader, 0 if the index is incorrect. */
346 virtual IImageLoader* getImageLoader(u32 n) = 0;
347
348 //! Retrieve the number of image writers
349 /** \return Number of image writers */
350 virtual u32 getImageWriterCount() const = 0;
351
352 //! Retrieve the given image writer
353 /** \param n The index of the writer to retrieve. This parameter is an 0-based
354 array index.
355 \return A pointer to the specified writer, 0 if the index is incorrect. */
356 virtual IImageWriter* getImageWriter(u32 n) = 0;
357
358 //! Sets a material.
359 /** All 3d drawing functions will draw geometry using this material thereafter.
360 \param material: Material to be used from now on. */
361 virtual void setMaterial(const SMaterial& material) =0;
362
363 //! Get access to a named texture.
364 /** Loads the texture from disk if it is not
365 already loaded and generates mipmap levels if desired.
366 Texture loading can be influenced using the
367 setTextureCreationFlag() method. The texture can be in several
368 imageformats, such as BMP, JPG, TGA, PCX, PNG, and PSD.
369 \param filename Filename of the texture to be loaded.
370 \return Pointer to the texture, or 0 if the texture
371 could not be loaded. This pointer should not be dropped. See
372 IReferenceCounted::drop() for more information. */
373 virtual ITexture* getTexture(const io::path& filename) = 0;
374
375 //! Get access to a named texture.
376 /** Loads the texture from disk if it is not
377 already loaded and generates mipmap levels if desired.
378 Texture loading can be influenced using the
379 setTextureCreationFlag() method. The texture can be in several
380 imageformats, such as BMP, JPG, TGA, PCX, PNG, and PSD.
381 \param file Pointer to an already opened file.
382 \return Pointer to the texture, or 0 if the texture
383 could not be loaded. This pointer should not be dropped. See
384 IReferenceCounted::drop() for more information. */
385 virtual ITexture* getTexture(io::IReadFile* file) =0;
386
387 //! Returns a texture by index
388 /** \param index: Index of the texture, must be smaller than
389 getTextureCount() Please note that this index might change when
390 adding or removing textures
391 \return Pointer to the texture, or 0 if the texture was not
392 set or index is out of bounds. This pointer should not be
393 dropped. See IReferenceCounted::drop() for more information. */
394 virtual ITexture* getTextureByIndex(u32 index) =0;
395
396 //! Returns amount of textures currently loaded
397 /** \return Amount of textures currently loaded */
398 virtual u32 getTextureCount() const = 0;
399
400 //! Renames a texture
401 /** \param texture Pointer to the texture to rename.
402 \param newName New name for the texture. This should be a unique name. */
403 virtual void renameTexture(ITexture* texture, const io::path& newName) = 0;
404
405 //! Creates an empty texture of specified size.
406 /** \param size: Size of the texture.
407 \param name A name for the texture. Later calls to
408 getTexture() with this name will return this texture
409 \param format Desired color format of the texture. Please note
410 that the driver may choose to create the texture in another
411 color format.
412 \return Pointer to the newly created texture. This pointer
413 should not be dropped. See IReferenceCounted::drop() for more
414 information. */
415 virtual ITexture* addTexture(const core::dimension2d<u32>& size,
416 const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;
417
418 //! Creates a texture from an IImage.
419 /** \param name A name for the texture. Later calls of
420 getTexture() with this name will return this texture
421 \param image Image the texture is created from.
422 \param mipmapData Optional pointer to a set of images which
423 build up the whole mipmap set. Must be images of the same color
424 type as image. If this parameter is not given, the mipmaps are
425 derived from image.
426 \return Pointer to the newly created texture. This pointer
427 should not be dropped. See IReferenceCounted::drop() for more
428 information. */
429 virtual ITexture* addTexture(const io::path& name, IImage* image, void* mipmapData=0) = 0;
430
431 //! Adds a new render target texture to the texture cache.
432 /** \param size Size of the texture, in pixels. Width and
433 height should be a power of two (e.g. 64, 128, 256, 512, ...)
434 and it should not be bigger than the backbuffer, because it
435 shares the zbuffer with the screen buffer.
436 \param name An optional name for the RTT.
437 \param format The color format of the render target. Floating point formats are supported.
438 \return Pointer to the created texture or 0 if the texture
439 could not be created. This pointer should not be dropped. See
440 IReferenceCounted::drop() for more information. */
441 virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
442 const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;
443
444 //! Removes a texture from the texture cache and deletes it.
445 /** This method can free a lot of memory!
446 Please note that after calling this, the pointer to the
447 ITexture may no longer be valid, if it was not grabbed before
448 by other parts of the engine for storing it longer. So it is a
449 good idea to set all materials which are using this texture to
450 0 or another texture first.
451 \param texture Texture to delete from the engine cache. */
452 virtual void removeTexture(ITexture* texture) =0;
453
454 //! Removes all textures from the texture cache and deletes them.
455 /** This method can free a lot of memory!
456 Please note that after calling this, the pointer to the
457 ITexture may no longer be valid, if it was not grabbed before
458 by other parts of the engine for storing it longer. So it is a
459 good idea to set all materials which are using this texture to
460 0 or another texture first. */
461 virtual void removeAllTextures() =0;
462
463 //! Remove hardware buffer
464 virtual void removeHardwareBuffer(const scene::IMeshBuffer* mb) =0;
465
466 //! Remove all hardware buffers
467 virtual void removeAllHardwareBuffers() =0;
468
469 //! Create occlusion query.
470 /** Use node for identification and mesh for occlusion test. */
471 virtual void addOcclusionQuery(scene::ISceneNode* node,
472 const scene::IMesh* mesh=0) =0;
473
474 //! Remove occlusion query.
475 virtual void removeOcclusionQuery(scene::ISceneNode* node) =0;
476
477 //! Remove all occlusion queries.
478 virtual void removeAllOcclusionQueries() =0;
479
480 //! Run occlusion query. Draws mesh stored in query.
481 /** If the mesh shall not be rendered visible, use
482 overrideMaterial to disable the color and depth buffer. */
483 virtual void runOcclusionQuery(scene::ISceneNode* node, bool visible=false) =0;
484
485 //! Run all occlusion queries. Draws all meshes stored in queries.
486 /** If the meshes shall not be rendered visible, use
487 overrideMaterial to disable the color and depth buffer. */
488 virtual void runAllOcclusionQueries(bool visible=false) =0;
489
490 //! Update occlusion query. Retrieves results from GPU.
491 /** If the query shall not block, set the flag to false.
492 Update might not occur in this case, though */
493 virtual void updateOcclusionQuery(scene::ISceneNode* node, bool block=true) =0;
494
495 //! Update all occlusion queries. Retrieves results from GPU.
496 /** If the query shall not block, set the flag to false.
497 Update might not occur in this case, though */
498 virtual void updateAllOcclusionQueries(bool block=true) =0;
499
500 //! Return query result.
501 /** Return value is the number of visible pixels/fragments.
502 The value is a safe approximation, i.e. can be larger than the
503 actual value of pixels. */
504 virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const =0;
505
506 //! Sets a boolean alpha channel on the texture based on a color key.
507 /** This makes the texture fully transparent at the texels where
508 this color key can be found when using for example draw2DImage
509 with useAlphachannel==true. The alpha of other texels is not modified.
510 \param texture Texture whose alpha channel is modified.
511 \param color Color key color. Every texel with this color will
512 become fully transparent as described above. Please note that the
513 colors of a texture may be converted when loading it, so the
514 color values may not be exactly the same in the engine and for
515 example in picture edit programs. To avoid this problem, you
516 could use the makeColorKeyTexture method, which takes the
517 position of a pixel instead a color value.
518 \param zeroTexels \deprecated If set to true, then any texels that match
519 the color key will have their color, as well as their alpha, set to zero
520 (i.e. black). This behavior matches the legacy (buggy) behavior prior
521 to release 1.5 and is provided for backwards compatibility only.
522 This parameter may be removed by Irrlicht 1.9. */
523 virtual void makeColorKeyTexture(video::ITexture* texture,
524 video::SColor color,
525 bool zeroTexels = false) const =0;
526
527 //! Sets a boolean alpha channel on the texture based on the color at a position.
528 /** This makes the texture fully transparent at the texels where
529 the color key can be found when using for example draw2DImage
530 with useAlphachannel==true. The alpha of other texels is not modified.
531 \param texture Texture whose alpha channel is modified.
532 \param colorKeyPixelPos Position of a pixel with the color key
533 color. Every texel with this color will become fully transparent as
534 described above.
535 \param zeroTexels \deprecated If set to true, then any texels that match
536 the color key will have their color, as well as their alpha, set to zero
537 (i.e. black). This behavior matches the legacy (buggy) behavior prior
538 to release 1.5 and is provided for backwards compatibility only.
539 This parameter may be removed by Irrlicht 1.9. */
540 virtual void makeColorKeyTexture(video::ITexture* texture,
541 core::position2d<s32> colorKeyPixelPos,
542 bool zeroTexels = false) const =0;
543
544 //! Creates a normal map from a height map texture.
545 /** If the target texture has 32 bit, the height value is
546 stored in the alpha component of the texture as addition. This
547 value is used by the video::EMT_PARALLAX_MAP_SOLID material and
548 similar materials.
549 \param texture Texture whose alpha channel is modified.
550 \param amplitude Constant value by which the height
551 information is multiplied.*/
552 virtual void makeNormalMapTexture(video::ITexture* texture, f32 amplitude=1.0f) const =0;
553
554 //! Sets a new render target.
555 /** This will only work if the driver supports the
556 EVDF_RENDER_TO_TARGET feature, which can be queried with
557 queryFeature(). Usually, rendering to textures is done in this
558 way:
559 \code
560 // create render target
561 ITexture* target = driver->addRenderTargetTexture(core::dimension2d<u32>(128,128), "rtt1");
562
563 // ...
564
565 driver->setRenderTarget(target); // set render target
566 // .. draw stuff here
567 driver->setRenderTarget(0); // set previous render target
568 \endcode
569 Please note that you cannot render 3D or 2D geometry with a
570 render target as texture on it when you are rendering the scene
571 into this render target at the same time. It is usually only
572 possible to render into a texture between the
573 IVideoDriver::beginScene() and endScene() method calls.
574 \param texture New render target. Must be a texture created with
575 IVideoDriver::addRenderTargetTexture(). If set to 0, it sets
576 the previous render target which was set before the last
577 setRenderTarget() call.
578 \param clearBackBuffer Clears the backbuffer of the render
579 target with the color parameter
580 \param clearZBuffer Clears the zBuffer of the rendertarget.
581 Note that because the frame buffer may share the zbuffer with
582 the rendertarget, its zbuffer might be partially cleared too
583 by this.
584 \param color The background color for the render target.
585 \return True if sucessful and false if not. */
586 virtual bool setRenderTarget(video::ITexture* texture,
587 bool clearBackBuffer=true, bool clearZBuffer=true,
588 SColor color=video::SColor(0,0,0,0)) =0;
589
590 //! set or reset special render targets
591 /** This method enables access to special color buffers such as
592 stereoscopic buffers or auxiliary buffers.
593 \param target Enum value for the render target
594 \param clearTarget Clears the target buffer with the color
595 parameter
596 \param clearZBuffer Clears the zBuffer of the rendertarget.
597 Note that because the main frame buffer may share the zbuffer with
598 the rendertarget, its zbuffer might be partially cleared too
599 by this.
600 \param color The background color for the render target.
601 \return True if sucessful and false if not. */
602 virtual bool setRenderTarget(E_RENDER_TARGET target, bool clearTarget=true,
603 bool clearZBuffer=true,
604 SColor color=video::SColor(0,0,0,0)) =0;
605
606 //! Sets new multiple render targets.
607 virtual bool setRenderTarget(const core::array<video::IRenderTarget>& texture,
608 bool clearBackBuffer=true, bool clearZBuffer=true,
609 SColor color=video::SColor(0,0,0,0)) =0;
610
611 //! Sets a new viewport.
612 /** Every rendering operation is done into this new area.
613 \param area: Rectangle defining the new area of rendering
614 operations. */
615 virtual void setViewPort(const core::rect<s32>& area) =0;
616
617 //! Gets the area of the current viewport.
618 /** \return Rectangle of the current viewport. */
619 virtual const core::rect<s32>& getViewPort() const =0;
620
621 //! Draws a vertex primitive list
622 /** Note that, depending on the index type, some vertices might be not
623 accessible through the index list. The limit is at 65535 vertices for 16bit
624 indices. Please note that currently not all primitives are available for
625 all drivers, and some might be emulated via triangle renders.
626 \param vertices Pointer to array of vertices.
627 \param vertexCount Amount of vertices in the array.
628 \param indexList Pointer to array of indices. These define the vertices used
629 for each primitive. Depending on the pType, indices are interpreted as single
630 objects (for point like primitives), pairs (for lines), triplets (for
631 triangles), or quads.
632 \param primCount Amount of Primitives
633 \param vType Vertex type, e.g. video::EVT_STANDARD for S3DVertex.
634 \param pType Primitive type, e.g. scene::EPT_TRIANGLE_FAN for a triangle fan.
635 \param iType Index type, e.g. video::EIT_16BIT for 16bit indices. */
636 virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
637 const void* indexList, u32 primCount,
638 E_VERTEX_TYPE vType=EVT_STANDARD,
639 scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES,
640 E_INDEX_TYPE iType=EIT_16BIT) =0;
641
642 //! Draws a vertex primitive list in 2d
643 /** Compared to the general (3d) version of this method, this
644 one sets up a 2d render mode, and uses only x and y of vectors.
645 Note that, depending on the index type, some vertices might be
646 not accessible through the index list. The limit is at 65535
647 vertices for 16bit indices. Please note that currently not all
648 primitives are available for all drivers, and some might be
649 emulated via triangle renders. This function is not available
650 for the sw drivers.
651 \param vertices Pointer to array of vertices.
652 \param vertexCount Amount of vertices in the array.
653 \param indexList Pointer to array of indices. These define the
654 vertices used for each primitive. Depending on the pType,
655 indices are interpreted as single objects (for point like
656 primitives), pairs (for lines), triplets (for triangles), or
657 quads.
658 \param primCount Amount of Primitives
659 \param vType Vertex type, e.g. video::EVT_STANDARD for S3DVertex.
660 \param pType Primitive type, e.g. scene::EPT_TRIANGLE_FAN for a triangle fan.
661 \param iType Index type, e.g. video::EIT_16BIT for 16bit indices. */
662 virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount,
663 const void* indexList, u32 primCount,
664 E_VERTEX_TYPE vType=EVT_STANDARD,
665 scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES,
666 E_INDEX_TYPE iType=EIT_16BIT) =0;
667
668 //! Draws an indexed triangle list.
669 /** Note that there may be at maximum 65536 vertices, because
670 the index list is an array of 16 bit values each with a maximum
671 value of 65536. If there are more than 65536 vertices in the
672 list, results of this operation are not defined.
673 \param vertices Pointer to array of vertices.
674 \param vertexCount Amount of vertices in the array.
675 \param indexList Pointer to array of indices.
676 \param triangleCount Amount of Triangles. Usually amount of indices / 3. */
677 void drawIndexedTriangleList(const S3DVertex* vertices,
678 u32 vertexCount, const u16* indexList, u32 triangleCount)
679 {
680 drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);
681 }
682
683 //! Draws an indexed triangle list.
684 /** Note that there may be at maximum 65536 vertices, because
685 the index list is an array of 16 bit values each with a maximum
686 value of 65536. If there are more than 65536 vertices in the
687 list, results of this operation are not defined.
688 \param vertices Pointer to array of vertices.
689 \param vertexCount Amount of vertices in the array.
690 \param indexList Pointer to array of indices.
691 \param triangleCount Amount of Triangles. Usually amount of indices / 3. */
692 void drawIndexedTriangleList(const S3DVertex2TCoords* vertices,
693 u32 vertexCount, const u16* indexList, u32 triangleCount)
694 {
695 drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLES, EIT_16BIT);
696 }
697
698 //! Draws an indexed triangle list.
699 /** Note that there may be at maximum 65536 vertices, because
700 the index list is an array of 16 bit values each with a maximum
701 value of 65536. If there are more than 65536 vertices in the
702 list, results of this operation are not defined.
703 \param vertices Pointer to array of vertices.
704 \param vertexCount Amount of vertices in the array.
705 \param indexList Pointer to array of indices.
706 \param triangleCount Amount of Triangles. Usually amount of indices / 3. */
707 void drawIndexedTriangleList(const S3DVertexTangents* vertices,
708 u32 vertexCount, const u16* indexList, u32 triangleCount)
709 {
710 drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLES, EIT_16BIT);
711 }
712
713 //! Draws an indexed triangle fan.
714 /** Note that there may be at maximum 65536 vertices, because
715 the index list is an array of 16 bit values each with a maximum
716 value of 65536. If there are more than 65536 vertices in the
717 list, results of this operation are not defined.
718 \param vertices Pointer to array of vertices.
719 \param vertexCount Amount of vertices in the array.
720 \param indexList Pointer to array of indices.
721 \param triangleCount Amount of Triangles. Usually amount of indices - 2. */
722 void drawIndexedTriangleFan(const S3DVertex* vertices,
723 u32 vertexCount, const u16* indexList, u32 triangleCount)
724 {
725 drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
726 }
727
728 //! Draws an indexed triangle fan.
729 /** Note that there may be at maximum 65536 vertices, because
730 the index list is an array of 16 bit values each with a maximum
731 value of 65536. If there are more than 65536 vertices in the
732 list, results of this operation are not defined.
733 \param vertices Pointer to array of vertices.
734 \param vertexCount Amount of vertices in the array.
735 \param indexList Pointer to array of indices.
736 \param triangleCount Amount of Triangles. Usually amount of indices - 2. */
737 void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
738 u32 vertexCount, const u16* indexList, u32 triangleCount)
739 {
740 drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
741 }
742
743 //! Draws an indexed triangle fan.
744 /** Note that there may be at maximum 65536 vertices, because
745 the index list is an array of 16 bit values each with a maximum
746 value of 65536. If there are more than 65536 vertices in the
747 list, results of this operation are not defined.
748 \param vertices Pointer to array of vertices.
749 \param vertexCount Amount of vertices in the array.
750 \param indexList Pointer to array of indices.
751 \param triangleCount Amount of Triangles. Usually amount of indices - 2. */
752 void drawIndexedTriangleFan(const S3DVertexTangents* vertices,
753 u32 vertexCount, const u16* indexList, u32 triangleCount)
754 {
755 drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
756 }
757
758 //! Draws a 3d line.
759 /** For some implementations, this method simply calls
760 drawVertexPrimitiveList for some triangles.
761 Note that the line is drawn using the current transformation
762 matrix and material. So if you need to draw the 3D line
763 independently of the current transformation, use
764 \code
765 driver->setMaterial(someMaterial);
766 driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
767 \endcode
768 for some properly set up material before drawing the line.
769 Some drivers support line thickness set in the material.
770 \param start Start of the 3d line.
771 \param end End of the 3d line.
772 \param color Color of the line. */
773 virtual void draw3DLine(const core::vector3df& start,
774 const core::vector3df& end, SColor color = SColor(255,255,255,255)) =0;
775
776 //! Draws a 3d triangle.
777 /** This method calls drawVertexPrimitiveList for some triangles.
778 This method works with all drivers because it simply calls
779 drawVertexPrimitiveList, but it is hence not very fast.
780 Note that the triangle is drawn using the current
781 transformation matrix and material. So if you need to draw it
782 independently of the current transformation, use
783 \code
784 driver->setMaterial(someMaterial);
785 driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
786 \endcode
787 for some properly set up material before drawing the triangle.
788 \param triangle The triangle to draw.
789 \param color Color of the line. */
790 virtual void draw3DTriangle(const core::triangle3df& triangle,
791 SColor color = SColor(255,255,255,255)) =0;
792
793 //! Draws a 3d axis aligned box.
794 /** This method simply calls draw3DLine for the edges of the
795 box. Note that the box is drawn using the current transformation
796 matrix and material. So if you need to draw it independently of
797 the current transformation, use
798 \code
799 driver->setMaterial(someMaterial);
800 driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
801 \endcode
802 for some properly set up material before drawing the box.
803 \param box The axis aligned box to draw
804 \param color Color to use while drawing the box. */
805 virtual void draw3DBox(const core::aabbox3d<f32>& box,
806 SColor color = SColor(255,255,255,255)) =0;
807
808 //! Draws a 2d image without any special effects
809 /** \param texture Pointer to texture to use.
810 \param destPos Upper left 2d destination position where the
811 image will be drawn. */
812 virtual void draw2DImage(const video::ITexture* texture,
813 const core::position2d<s32>& destPos) =0;
814
815 //! Draws a 2d image using a color
816 /** (if color is other than
817 Color(255,255,255,255)) and the alpha channel of the texture.
818 \param texture Texture to be drawn.
819 \param destPos Upper left 2d destination position where the
820 image will be drawn.
821 \param sourceRect Source rectangle in the image.
822 \param clipRect Pointer to rectangle on the screen where the
823 image is clipped to.
824 If this pointer is NULL the image is not clipped.
825 \param color Color with which the image is drawn. If the color
826 equals Color(255,255,255,255) it is ignored. Note that the
827 alpha component is used: If alpha is other than 255, the image
828 will be transparent.
829 \param useAlphaChannelOfTexture: If true, the alpha channel of
830 the texture is used to draw the image.*/
831 virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
832 const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0,
833 SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false) =0;
834
835 //! Draws a set of 2d images, using a color and the alpha channel of the texture.
836 /** The images are drawn beginning at pos and concatenated in
837 one line. All drawings are clipped against clipRect (if != 0).
838 The subtextures are defined by the array of sourceRects and are
839 chosen by the indices given.
840 \param texture Texture to be drawn.
841 \param pos Upper left 2d destination position where the image
842 will be drawn.
843 \param sourceRects Source rectangles of the image.
844 \param indices List of indices which choose the actual
845 rectangle used each time.
846 \param kerningWidth Offset to Position on X
847 \param clipRect Pointer to rectangle on the screen where the
848 image is clipped to.
849 If this pointer is 0 then the image is not clipped.
850 \param color Color with which the image is drawn.
851 Note that the alpha component is used. If alpha is other than
852 255, the image will be transparent.
853 \param useAlphaChannelOfTexture: If true, the alpha channel of
854 the texture is used to draw the image. */
855 virtual void draw2DImageBatch(const video::ITexture* texture,
856 const core::position2d<s32>& pos,
857 const core::array<core::rect<s32> >& sourceRects,
858 const core::array<s32>& indices,
859 s32 kerningWidth=0,
860 const core::rect<s32>* clipRect=0,
861 SColor color=SColor(255,255,255,255),
862 bool useAlphaChannelOfTexture=false) =0;
863
864 //! Draws a set of 2d images, using a color and the alpha channel of the texture.
865 /** All drawings are clipped against clipRect (if != 0).
866 The subtextures are defined by the array of sourceRects and are
867 positioned using the array of positions.
868 \param texture Texture to be drawn.
869 \param positions Array of upper left 2d destinations where the
870 images will be drawn.
871 \param sourceRects Source rectangles of the image.
872 \param clipRect Pointer to rectangle on the screen where the
873 images are clipped to.
874 If this pointer is 0 then the image is not clipped.
875 \param color Color with which the image is drawn.
876 Note that the alpha component is used. If alpha is other than
877 255, the image will be transparent.
878 \param useAlphaChannelOfTexture: If true, the alpha channel of
879 the texture is used to draw the image. */
880 virtual void draw2DImageBatch(const video::ITexture* texture,
881 const core::array<core::position2d<s32> >& positions,
882 const core::array<core::rect<s32> >& sourceRects,
883 const core::rect<s32>* clipRect=0,
884 SColor color=SColor(255,255,255,255),
885 bool useAlphaChannelOfTexture=false) =0;
886
887 //! Draws a part of the texture into the rectangle. Note that colors must be an array of 4 colors if used.
888 /** Suggested and first implemented by zola.
889 \param texture The texture to draw from
890 \param destRect The rectangle to draw into
891 \param sourceRect The rectangle denoting a part of the texture
892 \param clipRect Clips the destination rectangle (may be 0)
893 \param colors Array of 4 colors denoting the color values of
894 the corners of the destRect
895 \param useAlphaChannelOfTexture True if alpha channel will be
896 blended. */
897 virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
898 const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0,
899 const video::SColor * const colors=0, bool useAlphaChannelOfTexture=false) =0;
900
901 //! Draws a 2d rectangle.
902 /** \param color Color of the rectangle to draw. The alpha
903 component will not be ignored and specifies how transparent the
904 rectangle will be.
905 \param pos Position of the rectangle.
906 \param clip Pointer to rectangle against which the rectangle
907 will be clipped. If the pointer is null, no clipping will be
908 performed. */
909 virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,
910 const core::rect<s32>* clip =0) =0;
911
912 //! Draws a 2d rectangle with a gradient.
913 /** \param colorLeftUp Color of the upper left corner to draw.
914 The alpha component will not be ignored and specifies how
915 transparent the rectangle will be.
916 \param colorRightUp Color of the upper right corner to draw.
917 The alpha component will not be ignored and specifies how
918 transparent the rectangle will be.
919 \param colorLeftDown Color of the lower left corner to draw.
920 The alpha component will not be ignored and specifies how
921 transparent the rectangle will be.
922 \param colorRightDown Color of the lower right corner to draw.
923 The alpha component will not be ignored and specifies how
924 transparent the rectangle will be.
925 \param pos Position of the rectangle.
926 \param clip Pointer to rectangle against which the rectangle
927 will be clipped. If the pointer is null, no clipping will be
928 performed. */
929 virtual void draw2DRectangle(const core::rect<s32>& pos,
930 SColor colorLeftUp, SColor colorRightUp,
931 SColor colorLeftDown, SColor colorRightDown,
932 const core::rect<s32>* clip =0) =0;
933
934 //! Draws the outline of a 2D rectangle.
935 /** \param pos Position of the rectangle.
936 \param color Color of the rectangle to draw. The alpha component
937 specifies how transparent the rectangle outline will be. */
938 virtual void draw2DRectangleOutline(const core::recti& pos,
939 SColor color=SColor(255,255,255,255)) =0;
940
941 //! Draws a 2d line. Both start and end will be included in coloring.
942 /** \param start Screen coordinates of the start of the line
943 in pixels.
944 \param end Screen coordinates of the start of the line in
945 pixels.
946 \param color Color of the line to draw. */
947 virtual void draw2DLine(const core::position2d<s32>& start,
948 const core::position2d<s32>& end,
949 SColor color=SColor(255,255,255,255)) =0;
950
951 //! Draws a pixel.
952 /** \param x The x-position of the pixel.
953 \param y The y-position of the pixel.
954 \param color Color of the pixel to draw. */
955 virtual void drawPixel(u32 x, u32 y, const SColor& color) =0;
956
957 //! Draws a non filled concyclic regular 2d polyon.
958 /** This method can be used to draw circles, but also
959 triangles, tetragons, pentagons, hexagons, heptagons, octagons,
960 enneagons, decagons, hendecagons, dodecagon, triskaidecagons,
961 etc. I think you'll got it now. And all this by simply
962 specifying the vertex count. Welcome to the wonders of
963 geometry.
964 \param center Position of center of circle (pixels).
965 \param radius Radius of circle in pixels.
966 \param color Color of the circle.
967 \param vertexCount Amount of vertices of the polygon. Specify 2
968 to draw a line, 3 to draw a triangle, 4 for tetragons and a lot
969 (>10) for nearly a circle. */
970 virtual void draw2DPolygon(core::position2d<s32> center,
971 f32 radius,
972 video::SColor color=SColor(100,255,255,255),
973 s32 vertexCount=10) =0;
974
975 //! Draws a shadow volume into the stencil buffer.
976 /** To draw a stencil shadow, do this: First, draw all geometry.
977 Then use this method, to draw the shadow volume. Then, use
978 IVideoDriver::drawStencilShadow() to visualize the shadow.
979 Please note that the code for the opengl version of the method
980 is based on free code sent in by Philipp Dortmann, lots of
981 thanks go to him!
982 \param triangles Array of 3d vectors, specifying the shadow
983 volume.
984 \param zfail If set to true, zfail method is used, otherwise
985 zpass.
986 \param debugDataVisible The debug data that is enabled for this
987 shadow node
988 */
989 virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0) =0;
990
991 //! Fills the stencil shadow with color.
992 /** After the shadow volume has been drawn into the stencil
993 buffer using IVideoDriver::drawStencilShadowVolume(), use this
994 to draw the color of the shadow.
995 Please note that the code for the opengl version of the method
996 is based on free code sent in by Philipp Dortmann, lots of
997 thanks go to him!
998 \param clearStencilBuffer Set this to false, if you want to
999 draw every shadow with the same color, and only want to call
1000 drawStencilShadow() once after all shadow volumes have been
1001 drawn. Set this to true, if you want to paint every shadow with
1002 its own color.
1003 \param leftUpEdge Color of the shadow in the upper left corner
1004 of screen.
1005 \param rightUpEdge Color of the shadow in the upper right
1006 corner of screen.
1007 \param leftDownEdge Color of the shadow in the lower left
1008 corner of screen.
1009 \param rightDownEdge Color of the shadow in the lower right
1010 corner of screen. */
1011 virtual void drawStencilShadow(bool clearStencilBuffer=false,
1012 video::SColor leftUpEdge = video::SColor(255,0,0,0),
1013 video::SColor rightUpEdge = video::SColor(255,0,0,0),
1014 video::SColor leftDownEdge = video::SColor(255,0,0,0),
1015 video::SColor rightDownEdge = video::SColor(255,0,0,0)) =0;
1016
1017 //! Draws a mesh buffer
1018 /** \param mb Buffer to draw */
1019 virtual void drawMeshBuffer(const scene::IMeshBuffer* mb) =0;
1020
1021 //! Draws normals of a mesh buffer
1022 /** \param mb Buffer to draw the normals of
1023 \param length length scale factor of the normals
1024 \param color Color the normals are rendered with
1025 */
1026 virtual void drawMeshBufferNormals(const scene::IMeshBuffer* mb, f32 length=10.f, SColor color=0xffffffff) =0;
1027
1028 //! Sets the fog mode.
1029 /** These are global values attached to each 3d object rendered,
1030 which has the fog flag enabled in its material.
1031 \param color Color of the fog
1032 \param fogType Type of fog used
1033 \param start Only used in linear fog mode (linearFog=true).
1034 Specifies where fog starts.
1035 \param end Only used in linear fog mode (linearFog=true).
1036 Specifies where fog ends.
1037 \param density Only used in exponential fog mode
1038 (linearFog=false). Must be a value between 0 and 1.
1039 \param pixelFog Set this to false for vertex fog, and true if
1040 you want per-pixel fog.
1041 \param rangeFog Set this to true to enable range-based vertex
1042 fog. The distance from the viewer is used to compute the fog,
1043 not the z-coordinate. This is better, but slower. This might not
1044 be available with all drivers and fog settings. */
1045 virtual void setFog(SColor color=SColor(0,255,255,255),
1046 E_FOG_TYPE fogType=EFT_FOG_LINEAR,
1047 f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
1048 bool pixelFog=false, bool rangeFog=false) =0;
1049
1050 //! Gets the fog mode.
1051 virtual void getFog(SColor& color, E_FOG_TYPE& fogType,
1052 f32& start, f32& end, f32& density,
1053 bool& pixelFog, bool& rangeFog) = 0;
1054
1055 //! Get the current color format of the color buffer
1056 /** \return Color format of the color buffer. */
1057 virtual ECOLOR_FORMAT getColorFormat() const =0;
1058
1059 //! Get the size of the screen or render window.
1060 /** \return Size of screen or render window. */
1061 virtual const core::dimension2d<u32>& getScreenSize() const =0;
1062
1063 //! Get the size of the current render target
1064 /** This method will return the screen size if the driver
1065 doesn't support render to texture, or if the current render
1066 target is the screen.
1067 \return Size of render target or screen/window */
1068 virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const =0;
1069
1070 //! Returns current frames per second value.
1071 /** This value is updated approximately every 1.5 seconds and
1072 is only intended to provide a rough guide to the average frame
1073 rate. It is not suitable for use in performing timing
1074 calculations or framerate independent movement.
1075 \return Approximate amount of frames per second drawn. */
1076 virtual s32 getFPS() const =0;
1077
1078 //! Returns amount of primitives (mostly triangles) which were drawn in the last frame.
1079 /** Together with getFPS() very useful method for statistics.
1080 \param mode Defines if the primitives drawn are accumulated or
1081 counted per frame.
1082 \return Amount of primitives drawn in the last frame. */
1083 virtual u32 getPrimitiveCountDrawn( u32 mode =0 ) const =0;
1084
1085 //! Deletes all dynamic lights which were previously added with addDynamicLight().
1086 virtual void deleteAllDynamicLights() =0;
1087
1088 //! adds a dynamic light, returning an index to the light
1089 //! \param light: the light data to use to create the light
1090 //! \return An index to the light, or -1 if an error occurs
1091 virtual s32 addDynamicLight(const SLight& light) =0;
1092
1093 //! Returns the maximal amount of dynamic lights the device can handle
1094 /** \return Maximal amount of dynamic lights. */
1095 virtual u32 getMaximalDynamicLightAmount() const =0;
1096
1097 //! Returns amount of dynamic lights currently set
1098 /** \return Amount of dynamic lights currently set */
1099 virtual u32 getDynamicLightCount() const =0;
1100
1101 //! Returns light data which was previously set by IVideoDriver::addDynamicLight().
1102 /** \param idx Zero based index of the light. Must be 0 or
1103 greater and smaller than IVideoDriver::getDynamicLightCount.
1104 \return Light data. */
1105 virtual const SLight& getDynamicLight(u32 idx) const =0;
1106
1107 //! Turns a dynamic light on or off
1108 //! \param lightIndex: the index returned by addDynamicLight
1109 //! \param turnOn: true to turn the light on, false to turn it off
1110 virtual void turnLightOn(s32 lightIndex, bool turnOn) =0;
1111
1112 //! Gets name of this video driver.
1113 /** \return Returns the name of the video driver, e.g. in case
1114 of the Direct3D8 driver, it would return "Direct3D 8.1". */
1115 virtual const wchar_t* getName() const =0;
1116
1117 //! Adds an external image loader to the engine.
1118 /** This is useful if the Irrlicht Engine should be able to load
1119 textures of currently unsupported file formats (e.g. gif). The
1120 IImageLoader only needs to be implemented for loading this file
1121 format. A pointer to the implementation can be passed to the
1122 engine using this method.
1123 \param loader Pointer to the external loader created. */
1124 virtual void addExternalImageLoader(IImageLoader* loader) =0;
1125
1126 //! Adds an external image writer to the engine.
1127 /** This is useful if the Irrlicht Engine should be able to
1128 write textures of currently unsupported file formats (e.g
1129 .gif). The IImageWriter only needs to be implemented for
1130 writing this file format. A pointer to the implementation can
1131 be passed to the engine using this method.
1132 \param writer: Pointer to the external writer created. */
1133 virtual void addExternalImageWriter(IImageWriter* writer) =0;
1134
1135 //! Returns the maximum amount of primitives
1136 /** (mostly vertices) which the device is able to render with
1137 one drawVertexPrimitiveList call.
1138 \return Maximum amount of primitives. */
1139 virtual u32 getMaximalPrimitiveCount() const =0;
1140
1141 //! Enables or disables a texture creation flag.
1142 /** These flags define how textures should be created. By
1143 changing this value, you can influence for example the speed of
1144 rendering a lot. But please note that the video drivers take
1145 this value only as recommendation. It could happen that you
1146 enable the ETCF_ALWAYS_16_BIT mode, but the driver still creates
1147 32 bit textures.
1148 \param flag Texture creation flag.
1149 \param enabled Specifies if the given flag should be enabled or
1150 disabled. */
1151 virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled=true) =0;
1152
1153 //! Returns if a texture creation flag is enabled or disabled.
1154 /** You can change this value using setTextureCreationFlag().
1155 \param flag Texture creation flag.
1156 \return The current texture creation flag enabled mode. */
1157 virtual bool getTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag) const =0;
1158
1159 //! Creates a software image from a file.
1160 /** No hardware texture will be created for this image. This
1161 method is useful for example if you want to read a heightmap
1162 for a terrain renderer.
1163 \param filename Name of the file from which the image is
1164 created.
1165 \return The created image.
1166 If you no longer need the image, you should call IImage::drop().
1167 See IReferenceCounted::drop() for more information. */
1168 virtual IImage* createImageFromFile(const io::path& filename) = 0;
1169
1170 //! Creates a software image from a file.
1171 /** No hardware texture will be created for this image. This
1172 method is useful for example if you want to read a heightmap
1173 for a terrain renderer.
1174 \param file File from which the image is created.
1175 \return The created image.
1176 If you no longer need the image, you should call IImage::drop().
1177 See IReferenceCounted::drop() for more information. */
1178 virtual IImage* createImageFromFile(io::IReadFile* file) =0;
1179
1180 //! Writes the provided image to a file.
1181 /** Requires that there is a suitable image writer registered
1182 for writing the image.
1183 \param image Image to write.
1184 \param filename Name of the file to write.
1185 \param param Control parameter for the backend (e.g. compression
1186 level).
1187 \return True on successful write. */
1188 virtual bool writeImageToFile(IImage* image, const io::path& filename, u32 param = 0) = 0;
1189
1190 //! Writes the provided image to a file.
1191 /** Requires that there is a suitable image writer registered
1192 for writing the image.
1193 \param image Image to write.
1194 \param file An already open io::IWriteFile object. The name
1195 will be used to determine the appropriate image writer to use.
1196 \param param Control parameter for the backend (e.g. compression
1197 level).
1198 \return True on successful write. */
1199 virtual bool writeImageToFile(IImage* image, io::IWriteFile* file, u32 param =0) =0;
1200
1201 //! Creates a software image from a byte array.
1202 /** No hardware texture will be created for this image. This
1203 method is useful for example if you want to read a heightmap
1204 for a terrain renderer.
1205 \param format Desired color format of the texture
1206 \param size Desired size of the image
1207 \param data A byte array with pixel color information
1208 \param ownForeignMemory If true, the image will use the data
1209 pointer directly and own it afterwards. If false, the memory
1210 will by copied internally.
1211 \param deleteMemory Whether the memory is deallocated upon
1212 destruction.
1213 \return The created image.
1214 If you no longer need the image, you should call IImage::drop().
1215 See IReferenceCounted::drop() for more information. */
1216 virtual IImage* createImageFromData(ECOLOR_FORMAT format,
1217 const core::dimension2d<u32>& size, void *data,
1218 bool ownForeignMemory=false,
1219 bool deleteMemory = true) =0;
1220
1221 //! Creates an empty software image.
1222 /**
1223 \param format Desired color format of the image.
1224 \param size Size of the image to create.
1225 \return The created image.
1226 If you no longer need the image, you should call IImage::drop().
1227 See IReferenceCounted::drop() for more information. */
1228 virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) =0;
1229
1230 //! Creates a software image by converting it to given format from another image.
1231 /** \deprecated Create an empty image and use copyTo(). This method may be removed by Irrlicht 1.9.
1232 \param format Desired color format of the image.
1233 \param imageToCopy Image to copy to the new image.
1234 \return The created image.
1235 If you no longer need the image, you should call IImage::drop().
1236 See IReferenceCounted::drop() for more information. */
1237 _IRR_DEPRECATED_ virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy) =0;
1238
1239 //! Creates a software image from a part of another image.
1240 /** \deprecated Create an empty image and use copyTo(). This method may be removed by Irrlicht 1.9.
1241 \param imageToCopy Image to copy to the new image in part.
1242 \param pos Position of rectangle to copy.
1243 \param size Extents of rectangle to copy.
1244 \return The created image.
1245 If you no longer need the image, you should call IImage::drop().
1246 See IReferenceCounted::drop() for more information. */
1247 _IRR_DEPRECATED_ virtual IImage* createImage(IImage* imageToCopy,
1248 const core::position2d<s32>& pos,
1249 const core::dimension2d<u32>& size) =0;
1250
1251 //! Creates a software image from a part of a texture.
1252 /**
1253 \param texture Texture to copy to the new image in part.
1254 \param pos Position of rectangle to copy.
1255 \param size Extents of rectangle to copy.
1256 \return The created image.
1257 If you no longer need the image, you should call IImage::drop().
1258 See IReferenceCounted::drop() for more information. */
1259 virtual IImage* createImage(ITexture* texture,
1260 const core::position2d<s32>& pos,
1261 const core::dimension2d<u32>& size) =0;
1262
1263 //! Event handler for resize events. Only used by the engine internally.
1264 /** Used to notify the driver that the window was resized.
1265 Usually, there is no need to call this method. */
1266 virtual void OnResize(const core::dimension2d<u32>& size) =0;
1267
1268 //! Adds a new material renderer to the video device.
1269 /** Use this method to extend the VideoDriver with new material
1270 types. To extend the engine using this method do the following:
1271 Derive a class from IMaterialRenderer and override the methods
1272 you need. For setting the right renderstates, you can try to
1273 get a pointer to the real rendering device using
1274 IVideoDriver::getExposedVideoData(). Add your class with
1275 IVideoDriver::addMaterialRenderer(). To use an object being
1276 displayed with your new material, set the MaterialType member of
1277 the SMaterial struct to the value returned by this method.
1278 If you simply want to create a new material using vertex and/or
1279 pixel shaders it would be easier to use the
1280 video::IGPUProgrammingServices interface which you can get
1281 using the getGPUProgrammingServices() method.
1282 \param renderer A pointer to the new renderer.
1283 \param name Optional name for the material renderer entry.
1284 \return The number of the material type which can be set in
1285 SMaterial::MaterialType to use the renderer. -1 is returned if
1286 an error occured. For example if you tried to add an material
1287 renderer to the software renderer or the null device, which do
1288 not accept material renderers. */
1289 virtual s32 addMaterialRenderer(IMaterialRenderer* renderer, const c8* name =0) =0;
1290
1291 //! Get access to a material renderer by index.
1292 /** \param idx Id of the material renderer. Can be a value of
1293 the E_MATERIAL_TYPE enum or a value which was returned by
1294 addMaterialRenderer().
1295 \return Pointer to material renderer or null if not existing. */
1296 virtual IMaterialRenderer* getMaterialRenderer(u32 idx) =0;
1297
1298 //! Get amount of currently available material renderers.
1299 /** \return Amount of currently available material renderers. */
1300 virtual u32 getMaterialRendererCount() const =0;
1301
1302 //! Get name of a material renderer
1303 /** This string can, e.g., be used to test if a specific
1304 renderer already has been registered/created, or use this
1305 string to store data about materials: This returned name will
1306 be also used when serializing materials.
1307 \param idx Id of the material renderer. Can be a value of the
1308 E_MATERIAL_TYPE enum or a value which was returned by
1309 addMaterialRenderer().
1310 \return String with the name of the renderer, or 0 if not
1311 exisiting */
1312 virtual const c8* getMaterialRendererName(u32 idx) const =0;
1313
1314 //! Sets the name of a material renderer.
1315 /** Will have no effect on built-in material renderers.
1316 \param idx: Id of the material renderer. Can be a value of the
1317 E_MATERIAL_TYPE enum or a value which was returned by
1318 addMaterialRenderer().
1319 \param name: New name of the material renderer. */
1320 virtual void setMaterialRendererName(s32 idx, const c8* name) =0;
1321
1322 //! Creates material attributes list from a material
1323 /** This method is useful for serialization and more.
1324 Please note that the video driver will use the material
1325 renderer names from getMaterialRendererName() to write out the
1326 material type name, so they should be set before.
1327 \param material The material to serialize.
1328 \param options Additional options which might influence the
1329 serialization.
1330 \return The io::IAttributes container holding the material
1331 properties. */
1332 virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material,
1333 io::SAttributeReadWriteOptions* options=0) =0;
1334
1335 //! Fills an SMaterial structure from attributes.
1336 /** Please note that for setting material types of the
1337 material, the video driver will need to query the material
1338 renderers for their names, so all non built-in materials must
1339 have been created before calling this method.
1340 \param outMaterial The material to set the properties for.
1341 \param attributes The attributes to read from. */
1342 virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) =0;
1343
1344 //! Returns driver and operating system specific data about the IVideoDriver.
1345 /** This method should only be used if the engine should be
1346 extended without having to modify the source of the engine.
1347 \return Collection of device dependent pointers. */
1348 virtual const SExposedVideoData& getExposedVideoData() =0;
1349
1350 //! Get type of video driver
1351 /** \return Type of driver. */
1352 virtual E_DRIVER_TYPE getDriverType() const =0;
1353
1354 //! Gets the IGPUProgrammingServices interface.
1355 /** \return Pointer to the IGPUProgrammingServices. Returns 0
1356 if the video driver does not support this. For example the
1357 Software driver and the Null driver will always return 0. */
1358 virtual IGPUProgrammingServices* getGPUProgrammingServices() =0;
1359
1360 //! Returns a pointer to the mesh manipulator.
1361 virtual scene::IMeshManipulator* getMeshManipulator() =0;
1362
1363 //! Clears the ZBuffer.
1364 /** Note that you usually need not to call this method, as it
1365 is automatically done in IVideoDriver::beginScene() or
1366 IVideoDriver::setRenderTarget() if you enable zBuffer. But if
1367 you have to render some special things, you can clear the
1368 zbuffer during the rendering process with this method any time.
1369 */
1370 virtual void clearZBuffer() =0;
1371
1372 //! Make a screenshot of the last rendered frame.
1373 /** \return An image created from the last rendered frame. */
1374 virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) =0;
1375
1376 //! Check if the image is already loaded.
1377 /** Works similar to getTexture(), but does not load the texture
1378 if it is not currently loaded.
1379 \param filename Name of the texture.
1380 \return Pointer to loaded texture, or 0 if not found. */
1381 virtual video::ITexture* findTexture(const io::path& filename) = 0;
1382
1383 //! Set or unset a clipping plane.
1384 /** There are at least 6 clipping planes available for the user
1385 to set at will.
1386 \param index The plane index. Must be between 0 and
1387 MaxUserClipPlanes.
1388 \param plane The plane itself.
1389 \param enable If true, enable the clipping plane else disable
1390 it.
1391 \return True if the clipping plane is usable. */
1392 virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false) =0;
1393
1394 //! Enable or disable a clipping plane.
1395 /** There are at least 6 clipping planes available for the user
1396 to set at will.
1397 \param index The plane index. Must be between 0 and
1398 MaxUserClipPlanes.
1399 \param enable If true, enable the clipping plane else disable
1400 it. */
1401 virtual void enableClipPlane(u32 index, bool enable) =0;
1402
1403 //! Set the minimum number of vertices for which a hw buffer will be created
1404 /** \param count Number of vertices to set as minimum. */
1405 virtual void setMinHardwareBufferVertexCount(u32 count) =0;
1406
1407 //! Get the global Material, which might override local materials.
1408 /** Depending on the enable flags, values from this Material
1409 are used to override those of local materials of some
1410 meshbuffer being rendered.
1411 \return Reference to the Override Material. */
1412 virtual SOverrideMaterial& getOverrideMaterial() =0;
1413
1414 //! Get the 2d override material for altering its values
1415 /** The 2d override materual allows to alter certain render
1416 states of the 2d methods. Not all members of SMaterial are
1417 honored, especially not MaterialType and Textures. Moreover,
1418 the zbuffer is always ignored, and lighting is always off. All
1419 other flags can be changed, though some might have to effect
1420 in most cases.
1421 Please note that you have to enable/disable this effect with
1422 enableInitMaterial2D(). This effect is costly, as it increases
1423 the number of state changes considerably. Always reset the
1424 values when done.
1425 \return Material reference which should be altered to reflect
1426 the new settings.
1427 */
1428 virtual SMaterial& getMaterial2D() =0;
1429
1430 //! Enable the 2d override material
1431 /** \param enable Flag which tells whether the material shall be
1432 enabled or disabled. */
1433 virtual void enableMaterial2D(bool enable=true) =0;
1434
1435 //! Get the graphics card vendor name.
1436 virtual core::stringc getVendorInfo() =0;
1437
1438 //! Only used by the engine internally.
1439 /** The ambient color is set in the scene manager, see
1440 scene::ISceneManager::setAmbientLight().
1441 \param color New color of the ambient light. */
1442 virtual void setAmbientLight(const SColorf& color) =0;
1443
1444 //! Only used by the engine internally.
1445 /** Passes the global material flag AllowZWriteOnTransparent.
1446 Use the SceneManager attribute to set this value from your app.
1447 \param flag Default behavior is to disable ZWrite, i.e. false. */
1448 virtual void setAllowZWriteOnTransparent(bool flag) =0;
1449
1450 //! Get the maximum texture size supported.
1451 virtual core::dimension2du getMaxTextureSize() const =0;
1452
1453 //! Color conversion convenience function
1454 /** Convert an image (as array of pixels) from source to destination
1455 array, thereby converting the color format. The pixel size is
1456 determined by the color formats.
1457 \param sP Pointer to source
1458 \param sF Color format of source
1459 \param sN Number of pixels to convert, both array must be large enough
1460 \param dP Pointer to destination
1461 \param dF Color format of destination
1462 */
1463 virtual void convertColor(const void* sP, ECOLOR_FORMAT sF, s32 sN,
1464 void* dP, ECOLOR_FORMAT dF) const =0;
1465 };
1466
1467} // end namespace video
1468} // end namespace irr
1469
1470
1471#endif
diff --git a/src/others/irrlicht-1.8.1/include/IVideoModeList.h b/src/others/irrlicht-1.8.1/include/IVideoModeList.h
new file mode 100644
index 0000000..4fe2e69
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IVideoModeList.h
@@ -0,0 +1,62 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_I_VIDEO_MODE_LIST_H_INCLUDED__
6#define __IRR_I_VIDEO_MODE_LIST_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "dimension2d.h"
10
11namespace irr
12{
13namespace video
14{
15
16 //! A list of all available video modes.
17 /** You can get a list via IrrlichtDevice::getVideoModeList(). If you are confused
18 now, because you think you have to create an Irrlicht Device with a video
19 mode before being able to get the video mode list, let me tell you that
20 there is no need to start up an Irrlicht Device with EDT_DIRECT3D8, EDT_OPENGL or
21 EDT_SOFTWARE: For this (and for lots of other reasons) the null device,
22 EDT_NULL exists.*/
23 class IVideoModeList : public virtual IReferenceCounted
24 {
25 public:
26
27 //! Gets amount of video modes in the list.
28 /** \return Returns amount of video modes. */
29 virtual s32 getVideoModeCount() const = 0;
30
31 //! Get the screen size of a video mode in pixels.
32 /** \param modeNumber: zero based index of the video mode.
33 \return Size of screen in pixels of the specified video mode. */
34 virtual core::dimension2d<u32> getVideoModeResolution(s32 modeNumber) const = 0;
35
36 //! Get a supported screen size with certain constraints.
37 /** \param minSize: Minimum dimensions required.
38 \param maxSize: Maximum dimensions allowed.
39 \return Size of screen in pixels which matches the requirements.
40 as good as possible. */
41 virtual core::dimension2d<u32> getVideoModeResolution(const core::dimension2d<u32>& minSize, const core::dimension2d<u32>& maxSize) const = 0;
42
43 //! Get the pixel depth of a video mode in bits.
44 /** \param modeNumber: zero based index of the video mode.
45 \return Size of each pixel of the specified video mode in bits. */
46 virtual s32 getVideoModeDepth(s32 modeNumber) const = 0;
47
48 //! Get current desktop screen resolution.
49 /** \return Size of screen in pixels of the current desktop video mode. */
50 virtual const core::dimension2d<u32>& getDesktopResolution() const = 0;
51
52 //! Get the pixel depth of a video mode in bits.
53 /** \return Size of each pixel of the current desktop video mode in bits. */
54 virtual s32 getDesktopDepth() const = 0;
55 };
56
57} // end namespace video
58} // end namespace irr
59
60
61#endif
62
diff --git a/src/others/irrlicht-1.8.1/include/IVolumeLightSceneNode.h b/src/others/irrlicht-1.8.1/include/IVolumeLightSceneNode.h
new file mode 100644
index 0000000..6386112
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IVolumeLightSceneNode.h
@@ -0,0 +1,60 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4//
5// created by Dean Wadsworth aka Varmint Dec 31 2007
6
7#ifndef __I_VOLUME_LIGHT_SCENE_NODE_H_INCLUDED__
8#define __I_VOLUME_LIGHT_SCENE_NODE_H_INCLUDED__
9
10#include "ISceneNode.h"
11
12namespace irr
13{
14namespace scene
15{
16 class IMeshBuffer;
17
18 class IVolumeLightSceneNode : public ISceneNode
19 {
20 public:
21
22 //! constructor
23 IVolumeLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
24 const core::vector3df& position,
25 const core::vector3df& rotation,
26 const core::vector3df& scale)
27 : ISceneNode(parent, mgr, id, position, rotation, scale) {};
28
29 //! Returns type of the scene node
30 virtual ESCENE_NODE_TYPE getType() const { return ESNT_VOLUME_LIGHT; }
31
32 //! Sets the number of segments across the U axis
33 virtual void setSubDivideU(const u32 inU) =0;
34
35 //! Sets the number of segments across the V axis
36 virtual void setSubDivideV(const u32 inV) =0;
37
38 //! Returns the number of segments across the U axis
39 virtual u32 getSubDivideU() const =0;
40
41 //! Returns the number of segments across the V axis
42 virtual u32 getSubDivideV() const =0;
43
44 //! Sets the color of the base of the light
45 virtual void setFootColor(const video::SColor inColor) =0;
46
47 //! Sets the color of the tip of the light
48 virtual void setTailColor(const video::SColor inColor) =0;
49
50 //! Returns the color of the base of the light
51 virtual video::SColor getFootColor() const =0;
52
53 //! Returns the color of the tip of the light
54 virtual video::SColor getTailColor() const =0;
55 };
56
57} // end namespace scene
58} // end namespace irr
59
60#endif
diff --git a/src/others/irrlicht-1.8.1/include/IWriteFile.h b/src/others/irrlicht-1.8.1/include/IWriteFile.h
new file mode 100644
index 0000000..5944318
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IWriteFile.h
@@ -0,0 +1,50 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_WRITE_FILE_H_INCLUDED__
6#define __I_WRITE_FILE_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "path.h"
10
11namespace irr
12{
13namespace io
14{
15
16 //! Interface providing write access to a file.
17 class IWriteFile : public virtual IReferenceCounted
18 {
19 public:
20 //! Writes an amount of bytes to the file.
21 /** \param buffer Pointer to buffer of bytes to write.
22 \param sizeToWrite Amount of bytes to write to the file.
23 \return How much bytes were written. */
24 virtual s32 write(const void* buffer, u32 sizeToWrite) = 0;
25
26 //! Changes position in file
27 /** \param finalPos Destination position in the file.
28 \param relativeMovement If set to true, the position in the file is
29 changed relative to current position. Otherwise the position is changed
30 from begin of file.
31 \return True if successful, otherwise false. */
32 virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
33
34 //! Get the current position in the file.
35 /** \return Current position in the file in bytes. */
36 virtual long getPos() const = 0;
37
38 //! Get name of file.
39 /** \return File name as zero terminated character string. */
40 virtual const path& getFileName() const = 0;
41 };
42
43 //! Internal function, please do not use.
44 IWriteFile* createWriteFile(const io::path& fileName, bool append);
45
46} // end namespace io
47} // end namespace irr
48
49#endif
50
diff --git a/src/others/irrlicht-1.8.1/include/IXMLReader.h b/src/others/irrlicht-1.8.1/include/IXMLReader.h
new file mode 100644
index 0000000..3f34cb8
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IXMLReader.h
@@ -0,0 +1,31 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_XML_READER_H_INCLUDED__
6#define __I_XML_READER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrXML.h"
10
11namespace irr
12{
13namespace io
14{
15 //! An xml reader for wide characters, derived from IReferenceCounted.
16 /** This XML Parser can read any type of text files from any source
17 Irrlicht can read. Just call IFileSystem::createXMLReader(). For more
18 informations on how to use the parser, see IIrrXMLReader */
19 typedef IIrrXMLReader<wchar_t, IReferenceCounted> IXMLReader;
20
21 //! An xml reader for ASCII or UTF-8 characters, derived from IReferenceCounted.
22 /** This XML Parser can read any type of text files from any source
23 Irrlicht can read. Just call IFileSystem::createXMLReaderUTF8(). For
24 more informations on how to use the parser, see IIrrXMLReader */
25 typedef IIrrXMLReader<c8, IReferenceCounted> IXMLReaderUTF8;
26
27} // end namespace io
28} // end namespace irr
29
30#endif
31
diff --git a/src/others/irrlicht-1.8.1/include/IXMLWriter.h b/src/others/irrlicht-1.8.1/include/IXMLWriter.h
new file mode 100644
index 0000000..bb6901e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IXMLWriter.h
@@ -0,0 +1,77 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_XML_WRITER_H_INCLUDED__
6#define __I_XML_WRITER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrArray.h"
10#include "irrString.h"
11
12namespace irr
13{
14namespace io
15{
16
17 //! Interface providing methods for making it easier to write XML files.
18 /** This XML Writer writes xml files using in the platform dependent
19 wchar_t format and sets the xml-encoding correspondingly. */
20 class IXMLWriter : public virtual IReferenceCounted
21 {
22 public:
23 //! Writes an xml 1.0 header.
24 /** Looks like &lt;?xml version="1.0"?&gt;. This should always
25 be called before writing anything other, because also the text
26 file header for unicode texts is written out with this method. */
27 virtual void writeXMLHeader() = 0;
28
29 //! Writes an xml element with maximal 5 attributes like "<foo />" or
30 //! &lt;foo optAttr="value" /&gt;.
31 /** The element can be empty or not.
32 \param name: Name of the element
33 \param empty: Specifies if the element should be empty. Like
34 "<foo />". If You set this to false, something like this is
35 written instead: "<foo>".
36 \param attr1Name: 1st attributes name
37 \param attr1Value: 1st attributes value
38 \param attr2Name: 2nd attributes name
39 \param attr2Value: 2nd attributes value
40 \param attr3Name: 3rd attributes name
41 \param attr3Value: 3rd attributes value
42 \param attr4Name: 4th attributes name
43 \param attr4Value: 4th attributes value
44 \param attr5Name: 5th attributes name
45 \param attr5Value: 5th attributes value */
46 virtual void writeElement(const wchar_t* name, bool empty=false,
47 const wchar_t* attr1Name = 0, const wchar_t* attr1Value = 0,
48 const wchar_t* attr2Name = 0, const wchar_t* attr2Value = 0,
49 const wchar_t* attr3Name = 0, const wchar_t* attr3Value = 0,
50 const wchar_t* attr4Name = 0, const wchar_t* attr4Value = 0,
51 const wchar_t* attr5Name = 0, const wchar_t* attr5Value = 0) = 0;
52
53 //! Writes an xml element with any number of attributes
54 virtual void writeElement(const wchar_t* name, bool empty,
55 core::array<core::stringw> &names, core::array<core::stringw> &values) = 0;
56
57 //! Writes a comment into the xml file
58 virtual void writeComment(const wchar_t* comment) = 0;
59
60 //! Writes the closing tag for an element. Like "</foo>"
61 virtual void writeClosingTag(const wchar_t* name) = 0;
62
63 //! Writes a text into the file.
64 /** All occurrences of special characters such as
65 & (&amp;), < (&lt;), > (&gt;), and " (&quot;) are automaticly
66 replaced. */
67 virtual void writeText(const wchar_t* text) = 0;
68
69 //! Writes a line break
70 virtual void writeLineBreak() = 0;
71 };
72
73} // end namespace io
74} // end namespace irr
75
76#endif
77
diff --git a/src/others/irrlicht-1.8.1/include/IrrCompileConfig.h b/src/others/irrlicht-1.8.1/include/IrrCompileConfig.h
new file mode 100644
index 0000000..2fa2423
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IrrCompileConfig.h
@@ -0,0 +1,832 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_COMPILE_CONFIG_H_INCLUDED__
6#define __IRR_COMPILE_CONFIG_H_INCLUDED__
7
8//! Irrlicht SDK Version
9#define IRRLICHT_VERSION_MAJOR 1
10#define IRRLICHT_VERSION_MINOR 8
11#define IRRLICHT_VERSION_REVISION 1
12// This flag will be defined only in SVN, the official release code will have
13// it undefined
14//#define IRRLICHT_VERSION_SVN -alpha
15#define IRRLICHT_SDK_VERSION "1.8.1"
16
17#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
18
19//! The defines for different operating system are:
20//! _IRR_XBOX_PLATFORM_ for XBox
21//! _IRR_WINDOWS_ for all irrlicht supported Windows versions
22//! _IRR_WINDOWS_CE_PLATFORM_ for Windows CE
23//! _IRR_WINDOWS_API_ for Windows or XBox
24//! _IRR_LINUX_PLATFORM_ for Linux (it is defined here if no other os is defined)
25//! _IRR_SOLARIS_PLATFORM_ for Solaris
26//! _IRR_OSX_PLATFORM_ for Apple systems running OSX
27//! _IRR_POSIX_API_ for Posix compatible systems
28//! Note: PLATFORM defines the OS specific layer, API can group several platforms
29
30//! DEVICE is the windowing system used, several PLATFORMs support more than one DEVICE
31//! Irrlicht can be compiled with more than one device
32//! _IRR_COMPILE_WITH_WINDOWS_DEVICE_ for Windows API based device
33//! _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_ for Windows CE API based device
34//! _IRR_COMPILE_WITH_OSX_DEVICE_ for Cocoa native windowing on OSX
35//! _IRR_COMPILE_WITH_X11_DEVICE_ for Linux X11 based device
36//! _IRR_COMPILE_WITH_SDL_DEVICE_ for platform independent SDL framework
37//! _IRR_COMPILE_WITH_CONSOLE_DEVICE_ for no windowing system, used as a fallback
38//! _IRR_COMPILE_WITH_FB_DEVICE_ for framebuffer systems
39
40//! Passing defines to the compiler which have NO in front of the _IRR definename is an alternative
41//! way which can be used to disable defines (instead of outcommenting them in this header).
42//! So defines can be controlled from Makefiles or Projectfiles which allows building
43//! different library versions without having to change the sources.
44//! Example: NO_IRR_COMPILE_WITH_X11_ would disable X11
45
46
47//! Uncomment this line to compile with the SDL device
48//#define _IRR_COMPILE_WITH_SDL_DEVICE_
49#ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_
50#undef _IRR_COMPILE_WITH_SDL_DEVICE_
51#endif
52
53//! Comment this line to compile without the fallback console device.
54#define _IRR_COMPILE_WITH_CONSOLE_DEVICE_
55#ifdef NO_IRR_COMPILE_WITH_CONSOLE_DEVICE_
56#undef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
57#endif
58
59//! WIN32 for Windows32
60//! WIN64 for Windows64
61// The windows platform and API support SDL and WINDOW device
62#if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64)
63#define _IRR_WINDOWS_
64#define _IRR_WINDOWS_API_
65#define _IRR_COMPILE_WITH_WINDOWS_DEVICE_
66#endif
67
68//! WINCE is a very restricted environment for mobile devices
69#if defined(_WIN32_WCE)
70#define _IRR_WINDOWS_
71#define _IRR_WINDOWS_API_
72#define _IRR_WINDOWS_CE_PLATFORM_
73#define _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
74#endif
75
76#if defined(_MSC_VER) && (_MSC_VER < 1300)
77# error "Only Microsoft Visual Studio 7.0 and later are supported."
78#endif
79
80// XBox only suppots the native Window stuff
81#if defined(_XBOX)
82 #undef _IRR_WINDOWS_
83 #define _IRR_XBOX_PLATFORM_
84 #define _IRR_WINDOWS_API_
85 //#define _IRR_COMPILE_WITH_WINDOWS_DEVICE_
86 #undef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
87 //#define _IRR_COMPILE_WITH_SDL_DEVICE_
88
89 #include <xtl.h>
90#endif
91
92#if defined(__APPLE__) || defined(MACOSX)
93#if !defined(MACOSX)
94#define MACOSX // legacy support
95#endif
96#define _IRR_OSX_PLATFORM_
97#define _IRR_COMPILE_WITH_OSX_DEVICE_
98#endif
99
100#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
101#ifndef _IRR_SOLARIS_PLATFORM_
102#define _IRR_LINUX_PLATFORM_
103#endif
104#define _IRR_POSIX_API_
105#define _IRR_COMPILE_WITH_X11_DEVICE_
106#endif
107
108
109//! Define _IRR_COMPILE_WITH_JOYSTICK_SUPPORT_ if you want joystick events.
110#define _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
111#ifdef NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_
112#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
113#endif
114
115
116//! Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht.
117#define _IRR_MATERIAL_MAX_TEXTURES_ 4
118
119//! Define _IRR_COMPILE_WITH_DIRECT3D_8_ and _IRR_COMPILE_WITH_DIRECT3D_9_ to
120//! compile the Irrlicht engine with Direct3D8 and/or DIRECT3D9.
121/** If you only want to use the software device or opengl you can disable those defines.
122This switch is mostly disabled because people do not get the g++ compiler compile
123directX header files, and directX is only available on Windows platforms. If you
124are using Dev-Cpp, and want to compile this using a DX dev pack, you can define
125_IRR_COMPILE_WITH_DX9_DEV_PACK_. So you simply need to add something like this
126to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK
127and this to the linker settings: -ld3dx9 -ld3dx8
128
129Microsoft have chosen to remove D3D8 headers from their recent DXSDKs, and
130so D3D8 support is now disabled by default. If you really want to build
131with D3D8 support, then you will have to source a DXSDK with the appropriate
132headers, e.g. Summer 2004. This is a Microsoft issue, not an Irrlicht one.
133*/
134#if defined(_IRR_WINDOWS_API_) && (!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK))
135
136//! Define _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ if you want to use DirectInput for joystick handling.
137/** This only applies to Windows devices, currently only supported under Win32 device.
138If not defined, Windows Multimedia library is used, which offers also broad support for joystick devices. */
139#define _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
140#ifdef NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
141#undef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
142#endif
143// can't get this to compile currently under borland, can be removed if someone has a better solution
144#if defined(__BORLANDC__)
145#undef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
146#endif
147
148//! Only define _IRR_COMPILE_WITH_DIRECT3D_8_ if you have an appropriate DXSDK, e.g. Summer 2004
149// #define _IRR_COMPILE_WITH_DIRECT3D_8_
150#define _IRR_COMPILE_WITH_DIRECT3D_9_
151
152#ifdef NO_IRR_COMPILE_WITH_DIRECT3D_8_
153#undef _IRR_COMPILE_WITH_DIRECT3D_8_
154#endif
155#ifdef NO_IRR_COMPILE_WITH_DIRECT3D_9_
156#undef _IRR_COMPILE_WITH_DIRECT3D_9_
157#endif
158
159#endif
160
161//! Define _IRR_COMPILE_WITH_OPENGL_ to compile the Irrlicht engine with OpenGL.
162/** If you do not wish the engine to be compiled with OpenGL, comment this
163define out. */
164#define _IRR_COMPILE_WITH_OPENGL_
165#ifdef NO_IRR_COMPILE_WITH_OPENGL_
166#undef _IRR_COMPILE_WITH_OPENGL_
167#endif
168
169//! Define _IRR_COMPILE_WITH_SOFTWARE_ to compile the Irrlicht engine with software driver
170/** If you do not need the software driver, or want to use Burning's Video instead,
171comment this define out */
172#define _IRR_COMPILE_WITH_SOFTWARE_
173#ifdef NO_IRR_COMPILE_WITH_SOFTWARE_
174#undef _IRR_COMPILE_WITH_SOFTWARE_
175#endif
176
177//! Define _IRR_COMPILE_WITH_BURNINGSVIDEO_ to compile the Irrlicht engine with Burning's video driver
178/** If you do not need this software driver, you can comment this define out. */
179#define _IRR_COMPILE_WITH_BURNINGSVIDEO_
180#ifdef NO_IRR_COMPILE_WITH_BURNINGSVIDEO_
181#undef _IRR_COMPILE_WITH_BURNINGSVIDEO_
182#endif
183
184//! Define _IRR_COMPILE_WITH_X11_ to compile the Irrlicht engine with X11 support.
185/** If you do not wish the engine to be compiled with X11, comment this
186define out. */
187// Only used in LinuxDevice.
188#define _IRR_COMPILE_WITH_X11_
189#ifdef NO_IRR_COMPILE_WITH_X11_
190#undef _IRR_COMPILE_WITH_X11_
191#endif
192
193//! Define _IRR_OPENGL_USE_EXTPOINTER_ if the OpenGL renderer should use OpenGL extensions via function pointers.
194/** On some systems there is no support for the dynamic extension of OpenGL
195 via function pointers such that this has to be undef'ed. */
196#if !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_SOLARIS_PLATFORM_)
197#define _IRR_OPENGL_USE_EXTPOINTER_
198#endif
199
200//! On some Linux systems the XF86 vidmode extension or X11 RandR are missing. Use these flags
201//! to remove the dependencies such that Irrlicht will compile on those systems, too.
202//! If you don't need colored cursors you can also disable the Xcursor extension
203#if defined(_IRR_LINUX_PLATFORM_) && defined(_IRR_COMPILE_WITH_X11_)
204#define _IRR_LINUX_X11_VIDMODE_
205//#define _IRR_LINUX_X11_RANDR_
206#ifdef NO_IRR_LINUX_X11_VIDMODE_
207#undef _IRR_LINUX_X11_VIDMODE_
208#endif
209#ifdef NO_IRR_LINUX_X11_RANDR_
210#undef _IRR_LINUX_X11_RANDR_
211#endif
212
213//! X11 has by default only monochrome cursors, but using the Xcursor library we can also get color cursor support.
214//! If you have the need for custom color cursors on X11 then enable this and make sure you also link
215//! to the Xcursor library in your Makefile/Projectfile.
216//#define _IRR_LINUX_XCURSOR_
217#ifdef NO_IRR_LINUX_XCURSOR_
218#undef _IRR_LINUX_XCURSOR_
219#endif
220
221#endif
222
223//! Define _IRR_COMPILE_WITH_GUI_ to compile the engine with the built-in GUI
224/** Disable this if you are using an external library to draw the GUI. If you disable this then
225you will not be able to use anything provided by the GUI Environment, including loading fonts. */
226#define _IRR_COMPILE_WITH_GUI_
227#ifdef NO_IRR_COMPILE_WITH_GUI_
228#undef _IRR_COMPILE_WITH_GUI_
229#endif
230
231//! Define _IRR_WCHAR_FILESYSTEM to enable unicode filesystem support for the engine.
232/** This enables the engine to read/write from unicode filesystem. If you
233disable this feature, the engine behave as before (ansi). This is currently only supported
234for Windows based systems. You also have to set #define UNICODE for this to compile.
235*/
236//#define _IRR_WCHAR_FILESYSTEM
237#ifdef NO_IRR_WCHAR_FILESYSTEM
238#undef _IRR_WCHAR_FILESYSTEM
239#endif
240
241//! Define _IRR_COMPILE_WITH_JPEGLIB_ to enable compiling the engine using libjpeg.
242/** This enables the engine to read jpeg images. If you comment this out,
243the engine will no longer read .jpeg images. */
244#define _IRR_COMPILE_WITH_LIBJPEG_
245#ifdef NO_IRR_COMPILE_WITH_LIBJPEG_
246#undef _IRR_COMPILE_WITH_LIBJPEG_
247#endif
248
249//! Define _IRR_USE_NON_SYSTEM_JPEG_LIB_ to let irrlicht use the jpeglib which comes with irrlicht.
250/** If this is commented out, Irrlicht will try to compile using the jpeg lib installed in the system.
251 This is only used when _IRR_COMPILE_WITH_LIBJPEG_ is defined. */
252#define _IRR_USE_NON_SYSTEM_JPEG_LIB_
253#ifdef NO_IRR_USE_NON_SYSTEM_JPEG_LIB_
254#undef _IRR_USE_NON_SYSTEM_JPEG_LIB_
255#endif
256
257//! Define _IRR_COMPILE_WITH_LIBPNG_ to enable compiling the engine using libpng.
258/** This enables the engine to read png images. If you comment this out,
259the engine will no longer read .png images. */
260#define _IRR_COMPILE_WITH_LIBPNG_
261#ifdef NO_IRR_COMPILE_WITH_LIBPNG_
262#undef _IRR_COMPILE_WITH_LIBPNG_
263#endif
264
265//! Define _IRR_USE_NON_SYSTEM_LIBPNG_ to let irrlicht use the libpng which comes with irrlicht.
266/** If this is commented out, Irrlicht will try to compile using the libpng installed in the system.
267 This is only used when _IRR_COMPILE_WITH_LIBPNG_ is defined. */
268#define _IRR_USE_NON_SYSTEM_LIB_PNG_
269#ifdef NO_IRR_USE_NON_SYSTEM_LIB_PNG_
270#undef _IRR_USE_NON_SYSTEM_LIB_PNG_
271#endif
272
273//! Define _IRR_D3D_NO_SHADER_DEBUGGING to disable shader debugging in D3D9
274/** If _IRR_D3D_NO_SHADER_DEBUGGING is undefined in IrrCompileConfig.h,
275it is possible to debug all D3D9 shaders in VisualStudio. All shaders
276(which have been generated in memory or read from archives for example) will be emitted
277into a temporary file at runtime for this purpose. To debug your shaders, choose
278Debug->Direct3D->StartWithDirect3DDebugging in Visual Studio, and for every shader a
279file named 'irr_dbg_shader_%%.vsh' or 'irr_dbg_shader_%%.psh' will be created. Drag'n'drop
280the file you want to debug into visual studio. That's it. You can now set breakpoints and
281watch registers, variables etc. This works with ASM, HLSL, and both with pixel and vertex shaders.
282Note that the engine will run in D3D REF for this, which is a lot slower than HAL. */
283#define _IRR_D3D_NO_SHADER_DEBUGGING
284#ifdef NO_IRR_D3D_NO_SHADER_DEBUGGING
285#undef _IRR_D3D_NO_SHADER_DEBUGGING
286#endif
287
288//! Define _IRR_D3D_USE_LEGACY_HLSL_COMPILER to enable the old HLSL compiler in recent DX SDKs
289/** This enables support for ps_1_x shaders for recent DX SDKs. Otherwise, support
290for this shader model is not available anymore in SDKs after Oct2006. You need to
291distribute the OCT2006_d3dx9_31_x86.cab or OCT2006_d3dx9_31_x64.cab though, in order
292to provide the user with the proper DLL. That's why it's disabled by default. */
293//#define _IRR_D3D_USE_LEGACY_HLSL_COMPILER
294#ifdef NO_IRR_D3D_USE_LEGACY_HLSL_COMPILER
295#undef _IRR_D3D_USE_LEGACY_HLSL_COMPILER
296#endif
297
298//! Define _IRR_COMPILE_WITH_CG_ to enable Cg Shading Language support
299//#define _IRR_COMPILE_WITH_CG_
300#ifdef NO_IRR_COMPILE_WITH_CG_
301#undef _IRR_COMPILE_WITH_CG_
302#endif
303#if !defined(_IRR_COMPILE_WITH_OPENGL_) && !defined(_IRR_COMPILE_WITH_DIRECT3D_9_)
304#undef _IRR_COMPILE_WITH_CG_
305#endif
306
307//! Define _IRR_USE_NVIDIA_PERFHUD_ to opt-in to using the nVidia PerHUD tool
308/** Enable, by opting-in, to use the nVidia PerfHUD performance analysis driver
309tool <http://developer.nvidia.com/object/nvperfhud_home.html>. */
310#undef _IRR_USE_NVIDIA_PERFHUD_
311
312//! Define one of the three setting for Burning's Video Software Rasterizer
313/** So if we were marketing guys we could say Irrlicht has 4 Software-Rasterizers.
314 In a Nutshell:
315 All Burnings Rasterizers use 32 Bit Backbuffer, 32Bit Texture & 32 Bit Z or WBuffer,
316 16 Bit/32 Bit can be adjusted on a global flag.
317
318 BURNINGVIDEO_RENDERER_BEAUTIFUL
319 32 Bit + Vertexcolor + Lighting + Per Pixel Perspective Correct + SubPixel/SubTexel Correct +
320 Bilinear Texturefiltering + WBuffer
321
322 BURNINGVIDEO_RENDERER_FAST
323 32 Bit + Per Pixel Perspective Correct + SubPixel/SubTexel Correct + WBuffer +
324 Bilinear Dithering TextureFiltering + WBuffer
325
326 BURNINGVIDEO_RENDERER_ULTRA_FAST
327 16Bit + SubPixel/SubTexel Correct + ZBuffer
328*/
329
330#define BURNINGVIDEO_RENDERER_BEAUTIFUL
331//#define BURNINGVIDEO_RENDERER_FAST
332//#define BURNINGVIDEO_RENDERER_ULTRA_FAST
333//#define BURNINGVIDEO_RENDERER_CE
334
335//! Uncomment the following line if you want to ignore the deprecated warnings
336//#define IGNORE_DEPRECATED_WARNING
337
338//! Define _IRR_COMPILE_WITH_IRR_SCENE_LOADER_ if you want to be able to load
339/** .irr scenes using ISceneManager::loadScene */
340#define _IRR_COMPILE_WITH_IRR_SCENE_LOADER_
341#ifdef NO_IRR_COMPILE_WITH_IRR_SCENE_LOADER_
342#undef _IRR_COMPILE_WITH_IRR_SCENE_LOADER_
343#endif
344
345//! Define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ if you want to use bone based
346/** animated meshes. If you compile without this, you will be unable to load
347B3D, MS3D or X meshes */
348#define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
349#ifdef NO_IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
350#undef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
351#endif
352
353#ifdef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
354//! Define _IRR_COMPILE_WITH_B3D_LOADER_ if you want to use Blitz3D files
355#define _IRR_COMPILE_WITH_B3D_LOADER_
356#ifdef NO_IRR_COMPILE_WITH_B3D_LOADER_
357#undef _IRR_COMPILE_WITH_B3D_LOADER_
358#endif
359//! Define _IRR_COMPILE_WITH_MS3D_LOADER_ if you want to Milkshape files
360#define _IRR_COMPILE_WITH_MS3D_LOADER_
361#ifdef NO_IRR_COMPILE_WITH_MS3D_LOADER_
362#undef _IRR_COMPILE_WITH_MS3D_LOADER_
363#endif
364//! Define _IRR_COMPILE_WITH_X_LOADER_ if you want to use Microsoft X files
365#define _IRR_COMPILE_WITH_X_LOADER_
366#ifdef NO_IRR_COMPILE_WITH_X_LOADER_
367#undef _IRR_COMPILE_WITH_X_LOADER_
368#endif
369//! Define _IRR_COMPILE_WITH_OGRE_LOADER_ if you want to load Ogre 3D files
370#define _IRR_COMPILE_WITH_OGRE_LOADER_
371#ifdef NO_IRR_COMPILE_WITH_OGRE_LOADER_
372#undef _IRR_COMPILE_WITH_OGRE_LOADER_
373#endif
374#endif // _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
375
376//! Define _IRR_COMPILE_WITH_IRR_MESH_LOADER_ if you want to load Irrlicht Engine .irrmesh files
377#define _IRR_COMPILE_WITH_IRR_MESH_LOADER_
378#ifdef NO_IRR_COMPILE_WITH_IRR_MESH_LOADER_
379#undef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
380#endif
381//! Define _IRR_COMPILE_WITH_HALFLIFE_LOADER_ if you want to load Halflife animated files
382#define _IRR_COMPILE_WITH_HALFLIFE_LOADER_
383#ifdef NO_IRR_COMPILE_WITH_HALFLIFE_LOADER_
384#undef _IRR_COMPILE_WITH_HALFLIFE_LOADER_
385#endif
386//! Define _IRR_COMPILE_WITH_MD2_LOADER_ if you want to load Quake 2 animated files
387#define _IRR_COMPILE_WITH_MD2_LOADER_
388#ifdef NO_IRR_COMPILE_WITH_MD2_LOADER_
389#undef _IRR_COMPILE_WITH_MD2_LOADER_
390#endif
391//! Define _IRR_COMPILE_WITH_MD3_LOADER_ if you want to load Quake 3 animated files
392#define _IRR_COMPILE_WITH_MD3_LOADER_
393#ifdef NO_IRR_COMPILE_WITH_MD3_LOADER_
394#undef _IRR_COMPILE_WITH_MD3_LOADER_
395#endif
396//! Define _IRR_COMPILE_WITH_3DS_LOADER_ if you want to load 3D Studio Max files
397#define _IRR_COMPILE_WITH_3DS_LOADER_
398#ifdef NO_IRR_COMPILE_WITH_3DS_LOADER_
399#undef _IRR_COMPILE_WITH_3DS_LOADER_
400#endif
401//! Define _IRR_COMPILE_WITH_COLLADA_LOADER_ if you want to load Collada files
402#define _IRR_COMPILE_WITH_COLLADA_LOADER_
403#ifdef NO_IRR_COMPILE_WITH_COLLADA_LOADER_
404#undef _IRR_COMPILE_WITH_COLLADA_LOADER_
405#endif
406//! Define _IRR_COMPILE_WITH_CSM_LOADER_ if you want to load Cartography Shop files
407#define _IRR_COMPILE_WITH_CSM_LOADER_
408#ifdef NO_IRR_COMPILE_WITH_CSM_LOADER_
409#undef _IRR_COMPILE_WITH_CSM_LOADER_
410#endif
411//! Define _IRR_COMPILE_WITH_BSP_LOADER_ if you want to load Quake 3 BSP files
412#define _IRR_COMPILE_WITH_BSP_LOADER_
413#ifdef NO_IRR_COMPILE_WITH_BSP_LOADER_
414#undef _IRR_COMPILE_WITH_BSP_LOADER_
415#endif
416//! Define _IRR_COMPILE_WITH_DMF_LOADER_ if you want to load DeleD files
417#define _IRR_COMPILE_WITH_DMF_LOADER_
418#ifdef NO_IRR_COMPILE_WITH_DMF_LOADER_
419#undef _IRR_COMPILE_WITH_DMF_LOADER_
420#endif
421//! Define _IRR_COMPILE_WITH_LMTS_LOADER_ if you want to load LMTools files
422#define _IRR_COMPILE_WITH_LMTS_LOADER_
423#ifdef NO_IRR_COMPILE_WITH_LMTS_LOADER_
424#undef _IRR_COMPILE_WITH_LMTS_LOADER_
425#endif
426//! Define _IRR_COMPILE_WITH_MY3D_LOADER_ if you want to load MY3D files
427#define _IRR_COMPILE_WITH_MY3D_LOADER_
428#ifdef NO_IRR_COMPILE_WITH_MY3D_LOADER_
429#undef _IRR_COMPILE_WITH_MY3D_LOADER_
430#endif
431//! Define _IRR_COMPILE_WITH_OBJ_LOADER_ if you want to load Wavefront OBJ files
432#define _IRR_COMPILE_WITH_OBJ_LOADER_
433#ifdef NO_IRR_COMPILE_WITH_OBJ_LOADER_
434#undef _IRR_COMPILE_WITH_OBJ_LOADER_
435#endif
436//! Define _IRR_COMPILE_WITH_OCT_LOADER_ if you want to load FSRad OCT files
437#define _IRR_COMPILE_WITH_OCT_LOADER_
438#ifdef NO_IRR_COMPILE_WITH_OCT_LOADER_
439#undef _IRR_COMPILE_WITH_OCT_LOADER_
440#endif
441//! Define _IRR_COMPILE_WITH_LWO_LOADER_ if you want to load Lightwave3D files
442#define _IRR_COMPILE_WITH_LWO_LOADER_
443#ifdef NO_IRR_COMPILE_WITH_LWO_LOADER_
444#undef _IRR_COMPILE_WITH_LWO_LOADER_
445#endif
446//! Define _IRR_COMPILE_WITH_STL_LOADER_ if you want to load stereolithography files
447#define _IRR_COMPILE_WITH_STL_LOADER_
448#ifdef NO_IRR_COMPILE_WITH_STL_LOADER_
449#undef _IRR_COMPILE_WITH_STL_LOADER_
450#endif
451//! Define _IRR_COMPILE_WITH_PLY_LOADER_ if you want to load Polygon (Stanford Triangle) files
452#define _IRR_COMPILE_WITH_PLY_LOADER_
453#ifdef NO_IRR_COMPILE_WITH_PLY_LOADER_
454#undef _IRR_COMPILE_WITH_PLY_LOADER_
455#endif
456//! Define _IRR_COMPILE_WITH_SMF_LOADER_ if you want to load 3D World Studio mesh files
457#define _IRR_COMPILE_WITH_SMF_LOADER_
458#ifdef NO_IRR_COMPILE_WITH_SMF_LOADER_
459#undef _IRR_COMPILE_WITH_SMF_LOADER_
460#endif
461
462//! Define _IRR_COMPILE_WITH_IRR_WRITER_ if you want to write static .irrMesh files
463#define _IRR_COMPILE_WITH_IRR_WRITER_
464#ifdef NO_IRR_COMPILE_WITH_IRR_WRITER_
465#undef _IRR_COMPILE_WITH_IRR_WRITER_
466#endif
467//! Define _IRR_COMPILE_WITH_COLLADA_WRITER_ if you want to write Collada files
468#define _IRR_COMPILE_WITH_COLLADA_WRITER_
469#ifdef NO_IRR_COMPILE_WITH_COLLADA_WRITER_
470#undef _IRR_COMPILE_WITH_COLLADA_WRITER_
471#endif
472//! Define _IRR_COMPILE_WITH_STL_WRITER_ if you want to write .stl files
473#define _IRR_COMPILE_WITH_STL_WRITER_
474#ifdef NO_IRR_COMPILE_WITH_STL_WRITER_
475#undef _IRR_COMPILE_WITH_STL_WRITER_
476#endif
477//! Define _IRR_COMPILE_WITH_OBJ_WRITER_ if you want to write .obj files
478#define _IRR_COMPILE_WITH_OBJ_WRITER_
479#ifdef NO_IRR_COMPILE_WITH_OBJ_WRITER_
480#undef _IRR_COMPILE_WITH_OBJ_WRITER_
481#endif
482//! Define _IRR_COMPILE_WITH_PLY_WRITER_ if you want to write .ply files
483#define _IRR_COMPILE_WITH_PLY_WRITER_
484#ifdef NO_IRR_COMPILE_WITH_PLY_WRITER_
485#undef _IRR_COMPILE_WITH_PLY_WRITER_
486#endif
487
488//! Define _IRR_COMPILE_WITH_BMP_LOADER_ if you want to load .bmp files
489//! Disabling this loader will also disable the built-in font
490#define _IRR_COMPILE_WITH_BMP_LOADER_
491#ifdef NO_IRR_COMPILE_WITH_BMP_LOADER_
492#undef _IRR_COMPILE_WITH_BMP_LOADER_
493#endif
494//! Define _IRR_COMPILE_WITH_JPG_LOADER_ if you want to load .jpg files
495#define _IRR_COMPILE_WITH_JPG_LOADER_
496#ifdef NO_IRR_COMPILE_WITH_JPG_LOADER_
497#undef _IRR_COMPILE_WITH_JPG_LOADER_
498#endif
499//! Define _IRR_COMPILE_WITH_PCX_LOADER_ if you want to load .pcx files
500#define _IRR_COMPILE_WITH_PCX_LOADER_
501#ifdef NO_IRR_COMPILE_WITH_PCX_LOADER_
502#undef _IRR_COMPILE_WITH_PCX_LOADER_
503#endif
504//! Define _IRR_COMPILE_WITH_PNG_LOADER_ if you want to load .png files
505#define _IRR_COMPILE_WITH_PNG_LOADER_
506#ifdef NO_IRR_COMPILE_WITH_PNG_LOADER_
507#undef _IRR_COMPILE_WITH_PNG_LOADER_
508#endif
509//! Define _IRR_COMPILE_WITH_PPM_LOADER_ if you want to load .ppm/.pgm/.pbm files
510#define _IRR_COMPILE_WITH_PPM_LOADER_
511#ifdef NO_IRR_COMPILE_WITH_PPM_LOADER_
512#undef _IRR_COMPILE_WITH_PPM_LOADER_
513#endif
514//! Define _IRR_COMPILE_WITH_PSD_LOADER_ if you want to load .psd files
515#define _IRR_COMPILE_WITH_PSD_LOADER_
516#ifdef NO_IRR_COMPILE_WITH_PSD_LOADER_
517#undef _IRR_COMPILE_WITH_PSD_LOADER_
518#endif
519//! Define _IRR_COMPILE_WITH_DDS_LOADER_ if you want to load .dds files
520// Outcommented because
521// a) it doesn't compile on 64-bit currently
522// b) anyone enabling it should be aware that S3TC compression algorithm which might be used in that loader
523// is patented in the US by S3 and they do collect license fees when it's used in applications.
524// So if you are unfortunate enough to develop applications for US market and their broken patent system be careful.
525// #define _IRR_COMPILE_WITH_DDS_LOADER_
526#ifdef NO_IRR_COMPILE_WITH_DDS_LOADER_
527#undef _IRR_COMPILE_WITH_DDS_LOADER_
528#endif
529//! Define _IRR_COMPILE_WITH_TGA_LOADER_ if you want to load .tga files
530#define _IRR_COMPILE_WITH_TGA_LOADER_
531#ifdef NO_IRR_COMPILE_WITH_TGA_LOADER_
532#undef _IRR_COMPILE_WITH_TGA_LOADER_
533#endif
534//! Define _IRR_COMPILE_WITH_WAL_LOADER_ if you want to load .wal files
535#define _IRR_COMPILE_WITH_WAL_LOADER_
536#ifdef NO_IRR_COMPILE_WITH_WAL_LOADER_
537#undef _IRR_COMPILE_WITH_WAL_LOADER_
538#endif
539//! Define _IRR_COMPILE_WITH_LMP_LOADER_ if you want to load .lmp files
540#define _IRR_COMPILE_WITH_LMP_LOADER_
541#ifdef NO_IRR_COMPILE_WITH_LMP_LOADER_
542#undef _IRR_COMPILE_WITH_LMP_LOADER_
543#endif
544//! Define _IRR_COMPILE_WITH_RGB_LOADER_ if you want to load Silicon Graphics .rgb/.rgba/.sgi/.int/.inta/.bw files
545#define _IRR_COMPILE_WITH_RGB_LOADER_
546#ifdef NO_IRR_COMPILE_WITH_RGB_LOADER_
547#undef _IRR_COMPILE_WITH_RGB_LOADER_
548#endif
549
550//! Define _IRR_COMPILE_WITH_BMP_WRITER_ if you want to write .bmp files
551#define _IRR_COMPILE_WITH_BMP_WRITER_
552#ifdef NO_IRR_COMPILE_WITH_BMP_WRITER_
553#undef _IRR_COMPILE_WITH_BMP_WRITER_
554#endif
555//! Define _IRR_COMPILE_WITH_JPG_WRITER_ if you want to write .jpg files
556#define _IRR_COMPILE_WITH_JPG_WRITER_
557#ifdef NO_IRR_COMPILE_WITH_JPG_WRITER_
558#undef _IRR_COMPILE_WITH_JPG_WRITER_
559#endif
560//! Define _IRR_COMPILE_WITH_PCX_WRITER_ if you want to write .pcx files
561#define _IRR_COMPILE_WITH_PCX_WRITER_
562#ifdef NO_IRR_COMPILE_WITH_PCX_WRITER_
563#undef _IRR_COMPILE_WITH_PCX_WRITER_
564#endif
565//! Define _IRR_COMPILE_WITH_PNG_WRITER_ if you want to write .png files
566#define _IRR_COMPILE_WITH_PNG_WRITER_
567#ifdef NO_IRR_COMPILE_WITH_PNG_WRITER_
568#undef _IRR_COMPILE_WITH_PNG_WRITER_
569#endif
570//! Define _IRR_COMPILE_WITH_PPM_WRITER_ if you want to write .ppm files
571#define _IRR_COMPILE_WITH_PPM_WRITER_
572#ifdef NO_IRR_COMPILE_WITH_PPM_WRITER_
573#undef _IRR_COMPILE_WITH_PPM_WRITER_
574#endif
575//! Define _IRR_COMPILE_WITH_PSD_WRITER_ if you want to write .psd files
576#define _IRR_COMPILE_WITH_PSD_WRITER_
577#ifdef NO_IRR_COMPILE_WITH_PSD_WRITER_
578#undef _IRR_COMPILE_WITH_PSD_WRITER_
579#endif
580//! Define _IRR_COMPILE_WITH_TGA_WRITER_ if you want to write .tga files
581#define _IRR_COMPILE_WITH_TGA_WRITER_
582#ifdef NO_IRR_COMPILE_WITH_TGA_WRITER_
583#undef _IRR_COMPILE_WITH_TGA_WRITER_
584#endif
585
586//! Define __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ if you want to open ZIP and GZIP archives
587/** ZIP reading has several more options below to configure. */
588#define __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
589#ifdef NO__IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
590#undef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
591#endif
592#ifdef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
593//! Define _IRR_COMPILE_WITH_ZLIB_ to enable compiling the engine using zlib.
594/** This enables the engine to read from compressed .zip archives. If you
595disable this feature, the engine can still read archives, but only uncompressed
596ones. */
597#define _IRR_COMPILE_WITH_ZLIB_
598#ifdef NO_IRR_COMPILE_WITH_ZLIB_
599#undef _IRR_COMPILE_WITH_ZLIB_
600#endif
601//! Define _IRR_USE_NON_SYSTEM_ZLIB_ to let irrlicht use the zlib which comes with irrlicht.
602/** If this is commented out, Irrlicht will try to compile using the zlib
603installed on the system. This is only used when _IRR_COMPILE_WITH_ZLIB_ is
604defined. */
605#define _IRR_USE_NON_SYSTEM_ZLIB_
606#ifdef NO_IRR_USE_NON_SYSTEM_ZLIB_
607#undef _IRR_USE_NON_SYSTEM_ZLIB_
608#endif
609//! Define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_ if you want to read AES-encrypted ZIP archives
610#define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
611#ifdef NO_IRR_COMPILE_WITH_ZIP_ENCRYPTION_
612#undef _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
613#endif
614//! Define _IRR_COMPILE_WITH_BZIP2_ if you want to support bzip2 compressed zip archives
615/** bzip2 is superior to the original zip file compression modes, but requires
616a certain amount of memory for decompression and adds several files to the
617library. */
618#define _IRR_COMPILE_WITH_BZIP2_
619#ifdef NO_IRR_COMPILE_WITH_BZIP2_
620#undef _IRR_COMPILE_WITH_BZIP2_
621#endif
622//! Define _IRR_USE_NON_SYSTEM_BZLIB_ to let irrlicht use the bzlib which comes with irrlicht.
623/** If this is commented out, Irrlicht will try to compile using the bzlib
624installed on the system. This is only used when _IRR_COMPILE_WITH_BZLIB_ is
625defined. */
626#define _IRR_USE_NON_SYSTEM_BZLIB_
627#ifdef NO_IRR_USE_NON_SYSTEM_BZLIB_
628#undef _IRR_USE_NON_SYSTEM_BZLIB_
629#endif
630//! Define _IRR_COMPILE_WITH_LZMA_ if you want to use LZMA compressed zip files.
631/** LZMA is a very efficient compression code, known from 7zip. Irrlicht
632currently only supports zip archives, though. */
633#define _IRR_COMPILE_WITH_LZMA_
634#ifdef NO_IRR_COMPILE_WITH_LZMA_
635#undef _IRR_COMPILE_WITH_LZMA_
636#endif
637#endif
638
639//! Define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ if you want to mount folders as archives
640#define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
641#ifdef NO__IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
642#undef __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
643#endif
644//! Define __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_ if you want to open ID software PAK archives
645#define __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_
646#ifdef NO__IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_
647#undef __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_
648#endif
649//! Define __IRR_COMPILE_WITH_NPK_ARCHIVE_LOADER_ if you want to open Nebula Device NPK archives
650#define __IRR_COMPILE_WITH_NPK_ARCHIVE_LOADER_
651#ifdef NO__IRR_COMPILE_WITH_NPK_ARCHIVE_LOADER_
652#undef __IRR_COMPILE_WITH_NPK_ARCHIVE_LOADER_
653#endif
654//! Define __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_ if you want to open TAR archives
655#define __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_
656#ifdef NO__IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_
657#undef __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_
658#endif
659//! Define __IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_ if you want to open WAD archives
660#define __IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_
661#ifdef NO__IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_
662#undef __IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_
663#endif
664
665//! Set FPU settings
666/** Irrlicht should use approximate float and integer fpu techniques
667precision will be lower but speed higher. currently X86 only
668*/
669#if !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_SOLARIS_PLATFORM_)
670 //#define IRRLICHT_FAST_MATH
671 #ifdef NO_IRRLICHT_FAST_MATH
672 #undef IRRLICHT_FAST_MATH
673 #endif
674#endif
675
676// Some cleanup and standard stuff
677
678#ifdef _IRR_WINDOWS_API_
679
680// To build Irrlicht as a static library, you must define _IRR_STATIC_LIB_ in both the
681// Irrlicht build, *and* in the user application, before #including <irrlicht.h>
682#ifndef _IRR_STATIC_LIB_
683#ifdef IRRLICHT_EXPORTS
684#define IRRLICHT_API __declspec(dllexport)
685#else
686#define IRRLICHT_API __declspec(dllimport)
687#endif // IRRLICHT_EXPORT
688#else
689#define IRRLICHT_API
690#endif // _IRR_STATIC_LIB_
691
692// Declare the calling convention.
693#if defined(_STDCALL_SUPPORTED)
694#define IRRCALLCONV __stdcall
695#else
696#define IRRCALLCONV __cdecl
697#endif // STDCALL_SUPPORTED
698
699#else // _IRR_WINDOWS_API_
700
701// Force symbol export in shared libraries built with gcc.
702#if (__GNUC__ >= 4) && !defined(_IRR_STATIC_LIB_) && defined(IRRLICHT_EXPORTS)
703#define IRRLICHT_API __attribute__ ((visibility("default")))
704#else
705#define IRRLICHT_API
706#endif
707
708#define IRRCALLCONV
709
710#endif // _IRR_WINDOWS_API_
711
712// We need to disable DIRECT3D9 support for Visual Studio 6.0 because
713// those $%&$!! disabled support for it since Dec. 2004 and users are complaining
714// about linker errors. Comment this out only if you are knowing what you are
715// doing. (Which means you have an old DX9 SDK and VisualStudio6).
716#ifdef _MSC_VER
717#if (_MSC_VER < 1300 && !defined(__GNUC__))
718#undef _IRR_COMPILE_WITH_DIRECT3D_9_
719#pragma message("Compiling Irrlicht with Visual Studio 6.0, support for DX9 is disabled.")
720#endif
721#endif
722
723// XBox does not have OpenGL or DirectX9
724#if defined(_IRR_XBOX_PLATFORM_)
725 #undef _IRR_COMPILE_WITH_OPENGL_
726 #undef _IRR_COMPILE_WITH_DIRECT3D_9_
727#endif
728
729//! WinCE does not have OpenGL or DirectX9. use minimal loaders
730#if defined(_WIN32_WCE)
731 #undef _IRR_COMPILE_WITH_OPENGL_
732 #undef _IRR_COMPILE_WITH_DIRECT3D_8_
733 #undef _IRR_COMPILE_WITH_DIRECT3D_9_
734
735 #undef BURNINGVIDEO_RENDERER_BEAUTIFUL
736 #undef BURNINGVIDEO_RENDERER_FAST
737 #undef BURNINGVIDEO_RENDERER_ULTRA_FAST
738 #define BURNINGVIDEO_RENDERER_CE
739
740 #undef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
741 #define _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_
742 //#define _IRR_WCHAR_FILESYSTEM
743
744 #undef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
745 //#undef _IRR_COMPILE_WITH_MD2_LOADER_
746 #undef _IRR_COMPILE_WITH_MD3_LOADER_
747 #undef _IRR_COMPILE_WITH_3DS_LOADER_
748 #undef _IRR_COMPILE_WITH_COLLADA_LOADER_
749 #undef _IRR_COMPILE_WITH_CSM_LOADER_
750 #undef _IRR_COMPILE_WITH_BSP_LOADER_
751 #undef _IRR_COMPILE_WITH_DMF_LOADER_
752 #undef _IRR_COMPILE_WITH_LMTS_LOADER_
753 #undef _IRR_COMPILE_WITH_MY3D_LOADER_
754 #undef _IRR_COMPILE_WITH_OBJ_LOADER_
755 #undef _IRR_COMPILE_WITH_OCT_LOADER_
756 #undef _IRR_COMPILE_WITH_OGRE_LOADER_
757 #undef _IRR_COMPILE_WITH_LWO_LOADER_
758 #undef _IRR_COMPILE_WITH_STL_LOADER_
759 #undef _IRR_COMPILE_WITH_IRR_WRITER_
760 #undef _IRR_COMPILE_WITH_COLLADA_WRITER_
761 #undef _IRR_COMPILE_WITH_STL_WRITER_
762 #undef _IRR_COMPILE_WITH_OBJ_WRITER_
763 //#undef _IRR_COMPILE_WITH_BMP_LOADER_
764 //#undef _IRR_COMPILE_WITH_JPG_LOADER_
765 #undef _IRR_COMPILE_WITH_PCX_LOADER_
766 //#undef _IRR_COMPILE_WITH_PNG_LOADER_
767 #undef _IRR_COMPILE_WITH_PPM_LOADER_
768 #undef _IRR_COMPILE_WITH_PSD_LOADER_
769 //#undef _IRR_COMPILE_WITH_TGA_LOADER_
770 #undef _IRR_COMPILE_WITH_WAL_LOADER_
771 #undef _IRR_COMPILE_WITH_BMP_WRITER_
772 #undef _IRR_COMPILE_WITH_JPG_WRITER_
773 #undef _IRR_COMPILE_WITH_PCX_WRITER_
774 #undef _IRR_COMPILE_WITH_PNG_WRITER_
775 #undef _IRR_COMPILE_WITH_PPM_WRITER_
776 #undef _IRR_COMPILE_WITH_PSD_WRITER_
777 #undef _IRR_COMPILE_WITH_TGA_WRITER_
778
779#endif
780
781#ifndef _IRR_WINDOWS_API_
782 #undef _IRR_WCHAR_FILESYSTEM
783#endif
784
785#if defined(__sparc__) || defined(__sun__)
786#define __BIG_ENDIAN__
787#endif
788
789#if defined(_IRR_SOLARIS_PLATFORM_)
790 #undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
791#endif
792
793//! Define __IRR_HAS_S64 if the irr::s64 type should be enable (needs long long, available on most platforms, but not part of ISO C++ 98)
794#define __IRR_HAS_S64
795#ifdef NO__IRR_HAS_S64
796#undef __IRR_HAS_S64
797#endif
798
799#if defined(__BORLANDC__)
800 #include <tchar.h>
801
802 // Borland 5.5.1 does not have _strcmpi defined
803 #if __BORLANDC__ == 0x551
804 // #define _strcmpi strcmpi
805 #undef _tfinddata_t
806 #undef _tfindfirst
807 #undef _tfindnext
808
809 #define _tfinddata_t __tfinddata_t
810 #define _tfindfirst __tfindfirst
811 #define _tfindnext __tfindnext
812 typedef long intptr_t;
813 #endif
814
815#endif
816
817#ifdef _DEBUG
818 //! A few attributes are written in CSceneManager when _IRR_SCENEMANAGER_DEBUG is enabled
819 // NOTE: Those attributes were used always until 1.8.0 and became a global define for 1.8.1
820 // which is only enabled in debug because it had a large (sometimes >5%) impact on speed.
821 // A better solution in the long run is to break the interface and remove _all_ attribute
822 // access in functions like CSceneManager::drawAll and instead put that information in some
823 // own struct/class or in CSceneManager.
824 // See http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=48211 for the discussion.
825 #define _IRR_SCENEMANAGER_DEBUG
826 #ifdef NO_IRR_SCENEMANAGER_DEBUG
827 #undef _IRR_SCENEMANAGER_DEBUG
828 #endif
829#endif
830
831#endif // __IRR_COMPILE_CONFIG_H_INCLUDED__
832
diff --git a/src/others/irrlicht-1.8.1/include/IrrlichtDevice.h b/src/others/irrlicht-1.8.1/include/IrrlichtDevice.h
new file mode 100644
index 0000000..9d4031e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IrrlichtDevice.h
@@ -0,0 +1,322 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_IRRLICHT_DEVICE_H_INCLUDED__
6#define __I_IRRLICHT_DEVICE_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "dimension2d.h"
10#include "IVideoDriver.h"
11#include "EDriverTypes.h"
12#include "EDeviceTypes.h"
13#include "IEventReceiver.h"
14#include "ICursorControl.h"
15#include "IVideoModeList.h"
16#include "ITimer.h"
17#include "IOSOperator.h"
18
19namespace irr
20{
21 class ILogger;
22 class IEventReceiver;
23 class IRandomizer;
24
25 namespace io {
26 class IFileSystem;
27 } // end namespace io
28
29 namespace gui {
30 class IGUIEnvironment;
31 } // end namespace gui
32
33 namespace scene {
34 class ISceneManager;
35 } // end namespace scene
36
37 //! The Irrlicht device. You can create it with createDevice() or createDeviceEx().
38 /** This is the most important class of the Irrlicht Engine. You can
39 access everything in the engine if you have a pointer to an instance of
40 this class. There should be only one instance of this class at any
41 time.
42 */
43 class IrrlichtDevice : public virtual IReferenceCounted
44 {
45 public:
46
47 //! Runs the device.
48 /** Also increments the virtual timer by calling
49 ITimer::tick();. You can prevent this
50 by calling ITimer::stop(); before and ITimer::start() after
51 calling IrrlichtDevice::run(). Returns false if device wants
52 to be deleted. Use it in this way:
53 \code
54 while(device->run())
55 {
56 // draw everything here
57 }
58 \endcode
59 If you want the device to do nothing if the window is inactive
60 (recommended), use the slightly enhanced code shown at isWindowActive().
61
62 Note if you are running Irrlicht inside an external, custom
63 created window: Calling Device->run() will cause Irrlicht to
64 dispatch windows messages internally.
65 If you are running Irrlicht in your own custom window, you can
66 also simply use your own message loop using GetMessage,
67 DispatchMessage and whatever and simply don't use this method.
68 But note that Irrlicht will not be able to fetch user input
69 then. See irr::SIrrlichtCreationParameters::WindowId for more
70 informations and example code.
71 */
72 virtual bool run() = 0;
73
74 //! Cause the device to temporarily pause execution and let other processes run.
75 /** This should bring down processor usage without major
76 performance loss for Irrlicht */
77 virtual void yield() = 0;
78
79 //! Pause execution and let other processes to run for a specified amount of time.
80 /** It may not wait the full given time, as sleep may be interrupted
81 \param timeMs: Time to sleep for in milisecs.
82 \param pauseTimer: If true, pauses the device timer while sleeping
83 */
84 virtual void sleep(u32 timeMs, bool pauseTimer=false) = 0;
85
86 //! Provides access to the video driver for drawing 3d and 2d geometry.
87 /** \return Pointer the video driver. */
88 virtual video::IVideoDriver* getVideoDriver() = 0;
89
90 //! Provides access to the virtual file system.
91 /** \return Pointer to the file system. */
92 virtual io::IFileSystem* getFileSystem() = 0;
93
94 //! Provides access to the 2d user interface environment.
95 /** \return Pointer to the gui environment. */
96 virtual gui::IGUIEnvironment* getGUIEnvironment() = 0;
97
98 //! Provides access to the scene manager.
99 /** \return Pointer to the scene manager. */
100 virtual scene::ISceneManager* getSceneManager() = 0;
101
102 //! Provides access to the cursor control.
103 /** \return Pointer to the mouse cursor control interface. */
104 virtual gui::ICursorControl* getCursorControl() = 0;
105
106 //! Provides access to the message logger.
107 /** \return Pointer to the logger. */
108 virtual ILogger* getLogger() = 0;
109
110 //! Gets a list with all video modes available.
111 /** If you are confused now, because you think you have to
112 create an Irrlicht Device with a video mode before being able
113 to get the video mode list, let me tell you that there is no
114 need to start up an Irrlicht Device with EDT_DIRECT3D8,
115 EDT_OPENGL or EDT_SOFTWARE: For this (and for lots of other
116 reasons) the null driver, EDT_NULL exists.
117 \return Pointer to a list with all video modes supported
118 by the gfx adapter. */
119 virtual video::IVideoModeList* getVideoModeList() = 0;
120
121 //! Provides access to the operation system operator object.
122 /** The OS operator provides methods for
123 getting system specific informations and doing system
124 specific operations, such as exchanging data with the clipboard
125 or reading the operation system version.
126 \return Pointer to the OS operator. */
127 virtual IOSOperator* getOSOperator() = 0;
128
129 //! Provides access to the engine's timer.
130 /** The system time can be retrieved by it as
131 well as the virtual time, which also can be manipulated.
132 \return Pointer to the ITimer object. */
133 virtual ITimer* getTimer() = 0;
134
135 //! Provides access to the engine's currently set randomizer.
136 /** \return Pointer to the IRandomizer object. */
137 virtual IRandomizer* getRandomizer() const =0;
138
139 //! Sets a new randomizer.
140 /** \param r Pointer to the new IRandomizer object. This object is
141 grab()'ed by the engine and will be released upon the next setRandomizer
142 call or upon device destruction. */
143 virtual void setRandomizer(IRandomizer* r) =0;
144
145 //! Creates a new default randomizer.
146 /** The default randomizer provides the random sequence known from previous
147 Irrlicht versions and is the initial randomizer set on device creation.
148 \return Pointer to the default IRandomizer object. */
149 virtual IRandomizer* createDefaultRandomizer() const =0;
150
151 //! Sets the caption of the window.
152 /** \param text: New text of the window caption. */
153 virtual void setWindowCaption(const wchar_t* text) = 0;
154
155 //! Returns if the window is active.
156 /** If the window is inactive,
157 nothing needs to be drawn. So if you don't want to draw anything
158 when the window is inactive, create your drawing loop this way:
159 \code
160 while(device->run())
161 {
162 if (device->isWindowActive())
163 {
164 // draw everything here
165 }
166 else
167 device->yield();
168 }
169 \endcode
170 \return True if window is active. */
171 virtual bool isWindowActive() const = 0;
172
173 //! Checks if the Irrlicht window has focus
174 /** \return True if window has focus. */
175 virtual bool isWindowFocused() const = 0;
176
177 //! Checks if the Irrlicht window is minimized
178 /** \return True if window is minimized. */
179 virtual bool isWindowMinimized() const = 0;
180
181 //! Checks if the Irrlicht window is running in fullscreen mode
182 /** \return True if window is fullscreen. */
183 virtual bool isFullscreen() const = 0;
184
185 //! Get the current color format of the window
186 /** \return Color format of the window. */
187 virtual video::ECOLOR_FORMAT getColorFormat() const = 0;
188
189 //! Notifies the device that it should close itself.
190 /** IrrlichtDevice::run() will always return false after closeDevice() was called. */
191 virtual void closeDevice() = 0;
192
193 //! Get the version of the engine.
194 /** The returned string
195 will look like this: "1.2.3" or this: "1.2".
196 \return String which contains the version. */
197 virtual const c8* getVersion() const = 0;
198
199 //! Sets a new user event receiver which will receive events from the engine.
200 /** Return true in IEventReceiver::OnEvent to prevent the event from continuing along
201 the chain of event receivers. The path that an event takes through the system depends
202 on its type. See irr::EEVENT_TYPE for details.
203 \param receiver New receiver to be used. */
204 virtual void setEventReceiver(IEventReceiver* receiver) = 0;
205
206 //! Provides access to the current event receiver.
207 /** \return Pointer to the current event receiver. Returns 0 if there is none. */
208 virtual IEventReceiver* getEventReceiver() = 0;
209
210 //! Sends a user created event to the engine.
211 /** Is is usually not necessary to use this. However, if you
212 are using an own input library for example for doing joystick
213 input, you can use this to post key or mouse input events to
214 the engine. Internally, this method only delegates the events
215 further to the scene manager and the GUI environment. */
216 virtual bool postEventFromUser(const SEvent& event) = 0;
217
218 //! Sets the input receiving scene manager.
219 /** If set to null, the main scene manager (returned by
220 GetSceneManager()) will receive the input
221 \param sceneManager New scene manager to be used. */
222 virtual void setInputReceivingSceneManager(scene::ISceneManager* sceneManager) = 0;
223
224 //! Sets if the window should be resizable in windowed mode.
225 /** The default is false. This method only works in windowed
226 mode.
227 \param resize Flag whether the window should be resizable. */
228 virtual void setResizable(bool resize=false) = 0;
229
230 //! Minimizes the window if possible.
231 virtual void minimizeWindow() =0;
232
233 //! Maximizes the window if possible.
234 virtual void maximizeWindow() =0;
235
236 //! Restore the window to normal size if possible.
237 virtual void restoreWindow() =0;
238
239 //! Activate any joysticks, and generate events for them.
240 /** Irrlicht contains support for joysticks, but does not generate joystick events by default,
241 as this would consume joystick info that 3rd party libraries might rely on. Call this method to
242 activate joystick support in Irrlicht and to receive irr::SJoystickEvent events.
243 \param joystickInfo On return, this will contain an array of each joystick that was found and activated.
244 \return true if joysticks are supported on this device and _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
245 is defined, false if joysticks are not supported or support is compiled out.
246 */
247 virtual bool activateJoysticks(core::array<SJoystickInfo>& joystickInfo) =0;
248
249 //! Set the current Gamma Value for the Display
250 virtual bool setGammaRamp(f32 red, f32 green, f32 blue,
251 f32 relativebrightness, f32 relativecontrast) =0;
252
253 //! Get the current Gamma Value for the Display
254 virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
255 f32 &brightness, f32 &contrast) =0;
256
257 //! Remove messages pending in the system message loop
258 /** This function is usually used after messages have been buffered for a longer time, for example
259 when loading a large scene. Clearing the message loop prevents that mouse- or buttonclicks which users
260 have pressed in the meantime will now trigger unexpected actions in the gui. <br>
261 So far the following messages are cleared:<br>
262 Win32: All keyboard and mouse messages<br>
263 Linux: All keyboard and mouse messages<br>
264 All other devices are not yet supported here.<br>
265 The function is still somewhat experimental, as the kind of messages we clear is based on just a few use-cases.
266 If you think further messages should be cleared, or some messages should not be cleared here, then please tell us. */
267 virtual void clearSystemMessages() = 0;
268
269 //! Get the type of the device.
270 /** This allows the user to check which windowing system is currently being
271 used. */
272 virtual E_DEVICE_TYPE getType() const = 0;
273
274 //! Check if a driver type is supported by the engine.
275 /** Even if true is returned the driver may not be available
276 for a configuration requested when creating the device. */
277 static bool isDriverSupported(video::E_DRIVER_TYPE driver)
278 {
279 switch (driver)
280 {
281 case video::EDT_NULL:
282 return true;
283 case video::EDT_SOFTWARE:
284#ifdef _IRR_COMPILE_WITH_SOFTWARE_
285 return true;
286#else
287 return false;
288#endif
289 case video::EDT_BURNINGSVIDEO:
290#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
291 return true;
292#else
293 return false;
294#endif
295 case video::EDT_DIRECT3D8:
296#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
297 return true;
298#else
299 return false;
300#endif
301 case video::EDT_DIRECT3D9:
302#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
303 return true;
304#else
305 return false;
306#endif
307 case video::EDT_OPENGL:
308#ifdef _IRR_COMPILE_WITH_OPENGL_
309 return true;
310#else
311 return false;
312#endif
313 default:
314 return false;
315 }
316 }
317 };
318
319} // end namespace irr
320
321#endif
322
diff --git a/src/others/irrlicht-1.8.1/include/Keycodes.h b/src/others/irrlicht-1.8.1/include/Keycodes.h
new file mode 100644
index 0000000..2e95c8c
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/Keycodes.h
@@ -0,0 +1,173 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_KEY_CODES_H_INCLUDED__
6#define __IRR_KEY_CODES_H_INCLUDED__
7
8namespace irr
9{
10
11 enum EKEY_CODE
12 {
13 KEY_LBUTTON = 0x01, // Left mouse button
14 KEY_RBUTTON = 0x02, // Right mouse button
15 KEY_CANCEL = 0x03, // Control-break processing
16 KEY_MBUTTON = 0x04, // Middle mouse button (three-button mouse)
17 KEY_XBUTTON1 = 0x05, // Windows 2000/XP: X1 mouse button
18 KEY_XBUTTON2 = 0x06, // Windows 2000/XP: X2 mouse button
19 KEY_BACK = 0x08, // BACKSPACE key
20 KEY_TAB = 0x09, // TAB key
21 KEY_CLEAR = 0x0C, // CLEAR key
22 KEY_RETURN = 0x0D, // ENTER key
23 KEY_SHIFT = 0x10, // SHIFT key
24 KEY_CONTROL = 0x11, // CTRL key
25 KEY_MENU = 0x12, // ALT key
26 KEY_PAUSE = 0x13, // PAUSE key
27 KEY_CAPITAL = 0x14, // CAPS LOCK key
28 KEY_KANA = 0x15, // IME Kana mode
29 KEY_HANGUEL = 0x15, // IME Hanguel mode (maintained for compatibility use KEY_HANGUL)
30 KEY_HANGUL = 0x15, // IME Hangul mode
31 KEY_JUNJA = 0x17, // IME Junja mode
32 KEY_FINAL = 0x18, // IME final mode
33 KEY_HANJA = 0x19, // IME Hanja mode
34 KEY_KANJI = 0x19, // IME Kanji mode
35 KEY_ESCAPE = 0x1B, // ESC key
36 KEY_CONVERT = 0x1C, // IME convert
37 KEY_NONCONVERT = 0x1D, // IME nonconvert
38 KEY_ACCEPT = 0x1E, // IME accept
39 KEY_MODECHANGE = 0x1F, // IME mode change request
40 KEY_SPACE = 0x20, // SPACEBAR
41 KEY_PRIOR = 0x21, // PAGE UP key
42 KEY_NEXT = 0x22, // PAGE DOWN key
43 KEY_END = 0x23, // END key
44 KEY_HOME = 0x24, // HOME key
45 KEY_LEFT = 0x25, // LEFT ARROW key
46 KEY_UP = 0x26, // UP ARROW key
47 KEY_RIGHT = 0x27, // RIGHT ARROW key
48 KEY_DOWN = 0x28, // DOWN ARROW key
49 KEY_SELECT = 0x29, // SELECT key
50 KEY_PRINT = 0x2A, // PRINT key
51 KEY_EXECUT = 0x2B, // EXECUTE key
52 KEY_SNAPSHOT = 0x2C, // PRINT SCREEN key
53 KEY_INSERT = 0x2D, // INS key
54 KEY_DELETE = 0x2E, // DEL key
55 KEY_HELP = 0x2F, // HELP key
56 KEY_KEY_0 = 0x30, // 0 key
57 KEY_KEY_1 = 0x31, // 1 key
58 KEY_KEY_2 = 0x32, // 2 key
59 KEY_KEY_3 = 0x33, // 3 key
60 KEY_KEY_4 = 0x34, // 4 key
61 KEY_KEY_5 = 0x35, // 5 key
62 KEY_KEY_6 = 0x36, // 6 key
63 KEY_KEY_7 = 0x37, // 7 key
64 KEY_KEY_8 = 0x38, // 8 key
65 KEY_KEY_9 = 0x39, // 9 key
66 KEY_KEY_A = 0x41, // A key
67 KEY_KEY_B = 0x42, // B key
68 KEY_KEY_C = 0x43, // C key
69 KEY_KEY_D = 0x44, // D key
70 KEY_KEY_E = 0x45, // E key
71 KEY_KEY_F = 0x46, // F key
72 KEY_KEY_G = 0x47, // G key
73 KEY_KEY_H = 0x48, // H key
74 KEY_KEY_I = 0x49, // I key
75 KEY_KEY_J = 0x4A, // J key
76 KEY_KEY_K = 0x4B, // K key
77 KEY_KEY_L = 0x4C, // L key
78 KEY_KEY_M = 0x4D, // M key
79 KEY_KEY_N = 0x4E, // N key
80 KEY_KEY_O = 0x4F, // O key
81 KEY_KEY_P = 0x50, // P key
82 KEY_KEY_Q = 0x51, // Q key
83 KEY_KEY_R = 0x52, // R key
84 KEY_KEY_S = 0x53, // S key
85 KEY_KEY_T = 0x54, // T key
86 KEY_KEY_U = 0x55, // U key
87 KEY_KEY_V = 0x56, // V key
88 KEY_KEY_W = 0x57, // W key
89 KEY_KEY_X = 0x58, // X key
90 KEY_KEY_Y = 0x59, // Y key
91 KEY_KEY_Z = 0x5A, // Z key
92 KEY_LWIN = 0x5B, // Left Windows key (Microsoft® Natural® keyboard)
93 KEY_RWIN = 0x5C, // Right Windows key (Natural keyboard)
94 KEY_APPS = 0x5D, // Applications key (Natural keyboard)
95 KEY_SLEEP = 0x5F, // Computer Sleep key
96 KEY_NUMPAD0 = 0x60, // Numeric keypad 0 key
97 KEY_NUMPAD1 = 0x61, // Numeric keypad 1 key
98 KEY_NUMPAD2 = 0x62, // Numeric keypad 2 key
99 KEY_NUMPAD3 = 0x63, // Numeric keypad 3 key
100 KEY_NUMPAD4 = 0x64, // Numeric keypad 4 key
101 KEY_NUMPAD5 = 0x65, // Numeric keypad 5 key
102 KEY_NUMPAD6 = 0x66, // Numeric keypad 6 key
103 KEY_NUMPAD7 = 0x67, // Numeric keypad 7 key
104 KEY_NUMPAD8 = 0x68, // Numeric keypad 8 key
105 KEY_NUMPAD9 = 0x69, // Numeric keypad 9 key
106 KEY_MULTIPLY = 0x6A, // Multiply key
107 KEY_ADD = 0x6B, // Add key
108 KEY_SEPARATOR = 0x6C, // Separator key
109 KEY_SUBTRACT = 0x6D, // Subtract key
110 KEY_DECIMAL = 0x6E, // Decimal key
111 KEY_DIVIDE = 0x6F, // Divide key
112 KEY_F1 = 0x70, // F1 key
113 KEY_F2 = 0x71, // F2 key
114 KEY_F3 = 0x72, // F3 key
115 KEY_F4 = 0x73, // F4 key
116 KEY_F5 = 0x74, // F5 key
117 KEY_F6 = 0x75, // F6 key
118 KEY_F7 = 0x76, // F7 key
119 KEY_F8 = 0x77, // F8 key
120 KEY_F9 = 0x78, // F9 key
121 KEY_F10 = 0x79, // F10 key
122 KEY_F11 = 0x7A, // F11 key
123 KEY_F12 = 0x7B, // F12 key
124 KEY_F13 = 0x7C, // F13 key
125 KEY_F14 = 0x7D, // F14 key
126 KEY_F15 = 0x7E, // F15 key
127 KEY_F16 = 0x7F, // F16 key
128 KEY_F17 = 0x80, // F17 key
129 KEY_F18 = 0x81, // F18 key
130 KEY_F19 = 0x82, // F19 key
131 KEY_F20 = 0x83, // F20 key
132 KEY_F21 = 0x84, // F21 key
133 KEY_F22 = 0x85, // F22 key
134 KEY_F23 = 0x86, // F23 key
135 KEY_F24 = 0x87, // F24 key
136 KEY_NUMLOCK = 0x90, // NUM LOCK key
137 KEY_SCROLL = 0x91, // SCROLL LOCK key
138 KEY_LSHIFT = 0xA0, // Left SHIFT key
139 KEY_RSHIFT = 0xA1, // Right SHIFT key
140 KEY_LCONTROL = 0xA2, // Left CONTROL key
141 KEY_RCONTROL = 0xA3, // Right CONTROL key
142 KEY_LMENU = 0xA4, // Left MENU key
143 KEY_RMENU = 0xA5, // Right MENU key
144 KEY_OEM_1 = 0xBA, // for US ";:"
145 KEY_PLUS = 0xBB, // Plus Key "+"
146 KEY_COMMA = 0xBC, // Comma Key ","
147 KEY_MINUS = 0xBD, // Minus Key "-"
148 KEY_PERIOD = 0xBE, // Period Key "."
149 KEY_OEM_2 = 0xBF, // for US "/?"
150 KEY_OEM_3 = 0xC0, // for US "`~"
151 KEY_OEM_4 = 0xDB, // for US "[{"
152 KEY_OEM_5 = 0xDC, // for US "\|"
153 KEY_OEM_6 = 0xDD, // for US "]}"
154 KEY_OEM_7 = 0xDE, // for US "'""
155 KEY_OEM_8 = 0xDF, // None
156 KEY_OEM_AX = 0xE1, // for Japan "AX"
157 KEY_OEM_102 = 0xE2, // "<>" or "\|"
158 KEY_ATTN = 0xF6, // Attn key
159 KEY_CRSEL = 0xF7, // CrSel key
160 KEY_EXSEL = 0xF8, // ExSel key
161 KEY_EREOF = 0xF9, // Erase EOF key
162 KEY_PLAY = 0xFA, // Play key
163 KEY_ZOOM = 0xFB, // Zoom key
164 KEY_PA1 = 0xFD, // PA1 key
165 KEY_OEM_CLEAR = 0xFE, // Clear key
166
167 KEY_KEY_CODES_COUNT = 0xFF // this is not a key, but the amount of keycodes there are.
168 };
169
170} // end namespace irr
171
172#endif
173
diff --git a/src/others/irrlicht-1.8.1/include/S3DVertex.h b/src/others/irrlicht-1.8.1/include/S3DVertex.h
new file mode 100644
index 0000000..bf0fd5b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/S3DVertex.h
@@ -0,0 +1,274 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_3D_VERTEX_H_INCLUDED__
6#define __S_3D_VERTEX_H_INCLUDED__
7
8#include "vector3d.h"
9#include "vector2d.h"
10#include "SColor.h"
11
12namespace irr
13{
14namespace video
15{
16
17//! Enumeration for all vertex types there are.
18enum E_VERTEX_TYPE
19{
20 //! Standard vertex type used by the Irrlicht engine, video::S3DVertex.
21 EVT_STANDARD = 0,
22
23 //! Vertex with two texture coordinates, video::S3DVertex2TCoords.
24 /** Usually used for geometry with lightmaps or other special materials. */
25 EVT_2TCOORDS,
26
27 //! Vertex with a tangent and binormal vector, video::S3DVertexTangents.
28 /** Usually used for tangent space normal mapping. */
29 EVT_TANGENTS
30};
31
32//! Array holding the built in vertex type names
33const char* const sBuiltInVertexTypeNames[] =
34{
35 "standard",
36 "2tcoords",
37 "tangents",
38 0
39};
40
41//! standard vertex used by the Irrlicht engine.
42struct S3DVertex
43{
44 //! default constructor
45 S3DVertex() {}
46
47 //! constructor
48 S3DVertex(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)
49 : Pos(x,y,z), Normal(nx,ny,nz), Color(c), TCoords(tu,tv) {}
50
51 //! constructor
52 S3DVertex(const core::vector3df& pos, const core::vector3df& normal,
53 SColor color, const core::vector2d<f32>& tcoords)
54 : Pos(pos), Normal(normal), Color(color), TCoords(tcoords) {}
55
56 //! Position
57 core::vector3df Pos;
58
59 //! Normal vector
60 core::vector3df Normal;
61
62 //! Color
63 SColor Color;
64
65 //! Texture coordinates
66 core::vector2d<f32> TCoords;
67
68 bool operator==(const S3DVertex& other) const
69 {
70 return ((Pos == other.Pos) && (Normal == other.Normal) &&
71 (Color == other.Color) && (TCoords == other.TCoords));
72 }
73
74 bool operator!=(const S3DVertex& other) const
75 {
76 return ((Pos != other.Pos) || (Normal != other.Normal) ||
77 (Color != other.Color) || (TCoords != other.TCoords));
78 }
79
80 bool operator<(const S3DVertex& other) const
81 {
82 return ((Pos < other.Pos) ||
83 ((Pos == other.Pos) && (Normal < other.Normal)) ||
84 ((Pos == other.Pos) && (Normal == other.Normal) && (Color < other.Color)) ||
85 ((Pos == other.Pos) && (Normal == other.Normal) && (Color == other.Color) && (TCoords < other.TCoords)));
86 }
87
88 E_VERTEX_TYPE getType() const
89 {
90 return EVT_STANDARD;
91 }
92
93 S3DVertex getInterpolated(const S3DVertex& other, f32 d)
94 {
95 d = core::clamp(d, 0.0f, 1.0f);
96 return S3DVertex(Pos.getInterpolated(other.Pos, d),
97 Normal.getInterpolated(other.Normal, d),
98 Color.getInterpolated(other.Color, d),
99 TCoords.getInterpolated(other.TCoords, d));
100 }
101};
102
103
104//! Vertex with two texture coordinates.
105/** Usually used for geometry with lightmaps
106or other special materials.
107*/
108struct S3DVertex2TCoords : public S3DVertex
109{
110 //! default constructor
111 S3DVertex2TCoords() : S3DVertex() {}
112
113 //! constructor with two different texture coords, but no normal
114 S3DVertex2TCoords(f32 x, f32 y, f32 z, SColor c, f32 tu, f32 tv, f32 tu2, f32 tv2)
115 : S3DVertex(x,y,z, 0.0f, 0.0f, 0.0f, c, tu,tv), TCoords2(tu2,tv2) {}
116
117 //! constructor with two different texture coords, but no normal
118 S3DVertex2TCoords(const core::vector3df& pos, SColor color,
119 const core::vector2d<f32>& tcoords, const core::vector2d<f32>& tcoords2)
120 : S3DVertex(pos, core::vector3df(), color, tcoords), TCoords2(tcoords2) {}
121
122 //! constructor with all values
123 S3DVertex2TCoords(const core::vector3df& pos, const core::vector3df& normal, const SColor& color,
124 const core::vector2d<f32>& tcoords, const core::vector2d<f32>& tcoords2)
125 : S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords2) {}
126
127 //! constructor with all values
128 S3DVertex2TCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv, f32 tu2, f32 tv2)
129 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), TCoords2(tu2,tv2) {}
130
131 //! constructor with the same texture coords and normal
132 S3DVertex2TCoords(f32 x, f32 y, f32 z, f32 nx, f32 ny, f32 nz, SColor c, f32 tu, f32 tv)
133 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), TCoords2(tu,tv) {}
134
135 //! constructor with the same texture coords and normal
136 S3DVertex2TCoords(const core::vector3df& pos, const core::vector3df& normal,
137 SColor color, const core::vector2d<f32>& tcoords)
138 : S3DVertex(pos, normal, color, tcoords), TCoords2(tcoords) {}
139
140 //! constructor from S3DVertex
141 S3DVertex2TCoords(S3DVertex& o) : S3DVertex(o) {}
142
143 //! Second set of texture coordinates
144 core::vector2d<f32> TCoords2;
145
146 //! Equality operator
147 bool operator==(const S3DVertex2TCoords& other) const
148 {
149 return ((static_cast<S3DVertex>(*this)==other) &&
150 (TCoords2 == other.TCoords2));
151 }
152
153 //! Inequality operator
154 bool operator!=(const S3DVertex2TCoords& other) const
155 {
156 return ((static_cast<S3DVertex>(*this)!=other) ||
157 (TCoords2 != other.TCoords2));
158 }
159
160 bool operator<(const S3DVertex2TCoords& other) const
161 {
162 return ((static_cast<S3DVertex>(*this) < other) ||
163 ((static_cast<S3DVertex>(*this) == other) && (TCoords2 < other.TCoords2)));
164 }
165
166 E_VERTEX_TYPE getType() const
167 {
168 return EVT_2TCOORDS;
169 }
170
171 S3DVertex2TCoords getInterpolated(const S3DVertex2TCoords& other, f32 d)
172 {
173 d = core::clamp(d, 0.0f, 1.0f);
174 return S3DVertex2TCoords(Pos.getInterpolated(other.Pos, d),
175 Normal.getInterpolated(other.Normal, d),
176 Color.getInterpolated(other.Color, d),
177 TCoords.getInterpolated(other.TCoords, d),
178 TCoords2.getInterpolated(other.TCoords2, d));
179 }
180};
181
182
183//! Vertex with a tangent and binormal vector.
184/** Usually used for tangent space normal mapping. */
185struct S3DVertexTangents : public S3DVertex
186{
187 //! default constructor
188 S3DVertexTangents() : S3DVertex() { }
189
190 //! constructor
191 S3DVertexTangents(f32 x, f32 y, f32 z, f32 nx=0.0f, f32 ny=0.0f, f32 nz=0.0f,
192 SColor c = 0xFFFFFFFF, f32 tu=0.0f, f32 tv=0.0f,
193 f32 tanx=0.0f, f32 tany=0.0f, f32 tanz=0.0f,
194 f32 bx=0.0f, f32 by=0.0f, f32 bz=0.0f)
195 : S3DVertex(x,y,z, nx,ny,nz, c, tu,tv), Tangent(tanx,tany,tanz), Binormal(bx,by,bz) { }
196
197 //! constructor
198 S3DVertexTangents(const core::vector3df& pos, SColor c,
199 const core::vector2df& tcoords)
200 : S3DVertex(pos, core::vector3df(), c, tcoords) { }
201
202 //! constructor
203 S3DVertexTangents(const core::vector3df& pos,
204 const core::vector3df& normal, SColor c,
205 const core::vector2df& tcoords,
206 const core::vector3df& tangent=core::vector3df(),
207 const core::vector3df& binormal=core::vector3df())
208 : S3DVertex(pos, normal, c, tcoords), Tangent(tangent), Binormal(binormal) { }
209
210 //! Tangent vector along the x-axis of the texture
211 core::vector3df Tangent;
212
213 //! Binormal vector (tangent x normal)
214 core::vector3df Binormal;
215
216 bool operator==(const S3DVertexTangents& other) const
217 {
218 return ((static_cast<S3DVertex>(*this)==other) &&
219 (Tangent == other.Tangent) &&
220 (Binormal == other.Binormal));
221 }
222
223 bool operator!=(const S3DVertexTangents& other) const
224 {
225 return ((static_cast<S3DVertex>(*this)!=other) ||
226 (Tangent != other.Tangent) ||
227 (Binormal != other.Binormal));
228 }
229
230 bool operator<(const S3DVertexTangents& other) const
231 {
232 return ((static_cast<S3DVertex>(*this) < other) ||
233 ((static_cast<S3DVertex>(*this) == other) && (Tangent < other.Tangent)) ||
234 ((static_cast<S3DVertex>(*this) == other) && (Tangent == other.Tangent) && (Binormal < other.Binormal)));
235 }
236
237 E_VERTEX_TYPE getType() const
238 {
239 return EVT_TANGENTS;
240 }
241
242 S3DVertexTangents getInterpolated(const S3DVertexTangents& other, f32 d)
243 {
244 d = core::clamp(d, 0.0f, 1.0f);
245 return S3DVertexTangents(Pos.getInterpolated(other.Pos, d),
246 Normal.getInterpolated(other.Normal, d),
247 Color.getInterpolated(other.Color, d),
248 TCoords.getInterpolated(other.TCoords, d),
249 Tangent.getInterpolated(other.Tangent, d),
250 Binormal.getInterpolated(other.Binormal, d));
251 }
252};
253
254
255
256inline u32 getVertexPitchFromType(E_VERTEX_TYPE vertexType)
257{
258 switch (vertexType)
259 {
260 case video::EVT_2TCOORDS:
261 return sizeof(video::S3DVertex2TCoords);
262 case video::EVT_TANGENTS:
263 return sizeof(video::S3DVertexTangents);
264 default:
265 return sizeof(video::S3DVertex);
266 }
267}
268
269
270} // end namespace video
271} // end namespace irr
272
273#endif
274
diff --git a/src/others/irrlicht-1.8.1/include/SAnimatedMesh.h b/src/others/irrlicht-1.8.1/include/SAnimatedMesh.h
new file mode 100644
index 0000000..ced4060
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SAnimatedMesh.h
@@ -0,0 +1,189 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_ANIMATED_MESH_H_INCLUDED__
6#define __S_ANIMATED_MESH_H_INCLUDED__
7
8#include "IAnimatedMesh.h"
9#include "IMesh.h"
10#include "aabbox3d.h"
11#include "irrArray.h"
12
13namespace irr
14{
15namespace scene
16{
17
18 //! Simple implementation of the IAnimatedMesh interface.
19 struct SAnimatedMesh : public IAnimatedMesh
20 {
21 //! constructor
22 SAnimatedMesh(scene::IMesh* mesh=0, scene::E_ANIMATED_MESH_TYPE type=scene::EAMT_UNKNOWN) : IAnimatedMesh(), FramesPerSecond(25.f), Type(type)
23 {
24 #ifdef _DEBUG
25 setDebugName("SAnimatedMesh");
26 #endif
27 addMesh(mesh);
28 recalculateBoundingBox();
29 }
30
31 //! destructor
32 virtual ~SAnimatedMesh()
33 {
34 // drop meshes
35 for (u32 i=0; i<Meshes.size(); ++i)
36 Meshes[i]->drop();
37 }
38
39 //! Gets the frame count of the animated mesh.
40 /** \return Amount of frames. If the amount is 1, it is a static, non animated mesh. */
41 virtual u32 getFrameCount() const
42 {
43 return Meshes.size();
44 }
45
46 //! Gets the default animation speed of the animated mesh.
47 /** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */
48 virtual f32 getAnimationSpeed() const
49 {
50 return FramesPerSecond;
51 }
52
53 //! Gets the frame count of the animated mesh.
54 /** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated.
55 The actual speed is set in the scene node the mesh is instantiated in.*/
56 virtual void setAnimationSpeed(f32 fps)
57 {
58 FramesPerSecond=fps;
59 }
60
61 //! Returns the IMesh interface for a frame.
62 /** \param frame: Frame number as zero based index. The maximum frame number is
63 getFrameCount() - 1;
64 \param detailLevel: Level of detail. 0 is the lowest,
65 255 the highest level of detail. Most meshes will ignore the detail level.
66 \param startFrameLoop: start frame
67 \param endFrameLoop: end frame
68 \return The animated mesh based on a detail level. */
69 virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1)
70 {
71 if (Meshes.empty())
72 return 0;
73
74 return Meshes[frame];
75 }
76
77 //! adds a Mesh
78 void addMesh(IMesh* mesh)
79 {
80 if (mesh)
81 {
82 mesh->grab();
83 Meshes.push_back(mesh);
84 }
85 }
86
87 //! Returns an axis aligned bounding box of the mesh.
88 /** \return A bounding box of this mesh is returned. */
89 virtual const core::aabbox3d<f32>& getBoundingBox() const
90 {
91 return Box;
92 }
93
94 //! set user axis aligned bounding box
95 virtual void setBoundingBox(const core::aabbox3df& box)
96 {
97 Box = box;
98 }
99
100 //! Recalculates the bounding box.
101 void recalculateBoundingBox()
102 {
103 Box.reset(0,0,0);
104
105 if (Meshes.empty())
106 return;
107
108 Box = Meshes[0]->getBoundingBox();
109
110 for (u32 i=1; i<Meshes.size(); ++i)
111 Box.addInternalBox(Meshes[i]->getBoundingBox());
112 }
113
114 //! Returns the type of the animated mesh.
115 virtual E_ANIMATED_MESH_TYPE getMeshType() const
116 {
117 return Type;
118 }
119
120 //! returns amount of mesh buffers.
121 virtual u32 getMeshBufferCount() const
122 {
123 if (Meshes.empty())
124 return 0;
125
126 return Meshes[0]->getMeshBufferCount();
127 }
128
129 //! returns pointer to a mesh buffer
130 virtual IMeshBuffer* getMeshBuffer(u32 nr) const
131 {
132 if (Meshes.empty())
133 return 0;
134
135 return Meshes[0]->getMeshBuffer(nr);
136 }
137
138 //! Returns pointer to a mesh buffer which fits a material
139 /** \param material: material to search for
140 \return Returns the pointer to the mesh buffer or
141 NULL if there is no such mesh buffer. */
142 virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const
143 {
144 if (Meshes.empty())
145 return 0;
146
147 return Meshes[0]->getMeshBuffer(material);
148 }
149
150 //! Set a material flag for all meshbuffers of this mesh.
151 virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
152 {
153 for (u32 i=0; i<Meshes.size(); ++i)
154 Meshes[i]->setMaterialFlag(flag, newvalue);
155 }
156
157 //! set the hardware mapping hint, for driver
158 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX )
159 {
160 for (u32 i=0; i<Meshes.size(); ++i)
161 Meshes[i]->setHardwareMappingHint(newMappingHint, buffer);
162 }
163
164 //! flags the meshbuffer as changed, reloads hardware buffers
165 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
166 {
167 for (u32 i=0; i<Meshes.size(); ++i)
168 Meshes[i]->setDirty(buffer);
169 }
170
171 //! All meshes defining the animated mesh
172 core::array<IMesh*> Meshes;
173
174 //! The bounding box of this mesh
175 core::aabbox3d<f32> Box;
176
177 //! Default animation speed of this mesh.
178 f32 FramesPerSecond;
179
180 //! The type of the mesh.
181 E_ANIMATED_MESH_TYPE Type;
182 };
183
184
185} // end namespace scene
186} // end namespace irr
187
188#endif
189
diff --git a/src/others/irrlicht-1.8.1/include/SColor.h b/src/others/irrlicht-1.8.1/include/SColor.h
new file mode 100644
index 0000000..b61bbef
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SColor.h
@@ -0,0 +1,697 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __COLOR_H_INCLUDED__
6#define __COLOR_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "irrMath.h"
10
11namespace irr
12{
13namespace video
14{
15 //! An enum for the color format of textures used by the Irrlicht Engine.
16 /** A color format specifies how color information is stored. */
17 enum ECOLOR_FORMAT
18 {
19 //! 16 bit color format used by the software driver.
20 /** It is thus preferred by all other irrlicht engine video drivers.
21 There are 5 bits for every color component, and a single bit is left
22 for alpha information. */
23 ECF_A1R5G5B5 = 0,
24
25 //! Standard 16 bit color format.
26 ECF_R5G6B5,
27
28 //! 24 bit color, no alpha channel, but 8 bit for red, green and blue.
29 ECF_R8G8B8,
30
31 //! Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
32 ECF_A8R8G8B8,
33
34 /** Floating Point formats. The following formats may only be used for render target textures. */
35
36 //! 16 bit floating point format using 16 bits for the red channel.
37 ECF_R16F,
38
39 //! 32 bit floating point format using 16 bits for the red channel and 16 bits for the green channel.
40 ECF_G16R16F,
41
42 //! 64 bit floating point format 16 bits are used for the red, green, blue and alpha channels.
43 ECF_A16B16G16R16F,
44
45 //! 32 bit floating point format using 32 bits for the red channel.
46 ECF_R32F,
47
48 //! 64 bit floating point format using 32 bits for the red channel and 32 bits for the green channel.
49 ECF_G32R32F,
50
51 //! 128 bit floating point format. 32 bits are used for the red, green, blue and alpha channels.
52 ECF_A32B32G32R32F,
53
54 //! Unknown color format:
55 ECF_UNKNOWN
56 };
57
58
59 //! Creates a 16 bit A1R5G5B5 color
60 inline u16 RGBA16(u32 r, u32 g, u32 b, u32 a=0xFF)
61 {
62 return (u16)((a & 0x80) << 8 |
63 (r & 0xF8) << 7 |
64 (g & 0xF8) << 2 |
65 (b & 0xF8) >> 3);
66 }
67
68
69 //! Creates a 16 bit A1R5G5B5 color
70 inline u16 RGB16(u32 r, u32 g, u32 b)
71 {
72 return RGBA16(r,g,b);
73 }
74
75
76 //! Creates a 16bit A1R5G5B5 color, based on 16bit input values
77 inline u16 RGB16from16(u16 r, u16 g, u16 b)
78 {
79 return (0x8000 |
80 (r & 0x1F) << 10 |
81 (g & 0x1F) << 5 |
82 (b & 0x1F));
83 }
84
85
86 //! Converts a 32bit (X8R8G8B8) color to a 16bit A1R5G5B5 color
87 inline u16 X8R8G8B8toA1R5G5B5(u32 color)
88 {
89 return (u16)(0x8000 |
90 ( color & 0x00F80000) >> 9 |
91 ( color & 0x0000F800) >> 6 |
92 ( color & 0x000000F8) >> 3);
93 }
94
95
96 //! Converts a 32bit (A8R8G8B8) color to a 16bit A1R5G5B5 color
97 inline u16 A8R8G8B8toA1R5G5B5(u32 color)
98 {
99 return (u16)(( color & 0x80000000) >> 16|
100 ( color & 0x00F80000) >> 9 |
101 ( color & 0x0000F800) >> 6 |
102 ( color & 0x000000F8) >> 3);
103 }
104
105
106 //! Converts a 32bit (A8R8G8B8) color to a 16bit R5G6B5 color
107 inline u16 A8R8G8B8toR5G6B5(u32 color)
108 {
109 return (u16)(( color & 0x00F80000) >> 8 |
110 ( color & 0x0000FC00) >> 5 |
111 ( color & 0x000000F8) >> 3);
112 }
113
114
115 //! Convert A8R8G8B8 Color from A1R5G5B5 color
116 /** build a nicer 32bit Color by extending dest lower bits with source high bits. */
117 inline u32 A1R5G5B5toA8R8G8B8(u16 color)
118 {
119 return ( (( -( (s32) color & 0x00008000 ) >> (s32) 31 ) & 0xFF000000 ) |
120 (( color & 0x00007C00 ) << 9) | (( color & 0x00007000 ) << 4) |
121 (( color & 0x000003E0 ) << 6) | (( color & 0x00000380 ) << 1) |
122 (( color & 0x0000001F ) << 3) | (( color & 0x0000001C ) >> 2)
123 );
124 }
125
126
127 //! Returns A8R8G8B8 Color from R5G6B5 color
128 inline u32 R5G6B5toA8R8G8B8(u16 color)
129 {
130 return 0xFF000000 |
131 ((color & 0xF800) << 8)|
132 ((color & 0x07E0) << 5)|
133 ((color & 0x001F) << 3);
134 }
135
136
137 //! Returns A1R5G5B5 Color from R5G6B5 color
138 inline u16 R5G6B5toA1R5G5B5(u16 color)
139 {
140 return 0x8000 | (((color & 0xFFC0) >> 1) | (color & 0x1F));
141 }
142
143
144 //! Returns R5G6B5 Color from A1R5G5B5 color
145 inline u16 A1R5G5B5toR5G6B5(u16 color)
146 {
147 return (((color & 0x7FE0) << 1) | (color & 0x1F));
148 }
149
150
151
152 //! Returns the alpha component from A1R5G5B5 color
153 /** In Irrlicht, alpha refers to opacity.
154 \return The alpha value of the color. 0 is transparent, 1 is opaque. */
155 inline u32 getAlpha(u16 color)
156 {
157 return ((color >> 15)&0x1);
158 }
159
160
161 //! Returns the red component from A1R5G5B5 color.
162 /** Shift left by 3 to get 8 bit value. */
163 inline u32 getRed(u16 color)
164 {
165 return ((color >> 10)&0x1F);
166 }
167
168
169 //! Returns the green component from A1R5G5B5 color
170 /** Shift left by 3 to get 8 bit value. */
171 inline u32 getGreen(u16 color)
172 {
173 return ((color >> 5)&0x1F);
174 }
175
176
177 //! Returns the blue component from A1R5G5B5 color
178 /** Shift left by 3 to get 8 bit value. */
179 inline u32 getBlue(u16 color)
180 {
181 return (color & 0x1F);
182 }
183
184
185 //! Returns the average from a 16 bit A1R5G5B5 color
186 inline s32 getAverage(s16 color)
187 {
188 return ((getRed(color)<<3) + (getGreen(color)<<3) + (getBlue(color)<<3)) / 3;
189 }
190
191
192 //! Class representing a 32 bit ARGB color.
193 /** The color values for alpha, red, green, and blue are
194 stored in a single u32. So all four values may be between 0 and 255.
195 Alpha in Irrlicht is opacity, so 0 is fully transparent, 255 is fully opaque (solid).
196 This class is used by most parts of the Irrlicht Engine
197 to specify a color. Another way is using the class SColorf, which
198 stores the color values in 4 floats.
199 This class must consist of only one u32 and must not use virtual functions.
200 */
201 class SColor
202 {
203 public:
204
205 //! Constructor of the Color. Does nothing.
206 /** The color value is not initialized to save time. */
207 SColor() {}
208
209 //! Constructs the color from 4 values representing the alpha, red, green and blue component.
210 /** Must be values between 0 and 255. */
211 SColor (u32 a, u32 r, u32 g, u32 b)
212 : color(((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff)) {}
213
214 //! Constructs the color from a 32 bit value. Could be another color.
215 SColor(u32 clr)
216 : color(clr) {}
217
218 //! Returns the alpha component of the color.
219 /** The alpha component defines how opaque a color is.
220 \return The alpha value of the color. 0 is fully transparent, 255 is fully opaque. */
221 u32 getAlpha() const { return color>>24; }
222
223 //! Returns the red component of the color.
224 /** \return Value between 0 and 255, specifying how red the color is.
225 0 means no red, 255 means full red. */
226 u32 getRed() const { return (color>>16) & 0xff; }
227
228 //! Returns the green component of the color.
229 /** \return Value between 0 and 255, specifying how green the color is.
230 0 means no green, 255 means full green. */
231 u32 getGreen() const { return (color>>8) & 0xff; }
232
233 //! Returns the blue component of the color.
234 /** \return Value between 0 and 255, specifying how blue the color is.
235 0 means no blue, 255 means full blue. */
236 u32 getBlue() const { return color & 0xff; }
237
238 //! Get lightness of the color in the range [0,255]
239 f32 getLightness() const
240 {
241 return 0.5f*(core::max_(core::max_(getRed(),getGreen()),getBlue())+core::min_(core::min_(getRed(),getGreen()),getBlue()));
242 }
243
244 //! Get luminance of the color in the range [0,255].
245 f32 getLuminance() const
246 {
247 return 0.3f*getRed() + 0.59f*getGreen() + 0.11f*getBlue();
248 }
249
250 //! Get average intensity of the color in the range [0,255].
251 u32 getAverage() const
252 {
253 return ( getRed() + getGreen() + getBlue() ) / 3;
254 }
255
256 //! Sets the alpha component of the Color.
257 /** The alpha component defines how transparent a color should be.
258 \param a The alpha value of the color. 0 is fully transparent, 255 is fully opaque. */
259 void setAlpha(u32 a) { color = ((a & 0xff)<<24) | (color & 0x00ffffff); }
260
261 //! Sets the red component of the Color.
262 /** \param r: Has to be a value between 0 and 255.
263 0 means no red, 255 means full red. */
264 void setRed(u32 r) { color = ((r & 0xff)<<16) | (color & 0xff00ffff); }
265
266 //! Sets the green component of the Color.
267 /** \param g: Has to be a value between 0 and 255.
268 0 means no green, 255 means full green. */
269 void setGreen(u32 g) { color = ((g & 0xff)<<8) | (color & 0xffff00ff); }
270
271 //! Sets the blue component of the Color.
272 /** \param b: Has to be a value between 0 and 255.
273 0 means no blue, 255 means full blue. */
274 void setBlue(u32 b) { color = (b & 0xff) | (color & 0xffffff00); }
275
276 //! Calculates a 16 bit A1R5G5B5 value of this color.
277 /** \return 16 bit A1R5G5B5 value of this color. */
278 u16 toA1R5G5B5() const { return A8R8G8B8toA1R5G5B5(color); }
279
280 //! Converts color to OpenGL color format
281 /** From ARGB to RGBA in 4 byte components for endian aware
282 passing to OpenGL
283 \param dest: address where the 4x8 bit OpenGL color is stored. */
284 void toOpenGLColor(u8* dest) const
285 {
286 *dest = (u8)getRed();
287 *++dest = (u8)getGreen();
288 *++dest = (u8)getBlue();
289 *++dest = (u8)getAlpha();
290 }
291
292 //! Sets all four components of the color at once.
293 /** Constructs the color from 4 values representing the alpha,
294 red, green and blue components of the color. Must be values
295 between 0 and 255.
296 \param a: Alpha component of the color. The alpha component
297 defines how transparent a color should be. Has to be a value
298 between 0 and 255. 255 means not transparent (opaque), 0 means
299 fully transparent.
300 \param r: Sets the red component of the Color. Has to be a
301 value between 0 and 255. 0 means no red, 255 means full red.
302 \param g: Sets the green component of the Color. Has to be a
303 value between 0 and 255. 0 means no green, 255 means full
304 green.
305 \param b: Sets the blue component of the Color. Has to be a
306 value between 0 and 255. 0 means no blue, 255 means full blue. */
307 void set(u32 a, u32 r, u32 g, u32 b)
308 {
309 color = (((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff));
310 }
311 void set(u32 col) { color = col; }
312
313 //! Compares the color to another color.
314 /** \return True if the colors are the same, and false if not. */
315 bool operator==(const SColor& other) const { return other.color == color; }
316
317 //! Compares the color to another color.
318 /** \return True if the colors are different, and false if they are the same. */
319 bool operator!=(const SColor& other) const { return other.color != color; }
320
321 //! comparison operator
322 /** \return True if this color is smaller than the other one */
323 bool operator<(const SColor& other) const { return (color < other.color); }
324
325 //! Adds two colors, result is clamped to 0..255 values
326 /** \param other Color to add to this color
327 \return Addition of the two colors, clamped to 0..255 values */
328 SColor operator+(const SColor& other) const
329 {
330 return SColor(core::min_(getAlpha() + other.getAlpha(), 255u),
331 core::min_(getRed() + other.getRed(), 255u),
332 core::min_(getGreen() + other.getGreen(), 255u),
333 core::min_(getBlue() + other.getBlue(), 255u));
334 }
335
336 //! Interpolates the color with a f32 value to another color
337 /** \param other: Other color
338 \param d: value between 0.0f and 1.0f
339 \return Interpolated color. */
340 SColor getInterpolated(const SColor &other, f32 d) const
341 {
342 d = core::clamp(d, 0.f, 1.f);
343 const f32 inv = 1.0f - d;
344 return SColor((u32)core::round32(other.getAlpha()*inv + getAlpha()*d),
345 (u32)core::round32(other.getRed()*inv + getRed()*d),
346 (u32)core::round32(other.getGreen()*inv + getGreen()*d),
347 (u32)core::round32(other.getBlue()*inv + getBlue()*d));
348 }
349
350 //! Returns interpolated color. ( quadratic )
351 /** \param c1: first color to interpolate with
352 \param c2: second color to interpolate with
353 \param d: value between 0.0f and 1.0f. */
354 SColor getInterpolated_quadratic(const SColor& c1, const SColor& c2, f32 d) const
355 {
356 // this*(1-d)*(1-d) + 2 * c1 * (1-d) + c2 * d * d;
357 d = core::clamp(d, 0.f, 1.f);
358 const f32 inv = 1.f - d;
359 const f32 mul0 = inv * inv;
360 const f32 mul1 = 2.f * d * inv;
361 const f32 mul2 = d * d;
362
363 return SColor(
364 core::clamp( core::floor32(
365 getAlpha() * mul0 + c1.getAlpha() * mul1 + c2.getAlpha() * mul2 ), 0, 255 ),
366 core::clamp( core::floor32(
367 getRed() * mul0 + c1.getRed() * mul1 + c2.getRed() * mul2 ), 0, 255 ),
368 core::clamp ( core::floor32(
369 getGreen() * mul0 + c1.getGreen() * mul1 + c2.getGreen() * mul2 ), 0, 255 ),
370 core::clamp ( core::floor32(
371 getBlue() * mul0 + c1.getBlue() * mul1 + c2.getBlue() * mul2 ), 0, 255 ));
372 }
373
374 //! set the color by expecting data in the given format
375 /** \param data: must point to valid memory containing color information in the given format
376 \param format: tells the format in which data is available
377 */
378 void setData(const void *data, ECOLOR_FORMAT format)
379 {
380 switch (format)
381 {
382 case ECF_A1R5G5B5:
383 color = A1R5G5B5toA8R8G8B8(*(u16*)data);
384 break;
385 case ECF_R5G6B5:
386 color = R5G6B5toA8R8G8B8(*(u16*)data);
387 break;
388 case ECF_A8R8G8B8:
389 color = *(u32*)data;
390 break;
391 case ECF_R8G8B8:
392 {
393 u8* p = (u8*)data;
394 set(255, p[0],p[1],p[2]);
395 }
396 break;
397 default:
398 color = 0xffffffff;
399 break;
400 }
401 }
402
403 //! Write the color to data in the defined format
404 /** \param data: target to write the color. Must contain sufficiently large memory to receive the number of bytes neede for format
405 \param format: tells the format used to write the color into data
406 */
407 void getData(void *data, ECOLOR_FORMAT format)
408 {
409 switch(format)
410 {
411 case ECF_A1R5G5B5:
412 {
413 u16 * dest = (u16*)data;
414 *dest = video::A8R8G8B8toA1R5G5B5( color );
415 }
416 break;
417
418 case ECF_R5G6B5:
419 {
420 u16 * dest = (u16*)data;
421 *dest = video::A8R8G8B8toR5G6B5( color );
422 }
423 break;
424
425 case ECF_R8G8B8:
426 {
427 u8* dest = (u8*)data;
428 dest[0] = (u8)getRed();
429 dest[1] = (u8)getGreen();
430 dest[2] = (u8)getBlue();
431 }
432 break;
433
434 case ECF_A8R8G8B8:
435 {
436 u32 * dest = (u32*)data;
437 *dest = color;
438 }
439 break;
440
441 default:
442 break;
443 }
444 }
445
446 //! color in A8R8G8B8 Format
447 u32 color;
448 };
449
450
451 //! Class representing a color with four floats.
452 /** The color values for red, green, blue
453 and alpha are each stored in a 32 bit floating point variable.
454 So all four values may be between 0.0f and 1.0f.
455 Another, faster way to define colors is using the class SColor, which
456 stores the color values in a single 32 bit integer.
457 */
458 class SColorf
459 {
460 public:
461 //! Default constructor for SColorf.
462 /** Sets red, green and blue to 0.0f and alpha to 1.0f. */
463 SColorf() : r(0.0f), g(0.0f), b(0.0f), a(1.0f) {}
464
465 //! Constructs a color from up to four color values: red, green, blue, and alpha.
466 /** \param r: Red color component. Should be a value between
467 0.0f meaning no red and 1.0f, meaning full red.
468 \param g: Green color component. Should be a value between 0.0f
469 meaning no green and 1.0f, meaning full green.
470 \param b: Blue color component. Should be a value between 0.0f
471 meaning no blue and 1.0f, meaning full blue.
472 \param a: Alpha color component of the color. The alpha
473 component defines how transparent a color should be. Has to be
474 a value between 0.0f and 1.0f, 1.0f means not transparent
475 (opaque), 0.0f means fully transparent. */
476 SColorf(f32 r, f32 g, f32 b, f32 a = 1.0f) : r(r), g(g), b(b), a(a) {}
477
478 //! Constructs a color from 32 bit Color.
479 /** \param c: 32 bit color from which this SColorf class is
480 constructed from. */
481 SColorf(SColor c)
482 {
483 const f32 inv = 1.0f / 255.0f;
484 r = c.getRed() * inv;
485 g = c.getGreen() * inv;
486 b = c.getBlue() * inv;
487 a = c.getAlpha() * inv;
488 }
489
490 //! Converts this color to a SColor without floats.
491 SColor toSColor() const
492 {
493 return SColor((u32)core::round32(a*255.0f), (u32)core::round32(r*255.0f), (u32)core::round32(g*255.0f), (u32)core::round32(b*255.0f));
494 }
495
496 //! Sets three color components to new values at once.
497 /** \param rr: Red color component. Should be a value between 0.0f meaning
498 no red (=black) and 1.0f, meaning full red.
499 \param gg: Green color component. Should be a value between 0.0f meaning
500 no green (=black) and 1.0f, meaning full green.
501 \param bb: Blue color component. Should be a value between 0.0f meaning
502 no blue (=black) and 1.0f, meaning full blue. */
503 void set(f32 rr, f32 gg, f32 bb) {r = rr; g =gg; b = bb; }
504
505 //! Sets all four color components to new values at once.
506 /** \param aa: Alpha component. Should be a value between 0.0f meaning
507 fully transparent and 1.0f, meaning opaque.
508 \param rr: Red color component. Should be a value between 0.0f meaning
509 no red and 1.0f, meaning full red.
510 \param gg: Green color component. Should be a value between 0.0f meaning
511 no green and 1.0f, meaning full green.
512 \param bb: Blue color component. Should be a value between 0.0f meaning
513 no blue and 1.0f, meaning full blue. */
514 void set(f32 aa, f32 rr, f32 gg, f32 bb) {a = aa; r = rr; g =gg; b = bb; }
515
516 //! Interpolates the color with a f32 value to another color
517 /** \param other: Other color
518 \param d: value between 0.0f and 1.0f
519 \return Interpolated color. */
520 SColorf getInterpolated(const SColorf &other, f32 d) const
521 {
522 d = core::clamp(d, 0.f, 1.f);
523 const f32 inv = 1.0f - d;
524 return SColorf(other.r*inv + r*d,
525 other.g*inv + g*d, other.b*inv + b*d, other.a*inv + a*d);
526 }
527
528 //! Returns interpolated color. ( quadratic )
529 /** \param c1: first color to interpolate with
530 \param c2: second color to interpolate with
531 \param d: value between 0.0f and 1.0f. */
532 inline SColorf getInterpolated_quadratic(const SColorf& c1, const SColorf& c2,
533 f32 d) const
534 {
535 d = core::clamp(d, 0.f, 1.f);
536 // this*(1-d)*(1-d) + 2 * c1 * (1-d) + c2 * d * d;
537 const f32 inv = 1.f - d;
538 const f32 mul0 = inv * inv;
539 const f32 mul1 = 2.f * d * inv;
540 const f32 mul2 = d * d;
541
542 return SColorf (r * mul0 + c1.r * mul1 + c2.r * mul2,
543 g * mul0 + c1.g * mul1 + c2.g * mul2,
544 b * mul0 + c1.b * mul1 + c2.b * mul2,
545 a * mul0 + c1.a * mul1 + c2.a * mul2);
546 }
547
548
549 //! Sets a color component by index. R=0, G=1, B=2, A=3
550 void setColorComponentValue(s32 index, f32 value)
551 {
552 switch(index)
553 {
554 case 0: r = value; break;
555 case 1: g = value; break;
556 case 2: b = value; break;
557 case 3: a = value; break;
558 }
559 }
560
561 //! Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque)
562 f32 getAlpha() const { return a; }
563
564 //! Returns the red component of the color in the range 0.0 to 1.0
565 f32 getRed() const { return r; }
566
567 //! Returns the green component of the color in the range 0.0 to 1.0
568 f32 getGreen() const { return g; }
569
570 //! Returns the blue component of the color in the range 0.0 to 1.0
571 f32 getBlue() const { return b; }
572
573 //! red color component
574 f32 r;
575
576 //! green color component
577 f32 g;
578
579 //! blue component
580 f32 b;
581
582 //! alpha color component
583 f32 a;
584 };
585
586
587 //! Class representing a color in HSL format
588 /** The color values for hue, saturation, luminance
589 are stored in 32bit floating point variables. Hue is in range [0,360],
590 Luminance and Saturation are in percent [0,100]
591 */
592 class SColorHSL
593 {
594 public:
595 SColorHSL ( f32 h = 0.f, f32 s = 0.f, f32 l = 0.f )
596 : Hue ( h ), Saturation ( s ), Luminance ( l ) {}
597
598 void fromRGB(const SColorf &color);
599 void toRGB(SColorf &color) const;
600
601 f32 Hue;
602 f32 Saturation;
603 f32 Luminance;
604
605 private:
606 inline f32 toRGB1(f32 rm1, f32 rm2, f32 rh) const;
607
608 };
609
610 inline void SColorHSL::fromRGB(const SColorf &color)
611 {
612 const f32 maxVal = core::max_(color.getRed(), color.getGreen(), color.getBlue());
613 const f32 minVal = (f32)core::min_(color.getRed(), color.getGreen(), color.getBlue());
614 Luminance = (maxVal+minVal)*50;
615 if (core::equals(maxVal, minVal))
616 {
617 Hue=0.f;
618 Saturation=0.f;
619 return;
620 }
621
622 const f32 delta = maxVal-minVal;
623 if ( Luminance <= 50 )
624 {
625 Saturation = (delta)/(maxVal+minVal);
626 }
627 else
628 {
629 Saturation = (delta)/(2-maxVal-minVal);
630 }
631 Saturation *= 100;
632
633 if (core::equals(maxVal, color.getRed()))
634 Hue = (color.getGreen()-color.getBlue())/delta;
635 else if (core::equals(maxVal, color.getGreen()))
636 Hue = 2+((color.getBlue()-color.getRed())/delta);
637 else // blue is max
638 Hue = 4+((color.getRed()-color.getGreen())/delta);
639
640 Hue *= 60.0f;
641 while ( Hue < 0.f )
642 Hue += 360;
643 }
644
645
646 inline void SColorHSL::toRGB(SColorf &color) const
647 {
648 const f32 l = Luminance/100;
649 if (core::iszero(Saturation)) // grey
650 {
651 color.set(l, l, l);
652 return;
653 }
654
655 f32 rm2;
656
657 if ( Luminance <= 50 )
658 {
659 rm2 = l + l * (Saturation/100);
660 }
661 else
662 {
663 rm2 = l + (1 - l) * (Saturation/100);
664 }
665
666 const f32 rm1 = 2.0f * l - rm2;
667
668 const f32 h = Hue / 360.0f;
669 color.set( toRGB1(rm1, rm2, h + 1.f/3.f),
670 toRGB1(rm1, rm2, h),
671 toRGB1(rm1, rm2, h - 1.f/3.f)
672 );
673 }
674
675
676 // algorithm from Foley/Van-Dam
677 inline f32 SColorHSL::toRGB1(f32 rm1, f32 rm2, f32 rh) const
678 {
679 if (rh<0)
680 rh += 1;
681 if (rh>1)
682 rh -= 1;
683
684 if (rh < 1.f/6.f)
685 rm1 = rm1 + (rm2 - rm1) * rh*6.f;
686 else if (rh < 0.5f)
687 rm1 = rm2;
688 else if (rh < 2.f/3.f)
689 rm1 = rm1 + (rm2 - rm1) * ((2.f/3.f)-rh)*6.f;
690
691 return rm1;
692 }
693
694} // end namespace video
695} // end namespace irr
696
697#endif
diff --git a/src/others/irrlicht-1.8.1/include/SExposedVideoData.h b/src/others/irrlicht-1.8.1/include/SExposedVideoData.h
new file mode 100644
index 0000000..c30f4a7
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SExposedVideoData.h
@@ -0,0 +1,90 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_EXPOSED_VIDEO_DATA_H_INCLUDED__
6#define __S_EXPOSED_VIDEO_DATA_H_INCLUDED__
7
8// forward declarations for internal pointers
9struct IDirect3D9;
10struct IDirect3DDevice9;
11struct IDirect3D8;
12struct IDirect3DDevice8;
13
14namespace irr
15{
16namespace video
17{
18
19//! structure for holding data describing a driver and operating system specific data.
20/** This data can be retrived by IVideoDriver::getExposedVideoData(). Use this with caution.
21This only should be used to make it possible to extend the engine easily without
22modification of its source. Note that this structure does not contain any valid data, if
23you are using the software or the null device.
24*/
25struct SExposedVideoData
26{
27 SExposedVideoData() {OpenGLWin32.HDc=0; OpenGLWin32.HRc=0; OpenGLWin32.HWnd=0;}
28 explicit SExposedVideoData(void* Window) {OpenGLWin32.HDc=0; OpenGLWin32.HRc=0; OpenGLWin32.HWnd=Window;}
29
30 union
31 {
32 struct
33 {
34 //! Pointer to the IDirect3D9 interface
35 IDirect3D9* D3D9;
36
37 //! Pointer to the IDirect3DDevice9 interface
38 IDirect3DDevice9* D3DDev9;
39
40 //! Window handle.
41 /** Get with for example HWND h = reinterpret_cast<HWND>(exposedData.D3D9.HWnd) */
42 void* HWnd;
43
44 } D3D9;
45
46 struct
47 {
48 //! Pointer to the IDirect3D8 interface
49 IDirect3D8* D3D8;
50
51 //! Pointer to the IDirect3DDevice8 interface
52 IDirect3DDevice8* D3DDev8;
53
54 //! Window handle.
55 /** Get with for example with: HWND h = reinterpret_cast<HWND>(exposedData.D3D8.HWnd) */
56 void* HWnd;
57
58 } D3D8;
59
60 struct
61 {
62 //! Private GDI Device Context.
63 /** Get if for example with: HDC h = reinterpret_cast<HDC>(exposedData.OpenGLWin32.HDc) */
64 void* HDc;
65
66 //! Permanent Rendering Context.
67 /** Get if for example with: HGLRC h = reinterpret_cast<HGLRC>(exposedData.OpenGLWin32.HRc) */
68 void* HRc;
69
70 //! Window handle.
71 /** Get with for example with: HWND h = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd) */
72 void* HWnd;
73 } OpenGLWin32;
74
75 struct
76 {
77 // XWindow handles
78 void* X11Display;
79 void* X11Context;
80 unsigned long X11Window;
81 } OpenGLLinux;
82 };
83};
84
85} // end namespace video
86} // end namespace irr
87
88
89#endif
90
diff --git a/src/others/irrlicht-1.8.1/include/SIrrCreationParameters.h b/src/others/irrlicht-1.8.1/include/SIrrCreationParameters.h
new file mode 100644
index 0000000..ec642c2
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SIrrCreationParameters.h
@@ -0,0 +1,308 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
6#define __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
7
8#include "EDriverTypes.h"
9#include "EDeviceTypes.h"
10#include "dimension2d.h"
11#include "ILogger.h"
12// onefang changes start
13#include "SExposedVideoData.h"
14// onefang changes end
15
16namespace irr
17{
18 class IEventReceiver;
19
20 //! Structure for holding Irrlicht Device creation parameters.
21 /** This structure is used in the createDeviceEx() function. */
22 struct SIrrlichtCreationParameters
23 {
24 //! Constructs a SIrrlichtCreationParameters structure with default values.
25 SIrrlichtCreationParameters() :
26 DeviceType(EIDT_BEST),
27 DriverType(video::EDT_BURNINGSVIDEO),
28 WindowSize(core::dimension2d<u32>(800, 600)),
29 Bits(16),
30 ZBufferBits(16),
31 Fullscreen(false),
32 Stencilbuffer(false),
33 Vsync(false),
34 AntiAlias(0),
35 HandleSRGB(false),
36 WithAlphaChannel(false),
37 Doublebuffer(true),
38 IgnoreInput(false),
39 Stereobuffer(false),
40 HighPrecisionFPU(false),
41 EventReceiver(0),
42 WindowId(0),
43// onefang changes start
44 VideoData(0),
45// onefang changes end
46#ifdef _DEBUG
47 LoggingLevel(ELL_DEBUG),
48#else
49 LoggingLevel(ELL_INFORMATION),
50#endif
51 DisplayAdapter(0),
52 DriverMultithreaded(false),
53 UsePerformanceTimer(true),
54 SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
55 {
56 }
57
58 SIrrlichtCreationParameters(const SIrrlichtCreationParameters& other) :
59 SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
60 {*this = other;}
61
62 SIrrlichtCreationParameters& operator=(const SIrrlichtCreationParameters& other)
63 {
64 DeviceType = other.DeviceType;
65 DriverType = other.DriverType;
66 WindowSize = other.WindowSize;
67 Bits = other.Bits;
68 ZBufferBits = other.ZBufferBits;
69 Fullscreen = other.Fullscreen;
70 Stencilbuffer = other.Stencilbuffer;
71 Vsync = other.Vsync;
72 AntiAlias = other.AntiAlias;
73 HandleSRGB = other.HandleSRGB;
74 WithAlphaChannel = other.WithAlphaChannel;
75 Doublebuffer = other.Doublebuffer;
76 IgnoreInput = other.IgnoreInput;
77 Stereobuffer = other.Stereobuffer;
78 HighPrecisionFPU = other.HighPrecisionFPU;
79 EventReceiver = other.EventReceiver;
80 WindowId = other.WindowId;
81// onefang changes start
82 VideoData = other.VideoData;
83// onefang changes end
84 LoggingLevel = other.LoggingLevel;
85 DriverMultithreaded = other.DriverMultithreaded;
86 DisplayAdapter = other.DisplayAdapter;
87 UsePerformanceTimer = other.UsePerformanceTimer;
88 return *this;
89 }
90
91 //! Type of the device.
92 /** This setting decides the windowing system used by the device, most device types are native
93 to a specific operating system and so may not be available.
94 EIDT_WIN32 is only available on Windows desktops,
95 EIDT_WINCE is only available on Windows mobile devices,
96 EIDT_COCOA is only available on Mac OSX,
97 EIDT_X11 is available on Linux, Solaris, BSD and other operating systems which use X11,
98 EIDT_SDL is available on most systems if compiled in,
99 EIDT_CONSOLE is usually available but can only render to text,
100 EIDT_BEST will select the best available device for your operating system.
101 Default: EIDT_BEST. */
102 E_DEVICE_TYPE DeviceType;
103
104 //! Type of video driver used to render graphics.
105 /** This can currently be video::EDT_NULL, video::EDT_SOFTWARE,
106 video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D8,
107 video::EDT_DIRECT3D9, and video::EDT_OPENGL.
108 Default: Software. */
109 video::E_DRIVER_TYPE DriverType;
110
111 //! Size of the window or the video mode in fullscreen mode. Default: 800x600
112 core::dimension2d<u32> WindowSize;
113
114 //! Minimum Bits per pixel of the color buffer in fullscreen mode. Ignored if windowed mode. Default: 16.
115 u8 Bits;
116
117 //! Minimum Bits per pixel of the depth buffer. Default: 16.
118 u8 ZBufferBits;
119
120 //! Should be set to true if the device should run in fullscreen.
121 /** Otherwise the device runs in windowed mode. Default: false. */
122 bool Fullscreen;
123
124 //! Specifies if the stencil buffer should be enabled.
125 /** Set this to true, if you want the engine be able to draw
126 stencil buffer shadows. Note that not all drivers are able to
127 use the stencil buffer, hence it can be ignored during device
128 creation. Without the stencil buffer no shadows will be drawn.
129 Default: false. */
130 bool Stencilbuffer;
131
132 //! Specifies vertical syncronisation.
133 /** If set to true, the driver will wait for the vertical
134 retrace period, otherwise not. May be silently ignored.
135 Default: false */
136 bool Vsync;
137
138 //! Specifies if the device should use fullscreen anti aliasing
139 /** Makes sharp/pixelated edges softer, but requires more
140 performance. Also, 2D elements might look blurred with this
141 switched on. The resulting rendering quality also depends on
142 the hardware and driver you are using, your program might look
143 different on different hardware with this. So if you are
144 writing a game/application with AntiAlias switched on, it would
145 be a good idea to make it possible to switch this option off
146 again by the user.
147 The value is the maximal antialiasing factor requested for
148 the device. The cretion method will automatically try smaller
149 values if no window can be created with the given value.
150 Value one is usually the same as 0 (disabled), but might be a
151 special value on some platforms. On D3D devices it maps to
152 NONMASKABLE.
153 Default value: 0 - disabled */
154 u8 AntiAlias;
155
156 //! Flag to enable proper sRGB and linear color handling
157 /** In most situations, it is desireable to have the color handling in
158 non-linear sRGB color space, and only do the intermediate color
159 calculations in linear RGB space. If this flag is enabled, the device and
160 driver try to assure that all color input and output are color corrected
161 and only the internal color representation is linear. This means, that
162 the color output is properly gamma-adjusted to provide the brighter
163 colors for monitor display. And that blending and lighting give a more
164 natural look, due to proper conversion from non-linear colors into linear
165 color space for blend operations. If this flag is enabled, all texture colors
166 (which are usually in sRGB space) are correctly displayed. However vertex colors
167 and other explicitly set values have to be manually encoded in linear color space.
168 Default value: false. */
169 bool HandleSRGB;
170
171 //! Whether the main framebuffer uses an alpha channel.
172 /** In some situations it might be desireable to get a color
173 buffer with an alpha channel, e.g. when rendering into a
174 transparent window or overlay. If this flag is set the device
175 tries to create a framebuffer with alpha channel.
176 If this flag is set, only color buffers with alpha channel
177 are considered. Otherwise, it depends on the actual hardware
178 if the colorbuffer has an alpha channel or not.
179 Default value: false */
180 bool WithAlphaChannel;
181
182 //! Whether the main framebuffer uses doublebuffering.
183 /** This should be usually enabled, in order to avoid render
184 artifacts on the visible framebuffer. However, it might be
185 useful to use only one buffer on very small devices. If no
186 doublebuffering is available, the drivers will fall back to
187 single buffers. Default value: true */
188 bool Doublebuffer;
189
190 //! Specifies if the device should ignore input events
191 /** This is only relevant when using external I/O handlers.
192 External windows need to take care of this themselves.
193 Currently only supported by X11.
194 Default value: false */
195 bool IgnoreInput;
196
197 //! Specifies if the device should use stereo buffers
198 /** Some high-end gfx cards support two framebuffers for direct
199 support of stereoscopic output devices. If this flag is set the
200 device tries to create a stereo context.
201 Currently only supported by OpenGL.
202 Default value: false */
203 bool Stereobuffer;
204
205 //! Specifies if the device should use high precision FPU setting
206 /** This is only relevant for DirectX Devices, which switch to
207 low FPU precision by default for performance reasons. However,
208 this may lead to problems with the other computations of the
209 application. In this case setting this flag to true should help
210 - on the expense of performance loss, though.
211 Default value: false */
212 bool HighPrecisionFPU;
213
214 //! A user created event receiver.
215 IEventReceiver* EventReceiver;
216
217 //! Window Id.
218 /** If this is set to a value other than 0, the Irrlicht Engine
219 will be created in an already existing window. For windows, set
220 this to the HWND of the window you want. The windowSize and
221 FullScreen options will be ignored when using the WindowId
222 parameter. Default this is set to 0.
223 To make Irrlicht run inside the custom window, you still will
224 have to draw Irrlicht on your own. You can use this loop, as
225 usual:
226 \code
227 while (device->run())
228 {
229 driver->beginScene(true, true, 0);
230 smgr->drawAll();
231 driver->endScene();
232 }
233 \endcode
234 Instead of this, you can also simply use your own message loop
235 using GetMessage, DispatchMessage and whatever. Calling
236 IrrlichtDevice::run() will cause Irrlicht to dispatch messages
237 internally too. You need not call Device->run() if you want to
238 do your own message dispatching loop, but Irrlicht will not be
239 able to fetch user input then and you have to do it on your own
240 using the window messages, DirectInput, or whatever. Also,
241 you'll have to increment the Irrlicht timer.
242 An alternative, own message dispatching loop without
243 device->run() would look like this:
244 \code
245 MSG msg;
246 while (true)
247 {
248 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
249 {
250 TranslateMessage(&msg);
251 DispatchMessage(&msg);
252
253 if (msg.message == WM_QUIT)
254 break;
255 }
256
257 // increase virtual timer time
258 device->getTimer()->tick();
259
260 // draw engine picture
261 driver->beginScene(true, true, 0);
262 smgr->drawAll();
263 driver->endScene();
264 }
265 \endcode
266 However, there is no need to draw the picture this often. Just
267 do it how you like. */
268 void* WindowId;
269// onefang changes start
270 video::SExposedVideoData *VideoData;
271// onefang changes end
272
273 //! Specifies the logging level used in the logging interface.
274 /** The default value is ELL_INFORMATION. You can access the ILogger interface
275 later on from the IrrlichtDevice with getLogger() and set another level.
276 But if you need more or less logging information already from device creation,
277 then you have to change it here.
278 */
279 ELOG_LEVEL LoggingLevel;
280
281 //! Allows to select which graphic card is used for rendering when more than one card is in the system.
282 /** So far only supported on D3D */
283 u32 DisplayAdapter;
284
285 //! Create the driver multithreaded.
286 /** Default is false. Enabling this can slow down your application.
287 Note that this does _not_ make Irrlicht threadsafe, but only the underlying driver-API for the graphiccard.
288 So far only supported on D3D. */
289 bool DriverMultithreaded;
290
291 //! Enables use of high performance timers on Windows platform.
292 /** When performance timers are not used, standard GetTickCount()
293 is used instead which usually has worse resolution, but also less
294 problems with speed stepping and other techniques.
295 */
296 bool UsePerformanceTimer;
297
298 //! Don't use or change this parameter.
299 /** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
300 This is needed for sdk version checks. */
301 const c8* const SDK_version_do_not_use;
302 };
303
304
305} // end namespace irr
306
307#endif
308
diff --git a/src/others/irrlicht-1.8.1/include/SKeyMap.h b/src/others/irrlicht-1.8.1/include/SKeyMap.h
new file mode 100644
index 0000000..793cd98
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SKeyMap.h
@@ -0,0 +1,41 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_KEY_MAP_H_INCLUDED__
6#define __S_KEY_MAP_H_INCLUDED__
7
8#include "Keycodes.h"
9
10namespace irr
11{
12
13 //! enumeration for key actions. Used for example in the FPS Camera.
14 enum EKEY_ACTION
15 {
16 EKA_MOVE_FORWARD = 0,
17 EKA_MOVE_BACKWARD,
18 EKA_STRAFE_LEFT,
19 EKA_STRAFE_RIGHT,
20 EKA_JUMP_UP,
21 EKA_CROUCH,
22 EKA_COUNT,
23
24 //! This value is not used. It only forces this enumeration to compile in 32 bit.
25 EKA_FORCE_32BIT = 0x7fffffff
26 };
27
28 //! Struct storing which key belongs to which action.
29 struct SKeyMap
30 {
31 SKeyMap() {}
32 SKeyMap(EKEY_ACTION action, EKEY_CODE keyCode) : Action(action), KeyCode(keyCode) {}
33
34 EKEY_ACTION Action;
35 EKEY_CODE KeyCode;
36 };
37
38} // end namespace irr
39
40#endif
41
diff --git a/src/others/irrlicht-1.8.1/include/SLight.h b/src/others/irrlicht-1.8.1/include/SLight.h
new file mode 100644
index 0000000..f809d2e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SLight.h
@@ -0,0 +1,98 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_LIGHT_H_INCLUDED__
6#define __S_LIGHT_H_INCLUDED__
7
8#include "SColor.h"
9
10namespace irr
11{
12namespace video
13{
14
15//! Enumeration for different types of lights
16enum E_LIGHT_TYPE
17{
18 //! point light, it has a position in space and radiates light in all directions
19 ELT_POINT,
20 //! spot light, it has a position in space, a direction, and a limited cone of influence
21 ELT_SPOT,
22 //! directional light, coming from a direction from an infinite distance
23 ELT_DIRECTIONAL,
24
25 //! Only used for counting the elements of this enum
26 ELT_COUNT
27};
28
29//! Names for light types
30const c8* const LightTypeNames[] =
31{
32 "Point",
33 "Spot",
34 "Directional",
35 0
36};
37
38//! structure for holding data describing a dynamic point light.
39/** Irrlicht supports point lights, spot lights, and directional lights.
40*/
41struct SLight
42{
43 SLight() : AmbientColor(0.f,0.f,0.f), DiffuseColor(1.f,1.f,1.f),
44 SpecularColor(1.f,1.f,1.f), Attenuation(1.f,0.f,0.f),
45 OuterCone(45.f), InnerCone(0.f), Falloff(2.f),
46 Position(0.f,0.f,0.f), Direction(0.f,0.f,1.f),
47 Radius(100.f), Type(ELT_POINT), CastShadows(true)
48 {}
49
50 //! Ambient color emitted by the light
51 SColorf AmbientColor;
52
53 //! Diffuse color emitted by the light.
54 /** This is the primary color you want to set. */
55 SColorf DiffuseColor;
56
57 //! Specular color emitted by the light.
58 /** For details how to use specular highlights, see SMaterial::Shininess */
59 SColorf SpecularColor;
60
61 //! Attenuation factors (constant, linear, quadratic)
62 /** Changes the light strength fading over distance.
63 Can also be altered by setting the radius, Attenuation will change to
64 (0,1.f/radius,0). Can be overridden after radius was set. */
65 core::vector3df Attenuation;
66
67 //! The angle of the spot's outer cone. Ignored for other lights.
68 f32 OuterCone;
69
70 //! The angle of the spot's inner cone. Ignored for other lights.
71 f32 InnerCone;
72
73 //! The light strength's decrease between Outer and Inner cone.
74 f32 Falloff;
75
76 //! Read-ONLY! Position of the light.
77 /** If Type is ELT_DIRECTIONAL, it is ignored. Changed via light scene node's position. */
78 core::vector3df Position;
79
80 //! Read-ONLY! Direction of the light.
81 /** If Type is ELT_POINT, it is ignored. Changed via light scene node's rotation. */
82 core::vector3df Direction;
83
84 //! Read-ONLY! Radius of light. Everything within this radius will be lighted.
85 f32 Radius;
86
87 //! Read-ONLY! Type of the light. Default: ELT_POINT
88 E_LIGHT_TYPE Type;
89
90 //! Read-ONLY! Does the light cast shadows?
91 bool CastShadows:1;
92};
93
94} // end namespace video
95} // end namespace irr
96
97#endif
98
diff --git a/src/others/irrlicht-1.8.1/include/SMaterial.h b/src/others/irrlicht-1.8.1/include/SMaterial.h
new file mode 100644
index 0000000..3172241
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SMaterial.h
@@ -0,0 +1,685 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_MATERIAL_H_INCLUDED__
6#define __S_MATERIAL_H_INCLUDED__
7
8#include "SColor.h"
9#include "matrix4.h"
10#include "irrArray.h"
11#include "irrMath.h"
12#include "EMaterialTypes.h"
13#include "EMaterialFlags.h"
14#include "SMaterialLayer.h"
15
16namespace irr
17{
18namespace video
19{
20 class ITexture;
21
22 //! Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) BlendFunc = source * sourceFactor + dest * destFactor
23 enum E_BLEND_FACTOR
24 {
25 EBF_ZERO = 0, //!< src & dest (0, 0, 0, 0)
26 EBF_ONE, //!< src & dest (1, 1, 1, 1)
27 EBF_DST_COLOR, //!< src (destR, destG, destB, destA)
28 EBF_ONE_MINUS_DST_COLOR, //!< src (1-destR, 1-destG, 1-destB, 1-destA)
29 EBF_SRC_COLOR, //!< dest (srcR, srcG, srcB, srcA)
30 EBF_ONE_MINUS_SRC_COLOR, //!< dest (1-srcR, 1-srcG, 1-srcB, 1-srcA)
31 EBF_SRC_ALPHA, //!< src & dest (srcA, srcA, srcA, srcA)
32 EBF_ONE_MINUS_SRC_ALPHA, //!< src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
33 EBF_DST_ALPHA, //!< src & dest (destA, destA, destA, destA)
34 EBF_ONE_MINUS_DST_ALPHA, //!< src & dest (1-destA, 1-destA, 1-destA, 1-destA)
35 EBF_SRC_ALPHA_SATURATE //!< src (min(srcA, 1-destA), idem, ...)
36 };
37
38 //! Values defining the blend operation used when blend is enabled
39 enum E_BLEND_OPERATION
40 {
41 EBO_NONE = 0, //!< No blending happens
42 EBO_ADD, //!< Default blending adds the color values
43 EBO_SUBTRACT, //!< This mode subtracts the color values
44 EBO_REVSUBTRACT,//!< This modes subtracts destination from source
45 EBO_MIN, //!< Choose minimum value of each color channel
46 EBO_MAX, //!< Choose maximum value of each color channel
47 EBO_MIN_FACTOR, //!< Choose minimum value of each color channel after applying blend factors, not widely supported
48 EBO_MAX_FACTOR, //!< Choose maximum value of each color channel after applying blend factors, not widely supported
49 EBO_MIN_ALPHA, //!< Choose minimum value of each color channel based on alpha value, not widely supported
50 EBO_MAX_ALPHA //!< Choose maximum value of each color channel based on alpha value, not widely supported
51 };
52
53 //! MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X
54 enum E_MODULATE_FUNC
55 {
56 EMFN_MODULATE_1X = 1,
57 EMFN_MODULATE_2X = 2,
58 EMFN_MODULATE_4X = 4
59 };
60
61 //! Comparison function, e.g. for depth buffer test
62 enum E_COMPARISON_FUNC
63 {
64 //! Test never succeeds, this equals disable
65 ECFN_NEVER=0,
66 //! <= test, default for e.g. depth test
67 ECFN_LESSEQUAL=1,
68 //! Exact equality
69 ECFN_EQUAL=2,
70 //! exclusive less comparison, i.e. <
71 ECFN_LESS,
72 //! Succeeds almost always, except for exact equality
73 ECFN_NOTEQUAL,
74 //! >= test
75 ECFN_GREATEREQUAL,
76 //! inverse of <=
77 ECFN_GREATER,
78 //! test succeeds always
79 ECFN_ALWAYS
80 };
81
82 //! Enum values for enabling/disabling color planes for rendering
83 enum E_COLOR_PLANE
84 {
85 //! No color enabled
86 ECP_NONE=0,
87 //! Alpha enabled
88 ECP_ALPHA=1,
89 //! Red enabled
90 ECP_RED=2,
91 //! Green enabled
92 ECP_GREEN=4,
93 //! Blue enabled
94 ECP_BLUE=8,
95 //! All colors, no alpha
96 ECP_RGB=14,
97 //! All planes enabled
98 ECP_ALL=15
99 };
100
101 //! Source of the alpha value to take
102 /** This is currently only supported in EMT_ONETEXTURE_BLEND. You can use an
103 or'ed combination of values. Alpha values are modulated (multiplicated). */
104 enum E_ALPHA_SOURCE
105 {
106 //! Use no alpha, somewhat redundant with other settings
107 EAS_NONE=0,
108 //! Use vertex color alpha
109 EAS_VERTEX_COLOR,
110 //! Use texture alpha channel
111 EAS_TEXTURE
112 };
113
114 //! EMT_ONETEXTURE_BLEND: pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam
115 /** alpha source can be an OR'ed combination of E_ALPHA_SOURCE values. */
116 inline f32 pack_textureBlendFunc ( const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE )
117 {
118 const u32 tmp = (alphaSource << 12) | (modulate << 8) | (srcFact << 4) | dstFact;
119 return FR(tmp);
120 }
121
122 //! EMT_ONETEXTURE_BLEND: unpack srcFact & dstFact and Modulo to MaterialTypeParam
123 /** The fields don't use the full byte range, so we could pack even more... */
124 inline void unpack_textureBlendFunc ( E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact,
125 E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param )
126 {
127 const u32 state = IR(param);
128 alphaSource = (state & 0x0000F000) >> 12;
129 modulo = E_MODULATE_FUNC( ( state & 0x00000F00 ) >> 8 );
130 srcFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 );
131 dstFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) );
132 }
133
134 //! EMT_ONETEXTURE_BLEND: has BlendFactor Alphablending
135 inline bool textureBlendFunc_hasAlpha ( const E_BLEND_FACTOR factor )
136 {
137 switch ( factor )
138 {
139 case EBF_SRC_ALPHA:
140 case EBF_ONE_MINUS_SRC_ALPHA:
141 case EBF_DST_ALPHA:
142 case EBF_ONE_MINUS_DST_ALPHA:
143 case EBF_SRC_ALPHA_SATURATE:
144 return true;
145 default:
146 return false;
147 }
148 }
149
150
151 //! These flags are used to specify the anti-aliasing and smoothing modes
152 /** Techniques supported are multisampling, geometry smoothing, and alpha
153 to coverage.
154 Some drivers don't support a per-material setting of the anti-aliasing
155 modes. In those cases, FSAA/multisampling is defined by the device mode
156 chosen upon creation via irr::SIrrCreationParameters.
157 */
158 enum E_ANTI_ALIASING_MODE
159 {
160 //! Use to turn off anti-aliasing for this material
161 EAAM_OFF=0,
162 //! Default anti-aliasing mode
163 EAAM_SIMPLE=1,
164 //! High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode
165 EAAM_QUALITY=3,
166 //! Line smoothing
167 EAAM_LINE_SMOOTH=4,
168 //! point smoothing, often in software and slow, only with OpenGL
169 EAAM_POINT_SMOOTH=8,
170 //! All typical anti-alias and smooth modes
171 EAAM_FULL_BASIC=15,
172 //! Enhanced anti-aliasing for transparent materials
173 /** Usually used with EMT_TRANSPARENT_ALPHA_REF and multisampling. */
174 EAAM_ALPHA_TO_COVERAGE=16
175 };
176
177 //! These flags allow to define the interpretation of vertex color when lighting is enabled
178 /** Without lighting being enabled the vertex color is the only value defining the fragment color.
179 Once lighting is enabled, the four values for diffuse, ambient, emissive, and specular take over.
180 With these flags it is possible to define which lighting factor shall be defined by the vertex color
181 instead of the lighting factor which is the same for all faces of that material.
182 The default is to use vertex color for the diffuse value, another pretty common value is to use
183 vertex color for both diffuse and ambient factor. */
184 enum E_COLOR_MATERIAL
185 {
186 //! Don't use vertex color for lighting
187 ECM_NONE=0,
188 //! Use vertex color for diffuse light, this is default
189 ECM_DIFFUSE,
190 //! Use vertex color for ambient light
191 ECM_AMBIENT,
192 //! Use vertex color for emissive light
193 ECM_EMISSIVE,
194 //! Use vertex color for specular light
195 ECM_SPECULAR,
196 //! Use vertex color for both diffuse and ambient light
197 ECM_DIFFUSE_AND_AMBIENT
198 };
199
200 //! Flags for the definition of the polygon offset feature
201 /** These flags define whether the offset should be into the screen, or towards the eye. */
202 enum E_POLYGON_OFFSET
203 {
204 //! Push pixel towards the far plane, away from the eye
205 /** This is typically used for rendering inner areas. */
206 EPO_BACK=0,
207 //! Pull pixels towards the camera.
208 /** This is typically used for polygons which should appear on top
209 of other elements, such as decals. */
210 EPO_FRONT=1
211 };
212
213 //! Names for polygon offset direction
214 const c8* const PolygonOffsetDirectionNames[] =
215 {
216 "Back",
217 "Front",
218 0
219 };
220
221
222 //! Maximum number of texture an SMaterial can have.
223 const u32 MATERIAL_MAX_TEXTURES = _IRR_MATERIAL_MAX_TEXTURES_;
224
225 //! Struct for holding parameters for a material renderer
226 class SMaterial
227 {
228 public:
229 //! Default constructor. Creates a solid, lit material with white colors
230 SMaterial()
231 : MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255),
232 EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
233 Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f),
234 ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
235 ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE),
236 PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
237 Wireframe(false), PointCloud(false), GouraudShading(true),
238 Lighting(true), ZWriteEnable(true), BackfaceCulling(true), FrontfaceCulling(false),
239 FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
240 { }
241
242 //! Copy constructor
243 /** \param other Material to copy from. */
244 SMaterial(const SMaterial& other)
245 {
246 // These pointers are checked during assignment
247 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
248 TextureLayer[i].TextureMatrix = 0;
249 *this = other;
250 }
251
252 //! Assignment operator
253 /** \param other Material to copy from. */
254 SMaterial& operator=(const SMaterial& other)
255 {
256 // Check for self-assignment!
257 if (this == &other)
258 return *this;
259
260 MaterialType = other.MaterialType;
261
262 AmbientColor = other.AmbientColor;
263 DiffuseColor = other.DiffuseColor;
264 EmissiveColor = other.EmissiveColor;
265 SpecularColor = other.SpecularColor;
266 Shininess = other.Shininess;
267 MaterialTypeParam = other.MaterialTypeParam;
268 MaterialTypeParam2 = other.MaterialTypeParam2;
269 Thickness = other.Thickness;
270 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
271 {
272 TextureLayer[i] = other.TextureLayer[i];
273 }
274
275 Wireframe = other.Wireframe;
276 PointCloud = other.PointCloud;
277 GouraudShading = other.GouraudShading;
278 Lighting = other.Lighting;
279 ZWriteEnable = other.ZWriteEnable;
280 BackfaceCulling = other.BackfaceCulling;
281 FrontfaceCulling = other.FrontfaceCulling;
282 FogEnable = other.FogEnable;
283 NormalizeNormals = other.NormalizeNormals;
284 ZBuffer = other.ZBuffer;
285 AntiAliasing = other.AntiAliasing;
286 ColorMask = other.ColorMask;
287 ColorMaterial = other.ColorMaterial;
288 BlendOperation = other.BlendOperation;
289 PolygonOffsetFactor = other.PolygonOffsetFactor;
290 PolygonOffsetDirection = other.PolygonOffsetDirection;
291 UseMipMaps = other.UseMipMaps;
292
293 return *this;
294 }
295
296 //! Texture layer array.
297 SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];
298
299 //! Type of the material. Specifies how everything is blended together
300 E_MATERIAL_TYPE MaterialType;
301
302 //! How much ambient light (a global light) is reflected by this material.
303 /** The default is full white, meaning objects are completely
304 globally illuminated. Reduce this if you want to see diffuse
305 or specular light effects. */
306 SColor AmbientColor;
307
308 //! How much diffuse light coming from a light source is reflected by this material.
309 /** The default is full white. */
310 SColor DiffuseColor;
311
312 //! Light emitted by this material. Default is to emit no light.
313 SColor EmissiveColor;
314
315 //! How much specular light (highlights from a light) is reflected.
316 /** The default is to reflect white specular light. See
317 SMaterial::Shininess on how to enable specular lights. */
318 SColor SpecularColor;
319
320 //! Value affecting the size of specular highlights.
321 /** A value of 20 is common. If set to 0, no specular
322 highlights are being used. To activate, simply set the
323 shininess of a material to a value in the range [0.5;128]:
324 \code
325 sceneNode->getMaterial(0).Shininess = 20.0f;
326 \endcode
327
328 You can change the color of the highlights using
329 \code
330 sceneNode->getMaterial(0).SpecularColor.set(255,255,255,255);
331 \endcode
332
333 The specular color of the dynamic lights
334 (SLight::SpecularColor) will influence the the highlight color
335 too, but they are set to a useful value by default when
336 creating the light scene node. Here is a simple example on how
337 to use specular highlights:
338 \code
339 // load and display mesh
340 scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(
341 smgr->getMesh("data/faerie.md2"));
342 node->setMaterialTexture(0, driver->getTexture("data/Faerie2.pcx")); // set diffuse texture
343 node->setMaterialFlag(video::EMF_LIGHTING, true); // enable dynamic lighting
344 node->getMaterial(0).Shininess = 20.0f; // set size of specular highlights
345
346 // add white light
347 scene::ILightSceneNode* light = smgr->addLightSceneNode(0,
348 core::vector3df(5,5,5), video::SColorf(1.0f, 1.0f, 1.0f));
349 \endcode */
350 f32 Shininess;
351
352 //! Free parameter, dependent on the material type.
353 /** Mostly ignored, used for example in EMT_PARALLAX_MAP_SOLID
354 and EMT_TRANSPARENT_ALPHA_CHANNEL. */
355 f32 MaterialTypeParam;
356
357 //! Second free parameter, dependent on the material type.
358 /** Mostly ignored. */
359 f32 MaterialTypeParam2;
360
361 //! Thickness of non-3dimensional elements such as lines and points.
362 f32 Thickness;
363
364 //! Is the ZBuffer enabled? Default: ECFN_LESSEQUAL
365 /** Values are from E_COMPARISON_FUNC. */
366 u8 ZBuffer;
367
368 //! Sets the antialiasing mode
369 /** Values are chosen from E_ANTI_ALIASING_MODE. Default is
370 EAAM_SIMPLE|EAAM_LINE_SMOOTH, i.e. simple multi-sample
371 anti-aliasing and lime smoothing is enabled. */
372 u8 AntiAliasing;
373
374 //! Defines the enabled color planes
375 /** Values are defined as or'ed values of the E_COLOR_PLANE enum.
376 Only enabled color planes will be rendered to the current render
377 target. Typical use is to disable all colors when rendering only to
378 depth or stencil buffer, or using Red and Green for Stereo rendering. */
379 u8 ColorMask:4;
380
381 //! Defines the interpretation of vertex color in the lighting equation
382 /** Values should be chosen from E_COLOR_MATERIAL.
383 When lighting is enabled, vertex color can be used instead of the
384 material values for light modulation. This allows to easily change e.g. the
385 diffuse light behavior of each face. The default, ECM_DIFFUSE, will result in
386 a very similar rendering as with lighting turned off, just with light shading. */
387 u8 ColorMaterial:3;
388
389 //! Store the blend operation of choice
390 /** Values to be chosen from E_BLEND_OPERATION. The actual way to use this value
391 is not yet determined, so ignore it for now. */
392 E_BLEND_OPERATION BlendOperation:4;
393
394 //! Factor specifying how far the polygon offset should be made
395 /** Specifying 0 disables the polygon offset. The direction is specified spearately.
396 The factor can be from 0 to 7.*/
397 u8 PolygonOffsetFactor:3;
398
399 //! Flag defining the direction the polygon offset is applied to.
400 /** Can be to front or to back, specififed by values from E_POLYGON_OFFSET. */
401 E_POLYGON_OFFSET PolygonOffsetDirection:1;
402
403 //! Draw as wireframe or filled triangles? Default: false
404 /** The user can access a material flag using
405 \code material.Wireframe=true \endcode
406 or \code material.setFlag(EMF_WIREFRAME, true); \endcode */
407 bool Wireframe:1;
408
409 //! Draw as point cloud or filled triangles? Default: false
410 bool PointCloud:1;
411
412 //! Flat or Gouraud shading? Default: true
413 bool GouraudShading:1;
414
415 //! Will this material be lighted? Default: true
416 bool Lighting:1;
417
418 //! Is the zbuffer writeable or is it read-only. Default: true.
419 /** This flag is forced to false if the MaterialType is a
420 transparent type and the scene parameter
421 ALLOW_ZWRITE_ON_TRANSPARENT is not set. */
422 bool ZWriteEnable:1;
423
424 //! Is backface culling enabled? Default: true
425 bool BackfaceCulling:1;
426
427 //! Is frontface culling enabled? Default: false
428 bool FrontfaceCulling:1;
429
430 //! Is fog enabled? Default: false
431 bool FogEnable:1;
432
433 //! Should normals be normalized?
434 /** Always use this if the mesh lit and scaled. Default: false */
435 bool NormalizeNormals:1;
436
437 //! Shall mipmaps be used if available
438 /** Sometimes, disabling mipmap usage can be useful. Default: true */
439 bool UseMipMaps:1;
440
441 //! Gets the texture transformation matrix for level i
442 /** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES.
443 \return Texture matrix for texture level i. */
444 core::matrix4& getTextureMatrix(u32 i)
445 {
446 return TextureLayer[i].getTextureMatrix();
447 }
448
449 //! Gets the immutable texture transformation matrix for level i
450 /** \param i The desired level.
451 \return Texture matrix for texture level i, or identity matrix for levels larger than MATERIAL_MAX_TEXTURES. */
452 const core::matrix4& getTextureMatrix(u32 i) const
453 {
454 if (i<MATERIAL_MAX_TEXTURES)
455 return TextureLayer[i].getTextureMatrix();
456 else
457 return core::IdentityMatrix;
458 }
459
460 //! Sets the i-th texture transformation matrix
461 /** \param i The desired level.
462 \param mat Texture matrix for texture level i. */
463 void setTextureMatrix(u32 i, const core::matrix4& mat)
464 {
465 if (i>=MATERIAL_MAX_TEXTURES)
466 return;
467 TextureLayer[i].setTextureMatrix(mat);
468 }
469
470 //! Gets the i-th texture
471 /** \param i The desired level.
472 \return Texture for texture level i, if defined, else 0. */
473 ITexture* getTexture(u32 i) const
474 {
475 return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0;
476 }
477
478 //! Sets the i-th texture
479 /** If i>=MATERIAL_MAX_TEXTURES this setting will be ignored.
480 \param i The desired level.
481 \param tex Texture for texture level i. */
482 void setTexture(u32 i, ITexture* tex)
483 {
484 if (i>=MATERIAL_MAX_TEXTURES)
485 return;
486 TextureLayer[i].Texture = tex;
487 }
488
489 //! Sets the Material flag to the given value
490 /** \param flag The flag to be set.
491 \param value The new value for the flag. */
492 void setFlag(E_MATERIAL_FLAG flag, bool value)
493 {
494 switch (flag)
495 {
496 case EMF_WIREFRAME:
497 Wireframe = value; break;
498 case EMF_POINTCLOUD:
499 PointCloud = value; break;
500 case EMF_GOURAUD_SHADING:
501 GouraudShading = value; break;
502 case EMF_LIGHTING:
503 Lighting = value; break;
504 case EMF_ZBUFFER:
505 ZBuffer = value; break;
506 case EMF_ZWRITE_ENABLE:
507 ZWriteEnable = value; break;
508 case EMF_BACK_FACE_CULLING:
509 BackfaceCulling = value; break;
510 case EMF_FRONT_FACE_CULLING:
511 FrontfaceCulling = value; break;
512 case EMF_BILINEAR_FILTER:
513 {
514 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
515 TextureLayer[i].BilinearFilter = value;
516 }
517 break;
518 case EMF_TRILINEAR_FILTER:
519 {
520 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
521 TextureLayer[i].TrilinearFilter = value;
522 }
523 break;
524 case EMF_ANISOTROPIC_FILTER:
525 {
526 if (value)
527 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
528 TextureLayer[i].AnisotropicFilter = 0xFF;
529 else
530 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
531 TextureLayer[i].AnisotropicFilter = 0;
532 }
533 break;
534 case EMF_FOG_ENABLE:
535 FogEnable = value; break;
536 case EMF_NORMALIZE_NORMALS:
537 NormalizeNormals = value; break;
538 case EMF_TEXTURE_WRAP:
539 {
540 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
541 {
542 TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)value;
543 TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value;
544 }
545 }
546 break;
547 case EMF_ANTI_ALIASING:
548 AntiAliasing = value?EAAM_SIMPLE:EAAM_OFF; break;
549 case EMF_COLOR_MASK:
550 ColorMask = value?ECP_ALL:ECP_NONE; break;
551 case EMF_COLOR_MATERIAL:
552 ColorMaterial = value?ECM_DIFFUSE:ECM_NONE; break;
553 case EMF_USE_MIP_MAPS:
554 UseMipMaps = value; break;
555 case EMF_BLEND_OPERATION:
556 BlendOperation = value?EBO_ADD:EBO_NONE; break;
557 case EMF_POLYGON_OFFSET:
558 PolygonOffsetFactor = value?1:0;
559 PolygonOffsetDirection = EPO_BACK;
560 break;
561 default:
562 break;
563 }
564 }
565
566 //! Gets the Material flag
567 /** \param flag The flag to query.
568 \return The current value of the flag. */
569 bool getFlag(E_MATERIAL_FLAG flag) const
570 {
571 switch (flag)
572 {
573 case EMF_WIREFRAME:
574 return Wireframe;
575 case EMF_POINTCLOUD:
576 return PointCloud;
577 case EMF_GOURAUD_SHADING:
578 return GouraudShading;
579 case EMF_LIGHTING:
580 return Lighting;
581 case EMF_ZBUFFER:
582 return ZBuffer!=ECFN_NEVER;
583 case EMF_ZWRITE_ENABLE:
584 return ZWriteEnable;
585 case EMF_BACK_FACE_CULLING:
586 return BackfaceCulling;
587 case EMF_FRONT_FACE_CULLING:
588 return FrontfaceCulling;
589 case EMF_BILINEAR_FILTER:
590 return TextureLayer[0].BilinearFilter;
591 case EMF_TRILINEAR_FILTER:
592 return TextureLayer[0].TrilinearFilter;
593 case EMF_ANISOTROPIC_FILTER:
594 return TextureLayer[0].AnisotropicFilter!=0;
595 case EMF_FOG_ENABLE:
596 return FogEnable;
597 case EMF_NORMALIZE_NORMALS:
598 return NormalizeNormals;
599 case EMF_TEXTURE_WRAP:
600 return !(TextureLayer[0].TextureWrapU ||
601 TextureLayer[0].TextureWrapV ||
602 TextureLayer[1].TextureWrapU ||
603 TextureLayer[1].TextureWrapV ||
604 TextureLayer[2].TextureWrapU ||
605 TextureLayer[2].TextureWrapV ||
606 TextureLayer[3].TextureWrapU ||
607 TextureLayer[3].TextureWrapV);
608 case EMF_ANTI_ALIASING:
609 return (AntiAliasing==1);
610 case EMF_COLOR_MASK:
611 return (ColorMask!=ECP_NONE);
612 case EMF_COLOR_MATERIAL:
613 return (ColorMaterial != ECM_NONE);
614 case EMF_USE_MIP_MAPS:
615 return UseMipMaps;
616 case EMF_BLEND_OPERATION:
617 return BlendOperation != EBO_NONE;
618 case EMF_POLYGON_OFFSET:
619 return PolygonOffsetFactor != 0;
620 }
621
622 return false;
623 }
624
625 //! Inequality operator
626 /** \param b Material to compare to.
627 \return True if the materials differ, else false. */
628 inline bool operator!=(const SMaterial& b) const
629 {
630 bool different =
631 MaterialType != b.MaterialType ||
632 AmbientColor != b.AmbientColor ||
633 DiffuseColor != b.DiffuseColor ||
634 EmissiveColor != b.EmissiveColor ||
635 SpecularColor != b.SpecularColor ||
636 Shininess != b.Shininess ||
637 MaterialTypeParam != b.MaterialTypeParam ||
638 MaterialTypeParam2 != b.MaterialTypeParam2 ||
639 Thickness != b.Thickness ||
640 Wireframe != b.Wireframe ||
641 PointCloud != b.PointCloud ||
642 GouraudShading != b.GouraudShading ||
643 Lighting != b.Lighting ||
644 ZBuffer != b.ZBuffer ||
645 ZWriteEnable != b.ZWriteEnable ||
646 BackfaceCulling != b.BackfaceCulling ||
647 FrontfaceCulling != b.FrontfaceCulling ||
648 FogEnable != b.FogEnable ||
649 NormalizeNormals != b.NormalizeNormals ||
650 AntiAliasing != b.AntiAliasing ||
651 ColorMask != b.ColorMask ||
652 ColorMaterial != b.ColorMaterial ||
653 BlendOperation != b.BlendOperation ||
654 PolygonOffsetFactor != b.PolygonOffsetFactor ||
655 PolygonOffsetDirection != b.PolygonOffsetDirection ||
656 UseMipMaps != b.UseMipMaps;
657 for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)
658 {
659 different |= (TextureLayer[i] != b.TextureLayer[i]);
660 }
661 return different;
662 }
663
664 //! Equality operator
665 /** \param b Material to compare to.
666 \return True if the materials are equal, else false. */
667 inline bool operator==(const SMaterial& b) const
668 { return !(b!=*this); }
669
670 bool isTransparent() const
671 {
672 return MaterialType==EMT_TRANSPARENT_ADD_COLOR ||
673 MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL ||
674 MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA ||
675 MaterialType==EMT_TRANSPARENT_REFLECTION_2_LAYER;
676 }
677 };
678
679 //! global const identity Material
680 IRRLICHT_API extern SMaterial IdentityMaterial;
681
682} // end namespace video
683} // end namespace irr
684
685#endif
diff --git a/src/others/irrlicht-1.8.1/include/SMaterialLayer.h b/src/others/irrlicht-1.8.1/include/SMaterialLayer.h
new file mode 100644
index 0000000..068c030
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SMaterialLayer.h
@@ -0,0 +1,228 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_MATERIAL_LAYER_H_INCLUDED__
6#define __S_MATERIAL_LAYER_H_INCLUDED__
7
8#include "matrix4.h"
9#include "irrAllocator.h"
10
11namespace irr
12{
13namespace video
14{
15 class ITexture;
16
17 //! Texture coord clamp mode outside [0.0, 1.0]
18 enum E_TEXTURE_CLAMP
19 {
20 //! Texture repeats
21 ETC_REPEAT = 0,
22 //! Texture is clamped to the last pixel
23 ETC_CLAMP,
24 //! Texture is clamped to the edge pixel
25 ETC_CLAMP_TO_EDGE,
26 //! Texture is clamped to the border pixel (if exists)
27 ETC_CLAMP_TO_BORDER,
28 //! Texture is alternatingly mirrored (0..1..0..1..0..)
29 ETC_MIRROR,
30 //! Texture is mirrored once and then clamped (0..1..0)
31 ETC_MIRROR_CLAMP,
32 //! Texture is mirrored once and then clamped to edge
33 ETC_MIRROR_CLAMP_TO_EDGE,
34 //! Texture is mirrored once and then clamped to border
35 ETC_MIRROR_CLAMP_TO_BORDER
36 };
37 static const char* const aTextureClampNames[] = {
38 "texture_clamp_repeat",
39 "texture_clamp_clamp",
40 "texture_clamp_clamp_to_edge",
41 "texture_clamp_clamp_to_border",
42 "texture_clamp_mirror",
43 "texture_clamp_mirror_clamp",
44 "texture_clamp_mirror_clamp_to_edge",
45 "texture_clamp_mirror_clamp_to_border", 0};
46
47 //! Struct for holding material parameters which exist per texture layer
48 class SMaterialLayer
49 {
50 public:
51 //! Default constructor
52 SMaterialLayer()
53 : Texture(0),
54 TextureWrapU(ETC_REPEAT),
55 TextureWrapV(ETC_REPEAT),
56 BilinearFilter(true),
57 TrilinearFilter(false),
58 AnisotropicFilter(0),
59 LODBias(0),
60 TextureMatrix(0)
61 {}
62
63 //! Copy constructor
64 /** \param other Material layer to copy from. */
65 SMaterialLayer(const SMaterialLayer& other)
66 {
67 // This pointer is checked during assignment
68 TextureMatrix = 0;
69 *this = other;
70 }
71
72 //! Destructor
73 ~SMaterialLayer()
74 {
75 MatrixAllocator.destruct(TextureMatrix);
76 MatrixAllocator.deallocate(TextureMatrix);
77 }
78
79 //! Assignment operator
80 /** \param other Material layer to copy from.
81 \return This material layer, updated. */
82 SMaterialLayer& operator=(const SMaterialLayer& other)
83 {
84 // Check for self-assignment!
85 if (this == &other)
86 return *this;
87
88 Texture = other.Texture;
89 if (TextureMatrix)
90 {
91 if (other.TextureMatrix)
92 *TextureMatrix = *other.TextureMatrix;
93 else
94 {
95 MatrixAllocator.destruct(TextureMatrix);
96 MatrixAllocator.deallocate(TextureMatrix);
97 TextureMatrix = 0;
98 }
99 }
100 else
101 {
102 if (other.TextureMatrix)
103 {
104 TextureMatrix = MatrixAllocator.allocate(1);
105 MatrixAllocator.construct(TextureMatrix,*other.TextureMatrix);
106 }
107 else
108 TextureMatrix = 0;
109 }
110 TextureWrapU = other.TextureWrapU;
111 TextureWrapV = other.TextureWrapV;
112 BilinearFilter = other.BilinearFilter;
113 TrilinearFilter = other.TrilinearFilter;
114 AnisotropicFilter = other.AnisotropicFilter;
115 LODBias = other.LODBias;
116
117 return *this;
118 }
119
120 //! Gets the texture transformation matrix
121 /** \return Texture matrix of this layer. */
122 core::matrix4& getTextureMatrix()
123 {
124 if (!TextureMatrix)
125 {
126 TextureMatrix = MatrixAllocator.allocate(1);
127 MatrixAllocator.construct(TextureMatrix,core::IdentityMatrix);
128 }
129 return *TextureMatrix;
130 }
131
132 //! Gets the immutable texture transformation matrix
133 /** \return Texture matrix of this layer. */
134 const core::matrix4& getTextureMatrix() const
135 {
136 if (TextureMatrix)
137 return *TextureMatrix;
138 else
139 return core::IdentityMatrix;
140 }
141
142 //! Sets the texture transformation matrix to mat
143 /** \param mat New texture matrix for this layer. */
144 void setTextureMatrix(const core::matrix4& mat)
145 {
146 if (!TextureMatrix)
147 {
148 TextureMatrix = MatrixAllocator.allocate(1);
149 MatrixAllocator.construct(TextureMatrix,mat);
150 }
151 else
152 *TextureMatrix = mat;
153 }
154
155 //! Inequality operator
156 /** \param b Layer to compare to.
157 \return True if layers are different, else false. */
158 inline bool operator!=(const SMaterialLayer& b) const
159 {
160 bool different =
161 Texture != b.Texture ||
162 TextureWrapU != b.TextureWrapU ||
163 TextureWrapV != b.TextureWrapV ||
164 BilinearFilter != b.BilinearFilter ||
165 TrilinearFilter != b.TrilinearFilter ||
166 AnisotropicFilter != b.AnisotropicFilter ||
167 LODBias != b.LODBias;
168 if (different)
169 return true;
170 else
171 different |= (TextureMatrix != b.TextureMatrix) &&
172 TextureMatrix && b.TextureMatrix &&
173 (*TextureMatrix != *(b.TextureMatrix));
174 return different;
175 }
176
177 //! Equality operator
178 /** \param b Layer to compare to.
179 \return True if layers are equal, else false. */
180 inline bool operator==(const SMaterialLayer& b) const
181 { return !(b!=*this); }
182
183 //! Texture
184 ITexture* Texture;
185
186 //! Texture Clamp Mode
187 /** Values are taken from E_TEXTURE_CLAMP. */
188 u8 TextureWrapU:4;
189 u8 TextureWrapV:4;
190
191 //! Is bilinear filtering enabled? Default: true
192 bool BilinearFilter:1;
193
194 //! Is trilinear filtering enabled? Default: false
195 /** If the trilinear filter flag is enabled,
196 the bilinear filtering flag is ignored. */
197 bool TrilinearFilter:1;
198
199 //! Is anisotropic filtering enabled? Default: 0, disabled
200 /** In Irrlicht you can use anisotropic texture filtering
201 in conjunction with bilinear or trilinear texture
202 filtering to improve rendering results. Primitives
203 will look less blurry with this flag switched on. The number gives
204 the maximal anisotropy degree, and is often in the range 2-16.
205 Value 1 is equivalent to 0, but should be avoided. */
206 u8 AnisotropicFilter;
207
208 //! Bias for the mipmap choosing decision.
209 /** This value can make the textures more or less blurry than with the
210 default value of 0. The value (divided by 8.f) is added to the mipmap level
211 chosen initially, and thus takes a smaller mipmap for a region
212 if the value is positive. */
213 s8 LODBias;
214
215 private:
216 friend class SMaterial;
217 irr::core::irrAllocator<irr::core::matrix4> MatrixAllocator;
218
219 //! Texture Matrix
220 /** Do not access this element directly as the internal
221 ressource management has to cope with Null pointers etc. */
222 core::matrix4* TextureMatrix;
223 };
224
225} // end namespace video
226} // end namespace irr
227
228#endif // __S_MATERIAL_LAYER_H_INCLUDED__
diff --git a/src/others/irrlicht-1.8.1/include/SMesh.h b/src/others/irrlicht-1.8.1/include/SMesh.h
new file mode 100644
index 0000000..77a695d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SMesh.h
@@ -0,0 +1,140 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_MESH_H_INCLUDED__
6#define __S_MESH_H_INCLUDED__
7
8#include "IMesh.h"
9#include "IMeshBuffer.h"
10#include "aabbox3d.h"
11#include "irrArray.h"
12
13namespace irr
14{
15namespace scene
16{
17 //! Simple implementation of the IMesh interface.
18 struct SMesh : public IMesh
19 {
20 //! constructor
21 SMesh()
22 {
23 #ifdef _DEBUG
24 setDebugName("SMesh");
25 #endif
26 }
27
28 //! destructor
29 virtual ~SMesh()
30 {
31 // drop buffers
32 for (u32 i=0; i<MeshBuffers.size(); ++i)
33 MeshBuffers[i]->drop();
34 }
35
36 //! clean mesh
37 virtual void clear()
38 {
39 for (u32 i=0; i<MeshBuffers.size(); ++i)
40 MeshBuffers[i]->drop();
41 MeshBuffers.clear();
42 BoundingBox.reset ( 0.f, 0.f, 0.f );
43 }
44
45
46 //! returns amount of mesh buffers.
47 virtual u32 getMeshBufferCount() const
48 {
49 return MeshBuffers.size();
50 }
51
52 //! returns pointer to a mesh buffer
53 virtual IMeshBuffer* getMeshBuffer(u32 nr) const
54 {
55 return MeshBuffers[nr];
56 }
57
58 //! returns a meshbuffer which fits a material
59 /** reverse search */
60 virtual IMeshBuffer* getMeshBuffer( const video::SMaterial & material) const
61 {
62 for (s32 i = (s32)MeshBuffers.size()-1; i >= 0; --i)
63 {
64 if ( material == MeshBuffers[i]->getMaterial())
65 return MeshBuffers[i];
66 }
67
68 return 0;
69 }
70
71 //! returns an axis aligned bounding box
72 virtual const core::aabbox3d<f32>& getBoundingBox() const
73 {
74 return BoundingBox;
75 }
76
77 //! set user axis aligned bounding box
78 virtual void setBoundingBox( const core::aabbox3df& box)
79 {
80 BoundingBox = box;
81 }
82
83 //! recalculates the bounding box
84 void recalculateBoundingBox()
85 {
86 if (MeshBuffers.size())
87 {
88 BoundingBox = MeshBuffers[0]->getBoundingBox();
89 for (u32 i=1; i<MeshBuffers.size(); ++i)
90 BoundingBox.addInternalBox(MeshBuffers[i]->getBoundingBox());
91 }
92 else
93 BoundingBox.reset(0.0f, 0.0f, 0.0f);
94 }
95
96 //! adds a MeshBuffer
97 /** The bounding box is not updated automatically. */
98 void addMeshBuffer(IMeshBuffer* buf)
99 {
100 if (buf)
101 {
102 buf->grab();
103 MeshBuffers.push_back(buf);
104 }
105 }
106
107 //! sets a flag of all contained materials to a new value
108 virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
109 {
110 for (u32 i=0; i<MeshBuffers.size(); ++i)
111 MeshBuffers[i]->getMaterial().setFlag(flag, newvalue);
112 }
113
114 //! set the hardware mapping hint, for driver
115 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX )
116 {
117 for (u32 i=0; i<MeshBuffers.size(); ++i)
118 MeshBuffers[i]->setHardwareMappingHint(newMappingHint, buffer);
119 }
120
121 //! flags the meshbuffer as changed, reloads hardware buffers
122 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
123 {
124 for (u32 i=0; i<MeshBuffers.size(); ++i)
125 MeshBuffers[i]->setDirty(buffer);
126 }
127
128 //! The meshbuffers of this mesh
129 core::array<IMeshBuffer*> MeshBuffers;
130
131 //! The bounding box of this mesh
132 core::aabbox3d<f32> BoundingBox;
133 };
134
135
136} // end namespace scene
137} // end namespace irr
138
139#endif
140
diff --git a/src/others/irrlicht-1.8.1/include/SMeshBuffer.h b/src/others/irrlicht-1.8.1/include/SMeshBuffer.h
new file mode 100644
index 0000000..03b441f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SMeshBuffer.h
@@ -0,0 +1,7 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5// replaced by template
6#include "CMeshBuffer.h"
7
diff --git a/src/others/irrlicht-1.8.1/include/SMeshBufferLightMap.h b/src/others/irrlicht-1.8.1/include/SMeshBufferLightMap.h
new file mode 100644
index 0000000..03b441f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SMeshBufferLightMap.h
@@ -0,0 +1,7 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5// replaced by template
6#include "CMeshBuffer.h"
7
diff --git a/src/others/irrlicht-1.8.1/include/SMeshBufferTangents.h b/src/others/irrlicht-1.8.1/include/SMeshBufferTangents.h
new file mode 100644
index 0000000..03b441f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SMeshBufferTangents.h
@@ -0,0 +1,7 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5// replaced by template
6#include "CMeshBuffer.h"
7
diff --git a/src/others/irrlicht-1.8.1/include/SParticle.h b/src/others/irrlicht-1.8.1/include/SParticle.h
new file mode 100644
index 0000000..d1507a1
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SParticle.h
@@ -0,0 +1,56 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_PARTICLE_H_INCLUDED__
6#define __S_PARTICLE_H_INCLUDED__
7
8#include "vector3d.h"
9#include "dimension2d.h"
10#include "SColor.h"
11
12namespace irr
13{
14namespace scene
15{
16 //! Struct for holding particle data
17 struct SParticle
18 {
19 //! Position of the particle
20 core::vector3df pos;
21
22 //! Direction and speed of the particle
23 core::vector3df vector;
24
25 //! Start life time of the particle
26 u32 startTime;
27
28 //! End life time of the particle
29 u32 endTime;
30
31 //! Current color of the particle
32 video::SColor color;
33
34 //! Original color of the particle.
35 /** That's the color of the particle it had when it was emitted. */
36 video::SColor startColor;
37
38 //! Original direction and speed of the particle.
39 /** The direction and speed the particle had when it was emitted. */
40 core::vector3df startVector;
41
42 //! Scale of the particle.
43 /** The current scale of the particle. */
44 core::dimension2df size;
45
46 //! Original scale of the particle.
47 /** The scale of the particle when it was emitted. */
48 core::dimension2df startSize;
49 };
50
51
52} // end namespace scene
53} // end namespace irr
54
55#endif
56
diff --git a/src/others/irrlicht-1.8.1/include/SSharedMeshBuffer.h b/src/others/irrlicht-1.8.1/include/SSharedMeshBuffer.h
new file mode 100644
index 0000000..b9ee07a
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SSharedMeshBuffer.h
@@ -0,0 +1,242 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_SHARED_MESH_BUFFER_H_INCLUDED__
6#define __S_SHARED_MESH_BUFFER_H_INCLUDED__
7
8#include "irrArray.h"
9#include "IMeshBuffer.h"
10
11namespace irr
12{
13namespace scene
14{
15 //! Implementation of the IMeshBuffer interface with shared vertex list
16 struct SSharedMeshBuffer : public IMeshBuffer
17 {
18 //! constructor
19 SSharedMeshBuffer() : IMeshBuffer(), Vertices(0), ChangedID_Vertex(1), ChangedID_Index(1), MappingHintVertex(EHM_NEVER), MappingHintIndex(EHM_NEVER)
20 {
21 #ifdef _DEBUG
22 setDebugName("SSharedMeshBuffer");
23 #endif
24 }
25
26 //! constructor
27 SSharedMeshBuffer(core::array<video::S3DVertex> *vertices) : IMeshBuffer(), Vertices(vertices)
28 {
29 #ifdef _DEBUG
30 setDebugName("SSharedMeshBuffer");
31 #endif
32 }
33
34 //! returns the material of this meshbuffer
35 virtual const video::SMaterial& getMaterial() const
36 {
37 return Material;
38 }
39
40 //! returns the material of this meshbuffer
41 virtual video::SMaterial& getMaterial()
42 {
43 return Material;
44 }
45
46 //! returns pointer to vertices
47 virtual const void* getVertices() const
48 {
49 if (Vertices)
50 return Vertices->const_pointer();
51 else
52 return 0;
53 }
54
55 //! returns pointer to vertices
56 virtual void* getVertices()
57 {
58 if (Vertices)
59 return Vertices->pointer();
60 else
61 return 0;
62 }
63
64 //! returns amount of vertices
65 virtual u32 getVertexCount() const
66 {
67 if (Vertices)
68 return Vertices->size();
69 else
70 return 0;
71 }
72
73 //! returns pointer to Indices
74 virtual const u16* getIndices() const
75 {
76 return Indices.const_pointer();
77 }
78
79 //! returns pointer to Indices
80 virtual u16* getIndices()
81 {
82 return Indices.pointer();
83 }
84
85 //! returns amount of indices
86 virtual u32 getIndexCount() const
87 {
88 return Indices.size();
89 }
90
91 //! Get type of index data which is stored in this meshbuffer.
92 virtual video::E_INDEX_TYPE getIndexType() const
93 {
94 return video::EIT_16BIT;
95 }
96
97 //! returns an axis aligned bounding box
98 virtual const core::aabbox3d<f32>& getBoundingBox() const
99 {
100 return BoundingBox;
101 }
102
103 //! set user axis aligned bounding box
104 virtual void setBoundingBox( const core::aabbox3df& box)
105 {
106 BoundingBox = box;
107 }
108
109 //! returns which type of vertex data is stored.
110 virtual video::E_VERTEX_TYPE getVertexType() const
111 {
112 return video::EVT_STANDARD;
113 }
114
115 //! recalculates the bounding box. should be called if the mesh changed.
116 virtual void recalculateBoundingBox()
117 {
118 if (!Vertices || Vertices->empty() || Indices.empty())
119 BoundingBox.reset(0,0,0);
120 else
121 {
122 BoundingBox.reset((*Vertices)[Indices[0]].Pos);
123 for (u32 i=1; i<Indices.size(); ++i)
124 BoundingBox.addInternalPoint((*Vertices)[Indices[i]].Pos);
125 }
126 }
127
128 //! returns position of vertex i
129 virtual const core::vector3df& getPosition(u32 i) const
130 {
131 _IRR_DEBUG_BREAK_IF(!Vertices);
132 return (*Vertices)[Indices[i]].Pos;
133 }
134
135 //! returns position of vertex i
136 virtual core::vector3df& getPosition(u32 i)
137 {
138 _IRR_DEBUG_BREAK_IF(!Vertices);
139 return (*Vertices)[Indices[i]].Pos;
140 }
141
142 //! returns normal of vertex i
143 virtual const core::vector3df& getNormal(u32 i) const
144 {
145 _IRR_DEBUG_BREAK_IF(!Vertices);
146 return (*Vertices)[Indices[i]].Normal;
147 }
148
149 //! returns normal of vertex i
150 virtual core::vector3df& getNormal(u32 i)
151 {
152 _IRR_DEBUG_BREAK_IF(!Vertices);
153 return (*Vertices)[Indices[i]].Normal;
154 }
155
156 //! returns texture coord of vertex i
157 virtual const core::vector2df& getTCoords(u32 i) const
158 {
159 _IRR_DEBUG_BREAK_IF(!Vertices);
160 return (*Vertices)[Indices[i]].TCoords;
161 }
162
163 //! returns texture coord of vertex i
164 virtual core::vector2df& getTCoords(u32 i)
165 {
166 _IRR_DEBUG_BREAK_IF(!Vertices);
167 return (*Vertices)[Indices[i]].TCoords;
168 }
169
170 //! append the vertices and indices to the current buffer
171 virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {}
172
173 //! append the meshbuffer to the current buffer
174 virtual void append(const IMeshBuffer* const other) {}
175
176 //! get the current hardware mapping hint
177 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const
178 {
179 return MappingHintVertex;
180 }
181
182 //! get the current hardware mapping hint
183 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const
184 {
185 return MappingHintIndex;
186 }
187
188 //! set the hardware mapping hint, for driver
189 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX )
190 {
191 if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX)
192 MappingHintVertex=NewMappingHint;
193 if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX)
194 MappingHintIndex=NewMappingHint;
195 }
196
197 //! flags the mesh as changed, reloads hardware buffers
198 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
199 {
200 if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX)
201 ++ChangedID_Vertex;
202 if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX)
203 ++ChangedID_Index;
204 }
205
206 //! Get the currently used ID for identification of changes.
207 /** This shouldn't be used for anything outside the VideoDriver. */
208 virtual u32 getChangedID_Vertex() const {return ChangedID_Vertex;}
209
210 //! Get the currently used ID for identification of changes.
211 /** This shouldn't be used for anything outside the VideoDriver. */
212 virtual u32 getChangedID_Index() const {return ChangedID_Index;}
213
214 //! Material of this meshBuffer
215 video::SMaterial Material;
216
217 //! Shared Array of vertices
218 core::array<video::S3DVertex> *Vertices;
219
220 //! Array of Indices
221 core::array<u16> Indices;
222
223 //! ID used for hardware buffer management
224 u32 ChangedID_Vertex;
225
226 //! ID used for hardware buffer management
227 u32 ChangedID_Index;
228
229 //! Bounding box
230 core::aabbox3df BoundingBox;
231
232 //! hardware mapping hint
233 E_HARDWARE_MAPPING MappingHintVertex;
234 E_HARDWARE_MAPPING MappingHintIndex;
235 };
236
237
238} // end namespace scene
239} // end namespace irr
240
241#endif
242
diff --git a/src/others/irrlicht-1.8.1/include/SSkinMeshBuffer.h b/src/others/irrlicht-1.8.1/include/SSkinMeshBuffer.h
new file mode 100644
index 0000000..4582b80
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SSkinMeshBuffer.h
@@ -0,0 +1,404 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SKIN_MESH_BUFFER_H_INCLUDED__
6#define __I_SKIN_MESH_BUFFER_H_INCLUDED__
7
8#include "IMeshBuffer.h"
9#include "S3DVertex.h"
10
11
12namespace irr
13{
14namespace scene
15{
16
17
18//! A mesh buffer able to choose between S3DVertex2TCoords, S3DVertex and S3DVertexTangents at runtime
19struct SSkinMeshBuffer : public IMeshBuffer
20{
21 //! Default constructor
22 SSkinMeshBuffer(video::E_VERTEX_TYPE vt=video::EVT_STANDARD) :
23 ChangedID_Vertex(1), ChangedID_Index(1), VertexType(vt),
24 MappingHint_Vertex(EHM_NEVER), MappingHint_Index(EHM_NEVER),
25 BoundingBoxNeedsRecalculated(true)
26 {
27 #ifdef _DEBUG
28 setDebugName("SSkinMeshBuffer");
29 #endif
30 }
31
32 //! Get Material of this buffer.
33 virtual const video::SMaterial& getMaterial() const
34 {
35 return Material;
36 }
37
38 //! Get Material of this buffer.
39 virtual video::SMaterial& getMaterial()
40 {
41 return Material;
42 }
43
44 //! Get standard vertex at given index
45 virtual video::S3DVertex *getVertex(u32 index)
46 {
47 switch (VertexType)
48 {
49 case video::EVT_2TCOORDS:
50 return (video::S3DVertex*)&Vertices_2TCoords[index];
51 case video::EVT_TANGENTS:
52 return (video::S3DVertex*)&Vertices_Tangents[index];
53 default:
54 return &Vertices_Standard[index];
55 }
56 }
57
58 //! Get pointer to vertex array
59 virtual const void* getVertices() const
60 {
61 switch (VertexType)
62 {
63 case video::EVT_2TCOORDS:
64 return Vertices_2TCoords.const_pointer();
65 case video::EVT_TANGENTS:
66 return Vertices_Tangents.const_pointer();
67 default:
68 return Vertices_Standard.const_pointer();
69 }
70 }
71
72 //! Get pointer to vertex array
73 virtual void* getVertices()
74 {
75 switch (VertexType)
76 {
77 case video::EVT_2TCOORDS:
78 return Vertices_2TCoords.pointer();
79 case video::EVT_TANGENTS:
80 return Vertices_Tangents.pointer();
81 default:
82 return Vertices_Standard.pointer();
83 }
84 }
85
86 //! Get vertex count
87 virtual u32 getVertexCount() const
88 {
89 switch (VertexType)
90 {
91 case video::EVT_2TCOORDS:
92 return Vertices_2TCoords.size();
93 case video::EVT_TANGENTS:
94 return Vertices_Tangents.size();
95 default:
96 return Vertices_Standard.size();
97 }
98 }
99
100 //! Get type of index data which is stored in this meshbuffer.
101 /** \return Index type of this buffer. */
102 virtual video::E_INDEX_TYPE getIndexType() const
103 {
104 return video::EIT_16BIT;
105 }
106
107 //! Get pointer to index array
108 virtual const u16* getIndices() const
109 {
110 return Indices.const_pointer();
111 }
112
113 //! Get pointer to index array
114 virtual u16* getIndices()
115 {
116 return Indices.pointer();
117 }
118
119 //! Get index count
120 virtual u32 getIndexCount() const
121 {
122 return Indices.size();
123 }
124
125 //! Get bounding box
126 virtual const core::aabbox3d<f32>& getBoundingBox() const
127 {
128 return BoundingBox;
129 }
130
131 //! Set bounding box
132 virtual void setBoundingBox( const core::aabbox3df& box)
133 {
134 BoundingBox = box;
135 }
136
137 //! Recalculate bounding box
138 virtual void recalculateBoundingBox()
139 {
140 if(!BoundingBoxNeedsRecalculated)
141 return;
142
143 BoundingBoxNeedsRecalculated = false;
144
145 switch (VertexType)
146 {
147 case video::EVT_STANDARD:
148 {
149 if (Vertices_Standard.empty())
150 BoundingBox.reset(0,0,0);
151 else
152 {
153 BoundingBox.reset(Vertices_Standard[0].Pos);
154 for (u32 i=1; i<Vertices_Standard.size(); ++i)
155 BoundingBox.addInternalPoint(Vertices_Standard[i].Pos);
156 }
157 break;
158 }
159 case video::EVT_2TCOORDS:
160 {
161 if (Vertices_2TCoords.empty())
162 BoundingBox.reset(0,0,0);
163 else
164 {
165 BoundingBox.reset(Vertices_2TCoords[0].Pos);
166 for (u32 i=1; i<Vertices_2TCoords.size(); ++i)
167 BoundingBox.addInternalPoint(Vertices_2TCoords[i].Pos);
168 }
169 break;
170 }
171 case video::EVT_TANGENTS:
172 {
173 if (Vertices_Tangents.empty())
174 BoundingBox.reset(0,0,0);
175 else
176 {
177 BoundingBox.reset(Vertices_Tangents[0].Pos);
178 for (u32 i=1; i<Vertices_Tangents.size(); ++i)
179 BoundingBox.addInternalPoint(Vertices_Tangents[i].Pos);
180 }
181 break;
182 }
183 }
184 }
185
186 //! Get vertex type
187 virtual video::E_VERTEX_TYPE getVertexType() const
188 {
189 return VertexType;
190 }
191
192 //! Convert to 2tcoords vertex type
193 virtual void convertTo2TCoords()
194 {
195 if (VertexType==video::EVT_STANDARD)
196 {
197 for(u32 n=0;n<Vertices_Standard.size();++n)
198 {
199 video::S3DVertex2TCoords Vertex;
200 Vertex.Color=Vertices_Standard[n].Color;
201 Vertex.Pos=Vertices_Standard[n].Pos;
202 Vertex.Normal=Vertices_Standard[n].Normal;
203 Vertex.TCoords=Vertices_Standard[n].TCoords;
204 Vertices_2TCoords.push_back(Vertex);
205 }
206 Vertices_Standard.clear();
207 VertexType=video::EVT_2TCOORDS;
208 }
209 }
210
211 //! Convert to tangents vertex type
212 virtual void convertToTangents()
213 {
214 if (VertexType==video::EVT_STANDARD)
215 {
216 for(u32 n=0;n<Vertices_Standard.size();++n)
217 {
218 video::S3DVertexTangents Vertex;
219 Vertex.Color=Vertices_Standard[n].Color;
220 Vertex.Pos=Vertices_Standard[n].Pos;
221 Vertex.Normal=Vertices_Standard[n].Normal;
222 Vertex.TCoords=Vertices_Standard[n].TCoords;
223 Vertices_Tangents.push_back(Vertex);
224 }
225 Vertices_Standard.clear();
226 VertexType=video::EVT_TANGENTS;
227 }
228 else if (VertexType==video::EVT_2TCOORDS)
229 {
230 for(u32 n=0;n<Vertices_2TCoords.size();++n)
231 {
232 video::S3DVertexTangents Vertex;
233 Vertex.Color=Vertices_2TCoords[n].Color;
234 Vertex.Pos=Vertices_2TCoords[n].Pos;
235 Vertex.Normal=Vertices_2TCoords[n].Normal;
236 Vertex.TCoords=Vertices_2TCoords[n].TCoords;
237 Vertices_Tangents.push_back(Vertex);
238 }
239 Vertices_2TCoords.clear();
240 VertexType=video::EVT_TANGENTS;
241 }
242 }
243
244 //! returns position of vertex i
245 virtual const core::vector3df& getPosition(u32 i) const
246 {
247 switch (VertexType)
248 {
249 case video::EVT_2TCOORDS:
250 return Vertices_2TCoords[i].Pos;
251 case video::EVT_TANGENTS:
252 return Vertices_Tangents[i].Pos;
253 default:
254 return Vertices_Standard[i].Pos;
255 }
256 }
257
258 //! returns position of vertex i
259 virtual core::vector3df& getPosition(u32 i)
260 {
261 switch (VertexType)
262 {
263 case video::EVT_2TCOORDS:
264 return Vertices_2TCoords[i].Pos;
265 case video::EVT_TANGENTS:
266 return Vertices_Tangents[i].Pos;
267 default:
268 return Vertices_Standard[i].Pos;
269 }
270 }
271
272 //! returns normal of vertex i
273 virtual const core::vector3df& getNormal(u32 i) const
274 {
275 switch (VertexType)
276 {
277 case video::EVT_2TCOORDS:
278 return Vertices_2TCoords[i].Normal;
279 case video::EVT_TANGENTS:
280 return Vertices_Tangents[i].Normal;
281 default:
282 return Vertices_Standard[i].Normal;
283 }
284 }
285
286 //! returns normal of vertex i
287 virtual core::vector3df& getNormal(u32 i)
288 {
289 switch (VertexType)
290 {
291 case video::EVT_2TCOORDS:
292 return Vertices_2TCoords[i].Normal;
293 case video::EVT_TANGENTS:
294 return Vertices_Tangents[i].Normal;
295 default:
296 return Vertices_Standard[i].Normal;
297 }
298 }
299
300 //! returns texture coords of vertex i
301 virtual const core::vector2df& getTCoords(u32 i) const
302 {
303 switch (VertexType)
304 {
305 case video::EVT_2TCOORDS:
306 return Vertices_2TCoords[i].TCoords;
307 case video::EVT_TANGENTS:
308 return Vertices_Tangents[i].TCoords;
309 default:
310 return Vertices_Standard[i].TCoords;
311 }
312 }
313
314 //! returns texture coords of vertex i
315 virtual core::vector2df& getTCoords(u32 i)
316 {
317 switch (VertexType)
318 {
319 case video::EVT_2TCOORDS:
320 return Vertices_2TCoords[i].TCoords;
321 case video::EVT_TANGENTS:
322 return Vertices_Tangents[i].TCoords;
323 default:
324 return Vertices_Standard[i].TCoords;
325 }
326 }
327
328 //! append the vertices and indices to the current buffer
329 virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {}
330
331 //! append the meshbuffer to the current buffer
332 virtual void append(const IMeshBuffer* const other) {}
333
334 //! get the current hardware mapping hint for vertex buffers
335 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const
336 {
337 return MappingHint_Vertex;
338 }
339
340 //! get the current hardware mapping hint for index buffers
341 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const
342 {
343 return MappingHint_Index;
344 }
345
346 //! set the hardware mapping hint, for driver
347 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX )
348 {
349 if (Buffer==EBT_VERTEX)
350 MappingHint_Vertex=NewMappingHint;
351 else if (Buffer==EBT_INDEX)
352 MappingHint_Index=NewMappingHint;
353 else if (Buffer==EBT_VERTEX_AND_INDEX)
354 {
355 MappingHint_Vertex=NewMappingHint;
356 MappingHint_Index=NewMappingHint;
357 }
358 }
359
360 //! flags the mesh as changed, reloads hardware buffers
361 virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX)
362 {
363 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
364 ++ChangedID_Vertex;
365 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
366 ++ChangedID_Index;
367 }
368
369 virtual u32 getChangedID_Vertex() const {return ChangedID_Vertex;}
370
371 virtual u32 getChangedID_Index() const {return ChangedID_Index;}
372
373 //! Call this after changing the positions of any vertex.
374 void boundingBoxNeedsRecalculated(void) { BoundingBoxNeedsRecalculated = true; }
375
376 core::array<video::S3DVertexTangents> Vertices_Tangents;
377 core::array<video::S3DVertex2TCoords> Vertices_2TCoords;
378 core::array<video::S3DVertex> Vertices_Standard;
379 core::array<u16> Indices;
380
381 u32 ChangedID_Vertex;
382 u32 ChangedID_Index;
383
384 //ISkinnedMesh::SJoint *AttachedJoint;
385 core::matrix4 Transformation;
386
387 video::SMaterial Material;
388 video::E_VERTEX_TYPE VertexType;
389
390 core::aabbox3d<f32> BoundingBox;
391
392 // hardware mapping hint
393 E_HARDWARE_MAPPING MappingHint_Vertex:3;
394 E_HARDWARE_MAPPING MappingHint_Index:3;
395
396 bool BoundingBoxNeedsRecalculated:1;
397};
398
399
400} // end namespace scene
401} // end namespace irr
402
403#endif
404
diff --git a/src/others/irrlicht-1.8.1/include/SVertexIndex.h b/src/others/irrlicht-1.8.1/include/SVertexIndex.h
new file mode 100644
index 0000000..d6837dc
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SVertexIndex.h
@@ -0,0 +1,79 @@
1// Copyright (C) 2008-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_VERTEX_INDEX_H_INCLUDED__
6#define __S_VERTEX_INDEX_H_INCLUDED__
7
8#include "irrTypes.h"
9
10
11namespace irr
12{
13namespace video
14{
15enum E_INDEX_TYPE
16{
17 EIT_16BIT = 0,
18 EIT_32BIT
19};
20
21
22/*
23//! vertex index used by the Irrlicht engine.
24template <class T>
25struct SSpecificVertexIndex
26{
27 T Index;
28
29 //! default constructor
30 SSpecificVertexIndex() {}
31
32 //! constructor
33 SSpecificVertexIndex(u32 _index) :Index(_index) {}
34
35 bool operator==(const SSpecificVertexIndex& other) const
36 {
37 return (Index == other.Index);
38 }
39
40 bool operator!=(const SSpecificVertexIndex& other) const
41 {
42 return (Index != other.Index);
43 }
44
45 bool operator<(const SSpecificVertexIndex& other) const
46 {
47 return (Index < other.Index);
48 }
49
50 SSpecificVertexIndex operator+(const u32& other) const
51 {
52 return SSpecificVertexIndex(Index + other);
53 }
54
55 operator const u32() const
56 {
57 return (const u32)Index;
58 }
59
60 E_INDEX_TYPE getType() const
61 {
62 if (sizeof(T)==sizeof(u16))
63 return video::EIT_16BIT;
64 return video::EIT_32BIT;
65 }
66
67};
68
69//typedef SSpecificVertexIndex<u16> SVertexIndex;
70
71typedef u32 SVertexIndex;
72*/
73
74
75} // end namespace video
76} // end namespace irr
77
78#endif
79
diff --git a/src/others/irrlicht-1.8.1/include/SVertexManipulator.h b/src/others/irrlicht-1.8.1/include/SVertexManipulator.h
new file mode 100644
index 0000000..6696ad0
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SVertexManipulator.h
@@ -0,0 +1,292 @@
1// Copyright (C) 2009-2012 Christian Stehno
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_VERTEX_MANIPULATOR_H_INCLUDED__
6#define __S_VERTEX_MANIPULATOR_H_INCLUDED__
7
8#include "S3DVertex.h"
9#include "SColor.h"
10
11namespace irr
12{
13namespace scene
14{
15
16 class IMesh;
17 class IMeshBuffer;
18 struct SMesh;
19
20 //! Interface for vertex manipulators.
21 /** You should derive your manipulator from this class if it shall be called for every vertex, getting as parameter just the vertex.
22 */
23 struct IVertexManipulator
24 {
25 };
26 //! Vertex manipulator to set color to a fixed color for all vertices
27 class SVertexColorSetManipulator : public IVertexManipulator
28 {
29 public:
30 SVertexColorSetManipulator(video::SColor color) : Color(color) {}
31 void operator()(video::S3DVertex& vertex) const
32 {
33 vertex.Color=Color;
34 }
35 private:
36 video::SColor Color;
37 };
38 //! Vertex manipulator to set the alpha value of the vertex color to a fixed value
39 class SVertexColorSetAlphaManipulator : public IVertexManipulator
40 {
41 public:
42 SVertexColorSetAlphaManipulator(u32 alpha) : Alpha(alpha) {}
43 void operator()(video::S3DVertex& vertex) const
44 {
45 vertex.Color.setAlpha(Alpha);
46 }
47 private:
48 u32 Alpha;
49 };
50 //! Vertex manipulator which invertes the RGB values
51 class SVertexColorInvertManipulator : public IVertexManipulator
52 {
53 public:
54 void operator()(video::S3DVertex& vertex) const
55 {
56 vertex.Color.setRed(255-vertex.Color.getRed());
57 vertex.Color.setGreen(255-vertex.Color.getGreen());
58 vertex.Color.setBlue(255-vertex.Color.getBlue());
59 }
60 };
61 //! Vertex manipulator to set vertex color to one of two values depending on a given threshold
62 /** If average of the color value is >Threshold the High color is chosen, else Low. */
63 class SVertexColorThresholdManipulator : public IVertexManipulator
64 {
65 public:
66 SVertexColorThresholdManipulator(u8 threshold, video::SColor low,
67 video::SColor high) : Threshold(threshold), Low(low), High(high) {}
68 void operator()(video::S3DVertex& vertex) const
69 {
70 vertex.Color = ((u8)vertex.Color.getAverage()>Threshold)?High:Low;
71 }
72 private:
73 u8 Threshold;
74 video::SColor Low;
75 video::SColor High;
76 };
77 //! Vertex manipulator which adjusts the brightness by the given amount
78 /** A positive value increases brightness, a negative value darkens the colors. */
79 class SVertexColorBrightnessManipulator : public IVertexManipulator
80 {
81 public:
82 SVertexColorBrightnessManipulator(s32 amount) : Amount(amount) {}
83 void operator()(video::S3DVertex& vertex) const
84 {
85 vertex.Color.setRed(core::clamp(vertex.Color.getRed()+Amount, 0u, 255u));
86 vertex.Color.setGreen(core::clamp(vertex.Color.getGreen()+Amount, 0u, 255u));
87 vertex.Color.setBlue(core::clamp(vertex.Color.getBlue()+Amount, 0u, 255u));
88 }
89 private:
90 s32 Amount;
91 };
92 //! Vertex manipulator which adjusts the contrast by the given factor
93 /** Factors over 1 increase contrast, below 1 reduce it. */
94 class SVertexColorContrastManipulator : public IVertexManipulator
95 {
96 public:
97 SVertexColorContrastManipulator(f32 factor) : Factor(factor) {}
98 void operator()(video::S3DVertex& vertex) const
99 {
100 vertex.Color.setRed(core::clamp(core::round32((vertex.Color.getRed()-128)*Factor)+128, 0, 255));
101 vertex.Color.setGreen(core::clamp(core::round32((vertex.Color.getGreen()-128)*Factor)+128, 0, 255));
102 vertex.Color.setBlue(core::clamp(core::round32((vertex.Color.getBlue()-128)*Factor)+128, 0, 255));
103 }
104 private:
105 f32 Factor;
106 };
107 //! Vertex manipulator which adjusts the contrast by the given factor and brightness by a signed amount.
108 /** Factors over 1 increase contrast, below 1 reduce it.
109 A positive amount increases brightness, a negative one darkens the colors. */
110 class SVertexColorContrastBrightnessManipulator : public IVertexManipulator
111 {
112 public:
113 SVertexColorContrastBrightnessManipulator(f32 factor, s32 amount) : Factor(factor), Amount(amount+128) {}
114 void operator()(video::S3DVertex& vertex) const
115 {
116 vertex.Color.setRed(core::clamp(core::round32((vertex.Color.getRed()-128)*Factor)+Amount, 0, 255));
117 vertex.Color.setGreen(core::clamp(core::round32((vertex.Color.getGreen()-128)*Factor)+Amount, 0, 255));
118 vertex.Color.setBlue(core::clamp(core::round32((vertex.Color.getBlue()-128)*Factor)+Amount, 0, 255));
119 }
120 private:
121 f32 Factor;
122 s32 Amount;
123 };
124 //! Vertex manipulator which adjusts the brightness by a gamma operation
125 /** A value over one increases brightness, one below darkens the colors. */
126 class SVertexColorGammaManipulator : public IVertexManipulator
127 {
128 public:
129 SVertexColorGammaManipulator(f32 gamma) : Gamma(1.f)
130 {
131 if (gamma != 0.f)
132 Gamma = 1.f/gamma;
133 }
134 void operator()(video::S3DVertex& vertex) const
135 {
136 vertex.Color.setRed(core::clamp(core::round32(powf((f32)(vertex.Color.getRed()),Gamma)), 0, 255));
137 vertex.Color.setGreen(core::clamp(core::round32(powf((f32)(vertex.Color.getGreen()),Gamma)), 0, 255));
138 vertex.Color.setBlue(core::clamp(core::round32(powf((f32)(vertex.Color.getBlue()),Gamma)), 0, 255));
139 }
140 private:
141 f32 Gamma;
142 };
143 //! Vertex manipulator which scales the color values
144 /** Can e.g be used for white balance, factor would be 255.f/brightest color. */
145 class SVertexColorScaleManipulator : public IVertexManipulator
146 {
147 public:
148 SVertexColorScaleManipulator(f32 factor) : Factor(factor) {}
149 void operator()(video::S3DVertex& vertex) const
150 {
151 vertex.Color.setRed(core::clamp(core::round32(vertex.Color.getRed()*Factor), 0, 255));
152 vertex.Color.setGreen(core::clamp(core::round32(vertex.Color.getGreen()*Factor), 0, 255));
153 vertex.Color.setBlue(core::clamp(core::round32(vertex.Color.getBlue()*Factor), 0, 255));
154 }
155 private:
156 f32 Factor;
157 };
158 //! Vertex manipulator which desaturates the color values
159 /** Uses the lightness value of the color. */
160 class SVertexColorDesaturateToLightnessManipulator : public IVertexManipulator
161 {
162 public:
163 void operator()(video::S3DVertex& vertex) const
164 {
165 vertex.Color=core::round32(vertex.Color.getLightness());
166 }
167 };
168 //! Vertex manipulator which desaturates the color values
169 /** Uses the average value of the color. */
170 class SVertexColorDesaturateToAverageManipulator : public IVertexManipulator
171 {
172 public:
173 void operator()(video::S3DVertex& vertex) const
174 {
175 vertex.Color=vertex.Color.getAverage();
176 }
177 };
178 //! Vertex manipulator which desaturates the color values
179 /** Uses the luminance value of the color. */
180 class SVertexColorDesaturateToLuminanceManipulator : public IVertexManipulator
181 {
182 public:
183 void operator()(video::S3DVertex& vertex) const
184 {
185 vertex.Color=core::round32(vertex.Color.getLuminance());
186 }
187 };
188 //! Vertex manipulator which interpolates the color values
189 /** Uses linear interpolation. */
190 class SVertexColorInterpolateLinearManipulator : public IVertexManipulator
191 {
192 public:
193 SVertexColorInterpolateLinearManipulator(video::SColor color, f32 factor) :
194 Color(color), Factor(factor) {}
195 void operator()(video::S3DVertex& vertex) const
196 {
197 vertex.Color=vertex.Color.getInterpolated(Color, Factor);
198 }
199 private:
200 video::SColor Color;
201 f32 Factor;
202 };
203 //! Vertex manipulator which interpolates the color values
204 /** Uses linear interpolation. */
205 class SVertexColorInterpolateQuadraticManipulator : public IVertexManipulator
206 {
207 public:
208 SVertexColorInterpolateQuadraticManipulator(video::SColor color1, video::SColor color2, f32 factor) :
209 Color1(color1), Color2(color2), Factor(factor) {}
210 void operator()(video::S3DVertex& vertex) const
211 {
212 vertex.Color=vertex.Color.getInterpolated_quadratic(Color1, Color2, Factor);
213 }
214 private:
215 video::SColor Color1;
216 video::SColor Color2;
217 f32 Factor;
218 };
219
220 //! Vertex manipulator which scales the position of the vertex
221 class SVertexPositionScaleManipulator : public IVertexManipulator
222 {
223 public:
224 SVertexPositionScaleManipulator(const core::vector3df& factor) : Factor(factor) {}
225 template <typename VType>
226 void operator()(VType& vertex) const
227 {
228 vertex.Pos *= Factor;
229 }
230 private:
231 core::vector3df Factor;
232 };
233
234 //! Vertex manipulator which scales the position of the vertex along the normals
235 /** This can look more pleasing than the usual Scale operator, but
236 depends on the mesh geometry.
237 */
238 class SVertexPositionScaleAlongNormalsManipulator : public IVertexManipulator
239 {
240 public:
241 SVertexPositionScaleAlongNormalsManipulator(const core::vector3df& factor) : Factor(factor) {}
242 template <typename VType>
243 void operator()(VType& vertex) const
244 {
245 vertex.Pos += vertex.Normal*Factor;
246 }
247 private:
248 core::vector3df Factor;
249 };
250
251 //! Vertex manipulator which transforms the position of the vertex
252 class SVertexPositionTransformManipulator : public IVertexManipulator
253 {
254 public:
255 SVertexPositionTransformManipulator(const core::matrix4& m) : Transformation(m) {}
256 template <typename VType>
257 void operator()(VType& vertex) const
258 {
259 Transformation.transformVect(vertex.Pos);
260 }
261 private:
262 core::matrix4 Transformation;
263 };
264
265 //! Vertex manipulator which scales the TCoords of the vertex
266 class SVertexTCoordsScaleManipulator : public IVertexManipulator
267 {
268 public:
269 SVertexTCoordsScaleManipulator(const core::vector2df& factor, u32 uvSet=1) : Factor(factor), UVSet(uvSet) {}
270 void operator()(video::S3DVertex2TCoords& vertex) const
271 {
272 if (1==UVSet)
273 vertex.TCoords *= Factor;
274 else if (2==UVSet)
275 vertex.TCoords2 *= Factor;
276 }
277 template <typename VType>
278 void operator()(VType& vertex) const
279 {
280 if (1==UVSet)
281 vertex.TCoords *= Factor;
282 }
283 private:
284 core::vector2df Factor;
285 u32 UVSet;
286 };
287
288} // end namespace scene
289} // end namespace irr
290
291
292#endif
diff --git a/src/others/irrlicht-1.8.1/include/SViewFrustum.h b/src/others/irrlicht-1.8.1/include/SViewFrustum.h
new file mode 100644
index 0000000..88d7e2e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SViewFrustum.h
@@ -0,0 +1,370 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_VIEW_FRUSTUM_H_INCLUDED__
6#define __S_VIEW_FRUSTUM_H_INCLUDED__
7
8#include "plane3d.h"
9#include "vector3d.h"
10#include "line3d.h"
11#include "aabbox3d.h"
12#include "matrix4.h"
13#include "IVideoDriver.h"
14
15namespace irr
16{
17namespace scene
18{
19
20 //! Defines the view frustum. That's the space visible by the camera.
21 /** The view frustum is enclosed by 6 planes. These six planes share
22 eight points. A bounding box around these eight points is also stored in
23 this structure.
24 */
25 struct SViewFrustum
26 {
27 enum VFPLANES
28 {
29 //! Far plane of the frustum. That is the plane farest away from the eye.
30 VF_FAR_PLANE = 0,
31 //! Near plane of the frustum. That is the plane nearest to the eye.
32 VF_NEAR_PLANE,
33 //! Left plane of the frustum.
34 VF_LEFT_PLANE,
35 //! Right plane of the frustum.
36 VF_RIGHT_PLANE,
37 //! Bottom plane of the frustum.
38 VF_BOTTOM_PLANE,
39 //! Top plane of the frustum.
40 VF_TOP_PLANE,
41
42 //! Amount of planes enclosing the view frustum. Should be 6.
43 VF_PLANE_COUNT
44 };
45
46
47 //! Default Constructor
48 SViewFrustum() {}
49
50 //! Copy Constructor
51 SViewFrustum(const SViewFrustum& other);
52
53 //! This constructor creates a view frustum based on a projection and/or view matrix.
54 SViewFrustum(const core::matrix4& mat);
55
56 //! This constructor creates a view frustum based on a projection and/or view matrix.
57 inline void setFrom(const core::matrix4& mat);
58
59 //! transforms the frustum by the matrix
60 /** \param mat: Matrix by which the view frustum is transformed.*/
61 void transform(const core::matrix4& mat);
62
63 //! returns the point which is on the far left upper corner inside the the view frustum.
64 core::vector3df getFarLeftUp() const;
65
66 //! returns the point which is on the far left bottom corner inside the the view frustum.
67 core::vector3df getFarLeftDown() const;
68
69 //! returns the point which is on the far right top corner inside the the view frustum.
70 core::vector3df getFarRightUp() const;
71
72 //! returns the point which is on the far right bottom corner inside the the view frustum.
73 core::vector3df getFarRightDown() const;
74
75 //! returns the point which is on the near left upper corner inside the the view frustum.
76 core::vector3df getNearLeftUp() const;
77
78 //! returns the point which is on the near left bottom corner inside the the view frustum.
79 core::vector3df getNearLeftDown() const;
80
81 //! returns the point which is on the near right top corner inside the the view frustum.
82 core::vector3df getNearRightUp() const;
83
84 //! returns the point which is on the near right bottom corner inside the the view frustum.
85 core::vector3df getNearRightDown() const;
86
87 //! returns a bounding box enclosing the whole view frustum
88 const core::aabbox3d<f32> &getBoundingBox() const;
89
90 //! recalculates the bounding box member based on the planes
91 inline void recalculateBoundingBox();
92
93 //! get the given state's matrix based on frustum E_TRANSFORMATION_STATE
94 core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state);
95
96 //! get the given state's matrix based on frustum E_TRANSFORMATION_STATE
97 const core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state) const;
98
99 //! clips a line to the view frustum.
100 /** \return True if the line was clipped, false if not */
101 bool clipLine(core::line3d<f32>& line) const;
102
103 //! the position of the camera
104 core::vector3df cameraPosition;
105
106 //! all planes enclosing the view frustum.
107 core::plane3d<f32> planes[VF_PLANE_COUNT];
108
109 //! bounding box around the view frustum
110 core::aabbox3d<f32> boundingBox;
111
112 private:
113 //! Hold a copy of important transform matrices
114 enum E_TRANSFORMATION_STATE_FRUSTUM
115 {
116 ETS_VIEW = 0,
117 ETS_PROJECTION = 1,
118 ETS_COUNT_FRUSTUM
119 };
120
121 //! Hold a copy of important transform matrices
122 core::matrix4 Matrices[ETS_COUNT_FRUSTUM];
123 };
124
125
126 /*!
127 Copy constructor ViewFrustum
128 */
129 inline SViewFrustum::SViewFrustum(const SViewFrustum& other)
130 {
131 cameraPosition=other.cameraPosition;
132 boundingBox=other.boundingBox;
133
134 u32 i;
135 for (i=0; i<VF_PLANE_COUNT; ++i)
136 planes[i]=other.planes[i];
137
138 for (i=0; i<ETS_COUNT_FRUSTUM; ++i)
139 Matrices[i]=other.Matrices[i];
140 }
141
142 inline SViewFrustum::SViewFrustum(const core::matrix4& mat)
143 {
144 setFrom ( mat );
145 }
146
147
148 inline void SViewFrustum::transform(const core::matrix4& mat)
149 {
150 for (u32 i=0; i<VF_PLANE_COUNT; ++i)
151 mat.transformPlane(planes[i]);
152
153 mat.transformVect(cameraPosition);
154 recalculateBoundingBox();
155 }
156
157
158 inline core::vector3df SViewFrustum::getFarLeftUp() const
159 {
160 core::vector3df p;
161 planes[scene::SViewFrustum::VF_FAR_PLANE].getIntersectionWithPlanes(
162 planes[scene::SViewFrustum::VF_TOP_PLANE],
163 planes[scene::SViewFrustum::VF_LEFT_PLANE], p);
164
165 return p;
166 }
167
168 inline core::vector3df SViewFrustum::getFarLeftDown() const
169 {
170 core::vector3df p;
171 planes[scene::SViewFrustum::VF_FAR_PLANE].getIntersectionWithPlanes(
172 planes[scene::SViewFrustum::VF_BOTTOM_PLANE],
173 planes[scene::SViewFrustum::VF_LEFT_PLANE], p);
174
175 return p;
176 }
177
178 inline core::vector3df SViewFrustum::getFarRightUp() const
179 {
180 core::vector3df p;
181 planes[scene::SViewFrustum::VF_FAR_PLANE].getIntersectionWithPlanes(
182 planes[scene::SViewFrustum::VF_TOP_PLANE],
183 planes[scene::SViewFrustum::VF_RIGHT_PLANE], p);
184
185 return p;
186 }
187
188 inline core::vector3df SViewFrustum::getFarRightDown() const
189 {
190 core::vector3df p;
191 planes[scene::SViewFrustum::VF_FAR_PLANE].getIntersectionWithPlanes(
192 planes[scene::SViewFrustum::VF_BOTTOM_PLANE],
193 planes[scene::SViewFrustum::VF_RIGHT_PLANE], p);
194
195 return p;
196 }
197
198 inline core::vector3df SViewFrustum::getNearLeftUp() const
199 {
200 core::vector3df p;
201 planes[scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
202 planes[scene::SViewFrustum::VF_TOP_PLANE],
203 planes[scene::SViewFrustum::VF_LEFT_PLANE], p);
204
205 return p;
206 }
207
208 inline core::vector3df SViewFrustum::getNearLeftDown() const
209 {
210 core::vector3df p;
211 planes[scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
212 planes[scene::SViewFrustum::VF_BOTTOM_PLANE],
213 planes[scene::SViewFrustum::VF_LEFT_PLANE], p);
214
215 return p;
216 }
217
218 inline core::vector3df SViewFrustum::getNearRightUp() const
219 {
220 core::vector3df p;
221 planes[scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
222 planes[scene::SViewFrustum::VF_TOP_PLANE],
223 planes[scene::SViewFrustum::VF_RIGHT_PLANE], p);
224
225 return p;
226 }
227
228 inline core::vector3df SViewFrustum::getNearRightDown() const
229 {
230 core::vector3df p;
231 planes[scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
232 planes[scene::SViewFrustum::VF_BOTTOM_PLANE],
233 planes[scene::SViewFrustum::VF_RIGHT_PLANE], p);
234
235 return p;
236 }
237
238 inline const core::aabbox3d<f32> &SViewFrustum::getBoundingBox() const
239 {
240 return boundingBox;
241 }
242
243 inline void SViewFrustum::recalculateBoundingBox()
244 {
245 boundingBox.reset ( cameraPosition );
246
247 boundingBox.addInternalPoint(getFarLeftUp());
248 boundingBox.addInternalPoint(getFarRightUp());
249 boundingBox.addInternalPoint(getFarLeftDown());
250 boundingBox.addInternalPoint(getFarRightDown());
251 }
252
253 //! This constructor creates a view frustum based on a projection
254 //! and/or view matrix.
255 inline void SViewFrustum::setFrom(const core::matrix4& mat)
256 {
257 // left clipping plane
258 planes[VF_LEFT_PLANE].Normal.X = mat[3 ] + mat[0];
259 planes[VF_LEFT_PLANE].Normal.Y = mat[7 ] + mat[4];
260 planes[VF_LEFT_PLANE].Normal.Z = mat[11] + mat[8];
261 planes[VF_LEFT_PLANE].D = mat[15] + mat[12];
262
263 // right clipping plane
264 planes[VF_RIGHT_PLANE].Normal.X = mat[3 ] - mat[0];
265 planes[VF_RIGHT_PLANE].Normal.Y = mat[7 ] - mat[4];
266 planes[VF_RIGHT_PLANE].Normal.Z = mat[11] - mat[8];
267 planes[VF_RIGHT_PLANE].D = mat[15] - mat[12];
268
269 // top clipping plane
270 planes[VF_TOP_PLANE].Normal.X = mat[3 ] - mat[1];
271 planes[VF_TOP_PLANE].Normal.Y = mat[7 ] - mat[5];
272 planes[VF_TOP_PLANE].Normal.Z = mat[11] - mat[9];
273 planes[VF_TOP_PLANE].D = mat[15] - mat[13];
274
275 // bottom clipping plane
276 planes[VF_BOTTOM_PLANE].Normal.X = mat[3 ] + mat[1];
277 planes[VF_BOTTOM_PLANE].Normal.Y = mat[7 ] + mat[5];
278 planes[VF_BOTTOM_PLANE].Normal.Z = mat[11] + mat[9];
279 planes[VF_BOTTOM_PLANE].D = mat[15] + mat[13];
280
281 // far clipping plane
282 planes[VF_FAR_PLANE].Normal.X = mat[3 ] - mat[2];
283 planes[VF_FAR_PLANE].Normal.Y = mat[7 ] - mat[6];
284 planes[VF_FAR_PLANE].Normal.Z = mat[11] - mat[10];
285 planes[VF_FAR_PLANE].D = mat[15] - mat[14];
286
287 // near clipping plane
288 planes[VF_NEAR_PLANE].Normal.X = mat[2];
289 planes[VF_NEAR_PLANE].Normal.Y = mat[6];
290 planes[VF_NEAR_PLANE].Normal.Z = mat[10];
291 planes[VF_NEAR_PLANE].D = mat[14];
292
293 // normalize normals
294 u32 i;
295 for ( i=0; i != VF_PLANE_COUNT; ++i)
296 {
297 const f32 len = -core::reciprocal_squareroot(
298 planes[i].Normal.getLengthSQ());
299 planes[i].Normal *= len;
300 planes[i].D *= len;
301 }
302
303 // make bounding box
304 recalculateBoundingBox();
305 }
306
307 /*!
308 View Frustum depends on Projection & View Matrix
309 */
310 inline core::matrix4& SViewFrustum::getTransform(video::E_TRANSFORMATION_STATE state )
311 {
312 u32 index = 0;
313 switch ( state )
314 {
315 case video::ETS_PROJECTION:
316 index = SViewFrustum::ETS_PROJECTION; break;
317 case video::ETS_VIEW:
318 index = SViewFrustum::ETS_VIEW; break;
319 default:
320 break;
321 }
322 return Matrices [ index ];
323 }
324
325 /*!
326 View Frustum depends on Projection & View Matrix
327 */
328 inline const core::matrix4& SViewFrustum::getTransform(video::E_TRANSFORMATION_STATE state ) const
329 {
330 u32 index = 0;
331 switch ( state )
332 {
333 case video::ETS_PROJECTION:
334 index = SViewFrustum::ETS_PROJECTION; break;
335 case video::ETS_VIEW:
336 index = SViewFrustum::ETS_VIEW; break;
337 default:
338 break;
339 }
340 return Matrices [ index ];
341 }
342
343 //! Clips a line to the frustum
344 inline bool SViewFrustum::clipLine(core::line3d<f32>& line) const
345 {
346 bool wasClipped = false;
347 for (u32 i=0; i < VF_PLANE_COUNT; ++i)
348 {
349 if (planes[i].classifyPointRelation(line.start) == core::ISREL3D_FRONT)
350 {
351 line.start = line.start.getInterpolated(line.end,
352 planes[i].getKnownIntersectionWithLine(line.start, line.end));
353 wasClipped = true;
354 }
355 if (planes[i].classifyPointRelation(line.end) == core::ISREL3D_FRONT)
356 {
357 line.end = line.start.getInterpolated(line.end,
358 planes[i].getKnownIntersectionWithLine(line.start, line.end));
359 wasClipped = true;
360 }
361 }
362 return wasClipped;
363 }
364
365
366} // end namespace scene
367} // end namespace irr
368
369#endif
370
diff --git a/src/others/irrlicht-1.8.1/include/SceneParameters.h b/src/others/irrlicht-1.8.1/include/SceneParameters.h
new file mode 100644
index 0000000..699e2ac
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/SceneParameters.h
@@ -0,0 +1,182 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_SCENE_PARAMETERS_H_INCLUDED__
6#define __I_SCENE_PARAMETERS_H_INCLUDED__
7
8/*! \file SceneParameters.h
9 \brief Header file containing all scene parameters for modifying mesh loading etc.
10
11 This file includes all parameter names which can be set using ISceneManager::getParameters()
12 to modify the behavior of plugins and mesh loaders.
13*/
14
15namespace irr
16{
17namespace scene
18{
19 //! Name of the parameter for changing how Irrlicht handles the ZWrite flag for transparent (blending) materials
20 /** The default behavior in Irrlicht is to disable writing to the
21 z-buffer for all really transparent, i.e. blending materials. This
22 avoids problems with intersecting faces, but can also break renderings.
23 If transparent materials should use the SMaterial flag for ZWriteEnable
24 just as other material types use this attribute.
25 Use it like this:
26 \code
27 SceneManager->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
28 \endcode
29 **/
30 const c8* const ALLOW_ZWRITE_ON_TRANSPARENT = "Allow_ZWrite_On_Transparent";
31
32 //! Name of the parameter for changing the texture path of the built-in csm loader.
33 /** Use it like this:
34 \code
35 SceneManager->getParameters()->setAttribute(scene::CSM_TEXTURE_PATH, "path/to/your/textures");
36 \endcode
37 **/
38 const c8* const CSM_TEXTURE_PATH = "CSM_TexturePath";
39
40 //! Name of the parameter for changing the texture path of the built-in lmts loader.
41 /** Use it like this:
42 \code
43 SceneManager->getParameters()->setAttribute(scene::LMTS_TEXTURE_PATH, "path/to/your/textures");
44 \endcode
45 **/
46 const c8* const LMTS_TEXTURE_PATH = "LMTS_TexturePath";
47
48 //! Name of the parameter for changing the texture path of the built-in my3d loader.
49 /** Use it like this:
50 \code
51 SceneManager->getParameters()->setAttribute(scene::MY3D_TEXTURE_PATH, "path/to/your/textures");
52 \endcode
53 **/
54 const c8* const MY3D_TEXTURE_PATH = "MY3D_TexturePath";
55
56 //! Name of the parameter specifying the COLLADA mesh loading mode
57 /**
58 Specifies if the COLLADA loader should create instances of the models, lights and
59 cameras when loading COLLADA meshes. By default, this is set to false. If this is
60 set to true, the ISceneManager::getMesh() method will only return a pointer to a
61 dummy mesh and create instances of all meshes and lights and cameras in the collada
62 file by itself. Example:
63 \code
64 SceneManager->getParameters()->setAttribute(scene::COLLADA_CREATE_SCENE_INSTANCES, true);
65 \endcode
66 */
67 const c8* const COLLADA_CREATE_SCENE_INSTANCES = "COLLADA_CreateSceneInstances";
68
69 //! Name of the parameter for changing the texture path of the built-in DMF loader.
70 /** This path is prefixed to the file names defined in the Deled file when loading
71 textures. This allows to alter the paths for a specific project setting.
72 Use it like this:
73 \code
74 SceneManager->getStringParameters()->setAttribute(scene::DMF_TEXTURE_PATH, "path/to/your/textures");
75 \endcode
76 **/
77 const c8* const DMF_TEXTURE_PATH = "DMF_TexturePath";
78
79 //! Name of the parameter for preserving DMF textures dir structure with built-in DMF loader.
80 /** If this parameter is set to true, the texture directory defined in the Deled file
81 is ignored, and only the texture name is used to find the proper file. Otherwise, the
82 texture path is also used, which allows to use a nicer media layout.
83 Use it like this:
84 \code
85 //this way you won't use this setting (default)
86 SceneManager->getParameters()->setAttribute(scene::DMF_IGNORE_MATERIALS_DIRS, false);
87 \endcode
88 \code
89 //this way you'll use this setting
90 SceneManager->getParameters()->setAttribute(scene::DMF_IGNORE_MATERIALS_DIRS, true);
91 \endcode
92 **/
93 const c8* const DMF_IGNORE_MATERIALS_DIRS = "DMF_IgnoreMaterialsDir";
94
95 //! Name of the parameter for setting reference value of alpha in transparent materials.
96 /** Use it like this:
97 \code
98 //this way you'll set alpha ref to 0.1
99 SceneManager->getParameters()->setAttribute(scene::DMF_ALPHA_CHANNEL_REF, 0.1);
100 \endcode
101 **/
102 const c8* const DMF_ALPHA_CHANNEL_REF = "DMF_AlphaRef";
103
104 //! Name of the parameter for choose to flip or not tga files.
105 /** Use it like this:
106 \code
107 //this way you'll choose to flip alpha textures
108 SceneManager->getParameters()->setAttribute(scene::DMF_FLIP_ALPHA_TEXTURES, true);
109 \endcode
110 **/
111 const c8* const DMF_FLIP_ALPHA_TEXTURES = "DMF_FlipAlpha";
112
113
114 //! Name of the parameter for changing the texture path of the built-in obj loader.
115 /** Use it like this:
116 \code
117 SceneManager->getParameters()->setAttribute(scene::OBJ_TEXTURE_PATH, "path/to/your/textures");
118 \endcode
119 **/
120 const c8* const OBJ_TEXTURE_PATH = "OBJ_TexturePath";
121
122 //! Flag to avoid loading group structures in .obj files
123 /** Use it like this:
124 \code
125 SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_GROUPS, true);
126 \endcode
127 **/
128 const c8* const OBJ_LOADER_IGNORE_GROUPS = "OBJ_IgnoreGroups";
129
130
131 //! Flag to avoid loading material .mtl file for .obj files
132 /** Use it like this:
133 \code
134 SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_MATERIAL_FILES, true);
135 \endcode
136 **/
137 const c8* const OBJ_LOADER_IGNORE_MATERIAL_FILES = "OBJ_IgnoreMaterialFiles";
138
139
140 //! Flag to ignore the b3d file's mipmapping flag
141 /** Instead Irrlicht's texture creation flag is used. Use it like this:
142 \code
143 SceneManager->getParameters()->setAttribute(scene::B3D_LOADER_IGNORE_MIPMAP_FLAG, true);
144 \endcode
145 **/
146 const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag";
147
148 //! Name of the parameter for changing the texture path of the built-in b3d loader.
149 /** Use it like this:
150 \code
151 SceneManager->getParameters()->setAttribute(scene::B3D_TEXTURE_PATH, "path/to/your/textures");
152 \endcode
153 **/
154 const c8* const B3D_TEXTURE_PATH = "B3D_TexturePath";
155
156 //! Flag set as parameter when the scene manager is used as editor
157 /** In this way special animators like deletion animators can be stopped from
158 deleting scene nodes for example */
159 const c8* const IRR_SCENE_MANAGER_IS_EDITOR = "IRR_Editor";
160
161 //! Name of the parameter for setting the length of debug normals.
162 /** Use it like this:
163 \code
164 SceneManager->getParameters()->setAttribute(scene::DEBUG_NORMAL_LENGTH, 1.5f);
165 \endcode
166 **/
167 const c8* const DEBUG_NORMAL_LENGTH = "DEBUG_Normal_Length";
168
169 //! Name of the parameter for setting the color of debug normals.
170 /** Use it like this:
171 \code
172 SceneManager->getParameters()->setAttributeAsColor(scene::DEBUG_NORMAL_COLOR, video::SColor(255, 255, 255, 255));
173 \endcode
174 **/
175 const c8* const DEBUG_NORMAL_COLOR = "DEBUG_Normal_Color";
176
177
178} // end namespace scene
179} // end namespace irr
180
181#endif
182
diff --git a/src/others/irrlicht-1.8.1/include/aabbox3d.h b/src/others/irrlicht-1.8.1/include/aabbox3d.h
new file mode 100644
index 0000000..afaf12d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/aabbox3d.h
@@ -0,0 +1,332 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_AABBOX_3D_H_INCLUDED__
6#define __IRR_AABBOX_3D_H_INCLUDED__
7
8#include "irrMath.h"
9#include "plane3d.h"
10#include "line3d.h"
11
12namespace irr
13{
14namespace core
15{
16
17//! Axis aligned bounding box in 3d dimensional space.
18/** Has some useful methods used with occlusion culling or clipping.
19*/
20template <class T>
21class aabbox3d
22{
23 public:
24
25 //! Default Constructor.
26 aabbox3d(): MinEdge(-1,-1,-1), MaxEdge(1,1,1) {}
27 //! Constructor with min edge and max edge.
28 aabbox3d(const vector3d<T>& min, const vector3d<T>& max): MinEdge(min), MaxEdge(max) {}
29 //! Constructor with only one point.
30 aabbox3d(const vector3d<T>& init): MinEdge(init), MaxEdge(init) {}
31 //! Constructor with min edge and max edge as single values, not vectors.
32 aabbox3d(T minx, T miny, T minz, T maxx, T maxy, T maxz): MinEdge(minx, miny, minz), MaxEdge(maxx, maxy, maxz) {}
33
34 // operators
35 //! Equality operator
36 /** \param other box to compare with.
37 \return True if both boxes are equal, else false. */
38 inline bool operator==(const aabbox3d<T>& other) const { return (MinEdge == other.MinEdge && other.MaxEdge == MaxEdge);}
39 //! Inequality operator
40 /** \param other box to compare with.
41 \return True if both boxes are different, else false. */
42 inline bool operator!=(const aabbox3d<T>& other) const { return !(MinEdge == other.MinEdge && other.MaxEdge == MaxEdge);}
43
44 // functions
45
46 //! Resets the bounding box to a one-point box.
47 /** \param x X coord of the point.
48 \param y Y coord of the point.
49 \param z Z coord of the point. */
50 void reset(T x, T y, T z)
51 {
52 MaxEdge.set(x,y,z);
53 MinEdge = MaxEdge;
54 }
55
56 //! Resets the bounding box.
57 /** \param initValue New box to set this one to. */
58 void reset(const aabbox3d<T>& initValue)
59 {
60 *this = initValue;
61 }
62
63 //! Resets the bounding box to a one-point box.
64 /** \param initValue New point. */
65 void reset(const vector3d<T>& initValue)
66 {
67 MaxEdge = initValue;
68 MinEdge = initValue;
69 }
70
71 //! Adds a point to the bounding box
72 /** The box grows bigger, if point was outside of the box.
73 \param p: Point to add into the box. */
74 void addInternalPoint(const vector3d<T>& p)
75 {
76 addInternalPoint(p.X, p.Y, p.Z);
77 }
78
79 //! Adds another bounding box
80 /** The box grows bigger, if the new box was outside of the box.
81 \param b: Other bounding box to add into this box. */
82 void addInternalBox(const aabbox3d<T>& b)
83 {
84 addInternalPoint(b.MaxEdge);
85 addInternalPoint(b.MinEdge);
86 }
87
88 //! Adds a point to the bounding box
89 /** The box grows bigger, if point is outside of the box.
90 \param x X coordinate of the point to add to this box.
91 \param y Y coordinate of the point to add to this box.
92 \param z Z coordinate of the point to add to this box. */
93 void addInternalPoint(T x, T y, T z)
94 {
95 if (x>MaxEdge.X) MaxEdge.X = x;
96 if (y>MaxEdge.Y) MaxEdge.Y = y;
97 if (z>MaxEdge.Z) MaxEdge.Z = z;
98
99 if (x<MinEdge.X) MinEdge.X = x;
100 if (y<MinEdge.Y) MinEdge.Y = y;
101 if (z<MinEdge.Z) MinEdge.Z = z;
102 }
103
104 //! Get center of the bounding box
105 /** \return Center of the bounding box. */
106 vector3d<T> getCenter() const
107 {
108 return (MinEdge + MaxEdge) / 2;
109 }
110
111 //! Get extent of the box (maximal distance of two points in the box)
112 /** \return Extent of the bounding box. */
113 vector3d<T> getExtent() const
114 {
115 return MaxEdge - MinEdge;
116 }
117
118 //! Check if the box is empty.
119 /** This means that there is no space between the min and max edge.
120 \return True if box is empty, else false. */
121 bool isEmpty() const
122 {
123 return MinEdge.equals ( MaxEdge );
124 }
125
126 //! Get the volume enclosed by the box in cubed units
127 T getVolume() const
128 {
129 const vector3d<T> e = getExtent();
130 return e.X * e.Y * e.Z;
131 }
132
133 //! Get the surface area of the box in squared units
134 T getArea() const
135 {
136 const vector3d<T> e = getExtent();
137 return 2*(e.X*e.Y + e.X*e.Z + e.Y*e.Z);
138 }
139
140 //! Stores all 8 edges of the box into an array
141 /** \param edges: Pointer to array of 8 edges. */
142 void getEdges(vector3d<T> *edges) const
143 {
144 const core::vector3d<T> middle = getCenter();
145 const core::vector3d<T> diag = middle - MaxEdge;
146
147 /*
148 Edges are stored in this way:
149 Hey, am I an ascii artist, or what? :) niko.
150 /3--------/7
151 / | / |
152 / | / |
153 1---------5 |
154 | /2- - -|- -6
155 | / | /
156 |/ | /
157 0---------4/
158 */
159
160 edges[0].set(middle.X + diag.X, middle.Y + diag.Y, middle.Z + diag.Z);
161 edges[1].set(middle.X + diag.X, middle.Y - diag.Y, middle.Z + diag.Z);
162 edges[2].set(middle.X + diag.X, middle.Y + diag.Y, middle.Z - diag.Z);
163 edges[3].set(middle.X + diag.X, middle.Y - diag.Y, middle.Z - diag.Z);
164 edges[4].set(middle.X - diag.X, middle.Y + diag.Y, middle.Z + diag.Z);
165 edges[5].set(middle.X - diag.X, middle.Y - diag.Y, middle.Z + diag.Z);
166 edges[6].set(middle.X - diag.X, middle.Y + diag.Y, middle.Z - diag.Z);
167 edges[7].set(middle.X - diag.X, middle.Y - diag.Y, middle.Z - diag.Z);
168 }
169
170 //! Repairs the box.
171 /** Necessary if for example MinEdge and MaxEdge are swapped. */
172 void repair()
173 {
174 T t;
175
176 if (MinEdge.X > MaxEdge.X)
177 { t=MinEdge.X; MinEdge.X = MaxEdge.X; MaxEdge.X=t; }
178 if (MinEdge.Y > MaxEdge.Y)
179 { t=MinEdge.Y; MinEdge.Y = MaxEdge.Y; MaxEdge.Y=t; }
180 if (MinEdge.Z > MaxEdge.Z)
181 { t=MinEdge.Z; MinEdge.Z = MaxEdge.Z; MaxEdge.Z=t; }
182 }
183
184 //! Calculates a new interpolated bounding box.
185 /** d=0 returns other, d=1 returns this, all other values blend between
186 the two boxes.
187 \param other Other box to interpolate between
188 \param d Value between 0.0f and 1.0f.
189 \return Interpolated box. */
190 aabbox3d<T> getInterpolated(const aabbox3d<T>& other, f32 d) const
191 {
192 f32 inv = 1.0f - d;
193 return aabbox3d<T>((other.MinEdge*inv) + (MinEdge*d),
194 (other.MaxEdge*inv) + (MaxEdge*d));
195 }
196
197 //! Determines if a point is within this box.
198 /** Border is included (IS part of the box)!
199 \param p: Point to check.
200 \return True if the point is within the box and false if not */
201 bool isPointInside(const vector3d<T>& p) const
202 {
203 return (p.X >= MinEdge.X && p.X <= MaxEdge.X &&
204 p.Y >= MinEdge.Y && p.Y <= MaxEdge.Y &&
205 p.Z >= MinEdge.Z && p.Z <= MaxEdge.Z);
206 }
207
208 //! Determines if a point is within this box and not its borders.
209 /** Border is excluded (NOT part of the box)!
210 \param p: Point to check.
211 \return True if the point is within the box and false if not. */
212 bool isPointTotalInside(const vector3d<T>& p) const
213 {
214 return (p.X > MinEdge.X && p.X < MaxEdge.X &&
215 p.Y > MinEdge.Y && p.Y < MaxEdge.Y &&
216 p.Z > MinEdge.Z && p.Z < MaxEdge.Z);
217 }
218
219 //! Check if this box is completely inside the 'other' box.
220 /** \param other: Other box to check against.
221 \return True if this box is completly inside the other box,
222 otherwise false. */
223 bool isFullInside(const aabbox3d<T>& other) const
224 {
225 return (MinEdge.X >= other.MinEdge.X && MinEdge.Y >= other.MinEdge.Y && MinEdge.Z >= other.MinEdge.Z &&
226 MaxEdge.X <= other.MaxEdge.X && MaxEdge.Y <= other.MaxEdge.Y && MaxEdge.Z <= other.MaxEdge.Z);
227 }
228
229 //! Determines if the axis-aligned box intersects with another axis-aligned box.
230 /** \param other: Other box to check a intersection with.
231 \return True if there is an intersection with the other box,
232 otherwise false. */
233 bool intersectsWithBox(const aabbox3d<T>& other) const
234 {
235 return (MinEdge.X <= other.MaxEdge.X && MinEdge.Y <= other.MaxEdge.Y && MinEdge.Z <= other.MaxEdge.Z &&
236 MaxEdge.X >= other.MinEdge.X && MaxEdge.Y >= other.MinEdge.Y && MaxEdge.Z >= other.MinEdge.Z);
237 }
238
239 //! Tests if the box intersects with a line
240 /** \param line: Line to test intersection with.
241 \return True if there is an intersection , else false. */
242 bool intersectsWithLine(const line3d<T>& line) const
243 {
244 return intersectsWithLine(line.getMiddle(), line.getVector().normalize(),
245 (T)(line.getLength() * 0.5));
246 }
247
248 //! Tests if the box intersects with a line
249 /** \param linemiddle Center of the line.
250 \param linevect Vector of the line.
251 \param halflength Half length of the line.
252 \return True if there is an intersection, else false. */
253 bool intersectsWithLine(const vector3d<T>& linemiddle,
254 const vector3d<T>& linevect, T halflength) const
255 {
256 const vector3d<T> e = getExtent() * (T)0.5;
257 const vector3d<T> t = getCenter() - linemiddle;
258
259 if ((fabs(t.X) > e.X + halflength * fabs(linevect.X)) ||
260 (fabs(t.Y) > e.Y + halflength * fabs(linevect.Y)) ||
261 (fabs(t.Z) > e.Z + halflength * fabs(linevect.Z)) )
262 return false;
263
264 T r = e.Y * (T)fabs(linevect.Z) + e.Z * (T)fabs(linevect.Y);
265 if (fabs(t.Y*linevect.Z - t.Z*linevect.Y) > r )
266 return false;
267
268 r = e.X * (T)fabs(linevect.Z) + e.Z * (T)fabs(linevect.X);
269 if (fabs(t.Z*linevect.X - t.X*linevect.Z) > r )
270 return false;
271
272 r = e.X * (T)fabs(linevect.Y) + e.Y * (T)fabs(linevect.X);
273 if (fabs(t.X*linevect.Y - t.Y*linevect.X) > r)
274 return false;
275
276 return true;
277 }
278
279 //! Classifies a relation with a plane.
280 /** \param plane Plane to classify relation to.
281 \return Returns ISREL3D_FRONT if the box is in front of the plane,
282 ISREL3D_BACK if the box is behind the plane, and
283 ISREL3D_CLIPPED if it is on both sides of the plane. */
284 EIntersectionRelation3D classifyPlaneRelation(const plane3d<T>& plane) const
285 {
286 vector3d<T> nearPoint(MaxEdge);
287 vector3d<T> farPoint(MinEdge);
288
289 if (plane.Normal.X > (T)0)
290 {
291 nearPoint.X = MinEdge.X;
292 farPoint.X = MaxEdge.X;
293 }
294
295 if (plane.Normal.Y > (T)0)
296 {
297 nearPoint.Y = MinEdge.Y;
298 farPoint.Y = MaxEdge.Y;
299 }
300
301 if (plane.Normal.Z > (T)0)
302 {
303 nearPoint.Z = MinEdge.Z;
304 farPoint.Z = MaxEdge.Z;
305 }
306
307 if (plane.Normal.dotProduct(nearPoint) + plane.D > (T)0)
308 return ISREL3D_FRONT;
309
310 if (plane.Normal.dotProduct(farPoint) + plane.D > (T)0)
311 return ISREL3D_CLIPPED;
312
313 return ISREL3D_BACK;
314 }
315
316 //! The near edge
317 vector3d<T> MinEdge;
318
319 //! The far edge
320 vector3d<T> MaxEdge;
321};
322
323 //! Typedef for a f32 3d bounding box.
324 typedef aabbox3d<f32> aabbox3df;
325 //! Typedef for an integer 3d bounding box.
326 typedef aabbox3d<s32> aabbox3di;
327
328} // end namespace core
329} // end namespace irr
330
331#endif
332
diff --git a/src/others/irrlicht-1.8.1/include/coreutil.h b/src/others/irrlicht-1.8.1/include/coreutil.h
new file mode 100644
index 0000000..2ab4855
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/coreutil.h
@@ -0,0 +1,188 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_CORE_UTIL_H_INCLUDED__
6#define __IRR_CORE_UTIL_H_INCLUDED__
7
8#include "irrString.h"
9#include "path.h"
10
11namespace irr
12{
13namespace core
14{
15
16/*! \file coreutil.h
17 \brief File containing useful basic utility functions
18*/
19
20// ----------- some basic quite often used string functions -----------------
21
22//! search if a filename has a proper extension
23inline s32 isFileExtension ( const io::path& filename,
24 const io::path& ext0,
25 const io::path& ext1,
26 const io::path& ext2)
27{
28 s32 extPos = filename.findLast ( '.' );
29 if ( extPos < 0 )
30 return 0;
31
32 extPos += 1;
33 if ( filename.equals_substring_ignore_case ( ext0, extPos ) ) return 1;
34 if ( filename.equals_substring_ignore_case ( ext1, extPos ) ) return 2;
35 if ( filename.equals_substring_ignore_case ( ext2, extPos ) ) return 3;
36 return 0;
37}
38
39//! search if a filename has a proper extension
40inline bool hasFileExtension ( const io::path& filename,
41 const io::path& ext0,
42 const io::path& ext1 = "",
43 const io::path& ext2 = "")
44{
45 return isFileExtension ( filename, ext0, ext1, ext2 ) > 0;
46}
47
48//! cut the filename extension from a source file path and store it in a dest file path
49inline io::path& cutFilenameExtension ( io::path &dest, const io::path &source )
50{
51 s32 endPos = source.findLast ( '.' );
52 dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
53 return dest;
54}
55
56//! get the filename extension from a file path
57inline io::path& getFileNameExtension ( io::path &dest, const io::path &source )
58{
59 s32 endPos = source.findLast ( '.' );
60 if ( endPos < 0 )
61 dest = "";
62 else
63 dest = source.subString ( endPos, source.size () );
64 return dest;
65}
66
67//! delete path from filename
68inline io::path& deletePathFromFilename(io::path& filename)
69{
70 // delete path from filename
71 const fschar_t* s = filename.c_str();
72 const fschar_t* p = s + filename.size();
73
74 // search for path separator or beginning
75 while ( *p != '/' && *p != '\\' && p != s )
76 p--;
77
78 if ( p != s )
79 {
80 ++p;
81 filename = p;
82 }
83 return filename;
84}
85
86//! trim paths
87inline io::path& deletePathFromPath(io::path& filename, s32 pathCount)
88{
89 // delete path from filename
90 s32 i = filename.size();
91
92 // search for path separator or beginning
93 while ( i>=0 )
94 {
95 if ( filename[i] == '/' || filename[i] == '\\' )
96 {
97 if ( --pathCount <= 0 )
98 break;
99 }
100 --i;
101 }
102
103 if ( i>0 )
104 {
105 filename [ i + 1 ] = 0;
106 filename.validate();
107 }
108 else
109 filename="";
110 return filename;
111}
112
113//! looks if file is in the same directory of path. returns offset of directory.
114//! 0 means in same directory. 1 means file is direct child of path
115inline s32 isInSameDirectory ( const io::path& path, const io::path& file )
116{
117 s32 subA = 0;
118 s32 subB = 0;
119 s32 pos;
120
121 if ( path.size() && !path.equalsn ( file, path.size() ) )
122 return -1;
123
124 pos = 0;
125 while ( (pos = path.findNext ( '/', pos )) >= 0 )
126 {
127 subA += 1;
128 pos += 1;
129 }
130
131 pos = 0;
132 while ( (pos = file.findNext ( '/', pos )) >= 0 )
133 {
134 subB += 1;
135 pos += 1;
136 }
137
138 return subB - subA;
139}
140
141// splits a path into components
142static inline void splitFilename(const io::path &name, io::path* path=0,
143 io::path* filename=0, io::path* extension=0, bool make_lower=false)
144{
145 s32 i = name.size();
146 s32 extpos = i;
147
148 // search for path separator or beginning
149 while ( i >= 0 )
150 {
151 if ( name[i] == '.' )
152 {
153 extpos = i;
154 if ( extension )
155 *extension = name.subString ( extpos + 1, name.size() - (extpos + 1), make_lower );
156 }
157 else
158 if ( name[i] == '/' || name[i] == '\\' )
159 {
160 if ( filename )
161 *filename = name.subString ( i + 1, extpos - (i + 1), make_lower );
162 if ( path )
163 {
164 *path = name.subString ( 0, i + 1, make_lower );
165 path->replace ( '\\', '/' );
166 }
167 return;
168 }
169 i -= 1;
170 }
171 if ( filename )
172 *filename = name.subString ( 0, extpos, make_lower );
173}
174
175
176//! some standard function ( to remove dependencies )
177#undef isdigit
178#undef isspace
179#undef isupper
180inline s32 isdigit(s32 c) { return c >= '0' && c <= '9'; }
181inline s32 isspace(s32 c) { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; }
182inline s32 isupper(s32 c) { return c >= 'A' && c <= 'Z'; }
183
184
185} // end namespace core
186} // end namespace irr
187
188#endif
diff --git a/src/others/irrlicht-1.8.1/include/dimension2d.h b/src/others/irrlicht-1.8.1/include/dimension2d.h
new file mode 100644
index 0000000..13addb4
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/dimension2d.h
@@ -0,0 +1,224 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_DIMENSION2D_H_INCLUDED__
6#define __IRR_DIMENSION2D_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "irrMath.h" // for irr::core::equals()
10
11namespace irr
12{
13namespace core
14{
15 template <class T>
16 class vector2d;
17
18 //! Specifies a 2 dimensional size.
19 template <class T>
20 class dimension2d
21 {
22 public:
23 //! Default constructor for empty dimension
24 dimension2d() : Width(0), Height(0) {}
25 //! Constructor with width and height
26 dimension2d(const T& width, const T& height)
27 : Width(width), Height(height) {}
28
29 dimension2d(const vector2d<T>& other); // Defined in vector2d.h
30
31 //! Use this constructor only where you are sure that the conversion is valid.
32 template <class U>
33 explicit dimension2d(const dimension2d<U>& other) :
34 Width((T)other.Width), Height((T)other.Height) { }
35
36 template <class U>
37 dimension2d<T>& operator=(const dimension2d<U>& other)
38 {
39 Width = (T) other.Width;
40 Height = (T) other.Height;
41 return *this;
42 }
43
44
45 //! Equality operator
46 bool operator==(const dimension2d<T>& other) const
47 {
48 return core::equals(Width, other.Width) &&
49 core::equals(Height, other.Height);
50 }
51
52 //! Inequality operator
53 bool operator!=(const dimension2d<T>& other) const
54 {
55 return ! (*this == other);
56 }
57
58 bool operator==(const vector2d<T>& other) const; // Defined in vector2d.h
59
60 bool operator!=(const vector2d<T>& other) const
61 {
62 return !(*this == other);
63 }
64
65 //! Set to new values
66 dimension2d<T>& set(const T& width, const T& height)
67 {
68 Width = width;
69 Height = height;
70 return *this;
71 }
72
73 //! Divide width and height by scalar
74 dimension2d<T>& operator/=(const T& scale)
75 {
76 Width /= scale;
77 Height /= scale;
78 return *this;
79 }
80
81 //! Divide width and height by scalar
82 dimension2d<T> operator/(const T& scale) const
83 {
84 return dimension2d<T>(Width/scale, Height/scale);
85 }
86
87 //! Multiply width and height by scalar
88 dimension2d<T>& operator*=(const T& scale)
89 {
90 Width *= scale;
91 Height *= scale;
92 return *this;
93 }
94
95 //! Multiply width and height by scalar
96 dimension2d<T> operator*(const T& scale) const
97 {
98 return dimension2d<T>(Width*scale, Height*scale);
99 }
100
101 //! Add another dimension to this one.
102 dimension2d<T>& operator+=(const dimension2d<T>& other)
103 {
104 Width += other.Width;
105 Height += other.Height;
106 return *this;
107 }
108
109 //! Add two dimensions
110 dimension2d<T> operator+(const dimension2d<T>& other) const
111 {
112 return dimension2d<T>(Width+other.Width, Height+other.Height);
113 }
114
115 //! Subtract a dimension from this one
116 dimension2d<T>& operator-=(const dimension2d<T>& other)
117 {
118 Width -= other.Width;
119 Height -= other.Height;
120 return *this;
121 }
122
123 //! Subtract one dimension from another
124 dimension2d<T> operator-(const dimension2d<T>& other) const
125 {
126 return dimension2d<T>(Width-other.Width, Height-other.Height);
127 }
128
129 //! Get area
130 T getArea() const
131 {
132 return Width*Height;
133 }
134
135 //! Get the optimal size according to some properties
136 /** This is a function often used for texture dimension
137 calculations. The function returns the next larger or
138 smaller dimension which is a power-of-two dimension
139 (2^n,2^m) and/or square (Width=Height).
140 \param requirePowerOfTwo Forces the result to use only
141 powers of two as values.
142 \param requireSquare Makes width==height in the result
143 \param larger Choose whether the result is larger or
144 smaller than the current dimension. If one dimension
145 need not be changed it is kept with any value of larger.
146 \param maxValue Maximum texturesize. if value > 0 size is
147 clamped to maxValue
148 \return The optimal dimension under the given
149 constraints. */
150 dimension2d<T> getOptimalSize(
151 bool requirePowerOfTwo=true,
152 bool requireSquare=false,
153 bool larger=true,
154 u32 maxValue = 0) const
155 {
156 u32 i=1;
157 u32 j=1;
158 if (requirePowerOfTwo)
159 {
160 while (i<(u32)Width)
161 i<<=1;
162 if (!larger && i!=1 && i!=(u32)Width)
163 i>>=1;
164 while (j<(u32)Height)
165 j<<=1;
166 if (!larger && j!=1 && j!=(u32)Height)
167 j>>=1;
168 }
169 else
170 {
171 i=(u32)Width;
172 j=(u32)Height;
173 }
174
175 if (requireSquare)
176 {
177 if ((larger && (i>j)) || (!larger && (i<j)))
178 j=i;
179 else
180 i=j;
181 }
182
183 if ( maxValue > 0 && i > maxValue)
184 i = maxValue;
185
186 if ( maxValue > 0 && j > maxValue)
187 j = maxValue;
188
189 return dimension2d<T>((T)i,(T)j);
190 }
191
192 //! Get the interpolated dimension
193 /** \param other Other dimension to interpolate with.
194 \param d Value between 0.0f and 1.0f.
195 \return Interpolated dimension. */
196 dimension2d<T> getInterpolated(const dimension2d<T>& other, f32 d) const
197 {
198 f32 inv = (1.0f - d);
199 return dimension2d<T>( (T)(other.Width*inv + Width*d), (T)(other.Height*inv + Height*d));
200 }
201
202
203 //! Width of the dimension.
204 T Width;
205 //! Height of the dimension.
206 T Height;
207 };
208
209 //! Typedef for an f32 dimension.
210 typedef dimension2d<f32> dimension2df;
211 //! Typedef for an unsigned integer dimension.
212 typedef dimension2d<u32> dimension2du;
213
214 //! Typedef for an integer dimension.
215 /** There are few cases where negative dimensions make sense. Please consider using
216 dimension2du instead. */
217 typedef dimension2d<s32> dimension2di;
218
219
220} // end namespace core
221} // end namespace irr
222
223#endif
224
diff --git a/src/others/irrlicht-1.8.1/include/driverChoice.h b/src/others/irrlicht-1.8.1/include/driverChoice.h
new file mode 100644
index 0000000..d418ba8
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/driverChoice.h
@@ -0,0 +1,45 @@
1// Copyright (C) 2009-2012 Christian Stehno
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __E_DRIVER_CHOICE_H_INCLUDED__
6#define __E_DRIVER_CHOICE_H_INCLUDED__
7
8#include <iostream>
9#include <cstdio>
10#include "EDriverTypes.h"
11#include "irrTypes.h"
12#include "IrrlichtDevice.h"
13
14namespace irr
15{
16
17//! ask user for driver
18static irr::video::E_DRIVER_TYPE driverChoiceConsole(bool allDrivers=true)
19{
20 const char* const names[] = {"NullDriver","Software Renderer","Burning's Video","Direct3D 8.1","Direct3D 9.0c","OpenGL 1.x/2.x/3.x"};
21 printf("Please select the driver you want:\n");
22 irr::u32 i=0;
23 for (i=irr::video::EDT_COUNT; i>0; --i)
24 {
25 if (allDrivers || (irr::IrrlichtDevice::isDriverSupported(irr::video::E_DRIVER_TYPE(i-1))))
26 printf(" (%c) %s\n", 'a'+irr::video::EDT_COUNT-i, names[i-1]);
27 }
28
29 char c;
30 std::cin >> c;
31 c = irr::video::EDT_COUNT+'a'-c;
32
33 for (i=irr::video::EDT_COUNT; i>0; --i)
34 {
35 if (!(allDrivers || (irr::IrrlichtDevice::isDriverSupported(irr::video::E_DRIVER_TYPE(i-1)))))
36 --c;
37 if ((char)i==c)
38 return irr::video::E_DRIVER_TYPE(i-1);
39 }
40 return irr::video::EDT_COUNT;
41}
42
43} // end namespace irr
44
45#endif
diff --git a/src/others/irrlicht-1.8.1/include/fast_atof.h b/src/others/irrlicht-1.8.1/include/fast_atof.h
new file mode 100644
index 0000000..7d4917a
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/fast_atof.h
@@ -0,0 +1,364 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine" and the "irrXML" project.
3// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
4
5#ifndef __FAST_ATOF_H_INCLUDED__
6#define __FAST_ATOF_H_INCLUDED__
7
8#include "irrMath.h"
9#include "irrString.h"
10
11namespace irr
12{
13namespace core
14{
15 //! Selection of characters which count as decimal point in fast_atof
16 // TODO: This should probably also be used in irr::core::string, but the float-to-string code
17 // used there has to be rewritten first.
18 IRRLICHT_API extern irr::core::stringc LOCALE_DECIMAL_POINTS;
19
20// we write [17] here instead of [] to work around a swig bug
21const float fast_atof_table[17] = {
22 0.f,
23 0.1f,
24 0.01f,
25 0.001f,
26 0.0001f,
27 0.00001f,
28 0.000001f,
29 0.0000001f,
30 0.00000001f,
31 0.000000001f,
32 0.0000000001f,
33 0.00000000001f,
34 0.000000000001f,
35 0.0000000000001f,
36 0.00000000000001f,
37 0.000000000000001f,
38 0.0000000000000001f
39};
40
41//! Convert a simple string of base 10 digits into an unsigned 32 bit integer.
42/** \param[in] in: The string of digits to convert. No leading chars are
43 allowed, only digits 0 to 9. Parsing stops at the first non-digit.
44 \param[out] out: (optional) If provided, it will be set to point at the
45 first character not used in the calculation.
46 \return The unsigned integer value of the digits. If the string specifies
47 too many digits to encode in an u32 then INT_MAX will be returned.
48*/
49inline u32 strtoul10(const char* in, const char** out=0)
50{
51 if (!in)
52 {
53 if (out)
54 *out = in;
55 return 0;
56 }
57
58 bool overflow=false;
59 u32 unsignedValue = 0;
60 while ( ( *in >= '0') && ( *in <= '9' ))
61 {
62 const u32 tmp = ( unsignedValue * 10 ) + ( *in - '0' );
63 if (tmp<unsignedValue)
64 {
65 unsignedValue=(u32)0xffffffff;
66 overflow=true;
67 }
68 if (!overflow)
69 unsignedValue = tmp;
70 ++in;
71 }
72
73 if (out)
74 *out = in;
75
76 return unsignedValue;
77}
78
79//! Convert a simple string of base 10 digits into a signed 32 bit integer.
80/** \param[in] in: The string of digits to convert. Only a leading - or +
81 followed by digits 0 to 9 will be considered. Parsing stops at the first
82 non-digit.
83 \param[out] out: (optional) If provided, it will be set to point at the
84 first character not used in the calculation.
85 \return The signed integer value of the digits. If the string specifies
86 too many digits to encode in an s32 then +INT_MAX or -INT_MAX will be
87 returned.
88*/
89inline s32 strtol10(const char* in, const char** out=0)
90{
91 if (!in)
92 {
93 if (out)
94 *out = in;
95 return 0;
96 }
97
98 const bool negative = ('-' == *in);
99 if (negative || ('+' == *in))
100 ++in;
101
102 const u32 unsignedValue = strtoul10(in,out);
103 if (unsignedValue > (u32)INT_MAX)
104 {
105 if (negative)
106 return (s32)INT_MIN;
107 else
108 return (s32)INT_MAX;
109 }
110 else
111 {
112 if (negative)
113 return -((s32)unsignedValue);
114 else
115 return (s32)unsignedValue;
116 }
117}
118
119//! Convert a hex-encoded character to an unsigned integer.
120/** \param[in] in The digit to convert. Only digits 0 to 9 and chars A-F,a-f
121 will be considered.
122 \return The unsigned integer value of the digit. 0xffffffff if the input is
123 not hex
124*/
125inline u32 ctoul16(char in)
126{
127 if (in >= '0' && in <= '9')
128 return in - '0';
129 else if (in >= 'a' && in <= 'f')
130 return 10u + in - 'a';
131 else if (in >= 'A' && in <= 'F')
132 return 10u + in - 'A';
133 else
134 return 0xffffffff;
135}
136
137//! Convert a simple string of base 16 digits into an unsigned 32 bit integer.
138/** \param[in] in: The string of digits to convert. No leading chars are
139 allowed, only digits 0 to 9 and chars A-F,a-f are allowed. Parsing stops
140 at the first illegal char.
141 \param[out] out: (optional) If provided, it will be set to point at the
142 first character not used in the calculation.
143 \return The unsigned integer value of the digits. If the string specifies
144 too many digits to encode in an u32 then INT_MAX will be returned.
145*/
146inline u32 strtoul16(const char* in, const char** out=0)
147{
148 if (!in)
149 {
150 if (out)
151 *out = in;
152 return 0;
153 }
154
155 bool overflow=false;
156 u32 unsignedValue = 0;
157 while (true)
158 {
159 u32 tmp = 0;
160 if ((*in >= '0') && (*in <= '9'))
161 tmp = (unsignedValue << 4u) + (*in - '0');
162 else if ((*in >= 'A') && (*in <= 'F'))
163 tmp = (unsignedValue << 4u) + (*in - 'A') + 10;
164 else if ((*in >= 'a') && (*in <= 'f'))
165 tmp = (unsignedValue << 4u) + (*in - 'a') + 10;
166 else
167 break;
168 if (tmp<unsignedValue)
169 {
170 unsignedValue=(u32)INT_MAX;
171 overflow=true;
172 }
173 if (!overflow)
174 unsignedValue = tmp;
175 ++in;
176 }
177
178 if (out)
179 *out = in;
180
181 return unsignedValue;
182}
183
184//! Convert a simple string of base 8 digits into an unsigned 32 bit integer.
185/** \param[in] in The string of digits to convert. No leading chars are
186 allowed, only digits 0 to 7 are allowed. Parsing stops at the first illegal
187 char.
188 \param[out] out (optional) If provided, it will be set to point at the
189 first character not used in the calculation.
190 \return The unsigned integer value of the digits. If the string specifies
191 too many digits to encode in an u32 then INT_MAX will be returned.
192*/
193inline u32 strtoul8(const char* in, const char** out=0)
194{
195 if (!in)
196 {
197 if (out)
198 *out = in;
199 return 0;
200 }
201
202 bool overflow=false;
203 u32 unsignedValue = 0;
204 while (true)
205 {
206 u32 tmp = 0;
207 if ((*in >= '0') && (*in <= '7'))
208 tmp = (unsignedValue << 3u) + (*in - '0');
209 else
210 break;
211 if (tmp<unsignedValue)
212 {
213 unsignedValue=(u32)INT_MAX;
214 overflow=true;
215 }
216 if (!overflow)
217 unsignedValue = tmp;
218 ++in;
219 }
220
221 if (out)
222 *out = in;
223
224 return unsignedValue;
225}
226
227//! Convert a C-style prefixed string (hex, oct, integer) into an unsigned 32 bit integer.
228/** \param[in] in The string of digits to convert. If string starts with 0x the
229 hex parser is used, if only leading 0 is used, oct parser is used. In all
230 other cases, the usual unsigned parser is used.
231 \param[out] out (optional) If provided, it will be set to point at the
232 first character not used in the calculation.
233 \return The unsigned integer value of the digits. If the string specifies
234 too many digits to encode in an u32 then INT_MAX will be returned.
235*/
236inline u32 strtoul_prefix(const char* in, const char** out=0)
237{
238 if (!in)
239 {
240 if (out)
241 *out = in;
242 return 0;
243 }
244 if ('0'==in[0])
245 return ('x'==in[1] ? strtoul16(in+2,out) : strtoul8(in+1,out));
246 return strtoul10(in,out);
247}
248
249//! Converts a sequence of digits into a whole positive floating point value.
250/** Only digits 0 to 9 are parsed. Parsing stops at any other character,
251 including sign characters or a decimal point.
252 \param in: the sequence of digits to convert.
253 \param out: (optional) will be set to point at the first non-converted
254 character.
255 \return The whole positive floating point representation of the digit
256 sequence.
257*/
258inline f32 strtof10(const char* in, const char** out = 0)
259{
260 if (!in)
261 {
262 if (out)
263 *out = in;
264 return 0.f;
265 }
266
267 const u32 MAX_SAFE_U32_VALUE = UINT_MAX / 10 - 10;
268 u32 intValue = 0;
269
270 // Use integer arithmetic for as long as possible, for speed
271 // and precision.
272 while ( ( *in >= '0') && ( *in <= '9' ) )
273 {
274 // If it looks like we're going to overflow, bail out
275 // now and start using floating point.
276 if (intValue >= MAX_SAFE_U32_VALUE)
277 break;
278
279 intValue = (intValue * 10) + (*in - '0');
280 ++in;
281 }
282
283 f32 floatValue = (f32)intValue;
284
285 // If there are any digits left to parse, then we need to use
286 // floating point arithmetic from here.
287 while ( ( *in >= '0') && ( *in <= '9' ) )
288 {
289 floatValue = (floatValue * 10.f) + (f32)(*in - '0');
290 ++in;
291 if (floatValue > FLT_MAX) // Just give up.
292 break;
293 }
294
295 if (out)
296 *out = in;
297
298 return floatValue;
299}
300
301//! Provides a fast function for converting a string into a float.
302/** This is not guaranteed to be as accurate as atof(), but is
303 approximately 6 to 8 times as fast.
304 \param[in] in The string to convert.
305 \param[out] result The resultant float will be written here.
306 \return Pointer to the first character in the string that wasn't used
307 to create the float value.
308*/
309inline const char* fast_atof_move(const char* in, f32& result)
310{
311 // Please run the regression test when making any modifications to this function.
312
313 result = 0.f;
314 if (!in)
315 return 0;
316
317 const bool negative = ('-' == *in);
318 if (negative || ('+'==*in))
319 ++in;
320
321 f32 value = strtof10(in, &in);
322
323 if ( LOCALE_DECIMAL_POINTS.findFirst(*in) >= 0 )
324 {
325 const char* afterDecimal = ++in;
326 const f32 decimal = strtof10(in, &afterDecimal);
327 value += decimal * fast_atof_table[afterDecimal - in];
328 in = afterDecimal;
329 }
330
331 if ('e' == *in || 'E' == *in)
332 {
333 ++in;
334 // Assume that the exponent is a whole number.
335 // strtol10() will deal with both + and - signs,
336 // but calculate as f32 to prevent overflow at FLT_MAX
337 value *= powf(10.f, (f32)strtol10(in, &in));
338 }
339
340 result = negative?-value:value;
341 return in;
342}
343
344//! Convert a string to a floating point number
345/** \param floatAsString The string to convert.
346 \param out Optional pointer to the first character in the string that
347 wasn't used to create the float value.
348 \result Float value parsed from the input string
349*/
350inline float fast_atof(const char* floatAsString, const char** out=0)
351{
352 float ret;
353 if (out)
354 *out=fast_atof_move(floatAsString, ret);
355 else
356 fast_atof_move(floatAsString, ret);
357 return ret;
358}
359
360} // end namespace core
361} // end namespace irr
362
363#endif
364
diff --git a/src/others/irrlicht-1.8.1/include/heapsort.h b/src/others/irrlicht-1.8.1/include/heapsort.h
new file mode 100644
index 0000000..6f87665
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/heapsort.h
@@ -0,0 +1,70 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_HEAPSORT_H_INCLUDED__
6#define __IRR_HEAPSORT_H_INCLUDED__
7
8#include "irrTypes.h"
9
10namespace irr
11{
12namespace core
13{
14
15//! Sinks an element into the heap.
16template<class T>
17inline void heapsink(T*array, s32 element, s32 max)
18{
19 while ((element<<1) < max) // there is a left child
20 {
21 s32 j = (element<<1);
22
23 if (j+1 < max && array[j] < array[j+1])
24 j = j+1; // take right child
25
26 if (array[element] < array[j])
27 {
28 T t = array[j]; // swap elements
29 array[j] = array[element];
30 array[element] = t;
31 element = j;
32 }
33 else
34 return;
35 }
36}
37
38
39//! Sorts an array with size 'size' using heapsort.
40template<class T>
41inline void heapsort(T* array_, s32 size)
42{
43 // for heapsink we pretent this is not c++, where
44 // arrays start with index 0. So we decrease the array pointer,
45 // the maximum always +2 and the element always +1
46
47 T* virtualArray = array_ - 1;
48 s32 virtualSize = size + 2;
49 s32 i;
50
51 // build heap
52
53 for (i=((size-1)/2); i>=0; --i)
54 heapsink(virtualArray, i+1, virtualSize-1);
55
56 // sort array, leave out the last element (0)
57 for (i=size-1; i>0; --i)
58 {
59 T t = array_[0];
60 array_[0] = array_[i];
61 array_[i] = t;
62 heapsink(virtualArray, 1, i + 1);
63 }
64}
65
66} // end namespace core
67} // end namespace irr
68
69#endif
70
diff --git a/src/others/irrlicht-1.8.1/include/irrAllocator.h b/src/others/irrlicht-1.8.1/include/irrAllocator.h
new file mode 100644
index 0000000..648c410
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrAllocator.h
@@ -0,0 +1,124 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine" and the "irrXML" project.
3// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
4
5#ifndef __IRR_ALLOCATOR_H_INCLUDED__
6#define __IRR_ALLOCATOR_H_INCLUDED__
7
8#include "irrTypes.h"
9#include <new>
10// necessary for older compilers
11#include <memory.h>
12
13namespace irr
14{
15namespace core
16{
17
18#ifdef DEBUG_CLIENTBLOCK
19#undef DEBUG_CLIENTBLOCK
20#define DEBUG_CLIENTBLOCK new
21#endif
22
23//! Very simple allocator implementation, containers using it can be used across dll boundaries
24template<typename T>
25class irrAllocator
26{
27public:
28
29 //! Destructor
30 virtual ~irrAllocator() {}
31
32 //! Allocate memory for an array of objects
33 T* allocate(size_t cnt)
34 {
35 return (T*)internal_new(cnt* sizeof(T));
36 }
37
38 //! Deallocate memory for an array of objects
39 void deallocate(T* ptr)
40 {
41 internal_delete(ptr);
42 }
43
44 //! Construct an element
45 void construct(T* ptr, const T&e)
46 {
47 new ((void*)ptr) T(e);
48 }
49
50 //! Destruct an element
51 void destruct(T* ptr)
52 {
53 ptr->~T();
54 }
55
56protected:
57
58 virtual void* internal_new(size_t cnt)
59 {
60 return operator new(cnt);
61 }
62
63 virtual void internal_delete(void* ptr)
64 {
65 operator delete(ptr);
66 }
67
68};
69
70
71//! Fast allocator, only to be used in containers inside the same memory heap.
72/** Containers using it are NOT able to be used it across dll boundaries. Use this
73when using in an internal class or function or when compiled into a static lib */
74template<typename T>
75class irrAllocatorFast
76{
77public:
78
79 //! Allocate memory for an array of objects
80 T* allocate(size_t cnt)
81 {
82 return (T*)operator new(cnt* sizeof(T));
83 }
84
85 //! Deallocate memory for an array of objects
86 void deallocate(T* ptr)
87 {
88 operator delete(ptr);
89 }
90
91 //! Construct an element
92 void construct(T* ptr, const T&e)
93 {
94 new ((void*)ptr) T(e);
95 }
96
97 //! Destruct an element
98 void destruct(T* ptr)
99 {
100 ptr->~T();
101 }
102};
103
104
105
106#ifdef DEBUG_CLIENTBLOCK
107#undef DEBUG_CLIENTBLOCK
108#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
109#endif
110
111//! defines an allocation strategy
112enum eAllocStrategy
113{
114 ALLOC_STRATEGY_SAFE = 0,
115 ALLOC_STRATEGY_DOUBLE = 1,
116 ALLOC_STRATEGY_SQRT = 2
117};
118
119
120} // end namespace core
121} // end namespace irr
122
123#endif
124
diff --git a/src/others/irrlicht-1.8.1/include/irrArray.h b/src/others/irrlicht-1.8.1/include/irrArray.h
new file mode 100644
index 0000000..7dab593
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrArray.h
@@ -0,0 +1,627 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine" and the "irrXML" project.
3// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
4
5#ifndef __IRR_ARRAY_H_INCLUDED__
6#define __IRR_ARRAY_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "heapsort.h"
10#include "irrAllocator.h"
11#include "irrMath.h"
12
13namespace irr
14{
15namespace core
16{
17
18//! Self reallocating template array (like stl vector) with additional features.
19/** Some features are: Heap sorting, binary search methods, easier debugging.
20*/
21template <class T, typename TAlloc = irrAllocator<T> >
22class array
23{
24
25public:
26
27 //! Default constructor for empty array.
28 array()
29 : data(0), allocated(0), used(0),
30 strategy(ALLOC_STRATEGY_DOUBLE), free_when_destroyed(true), is_sorted(true)
31 {
32 }
33
34
35 //! Constructs an array and allocates an initial chunk of memory.
36 /** \param start_count Amount of elements to pre-allocate. */
37 array(u32 start_count)
38 : data(0), allocated(0), used(0),
39 strategy(ALLOC_STRATEGY_DOUBLE), free_when_destroyed(true), is_sorted(true)
40 {
41 reallocate(start_count);
42 }
43
44
45 //! Copy constructor
46 array(const array<T, TAlloc>& other) : data(0)
47 {
48 *this = other;
49 }
50
51
52 //! Destructor.
53 /** Frees allocated memory, if set_free_when_destroyed was not set to
54 false by the user before. */
55 ~array()
56 {
57 clear();
58 }
59
60
61 //! Reallocates the array, make it bigger or smaller.
62 /** \param new_size New size of array.
63 \param canShrink Specifies whether the array is reallocated even if
64 enough space is available. Setting this flag to false can speed up
65 array usage, but may use more memory than required by the data.
66 */
67 void reallocate(u32 new_size, bool canShrink=true)
68 {
69 if (allocated==new_size)
70 return;
71 if (!canShrink && (new_size < allocated))
72 return;
73
74 T* old_data = data;
75
76 data = allocator.allocate(new_size); //new T[new_size];
77 allocated = new_size;
78
79 // copy old data
80 s32 end = used < new_size ? used : new_size;
81
82 for (s32 i=0; i<end; ++i)
83 {
84 // data[i] = old_data[i];
85 allocator.construct(&data[i], old_data[i]);
86 }
87
88 // destruct old data
89 for (u32 j=0; j<used; ++j)
90 allocator.destruct(&old_data[j]);
91
92 if (allocated < used)
93 used = allocated;
94
95 allocator.deallocate(old_data); //delete [] old_data;
96 }
97
98
99 //! set a new allocation strategy
100 /** if the maximum size of the array is unknown, you can define how big the
101 allocation should happen.
102 \param newStrategy New strategy to apply to this array. */
103 void setAllocStrategy ( eAllocStrategy newStrategy = ALLOC_STRATEGY_DOUBLE )
104 {
105 strategy = newStrategy;
106 }
107
108
109 //! Adds an element at back of array.
110 /** If the array is too small to add this new element it is made bigger.
111 \param element: Element to add at the back of the array. */
112 void push_back(const T& element)
113 {
114 insert(element, used);
115 }
116
117
118 //! Adds an element at the front of the array.
119 /** If the array is to small to add this new element, the array is
120 made bigger. Please note that this is slow, because the whole array
121 needs to be copied for this.
122 \param element Element to add at the back of the array. */
123 void push_front(const T& element)
124 {
125 insert(element);
126 }
127
128
129 //! Insert item into array at specified position.
130 /** Please use this only if you know what you are doing (possible
131 performance loss). The preferred method of adding elements should be
132 push_back().
133 \param element: Element to be inserted
134 \param index: Where position to insert the new element. */
135 void insert(const T& element, u32 index=0)
136 {
137 _IRR_DEBUG_BREAK_IF(index>used) // access violation
138
139 if (used + 1 > allocated)
140 {
141 // this doesn't work if the element is in the same
142 // array. So we'll copy the element first to be sure
143 // we'll get no data corruption
144 const T e(element);
145
146 // increase data block
147 u32 newAlloc;
148 switch ( strategy )
149 {
150 case ALLOC_STRATEGY_DOUBLE:
151 newAlloc = used + 1 + (allocated < 500 ?
152 (allocated < 5 ? 5 : used) : used >> 2);
153 break;
154 default:
155 case ALLOC_STRATEGY_SAFE:
156 newAlloc = used + 1;
157 break;
158 }
159 reallocate( newAlloc);
160
161 // move array content and construct new element
162 // first move end one up
163 for (u32 i=used; i>index; --i)
164 {
165 if (i<used)
166 allocator.destruct(&data[i]);
167 allocator.construct(&data[i], data[i-1]); // data[i] = data[i-1];
168 }
169 // then add new element
170 if (used > index)
171 allocator.destruct(&data[index]);
172 allocator.construct(&data[index], e); // data[index] = e;
173 }
174 else
175 {
176 // element inserted not at end
177 if ( used > index )
178 {
179 // create one new element at the end
180 allocator.construct(&data[used], data[used-1]);
181
182 // move the rest of the array content
183 for (u32 i=used-1; i>index; --i)
184 {
185 data[i] = data[i-1];
186 }
187 // insert the new element
188 data[index] = element;
189 }
190 else
191 {
192 // insert the new element to the end
193 allocator.construct(&data[index], element);
194 }
195 }
196 // set to false as we don't know if we have the comparison operators
197 is_sorted = false;
198 ++used;
199 }
200
201
202 //! Clears the array and deletes all allocated memory.
203 void clear()
204 {
205 if (free_when_destroyed)
206 {
207 for (u32 i=0; i<used; ++i)
208 allocator.destruct(&data[i]);
209
210 allocator.deallocate(data); // delete [] data;
211 }
212 data = 0;
213 used = 0;
214 allocated = 0;
215 is_sorted = true;
216 }
217
218
219 //! Sets pointer to new array, using this as new workspace.
220 /** Make sure that set_free_when_destroyed is used properly.
221 \param newPointer: Pointer to new array of elements.
222 \param size: Size of the new array.
223 \param _is_sorted Flag which tells whether the new array is already
224 sorted.
225 \param _free_when_destroyed Sets whether the new memory area shall be
226 freed by the array upon destruction, or if this will be up to the user
227 application. */
228 void set_pointer(T* newPointer, u32 size, bool _is_sorted=false, bool _free_when_destroyed=true)
229 {
230 clear();
231 data = newPointer;
232 allocated = size;
233 used = size;
234 is_sorted = _is_sorted;
235 free_when_destroyed=_free_when_destroyed;
236 }
237
238
239 //! Sets if the array should delete the memory it uses upon destruction.
240 /** Also clear and set_pointer will only delete the (original) memory
241 area if this flag is set to true, which is also the default. The
242 methods reallocate, set_used, push_back, push_front, insert, and erase
243 will still try to deallocate the original memory, which might cause
244 troubles depending on the intended use of the memory area.
245 \param f If true, the array frees the allocated memory in its
246 destructor, otherwise not. The default is true. */
247 void set_free_when_destroyed(bool f)
248 {
249 free_when_destroyed = f;
250 }
251
252
253 //! Sets the size of the array and allocates new elements if necessary.
254 /** Please note: This is only secure when using it with simple types,
255 because no default constructor will be called for the added elements.
256 \param usedNow Amount of elements now used. */
257 void set_used(u32 usedNow)
258 {
259 if (allocated < usedNow)
260 reallocate(usedNow);
261
262 used = usedNow;
263 }
264
265
266 //! Assignment operator
267 const array<T, TAlloc>& operator=(const array<T, TAlloc>& other)
268 {
269 if (this == &other)
270 return *this;
271 strategy = other.strategy;
272
273 if (data)
274 clear();
275
276 //if (allocated < other.allocated)
277 if (other.allocated == 0)
278 data = 0;
279 else
280 data = allocator.allocate(other.allocated); // new T[other.allocated];
281
282 used = other.used;
283 free_when_destroyed = true;
284 is_sorted = other.is_sorted;
285 allocated = other.allocated;
286
287 for (u32 i=0; i<other.used; ++i)
288 allocator.construct(&data[i], other.data[i]); // data[i] = other.data[i];
289
290 return *this;
291 }
292
293
294 //! Equality operator
295 bool operator == (const array<T, TAlloc>& other) const
296 {
297 if (used != other.used)
298 return false;
299
300 for (u32 i=0; i<other.used; ++i)
301 if (data[i] != other[i])
302 return false;
303 return true;
304 }
305
306
307 //! Inequality operator
308 bool operator != (const array<T, TAlloc>& other) const
309 {
310 return !(*this==other);
311 }
312
313
314 //! Direct access operator
315 T& operator [](u32 index)
316 {
317 _IRR_DEBUG_BREAK_IF(index>=used) // access violation
318
319 return data[index];
320 }
321
322
323 //! Direct const access operator
324 const T& operator [](u32 index) const
325 {
326 _IRR_DEBUG_BREAK_IF(index>=used) // access violation
327
328 return data[index];
329 }
330
331
332 //! Gets last element.
333 T& getLast()
334 {
335 _IRR_DEBUG_BREAK_IF(!used) // access violation
336
337 return data[used-1];
338 }
339
340
341 //! Gets last element
342 const T& getLast() const
343 {
344 _IRR_DEBUG_BREAK_IF(!used) // access violation
345
346 return data[used-1];
347 }
348
349
350 //! Gets a pointer to the array.
351 /** \return Pointer to the array. */
352 T* pointer()
353 {
354 return data;
355 }
356
357
358 //! Gets a const pointer to the array.
359 /** \return Pointer to the array. */
360 const T* const_pointer() const
361 {
362 return data;
363 }
364
365
366 //! Get number of occupied elements of the array.
367 /** \return Size of elements in the array which are actually occupied. */
368 u32 size() const
369 {
370 return used;
371 }
372
373
374 //! Get amount of memory allocated.
375 /** \return Amount of memory allocated. The amount of bytes
376 allocated would be allocated_size() * sizeof(ElementTypeUsed); */
377 u32 allocated_size() const
378 {
379 return allocated;
380 }
381
382
383 //! Check if array is empty.
384 /** \return True if the array is empty false if not. */
385 bool empty() const
386 {
387 return used == 0;
388 }
389
390
391 //! Sorts the array using heapsort.
392 /** There is no additional memory waste and the algorithm performs
393 O(n*log n) in worst case. */
394 void sort()
395 {
396 if (!is_sorted && used>1)
397 heapsort(data, used);
398 is_sorted = true;
399 }
400
401
402 //! Performs a binary search for an element, returns -1 if not found.
403 /** The array will be sorted before the binary search if it is not
404 already sorted. Caution is advised! Be careful not to call this on
405 unsorted const arrays, or the slower method will be used.
406 \param element Element to search for.
407 \return Position of the searched element if it was found,
408 otherwise -1 is returned. */
409 s32 binary_search(const T& element)
410 {
411 sort();
412 return binary_search(element, 0, used-1);
413 }
414
415
416 //! Performs a binary search for an element if possible, returns -1 if not found.
417 /** This method is for const arrays and so cannot call sort(), if the array is
418 not sorted then linear_search will be used instead. Potentially very slow!
419 \param element Element to search for.
420 \return Position of the searched element if it was found,
421 otherwise -1 is returned. */
422 s32 binary_search(const T& element) const
423 {
424 if (is_sorted)
425 return binary_search(element, 0, used-1);
426 else
427 return linear_search(element);
428 }
429
430
431 //! Performs a binary search for an element, returns -1 if not found.
432 /** \param element: Element to search for.
433 \param left First left index
434 \param right Last right index.
435 \return Position of the searched element if it was found, otherwise -1
436 is returned. */
437 s32 binary_search(const T& element, s32 left, s32 right) const
438 {
439 if (!used)
440 return -1;
441
442 s32 m;
443
444 do
445 {
446 m = (left+right)>>1;
447
448 if (element < data[m])
449 right = m - 1;
450 else
451 left = m + 1;
452
453 } while((element < data[m] || data[m] < element) && left<=right);
454 // this last line equals to:
455 // " while((element != array[m]) && left<=right);"
456 // but we only want to use the '<' operator.
457 // the same in next line, it is "(element == array[m])"
458
459
460 if (!(element < data[m]) && !(data[m] < element))
461 return m;
462
463 return -1;
464 }
465
466
467 //! Performs a binary search for an element, returns -1 if not found.
468 //! it is used for searching a multiset
469 /** The array will be sorted before the binary search if it is not
470 already sorted.
471 \param element Element to search for.
472 \param &last return lastIndex of equal elements
473 \return Position of the first searched element if it was found,
474 otherwise -1 is returned. */
475 s32 binary_search_multi(const T& element, s32 &last)
476 {
477 sort();
478 s32 index = binary_search(element, 0, used-1);
479 if ( index < 0 )
480 return index;
481
482 // The search can be somewhere in the middle of the set
483 // look linear previous and past the index
484 last = index;
485
486 while ( index > 0 && !(element < data[index - 1]) && !(data[index - 1] < element) )
487 {
488 index -= 1;
489 }
490 // look linear up
491 while ( last < (s32) used - 1 && !(element < data[last + 1]) && !(data[last + 1] < element) )
492 {
493 last += 1;
494 }
495
496 return index;
497 }
498
499
500 //! Finds an element in linear time, which is very slow.
501 /** Use binary_search for faster finding. Only works if ==operator is
502 implemented.
503 \param element Element to search for.
504 \return Position of the searched element if it was found, otherwise -1
505 is returned. */
506 s32 linear_search(const T& element) const
507 {
508 for (u32 i=0; i<used; ++i)
509 if (element == data[i])
510 return (s32)i;
511
512 return -1;
513 }
514
515
516 //! Finds an element in linear time, which is very slow.
517 /** Use binary_search for faster finding. Only works if ==operator is
518 implemented.
519 \param element: Element to search for.
520 \return Position of the searched element if it was found, otherwise -1
521 is returned. */
522 s32 linear_reverse_search(const T& element) const
523 {
524 for (s32 i=used-1; i>=0; --i)
525 if (data[i] == element)
526 return i;
527
528 return -1;
529 }
530
531
532 //! Erases an element from the array.
533 /** May be slow, because all elements following after the erased
534 element have to be copied.
535 \param index: Index of element to be erased. */
536 void erase(u32 index)
537 {
538 _IRR_DEBUG_BREAK_IF(index>=used) // access violation
539
540 for (u32 i=index+1; i<used; ++i)
541 {
542 allocator.destruct(&data[i-1]);
543 allocator.construct(&data[i-1], data[i]); // data[i-1] = data[i];
544 }
545
546 allocator.destruct(&data[used-1]);
547
548 --used;
549 }
550
551
552 //! Erases some elements from the array.
553 /** May be slow, because all elements following after the erased
554 element have to be copied.
555 \param index: Index of the first element to be erased.
556 \param count: Amount of elements to be erased. */
557 void erase(u32 index, s32 count)
558 {
559 if (index>=used || count<1)
560 return;
561 if (index+count>used)
562 count = used-index;
563
564 u32 i;
565 for (i=index; i<index+count; ++i)
566 allocator.destruct(&data[i]);
567
568 for (i=index+count; i<used; ++i)
569 {
570 if (i-count >= index+count) // not already destructed before loop
571 allocator.destruct(&data[i-count]);
572
573 allocator.construct(&data[i-count], data[i]); // data[i-count] = data[i];
574
575 if (i >= used-count) // those which are not overwritten
576 allocator.destruct(&data[i]);
577 }
578
579 used-= count;
580 }
581
582
583 //! Sets if the array is sorted
584 void set_sorted(bool _is_sorted)
585 {
586 is_sorted = _is_sorted;
587 }
588
589
590 //! Swap the content of this array container with the content of another array
591 /** Afterwards this object will contain the content of the other object and the other
592 object will contain the content of this object.
593 \param other Swap content with this object */
594 void swap(array<T, TAlloc>& other)
595 {
596 core::swap(data, other.data);
597 core::swap(allocated, other.allocated);
598 core::swap(used, other.used);
599 core::swap(allocator, other.allocator); // memory is still released by the same allocator used for allocation
600 eAllocStrategy helper_strategy(strategy); // can't use core::swap with bitfields
601 strategy = other.strategy;
602 other.strategy = helper_strategy;
603 bool helper_free_when_destroyed(free_when_destroyed);
604 free_when_destroyed = other.free_when_destroyed;
605 other.free_when_destroyed = helper_free_when_destroyed;
606 bool helper_is_sorted(is_sorted);
607 is_sorted = other.is_sorted;
608 other.is_sorted = helper_is_sorted;
609 }
610
611
612private:
613 T* data;
614 u32 allocated;
615 u32 used;
616 TAlloc allocator;
617 eAllocStrategy strategy:4;
618 bool free_when_destroyed:1;
619 bool is_sorted:1;
620};
621
622
623} // end namespace core
624} // end namespace irr
625
626#endif
627
diff --git a/src/others/irrlicht-1.8.1/include/irrList.h b/src/others/irrlicht-1.8.1/include/irrList.h
new file mode 100644
index 0000000..54eed83
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrList.h
@@ -0,0 +1,416 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_LIST_H_INCLUDED__
6#define __IRR_LIST_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "irrAllocator.h"
10#include "irrMath.h"
11
12namespace irr
13{
14namespace core
15{
16
17
18//! Doubly linked list template.
19template <class T>
20class list
21{
22private:
23
24 //! List element node with pointer to previous and next element in the list.
25 struct SKListNode
26 {
27 SKListNode(const T& e) : Next(0), Prev(0), Element(e) {}
28
29 SKListNode* Next;
30 SKListNode* Prev;
31 T Element;
32 };
33
34public:
35 class ConstIterator;
36
37 //! List iterator.
38 class Iterator
39 {
40 public:
41 Iterator() : Current(0) {}
42
43 Iterator& operator ++() { Current = Current->Next; return *this; }
44 Iterator& operator --() { Current = Current->Prev; return *this; }
45 Iterator operator ++(s32) { Iterator tmp = *this; Current = Current->Next; return tmp; }
46 Iterator operator --(s32) { Iterator tmp = *this; Current = Current->Prev; return tmp; }
47
48 Iterator& operator +=(s32 num)
49 {
50 if(num > 0)
51 {
52 while (num-- && this->Current != 0) ++(*this);
53 }
54 else
55 {
56 while(num++ && this->Current != 0) --(*this);
57 }
58 return *this;
59 }
60
61 Iterator operator + (s32 num) const { Iterator tmp = *this; return tmp += num; }
62 Iterator& operator -=(s32 num) { return (*this)+=(-num); }
63 Iterator operator - (s32 num) const { return (*this)+ (-num); }
64
65 bool operator ==(const Iterator& other) const { return Current == other.Current; }
66 bool operator !=(const Iterator& other) const { return Current != other.Current; }
67 bool operator ==(const ConstIterator& other) const { return Current == other.Current; }
68 bool operator !=(const ConstIterator& other) const { return Current != other.Current; }
69
70 #if defined (_MSC_VER) && (_MSC_VER < 1300)
71 #pragma warning(disable:4284) // infix notation problem when using iterator operator ->
72 #endif
73
74 T & operator * () { return Current->Element; }
75 T * operator ->() { return &Current->Element; }
76
77 private:
78 explicit Iterator(SKListNode* begin) : Current(begin) {}
79
80 SKListNode* Current;
81
82 friend class list<T>;
83 friend class ConstIterator;
84 };
85
86 //! List iterator for const access.
87 class ConstIterator
88 {
89 public:
90
91 ConstIterator() : Current(0) {}
92 ConstIterator(const Iterator& iter) : Current(iter.Current) {}
93
94 ConstIterator& operator ++() { Current = Current->Next; return *this; }
95 ConstIterator& operator --() { Current = Current->Prev; return *this; }
96 ConstIterator operator ++(s32) { ConstIterator tmp = *this; Current = Current->Next; return tmp; }
97 ConstIterator operator --(s32) { ConstIterator tmp = *this; Current = Current->Prev; return tmp; }
98
99 ConstIterator& operator +=(s32 num)
100 {
101 if(num > 0)
102 {
103 while(num-- && this->Current != 0) ++(*this);
104 }
105 else
106 {
107 while(num++ && this->Current != 0) --(*this);
108 }
109 return *this;
110 }
111
112 ConstIterator operator + (s32 num) const { ConstIterator tmp = *this; return tmp += num; }
113 ConstIterator& operator -=(s32 num) { return (*this)+=(-num); }
114 ConstIterator operator - (s32 num) const { return (*this)+ (-num); }
115
116 bool operator ==(const ConstIterator& other) const { return Current == other.Current; }
117 bool operator !=(const ConstIterator& other) const { return Current != other.Current; }
118 bool operator ==(const Iterator& other) const { return Current == other.Current; }
119 bool operator !=(const Iterator& other) const { return Current != other.Current; }
120
121 const T & operator * () { return Current->Element; }
122 const T * operator ->() { return &Current->Element; }
123
124 ConstIterator & operator =(const Iterator & iterator) { Current = iterator.Current; return *this; }
125
126 private:
127 explicit ConstIterator(SKListNode* begin) : Current(begin) {}
128
129 SKListNode* Current;
130
131 friend class Iterator;
132 friend class list<T>;
133 };
134
135 //! Default constructor for empty list.
136 list()
137 : First(0), Last(0), Size(0) {}
138
139
140 //! Copy constructor.
141 list(const list<T>& other) : First(0), Last(0), Size(0)
142 {
143 *this = other;
144 }
145
146
147 //! Destructor
148 ~list()
149 {
150 clear();
151 }
152
153
154 //! Assignment operator
155 void operator=(const list<T>& other)
156 {
157 if(&other == this)
158 {
159 return;
160 }
161
162 clear();
163
164 SKListNode* node = other.First;
165 while(node)
166 {
167 push_back(node->Element);
168 node = node->Next;
169 }
170 }
171
172
173 //! Returns amount of elements in list.
174 /** \return Amount of elements in the list. */
175 u32 size() const
176 {
177 return Size;
178 }
179 u32 getSize() const
180 {
181 return Size;
182 }
183
184
185 //! Clears the list, deletes all elements in the list.
186 /** All existing iterators of this list will be invalid. */
187 void clear()
188 {
189 while(First)
190 {
191 SKListNode * next = First->Next;
192 allocator.destruct(First);
193 allocator.deallocate(First);
194 First = next;
195 }
196
197 //First = 0; handled by loop
198 Last = 0;
199 Size = 0;
200 }
201
202
203 //! Checks for empty list.
204 /** \return True if the list is empty and false if not. */
205 bool empty() const
206 {
207 return (First == 0);
208 }
209
210
211 //! Adds an element at the end of the list.
212 /** \param element Element to add to the list. */
213 void push_back(const T& element)
214 {
215 SKListNode* node = allocator.allocate(1);
216 allocator.construct(node, element);
217
218 ++Size;
219
220 if (First == 0)
221 First = node;
222
223 node->Prev = Last;
224
225 if (Last != 0)
226 Last->Next = node;
227
228 Last = node;
229 }
230
231
232 //! Adds an element at the begin of the list.
233 /** \param element: Element to add to the list. */
234 void push_front(const T& element)
235 {
236 SKListNode* node = allocator.allocate(1);
237 allocator.construct(node, element);
238
239 ++Size;
240
241 if (First == 0)
242 {
243 Last = node;
244 First = node;
245 }
246 else
247 {
248 node->Next = First;
249 First->Prev = node;
250 First = node;
251 }
252 }
253
254
255 //! Gets first node.
256 /** \return A list iterator pointing to the beginning of the list. */
257 Iterator begin()
258 {
259 return Iterator(First);
260 }
261
262
263 //! Gets first node.
264 /** \return A const list iterator pointing to the beginning of the list. */
265 ConstIterator begin() const
266 {
267 return ConstIterator(First);
268 }
269
270
271 //! Gets end node.
272 /** \return List iterator pointing to null. */
273 Iterator end()
274 {
275 return Iterator(0);
276 }
277
278
279 //! Gets end node.
280 /** \return Const list iterator pointing to null. */
281 ConstIterator end() const
282 {
283 return ConstIterator(0);
284 }
285
286
287 //! Gets last element.
288 /** \return List iterator pointing to the last element of the list. */
289 Iterator getLast()
290 {
291 return Iterator(Last);
292 }
293
294
295 //! Gets last element.
296 /** \return Const list iterator pointing to the last element of the list. */
297 ConstIterator getLast() const
298 {
299 return ConstIterator(Last);
300 }
301
302
303 //! Inserts an element after an element.
304 /** \param it Iterator pointing to element after which the new element
305 should be inserted.
306 \param element The new element to be inserted into the list.
307 */
308 void insert_after(const Iterator& it, const T& element)
309 {
310 SKListNode* node = allocator.allocate(1);
311 allocator.construct(node, element);
312
313 node->Next = it.Current->Next;
314
315 if (it.Current->Next)
316 it.Current->Next->Prev = node;
317
318 node->Prev = it.Current;
319 it.Current->Next = node;
320 ++Size;
321
322 if (it.Current == Last)
323 Last = node;
324 }
325
326
327 //! Inserts an element before an element.
328 /** \param it Iterator pointing to element before which the new element
329 should be inserted.
330 \param element The new element to be inserted into the list.
331 */
332 void insert_before(const Iterator& it, const T& element)
333 {
334 SKListNode* node = allocator.allocate(1);
335 allocator.construct(node, element);
336
337 node->Prev = it.Current->Prev;
338
339 if (it.Current->Prev)
340 it.Current->Prev->Next = node;
341
342 node->Next = it.Current;
343 it.Current->Prev = node;
344 ++Size;
345
346 if (it.Current == First)
347 First = node;
348 }
349
350
351 //! Erases an element.
352 /** \param it Iterator pointing to the element which shall be erased.
353 \return Iterator pointing to next element. */
354 Iterator erase(Iterator& it)
355 {
356 // suggest changing this to a const Iterator& and
357 // working around line: it.Current = 0 (possibly with a mutable, or just let it be garbage?)
358
359 Iterator returnIterator(it);
360 ++returnIterator;
361
362 if(it.Current == First)
363 {
364 First = it.Current->Next;
365 }
366 else
367 {
368 it.Current->Prev->Next = it.Current->Next;
369 }
370
371 if(it.Current == Last)
372 {
373 Last = it.Current->Prev;
374 }
375 else
376 {
377 it.Current->Next->Prev = it.Current->Prev;
378 }
379
380 allocator.destruct(it.Current);
381 allocator.deallocate(it.Current);
382 it.Current = 0;
383 --Size;
384
385 return returnIterator;
386 }
387
388 //! Swap the content of this list container with the content of another list
389 /** Afterwards this object will contain the content of the other object and the other
390 object will contain the content of this object. Iterators will afterwards be valid for
391 the swapped object.
392 \param other Swap content with this object */
393 void swap(list<T>& other)
394 {
395 core::swap(First, other.First);
396 core::swap(Last, other.Last);
397 core::swap(Size, other.Size);
398 core::swap(allocator, other.allocator); // memory is still released by the same allocator used for allocation
399 }
400
401
402private:
403
404 SKListNode* First;
405 SKListNode* Last;
406 u32 Size;
407 irrAllocator<SKListNode> allocator;
408
409};
410
411
412} // end namespace core
413}// end namespace irr
414
415#endif
416
diff --git a/src/others/irrlicht-1.8.1/include/irrMap.h b/src/others/irrlicht-1.8.1/include/irrMap.h
new file mode 100644
index 0000000..9e9ae73
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrMap.h
@@ -0,0 +1,1127 @@
1// Copyright (C) 2006-2012 by Kat'Oun
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_MAP_H_INCLUDED__
6#define __IRR_MAP_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "irrMath.h"
10
11namespace irr
12{
13namespace core
14{
15
16//! map template for associative arrays using a red-black tree
17template <class KeyType, class ValueType>
18class map
19{
20 //! red/black tree for map
21 template <class KeyTypeRB, class ValueTypeRB>
22 class RBTree
23 {
24 public:
25
26 RBTree(const KeyTypeRB& k, const ValueTypeRB& v)
27 : LeftChild(0), RightChild(0), Parent(0), Key(k),
28 Value(v), IsRed(true) {}
29
30 void setLeftChild(RBTree* p)
31 {
32 LeftChild=p;
33 if (p)
34 p->setParent(this);
35 }
36
37 void setRightChild(RBTree* p)
38 {
39 RightChild=p;
40 if (p)
41 p->setParent(this);
42 }
43
44 void setParent(RBTree* p) { Parent=p; }
45
46 void setValue(const ValueTypeRB& v) { Value = v; }
47
48 void setRed() { IsRed = true; }
49 void setBlack() { IsRed = false; }
50
51 RBTree* getLeftChild() const { return LeftChild; }
52 RBTree* getRightChild() const { return RightChild; }
53 RBTree* getParent() const { return Parent; }
54
55 const ValueTypeRB& getValue() const
56 {
57 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
58 return Value;
59 }
60
61 ValueTypeRB& getValue()
62 {
63 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
64 return Value;
65 }
66
67 const KeyTypeRB& getKey() const
68 {
69 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
70 return Key;
71 }
72
73 bool isRoot() const
74 {
75 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
76 return Parent==0;
77 }
78
79 bool isLeftChild() const
80 {
81 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
82 return (Parent != 0) && (Parent->getLeftChild()==this);
83 }
84
85 bool isRightChild() const
86 {
87 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
88 return (Parent!=0) && (Parent->getRightChild()==this);
89 }
90
91 bool isLeaf() const
92 {
93 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
94 return (LeftChild==0) && (RightChild==0);
95 }
96
97 unsigned int getLevel() const
98 {
99 if (isRoot())
100 return 1;
101 else
102 return getParent()->getLevel() + 1;
103 }
104
105
106 bool isRed() const
107 {
108 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
109 return IsRed;
110 }
111
112 bool isBlack() const
113 {
114 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
115 return !IsRed;
116 }
117
118 private:
119 RBTree();
120
121 RBTree* LeftChild;
122 RBTree* RightChild;
123
124 RBTree* Parent;
125
126 KeyTypeRB Key;
127 ValueTypeRB Value;
128
129 bool IsRed;
130 }; // RBTree
131
132 public:
133
134 typedef RBTree<KeyType,ValueType> Node;
135 // We need the forwad declaration for the friend declaration
136 class ConstIterator;
137
138 //! Normal Iterator
139 class Iterator
140 {
141 friend class ConstIterator;
142 public:
143
144 Iterator() : Root(0), Cur(0) {}
145
146 // Constructor(Node*)
147 Iterator(Node* root) : Root(root)
148 {
149 reset();
150 }
151
152 // Copy constructor
153 Iterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
154
155 void reset(bool atLowest=true)
156 {
157 if (atLowest)
158 Cur = getMin(Root);
159 else
160 Cur = getMax(Root);
161 }
162
163 bool atEnd() const
164 {
165 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
166 return Cur==0;
167 }
168
169 Node* getNode() const
170 {
171 return Cur;
172 }
173
174 Iterator& operator=(const Iterator& src)
175 {
176 Root = src.Root;
177 Cur = src.Cur;
178 return (*this);
179 }
180
181 void operator++(int)
182 {
183 inc();
184 }
185
186 void operator--(int)
187 {
188 dec();
189 }
190
191 Node* operator->()
192 {
193 return getNode();
194 }
195
196 Node& operator*()
197 {
198 _IRR_DEBUG_BREAK_IF(atEnd()) // access violation
199
200 return *Cur;
201 }
202
203 private:
204
205 Node* getMin(Node* n) const
206 {
207 while(n && n->getLeftChild())
208 n = n->getLeftChild();
209 return n;
210 }
211
212 Node* getMax(Node* n) const
213 {
214 while(n && n->getRightChild())
215 n = n->getRightChild();
216 return n;
217 }
218
219 void inc()
220 {
221 // Already at end?
222 if (Cur==0)
223 return;
224
225 if (Cur->getRightChild())
226 {
227 // If current node has a right child, the next higher node is the
228 // node with lowest key beneath the right child.
229 Cur = getMin(Cur->getRightChild());
230 }
231 else if (Cur->isLeftChild())
232 {
233 // No right child? Well if current node is a left child then
234 // the next higher node is the parent
235 Cur = Cur->getParent();
236 }
237 else
238 {
239 // Current node neither is left child nor has a right child.
240 // Ie it is either right child or root
241 // The next higher node is the parent of the first non-right
242 // child (ie either a left child or the root) up in the
243 // hierarchy. Root's parent is 0.
244 while(Cur->isRightChild())
245 Cur = Cur->getParent();
246 Cur = Cur->getParent();
247 }
248 }
249
250 void dec()
251 {
252 // Already at end?
253 if (Cur==0)
254 return;
255
256 if (Cur->getLeftChild())
257 {
258 // If current node has a left child, the next lower node is the
259 // node with highest key beneath the left child.
260 Cur = getMax(Cur->getLeftChild());
261 }
262 else if (Cur->isRightChild())
263 {
264 // No left child? Well if current node is a right child then
265 // the next lower node is the parent
266 Cur = Cur->getParent();
267 }
268 else
269 {
270 // Current node neither is right child nor has a left child.
271 // Ie it is either left child or root
272 // The next higher node is the parent of the first non-left
273 // child (ie either a right child or the root) up in the
274 // hierarchy. Root's parent is 0.
275
276 while(Cur->isLeftChild())
277 Cur = Cur->getParent();
278 Cur = Cur->getParent();
279 }
280 }
281
282 Node* Root;
283 Node* Cur;
284 }; // Iterator
285
286 //! Const Iterator
287 class ConstIterator
288 {
289 friend class Iterator;
290 public:
291
292 ConstIterator() : Root(0), Cur(0) {}
293
294 // Constructor(Node*)
295 ConstIterator(const Node* root) : Root(root)
296 {
297 reset();
298 }
299
300 // Copy constructor
301 ConstIterator(const ConstIterator& src) : Root(src.Root), Cur(src.Cur) {}
302 ConstIterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
303
304 void reset(bool atLowest=true)
305 {
306 if (atLowest)
307 Cur = getMin(Root);
308 else
309 Cur = getMax(Root);
310 }
311
312 bool atEnd() const
313 {
314 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
315 return Cur==0;
316 }
317
318 const Node* getNode() const
319 {
320 return Cur;
321 }
322
323 ConstIterator& operator=(const ConstIterator& src)
324 {
325 Root = src.Root;
326 Cur = src.Cur;
327 return (*this);
328 }
329
330 void operator++(int)
331 {
332 inc();
333 }
334
335 void operator--(int)
336 {
337 dec();
338 }
339
340 const Node* operator->()
341 {
342 return getNode();
343 }
344
345 const Node& operator*()
346 {
347 _IRR_DEBUG_BREAK_IF(atEnd()) // access violation
348
349 return *Cur;
350 }
351
352 private:
353
354 const Node* getMin(const Node* n) const
355 {
356 while(n && n->getLeftChild())
357 n = n->getLeftChild();
358 return n;
359 }
360
361 const Node* getMax(const Node* n) const
362 {
363 while(n && n->getRightChild())
364 n = n->getRightChild();
365 return n;
366 }
367
368 void inc()
369 {
370 // Already at end?
371 if (Cur==0)
372 return;
373
374 if (Cur->getRightChild())
375 {
376 // If current node has a right child, the next higher node is the
377 // node with lowest key beneath the right child.
378 Cur = getMin(Cur->getRightChild());
379 }
380 else if (Cur->isLeftChild())
381 {
382 // No right child? Well if current node is a left child then
383 // the next higher node is the parent
384 Cur = Cur->getParent();
385 }
386 else
387 {
388 // Current node neither is left child nor has a right child.
389 // Ie it is either right child or root
390 // The next higher node is the parent of the first non-right
391 // child (ie either a left child or the root) up in the
392 // hierarchy. Root's parent is 0.
393 while(Cur->isRightChild())
394 Cur = Cur->getParent();
395 Cur = Cur->getParent();
396 }
397 }
398
399 void dec()
400 {
401 // Already at end?
402 if (Cur==0)
403 return;
404
405 if (Cur->getLeftChild())
406 {
407 // If current node has a left child, the next lower node is the
408 // node with highest key beneath the left child.
409 Cur = getMax(Cur->getLeftChild());
410 }
411 else if (Cur->isRightChild())
412 {
413 // No left child? Well if current node is a right child then
414 // the next lower node is the parent
415 Cur = Cur->getParent();
416 }
417 else
418 {
419 // Current node neither is right child nor has a left child.
420 // Ie it is either left child or root
421 // The next higher node is the parent of the first non-left
422 // child (ie either a right child or the root) up in the
423 // hierarchy. Root's parent is 0.
424
425 while(Cur->isLeftChild())
426 Cur = Cur->getParent();
427 Cur = Cur->getParent();
428 }
429 }
430
431 const Node* Root;
432 const Node* Cur;
433 }; // ConstIterator
434
435
436 //! Parent First Iterator.
437 /** Traverses the tree from top to bottom. Typical usage is
438 when storing the tree structure, because when reading it
439 later (and inserting elements) the tree structure will
440 be the same. */
441 class ParentFirstIterator
442 {
443 public:
444
445 ParentFirstIterator() : Root(0), Cur(0) {}
446
447 explicit ParentFirstIterator(Node* root) : Root(root), Cur(0)
448 {
449 reset();
450 }
451
452 void reset()
453 {
454 Cur = Root;
455 }
456
457 bool atEnd() const
458 {
459 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
460 return Cur==0;
461 }
462
463 Node* getNode()
464 {
465 return Cur;
466 }
467
468 ParentFirstIterator& operator=(const ParentFirstIterator& src)
469 {
470 Root = src.Root;
471 Cur = src.Cur;
472 return (*this);
473 }
474
475 void operator++(int)
476 {
477 inc();
478 }
479
480 Node* operator -> ()
481 {
482 return getNode();
483 }
484
485 Node& operator* ()
486 {
487 _IRR_DEBUG_BREAK_IF(atEnd()) // access violation
488
489 return *getNode();
490 }
491
492 private:
493
494 void inc()
495 {
496 // Already at end?
497 if (Cur==0)
498 return;
499
500 // First we try down to the left
501 if (Cur->getLeftChild())
502 {
503 Cur = Cur->getLeftChild();
504 }
505 else if (Cur->getRightChild())
506 {
507 // No left child? The we go down to the right.
508 Cur = Cur->getRightChild();
509 }
510 else
511 {
512 // No children? Move up in the hierarcy until
513 // we either reach 0 (and are finished) or
514 // find a right uncle.
515 while (Cur!=0)
516 {
517 // But if parent is left child and has a right "uncle" the parent
518 // has already been processed but the uncle hasn't. Move to
519 // the uncle.
520 if (Cur->isLeftChild() && Cur->getParent()->getRightChild())
521 {
522 Cur = Cur->getParent()->getRightChild();
523 return;
524 }
525 Cur = Cur->getParent();
526 }
527 }
528 }
529
530 Node* Root;
531 Node* Cur;
532
533 }; // ParentFirstIterator
534
535
536 //! Parent Last Iterator
537 /** Traverse the tree from bottom to top.
538 Typical usage is when deleting all elements in the tree
539 because you must delete the children before you delete
540 their parent. */
541 class ParentLastIterator
542 {
543 public:
544
545 ParentLastIterator() : Root(0), Cur(0) {}
546
547 explicit ParentLastIterator(Node* root) : Root(root), Cur(0)
548 {
549 reset();
550 }
551
552 void reset()
553 {
554 Cur = getMin(Root);
555 }
556
557 bool atEnd() const
558 {
559 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
560 return Cur==0;
561 }
562
563 Node* getNode()
564 {
565 return Cur;
566 }
567
568 ParentLastIterator& operator=(const ParentLastIterator& src)
569 {
570 Root = src.Root;
571 Cur = src.Cur;
572 return (*this);
573 }
574
575 void operator++(int)
576 {
577 inc();
578 }
579
580 Node* operator -> ()
581 {
582 return getNode();
583 }
584
585 Node& operator* ()
586 {
587 _IRR_DEBUG_BREAK_IF(atEnd()) // access violation
588
589 return *getNode();
590 }
591 private:
592
593 Node* getMin(Node* n)
594 {
595 while(n!=0 && (n->getLeftChild()!=0 || n->getRightChild()!=0))
596 {
597 if (n->getLeftChild())
598 n = n->getLeftChild();
599 else
600 n = n->getRightChild();
601 }
602 return n;
603 }
604
605 void inc()
606 {
607 // Already at end?
608 if (Cur==0)
609 return;
610
611 // Note: Starting point is the node as far down to the left as possible.
612
613 // If current node has an uncle to the right, go to the
614 // node as far down to the left from the uncle as possible
615 // else just go up a level to the parent.
616 if (Cur->isLeftChild() && Cur->getParent()->getRightChild())
617 {
618 Cur = getMin(Cur->getParent()->getRightChild());
619 }
620 else
621 Cur = Cur->getParent();
622 }
623
624 Node* Root;
625 Node* Cur;
626 }; // ParentLastIterator
627
628
629 // AccessClass is a temporary class used with the [] operator.
630 // It makes it possible to have different behavior in situations like:
631 // myTree["Foo"] = 32;
632 // If "Foo" already exists update its value else insert a new element.
633 // int i = myTree["Foo"]
634 // If "Foo" exists return its value.
635 class AccessClass
636 {
637 // Let map be the only one who can instantiate this class.
638 friend class map<KeyType, ValueType>;
639
640 public:
641
642 // Assignment operator. Handles the myTree["Foo"] = 32; situation
643 void operator=(const ValueType& value)
644 {
645 // Just use the Set method, it handles already exist/not exist situation
646 Tree.set(Key,value);
647 }
648
649 // ValueType operator
650 operator ValueType()
651 {
652 Node* node = Tree.find(Key);
653
654 // Not found
655 _IRR_DEBUG_BREAK_IF(node==0) // access violation
656
657 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
658 return node->getValue();
659 }
660
661 private:
662
663 AccessClass(map& tree, const KeyType& key) : Tree(tree), Key(key) {}
664
665 AccessClass();
666
667 map& Tree;
668 const KeyType& Key;
669 }; // AccessClass
670
671
672 // Constructor.
673 map() : Root(0), Size(0) {}
674
675 // Destructor
676 ~map()
677 {
678 clear();
679 }
680
681 //------------------------------
682 // Public Commands
683 //------------------------------
684
685 //! Inserts a new node into the tree
686 /** \param keyNew: the index for this value
687 \param v: the value to insert
688 \return True if successful, false if it fails (already exists) */
689 bool insert(const KeyType& keyNew, const ValueType& v)
690 {
691 // First insert node the "usual" way (no fancy balance logic yet)
692 Node* newNode = new Node(keyNew,v);
693 if (!insert(newNode))
694 {
695 delete newNode;
696 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
697 return false;
698 }
699
700 // Then attend a balancing party
701 while (!newNode->isRoot() && (newNode->getParent()->isRed()))
702 {
703 if (newNode->getParent()->isLeftChild())
704 {
705 // If newNode is a left child, get its right 'uncle'
706 Node* newNodesUncle = newNode->getParent()->getParent()->getRightChild();
707 if ( newNodesUncle!=0 && newNodesUncle->isRed())
708 {
709 // case 1 - change the colors
710 newNode->getParent()->setBlack();
711 newNodesUncle->setBlack();
712 newNode->getParent()->getParent()->setRed();
713 // Move newNode up the tree
714 newNode = newNode->getParent()->getParent();
715 }
716 else
717 {
718 // newNodesUncle is a black node
719 if ( newNode->isRightChild())
720 {
721 // and newNode is to the right
722 // case 2 - move newNode up and rotate
723 newNode = newNode->getParent();
724 rotateLeft(newNode);
725 }
726 // case 3
727 newNode->getParent()->setBlack();
728 newNode->getParent()->getParent()->setRed();
729 rotateRight(newNode->getParent()->getParent());
730 }
731 }
732 else
733 {
734 // If newNode is a right child, get its left 'uncle'
735 Node* newNodesUncle = newNode->getParent()->getParent()->getLeftChild();
736 if ( newNodesUncle!=0 && newNodesUncle->isRed())
737 {
738 // case 1 - change the colors
739 newNode->getParent()->setBlack();
740 newNodesUncle->setBlack();
741 newNode->getParent()->getParent()->setRed();
742 // Move newNode up the tree
743 newNode = newNode->getParent()->getParent();
744 }
745 else
746 {
747 // newNodesUncle is a black node
748 if (newNode->isLeftChild())
749 {
750 // and newNode is to the left
751 // case 2 - move newNode up and rotate
752 newNode = newNode->getParent();
753 rotateRight(newNode);
754 }
755 // case 3
756 newNode->getParent()->setBlack();
757 newNode->getParent()->getParent()->setRed();
758 rotateLeft(newNode->getParent()->getParent());
759 }
760
761 }
762 }
763 // Color the root black
764 Root->setBlack();
765 return true;
766 }
767
768 //! Replaces the value if the key already exists, otherwise inserts a new element.
769 /** \param k The index for this value
770 \param v The new value of */
771 void set(const KeyType& k, const ValueType& v)
772 {
773 Node* p = find(k);
774 if (p)
775 p->setValue(v);
776 else
777 insert(k,v);
778 }
779
780 //! Removes a node from the tree and returns it.
781 /** The returned node must be deleted by the user
782 \param k the key to remove
783 \return A pointer to the node, or 0 if not found */
784 Node* delink(const KeyType& k)
785 {
786 Node* p = find(k);
787 if (p == 0)
788 return 0;
789
790 // Rotate p down to the left until it has no right child, will get there
791 // sooner or later.
792 while(p->getRightChild())
793 {
794 // "Pull up my right child and let it knock me down to the left"
795 rotateLeft(p);
796 }
797 // p now has no right child but might have a left child
798 Node* left = p->getLeftChild();
799
800 // Let p's parent point to p's child instead of point to p
801 if (p->isLeftChild())
802 p->getParent()->setLeftChild(left);
803
804 else if (p->isRightChild())
805 p->getParent()->setRightChild(left);
806
807 else
808 {
809 // p has no parent => p is the root.
810 // Let the left child be the new root.
811 setRoot(left);
812 }
813
814 // p is now gone from the tree in the sense that
815 // no one is pointing at it, so return it.
816
817 --Size;
818 return p;
819 }
820
821 //! Removes a node from the tree and deletes it.
822 /** \return True if the node was found and deleted */
823 bool remove(const KeyType& k)
824 {
825 Node* p = find(k);
826 return remove(p);
827 }
828
829 //! Removes a node from the tree and deletes it.
830 /** \return True if the node was found and deleted */
831 bool remove(Node* p)
832 {
833 if (p == 0)
834 {
835 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
836 return false;
837 }
838
839 // Rotate p down to the left until it has no right child, will get there
840 // sooner or later.
841 while(p->getRightChild())
842 {
843 // "Pull up my right child and let it knock me down to the left"
844 rotateLeft(p);
845 }
846 // p now has no right child but might have a left child
847 Node* left = p->getLeftChild();
848
849 // Let p's parent point to p's child instead of point to p
850 if (p->isLeftChild())
851 p->getParent()->setLeftChild(left);
852
853 else if (p->isRightChild())
854 p->getParent()->setRightChild(left);
855
856 else
857 {
858 // p has no parent => p is the root.
859 // Let the left child be the new root.
860 setRoot(left);
861 }
862
863 // p is now gone from the tree in the sense that
864 // no one is pointing at it. Let's get rid of it.
865 delete p;
866
867 --Size;
868 return true;
869 }
870
871 //! Clear the entire tree
872 void clear()
873 {
874 ParentLastIterator i(getParentLastIterator());
875
876 while(!i.atEnd())
877 {
878 Node* p = i.getNode();
879 i++; // Increment it before it is deleted
880 // else iterator will get quite confused.
881 delete p;
882 }
883 Root = 0;
884 Size= 0;
885 }
886
887 //! Is the tree empty?
888 //! \return Returns true if empty, false if not
889 bool empty() const
890 {
891 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
892 return Root == 0;
893 }
894
895 //! \deprecated Use empty() instead. This method may be removed by Irrlicht 1.9
896 _IRR_DEPRECATED_ bool isEmpty() const
897 {
898 return empty();
899 }
900
901 //! Search for a node with the specified key.
902 //! \param keyToFind: The key to find
903 //! \return Returns 0 if node couldn't be found.
904 Node* find(const KeyType& keyToFind) const
905 {
906 Node* pNode = Root;
907
908 while(pNode!=0)
909 {
910 const KeyType& key=pNode->getKey();
911
912 if (keyToFind == key)
913 return pNode;
914 else if (keyToFind < key)
915 pNode = pNode->getLeftChild();
916 else //keyToFind > key
917 pNode = pNode->getRightChild();
918 }
919
920 return 0;
921 }
922
923 //! Gets the root element.
924 //! \return Returns a pointer to the root node, or
925 //! 0 if the tree is empty.
926 Node* getRoot() const
927 {
928 return Root;
929 }
930
931 //! Returns the number of nodes in the tree.
932 u32 size() const
933 {
934 return Size;
935 }
936
937 //! Swap the content of this map container with the content of another map
938 /** Afterwards this object will contain the content of the other object and the other
939 object will contain the content of this object. Iterators will afterwards be valid for
940 the swapped object.
941 \param other Swap content with this object */
942 void swap(map<KeyType, ValueType>& other)
943 {
944 core::swap(Root, other.Root);
945 core::swap(Size, other.Size);
946 }
947
948 //------------------------------
949 // Public Iterators
950 //------------------------------
951
952 //! Returns an iterator
953 Iterator getIterator() const
954 {
955 Iterator it(getRoot());
956 return it;
957 }
958
959 //! Returns a Constiterator
960 ConstIterator getConstIterator() const
961 {
962 Iterator it(getRoot());
963 return it;
964 }
965
966 //! Returns a ParentFirstIterator.
967 //! Traverses the tree from top to bottom. Typical usage is
968 //! when storing the tree structure, because when reading it
969 //! later (and inserting elements) the tree structure will
970 //! be the same.
971 ParentFirstIterator getParentFirstIterator() const
972 {
973 ParentFirstIterator it(getRoot());
974 return it;
975 }
976
977 //! Returns a ParentLastIterator to traverse the tree from
978 //! bottom to top.
979 //! Typical usage is when deleting all elements in the tree
980 //! because you must delete the children before you delete
981 //! their parent.
982 ParentLastIterator getParentLastIterator() const
983 {
984 ParentLastIterator it(getRoot());
985 return it;
986 }
987
988 //------------------------------
989 // Public Operators
990 //------------------------------
991
992 //! operator [] for access to elements
993 /** for example myMap["key"] */
994 AccessClass operator[](const KeyType& k)
995 {
996 return AccessClass(*this, k);
997 }
998 private:
999
1000 //------------------------------
1001 // Disabled methods
1002 //------------------------------
1003 // Copy constructor and assignment operator deliberately
1004 // defined but not implemented. The tree should never be
1005 // copied, pass along references to it instead.
1006 explicit map(const map& src);
1007 map& operator = (const map& src);
1008
1009 //! Set node as new root.
1010 /** The node will be set to black, otherwise core dumps may arise
1011 (patch provided by rogerborg).
1012 \param newRoot Node which will be the new root
1013 */
1014 void setRoot(Node* newRoot)
1015 {
1016 Root = newRoot;
1017 if (Root != 0)
1018 {
1019 Root->setParent(0);
1020 Root->setBlack();
1021 }
1022 }
1023
1024 //! Insert a node into the tree without using any fancy balancing logic.
1025 /** \return false if that key already exist in the tree. */
1026 bool insert(Node* newNode)
1027 {
1028 bool result=true; // Assume success
1029
1030 if (Root==0)
1031 {
1032 setRoot(newNode);
1033 Size = 1;
1034 }
1035 else
1036 {
1037 Node* pNode = Root;
1038 const KeyType& keyNew = newNode->getKey();
1039 while (pNode)
1040 {
1041 const KeyType& key=pNode->getKey();
1042
1043 if (keyNew == key)
1044 {
1045 result = false;
1046 pNode = 0;
1047 }
1048 else if (keyNew < key)
1049 {
1050 if (pNode->getLeftChild() == 0)
1051 {
1052 pNode->setLeftChild(newNode);
1053 pNode = 0;
1054 }
1055 else
1056 pNode = pNode->getLeftChild();
1057 }
1058 else // keyNew > key
1059 {
1060 if (pNode->getRightChild()==0)
1061 {
1062 pNode->setRightChild(newNode);
1063 pNode = 0;
1064 }
1065 else
1066 {
1067 pNode = pNode->getRightChild();
1068 }
1069 }
1070 }
1071
1072 if (result)
1073 ++Size;
1074 }
1075
1076 _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
1077 return result;
1078 }
1079
1080 //! Rotate left.
1081 //! Pull up node's right child and let it knock node down to the left
1082 void rotateLeft(Node* p)
1083 {
1084 Node* right = p->getRightChild();
1085
1086 p->setRightChild(right->getLeftChild());
1087
1088 if (p->isLeftChild())
1089 p->getParent()->setLeftChild(right);
1090 else if (p->isRightChild())
1091 p->getParent()->setRightChild(right);
1092 else
1093 setRoot(right);
1094
1095 right->setLeftChild(p);
1096 }
1097
1098 //! Rotate right.
1099 //! Pull up node's left child and let it knock node down to the right
1100 void rotateRight(Node* p)
1101 {
1102 Node* left = p->getLeftChild();
1103
1104 p->setLeftChild(left->getRightChild());
1105
1106 if (p->isLeftChild())
1107 p->getParent()->setLeftChild(left);
1108 else if (p->isRightChild())
1109 p->getParent()->setRightChild(left);
1110 else
1111 setRoot(left);
1112
1113 left->setRightChild(p);
1114 }
1115
1116 //------------------------------
1117 // Private Members
1118 //------------------------------
1119 Node* Root; // The top node. 0 if empty.
1120 u32 Size; // Number of nodes in the tree
1121};
1122
1123} // end namespace core
1124} // end namespace irr
1125
1126#endif // __IRR_MAP_H_INCLUDED__
1127
diff --git a/src/others/irrlicht-1.8.1/include/irrMath.h b/src/others/irrlicht-1.8.1/include/irrMath.h
new file mode 100644
index 0000000..3852932
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrMath.h
@@ -0,0 +1,732 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_MATH_H_INCLUDED__
6#define __IRR_MATH_H_INCLUDED__
7
8#include "IrrCompileConfig.h"
9#include "irrTypes.h"
10#include <math.h>
11#include <float.h>
12#include <stdlib.h> // for abs() etc.
13#include <limits.h> // For INT_MAX / UINT_MAX
14
15#if defined(_IRR_SOLARIS_PLATFORM_) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) || defined (_WIN32_WCE)
16 #define sqrtf(X) (irr::f32)sqrt((irr::f64)(X))
17 #define sinf(X) (irr::f32)sin((irr::f64)(X))
18 #define cosf(X) (irr::f32)cos((irr::f64)(X))
19 #define asinf(X) (irr::f32)asin((irr::f64)(X))
20 #define acosf(X) (irr::f32)acos((irr::f64)(X))
21 #define atan2f(X,Y) (irr::f32)atan2((irr::f64)(X),(irr::f64)(Y))
22 #define ceilf(X) (irr::f32)ceil((irr::f64)(X))
23 #define floorf(X) (irr::f32)floor((irr::f64)(X))
24 #define powf(X,Y) (irr::f32)pow((irr::f64)(X),(irr::f64)(Y))
25 #define fmodf(X,Y) (irr::f32)fmod((irr::f64)(X),(irr::f64)(Y))
26 #define fabsf(X) (irr::f32)fabs((irr::f64)(X))
27 #define logf(X) (irr::f32)log((irr::f64)(X))
28#endif
29
30#ifndef FLT_MAX
31#define FLT_MAX 3.402823466E+38F
32#endif
33
34#ifndef FLT_MIN
35#define FLT_MIN 1.17549435e-38F
36#endif
37
38namespace irr
39{
40namespace core
41{
42
43 //! Rounding error constant often used when comparing f32 values.
44
45 const s32 ROUNDING_ERROR_S32 = 0;
46#ifdef __IRR_HAS_S64
47 const s64 ROUNDING_ERROR_S64 = 0;
48#endif
49 const f32 ROUNDING_ERROR_f32 = 0.000001f;
50 const f64 ROUNDING_ERROR_f64 = 0.00000001;
51
52#ifdef PI // make sure we don't collide with a define
53#undef PI
54#endif
55 //! Constant for PI.
56 const f32 PI = 3.14159265359f;
57
58 //! Constant for reciprocal of PI.
59 const f32 RECIPROCAL_PI = 1.0f/PI;
60
61 //! Constant for half of PI.
62 const f32 HALF_PI = PI/2.0f;
63
64#ifdef PI64 // make sure we don't collide with a define
65#undef PI64
66#endif
67 //! Constant for 64bit PI.
68 const f64 PI64 = 3.1415926535897932384626433832795028841971693993751;
69
70 //! Constant for 64bit reciprocal of PI.
71 const f64 RECIPROCAL_PI64 = 1.0/PI64;
72
73 //! 32bit Constant for converting from degrees to radians
74 const f32 DEGTORAD = PI / 180.0f;
75
76 //! 32bit constant for converting from radians to degrees (formally known as GRAD_PI)
77 const f32 RADTODEG = 180.0f / PI;
78
79 //! 64bit constant for converting from degrees to radians (formally known as GRAD_PI2)
80 const f64 DEGTORAD64 = PI64 / 180.0;
81
82 //! 64bit constant for converting from radians to degrees
83 const f64 RADTODEG64 = 180.0 / PI64;
84
85 //! Utility function to convert a radian value to degrees
86 /** Provided as it can be clearer to write radToDeg(X) than RADTODEG * X
87 \param radians The radians value to convert to degrees.
88 */
89 inline f32 radToDeg(f32 radians)
90 {
91 return RADTODEG * radians;
92 }
93
94 //! Utility function to convert a radian value to degrees
95 /** Provided as it can be clearer to write radToDeg(X) than RADTODEG * X
96 \param radians The radians value to convert to degrees.
97 */
98 inline f64 radToDeg(f64 radians)
99 {
100 return RADTODEG64 * radians;
101 }
102
103 //! Utility function to convert a degrees value to radians
104 /** Provided as it can be clearer to write degToRad(X) than DEGTORAD * X
105 \param degrees The degrees value to convert to radians.
106 */
107 inline f32 degToRad(f32 degrees)
108 {
109 return DEGTORAD * degrees;
110 }
111
112 //! Utility function to convert a degrees value to radians
113 /** Provided as it can be clearer to write degToRad(X) than DEGTORAD * X
114 \param degrees The degrees value to convert to radians.
115 */
116 inline f64 degToRad(f64 degrees)
117 {
118 return DEGTORAD64 * degrees;
119 }
120
121 //! returns minimum of two values. Own implementation to get rid of the STL (VS6 problems)
122 template<class T>
123 inline const T& min_(const T& a, const T& b)
124 {
125 return a < b ? a : b;
126 }
127
128 //! returns minimum of three values. Own implementation to get rid of the STL (VS6 problems)
129 template<class T>
130 inline const T& min_(const T& a, const T& b, const T& c)
131 {
132 return a < b ? min_(a, c) : min_(b, c);
133 }
134
135 //! returns maximum of two values. Own implementation to get rid of the STL (VS6 problems)
136 template<class T>
137 inline const T& max_(const T& a, const T& b)
138 {
139 return a < b ? b : a;
140 }
141
142 //! returns maximum of three values. Own implementation to get rid of the STL (VS6 problems)
143 template<class T>
144 inline const T& max_(const T& a, const T& b, const T& c)
145 {
146 return a < b ? max_(b, c) : max_(a, c);
147 }
148
149 //! returns abs of two values. Own implementation to get rid of STL (VS6 problems)
150 template<class T>
151 inline T abs_(const T& a)
152 {
153 return a < (T)0 ? -a : a;
154 }
155
156 //! returns linear interpolation of a and b with ratio t
157 //! \return: a if t==0, b if t==1, and the linear interpolation else
158 template<class T>
159 inline T lerp(const T& a, const T& b, const f32 t)
160 {
161 return (T)(a*(1.f-t)) + (b*t);
162 }
163
164 //! clamps a value between low and high
165 template <class T>
166 inline const T clamp (const T& value, const T& low, const T& high)
167 {
168 return min_ (max_(value,low), high);
169 }
170
171 //! swaps the content of the passed parameters
172 // Note: We use the same trick as boost and use two template arguments to
173 // avoid ambiguity when swapping objects of an Irrlicht type that has not
174 // it's own swap overload. Otherwise we get conflicts with some compilers
175 // in combination with stl.
176 template <class T1, class T2>
177 inline void swap(T1& a, T2& b)
178 {
179 T1 c(a);
180 a = b;
181 b = c;
182 }
183
184 //! returns if a equals b, taking possible rounding errors into account
185 inline bool equals(const f64 a, const f64 b, const f64 tolerance = ROUNDING_ERROR_f64)
186 {
187 return (a + tolerance >= b) && (a - tolerance <= b);
188 }
189
190 //! returns if a equals b, taking possible rounding errors into account
191 inline bool equals(const f32 a, const f32 b, const f32 tolerance = ROUNDING_ERROR_f32)
192 {
193 return (a + tolerance >= b) && (a - tolerance <= b);
194 }
195
196 union FloatIntUnion32
197 {
198 FloatIntUnion32(float f1 = 0.0f) : f(f1) {}
199 // Portable sign-extraction
200 bool sign() const { return (i >> 31) != 0; }
201
202 irr::s32 i;
203 irr::f32 f;
204 };
205
206 //! We compare the difference in ULP's (spacing between floating-point numbers, aka ULP=1 means there exists no float between).
207 //\result true when numbers have a ULP <= maxUlpDiff AND have the same sign.
208 inline bool equalsByUlp(f32 a, f32 b, int maxUlpDiff)
209 {
210 // Based on the ideas and code from Bruce Dawson on
211 // http://www.altdevblogaday.com/2012/02/22/comparing-floating-point-numbers-2012-edition/
212 // When floats are interpreted as integers the two nearest possible float numbers differ just
213 // by one integer number. Also works the other way round, an integer of 1 interpreted as float
214 // is for example the smallest possible float number.
215
216 FloatIntUnion32 fa(a);
217 FloatIntUnion32 fb(b);
218
219 // Different signs, we could maybe get difference to 0, but so close to 0 using epsilons is better.
220 if ( fa.sign() != fb.sign() )
221 {
222 // Check for equality to make sure +0==-0
223 if (fa.i == fb.i)
224 return true;
225 return false;
226 }
227
228 // Find the difference in ULPs.
229 int ulpsDiff = abs_(fa.i- fb.i);
230 if (ulpsDiff <= maxUlpDiff)
231 return true;
232
233 return false;
234 }
235
236#if 0
237 //! returns if a equals b, not using any rounding tolerance
238 inline bool equals(const s32 a, const s32 b)
239 {
240 return (a == b);
241 }
242
243 //! returns if a equals b, not using any rounding tolerance
244 inline bool equals(const u32 a, const u32 b)
245 {
246 return (a == b);
247 }
248#endif
249 //! returns if a equals b, taking an explicit rounding tolerance into account
250 inline bool equals(const s32 a, const s32 b, const s32 tolerance = ROUNDING_ERROR_S32)
251 {
252 return (a + tolerance >= b) && (a - tolerance <= b);
253 }
254
255 //! returns if a equals b, taking an explicit rounding tolerance into account
256 inline bool equals(const u32 a, const u32 b, const s32 tolerance = ROUNDING_ERROR_S32)
257 {
258 return (a + tolerance >= b) && (a - tolerance <= b);
259 }
260
261#ifdef __IRR_HAS_S64
262 //! returns if a equals b, taking an explicit rounding tolerance into account
263 inline bool equals(const s64 a, const s64 b, const s64 tolerance = ROUNDING_ERROR_S64)
264 {
265 return (a + tolerance >= b) && (a - tolerance <= b);
266 }
267#endif
268
269 //! returns if a equals zero, taking rounding errors into account
270 inline bool iszero(const f64 a, const f64 tolerance = ROUNDING_ERROR_f64)
271 {
272 return fabs(a) <= tolerance;
273 }
274
275 //! returns if a equals zero, taking rounding errors into account
276 inline bool iszero(const f32 a, const f32 tolerance = ROUNDING_ERROR_f32)
277 {
278 return fabsf(a) <= tolerance;
279 }
280
281 //! returns if a equals not zero, taking rounding errors into account
282 inline bool isnotzero(const f32 a, const f32 tolerance = ROUNDING_ERROR_f32)
283 {
284 return fabsf(a) > tolerance;
285 }
286
287 //! returns if a equals zero, taking rounding errors into account
288 inline bool iszero(const s32 a, const s32 tolerance = 0)
289 {
290 return ( a & 0x7ffffff ) <= tolerance;
291 }
292
293 //! returns if a equals zero, taking rounding errors into account
294 inline bool iszero(const u32 a, const u32 tolerance = 0)
295 {
296 return a <= tolerance;
297 }
298
299#ifdef __IRR_HAS_S64
300 //! returns if a equals zero, taking rounding errors into account
301 inline bool iszero(const s64 a, const s64 tolerance = 0)
302 {
303 return abs_(a) <= tolerance;
304 }
305#endif
306
307 inline s32 s32_min(s32 a, s32 b)
308 {
309 const s32 mask = (a - b) >> 31;
310 return (a & mask) | (b & ~mask);
311 }
312
313 inline s32 s32_max(s32 a, s32 b)
314 {
315 const s32 mask = (a - b) >> 31;
316 return (b & mask) | (a & ~mask);
317 }
318
319 inline s32 s32_clamp (s32 value, s32 low, s32 high)
320 {
321 return s32_min(s32_max(value,low), high);
322 }
323
324 /*
325 float IEEE-754 bit represenation
326
327 0 0x00000000
328 1.0 0x3f800000
329 0.5 0x3f000000
330 3 0x40400000
331 +inf 0x7f800000
332 -inf 0xff800000
333 +NaN 0x7fc00000 or 0x7ff00000
334 in general: number = (sign ? -1:1) * 2^(exponent) * 1.(mantissa bits)
335 */
336
337 typedef union { u32 u; s32 s; f32 f; } inttofloat;
338
339 #define F32_AS_S32(f) (*((s32 *) &(f)))
340 #define F32_AS_U32(f) (*((u32 *) &(f)))
341 #define F32_AS_U32_POINTER(f) ( ((u32 *) &(f)))
342
343 #define F32_VALUE_0 0x00000000
344 #define F32_VALUE_1 0x3f800000
345 #define F32_SIGN_BIT 0x80000000U
346 #define F32_EXPON_MANTISSA 0x7FFFFFFFU
347
348 //! code is taken from IceFPU
349 //! Integer representation of a floating-point value.
350#ifdef IRRLICHT_FAST_MATH
351 #define IR(x) ((u32&)(x))
352#else
353 inline u32 IR(f32 x) {inttofloat tmp; tmp.f=x; return tmp.u;}
354#endif
355
356 //! Absolute integer representation of a floating-point value
357 #define AIR(x) (IR(x)&0x7fffffff)
358
359 //! Floating-point representation of an integer value.
360#ifdef IRRLICHT_FAST_MATH
361 #define FR(x) ((f32&)(x))
362#else
363 inline f32 FR(u32 x) {inttofloat tmp; tmp.u=x; return tmp.f;}
364 inline f32 FR(s32 x) {inttofloat tmp; tmp.s=x; return tmp.f;}
365#endif
366
367 //! integer representation of 1.0
368 #define IEEE_1_0 0x3f800000
369 //! integer representation of 255.0
370 #define IEEE_255_0 0x437f0000
371
372#ifdef IRRLICHT_FAST_MATH
373 #define F32_LOWER_0(f) (F32_AS_U32(f) > F32_SIGN_BIT)
374 #define F32_LOWER_EQUAL_0(f) (F32_AS_S32(f) <= F32_VALUE_0)
375 #define F32_GREATER_0(f) (F32_AS_S32(f) > F32_VALUE_0)
376 #define F32_GREATER_EQUAL_0(f) (F32_AS_U32(f) <= F32_SIGN_BIT)
377 #define F32_EQUAL_1(f) (F32_AS_U32(f) == F32_VALUE_1)
378 #define F32_EQUAL_0(f) ( (F32_AS_U32(f) & F32_EXPON_MANTISSA ) == F32_VALUE_0)
379
380 // only same sign
381 #define F32_A_GREATER_B(a,b) (F32_AS_S32((a)) > F32_AS_S32((b)))
382
383#else
384
385 #define F32_LOWER_0(n) ((n) < 0.0f)
386 #define F32_LOWER_EQUAL_0(n) ((n) <= 0.0f)
387 #define F32_GREATER_0(n) ((n) > 0.0f)
388 #define F32_GREATER_EQUAL_0(n) ((n) >= 0.0f)
389 #define F32_EQUAL_1(n) ((n) == 1.0f)
390 #define F32_EQUAL_0(n) ((n) == 0.0f)
391 #define F32_A_GREATER_B(a,b) ((a) > (b))
392#endif
393
394
395#ifndef REALINLINE
396 #ifdef _MSC_VER
397 #define REALINLINE __forceinline
398 #else
399 #define REALINLINE inline
400 #endif
401#endif
402
403#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
404
405 // 8-bit bools in borland builder
406
407 //! conditional set based on mask and arithmetic shift
408 REALINLINE u32 if_c_a_else_b ( const c8 condition, const u32 a, const u32 b )
409 {
410 return ( ( -condition >> 7 ) & ( a ^ b ) ) ^ b;
411 }
412
413 //! conditional set based on mask and arithmetic shift
414 REALINLINE u32 if_c_a_else_0 ( const c8 condition, const u32 a )
415 {
416 return ( -condition >> 31 ) & a;
417 }
418#else
419
420 //! conditional set based on mask and arithmetic shift
421 REALINLINE u32 if_c_a_else_b ( const s32 condition, const u32 a, const u32 b )
422 {
423 return ( ( -condition >> 31 ) & ( a ^ b ) ) ^ b;
424 }
425
426 //! conditional set based on mask and arithmetic shift
427 REALINLINE u16 if_c_a_else_b ( const s16 condition, const u16 a, const u16 b )
428 {
429 return ( ( -condition >> 15 ) & ( a ^ b ) ) ^ b;
430 }
431
432 //! conditional set based on mask and arithmetic shift
433 REALINLINE u32 if_c_a_else_0 ( const s32 condition, const u32 a )
434 {
435 return ( -condition >> 31 ) & a;
436 }
437#endif
438
439 /*
440 if (condition) state |= m; else state &= ~m;
441 */
442 REALINLINE void setbit_cond ( u32 &state, s32 condition, u32 mask )
443 {
444 // 0, or any postive to mask
445 //s32 conmask = -condition >> 31;
446 state ^= ( ( -condition >> 31 ) ^ state ) & mask;
447 }
448
449 inline f32 round_( f32 x )
450 {
451 return floorf( x + 0.5f );
452 }
453
454 REALINLINE void clearFPUException ()
455 {
456#ifdef IRRLICHT_FAST_MATH
457 return;
458#ifdef feclearexcept
459 feclearexcept(FE_ALL_EXCEPT);
460#elif defined(_MSC_VER)
461 __asm fnclex;
462#elif defined(__GNUC__) && defined(__x86__)
463 __asm__ __volatile__ ("fclex \n\t");
464#else
465# warn clearFPUException not supported.
466#endif
467#endif
468 }
469
470 // calculate: sqrt ( x )
471 REALINLINE f32 squareroot(const f32 f)
472 {
473 return sqrtf(f);
474 }
475
476 // calculate: sqrt ( x )
477 REALINLINE f64 squareroot(const f64 f)
478 {
479 return sqrt(f);
480 }
481
482 // calculate: sqrt ( x )
483 REALINLINE s32 squareroot(const s32 f)
484 {
485 return static_cast<s32>(squareroot(static_cast<f32>(f)));
486 }
487
488#ifdef __IRR_HAS_S64
489 // calculate: sqrt ( x )
490 REALINLINE s64 squareroot(const s64 f)
491 {
492 return static_cast<s64>(squareroot(static_cast<f64>(f)));
493 }
494#endif
495
496 // calculate: 1 / sqrt ( x )
497 REALINLINE f64 reciprocal_squareroot(const f64 x)
498 {
499 return 1.0 / sqrt(x);
500 }
501
502 // calculate: 1 / sqrtf ( x )
503 REALINLINE f32 reciprocal_squareroot(const f32 f)
504 {
505#if defined ( IRRLICHT_FAST_MATH )
506 #if defined(_MSC_VER)
507 // SSE reciprocal square root estimate, accurate to 12 significant
508 // bits of the mantissa
509 f32 recsqrt;
510 __asm rsqrtss xmm0, f // xmm0 = rsqrtss(f)
511 __asm movss recsqrt, xmm0 // return xmm0
512 return recsqrt;
513
514/*
515 // comes from Nvidia
516 u32 tmp = (u32(IEEE_1_0 << 1) + IEEE_1_0 - *(u32*)&x) >> 1;
517 f32 y = *(f32*)&tmp;
518 return y * (1.47f - 0.47f * x * y * y);
519*/
520 #else
521 return 1.f / sqrtf(f);
522 #endif
523#else // no fast math
524 return 1.f / sqrtf(f);
525#endif
526 }
527
528 // calculate: 1 / sqrtf( x )
529 REALINLINE s32 reciprocal_squareroot(const s32 x)
530 {
531 return static_cast<s32>(reciprocal_squareroot(static_cast<f32>(x)));
532 }
533
534 // calculate: 1 / x
535 REALINLINE f32 reciprocal( const f32 f )
536 {
537#if defined (IRRLICHT_FAST_MATH)
538
539 // SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
540 // bi ts of the mantissa
541 // One Newtown-Raphson Iteration:
542 // f(i+1) = 2 * rcpss(f) - f * rcpss(f) * rcpss(f)
543 f32 rec;
544 __asm rcpss xmm0, f // xmm0 = rcpss(f)
545 __asm movss xmm1, f // xmm1 = f
546 __asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f)
547 __asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f)
548 __asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f)
549 __asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f)
550 // - f * rcpss(f) * rcpss(f)
551 __asm movss rec, xmm0 // return xmm0
552 return rec;
553
554
555 //! i do not divide through 0.. (fpu expection)
556 // instead set f to a high value to get a return value near zero..
557 // -1000000000000.f.. is use minus to stay negative..
558 // must test's here (plane.normal dot anything ) checks on <= 0.f
559 //u32 x = (-(AIR(f) != 0 ) >> 31 ) & ( IR(f) ^ 0xd368d4a5 ) ^ 0xd368d4a5;
560 //return 1.f / FR ( x );
561
562#else // no fast math
563 return 1.f / f;
564#endif
565 }
566
567 // calculate: 1 / x
568 REALINLINE f64 reciprocal ( const f64 f )
569 {
570 return 1.0 / f;
571 }
572
573
574 // calculate: 1 / x, low precision allowed
575 REALINLINE f32 reciprocal_approxim ( const f32 f )
576 {
577#if defined( IRRLICHT_FAST_MATH)
578
579 // SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
580 // bi ts of the mantissa
581 // One Newtown-Raphson Iteration:
582 // f(i+1) = 2 * rcpss(f) - f * rcpss(f) * rcpss(f)
583 f32 rec;
584 __asm rcpss xmm0, f // xmm0 = rcpss(f)
585 __asm movss xmm1, f // xmm1 = f
586 __asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f)
587 __asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f)
588 __asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f)
589 __asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f)
590 // - f * rcpss(f) * rcpss(f)
591 __asm movss rec, xmm0 // return xmm0
592 return rec;
593
594
595/*
596 // SSE reciprocal estimate, accurate to 12 significant bits of
597 f32 rec;
598 __asm rcpss xmm0, f // xmm0 = rcpss(f)
599 __asm movss rec , xmm0 // return xmm0
600 return rec;
601*/
602/*
603 register u32 x = 0x7F000000 - IR ( p );
604 const f32 r = FR ( x );
605 return r * (2.0f - p * r);
606*/
607#else // no fast math
608 return 1.f / f;
609#endif
610 }
611
612
613 REALINLINE s32 floor32(f32 x)
614 {
615#ifdef IRRLICHT_FAST_MATH
616 const f32 h = 0.5f;
617
618 s32 t;
619
620#if defined(_MSC_VER)
621 __asm
622 {
623 fld x
624 fsub h
625 fistp t
626 }
627#elif defined(__GNUC__)
628 __asm__ __volatile__ (
629 "fsub %2 \n\t"
630 "fistpl %0"
631 : "=m" (t)
632 : "t" (x), "f" (h)
633 : "st"
634 );
635#else
636# warn IRRLICHT_FAST_MATH not supported.
637 return (s32) floorf ( x );
638#endif
639 return t;
640#else // no fast math
641 return (s32) floorf ( x );
642#endif
643 }
644
645
646 REALINLINE s32 ceil32 ( f32 x )
647 {
648#ifdef IRRLICHT_FAST_MATH
649 const f32 h = 0.5f;
650
651 s32 t;
652
653#if defined(_MSC_VER)
654 __asm
655 {
656 fld x
657 fadd h
658 fistp t
659 }
660#elif defined(__GNUC__)
661 __asm__ __volatile__ (
662 "fadd %2 \n\t"
663 "fistpl %0 \n\t"
664 : "=m"(t)
665 : "t"(x), "f"(h)
666 : "st"
667 );
668#else
669# warn IRRLICHT_FAST_MATH not supported.
670 return (s32) ceilf ( x );
671#endif
672 return t;
673#else // not fast math
674 return (s32) ceilf ( x );
675#endif
676 }
677
678
679
680 REALINLINE s32 round32(f32 x)
681 {
682#if defined(IRRLICHT_FAST_MATH)
683 s32 t;
684
685#if defined(_MSC_VER)
686 __asm
687 {
688 fld x
689 fistp t
690 }
691#elif defined(__GNUC__)
692 __asm__ __volatile__ (
693 "fistpl %0 \n\t"
694 : "=m"(t)
695 : "t"(x)
696 : "st"
697 );
698#else
699# warn IRRLICHT_FAST_MATH not supported.
700 return (s32) round_(x);
701#endif
702 return t;
703#else // no fast math
704 return (s32) round_(x);
705#endif
706 }
707
708 inline f32 f32_max3(const f32 a, const f32 b, const f32 c)
709 {
710 return a > b ? (a > c ? a : c) : (b > c ? b : c);
711 }
712
713 inline f32 f32_min3(const f32 a, const f32 b, const f32 c)
714 {
715 return a < b ? (a < c ? a : c) : (b < c ? b : c);
716 }
717
718 inline f32 fract ( f32 x )
719 {
720 return x - floorf ( x );
721 }
722
723} // end namespace core
724} // end namespace irr
725
726#ifndef IRRLICHT_FAST_MATH
727 using irr::core::IR;
728 using irr::core::FR;
729#endif
730
731#endif
732
diff --git a/src/others/irrlicht-1.8.1/include/irrString.h b/src/others/irrlicht-1.8.1/include/irrString.h
new file mode 100644
index 0000000..43557cd
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrString.h
@@ -0,0 +1,1368 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine" and the "irrXML" project.
3// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
4
5#ifndef __IRR_STRING_H_INCLUDED__
6#define __IRR_STRING_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "irrAllocator.h"
10#include "irrMath.h"
11#include <stdio.h>
12#include <string.h>
13#include <stdlib.h>
14
15namespace irr
16{
17namespace core
18{
19
20//! Very simple string class with some useful features.
21/** string<c8> and string<wchar_t> both accept Unicode AND ASCII/Latin-1,
22so you can assign Unicode to string<c8> and ASCII/Latin-1 to string<wchar_t>
23(and the other way round) if you want to.
24
25However, note that the conversation between both is not done using any encoding.
26This means that c8 strings are treated as ASCII/Latin-1, not UTF-8, and
27are simply expanded to the equivalent wchar_t, while Unicode/wchar_t
28characters are truncated to 8-bit ASCII/Latin-1 characters, discarding all
29other information in the wchar_t.
30*/
31
32enum eLocaleID
33{
34 IRR_LOCALE_ANSI = 0,
35 IRR_LOCALE_GERMAN = 1
36};
37
38static eLocaleID locale_current = IRR_LOCALE_ANSI;
39static inline void locale_set ( eLocaleID id )
40{
41 locale_current = id;
42}
43
44//! Returns a character converted to lower case
45static inline u32 locale_lower ( u32 x )
46{
47 switch ( locale_current )
48 {
49 case IRR_LOCALE_GERMAN:
50 case IRR_LOCALE_ANSI:
51 break;
52 }
53 // ansi
54 return x >= 'A' && x <= 'Z' ? x + 0x20 : x;
55}
56
57//! Returns a character converted to upper case
58static inline u32 locale_upper ( u32 x )
59{
60 switch ( locale_current )
61 {
62 case IRR_LOCALE_GERMAN:
63 case IRR_LOCALE_ANSI:
64 break;
65 }
66
67 // ansi
68 return x >= 'a' && x <= 'z' ? x + ( 'A' - 'a' ) : x;
69}
70
71
72template <typename T, typename TAlloc = irrAllocator<T> >
73class string
74{
75public:
76
77 typedef T char_type;
78
79 //! Default constructor
80 string()
81 : array(0), allocated(1), used(1)
82 {
83 array = allocator.allocate(1); // new T[1];
84 array[0] = 0;
85 }
86
87
88 //! Constructor
89 string(const string<T,TAlloc>& other)
90 : array(0), allocated(0), used(0)
91 {
92 *this = other;
93 }
94
95 //! Constructor from other string types
96 template <class B, class A>
97 string(const string<B, A>& other)
98 : array(0), allocated(0), used(0)
99 {
100 *this = other;
101 }
102
103
104 //! Constructs a string from a float
105 explicit string(const double number)
106 : array(0), allocated(0), used(0)
107 {
108 c8 tmpbuf[255];
109 snprintf(tmpbuf, 255, "%0.6f", number);
110 *this = tmpbuf;
111 }
112
113
114 //! Constructs a string from an int
115 explicit string(int number)
116 : array(0), allocated(0), used(0)
117 {
118 // store if negative and make positive
119
120 bool negative = false;
121 if (number < 0)
122 {
123 number *= -1;
124 negative = true;
125 }
126
127 // temporary buffer for 16 numbers
128
129 c8 tmpbuf[16]={0};
130 u32 idx = 15;
131
132 // special case '0'
133
134 if (!number)
135 {
136 tmpbuf[14] = '0';
137 *this = &tmpbuf[14];
138 return;
139 }
140
141 // add numbers
142
143 while(number && idx)
144 {
145 --idx;
146 tmpbuf[idx] = (c8)('0' + (number % 10));
147 number /= 10;
148 }
149
150 // add sign
151
152 if (negative)
153 {
154 --idx;
155 tmpbuf[idx] = '-';
156 }
157
158 *this = &tmpbuf[idx];
159 }
160
161
162 //! Constructs a string from an unsigned int
163 explicit string(unsigned int number)
164 : array(0), allocated(0), used(0)
165 {
166 // temporary buffer for 16 numbers
167
168 c8 tmpbuf[16]={0};
169 u32 idx = 15;
170
171 // special case '0'
172
173 if (!number)
174 {
175 tmpbuf[14] = '0';
176 *this = &tmpbuf[14];
177 return;
178 }
179
180 // add numbers
181
182 while(number && idx)
183 {
184 --idx;
185 tmpbuf[idx] = (c8)('0' + (number % 10));
186 number /= 10;
187 }
188
189 *this = &tmpbuf[idx];
190 }
191
192
193 //! Constructs a string from a long
194 explicit string(long number)
195 : array(0), allocated(0), used(0)
196 {
197 // store if negative and make positive
198
199 bool negative = false;
200 if (number < 0)
201 {
202 number *= -1;
203 negative = true;
204 }
205
206 // temporary buffer for 16 numbers
207
208 c8 tmpbuf[16]={0};
209 u32 idx = 15;
210
211 // special case '0'
212
213 if (!number)
214 {
215 tmpbuf[14] = '0';
216 *this = &tmpbuf[14];
217 return;
218 }
219
220 // add numbers
221
222 while(number && idx)
223 {
224 --idx;
225 tmpbuf[idx] = (c8)('0' + (number % 10));
226 number /= 10;
227 }
228
229 // add sign
230
231 if (negative)
232 {
233 --idx;
234 tmpbuf[idx] = '-';
235 }
236
237 *this = &tmpbuf[idx];
238 }
239
240
241 //! Constructs a string from an unsigned long
242 explicit string(unsigned long number)
243 : array(0), allocated(0), used(0)
244 {
245 // temporary buffer for 16 numbers
246
247 c8 tmpbuf[16]={0};
248 u32 idx = 15;
249
250 // special case '0'
251
252 if (!number)
253 {
254 tmpbuf[14] = '0';
255 *this = &tmpbuf[14];
256 return;
257 }
258
259 // add numbers
260
261 while(number && idx)
262 {
263 --idx;
264 tmpbuf[idx] = (c8)('0' + (number % 10));
265 number /= 10;
266 }
267
268 *this = &tmpbuf[idx];
269 }
270
271
272 //! Constructor for copying a string from a pointer with a given length
273 template <class B>
274 string(const B* const c, u32 length)
275 : array(0), allocated(0), used(0)
276 {
277 if (!c)
278 {
279 // correctly init the string to an empty one
280 *this="";
281 return;
282 }
283
284 allocated = used = length+1;
285 array = allocator.allocate(used); // new T[used];
286
287 for (u32 l = 0; l<length; ++l)
288 array[l] = (T)c[l];
289
290 array[length] = 0;
291 }
292
293
294 //! Constructor for unicode and ascii strings
295 template <class B>
296 string(const B* const c)
297 : array(0), allocated(0), used(0)
298 {
299 *this = c;
300 }
301
302
303 //! Destructor
304 ~string()
305 {
306 allocator.deallocate(array); // delete [] array;
307 }
308
309
310 //! Assignment operator
311 string<T,TAlloc>& operator=(const string<T,TAlloc>& other)
312 {
313 if (this == &other)
314 return *this;
315
316 used = other.size()+1;
317 if (used>allocated)
318 {
319 allocator.deallocate(array); // delete [] array;
320 allocated = used;
321 array = allocator.allocate(used); //new T[used];
322 }
323
324 const T* p = other.c_str();
325 for (u32 i=0; i<used; ++i, ++p)
326 array[i] = *p;
327
328 return *this;
329 }
330
331 //! Assignment operator for other string types
332 template <class B, class A>
333 string<T,TAlloc>& operator=(const string<B,A>& other)
334 {
335 *this = other.c_str();
336 return *this;
337 }
338
339
340 //! Assignment operator for strings, ascii and unicode
341 template <class B>
342 string<T,TAlloc>& operator=(const B* const c)
343 {
344 if (!c)
345 {
346 if (!array)
347 {
348 array = allocator.allocate(1); //new T[1];
349 allocated = 1;
350 }
351 used = 1;
352 array[0] = 0x0;
353 return *this;
354 }
355
356 if ((void*)c == (void*)array)
357 return *this;
358
359 u32 len = 0;
360 const B* p = c;
361 do
362 {
363 ++len;
364 } while(*p++);
365
366 // we'll keep the old string for a while, because the new
367 // string could be a part of the current string.
368 T* oldArray = array;
369
370 used = len;
371 if (used>allocated)
372 {
373 allocated = used;
374 array = allocator.allocate(used); //new T[used];
375 }
376
377 for (u32 l = 0; l<len; ++l)
378 array[l] = (T)c[l];
379
380 if (oldArray != array)
381 allocator.deallocate(oldArray); // delete [] oldArray;
382
383 return *this;
384 }
385
386
387 //! Append operator for other strings
388 string<T,TAlloc> operator+(const string<T,TAlloc>& other) const
389 {
390 string<T,TAlloc> str(*this);
391 str.append(other);
392
393 return str;
394 }
395
396
397 //! Append operator for strings, ascii and unicode
398 template <class B>
399 string<T,TAlloc> operator+(const B* const c) const
400 {
401 string<T,TAlloc> str(*this);
402 str.append(c);
403
404 return str;
405 }
406
407
408 //! Direct access operator
409 T& operator [](const u32 index)
410 {
411 _IRR_DEBUG_BREAK_IF(index>=used) // bad index
412 return array[index];
413 }
414
415
416 //! Direct access operator
417 const T& operator [](const u32 index) const
418 {
419 _IRR_DEBUG_BREAK_IF(index>=used) // bad index
420 return array[index];
421 }
422
423
424 //! Equality operator
425 bool operator==(const T* const str) const
426 {
427 if (!str)
428 return false;
429
430 u32 i;
431 for (i=0; array[i] && str[i]; ++i)
432 if (array[i] != str[i])
433 return false;
434
435 return (!array[i] && !str[i]);
436 }
437
438
439 //! Equality operator
440 bool operator==(const string<T,TAlloc>& other) const
441 {
442 for (u32 i=0; array[i] && other.array[i]; ++i)
443 if (array[i] != other.array[i])
444 return false;
445
446 return used == other.used;
447 }
448
449
450 //! Is smaller comparator
451 bool operator<(const string<T,TAlloc>& other) const
452 {
453 for (u32 i=0; array[i] && other.array[i]; ++i)
454 {
455 const s32 diff = array[i] - other.array[i];
456 if (diff)
457 return (diff < 0);
458 }
459
460 return (used < other.used);
461 }
462
463
464 //! Inequality operator
465 bool operator!=(const T* const str) const
466 {
467 return !(*this == str);
468 }
469
470
471 //! Inequality operator
472 bool operator!=(const string<T,TAlloc>& other) const
473 {
474 return !(*this == other);
475 }
476
477
478 //! Returns length of the string's content
479 /** \return Length of the string's content in characters, excluding
480 the trailing NUL. */
481 u32 size() const
482 {
483 return used-1;
484 }
485
486 //! Informs if the string is empty or not.
487 //! \return True if the string is empty, false if not.
488 bool empty() const
489 {
490 return (size() == 0);
491 }
492
493 //! Returns character string
494 /** \return pointer to C-style NUL terminated string. */
495 const T* c_str() const
496 {
497 return array;
498 }
499
500
501 //! Makes the string lower case.
502 string<T,TAlloc>& make_lower()
503 {
504 for (u32 i=0; array[i]; ++i)
505 array[i] = locale_lower ( array[i] );
506 return *this;
507 }
508
509
510 //! Makes the string upper case.
511 string<T,TAlloc>& make_upper()
512 {
513 for (u32 i=0; array[i]; ++i)
514 array[i] = locale_upper ( array[i] );
515 return *this;
516 }
517
518
519 //! Compares the strings ignoring case.
520 /** \param other: Other string to compare.
521 \return True if the strings are equal ignoring case. */
522 bool equals_ignore_case(const string<T,TAlloc>& other) const
523 {
524 for(u32 i=0; array[i] && other[i]; ++i)
525 if (locale_lower( array[i]) != locale_lower(other[i]))
526 return false;
527
528 return used == other.used;
529 }
530
531 //! Compares the strings ignoring case.
532 /** \param other: Other string to compare.
533 \param sourcePos: where to start to compare in the string
534 \return True if the strings are equal ignoring case. */
535 bool equals_substring_ignore_case(const string<T,TAlloc>&other, const s32 sourcePos = 0 ) const
536 {
537 if ( (u32) sourcePos >= used )
538 return false;
539
540 u32 i;
541 for( i=0; array[sourcePos + i] && other[i]; ++i)
542 if (locale_lower( array[sourcePos + i]) != locale_lower(other[i]))
543 return false;
544
545 return array[sourcePos + i] == 0 && other[i] == 0;
546 }
547
548
549 //! Compares the strings ignoring case.
550 /** \param other: Other string to compare.
551 \return True if this string is smaller ignoring case. */
552 bool lower_ignore_case(const string<T,TAlloc>& other) const
553 {
554 for(u32 i=0; array[i] && other.array[i]; ++i)
555 {
556 s32 diff = (s32) locale_lower ( array[i] ) - (s32) locale_lower ( other.array[i] );
557 if ( diff )
558 return diff < 0;
559 }
560
561 return used < other.used;
562 }
563
564
565 //! compares the first n characters of the strings
566 /** \param other Other string to compare.
567 \param n Number of characters to compare
568 \return True if the n first characters of both strings are equal. */
569 bool equalsn(const string<T,TAlloc>& other, u32 n) const
570 {
571 u32 i;
572 for(i=0; array[i] && other[i] && i < n; ++i)
573 if (array[i] != other[i])
574 return false;
575
576 // if one (or both) of the strings was smaller then they
577 // are only equal if they have the same length
578 return (i == n) || (used == other.used);
579 }
580
581
582 //! compares the first n characters of the strings
583 /** \param str Other string to compare.
584 \param n Number of characters to compare
585 \return True if the n first characters of both strings are equal. */
586 bool equalsn(const T* const str, u32 n) const
587 {
588 if (!str)
589 return false;
590 u32 i;
591 for(i=0; array[i] && str[i] && i < n; ++i)
592 if (array[i] != str[i])
593 return false;
594
595 // if one (or both) of the strings was smaller then they
596 // are only equal if they have the same length
597 return (i == n) || (array[i] == 0 && str[i] == 0);
598 }
599
600
601 //! Appends a character to this string
602 /** \param character: Character to append. */
603 string<T,TAlloc>& append(T character)
604 {
605 if (used + 1 > allocated)
606 reallocate(used + 1);
607
608 ++used;
609
610 array[used-2] = character;
611 array[used-1] = 0;
612
613 return *this;
614 }
615
616
617 //! Appends a char string to this string
618 /** \param other: Char string to append. */
619 /** \param length: The length of the string to append. */
620 string<T,TAlloc>& append(const T* const other, u32 length=0xffffffff)
621 {
622 if (!other)
623 return *this;
624
625 u32 len = 0;
626 const T* p = other;
627 while(*p)
628 {
629 ++len;
630 ++p;
631 }
632 if (len > length)
633 len = length;
634
635 if (used + len > allocated)
636 reallocate(used + len);
637
638 --used;
639 ++len;
640
641 for (u32 l=0; l<len; ++l)
642 array[l+used] = *(other+l);
643
644 used += len;
645
646 return *this;
647 }
648
649
650 //! Appends a string to this string
651 /** \param other: String to append. */
652 string<T,TAlloc>& append(const string<T,TAlloc>& other)
653 {
654 if (other.size() == 0)
655 return *this;
656
657 --used;
658 u32 len = other.size()+1;
659
660 if (used + len > allocated)
661 reallocate(used + len);
662
663 for (u32 l=0; l<len; ++l)
664 array[used+l] = other[l];
665
666 used += len;
667
668 return *this;
669 }
670
671
672 //! Appends a string of the length l to this string.
673 /** \param other: other String to append to this string.
674 \param length: How much characters of the other string to add to this one. */
675 string<T,TAlloc>& append(const string<T,TAlloc>& other, u32 length)
676 {
677 if (other.size() == 0)
678 return *this;
679
680 if (other.size() < length)
681 {
682 append(other);
683 return *this;
684 }
685
686 if (used + length > allocated)
687 reallocate(used + length);
688
689 --used;
690
691 for (u32 l=0; l<length; ++l)
692 array[l+used] = other[l];
693 used += length;
694
695 // ensure proper termination
696 array[used]=0;
697 ++used;
698
699 return *this;
700 }
701
702
703 //! Reserves some memory.
704 /** \param count: Amount of characters to reserve. */
705 void reserve(u32 count)
706 {
707 if (count < allocated)
708 return;
709
710 reallocate(count);
711 }
712
713
714 //! finds first occurrence of character in string
715 /** \param c: Character to search for.
716 \return Position where the character has been found,
717 or -1 if not found. */
718 s32 findFirst(T c) const
719 {
720 for (u32 i=0; i<used-1; ++i)
721 if (array[i] == c)
722 return i;
723
724 return -1;
725 }
726
727 //! finds first occurrence of a character of a list in string
728 /** \param c: List of characters to find. For example if the method
729 should find the first occurrence of 'a' or 'b', this parameter should be "ab".
730 \param count: Amount of characters in the list. Usually,
731 this should be strlen(c)
732 \return Position where one of the characters has been found,
733 or -1 if not found. */
734 s32 findFirstChar(const T* const c, u32 count=1) const
735 {
736 if (!c || !count)
737 return -1;
738
739 for (u32 i=0; i<used-1; ++i)
740 for (u32 j=0; j<count; ++j)
741 if (array[i] == c[j])
742 return i;
743
744 return -1;
745 }
746
747
748 //! Finds first position of a character not in a given list.
749 /** \param c: List of characters not to find. For example if the method
750 should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab".
751 \param count: Amount of characters in the list. Usually,
752 this should be strlen(c)
753 \return Position where the character has been found,
754 or -1 if not found. */
755 template <class B>
756 s32 findFirstCharNotInList(const B* const c, u32 count=1) const
757 {
758 if (!c || !count)
759 return -1;
760
761 for (u32 i=0; i<used-1; ++i)
762 {
763 u32 j;
764 for (j=0; j<count; ++j)
765 if (array[i] == c[j])
766 break;
767
768 if (j==count)
769 return i;
770 }
771
772 return -1;
773 }
774
775 //! Finds last position of a character not in a given list.
776 /** \param c: List of characters not to find. For example if the method
777 should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab".
778 \param count: Amount of characters in the list. Usually,
779 this should be strlen(c)
780 \return Position where the character has been found,
781 or -1 if not found. */
782 template <class B>
783 s32 findLastCharNotInList(const B* const c, u32 count=1) const
784 {
785 if (!c || !count)
786 return -1;
787
788 for (s32 i=(s32)(used-2); i>=0; --i)
789 {
790 u32 j;
791 for (j=0; j<count; ++j)
792 if (array[i] == c[j])
793 break;
794
795 if (j==count)
796 return i;
797 }
798
799 return -1;
800 }
801
802 //! finds next occurrence of character in string
803 /** \param c: Character to search for.
804 \param startPos: Position in string to start searching.
805 \return Position where the character has been found,
806 or -1 if not found. */
807 s32 findNext(T c, u32 startPos) const
808 {
809 for (u32 i=startPos; i<used-1; ++i)
810 if (array[i] == c)
811 return i;
812
813 return -1;
814 }
815
816
817 //! finds last occurrence of character in string
818 /** \param c: Character to search for.
819 \param start: start to search reverse ( default = -1, on end )
820 \return Position where the character has been found,
821 or -1 if not found. */
822 s32 findLast(T c, s32 start = -1) const
823 {
824 start = core::clamp ( start < 0 ? (s32)(used) - 2 : start, 0, (s32)(used) - 2 );
825 for (s32 i=start; i>=0; --i)
826 if (array[i] == c)
827 return i;
828
829 return -1;
830 }
831
832 //! finds last occurrence of a character of a list in string
833 /** \param c: List of strings to find. For example if the method
834 should find the last occurrence of 'a' or 'b', this parameter should be "ab".
835 \param count: Amount of characters in the list. Usually,
836 this should be strlen(c)
837 \return Position where one of the characters has been found,
838 or -1 if not found. */
839 s32 findLastChar(const T* const c, u32 count=1) const
840 {
841 if (!c || !count)
842 return -1;
843
844 for (s32 i=(s32)used-2; i>=0; --i)
845 for (u32 j=0; j<count; ++j)
846 if (array[i] == c[j])
847 return i;
848
849 return -1;
850 }
851
852
853 //! finds another string in this string
854 /** \param str: Another string
855 \param start: Start position of the search
856 \return Positions where the string has been found,
857 or -1 if not found. */
858 template <class B>
859 s32 find(const B* const str, const u32 start = 0) const
860 {
861 if (str && *str)
862 {
863 u32 len = 0;
864
865 while (str[len])
866 ++len;
867
868 if (len > used-1)
869 return -1;
870
871 for (u32 i=start; i<used-len; ++i)
872 {
873 u32 j=0;
874
875 while(str[j] && array[i+j] == str[j])
876 ++j;
877
878 if (!str[j])
879 return i;
880 }
881 }
882
883 return -1;
884 }
885
886
887 //! Returns a substring
888 /** \param begin Start of substring.
889 \param length Length of substring.
890 \param make_lower copy only lower case */
891 string<T> subString(u32 begin, s32 length, bool make_lower = false ) const
892 {
893 // if start after string
894 // or no proper substring length
895 if ((length <= 0) || (begin>=size()))
896 return string<T>("");
897 // clamp length to maximal value
898 if ((length+begin) > size())
899 length = size()-begin;
900
901 string<T> o;
902 o.reserve(length+1);
903
904 s32 i;
905 if ( !make_lower )
906 {
907 for (i=0; i<length; ++i)
908 o.array[i] = array[i+begin];
909 }
910 else
911 {
912 for (i=0; i<length; ++i)
913 o.array[i] = locale_lower ( array[i+begin] );
914 }
915
916 o.array[length] = 0;
917 o.used = length + 1;
918
919 return o;
920 }
921
922
923 //! Appends a character to this string
924 /** \param c Character to append. */
925 string<T,TAlloc>& operator += (T c)
926 {
927 append(c);
928 return *this;
929 }
930
931
932 //! Appends a char string to this string
933 /** \param c Char string to append. */
934 string<T,TAlloc>& operator += (const T* const c)
935 {
936 append(c);
937 return *this;
938 }
939
940
941 //! Appends a string to this string
942 /** \param other String to append. */
943 string<T,TAlloc>& operator += (const string<T,TAlloc>& other)
944 {
945 append(other);
946 return *this;
947 }
948
949
950 //! Appends a string representation of a number to this string
951 /** \param i Number to append. */
952 string<T,TAlloc>& operator += (const int i)
953 {
954 append(string<T,TAlloc>(i));
955 return *this;
956 }
957
958
959 //! Appends a string representation of a number to this string
960 /** \param i Number to append. */
961 string<T,TAlloc>& operator += (const unsigned int i)
962 {
963 append(string<T,TAlloc>(i));
964 return *this;
965 }
966
967
968 //! Appends a string representation of a number to this string
969 /** \param i Number to append. */
970 string<T,TAlloc>& operator += (const long i)
971 {
972 append(string<T,TAlloc>(i));
973 return *this;
974 }
975
976
977 //! Appends a string representation of a number to this string
978 /** \param i Number to append. */
979 string<T,TAlloc>& operator += (const unsigned long i)
980 {
981 append(string<T,TAlloc>(i));
982 return *this;
983 }
984
985
986 //! Appends a string representation of a number to this string
987 /** \param i Number to append. */
988 string<T,TAlloc>& operator += (const double i)
989 {
990 append(string<T,TAlloc>(i));
991 return *this;
992 }
993
994
995 //! Appends a string representation of a number to this string
996 /** \param i Number to append. */
997 string<T,TAlloc>& operator += (const float i)
998 {
999 append(string<T,TAlloc>(i));
1000 return *this;
1001 }
1002
1003
1004 //! Replaces all characters of a special type with another one
1005 /** \param toReplace Character to replace.
1006 \param replaceWith Character replacing the old one. */
1007 string<T,TAlloc>& replace(T toReplace, T replaceWith)
1008 {
1009 for (u32 i=0; i<used-1; ++i)
1010 if (array[i] == toReplace)
1011 array[i] = replaceWith;
1012 return *this;
1013 }
1014
1015
1016 //! Replaces all instances of a string with another one.
1017 /** \param toReplace The string to replace.
1018 \param replaceWith The string replacing the old one. */
1019 string<T,TAlloc>& replace(const string<T,TAlloc>& toReplace, const string<T,TAlloc>& replaceWith)
1020 {
1021 if (toReplace.size() == 0)
1022 return *this;
1023
1024 const T* other = toReplace.c_str();
1025 const T* replace = replaceWith.c_str();
1026 const u32 other_size = toReplace.size();
1027 const u32 replace_size = replaceWith.size();
1028
1029 // Determine the delta. The algorithm will change depending on the delta.
1030 s32 delta = replace_size - other_size;
1031
1032 // A character for character replace. The string will not shrink or grow.
1033 if (delta == 0)
1034 {
1035 s32 pos = 0;
1036 while ((pos = find(other, pos)) != -1)
1037 {
1038 for (u32 i = 0; i < replace_size; ++i)
1039 array[pos + i] = replace[i];
1040 ++pos;
1041 }
1042 return *this;
1043 }
1044
1045 // We are going to be removing some characters. The string will shrink.
1046 if (delta < 0)
1047 {
1048 u32 i = 0;
1049 for (u32 pos = 0; pos < used; ++i, ++pos)
1050 {
1051 // Is this potentially a match?
1052 if (array[pos] == *other)
1053 {
1054 // Check to see if we have a match.
1055 u32 j;
1056 for (j = 0; j < other_size; ++j)
1057 {
1058 if (array[pos + j] != other[j])
1059 break;
1060 }
1061
1062 // If we have a match, replace characters.
1063 if (j == other_size)
1064 {
1065 for (j = 0; j < replace_size; ++j)
1066 array[i + j] = replace[j];
1067 i += replace_size - 1;
1068 pos += other_size - 1;
1069 continue;
1070 }
1071 }
1072
1073 // No match found, just copy characters.
1074 array[i] = array[pos];
1075 }
1076 array[i-1] = 0;
1077 used = i;
1078
1079 return *this;
1080 }
1081
1082 // We are going to be adding characters, so the string size will increase.
1083 // Count the number of times toReplace exists in the string so we can allocate the new size.
1084 u32 find_count = 0;
1085 s32 pos = 0;
1086 while ((pos = find(other, pos)) != -1)
1087 {
1088 ++find_count;
1089 ++pos;
1090 }
1091
1092 // Re-allocate the string now, if needed.
1093 u32 len = delta * find_count;
1094 if (used + len > allocated)
1095 reallocate(used + len);
1096
1097 // Start replacing.
1098 pos = 0;
1099 while ((pos = find(other, pos)) != -1)
1100 {
1101 T* start = array + pos + other_size - 1;
1102 T* ptr = array + used - 1;
1103 T* end = array + delta + used -1;
1104
1105 // Shift characters to make room for the string.
1106 while (ptr != start)
1107 {
1108 *end = *ptr;
1109 --ptr;
1110 --end;
1111 }
1112
1113 // Add the new string now.
1114 for (u32 i = 0; i < replace_size; ++i)
1115 array[pos + i] = replace[i];
1116
1117 pos += replace_size;
1118 used += delta;
1119 }
1120
1121 return *this;
1122 }
1123
1124
1125 //! Removes characters from a string.
1126 /** \param c: Character to remove. */
1127 string<T,TAlloc>& remove(T c)
1128 {
1129 u32 pos = 0;
1130 u32 found = 0;
1131 for (u32 i=0; i<used-1; ++i)
1132 {
1133 if (array[i] == c)
1134 {
1135 ++found;
1136 continue;
1137 }
1138
1139 array[pos++] = array[i];
1140 }
1141 used -= found;
1142 array[used-1] = 0;
1143 return *this;
1144 }
1145
1146
1147 //! Removes a string from the string.
1148 /** \param toRemove: String to remove. */
1149 string<T,TAlloc>& remove(const string<T,TAlloc>& toRemove)
1150 {
1151 u32 size = toRemove.size();
1152 if ( size == 0 )
1153 return *this;
1154 u32 pos = 0;
1155 u32 found = 0;
1156 for (u32 i=0; i<used-1; ++i)
1157 {
1158 u32 j = 0;
1159 while (j < size)
1160 {
1161 if (array[i + j] != toRemove[j])
1162 break;
1163 ++j;
1164 }
1165 if (j == size)
1166 {
1167 found += size;
1168 i += size - 1;
1169 continue;
1170 }
1171
1172 array[pos++] = array[i];
1173 }
1174 used -= found;
1175 array[used-1] = 0;
1176 return *this;
1177 }
1178
1179
1180 //! Removes characters from a string.
1181 /** \param characters: Characters to remove. */
1182 string<T,TAlloc>& removeChars(const string<T,TAlloc> & characters)
1183 {
1184 if (characters.size() == 0)
1185 return *this;
1186
1187 u32 pos = 0;
1188 u32 found = 0;
1189 for (u32 i=0; i<used-1; ++i)
1190 {
1191 // Don't use characters.findFirst as it finds the \0,
1192 // causing used to become incorrect.
1193 bool docontinue = false;
1194 for (u32 j=0; j<characters.size(); ++j)
1195 {
1196 if (characters[j] == array[i])
1197 {
1198 ++found;
1199 docontinue = true;
1200 break;
1201 }
1202 }
1203 if (docontinue)
1204 continue;
1205
1206 array[pos++] = array[i];
1207 }
1208 used -= found;
1209 array[used-1] = 0;
1210
1211 return *this;
1212 }
1213
1214
1215 //! Trims the string.
1216 /** Removes the specified characters (by default, Latin-1 whitespace)
1217 from the begining and the end of the string. */
1218 string<T,TAlloc>& trim(const string<T,TAlloc> & whitespace = " \t\n\r")
1219 {
1220 // find start and end of the substring without the specified characters
1221 const s32 begin = findFirstCharNotInList(whitespace.c_str(), whitespace.used);
1222 if (begin == -1)
1223 return (*this="");
1224
1225 const s32 end = findLastCharNotInList(whitespace.c_str(), whitespace.used);
1226
1227 return (*this = subString(begin, (end +1) - begin));
1228 }
1229
1230
1231 //! Erases a character from the string.
1232 /** May be slow, because all elements
1233 following after the erased element have to be copied.
1234 \param index: Index of element to be erased. */
1235 string<T,TAlloc>& erase(u32 index)
1236 {
1237 _IRR_DEBUG_BREAK_IF(index>=used) // access violation
1238
1239 for (u32 i=index+1; i<used; ++i)
1240 array[i-1] = array[i];
1241
1242 --used;
1243 return *this;
1244 }
1245
1246 //! verify the existing string.
1247 string<T,TAlloc>& validate()
1248 {
1249 // terminate on existing null
1250 for (u32 i=0; i<allocated; ++i)
1251 {
1252 if (array[i] == 0)
1253 {
1254 used = i + 1;
1255 return *this;
1256 }
1257 }
1258
1259 // terminate
1260 if ( allocated > 0 )
1261 {
1262 used = allocated;
1263 array[used-1] = 0;
1264 }
1265 else
1266 {
1267 used = 0;
1268 }
1269
1270 return *this;
1271 }
1272
1273 //! gets the last char of a string or null
1274 T lastChar() const
1275 {
1276 return used > 1 ? array[used-2] : 0;
1277 }
1278
1279 //! split string into parts.
1280 /** This method will split a string at certain delimiter characters
1281 into the container passed in as reference. The type of the container
1282 has to be given as template parameter. It must provide a push_back and
1283 a size method.
1284 \param ret The result container
1285 \param c C-style string of delimiter characters
1286 \param count Number of delimiter characters
1287 \param ignoreEmptyTokens Flag to avoid empty substrings in the result
1288 container. If two delimiters occur without a character in between, an
1289 empty substring would be placed in the result. If this flag is set,
1290 only non-empty strings are stored.
1291 \param keepSeparators Flag which allows to add the separator to the
1292 result string. If this flag is true, the concatenation of the
1293 substrings results in the original string. Otherwise, only the
1294 characters between the delimiters are returned.
1295 \return The number of resulting substrings
1296 */
1297 template<class container>
1298 u32 split(container& ret, const T* const c, u32 count=1, bool ignoreEmptyTokens=true, bool keepSeparators=false) const
1299 {
1300 if (!c)
1301 return 0;
1302
1303 const u32 oldSize=ret.size();
1304 u32 lastpos = 0;
1305 bool lastWasSeparator = false;
1306 for (u32 i=0; i<used; ++i)
1307 {
1308 bool foundSeparator = false;
1309 for (u32 j=0; j<count; ++j)
1310 {
1311 if (array[i] == c[j])
1312 {
1313 if ((!ignoreEmptyTokens || i - lastpos != 0) &&
1314 !lastWasSeparator)
1315 ret.push_back(string<T,TAlloc>(&array[lastpos], i - lastpos));
1316 foundSeparator = true;
1317 lastpos = (keepSeparators ? i : i + 1);
1318 break;
1319 }
1320 }
1321 lastWasSeparator = foundSeparator;
1322 }
1323 if ((used - 1) > lastpos)
1324 ret.push_back(string<T,TAlloc>(&array[lastpos], (used - 1) - lastpos));
1325 return ret.size()-oldSize;
1326 }
1327
1328private:
1329
1330 //! Reallocate the array, make it bigger or smaller
1331 void reallocate(u32 new_size)
1332 {
1333 T* old_array = array;
1334
1335 array = allocator.allocate(new_size); //new T[new_size];
1336 allocated = new_size;
1337
1338 u32 amount = used < new_size ? used : new_size;
1339 for (u32 i=0; i<amount; ++i)
1340 array[i] = old_array[i];
1341
1342 if (allocated < used)
1343 used = allocated;
1344
1345 allocator.deallocate(old_array); // delete [] old_array;
1346 }
1347
1348 //--- member variables
1349
1350 T* array;
1351 u32 allocated;
1352 u32 used;
1353 TAlloc allocator;
1354};
1355
1356
1357//! Typedef for character strings
1358typedef string<c8> stringc;
1359
1360//! Typedef for wide character strings
1361typedef string<wchar_t> stringw;
1362
1363
1364} // end namespace core
1365} // end namespace irr
1366
1367#endif
1368
diff --git a/src/others/irrlicht-1.8.1/include/irrTypes.h b/src/others/irrlicht-1.8.1/include/irrTypes.h
new file mode 100644
index 0000000..403f890
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrTypes.h
@@ -0,0 +1,250 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_TYPES_H_INCLUDED__
6#define __IRR_TYPES_H_INCLUDED__
7
8#include "IrrCompileConfig.h"
9
10namespace irr
11{
12
13//! 8 bit unsigned variable.
14/** This is a typedef for unsigned char, it ensures portability of the engine. */
15#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
16typedef unsigned __int8 u8;
17#else
18typedef unsigned char u8;
19#endif
20
21//! 8 bit signed variable.
22/** This is a typedef for signed char, it ensures portability of the engine. */
23#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
24typedef __int8 s8;
25#else
26typedef signed char s8;
27#endif
28
29//! 8 bit character variable.
30/** This is a typedef for char, it ensures portability of the engine. */
31typedef char c8;
32
33
34
35//! 16 bit unsigned variable.
36/** This is a typedef for unsigned short, it ensures portability of the engine. */
37#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
38typedef unsigned __int16 u16;
39#else
40typedef unsigned short u16;
41#endif
42
43//! 16 bit signed variable.
44/** This is a typedef for signed short, it ensures portability of the engine. */
45#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
46typedef __int16 s16;
47#else
48typedef signed short s16;
49#endif
50
51
52
53//! 32 bit unsigned variable.
54/** This is a typedef for unsigned int, it ensures portability of the engine. */
55#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
56typedef unsigned __int32 u32;
57#else
58typedef unsigned int u32;
59#endif
60
61//! 32 bit signed variable.
62/** This is a typedef for signed int, it ensures portability of the engine. */
63#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
64typedef __int32 s32;
65#else
66typedef signed int s32;
67#endif
68
69
70#ifdef __IRR_HAS_S64
71//! 64 bit unsigned variable.
72/** This is a typedef for 64bit uint, it ensures portability of the engine. */
73#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
74typedef unsigned __int64 u64;
75#elif __GNUC__
76#if __WORDSIZE == 64
77typedef unsigned long int u64;
78#else
79__extension__ typedef unsigned long long u64;
80#endif
81#else
82typedef unsigned long long u64;
83#endif
84
85//! 64 bit signed variable.
86/** This is a typedef for 64bit int, it ensures portability of the engine. */
87#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
88typedef __int64 s64;
89#elif __GNUC__
90#if __WORDSIZE == 64
91typedef long int s64;
92#else
93__extension__ typedef long long s64;
94#endif
95#else
96typedef long long s64;
97#endif
98#endif // __IRR_HAS_S64
99
100
101
102//! 32 bit floating point variable.
103/** This is a typedef for float, it ensures portability of the engine. */
104typedef float f32;
105
106//! 64 bit floating point variable.
107/** This is a typedef for double, it ensures portability of the engine. */
108typedef double f64;
109
110
111} // end namespace irr
112
113
114#include <wchar.h>
115#ifdef _IRR_WINDOWS_API_
116//! Defines for s{w,n}printf because these methods do not match the ISO C
117//! standard on Windows platforms, but it does on all others.
118//! These should be int snprintf(char *str, size_t size, const char *format, ...);
119//! and int swprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...);
120#if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
121#define swprintf swprintf_s
122#define snprintf sprintf_s
123#elif !defined(__CYGWIN__)
124#define swprintf _snwprintf
125#define snprintf _snprintf
126#endif
127
128// define the wchar_t type if not already built in.
129#ifdef _MSC_VER
130#ifndef _WCHAR_T_DEFINED
131//! A 16 bit wide character type.
132/**
133 Defines the wchar_t-type.
134 In VS6, its not possible to tell
135 the standard compiler to treat wchar_t as a built-in type, and
136 sometimes we just don't want to include the huge stdlib.h or wchar.h,
137 so we'll use this.
138*/
139typedef unsigned short wchar_t;
140#define _WCHAR_T_DEFINED
141#endif // wchar is not defined
142#endif // microsoft compiler
143#endif // _IRR_WINDOWS_API_
144
145namespace irr
146{
147
148//! Type name for character type used by the file system.
149/** Should the wide character version of the FileSystem be used it is a
15016 bit character variable. Used for unicode Filesystem and unicode strings.
151Else it is a 8 bit character variable. Used for ansi Filesystem and non-unicode
152strings
153*/
154#if defined(_IRR_WCHAR_FILESYSTEM)
155 typedef wchar_t fschar_t;
156 #define _IRR_TEXT(X) L##X
157#else
158 typedef char fschar_t;
159 #define _IRR_TEXT(X) X
160#endif
161
162} // end namespace irr
163
164//! define a break macro for debugging.
165#if defined(_DEBUG)
166#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
167 #if defined(WIN64) || defined(_WIN64) // using portable common solution for x64 configuration
168 #include <crtdbg.h>
169 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}
170 #else
171 #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
172 #endif
173#else
174#include "assert.h"
175#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) );
176#endif
177#else
178#define _IRR_DEBUG_BREAK_IF( _CONDITION_ )
179#endif
180
181//! Defines a deprecated macro which generates a warning at compile time
182/** The usage is simple
183For typedef: typedef _IRR_DEPRECATED_ int test1;
184For classes/structs: class _IRR_DEPRECATED_ test2 { ... };
185For methods: class test3 { _IRR_DEPRECATED_ virtual void foo() {} };
186For functions: template<class T> _IRR_DEPRECATED_ void test4(void) {}
187**/
188#if defined(IGNORE_DEPRECATED_WARNING)
189#define _IRR_DEPRECATED_
190#elif _MSC_VER >= 1310 //vs 2003 or higher
191#define _IRR_DEPRECATED_ __declspec(deprecated)
192#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) // all versions above 3.0 should support this feature
193#define _IRR_DEPRECATED_ __attribute__ ((deprecated))
194#else
195#define _IRR_DEPRECATED_
196#endif
197
198//! Defines a small statement to work around a microsoft compiler bug.
199/** The microsoft compiler 7.0 - 7.1 has a bug:
200When you call unmanaged code that returns a bool type value of false from managed code,
201the return value may appear as true. See
202http://support.microsoft.com/default.aspx?kbid=823071 for details.
203Compiler version defines: VC6.0 : 1200, VC7.0 : 1300, VC7.1 : 1310, VC8.0 : 1400*/
204#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER > 1299) && (_MSC_VER < 1400)
205#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX __asm mov eax,100
206#else
207#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
208#endif // _IRR_MANAGED_MARSHALLING_BUGFIX
209
210
211// memory debugging
212#if defined(_DEBUG) && defined(IRRLICHT_EXPORTS) && defined(_MSC_VER) && \
213 (_MSC_VER > 1299) && !defined(_IRR_DONT_DO_MEMORY_DEBUGGING_HERE) && !defined(_WIN32_WCE)
214
215 #define CRTDBG_MAP_ALLOC
216 #define _CRTDBG_MAP_ALLOC
217 #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
218 #include <stdlib.h>
219 #include <crtdbg.h>
220 #define new DEBUG_CLIENTBLOCK
221#endif
222
223// disable truncated debug information warning in visual studio 6 by default
224#if defined(_MSC_VER) && (_MSC_VER < 1300 )
225#pragma warning( disable: 4786)
226#endif // _MSC
227
228
229//! ignore VC8 warning deprecated
230/** The microsoft compiler */
231#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER >= 1400)
232 //#pragma warning( disable: 4996)
233 //#define _CRT_SECURE_NO_DEPRECATE 1
234 //#define _CRT_NONSTDC_NO_DEPRECATE 1
235#endif
236
237
238//! creates four CC codes used in Irrlicht for simple ids
239/** some compilers can create those by directly writing the
240code like 'code', but some generate warnings so we use this macro here */
241#define MAKE_IRR_ID(c0, c1, c2, c3) \
242 ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
243 ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 ))
244
245#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
246#define _strcmpi(a,b) strcmpi(a,b)
247#endif
248
249#endif // __IRR_TYPES_H_INCLUDED__
250
diff --git a/src/others/irrlicht-1.8.1/include/irrXML.h b/src/others/irrlicht-1.8.1/include/irrXML.h
new file mode 100644
index 0000000..dd55b1a
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrXML.h
@@ -0,0 +1,575 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine" and the "irrXML" project.
3// For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
4
5#ifndef __IRR_XML_H_INCLUDED__
6#define __IRR_XML_H_INCLUDED__
7
8#include <stdio.h>
9#include "IrrCompileConfig.h"
10
11/** \mainpage irrXML 1.2 API documentation
12 <div align="center"><img src="logobig.png" ></div>
13
14 \section intro Introduction
15
16 Welcome to the irrXML API documentation.
17 Here you'll find any information you'll need to develop applications with
18 irrXML. If you look for a tutorial on how to start, take a look at the \ref irrxmlexample,
19 at the homepage of irrXML at <A HREF="http://www.ambiera.com/irrxml/">www.ambiera.com/irrxml/</A>
20 or into the SDK in the directory example.
21
22 irrXML is intended to be a high speed and easy-to-use XML Parser for C++, and
23 this documentation is an important part of it. If you have any questions or
24 suggestions, just send a email to the author of the engine, Nikolaus Gebhardt
25 (niko (at) irrlicht3d.org). For more informations about this parser, see \ref history.
26
27 \section features Features
28
29 irrXML provides forward-only, read-only
30 access to a stream of non validated XML data. It was fully implemented by
31 Nikolaus Gebhardt. Its current features are:
32
33 - It it fast as lighting and has very low memory usage. It was
34 developed with the intention of being used in 3D games, as it already has been.
35 - irrXML is very small: It only consists of 60 KB of code and can be added easily
36 to your existing project.
37 - Of course, it is platform independent and works with lots of compilers.
38 - It is able to parse ASCII, UTF-8, UTF-16 and UTF-32 text files, both in
39 little and big endian format.
40 - Independent of the input file format, the parser can return all strings in ASCII, UTF-8,
41 UTF-16 and UTF-32 format.
42 - With its optional file access abstraction it has the advantage that it can read not
43 only from files but from any type of data (memory, network, ...). For example when
44 used with the Irrlicht Engine, it directly reads from compressed .zip files.
45 - Just like the Irrlicht Engine for which it was originally created, it is extremely easy
46 to use.
47 - It has no external dependencies, it does not even need the STL.
48
49 Although irrXML has some strenghts, it currently also has the following limitations:
50
51 - The input xml file is not validated and assumed to be correct.
52
53 \section irrxmlexample Example
54
55 The following code demonstrates the basic usage of irrXML. A simple xml
56 file like this is parsed:
57 \code
58 <?xml version="1.0"?>
59 <config>
60 <!-- This is a config file for the mesh viewer -->
61 <model file="dwarf.dea" />
62 <messageText caption="Irrlicht Engine Mesh Viewer">
63 Welcome to the Mesh Viewer of the &quot;Irrlicht Engine&quot;.
64 </messageText>
65 </config>
66 \endcode
67
68 The code for parsing this file would look like this:
69 \code
70 #include <irrXML.h>
71 using namespace irr; // irrXML is located in the namespace irr::io
72 using namespace io;
73
74 #include <string> // we use STL strings to store data in this example
75
76 void main()
77 {
78 // create the reader using one of the factory functions
79
80 IrrXMLReader* xml = createIrrXMLReader("config.xml");
81
82 // strings for storing the data we want to get out of the file
83 std::string modelFile;
84 std::string messageText;
85 std::string caption;
86
87 // parse the file until end reached
88
89 while(xml && xml->read())
90 {
91 switch(xml->getNodeType())
92 {
93 case EXN_TEXT:
94 // in this xml file, the only text which occurs is the messageText
95 messageText = xml->getNodeData();
96 break;
97 case EXN_ELEMENT:
98 {
99 if (!strcmp("model", xml->getNodeName()))
100 modelFile = xml->getAttributeValue("file");
101 else
102 if (!strcmp("messageText", xml->getNodeName()))
103 caption = xml->getAttributeValue("caption");
104 }
105 break;
106 }
107 }
108
109 // delete the xml parser after usage
110 delete xml;
111 }
112 \endcode
113
114 \section howto How to use
115
116 Simply add the source files in the /src directory of irrXML to your project. Done.
117
118 \section license License
119
120 The irrXML license is based on the zlib license. Basicly, this means you can do with
121 irrXML whatever you want:
122
123 Copyright (C) 2002-2012 Nikolaus Gebhardt
124
125 This software is provided 'as-is', without any express or implied
126 warranty. In no event will the authors be held liable for any damages
127 arising from the use of this software.
128
129 Permission is granted to anyone to use this software for any purpose,
130 including commercial applications, and to alter it and redistribute it
131 freely, subject to the following restrictions:
132
133 1. The origin of this software must not be misrepresented; you must not
134 claim that you wrote the original software. If you use this software
135 in a product, an acknowledgment in the product documentation would be
136 appreciated but is not required.
137
138 2. Altered source versions must be plainly marked as such, and must not be
139 misrepresented as being the original software.
140
141 3. This notice may not be removed or altered from any source distribution.
142
143 \section history History
144
145 As lots of references in this documentation and the source show, this xml
146 parser has originally been a part of the
147 <A HREF="http://irrlicht.sourceforge.net" >Irrlicht Engine</A>. But because
148 the parser has become very useful with the latest release, people asked for a
149 separate version of it, to be able to use it in non Irrlicht projects. With
150 irrXML 1.0, this has now been done.
151*/
152
153namespace irr
154{
155namespace io
156{
157 //! Enumeration of all supported source text file formats
158 enum ETEXT_FORMAT
159 {
160 //! ASCII, file without byte order mark, or not a text file
161 ETF_ASCII,
162
163 //! UTF-8 format
164 ETF_UTF8,
165
166 //! UTF-16 format, big endian
167 ETF_UTF16_BE,
168
169 //! UTF-16 format, little endian
170 ETF_UTF16_LE,
171
172 //! UTF-32 format, big endian
173 ETF_UTF32_BE,
174
175 //! UTF-32 format, little endian
176 ETF_UTF32_LE
177 };
178
179
180 //! Enumeration for all xml nodes which are parsed by IrrXMLReader
181 enum EXML_NODE
182 {
183 //! No xml node. This is usually the node if you did not read anything yet.
184 EXN_NONE,
185
186 //! An xml element such as &lt;foo&gt;
187 EXN_ELEMENT,
188
189 //! End of an xml element such as &lt;/foo&gt;
190 EXN_ELEMENT_END,
191
192 //! Text within an xml element: &lt;foo&gt; this is the text. &lt;/foo&gt;
193 //! Also text between 2 xml elements: &lt;/foo&gt; this is the text. &lt;foo&gt;
194 EXN_TEXT,
195
196 //! An xml comment like &lt;!-- I am a comment --&gt; or a DTD definition.
197 EXN_COMMENT,
198
199 //! An xml cdata section like &lt;![CDATA[ this is some CDATA ]]&gt;
200 EXN_CDATA,
201
202 //! Unknown element.
203 EXN_UNKNOWN
204 };
205
206 //! Callback class for file read abstraction.
207 /** With this, it is possible to make the xml parser read in other
208 things than just files. The Irrlicht engine is using this for example to
209 read xml from compressed .zip files. To make the parser read in
210 any other data, derive a class from this interface, implement the
211 two methods to read your data and give a pointer to an instance of
212 your implementation when calling createIrrXMLReader(),
213 createIrrXMLReaderUTF16() or createIrrXMLReaderUTF32() */
214 class IFileReadCallBack
215 {
216 public:
217
218 //! Destructor
219 virtual ~IFileReadCallBack() {}
220
221 //! Reads an amount of bytes from the file.
222 /** \param buffer: Pointer to buffer where to read bytes will be written to.
223 \param sizeToRead: Amount of bytes to read from the file.
224 \return Returns how much bytes were read. */
225 virtual int read(void* buffer, int sizeToRead) = 0;
226
227 //! Returns size of file in bytes
228 virtual long getSize() const = 0;
229 };
230
231 //! Empty class to be used as parent class for IrrXMLReader.
232 /** If you need another class as base class for the xml reader, you can do this by creating
233 the reader using for example new CXMLReaderImpl<char, YourBaseClass>(yourcallback);
234 The Irrlicht Engine for example needs IReferenceCounted as base class for every object to
235 let it automaticly reference countend, hence it replaces IXMLBase with IReferenceCounted.
236 See irrXML.cpp on how this can be done in detail. */
237 class IXMLBase
238 {
239 };
240
241 //! Interface providing easy read access to a XML file.
242 /** You can create an instance of this reader using one of the factory functions
243 createIrrXMLReader(), createIrrXMLReaderUTF16() and createIrrXMLReaderUTF32().
244 If using the parser from the Irrlicht Engine, please use IFileSystem::createXMLReader()
245 instead.
246 For a detailed intro how to use the parser, see \ref irrxmlexample and \ref features.
247
248 The typical usage of this parser looks like this:
249 \code
250 #include <irrXML.h>
251 using namespace irr; // irrXML is located in the namespace irr::io
252 using namespace io;
253
254 void main()
255 {
256 // create the reader using one of the factory functions
257 IrrXMLReader* xml = createIrrXMLReader("config.xml");
258
259 if (xml == 0)
260 return; // file could not be opened
261
262 // parse the file until end reached
263 while(xml->read())
264 {
265 // based on xml->getNodeType(), do something.
266 }
267
268 // delete the xml parser after usage
269 delete xml;
270 }
271 \endcode
272 See \ref irrxmlexample for a more detailed example.
273 */
274 template<class char_type, class super_class>
275 class IIrrXMLReader : public super_class
276 {
277 public:
278
279 //! Destructor
280 virtual ~IIrrXMLReader() {}
281
282 //! Reads forward to the next xml node.
283 /** \return Returns false, if there was no further node. */
284 virtual bool read() = 0;
285
286 //! Returns the type of the current XML node.
287 virtual EXML_NODE getNodeType() const = 0;
288
289 //! Returns attribute count of the current XML node.
290 /** This is usually
291 non null if the current node is EXN_ELEMENT, and the element has attributes.
292 \return Returns amount of attributes of this xml node. */
293 virtual unsigned int getAttributeCount() const = 0;
294
295 //! Returns name of an attribute.
296 /** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1.
297 \return Name of the attribute, 0 if an attribute with this index does not exist. */
298 virtual const char_type* getAttributeName(int idx) const = 0;
299
300 //! Returns the value of an attribute.
301 /** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1.
302 \return Value of the attribute, 0 if an attribute with this index does not exist. */
303 virtual const char_type* getAttributeValue(int idx) const = 0;
304
305 //! Returns the value of an attribute.
306 /** \param name: Name of the attribute.
307 \return Value of the attribute, 0 if an attribute with this name does not exist. */
308 virtual const char_type* getAttributeValue(const char_type* name) const = 0;
309
310 //! Returns the value of an attribute in a safe way.
311 /** Like getAttributeValue(), but does not
312 return 0 if the attribute does not exist. An empty string ("") is returned then.
313 \param name: Name of the attribute.
314 \return Value of the attribute, and "" if an attribute with this name does not exist */
315 virtual const char_type* getAttributeValueSafe(const char_type* name) const = 0;
316
317 //! Returns the value of an attribute as integer.
318 /** \param name Name of the attribute.
319 \return Value of the attribute as integer, and 0 if an attribute with this name does not exist or
320 the value could not be interpreted as integer. */
321 virtual int getAttributeValueAsInt(const char_type* name) const = 0;
322
323 //! Returns the value of an attribute as integer.
324 /** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1.
325 \return Value of the attribute as integer, and 0 if an attribute with this index does not exist or
326 the value could not be interpreted as integer. */
327 virtual int getAttributeValueAsInt(int idx) const = 0;
328
329 //! Returns the value of an attribute as float.
330 /** \param name: Name of the attribute.
331 \return Value of the attribute as float, and 0 if an attribute with this name does not exist or
332 the value could not be interpreted as float. */
333 virtual float getAttributeValueAsFloat(const char_type* name) const = 0;
334
335 //! Returns the value of an attribute as float.
336 /** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1.
337 \return Value of the attribute as float, and 0 if an attribute with this index does not exist or
338 the value could not be interpreted as float. */
339 virtual float getAttributeValueAsFloat(int idx) const = 0;
340
341 //! Returns the name of the current node.
342 /** Only valid, if the node type is EXN_ELEMENT.
343 \return Name of the current node or 0 if the node has no name. */
344 virtual const char_type* getNodeName() const = 0;
345
346 //! Returns data of the current node.
347 /** Only valid if the node has some
348 data and it is of type EXN_TEXT, EXN_COMMENT, EXN_CDATA or EXN_UNKNOWN. */
349 virtual const char_type* getNodeData() const = 0;
350
351 //! Returns if an element is an empty element, like &lt;foo />
352 virtual bool isEmptyElement() const = 0;
353
354 //! Returns format of the source xml file.
355 /** It is not necessary to use
356 this method because the parser will convert the input file format
357 to the format wanted by the user when creating the parser. This
358 method is useful to get/display additional informations. */
359 virtual ETEXT_FORMAT getSourceFormat() const = 0;
360
361 //! Returns format of the strings returned by the parser.
362 /** This will be UTF8 for example when you created a parser with
363 IrrXMLReaderUTF8() and UTF32 when it has been created using
364 IrrXMLReaderUTF32. It should not be necessary to call this
365 method and only exists for informational purposes. */
366 virtual ETEXT_FORMAT getParserFormat() const = 0;
367 };
368
369
370 template <typename T>
371 struct xmlChar
372 {
373 T c;
374 xmlChar<T>() {}
375 xmlChar<T>(char in) : c(static_cast<T>(in)) {}
376 xmlChar<T>(wchar_t in) : c(static_cast<T>(in)) {}
377#if defined(__BORLANDC__)
378 // Note - removing explicit for borland was to get it to even compile.
379 // There haven't been any kind of tests for that besides that.
380 xmlChar<T>(unsigned char in) : c(static_cast<T>(in)) {}
381 xmlChar<T>(unsigned short in) : c(static_cast<T>(in)) {}
382 xmlChar<T>(unsigned int in) : c(static_cast<T>(in)) {}
383 xmlChar<T>(unsigned long in) : c(static_cast<T>(in)) {}
384#else
385 explicit xmlChar<T>(unsigned char in) : c(static_cast<T>(in)) {}
386 explicit xmlChar<T>(unsigned short in) : c(static_cast<T>(in)) {}
387 explicit xmlChar<T>(unsigned int in) : c(static_cast<T>(in)) {}
388 explicit xmlChar<T>(unsigned long in) : c(static_cast<T>(in)) {}
389#endif
390 operator T() const { return c; }
391 void operator=(int t) { c=static_cast<T>(t); }
392 };
393
394 //! defines the utf-16 type.
395 /** Not using wchar_t for this because
396 wchar_t has 16 bit on windows and 32 bit on other operating systems. */
397 typedef xmlChar<unsigned short> char16;
398
399 //! defines the utf-32 type.
400 /** Not using wchar_t for this because
401 wchar_t has 16 bit on windows and 32 bit on other operating systems. */
402 typedef xmlChar<unsigned int> char32;
403
404 //! A UTF-8 or ASCII character xml parser.
405 /** This means that all character data will be returned in 8 bit ASCII or UTF-8 by this parser.
406 The file to read can be in any format, it will be converted to UTF-8 if it is not
407 in this format.
408 Create an instance of this with createIrrXMLReader();
409 See IIrrXMLReader for description on how to use it. */
410 typedef IIrrXMLReader<char, IXMLBase> IrrXMLReader;
411
412 //! A UTF-16 xml parser.
413 /** This means that all character data will be returned in UTF-16 by this parser.
414 The file to read can be in any format, it will be converted to UTF-16 if it is not
415 in this format.
416 Create an instance of this with createIrrXMLReaderUTF16();
417 See IIrrXMLReader for description on how to use it. */
418 typedef IIrrXMLReader<char16, IXMLBase> IrrXMLReaderUTF16;
419
420 //! A UTF-32 xml parser.
421 /** This means that all character data will be returned in UTF-32 by this parser.
422 The file to read can be in any format, it will be converted to UTF-32 if it is not
423 in this format.
424 Create an instance of this with createIrrXMLReaderUTF32();
425 See IIrrXMLReader for description on how to use it. */
426 typedef IIrrXMLReader<char32, IXMLBase> IrrXMLReaderUTF32;
427
428
429 //! Creates an instance of an UFT-8 or ASCII character xml parser.
430 /** This means that all character data will be returned in 8 bit ASCII or UTF-8.
431 The file to read can be in any format, it will be converted to UTF-8 if it is not in this format.
432 If you are using the Irrlicht Engine, it is better not to use this function but
433 IFileSystem::createXMLReaderUTF8() instead.
434 \param filename: Name of file to be opened.
435 \return Returns a pointer to the created xml parser. This pointer should be
436 deleted using 'delete' after no longer needed. Returns 0 if an error occured
437 and the file could not be opened. */
438 IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(const char* filename);
439
440 //! Creates an instance of an UFT-8 or ASCII character xml parser.
441 /** This means that all character data will be returned in 8 bit ASCII or UTF-8. The file to read can
442 be in any format, it will be converted to UTF-8 if it is not in this format.
443 If you are using the Irrlicht Engine, it is better not to use this function but
444 IFileSystem::createXMLReaderUTF8() instead.
445 \param file: Pointer to opened file, must have been opened in binary mode, e.g.
446 using fopen("foo.bar", "wb"); The file will not be closed after it has been read.
447 \return Returns a pointer to the created xml parser. This pointer should be
448 deleted using 'delete' after no longer needed. Returns 0 if an error occured
449 and the file could not be opened. */
450 IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(FILE* file);
451
452 //! Creates an instance of an UFT-8 or ASCII character xml parser.
453 /** This means that all character data will be returned in 8 bit ASCII or UTF-8. The file to read can
454 be in any format, it will be converted to UTF-8 if it is not in this format.
455 If you are using the Irrlicht Engine, it is better not to use this function but
456 IFileSystem::createXMLReaderUTF8() instead.
457 \param callback: Callback for file read abstraction. Implement your own
458 callback to make the xml parser read in other things than just files. See
459 IFileReadCallBack for more information about this.
460 \param deleteCallback: if true, the callback will be deleted after the file
461 has been read. Otherwise the caller si responsible for cleaning it up.
462 \return Returns a pointer to the created xml parser. This pointer should be
463 deleted using 'delete' after no longer needed. Returns 0 if an error occured
464 and the file could not be opened. */
465 IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback,
466 bool deleteCallback = false);
467
468 //! Creates an instance of an UFT-16 xml parser.
469 /** This means that
470 all character data will be returned in UTF-16. The file to read can
471 be in any format, it will be converted to UTF-16 if it is not in this format.
472 If you are using the Irrlicht Engine, it is better not to use this function but
473 IFileSystem::createXMLReader() instead.
474 \param filename: Name of file to be opened.
475 \return Returns a pointer to the created xml parser. This pointer should be
476 deleted using 'delete' after no longer needed. Returns 0 if an error occured
477 and the file could not be opened. */
478 IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(const char* filename);
479
480 //! Creates an instance of an UFT-16 xml parser.
481 /** This means that all character data will be returned in UTF-16. The file to read can
482 be in any format, it will be converted to UTF-16 if it is not in this format.
483 If you are using the Irrlicht Engine, it is better not to use this function but
484 IFileSystem::createXMLReader() instead.
485 \param file: Pointer to opened file, must have been opened in binary mode, e.g.
486 using fopen("foo.bar", "wb"); The file will not be closed after it has been read.
487 \return Returns a pointer to the created xml parser. This pointer should be
488 deleted using 'delete' after no longer needed. Returns 0 if an error occured
489 and the file could not be opened. */
490 IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(FILE* file);
491
492 //! Creates an instance of an UFT-16 xml parser.
493 /** This means that all character data will be returned in UTF-16. The file to read can
494 be in any format, it will be converted to UTF-16 if it is not in this format.
495 If you are using the Irrlicht Engine, it is better not to use this function but
496 IFileSystem::createXMLReader() instead.
497 \param callback: Callback for file read abstraction. Implement your own
498 callback to make the xml parser read in other things than just files. See
499 IFileReadCallBack for more information about this.
500 \param deleteCallback: if true, the callback will be deleted after the file
501 has been read. Otherwise the caller si responsible for cleaning it up.
502 \return Returns a pointer to the created xml parser. This pointer should be
503 deleted using 'delete' after no longer needed. Returns 0 if an error occured
504 and the file could not be opened. */
505 IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback,
506 bool deleteCallback = false);
507
508
509 //! Creates an instance of an UFT-32 xml parser.
510 /** This means that all character data will be returned in UTF-32. The file to read can
511 be in any format, it will be converted to UTF-32 if it is not in this format.
512 If you are using the Irrlicht Engine, it is better not to use this function but
513 IFileSystem::createXMLReader() instead.
514 \param filename: Name of file to be opened.
515 \return Returns a pointer to the created xml parser. This pointer should be
516 deleted using 'delete' after no longer needed. Returns 0 if an error occured
517 and the file could not be opened. */
518 IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(const char* filename);
519
520 //! Creates an instance of an UFT-32 xml parser.
521 /** This means that all character data will be returned in UTF-32. The file to read can
522 be in any format, it will be converted to UTF-32 if it is not in this format.
523 if you are using the Irrlicht Engine, it is better not to use this function but
524 IFileSystem::createXMLReader() instead.
525 \param file: Pointer to opened file, must have been opened in binary mode, e.g.
526 using fopen("foo.bar", "wb"); The file will not be closed after it has been read.
527 \return Returns a pointer to the created xml parser. This pointer should be
528 deleted using 'delete' after no longer needed. Returns 0 if an error occured
529 and the file could not be opened. */
530 IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(FILE* file);
531
532 //! Creates an instance of an UFT-32 xml parser.
533 /** This means that
534 all character data will be returned in UTF-32. The file to read can
535 be in any format, it will be converted to UTF-32 if it is not in this format.
536 If you are using the Irrlicht Engine, it is better not to use this function but
537 IFileSystem::createXMLReader() instead.
538 \param callback: Callback for file read abstraction. Implement your own
539 callback to make the xml parser read in other things than just files. See
540 IFileReadCallBack for more information about this.
541 \param deleteCallback: if true, the callback will be deleted after the file
542 has been read. Otherwise the caller si responsible for cleaning it up.
543 \return Returns a pointer to the created xml parser. This pointer should be
544 deleted using 'delete' after no longer needed. Returns 0 if an error occured
545 and the file could not be opened. */
546 IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback,
547 bool deleteCallback = false);
548
549
550 /*! \file irrXML.h
551 \brief Header file of the irrXML, the Irrlicht XML parser.
552
553 This file includes everything needed for using irrXML,
554 the XML parser of the Irrlicht Engine. To use irrXML,
555 you only need to include this file in your project:
556
557 \code
558 #include <irrXML.h>
559 \endcode
560
561 It is also common to use the two namespaces in which irrXML is included,
562 directly after including irrXML.h:
563
564 \code
565 #include <irrXML.h>
566 using namespace irr;
567 using namespace io;
568 \endcode
569 */
570
571} // end namespace io
572} // end namespace irr
573
574#endif // __IRR_XML_H_INCLUDED__
575
diff --git a/src/others/irrlicht-1.8.1/include/irrlicht.h b/src/others/irrlicht-1.8.1/include/irrlicht.h
new file mode 100644
index 0000000..74783ce
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrlicht.h
@@ -0,0 +1,394 @@
1/* irrlicht.h -- interface of the 'Irrlicht Engine'
2
3 Copyright (C) 2002-2012 Nikolaus Gebhardt
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20
21 Please note that the Irrlicht Engine is based in part on the work of the
22 Independent JPEG Group, the zlib and the libPng. This means that if you use
23 the Irrlicht Engine in your product, you must acknowledge somewhere in your
24 documentation that you've used the IJG code. It would also be nice to mention
25 that you use the Irrlicht Engine, the zlib and libPng. See the README files
26 in the jpeglib, the zlib and libPng for further informations.
27*/
28
29#ifndef __IRRLICHT_H_INCLUDED__
30#define __IRRLICHT_H_INCLUDED__
31
32#include "IrrCompileConfig.h"
33#include "aabbox3d.h"
34#include "CDynamicMeshBuffer.h"
35#include "CIndexBuffer.h"
36#include "CMeshBuffer.h"
37#include "coreutil.h"
38#include "CVertexBuffer.h"
39#include "dimension2d.h"
40#include "ECullingTypes.h"
41#include "EDebugSceneTypes.h"
42#include "EDriverFeatures.h"
43#include "EDriverTypes.h"
44#include "EGUIAlignment.h"
45#include "EGUIElementTypes.h"
46#include "EHardwareBufferFlags.h"
47#include "EMaterialFlags.h"
48#include "EMaterialTypes.h"
49#include "EMeshWriterEnums.h"
50#include "EMessageBoxFlags.h"
51#include "ESceneNodeAnimatorTypes.h"
52#include "ESceneNodeTypes.h"
53#include "ETerrainElements.h"
54#include "fast_atof.h"
55#include "heapsort.h"
56#include "IAnimatedMesh.h"
57#include "IAnimatedMeshMD2.h"
58#include "IAnimatedMeshMD3.h"
59#include "IAnimatedMeshSceneNode.h"
60#include "IAttributeExchangingObject.h"
61#include "IAttributes.h"
62#include "IBillboardSceneNode.h"
63#include "IBillboardTextSceneNode.h"
64#include "IBoneSceneNode.h"
65#include "ICameraSceneNode.h"
66#include "ICursorControl.h"
67#include "IDummyTransformationSceneNode.h"
68#include "IDynamicMeshBuffer.h"
69#include "IEventReceiver.h"
70#include "IFileList.h"
71#include "IFileSystem.h"
72#include "IGeometryCreator.h"
73#include "IGPUProgrammingServices.h"
74#include "IGUIButton.h"
75#include "IGUICheckBox.h"
76#include "IGUIColorSelectDialog.h"
77#include "IGUIComboBox.h"
78#include "IGUIContextMenu.h"
79#include "IGUIEditBox.h"
80#include "IGUIElement.h"
81#include "IGUIElementFactory.h"
82#include "IGUIEnvironment.h"
83#include "IGUIFileOpenDialog.h"
84#include "IGUIFont.h"
85#include "IGUIFontBitmap.h"
86#include "IGUIImage.h"
87#include "IGUIInOutFader.h"
88#include "IGUIListBox.h"
89#include "IGUIMeshViewer.h"
90#include "IGUIScrollBar.h"
91#include "IGUISkin.h"
92#include "IGUISpinBox.h"
93#include "IGUISpriteBank.h"
94#include "IGUIStaticText.h"
95#include "IGUITabControl.h"
96#include "IGUITable.h"
97#include "IGUIToolbar.h"
98#include "IGUIWindow.h"
99#include "IGUITreeView.h"
100#include "IImage.h"
101#include "IImageLoader.h"
102#include "IImageWriter.h"
103#include "IIndexBuffer.h"
104#include "ILightSceneNode.h"
105#include "ILogger.h"
106#include "IMaterialRenderer.h"
107#include "IMaterialRendererServices.h"
108#include "IMesh.h"
109#include "IMeshBuffer.h"
110#include "IMeshCache.h"
111#include "IMeshLoader.h"
112#include "IMeshManipulator.h"
113#include "IMeshSceneNode.h"
114#include "IMeshWriter.h"
115#include "IColladaMeshWriter.h"
116#include "IMetaTriangleSelector.h"
117#include "IOSOperator.h"
118#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
119#include "IQ3LevelMesh.h"
120#include "IQ3Shader.h"
121#include "IReadFile.h"
122#include "IReferenceCounted.h"
123#include "irrArray.h"
124#include "IRandomizer.h"
125#include "IrrlichtDevice.h"
126#include "irrList.h"
127#include "irrMap.h"
128#include "irrMath.h"
129#include "irrString.h"
130#include "irrTypes.h"
131#include "path.h"
132#include "irrXML.h"
133#include "ISceneCollisionManager.h"
134#include "ISceneLoader.h"
135#include "ISceneManager.h"
136#include "ISceneNode.h"
137#include "ISceneNodeAnimator.h"
138#include "ISceneNodeAnimatorCameraFPS.h"
139#include "ISceneNodeAnimatorCameraMaya.h"
140#include "ISceneNodeAnimatorCollisionResponse.h"
141#include "ISceneNodeAnimatorFactory.h"
142#include "ISceneNodeFactory.h"
143#include "ISceneUserDataSerializer.h"
144#include "IShaderConstantSetCallBack.h"
145#include "IShadowVolumeSceneNode.h"
146#include "ISkinnedMesh.h"
147#include "ITerrainSceneNode.h"
148#include "ITextSceneNode.h"
149#include "ITexture.h"
150#include "ITimer.h"
151#include "ITriangleSelector.h"
152#include "IVertexBuffer.h"
153#include "IVideoDriver.h"
154#include "IVideoModeList.h"
155#include "IVolumeLightSceneNode.h"
156#include "IWriteFile.h"
157#include "IXMLReader.h"
158#include "IXMLWriter.h"
159#include "ILightManager.h"
160#include "Keycodes.h"
161#include "line2d.h"
162#include "line3d.h"
163#include "matrix4.h"
164#include "plane3d.h"
165#include "position2d.h"
166#include "quaternion.h"
167#include "rect.h"
168#include "S3DVertex.h"
169#include "SAnimatedMesh.h"
170#include "SceneParameters.h"
171#include "SColor.h"
172#include "SExposedVideoData.h"
173#include "SIrrCreationParameters.h"
174#include "SKeyMap.h"
175#include "SLight.h"
176#include "SMaterial.h"
177#include "SMesh.h"
178#include "SMeshBuffer.h"
179#include "SMeshBufferLightMap.h"
180#include "SMeshBufferTangents.h"
181#include "SParticle.h"
182#include "SSharedMeshBuffer.h"
183#include "SSkinMeshBuffer.h"
184#include "SVertexIndex.h"
185#include "SViewFrustum.h"
186#include "triangle3d.h"
187#include "vector2d.h"
188#include "vector3d.h"
189
190/*! \mainpage Irrlicht Engine 1.8 API documentation
191 *
192 * <div align="center"><img src="logobig.png" ></div>
193 *
194 * \section intro Introduction
195 *
196 * Welcome to the Irrlicht Engine API documentation.
197 * Here you'll find any information you'll need to develop applications with
198 * the Irrlicht Engine. If you are looking for a tutorial on how to start, you'll
199 * find some on the homepage of the Irrlicht Engine at
200 * <A HREF="http://irrlicht.sourceforge.net" >irrlicht.sourceforge.net</A>
201 * or inside the SDK in the examples directory.
202 *
203 * The Irrlicht Engine is intended to be an easy-to-use 3d engine, so
204 * this documentation is an important part of it. If you have any questions or
205 * suggestions, just send a email to the author of the engine, Nikolaus Gebhardt
206 * (niko (at) irrlicht3d.org).
207 *
208 *
209 * \section links Links
210 *
211 * <A HREF="namespaces.html">Namespaces</A>: A very good place to start reading
212 * the documentation.<BR>
213 * <A HREF="annotated.html">Class list</A>: List of all classes with descriptions.<BR>
214 * <A HREF="functions.html">Class members</A>: Good place to find forgotten features.<BR>
215 *
216 * \section irrexample Short example
217 *
218 * A simple application, starting up the engine, loading a Quake 2 animated
219 * model file and the corresponding texture, animating and displaying it
220 * in front of a blue background and placing a user controlable 3d camera
221 * would look like the following code. I think this example shows the usage
222 * of the engine quite well:
223 *
224 * \code
225 * #include <irrlicht.h>
226 * using namespace irr;
227 *
228 * int main()
229 * {
230 * // start up the engine
231 * IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D8,
232 * core::dimension2d<u32>(640,480));
233 *
234 * video::IVideoDriver* driver = device->getVideoDriver();
235 * scene::ISceneManager* scenemgr = device->getSceneManager();
236 *
237 * device->setWindowCaption(L"Hello World!");
238 *
239 * // load and show quake2 .md2 model
240 * scene::ISceneNode* node = scenemgr->addAnimatedMeshSceneNode(
241 * scenemgr->getMesh("quake2model.md2"));
242 *
243 * // if everything worked, add a texture and disable lighting
244 * if (node)
245 * {
246 * node->setMaterialTexture(0, driver->getTexture("texture.bmp"));
247 * node->setMaterialFlag(video::EMF_LIGHTING, false);
248 * }
249 *
250 * // add a first person shooter style user controlled camera
251 * scenemgr->addCameraSceneNodeFPS();
252 *
253 * // draw everything
254 * while(device->run() && driver)
255 * {
256 * driver->beginScene(true, true, video::SColor(255,0,0,255));
257 * scenemgr->drawAll();
258 * driver->endScene();
259 * }
260 *
261 * // delete device
262 * device->drop();
263 * return 0;
264 * }
265 * \endcode
266 *
267 * Irrlicht can load a lot of file formats automaticly, see irr::scene::ISceneManager::getMesh()
268 * for a detailed list. So if you would like to replace the simple blue screen background by
269 * a cool Quake 3 Map, optimized by an octree, just insert this code
270 * somewhere before the while loop:
271 *
272 * \code
273 * // add .pk3 archive to the file system
274 * device->getFileSystem()->addZipFileArchive("quake3map.pk3");
275 *
276 * // load .bsp file and show it using an octree
277 * scenemgr->addOctreeSceneNode(
278 * scenemgr->getMesh("quake3map.bsp"));
279 * \endcode
280 *
281 * As you can see, the engine uses namespaces. Everything in the engine is
282 * placed into the namespace 'irr', but there are also 5 sub namespaces.
283 * You can find a list of all namespaces with descriptions at the
284 * <A HREF="namespaces.html"> namespaces page</A>.
285 * This is also a good place to start reading the documentation. If you
286 * don't want to write the namespace names all the time, just use all namespaces like
287 * this:
288 * \code
289 * using namespace core;
290 * using namespace scene;
291 * using namespace video;
292 * using namespace io;
293 * using namespace gui;
294 * \endcode
295 *
296 * There is a lot more the engine can do, but I hope this gave a short
297 * overview over the basic features of the engine. For more examples, please take
298 * a look into the examples directory of the SDK.
299 */
300
301#include "SIrrCreationParameters.h"
302
303//! Everything in the Irrlicht Engine can be found in this namespace.
304namespace irr
305{
306 //! Creates an Irrlicht device. The Irrlicht device is the root object for using the engine.
307 /** If you need more parameters to be passed to the creation of the Irrlicht Engine device,
308 use the createDeviceEx() function.
309 \param deviceType: Type of the device. This can currently be video::EDT_NULL,
310 video::EDT_SOFTWARE, video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D8, video::EDT_DIRECT3D9 and video::EDT_OPENGL.
311 \param windowSize: Size of the window or the video mode in fullscreen mode.
312 \param bits: Bits per pixel in fullscreen mode. Ignored if windowed mode.
313 \param fullscreen: Should be set to true if the device should run in fullscreen. Otherwise
314 the device runs in windowed mode.
315 \param stencilbuffer: Specifies if the stencil buffer should be enabled. Set this to true,
316 if you want the engine be able to draw stencil buffer shadows. Note that not all
317 devices are able to use the stencil buffer. If they don't no shadows will be drawn.
318 \param vsync: Specifies vertical syncronisation: If set to true, the driver will wait
319 for the vertical retrace period, otherwise not.
320 \param receiver: A user created event receiver.
321 \return Returns pointer to the created IrrlichtDevice or null if the
322 device could not be created.
323 */
324 extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDevice(
325 video::E_DRIVER_TYPE deviceType = video::EDT_SOFTWARE,
326 // parantheses are necessary for some compilers
327 const core::dimension2d<u32>& windowSize = (core::dimension2d<u32>(640,480)),
328 u32 bits = 16,
329 bool fullscreen = false,
330 bool stencilbuffer = false,
331 bool vsync = false,
332 IEventReceiver* receiver = 0);
333
334 //! typedef for Function Pointer
335 typedef IrrlichtDevice* (IRRCALLCONV *funcptr_createDevice )(
336 video::E_DRIVER_TYPE deviceType,
337 const core::dimension2d<u32>& windowSize,
338 u32 bits,
339 bool fullscreen,
340 bool stencilbuffer,
341 bool vsync,
342 IEventReceiver* receiver);
343
344
345 //! Creates an Irrlicht device with the option to specify advanced parameters.
346 /** Usually you should used createDevice() for creating an Irrlicht Engine device.
347 Use this function only if you wish to specify advanced parameters like a window
348 handle in which the device should be created.
349 \param parameters: Structure containing advanced parameters for the creation of the device.
350 See irr::SIrrlichtCreationParameters for details.
351 \return Returns pointer to the created IrrlichtDevice or null if the
352 device could not be created. */
353 extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
354 const SIrrlichtCreationParameters& parameters);
355
356 //! typedef for Function Pointer
357 typedef IrrlichtDevice* (IRRCALLCONV *funcptr_createDeviceEx )( const SIrrlichtCreationParameters& parameters );
358
359
360 // THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES
361 // EXISTING ONLY FOR THE DOCUMENTATION SOFTWARE DOXYGEN.
362
363 //! Basic classes such as vectors, planes, arrays, lists, and so on can be found in this namespace.
364 namespace core
365 {
366 }
367
368 //! The gui namespace contains useful classes for easy creation of a graphical user interface.
369 namespace gui
370 {
371 }
372
373 //! This namespace provides interfaces for input/output: Reading and writing files, accessing zip archives, xml files, ...
374 namespace io
375 {
376 }
377
378 //! All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees and billboards, ...
379 namespace scene
380 {
381 }
382
383 //! The video namespace contains classes for accessing the video driver. All 2d and 3d rendering is done here.
384 namespace video
385 {
386 }
387}
388
389/*! \file irrlicht.h
390 \brief Main header file of the irrlicht, the only file needed to include.
391*/
392
393#endif
394
diff --git a/src/others/irrlicht-1.8.1/include/irrpack.h b/src/others/irrlicht-1.8.1/include/irrpack.h
new file mode 100644
index 0000000..3cf643f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrpack.h
@@ -0,0 +1,39 @@
1// Copyright (C) 2007-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5// include this file right before the data structures to be 1-aligned
6// and add to each structure the PACK_STRUCT define just like this:
7// struct mystruct
8// {
9// ...
10// } PACK_STRUCT;
11// Always include the irrunpack.h file right after the last type declared
12// like this, and do not put any other types with different alignment
13// in between!
14
15// byte-align structures
16#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
17# pragma warning(disable: 4103)
18# pragma pack( push, packing )
19# pragma pack( 1 )
20# define PACK_STRUCT
21#elif defined( __DMC__ )
22# pragma pack( push, 1 )
23# define PACK_STRUCT
24#elif defined( __GNUC__ )
25 // Using pragma pack might work with earlier gcc versions already, but
26 // it started to be necessary with gcc 4.7 on mingw unless compiled with -mno-ms-bitfields.
27 // And I found some hints on the web that older gcc versions on the other hand had sometimes
28 // trouble with pragma pack while they worked with __attribute__((packed)).
29# if (__GNUC__ >= 4 ) && (__GNUC_MINOR__ >= 7)
30# pragma pack( push, packing )
31# pragma pack( 1 )
32# define PACK_STRUCT
33# else
34# define PACK_STRUCT __attribute__((packed))
35 #endif
36#else
37# error compiler not supported
38#endif
39
diff --git a/src/others/irrlicht-1.8.1/include/irrunpack.h b/src/others/irrlicht-1.8.1/include/irrunpack.h
new file mode 100644
index 0000000..b42398d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/irrunpack.h
@@ -0,0 +1,20 @@
1// Copyright (C) 2007-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5// include this file to switch back to default alignment
6// file belongs to irrpack.h, see there for more info
7
8// Default alignment
9#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
10# pragma pack( pop, packing )
11#elif defined (__DMC__)
12# pragma pack( pop )
13#elif defined( __GNUC__ )
14# if (__GNUC__ >= 4 ) && (__GNUC_MINOR__ >= 7)
15# pragma pack( pop, packing )
16# endif
17#endif
18
19#undef PACK_STRUCT
20
diff --git a/src/others/irrlicht-1.8.1/include/line2d.h b/src/others/irrlicht-1.8.1/include/line2d.h
new file mode 100644
index 0000000..2a0dee4
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/line2d.h
@@ -0,0 +1,274 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_LINE_2D_H_INCLUDED__
6#define __IRR_LINE_2D_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "vector2d.h"
10
11namespace irr
12{
13namespace core
14{
15
16//! 2D line between two points with intersection methods.
17template <class T>
18class line2d
19{
20 public:
21 //! Default constructor for line going from (0,0) to (1,1).
22 line2d() : start(0,0), end(1,1) {}
23 //! Constructor for line between the two points.
24 line2d(T xa, T ya, T xb, T yb) : start(xa, ya), end(xb, yb) {}
25 //! Constructor for line between the two points given as vectors.
26 line2d(const vector2d<T>& start, const vector2d<T>& end) : start(start), end(end) {}
27 //! Copy constructor.
28 line2d(const line2d<T>& other) : start(other.start), end(other.end) {}
29
30 // operators
31
32 line2d<T> operator+(const vector2d<T>& point) const { return line2d<T>(start + point, end + point); }
33 line2d<T>& operator+=(const vector2d<T>& point) { start += point; end += point; return *this; }
34
35 line2d<T> operator-(const vector2d<T>& point) const { return line2d<T>(start - point, end - point); }
36 line2d<T>& operator-=(const vector2d<T>& point) { start -= point; end -= point; return *this; }
37
38 bool operator==(const line2d<T>& other) const
39 { return (start==other.start && end==other.end) || (end==other.start && start==other.end);}
40 bool operator!=(const line2d<T>& other) const
41 { return !(start==other.start && end==other.end) || (end==other.start && start==other.end);}
42
43 // functions
44 //! Set this line to new line going through the two points.
45 void setLine(const T& xa, const T& ya, const T& xb, const T& yb){start.set(xa, ya); end.set(xb, yb);}
46 //! Set this line to new line going through the two points.
47 void setLine(const vector2d<T>& nstart, const vector2d<T>& nend){start.set(nstart); end.set(nend);}
48 //! Set this line to new line given as parameter.
49 void setLine(const line2d<T>& line){start.set(line.start); end.set(line.end);}
50
51 //! Get length of line
52 /** \return Length of the line. */
53 T getLength() const { return start.getDistanceFrom(end); }
54
55 //! Get squared length of the line
56 /** \return Squared length of line. */
57 T getLengthSQ() const { return start.getDistanceFromSQ(end); }
58
59 //! Get middle of the line
60 /** \return center of the line. */
61 vector2d<T> getMiddle() const
62 {
63 return (start + end)/(T)2;
64 }
65
66 //! Get the vector of the line.
67 /** \return The vector of the line. */
68 vector2d<T> getVector() const { return vector2d<T>(end.X - start.X, end.Y - start.Y); }
69
70 //! Tests if this line intersects with another line.
71 /** \param l: Other line to test intersection with.
72 \param checkOnlySegments: Default is to check intersection between the begin and endpoints.
73 When set to false the function will check for the first intersection point when extending the lines.
74 \param out: If there is an intersection, the location of the
75 intersection will be stored in this vector.
76 \return True if there is an intersection, false if not. */
77 bool intersectWith(const line2d<T>& l, vector2d<T>& out, bool checkOnlySegments=true) const
78 {
79 // Uses the method given at:
80 // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/
81 const f32 commonDenominator = (f32)(l.end.Y - l.start.Y)*(end.X - start.X) -
82 (l.end.X - l.start.X)*(end.Y - start.Y);
83
84 const f32 numeratorA = (f32)(l.end.X - l.start.X)*(start.Y - l.start.Y) -
85 (l.end.Y - l.start.Y)*(start.X -l.start.X);
86
87 const f32 numeratorB = (f32)(end.X - start.X)*(start.Y - l.start.Y) -
88 (end.Y - start.Y)*(start.X -l.start.X);
89
90 if(equals(commonDenominator, 0.f))
91 {
92 // The lines are either coincident or parallel
93 // if both numerators are 0, the lines are coincident
94 if(equals(numeratorA, 0.f) && equals(numeratorB, 0.f))
95 {
96 // Try and find a common endpoint
97 if(l.start == start || l.end == start)
98 out = start;
99 else if(l.end == end || l.start == end)
100 out = end;
101 // now check if the two segments are disjunct
102 else if (l.start.X>start.X && l.end.X>start.X && l.start.X>end.X && l.end.X>end.X)
103 return false;
104 else if (l.start.Y>start.Y && l.end.Y>start.Y && l.start.Y>end.Y && l.end.Y>end.Y)
105 return false;
106 else if (l.start.X<start.X && l.end.X<start.X && l.start.X<end.X && l.end.X<end.X)
107 return false;
108 else if (l.start.Y<start.Y && l.end.Y<start.Y && l.start.Y<end.Y && l.end.Y<end.Y)
109 return false;
110 // else the lines are overlapping to some extent
111 else
112 {
113 // find the points which are not contributing to the
114 // common part
115 vector2d<T> maxp;
116 vector2d<T> minp;
117 if ((start.X>l.start.X && start.X>l.end.X && start.X>end.X) || (start.Y>l.start.Y && start.Y>l.end.Y && start.Y>end.Y))
118 maxp=start;
119 else if ((end.X>l.start.X && end.X>l.end.X && end.X>start.X) || (end.Y>l.start.Y && end.Y>l.end.Y && end.Y>start.Y))
120 maxp=end;
121 else if ((l.start.X>start.X && l.start.X>l.end.X && l.start.X>end.X) || (l.start.Y>start.Y && l.start.Y>l.end.Y && l.start.Y>end.Y))
122 maxp=l.start;
123 else
124 maxp=l.end;
125 if (maxp != start && ((start.X<l.start.X && start.X<l.end.X && start.X<end.X) || (start.Y<l.start.Y && start.Y<l.end.Y && start.Y<end.Y)))
126 minp=start;
127 else if (maxp != end && ((end.X<l.start.X && end.X<l.end.X && end.X<start.X) || (end.Y<l.start.Y && end.Y<l.end.Y && end.Y<start.Y)))
128 minp=end;
129 else if (maxp != l.start && ((l.start.X<start.X && l.start.X<l.end.X && l.start.X<end.X) || (l.start.Y<start.Y && l.start.Y<l.end.Y && l.start.Y<end.Y)))
130 minp=l.start;
131 else
132 minp=l.end;
133
134 // one line is contained in the other. Pick the center
135 // of the remaining points, which overlap for sure
136 out = core::vector2d<T>();
137 if (start != maxp && start != minp)
138 out += start;
139 if (end != maxp && end != minp)
140 out += end;
141 if (l.start != maxp && l.start != minp)
142 out += l.start;
143 if (l.end != maxp && l.end != minp)
144 out += l.end;
145 out.X = (T)(out.X/2);
146 out.Y = (T)(out.Y/2);
147 }
148
149 return true; // coincident
150 }
151
152 return false; // parallel
153 }
154
155 // Get the point of intersection on this line, checking that
156 // it is within the line segment.
157 const f32 uA = numeratorA / commonDenominator;
158 if(checkOnlySegments && (uA < 0.f || uA > 1.f) )
159 return false; // Outside the line segment
160
161 const f32 uB = numeratorB / commonDenominator;
162 if(checkOnlySegments && (uB < 0.f || uB > 1.f))
163 return false; // Outside the line segment
164
165 // Calculate the intersection point.
166 out.X = (T)(start.X + uA * (end.X - start.X));
167 out.Y = (T)(start.Y + uA * (end.Y - start.Y));
168 return true;
169 }
170
171 //! Get unit vector of the line.
172 /** \return Unit vector of this line. */
173 vector2d<T> getUnitVector() const
174 {
175 T len = (T)(1.0 / getLength());
176 return vector2d<T>((end.X - start.X) * len, (end.Y - start.Y) * len);
177 }
178
179 //! Get angle between this line and given line.
180 /** \param l Other line for test.
181 \return Angle in degrees. */
182 f64 getAngleWith(const line2d<T>& l) const
183 {
184 vector2d<T> vect = getVector();
185 vector2d<T> vect2 = l.getVector();
186 return vect.getAngleWith(vect2);
187 }
188
189 //! Tells us if the given point lies to the left, right, or on the line.
190 /** \return 0 if the point is on the line
191 <0 if to the left, or >0 if to the right. */
192 T getPointOrientation(const vector2d<T>& point) const
193 {
194 return ( (end.X - start.X) * (point.Y - start.Y) -
195 (point.X - start.X) * (end.Y - start.Y) );
196 }
197
198 //! Check if the given point is a member of the line
199 /** \return True if point is between start and end, else false. */
200 bool isPointOnLine(const vector2d<T>& point) const
201 {
202 T d = getPointOrientation(point);
203 return (d == 0 && point.isBetweenPoints(start, end));
204 }
205
206 //! Check if the given point is between start and end of the line.
207 /** Assumes that the point is already somewhere on the line. */
208 bool isPointBetweenStartAndEnd(const vector2d<T>& point) const
209 {
210 return point.isBetweenPoints(start, end);
211 }
212
213 //! Get the closest point on this line to a point
214 /** \param checkOnlySegments: Default (true) is to return a point on the line-segment (between begin and end) of the line.
215 When set to false the function will check for the first the closest point on the the line even when outside the segment. */
216 vector2d<T> getClosestPoint(const vector2d<T>& point, bool checkOnlySegments=true) const
217 {
218 vector2d<f64> c((f64)(point.X-start.X), (f64)(point.Y- start.Y));
219 vector2d<f64> v((f64)(end.X-start.X), (f64)(end.Y-start.Y));
220 f64 d = v.getLength();
221 if ( d == 0 ) // can't tell much when the line is just a single point
222 return start;
223 v /= d;
224 f64 t = v.dotProduct(c);
225
226 if ( checkOnlySegments )
227 {
228 if (t < 0) return vector2d<T>((T)start.X, (T)start.Y);
229 if (t > d) return vector2d<T>((T)end.X, (T)end.Y);
230 }
231
232 v *= t;
233 return vector2d<T>((T)(start.X + v.X), (T)(start.Y + v.Y));
234 }
235
236 //! Start point of the line.
237 vector2d<T> start;
238 //! End point of the line.
239 vector2d<T> end;
240};
241
242 // partial specialization to optimize <f32> lines (avoiding casts)
243 template <>
244 inline vector2df line2d<irr::f32>::getClosestPoint(const vector2df& point, bool checkOnlySegments) const
245 {
246 vector2df c = point - start;
247 vector2df v = end - start;
248 f32 d = (f32)v.getLength();
249 if ( d == 0 ) // can't tell much when the line is just a single point
250 return start;
251 v /= d;
252 f32 t = v.dotProduct(c);
253
254 if ( checkOnlySegments )
255 {
256 if (t < 0) return start;
257 if (t > d) return end;
258 }
259
260 v *= t;
261 return start + v;
262 }
263
264
265 //! Typedef for an f32 line.
266 typedef line2d<f32> line2df;
267 //! Typedef for an integer line.
268 typedef line2d<s32> line2di;
269
270} // end namespace core
271} // end namespace irr
272
273#endif
274
diff --git a/src/others/irrlicht-1.8.1/include/line3d.h b/src/others/irrlicht-1.8.1/include/line3d.h
new file mode 100644
index 0000000..6ec4e70
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/line3d.h
@@ -0,0 +1,144 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_LINE_3D_H_INCLUDED__
6#define __IRR_LINE_3D_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "vector3d.h"
10
11namespace irr
12{
13namespace core
14{
15
16//! 3D line between two points with intersection methods.
17template <class T>
18class line3d
19{
20 public:
21
22 //! Default constructor
23 /** line from (0,0,0) to (1,1,1) */
24 line3d() : start(0,0,0), end(1,1,1) {}
25 //! Constructor with two points
26 line3d(T xa, T ya, T za, T xb, T yb, T zb) : start(xa, ya, za), end(xb, yb, zb) {}
27 //! Constructor with two points as vectors
28 line3d(const vector3d<T>& start, const vector3d<T>& end) : start(start), end(end) {}
29
30 // operators
31
32 line3d<T> operator+(const vector3d<T>& point) const { return line3d<T>(start + point, end + point); }
33 line3d<T>& operator+=(const vector3d<T>& point) { start += point; end += point; return *this; }
34
35 line3d<T> operator-(const vector3d<T>& point) const { return line3d<T>(start - point, end - point); }
36 line3d<T>& operator-=(const vector3d<T>& point) { start -= point; end -= point; return *this; }
37
38 bool operator==(const line3d<T>& other) const
39 { return (start==other.start && end==other.end) || (end==other.start && start==other.end);}
40 bool operator!=(const line3d<T>& other) const
41 { return !(start==other.start && end==other.end) || (end==other.start && start==other.end);}
42
43 // functions
44 //! Set this line to a new line going through the two points.
45 void setLine(const T& xa, const T& ya, const T& za, const T& xb, const T& yb, const T& zb)
46 {start.set(xa, ya, za); end.set(xb, yb, zb);}
47 //! Set this line to a new line going through the two points.
48 void setLine(const vector3d<T>& nstart, const vector3d<T>& nend)
49 {start.set(nstart); end.set(nend);}
50 //! Set this line to new line given as parameter.
51 void setLine(const line3d<T>& line)
52 {start.set(line.start); end.set(line.end);}
53
54 //! Get length of line
55 /** \return Length of line. */
56 T getLength() const { return start.getDistanceFrom(end); }
57
58 //! Get squared length of line
59 /** \return Squared length of line. */
60 T getLengthSQ() const { return start.getDistanceFromSQ(end); }
61
62 //! Get middle of line
63 /** \return Center of line. */
64 vector3d<T> getMiddle() const
65 {
66 return (start + end)/(T)2;
67 }
68
69 //! Get vector of line
70 /** \return vector of line. */
71 vector3d<T> getVector() const
72 {
73 return end - start;
74 }
75
76 //! Check if the given point is between start and end of the line.
77 /** Assumes that the point is already somewhere on the line.
78 \param point The point to test.
79 \return True if point is on the line between start and end, else false.
80 */
81 bool isPointBetweenStartAndEnd(const vector3d<T>& point) const
82 {
83 return point.isBetweenPoints(start, end);
84 }
85
86 //! Get the closest point on this line to a point
87 /** \param point The point to compare to.
88 \return The nearest point which is part of the line. */
89 vector3d<T> getClosestPoint(const vector3d<T>& point) const
90 {
91 vector3d<T> c = point - start;
92 vector3d<T> v = end - start;
93 T d = (T)v.getLength();
94 v /= d;
95 T t = v.dotProduct(c);
96
97 if (t < (T)0.0)
98 return start;
99 if (t > d)
100 return end;
101
102 v *= t;
103 return start + v;
104 }
105
106 //! Check if the line intersects with a shpere
107 /** \param sorigin: Origin of the shpere.
108 \param sradius: Radius of the sphere.
109 \param outdistance: The distance to the first intersection point.
110 \return True if there is an intersection.
111 If there is one, the distance to the first intersection point
112 is stored in outdistance. */
113 bool getIntersectionWithSphere(vector3d<T> sorigin, T sradius, f64& outdistance) const
114 {
115 const vector3d<T> q = sorigin - start;
116 T c = q.getLength();
117 T v = q.dotProduct(getVector().normalize());
118 T d = sradius * sradius - (c*c - v*v);
119
120 if (d < 0.0)
121 return false;
122
123 outdistance = v - core::squareroot ( d );
124 return true;
125 }
126
127 // member variables
128
129 //! Start point of line
130 vector3d<T> start;
131 //! End point of line
132 vector3d<T> end;
133};
134
135 //! Typedef for an f32 line.
136 typedef line3d<f32> line3df;
137 //! Typedef for an integer line.
138 typedef line3d<s32> line3di;
139
140} // end namespace core
141} // end namespace irr
142
143#endif
144
diff --git a/src/others/irrlicht-1.8.1/include/matrix4.h b/src/others/irrlicht-1.8.1/include/matrix4.h
new file mode 100644
index 0000000..df1e4ea
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/matrix4.h
@@ -0,0 +1,2242 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_MATRIX_H_INCLUDED__
6#define __IRR_MATRIX_H_INCLUDED__
7
8#include "irrMath.h"
9#include "vector3d.h"
10#include "vector2d.h"
11#include "plane3d.h"
12#include "aabbox3d.h"
13#include "rect.h"
14#include "irrString.h"
15
16// enable this to keep track of changes to the matrix
17// and make simpler identity check for seldomly changing matrices
18// otherwise identity check will always compare the elements
19//#define USE_MATRIX_TEST
20
21// this is only for debugging purposes
22//#define USE_MATRIX_TEST_DEBUG
23
24#if defined( USE_MATRIX_TEST_DEBUG )
25
26struct MatrixTest
27{
28 MatrixTest () : ID(0), Calls(0) {}
29 char buf[256];
30 int Calls;
31 int ID;
32};
33static MatrixTest MTest;
34
35#endif
36
37namespace irr
38{
39namespace core
40{
41
42 //! 4x4 matrix. Mostly used as transformation matrix for 3d calculations.
43 /** The matrix is a D3D style matrix, row major with translations in the 4th row. */
44 template <class T>
45 class CMatrix4
46 {
47 public:
48
49 //! Constructor Flags
50 enum eConstructor
51 {
52 EM4CONST_NOTHING = 0,
53 EM4CONST_COPY,
54 EM4CONST_IDENTITY,
55 EM4CONST_TRANSPOSED,
56 EM4CONST_INVERSE,
57 EM4CONST_INVERSE_TRANSPOSED
58 };
59
60 //! Default constructor
61 /** \param constructor Choose the initialization style */
62 CMatrix4( eConstructor constructor = EM4CONST_IDENTITY );
63 //! Copy constructor
64 /** \param other Other matrix to copy from
65 \param constructor Choose the initialization style */
66 CMatrix4(const CMatrix4<T>& other, eConstructor constructor = EM4CONST_COPY);
67
68 //! Simple operator for directly accessing every element of the matrix.
69 T& operator()(const s32 row, const s32 col)
70 {
71#if defined ( USE_MATRIX_TEST )
72 definitelyIdentityMatrix=false;
73#endif
74 return M[ row * 4 + col ];
75 }
76
77 //! Simple operator for directly accessing every element of the matrix.
78 const T& operator()(const s32 row, const s32 col) const { return M[row * 4 + col]; }
79
80 //! Simple operator for linearly accessing every element of the matrix.
81 T& operator[](u32 index)
82 {
83#if defined ( USE_MATRIX_TEST )
84 definitelyIdentityMatrix=false;
85#endif
86 return M[index];
87 }
88
89 //! Simple operator for linearly accessing every element of the matrix.
90 const T& operator[](u32 index) const { return M[index]; }
91
92 //! Sets this matrix equal to the other matrix.
93 inline CMatrix4<T>& operator=(const CMatrix4<T> &other);
94
95 //! Sets all elements of this matrix to the value.
96 inline CMatrix4<T>& operator=(const T& scalar);
97
98 //! Returns pointer to internal array
99 const T* pointer() const { return M; }
100 T* pointer()
101 {
102#if defined ( USE_MATRIX_TEST )
103 definitelyIdentityMatrix=false;
104#endif
105 return M;
106 }
107
108 //! Returns true if other matrix is equal to this matrix.
109 bool operator==(const CMatrix4<T> &other) const;
110
111 //! Returns true if other matrix is not equal to this matrix.
112 bool operator!=(const CMatrix4<T> &other) const;
113
114 //! Add another matrix.
115 CMatrix4<T> operator+(const CMatrix4<T>& other) const;
116
117 //! Add another matrix.
118 CMatrix4<T>& operator+=(const CMatrix4<T>& other);
119
120 //! Subtract another matrix.
121 CMatrix4<T> operator-(const CMatrix4<T>& other) const;
122
123 //! Subtract another matrix.
124 CMatrix4<T>& operator-=(const CMatrix4<T>& other);
125
126 //! set this matrix to the product of two matrices
127 /** Calculate b*a */
128 inline CMatrix4<T>& setbyproduct(const CMatrix4<T>& other_a,const CMatrix4<T>& other_b );
129
130 //! Set this matrix to the product of two matrices
131 /** Calculate b*a, no optimization used,
132 use it if you know you never have a identity matrix */
133 CMatrix4<T>& setbyproduct_nocheck(const CMatrix4<T>& other_a,const CMatrix4<T>& other_b );
134
135 //! Multiply by another matrix.
136 /** Calculate other*this */
137 CMatrix4<T> operator*(const CMatrix4<T>& other) const;
138
139 //! Multiply by another matrix.
140 /** Calculate and return other*this */
141 CMatrix4<T>& operator*=(const CMatrix4<T>& other);
142
143 //! Multiply by scalar.
144 CMatrix4<T> operator*(const T& scalar) const;
145
146 //! Multiply by scalar.
147 CMatrix4<T>& operator*=(const T& scalar);
148
149 //! Set matrix to identity.
150 inline CMatrix4<T>& makeIdentity();
151
152 //! Returns true if the matrix is the identity matrix
153 inline bool isIdentity() const;
154
155 //! Returns true if the matrix is orthogonal
156 inline bool isOrthogonal() const;
157
158 //! Returns true if the matrix is the identity matrix
159 bool isIdentity_integer_base () const;
160
161 //! Set the translation of the current matrix. Will erase any previous values.
162 CMatrix4<T>& setTranslation( const vector3d<T>& translation );
163
164 //! Gets the current translation
165 vector3d<T> getTranslation() const;
166
167 //! Set the inverse translation of the current matrix. Will erase any previous values.
168 CMatrix4<T>& setInverseTranslation( const vector3d<T>& translation );
169
170 //! Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
171 inline CMatrix4<T>& setRotationRadians( const vector3d<T>& rotation );
172
173 //! Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
174 CMatrix4<T>& setRotationDegrees( const vector3d<T>& rotation );
175
176 //! Returns the rotation, as set by setRotation().
177 /** This code was orginally written by by Chev. */
178 core::vector3d<T> getRotationDegrees() const;
179
180 //! Make an inverted rotation matrix from Euler angles.
181 /** The 4th row and column are unmodified. */
182 inline CMatrix4<T>& setInverseRotationRadians( const vector3d<T>& rotation );
183
184 //! Make an inverted rotation matrix from Euler angles.
185 /** The 4th row and column are unmodified. */
186 inline CMatrix4<T>& setInverseRotationDegrees( const vector3d<T>& rotation );
187
188 //! Make a rotation matrix from angle and axis, assuming left handed rotation.
189 /** The 4th row and column are unmodified. */
190 inline CMatrix4<T>& setRotationAxisRadians(const T& angle, const vector3d<T>& axis);
191
192 //! Set Scale
193 CMatrix4<T>& setScale( const vector3d<T>& scale );
194
195 //! Set Scale
196 CMatrix4<T>& setScale( const T scale ) { return setScale(core::vector3d<T>(scale,scale,scale)); }
197
198 //! Get Scale
199 core::vector3d<T> getScale() const;
200
201 //! Translate a vector by the inverse of the translation part of this matrix.
202 void inverseTranslateVect( vector3df& vect ) const;
203
204 //! Rotate a vector by the inverse of the rotation part of this matrix.
205 void inverseRotateVect( vector3df& vect ) const;
206
207 //! Rotate a vector by the rotation part of this matrix.
208 void rotateVect( vector3df& vect ) const;
209
210 //! An alternate transform vector method, writing into a second vector
211 void rotateVect(core::vector3df& out, const core::vector3df& in) const;
212
213 //! An alternate transform vector method, writing into an array of 3 floats
214 void rotateVect(T *out,const core::vector3df &in) const;
215
216 //! Transforms the vector by this matrix
217 void transformVect( vector3df& vect) const;
218
219 //! Transforms input vector by this matrix and stores result in output vector
220 void transformVect( vector3df& out, const vector3df& in ) const;
221
222 //! An alternate transform vector method, writing into an array of 4 floats
223 void transformVect(T *out,const core::vector3df &in) const;
224
225 //! An alternate transform vector method, reading from and writing to an array of 3 floats
226 void transformVec3(T *out, const T * in) const;
227
228 //! Translate a vector by the translation part of this matrix.
229 void translateVect( vector3df& vect ) const;
230
231 //! Transforms a plane by this matrix
232 void transformPlane( core::plane3d<f32> &plane) const;
233
234 //! Transforms a plane by this matrix
235 void transformPlane( const core::plane3d<f32> &in, core::plane3d<f32> &out) const;
236
237 //! Transforms a axis aligned bounding box
238 /** The result box of this operation may not be accurate at all. For
239 correct results, use transformBoxEx() */
240 void transformBox(core::aabbox3d<f32>& box) const;
241
242 //! Transforms a axis aligned bounding box
243 /** The result box of this operation should by accurate, but this operation
244 is slower than transformBox(). */
245 void transformBoxEx(core::aabbox3d<f32>& box) const;
246
247 //! Multiplies this matrix by a 1x4 matrix
248 void multiplyWith1x4Matrix(T* matrix) const;
249
250 //! Calculates inverse of matrix. Slow.
251 /** \return Returns false if there is no inverse matrix.*/
252 bool makeInverse();
253
254
255 //! Inverts a primitive matrix which only contains a translation and a rotation
256 /** \param out: where result matrix is written to. */
257 bool getInversePrimitive ( CMatrix4<T>& out ) const;
258
259 //! Gets the inversed matrix of this one
260 /** \param out: where result matrix is written to.
261 \return Returns false if there is no inverse matrix. */
262 bool getInverse(CMatrix4<T>& out) const;
263
264 //! Builds a right-handed perspective projection matrix based on a field of view
265 CMatrix4<T>& buildProjectionMatrixPerspectiveFovRH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar);
266
267 //! Builds a left-handed perspective projection matrix based on a field of view
268 CMatrix4<T>& buildProjectionMatrixPerspectiveFovLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar);
269
270 //! Builds a left-handed perspective projection matrix based on a field of view, with far plane at infinity
271 CMatrix4<T>& buildProjectionMatrixPerspectiveFovInfinityLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 epsilon=0);
272
273 //! Builds a right-handed perspective projection matrix.
274 CMatrix4<T>& buildProjectionMatrixPerspectiveRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar);
275
276 //! Builds a left-handed perspective projection matrix.
277 CMatrix4<T>& buildProjectionMatrixPerspectiveLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar);
278
279 //! Builds a left-handed orthogonal projection matrix.
280 CMatrix4<T>& buildProjectionMatrixOrthoLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar);
281
282 //! Builds a right-handed orthogonal projection matrix.
283 CMatrix4<T>& buildProjectionMatrixOrthoRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar);
284
285 //! Builds a left-handed look-at matrix.
286 CMatrix4<T>& buildCameraLookAtMatrixLH(
287 const vector3df& position,
288 const vector3df& target,
289 const vector3df& upVector);
290
291 //! Builds a right-handed look-at matrix.
292 CMatrix4<T>& buildCameraLookAtMatrixRH(
293 const vector3df& position,
294 const vector3df& target,
295 const vector3df& upVector);
296
297 //! Builds a matrix that flattens geometry into a plane.
298 /** \param light: light source
299 \param plane: plane into which the geometry if flattened into
300 \param point: value between 0 and 1, describing the light source.
301 If this is 1, it is a point light, if it is 0, it is a directional light. */
302 CMatrix4<T>& buildShadowMatrix(const core::vector3df& light, core::plane3df plane, f32 point=1.0f);
303
304 //! Builds a matrix which transforms a normalized Device Coordinate to Device Coordinates.
305 /** Used to scale <-1,-1><1,1> to viewport, for example from <-1,-1> <1,1> to the viewport <0,0><0,640> */
306 CMatrix4<T>& buildNDCToDCMatrix( const core::rect<s32>& area, f32 zScale);
307
308 //! Creates a new matrix as interpolated matrix from two other ones.
309 /** \param b: other matrix to interpolate with
310 \param time: Must be a value between 0 and 1. */
311 CMatrix4<T> interpolate(const core::CMatrix4<T>& b, f32 time) const;
312
313 //! Gets transposed matrix
314 CMatrix4<T> getTransposed() const;
315
316 //! Gets transposed matrix
317 inline void getTransposed( CMatrix4<T>& dest ) const;
318
319 //! Builds a matrix that rotates from one vector to another
320 /** \param from: vector to rotate from
321 \param to: vector to rotate to
322 */
323 CMatrix4<T>& buildRotateFromTo(const core::vector3df& from, const core::vector3df& to);
324
325 //! Builds a combined matrix which translates to a center before rotation and translates from origin afterwards
326 /** \param center Position to rotate around
327 \param translate Translation applied after the rotation
328 */
329 void setRotationCenter(const core::vector3df& center, const core::vector3df& translate);
330
331 //! Builds a matrix which rotates a source vector to a look vector over an arbitrary axis
332 /** \param camPos: viewer position in world coo
333 \param center: object position in world-coo and rotation pivot
334 \param translation: object final translation from center
335 \param axis: axis to rotate about
336 \param from: source vector to rotate from
337 */
338 void buildAxisAlignedBillboard(const core::vector3df& camPos,
339 const core::vector3df& center,
340 const core::vector3df& translation,
341 const core::vector3df& axis,
342 const core::vector3df& from);
343
344 /*
345 construct 2D Texture transformations
346 rotate about center, scale, and transform.
347 */
348 //! Set to a texture transformation matrix with the given parameters.
349 CMatrix4<T>& buildTextureTransform( f32 rotateRad,
350 const core::vector2df &rotatecenter,
351 const core::vector2df &translate,
352 const core::vector2df &scale);
353
354 //! Set texture transformation rotation
355 /** Rotate about z axis, recenter at (0.5,0.5).
356 Doesn't clear other elements than those affected
357 \param radAngle Angle in radians
358 \return Altered matrix */
359 CMatrix4<T>& setTextureRotationCenter( f32 radAngle );
360
361 //! Set texture transformation translation
362 /** Doesn't clear other elements than those affected.
363 \param x Offset on x axis
364 \param y Offset on y axis
365 \return Altered matrix */
366 CMatrix4<T>& setTextureTranslate( f32 x, f32 y );
367
368 //! Set texture transformation translation, using a transposed representation
369 /** Doesn't clear other elements than those affected.
370 \param x Offset on x axis
371 \param y Offset on y axis
372 \return Altered matrix */
373 CMatrix4<T>& setTextureTranslateTransposed( f32 x, f32 y );
374
375 //! Set texture transformation scale
376 /** Doesn't clear other elements than those affected.
377 \param sx Scale factor on x axis
378 \param sy Scale factor on y axis
379 \return Altered matrix. */
380 CMatrix4<T>& setTextureScale( f32 sx, f32 sy );
381
382 //! Set texture transformation scale, and recenter at (0.5,0.5)
383 /** Doesn't clear other elements than those affected.
384 \param sx Scale factor on x axis
385 \param sy Scale factor on y axis
386 \return Altered matrix. */
387 CMatrix4<T>& setTextureScaleCenter( f32 sx, f32 sy );
388
389 //! Sets all matrix data members at once
390 CMatrix4<T>& setM(const T* data);
391
392 //! Sets if the matrix is definitely identity matrix
393 void setDefinitelyIdentityMatrix( bool isDefinitelyIdentityMatrix);
394
395 //! Gets if the matrix is definitely identity matrix
396 bool getDefinitelyIdentityMatrix() const;
397
398 //! Compare two matrices using the equal method
399 bool equals(const core::CMatrix4<T>& other, const T tolerance=(T)ROUNDING_ERROR_f64) const;
400
401 private:
402 //! Matrix data, stored in row-major order
403 T M[16];
404#if defined ( USE_MATRIX_TEST )
405 //! Flag is this matrix is identity matrix
406 mutable u32 definitelyIdentityMatrix;
407#endif
408#if defined ( USE_MATRIX_TEST_DEBUG )
409 u32 id;
410 mutable u32 calls;
411#endif
412
413 };
414
415 // Default constructor
416 template <class T>
417 inline CMatrix4<T>::CMatrix4( eConstructor constructor )
418#if defined ( USE_MATRIX_TEST )
419 : definitelyIdentityMatrix(BIT_UNTESTED)
420#endif
421#if defined ( USE_MATRIX_TEST_DEBUG )
422 ,id ( MTest.ID++), calls ( 0 )
423#endif
424 {
425 switch ( constructor )
426 {
427 case EM4CONST_NOTHING:
428 case EM4CONST_COPY:
429 break;
430 case EM4CONST_IDENTITY:
431 case EM4CONST_INVERSE:
432 default:
433 makeIdentity();
434 break;
435 }
436 }
437
438 // Copy constructor
439 template <class T>
440 inline CMatrix4<T>::CMatrix4( const CMatrix4<T>& other, eConstructor constructor)
441#if defined ( USE_MATRIX_TEST )
442 : definitelyIdentityMatrix(BIT_UNTESTED)
443#endif
444#if defined ( USE_MATRIX_TEST_DEBUG )
445 ,id ( MTest.ID++), calls ( 0 )
446#endif
447 {
448 switch ( constructor )
449 {
450 case EM4CONST_IDENTITY:
451 makeIdentity();
452 break;
453 case EM4CONST_NOTHING:
454 break;
455 case EM4CONST_COPY:
456 *this = other;
457 break;
458 case EM4CONST_TRANSPOSED:
459 other.getTransposed(*this);
460 break;
461 case EM4CONST_INVERSE:
462 if (!other.getInverse(*this))
463 memset(M, 0, 16*sizeof(T));
464 break;
465 case EM4CONST_INVERSE_TRANSPOSED:
466 if (!other.getInverse(*this))
467 memset(M, 0, 16*sizeof(T));
468 else
469 *this=getTransposed();
470 break;
471 }
472 }
473
474 //! Add another matrix.
475 template <class T>
476 inline CMatrix4<T> CMatrix4<T>::operator+(const CMatrix4<T>& other) const
477 {
478 CMatrix4<T> temp ( EM4CONST_NOTHING );
479
480 temp[0] = M[0]+other[0];
481 temp[1] = M[1]+other[1];
482 temp[2] = M[2]+other[2];
483 temp[3] = M[3]+other[3];
484 temp[4] = M[4]+other[4];
485 temp[5] = M[5]+other[5];
486 temp[6] = M[6]+other[6];
487 temp[7] = M[7]+other[7];
488 temp[8] = M[8]+other[8];
489 temp[9] = M[9]+other[9];
490 temp[10] = M[10]+other[10];
491 temp[11] = M[11]+other[11];
492 temp[12] = M[12]+other[12];
493 temp[13] = M[13]+other[13];
494 temp[14] = M[14]+other[14];
495 temp[15] = M[15]+other[15];
496
497 return temp;
498 }
499
500 //! Add another matrix.
501 template <class T>
502 inline CMatrix4<T>& CMatrix4<T>::operator+=(const CMatrix4<T>& other)
503 {
504 M[0]+=other[0];
505 M[1]+=other[1];
506 M[2]+=other[2];
507 M[3]+=other[3];
508 M[4]+=other[4];
509 M[5]+=other[5];
510 M[6]+=other[6];
511 M[7]+=other[7];
512 M[8]+=other[8];
513 M[9]+=other[9];
514 M[10]+=other[10];
515 M[11]+=other[11];
516 M[12]+=other[12];
517 M[13]+=other[13];
518 M[14]+=other[14];
519 M[15]+=other[15];
520
521 return *this;
522 }
523
524 //! Subtract another matrix.
525 template <class T>
526 inline CMatrix4<T> CMatrix4<T>::operator-(const CMatrix4<T>& other) const
527 {
528 CMatrix4<T> temp ( EM4CONST_NOTHING );
529
530 temp[0] = M[0]-other[0];
531 temp[1] = M[1]-other[1];
532 temp[2] = M[2]-other[2];
533 temp[3] = M[3]-other[3];
534 temp[4] = M[4]-other[4];
535 temp[5] = M[5]-other[5];
536 temp[6] = M[6]-other[6];
537 temp[7] = M[7]-other[7];
538 temp[8] = M[8]-other[8];
539 temp[9] = M[9]-other[9];
540 temp[10] = M[10]-other[10];
541 temp[11] = M[11]-other[11];
542 temp[12] = M[12]-other[12];
543 temp[13] = M[13]-other[13];
544 temp[14] = M[14]-other[14];
545 temp[15] = M[15]-other[15];
546
547 return temp;
548 }
549
550 //! Subtract another matrix.
551 template <class T>
552 inline CMatrix4<T>& CMatrix4<T>::operator-=(const CMatrix4<T>& other)
553 {
554 M[0]-=other[0];
555 M[1]-=other[1];
556 M[2]-=other[2];
557 M[3]-=other[3];
558 M[4]-=other[4];
559 M[5]-=other[5];
560 M[6]-=other[6];
561 M[7]-=other[7];
562 M[8]-=other[8];
563 M[9]-=other[9];
564 M[10]-=other[10];
565 M[11]-=other[11];
566 M[12]-=other[12];
567 M[13]-=other[13];
568 M[14]-=other[14];
569 M[15]-=other[15];
570
571 return *this;
572 }
573
574 //! Multiply by scalar.
575 template <class T>
576 inline CMatrix4<T> CMatrix4<T>::operator*(const T& scalar) const
577 {
578 CMatrix4<T> temp ( EM4CONST_NOTHING );
579
580 temp[0] = M[0]*scalar;
581 temp[1] = M[1]*scalar;
582 temp[2] = M[2]*scalar;
583 temp[3] = M[3]*scalar;
584 temp[4] = M[4]*scalar;
585 temp[5] = M[5]*scalar;
586 temp[6] = M[6]*scalar;
587 temp[7] = M[7]*scalar;
588 temp[8] = M[8]*scalar;
589 temp[9] = M[9]*scalar;
590 temp[10] = M[10]*scalar;
591 temp[11] = M[11]*scalar;
592 temp[12] = M[12]*scalar;
593 temp[13] = M[13]*scalar;
594 temp[14] = M[14]*scalar;
595 temp[15] = M[15]*scalar;
596
597 return temp;
598 }
599
600 //! Multiply by scalar.
601 template <class T>
602 inline CMatrix4<T>& CMatrix4<T>::operator*=(const T& scalar)
603 {
604 M[0]*=scalar;
605 M[1]*=scalar;
606 M[2]*=scalar;
607 M[3]*=scalar;
608 M[4]*=scalar;
609 M[5]*=scalar;
610 M[6]*=scalar;
611 M[7]*=scalar;
612 M[8]*=scalar;
613 M[9]*=scalar;
614 M[10]*=scalar;
615 M[11]*=scalar;
616 M[12]*=scalar;
617 M[13]*=scalar;
618 M[14]*=scalar;
619 M[15]*=scalar;
620
621 return *this;
622 }
623
624 //! Multiply by another matrix.
625 template <class T>
626 inline CMatrix4<T>& CMatrix4<T>::operator*=(const CMatrix4<T>& other)
627 {
628#if defined ( USE_MATRIX_TEST )
629 // do checks on your own in order to avoid copy creation
630 if ( !other.isIdentity() )
631 {
632 if ( this->isIdentity() )
633 {
634 return (*this = other);
635 }
636 else
637 {
638 CMatrix4<T> temp ( *this );
639 return setbyproduct_nocheck( temp, other );
640 }
641 }
642 return *this;
643#else
644 CMatrix4<T> temp ( *this );
645 return setbyproduct_nocheck( temp, other );
646#endif
647 }
648
649 //! multiply by another matrix
650 // set this matrix to the product of two other matrices
651 // goal is to reduce stack use and copy
652 template <class T>
653 inline CMatrix4<T>& CMatrix4<T>::setbyproduct_nocheck(const CMatrix4<T>& other_a,const CMatrix4<T>& other_b )
654 {
655 const T *m1 = other_a.M;
656 const T *m2 = other_b.M;
657
658 M[0] = m1[0]*m2[0] + m1[4]*m2[1] + m1[8]*m2[2] + m1[12]*m2[3];
659 M[1] = m1[1]*m2[0] + m1[5]*m2[1] + m1[9]*m2[2] + m1[13]*m2[3];
660 M[2] = m1[2]*m2[0] + m1[6]*m2[1] + m1[10]*m2[2] + m1[14]*m2[3];
661 M[3] = m1[3]*m2[0] + m1[7]*m2[1] + m1[11]*m2[2] + m1[15]*m2[3];
662
663 M[4] = m1[0]*m2[4] + m1[4]*m2[5] + m1[8]*m2[6] + m1[12]*m2[7];
664 M[5] = m1[1]*m2[4] + m1[5]*m2[5] + m1[9]*m2[6] + m1[13]*m2[7];
665 M[6] = m1[2]*m2[4] + m1[6]*m2[5] + m1[10]*m2[6] + m1[14]*m2[7];
666 M[7] = m1[3]*m2[4] + m1[7]*m2[5] + m1[11]*m2[6] + m1[15]*m2[7];
667
668 M[8] = m1[0]*m2[8] + m1[4]*m2[9] + m1[8]*m2[10] + m1[12]*m2[11];
669 M[9] = m1[1]*m2[8] + m1[5]*m2[9] + m1[9]*m2[10] + m1[13]*m2[11];
670 M[10] = m1[2]*m2[8] + m1[6]*m2[9] + m1[10]*m2[10] + m1[14]*m2[11];
671 M[11] = m1[3]*m2[8] + m1[7]*m2[9] + m1[11]*m2[10] + m1[15]*m2[11];
672
673 M[12] = m1[0]*m2[12] + m1[4]*m2[13] + m1[8]*m2[14] + m1[12]*m2[15];
674 M[13] = m1[1]*m2[12] + m1[5]*m2[13] + m1[9]*m2[14] + m1[13]*m2[15];
675 M[14] = m1[2]*m2[12] + m1[6]*m2[13] + m1[10]*m2[14] + m1[14]*m2[15];
676 M[15] = m1[3]*m2[12] + m1[7]*m2[13] + m1[11]*m2[14] + m1[15]*m2[15];
677#if defined ( USE_MATRIX_TEST )
678 definitelyIdentityMatrix=false;
679#endif
680 return *this;
681 }
682
683
684 //! multiply by another matrix
685 // set this matrix to the product of two other matrices
686 // goal is to reduce stack use and copy
687 template <class T>
688 inline CMatrix4<T>& CMatrix4<T>::setbyproduct(const CMatrix4<T>& other_a, const CMatrix4<T>& other_b )
689 {
690#if defined ( USE_MATRIX_TEST )
691 if ( other_a.isIdentity () )
692 return (*this = other_b);
693 else
694 if ( other_b.isIdentity () )
695 return (*this = other_a);
696 else
697 return setbyproduct_nocheck(other_a,other_b);
698#else
699 return setbyproduct_nocheck(other_a,other_b);
700#endif
701 }
702
703 //! multiply by another matrix
704 template <class T>
705 inline CMatrix4<T> CMatrix4<T>::operator*(const CMatrix4<T>& m2) const
706 {
707#if defined ( USE_MATRIX_TEST )
708 // Testing purpose..
709 if ( this->isIdentity() )
710 return m2;
711 if ( m2.isIdentity() )
712 return *this;
713#endif
714
715 CMatrix4<T> m3 ( EM4CONST_NOTHING );
716
717 const T *m1 = M;
718
719 m3[0] = m1[0]*m2[0] + m1[4]*m2[1] + m1[8]*m2[2] + m1[12]*m2[3];
720 m3[1] = m1[1]*m2[0] + m1[5]*m2[1] + m1[9]*m2[2] + m1[13]*m2[3];
721 m3[2] = m1[2]*m2[0] + m1[6]*m2[1] + m1[10]*m2[2] + m1[14]*m2[3];
722 m3[3] = m1[3]*m2[0] + m1[7]*m2[1] + m1[11]*m2[2] + m1[15]*m2[3];
723
724 m3[4] = m1[0]*m2[4] + m1[4]*m2[5] + m1[8]*m2[6] + m1[12]*m2[7];
725 m3[5] = m1[1]*m2[4] + m1[5]*m2[5] + m1[9]*m2[6] + m1[13]*m2[7];
726 m3[6] = m1[2]*m2[4] + m1[6]*m2[5] + m1[10]*m2[6] + m1[14]*m2[7];
727 m3[7] = m1[3]*m2[4] + m1[7]*m2[5] + m1[11]*m2[6] + m1[15]*m2[7];
728
729 m3[8] = m1[0]*m2[8] + m1[4]*m2[9] + m1[8]*m2[10] + m1[12]*m2[11];
730 m3[9] = m1[1]*m2[8] + m1[5]*m2[9] + m1[9]*m2[10] + m1[13]*m2[11];
731 m3[10] = m1[2]*m2[8] + m1[6]*m2[9] + m1[10]*m2[10] + m1[14]*m2[11];
732 m3[11] = m1[3]*m2[8] + m1[7]*m2[9] + m1[11]*m2[10] + m1[15]*m2[11];
733
734 m3[12] = m1[0]*m2[12] + m1[4]*m2[13] + m1[8]*m2[14] + m1[12]*m2[15];
735 m3[13] = m1[1]*m2[12] + m1[5]*m2[13] + m1[9]*m2[14] + m1[13]*m2[15];
736 m3[14] = m1[2]*m2[12] + m1[6]*m2[13] + m1[10]*m2[14] + m1[14]*m2[15];
737 m3[15] = m1[3]*m2[12] + m1[7]*m2[13] + m1[11]*m2[14] + m1[15]*m2[15];
738 return m3;
739 }
740
741
742
743 template <class T>
744 inline vector3d<T> CMatrix4<T>::getTranslation() const
745 {
746 return vector3d<T>(M[12], M[13], M[14]);
747 }
748
749
750 template <class T>
751 inline CMatrix4<T>& CMatrix4<T>::setTranslation( const vector3d<T>& translation )
752 {
753 M[12] = translation.X;
754 M[13] = translation.Y;
755 M[14] = translation.Z;
756#if defined ( USE_MATRIX_TEST )
757 definitelyIdentityMatrix=false;
758#endif
759 return *this;
760 }
761
762 template <class T>
763 inline CMatrix4<T>& CMatrix4<T>::setInverseTranslation( const vector3d<T>& translation )
764 {
765 M[12] = -translation.X;
766 M[13] = -translation.Y;
767 M[14] = -translation.Z;
768#if defined ( USE_MATRIX_TEST )
769 definitelyIdentityMatrix=false;
770#endif
771 return *this;
772 }
773
774 template <class T>
775 inline CMatrix4<T>& CMatrix4<T>::setScale( const vector3d<T>& scale )
776 {
777 M[0] = scale.X;
778 M[5] = scale.Y;
779 M[10] = scale.Z;
780#if defined ( USE_MATRIX_TEST )
781 definitelyIdentityMatrix=false;
782#endif
783 return *this;
784 }
785
786 //! Returns the absolute values of the scales of the matrix.
787 /**
788 Note that this returns the absolute (positive) values unless only scale is set.
789 Unfortunately it does not appear to be possible to extract any original negative
790 values. The best that we could do would be to arbitrarily make one scale
791 negative if one or three of them were negative.
792 FIXME - return the original values.
793 */
794 template <class T>
795 inline vector3d<T> CMatrix4<T>::getScale() const
796 {
797 // See http://www.robertblum.com/articles/2005/02/14/decomposing-matrices
798
799 // Deal with the 0 rotation case first
800 // Prior to Irrlicht 1.6, we always returned this value.
801 if(core::iszero(M[1]) && core::iszero(M[2]) &&
802 core::iszero(M[4]) && core::iszero(M[6]) &&
803 core::iszero(M[8]) && core::iszero(M[9]))
804 return vector3d<T>(M[0], M[5], M[10]);
805
806 // We have to do the full calculation.
807 return vector3d<T>(sqrtf(M[0] * M[0] + M[1] * M[1] + M[2] * M[2]),
808 sqrtf(M[4] * M[4] + M[5] * M[5] + M[6] * M[6]),
809 sqrtf(M[8] * M[8] + M[9] * M[9] + M[10] * M[10]));
810 }
811
812 template <class T>
813 inline CMatrix4<T>& CMatrix4<T>::setRotationDegrees( const vector3d<T>& rotation )
814 {
815 return setRotationRadians( rotation * core::DEGTORAD );
816 }
817
818 template <class T>
819 inline CMatrix4<T>& CMatrix4<T>::setInverseRotationDegrees( const vector3d<T>& rotation )
820 {
821 return setInverseRotationRadians( rotation * core::DEGTORAD );
822 }
823
824 template <class T>
825 inline CMatrix4<T>& CMatrix4<T>::setRotationRadians( const vector3d<T>& rotation )
826 {
827 const f64 cr = cos( rotation.X );
828 const f64 sr = sin( rotation.X );
829 const f64 cp = cos( rotation.Y );
830 const f64 sp = sin( rotation.Y );
831 const f64 cy = cos( rotation.Z );
832 const f64 sy = sin( rotation.Z );
833
834 M[0] = (T)( cp*cy );
835 M[1] = (T)( cp*sy );
836 M[2] = (T)( -sp );
837
838 const f64 srsp = sr*sp;
839 const f64 crsp = cr*sp;
840
841 M[4] = (T)( srsp*cy-cr*sy );
842 M[5] = (T)( srsp*sy+cr*cy );
843 M[6] = (T)( sr*cp );
844
845 M[8] = (T)( crsp*cy+sr*sy );
846 M[9] = (T)( crsp*sy-sr*cy );
847 M[10] = (T)( cr*cp );
848#if defined ( USE_MATRIX_TEST )
849 definitelyIdentityMatrix=false;
850#endif
851 return *this;
852 }
853
854
855 //! Returns a rotation that is equivalent to that set by setRotationDegrees().
856 /** This code was sent in by Chev. Note that it does not necessarily return
857 the *same* Euler angles as those set by setRotationDegrees(), but the rotation will
858 be equivalent, i.e. will have the same result when used to rotate a vector or node. */
859 template <class T>
860 inline core::vector3d<T> CMatrix4<T>::getRotationDegrees() const
861 {
862 const CMatrix4<T> &mat = *this;
863 core::vector3d<T> scale = getScale();
864 // we need to check for negative scale on to axes, which would bring up wrong results
865 if (scale.Y<0 && scale.Z<0)
866 {
867 scale.Y =-scale.Y;
868 scale.Z =-scale.Z;
869 }
870 else if (scale.X<0 && scale.Z<0)
871 {
872 scale.X =-scale.X;
873 scale.Z =-scale.Z;
874 }
875 else if (scale.X<0 && scale.Y<0)
876 {
877 scale.X =-scale.X;
878 scale.Y =-scale.Y;
879 }
880 const core::vector3d<f64> invScale(core::reciprocal(scale.X),core::reciprocal(scale.Y),core::reciprocal(scale.Z));
881
882 f64 Y = -asin(core::clamp(mat[2]*invScale.X, -1.0, 1.0));
883 const f64 C = cos(Y);
884 Y *= RADTODEG64;
885
886 f64 rotx, roty, X, Z;
887
888 if (!core::iszero(C))
889 {
890 const f64 invC = core::reciprocal(C);
891 rotx = mat[10] * invC * invScale.Z;
892 roty = mat[6] * invC * invScale.Y;
893 X = atan2( roty, rotx ) * RADTODEG64;
894 rotx = mat[0] * invC * invScale.X;
895 roty = mat[1] * invC * invScale.X;
896 Z = atan2( roty, rotx ) * RADTODEG64;
897 }
898 else
899 {
900 X = 0.0;
901 rotx = mat[5] * invScale.Y;
902 roty = -mat[4] * invScale.Y;
903 Z = atan2( roty, rotx ) * RADTODEG64;
904 }
905
906 // fix values that get below zero
907 if (X < 0.0) X += 360.0;
908 if (Y < 0.0) Y += 360.0;
909 if (Z < 0.0) Z += 360.0;
910
911 return vector3d<T>((T)X,(T)Y,(T)Z);
912 }
913
914
915 //! Sets matrix to rotation matrix of inverse angles given as parameters
916 template <class T>
917 inline CMatrix4<T>& CMatrix4<T>::setInverseRotationRadians( const vector3d<T>& rotation )
918 {
919 f64 cr = cos( rotation.X );
920 f64 sr = sin( rotation.X );
921 f64 cp = cos( rotation.Y );
922 f64 sp = sin( rotation.Y );
923 f64 cy = cos( rotation.Z );
924 f64 sy = sin( rotation.Z );
925
926 M[0] = (T)( cp*cy );
927 M[4] = (T)( cp*sy );
928 M[8] = (T)( -sp );
929
930 f64 srsp = sr*sp;
931 f64 crsp = cr*sp;
932
933 M[1] = (T)( srsp*cy-cr*sy );
934 M[5] = (T)( srsp*sy+cr*cy );
935 M[9] = (T)( sr*cp );
936
937 M[2] = (T)( crsp*cy+sr*sy );
938 M[6] = (T)( crsp*sy-sr*cy );
939 M[10] = (T)( cr*cp );
940#if defined ( USE_MATRIX_TEST )
941 definitelyIdentityMatrix=false;
942#endif
943 return *this;
944 }
945
946 //! Sets matrix to rotation matrix defined by axis and angle, assuming LH rotation
947 template <class T>
948 inline CMatrix4<T>& CMatrix4<T>::setRotationAxisRadians( const T& angle, const vector3d<T>& axis )
949 {
950 const f64 c = cos(angle);
951 const f64 s = sin(angle);
952 const f64 t = 1.0 - c;
953
954 const f64 tx = t * axis.X;
955 const f64 ty = t * axis.Y;
956 const f64 tz = t * axis.Z;
957
958 const f64 sx = s * axis.X;
959 const f64 sy = s * axis.Y;
960 const f64 sz = s * axis.Z;
961
962 M[0] = (T)(tx * axis.X + c);
963 M[1] = (T)(tx * axis.Y + sz);
964 M[2] = (T)(tx * axis.Z - sy);
965
966 M[4] = (T)(ty * axis.X - sz);
967 M[5] = (T)(ty * axis.Y + c);
968 M[6] = (T)(ty * axis.Z + sx);
969
970 M[8] = (T)(tz * axis.X + sy);
971 M[9] = (T)(tz * axis.Y - sx);
972 M[10] = (T)(tz * axis.Z + c);
973
974#if defined ( USE_MATRIX_TEST )
975 definitelyIdentityMatrix=false;
976#endif
977 return *this;
978 }
979
980
981 /*!
982 */
983 template <class T>
984 inline CMatrix4<T>& CMatrix4<T>::makeIdentity()
985 {
986 memset(M, 0, 16*sizeof(T));
987 M[0] = M[5] = M[10] = M[15] = (T)1;
988#if defined ( USE_MATRIX_TEST )
989 definitelyIdentityMatrix=true;
990#endif
991 return *this;
992 }
993
994
995 /*
996 check identity with epsilon
997 solve floating range problems..
998 */
999 template <class T>
1000 inline bool CMatrix4<T>::isIdentity() const
1001 {
1002#if defined ( USE_MATRIX_TEST )
1003 if (definitelyIdentityMatrix)
1004 return true;
1005#endif
1006 if (!core::equals( M[12], (T)0 ) || !core::equals( M[13], (T)0 ) || !core::equals( M[14], (T)0 ) || !core::equals( M[15], (T)1 ))
1007 return false;
1008
1009 if (!core::equals( M[ 0], (T)1 ) || !core::equals( M[ 1], (T)0 ) || !core::equals( M[ 2], (T)0 ) || !core::equals( M[ 3], (T)0 ))
1010 return false;
1011
1012 if (!core::equals( M[ 4], (T)0 ) || !core::equals( M[ 5], (T)1 ) || !core::equals( M[ 6], (T)0 ) || !core::equals( M[ 7], (T)0 ))
1013 return false;
1014
1015 if (!core::equals( M[ 8], (T)0 ) || !core::equals( M[ 9], (T)0 ) || !core::equals( M[10], (T)1 ) || !core::equals( M[11], (T)0 ))
1016 return false;
1017/*
1018 if (!core::equals( M[ 0], (T)1 ) ||
1019 !core::equals( M[ 5], (T)1 ) ||
1020 !core::equals( M[10], (T)1 ) ||
1021 !core::equals( M[15], (T)1 ))
1022 return false;
1023
1024 for (s32 i=0; i<4; ++i)
1025 for (s32 j=0; j<4; ++j)
1026 if ((j != i) && (!iszero((*this)(i,j))))
1027 return false;
1028*/
1029#if defined ( USE_MATRIX_TEST )
1030 definitelyIdentityMatrix=true;
1031#endif
1032 return true;
1033 }
1034
1035
1036 /* Check orthogonality of matrix. */
1037 template <class T>
1038 inline bool CMatrix4<T>::isOrthogonal() const
1039 {
1040 T dp=M[0] * M[4 ] + M[1] * M[5 ] + M[2 ] * M[6 ] + M[3 ] * M[7 ];
1041 if (!iszero(dp))
1042 return false;
1043 dp = M[0] * M[8 ] + M[1] * M[9 ] + M[2 ] * M[10] + M[3 ] * M[11];
1044 if (!iszero(dp))
1045 return false;
1046 dp = M[0] * M[12] + M[1] * M[13] + M[2 ] * M[14] + M[3 ] * M[15];
1047 if (!iszero(dp))
1048 return false;
1049 dp = M[4] * M[8 ] + M[5] * M[9 ] + M[6 ] * M[10] + M[7 ] * M[11];
1050 if (!iszero(dp))
1051 return false;
1052 dp = M[4] * M[12] + M[5] * M[13] + M[6 ] * M[14] + M[7 ] * M[15];
1053 if (!iszero(dp))
1054 return false;
1055 dp = M[8] * M[12] + M[9] * M[13] + M[10] * M[14] + M[11] * M[15];
1056 return (iszero(dp));
1057 }
1058
1059
1060 /*
1061 doesn't solve floating range problems..
1062 but takes care on +/- 0 on translation because we are changing it..
1063 reducing floating point branches
1064 but it needs the floats in memory..
1065 */
1066 template <class T>
1067 inline bool CMatrix4<T>::isIdentity_integer_base() const
1068 {
1069#if defined ( USE_MATRIX_TEST )
1070 if (definitelyIdentityMatrix)
1071 return true;
1072#endif
1073 if(IR(M[0])!=F32_VALUE_1) return false;
1074 if(IR(M[1])!=0) return false;
1075 if(IR(M[2])!=0) return false;
1076 if(IR(M[3])!=0) return false;
1077
1078 if(IR(M[4])!=0) return false;
1079 if(IR(M[5])!=F32_VALUE_1) return false;
1080 if(IR(M[6])!=0) return false;
1081 if(IR(M[7])!=0) return false;
1082
1083 if(IR(M[8])!=0) return false;
1084 if(IR(M[9])!=0) return false;
1085 if(IR(M[10])!=F32_VALUE_1) return false;
1086 if(IR(M[11])!=0) return false;
1087
1088 if(IR(M[12])!=0) return false;
1089 if(IR(M[13])!=0) return false;
1090 if(IR(M[13])!=0) return false;
1091 if(IR(M[15])!=F32_VALUE_1) return false;
1092
1093#if defined ( USE_MATRIX_TEST )
1094 definitelyIdentityMatrix=true;
1095#endif
1096 return true;
1097 }
1098
1099
1100 template <class T>
1101 inline void CMatrix4<T>::rotateVect( vector3df& vect ) const
1102 {
1103 vector3df tmp = vect;
1104 vect.X = tmp.X*M[0] + tmp.Y*M[4] + tmp.Z*M[8];
1105 vect.Y = tmp.X*M[1] + tmp.Y*M[5] + tmp.Z*M[9];
1106 vect.Z = tmp.X*M[2] + tmp.Y*M[6] + tmp.Z*M[10];
1107 }
1108
1109 //! An alternate transform vector method, writing into a second vector
1110 template <class T>
1111 inline void CMatrix4<T>::rotateVect(core::vector3df& out, const core::vector3df& in) const
1112 {
1113 out.X = in.X*M[0] + in.Y*M[4] + in.Z*M[8];
1114 out.Y = in.X*M[1] + in.Y*M[5] + in.Z*M[9];
1115 out.Z = in.X*M[2] + in.Y*M[6] + in.Z*M[10];
1116 }
1117
1118 //! An alternate transform vector method, writing into an array of 3 floats
1119 template <class T>
1120 inline void CMatrix4<T>::rotateVect(T *out, const core::vector3df& in) const
1121 {
1122 out[0] = in.X*M[0] + in.Y*M[4] + in.Z*M[8];
1123 out[1] = in.X*M[1] + in.Y*M[5] + in.Z*M[9];
1124 out[2] = in.X*M[2] + in.Y*M[6] + in.Z*M[10];
1125 }
1126
1127 template <class T>
1128 inline void CMatrix4<T>::inverseRotateVect( vector3df& vect ) const
1129 {
1130 vector3df tmp = vect;
1131 vect.X = tmp.X*M[0] + tmp.Y*M[1] + tmp.Z*M[2];
1132 vect.Y = tmp.X*M[4] + tmp.Y*M[5] + tmp.Z*M[6];
1133 vect.Z = tmp.X*M[8] + tmp.Y*M[9] + tmp.Z*M[10];
1134 }
1135
1136 template <class T>
1137 inline void CMatrix4<T>::transformVect( vector3df& vect) const
1138 {
1139 f32 vector[3];
1140
1141 vector[0] = vect.X*M[0] + vect.Y*M[4] + vect.Z*M[8] + M[12];
1142 vector[1] = vect.X*M[1] + vect.Y*M[5] + vect.Z*M[9] + M[13];
1143 vector[2] = vect.X*M[2] + vect.Y*M[6] + vect.Z*M[10] + M[14];
1144
1145 vect.X = vector[0];
1146 vect.Y = vector[1];
1147 vect.Z = vector[2];
1148 }
1149
1150 template <class T>
1151 inline void CMatrix4<T>::transformVect( vector3df& out, const vector3df& in) const
1152 {
1153 out.X = in.X*M[0] + in.Y*M[4] + in.Z*M[8] + M[12];
1154 out.Y = in.X*M[1] + in.Y*M[5] + in.Z*M[9] + M[13];
1155 out.Z = in.X*M[2] + in.Y*M[6] + in.Z*M[10] + M[14];
1156 }
1157
1158
1159 template <class T>
1160 inline void CMatrix4<T>::transformVect(T *out, const core::vector3df &in) const
1161 {
1162 out[0] = in.X*M[0] + in.Y*M[4] + in.Z*M[8] + M[12];
1163 out[1] = in.X*M[1] + in.Y*M[5] + in.Z*M[9] + M[13];
1164 out[2] = in.X*M[2] + in.Y*M[6] + in.Z*M[10] + M[14];
1165 out[3] = in.X*M[3] + in.Y*M[7] + in.Z*M[11] + M[15];
1166 }
1167
1168 template <class T>
1169 inline void CMatrix4<T>::transformVec3(T *out, const T * in) const
1170 {
1171 out[0] = in[0]*M[0] + in[1]*M[4] + in[2]*M[8] + M[12];
1172 out[1] = in[0]*M[1] + in[1]*M[5] + in[2]*M[9] + M[13];
1173 out[2] = in[0]*M[2] + in[1]*M[6] + in[2]*M[10] + M[14];
1174 }
1175
1176
1177 //! Transforms a plane by this matrix
1178 template <class T>
1179 inline void CMatrix4<T>::transformPlane( core::plane3d<f32> &plane) const
1180 {
1181 vector3df member;
1182 // Transform the plane member point, i.e. rotate, translate and scale it.
1183 transformVect(member, plane.getMemberPoint());
1184
1185 // Transform the normal by the transposed inverse of the matrix
1186 CMatrix4<T> transposedInverse(*this, EM4CONST_INVERSE_TRANSPOSED);
1187 vector3df normal = plane.Normal;
1188 transposedInverse.transformVect(normal);
1189
1190 plane.setPlane(member, normal);
1191 }
1192
1193 //! Transforms a plane by this matrix
1194 template <class T>
1195 inline void CMatrix4<T>::transformPlane( const core::plane3d<f32> &in, core::plane3d<f32> &out) const
1196 {
1197 out = in;
1198 transformPlane( out );
1199 }
1200
1201 //! Transforms a axis aligned bounding box
1202 template <class T>
1203 inline void CMatrix4<T>::transformBox(core::aabbox3d<f32>& box) const
1204 {
1205#if defined ( USE_MATRIX_TEST )
1206 if (isIdentity())
1207 return;
1208#endif
1209
1210 transformVect(box.MinEdge);
1211 transformVect(box.MaxEdge);
1212 box.repair();
1213 }
1214
1215 //! Transforms a axis aligned bounding box more accurately than transformBox()
1216 template <class T>
1217 inline void CMatrix4<T>::transformBoxEx(core::aabbox3d<f32>& box) const
1218 {
1219#if defined ( USE_MATRIX_TEST )
1220 if (isIdentity())
1221 return;
1222#endif
1223
1224 const f32 Amin[3] = {box.MinEdge.X, box.MinEdge.Y, box.MinEdge.Z};
1225 const f32 Amax[3] = {box.MaxEdge.X, box.MaxEdge.Y, box.MaxEdge.Z};
1226
1227 f32 Bmin[3];
1228 f32 Bmax[3];
1229
1230 Bmin[0] = Bmax[0] = M[12];
1231 Bmin[1] = Bmax[1] = M[13];
1232 Bmin[2] = Bmax[2] = M[14];
1233
1234 const CMatrix4<T> &m = *this;
1235
1236 for (u32 i = 0; i < 3; ++i)
1237 {
1238 for (u32 j = 0; j < 3; ++j)
1239 {
1240 const f32 a = m(j,i) * Amin[j];
1241 const f32 b = m(j,i) * Amax[j];
1242
1243 if (a < b)
1244 {
1245 Bmin[i] += a;
1246 Bmax[i] += b;
1247 }
1248 else
1249 {
1250 Bmin[i] += b;
1251 Bmax[i] += a;
1252 }
1253 }
1254 }
1255
1256 box.MinEdge.X = Bmin[0];
1257 box.MinEdge.Y = Bmin[1];
1258 box.MinEdge.Z = Bmin[2];
1259
1260 box.MaxEdge.X = Bmax[0];
1261 box.MaxEdge.Y = Bmax[1];
1262 box.MaxEdge.Z = Bmax[2];
1263 }
1264
1265
1266 //! Multiplies this matrix by a 1x4 matrix
1267 template <class T>
1268 inline void CMatrix4<T>::multiplyWith1x4Matrix(T* matrix) const
1269 {
1270 /*
1271 0 1 2 3
1272 4 5 6 7
1273 8 9 10 11
1274 12 13 14 15
1275 */
1276
1277 T mat[4];
1278 mat[0] = matrix[0];
1279 mat[1] = matrix[1];
1280 mat[2] = matrix[2];
1281 mat[3] = matrix[3];
1282
1283 matrix[0] = M[0]*mat[0] + M[4]*mat[1] + M[8]*mat[2] + M[12]*mat[3];
1284 matrix[1] = M[1]*mat[0] + M[5]*mat[1] + M[9]*mat[2] + M[13]*mat[3];
1285 matrix[2] = M[2]*mat[0] + M[6]*mat[1] + M[10]*mat[2] + M[14]*mat[3];
1286 matrix[3] = M[3]*mat[0] + M[7]*mat[1] + M[11]*mat[2] + M[15]*mat[3];
1287 }
1288
1289 template <class T>
1290 inline void CMatrix4<T>::inverseTranslateVect( vector3df& vect ) const
1291 {
1292 vect.X = vect.X-M[12];
1293 vect.Y = vect.Y-M[13];
1294 vect.Z = vect.Z-M[14];
1295 }
1296
1297 template <class T>
1298 inline void CMatrix4<T>::translateVect( vector3df& vect ) const
1299 {
1300 vect.X = vect.X+M[12];
1301 vect.Y = vect.Y+M[13];
1302 vect.Z = vect.Z+M[14];
1303 }
1304
1305
1306 template <class T>
1307 inline bool CMatrix4<T>::getInverse(CMatrix4<T>& out) const
1308 {
1309 /// Calculates the inverse of this Matrix
1310 /// The inverse is calculated using Cramers rule.
1311 /// If no inverse exists then 'false' is returned.
1312
1313#if defined ( USE_MATRIX_TEST )
1314 if ( this->isIdentity() )
1315 {
1316 out=*this;
1317 return true;
1318 }
1319#endif
1320 const CMatrix4<T> &m = *this;
1321
1322 f32 d = (m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0)) * (m(2, 2) * m(3, 3) - m(2, 3) * m(3, 2)) -
1323 (m(0, 0) * m(1, 2) - m(0, 2) * m(1, 0)) * (m(2, 1) * m(3, 3) - m(2, 3) * m(3, 1)) +
1324 (m(0, 0) * m(1, 3) - m(0, 3) * m(1, 0)) * (m(2, 1) * m(3, 2) - m(2, 2) * m(3, 1)) +
1325 (m(0, 1) * m(1, 2) - m(0, 2) * m(1, 1)) * (m(2, 0) * m(3, 3) - m(2, 3) * m(3, 0)) -
1326 (m(0, 1) * m(1, 3) - m(0, 3) * m(1, 1)) * (m(2, 0) * m(3, 2) - m(2, 2) * m(3, 0)) +
1327 (m(0, 2) * m(1, 3) - m(0, 3) * m(1, 2)) * (m(2, 0) * m(3, 1) - m(2, 1) * m(3, 0));
1328
1329 if( core::iszero ( d, FLT_MIN ) )
1330 return false;
1331
1332 d = core::reciprocal ( d );
1333
1334 out(0, 0) = d * (m(1, 1) * (m(2, 2) * m(3, 3) - m(2, 3) * m(3, 2)) +
1335 m(1, 2) * (m(2, 3) * m(3, 1) - m(2, 1) * m(3, 3)) +
1336 m(1, 3) * (m(2, 1) * m(3, 2) - m(2, 2) * m(3, 1)));
1337 out(0, 1) = d * (m(2, 1) * (m(0, 2) * m(3, 3) - m(0, 3) * m(3, 2)) +
1338 m(2, 2) * (m(0, 3) * m(3, 1) - m(0, 1) * m(3, 3)) +
1339 m(2, 3) * (m(0, 1) * m(3, 2) - m(0, 2) * m(3, 1)));
1340 out(0, 2) = d * (m(3, 1) * (m(0, 2) * m(1, 3) - m(0, 3) * m(1, 2)) +
1341 m(3, 2) * (m(0, 3) * m(1, 1) - m(0, 1) * m(1, 3)) +
1342 m(3, 3) * (m(0, 1) * m(1, 2) - m(0, 2) * m(1, 1)));
1343 out(0, 3) = d * (m(0, 1) * (m(1, 3) * m(2, 2) - m(1, 2) * m(2, 3)) +
1344 m(0, 2) * (m(1, 1) * m(2, 3) - m(1, 3) * m(2, 1)) +
1345 m(0, 3) * (m(1, 2) * m(2, 1) - m(1, 1) * m(2, 2)));
1346 out(1, 0) = d * (m(1, 2) * (m(2, 0) * m(3, 3) - m(2, 3) * m(3, 0)) +
1347 m(1, 3) * (m(2, 2) * m(3, 0) - m(2, 0) * m(3, 2)) +
1348 m(1, 0) * (m(2, 3) * m(3, 2) - m(2, 2) * m(3, 3)));
1349 out(1, 1) = d * (m(2, 2) * (m(0, 0) * m(3, 3) - m(0, 3) * m(3, 0)) +
1350 m(2, 3) * (m(0, 2) * m(3, 0) - m(0, 0) * m(3, 2)) +
1351 m(2, 0) * (m(0, 3) * m(3, 2) - m(0, 2) * m(3, 3)));
1352 out(1, 2) = d * (m(3, 2) * (m(0, 0) * m(1, 3) - m(0, 3) * m(1, 0)) +
1353 m(3, 3) * (m(0, 2) * m(1, 0) - m(0, 0) * m(1, 2)) +
1354 m(3, 0) * (m(0, 3) * m(1, 2) - m(0, 2) * m(1, 3)));
1355 out(1, 3) = d * (m(0, 2) * (m(1, 3) * m(2, 0) - m(1, 0) * m(2, 3)) +
1356 m(0, 3) * (m(1, 0) * m(2, 2) - m(1, 2) * m(2, 0)) +
1357 m(0, 0) * (m(1, 2) * m(2, 3) - m(1, 3) * m(2, 2)));
1358 out(2, 0) = d * (m(1, 3) * (m(2, 0) * m(3, 1) - m(2, 1) * m(3, 0)) +
1359 m(1, 0) * (m(2, 1) * m(3, 3) - m(2, 3) * m(3, 1)) +
1360 m(1, 1) * (m(2, 3) * m(3, 0) - m(2, 0) * m(3, 3)));
1361 out(2, 1) = d * (m(2, 3) * (m(0, 0) * m(3, 1) - m(0, 1) * m(3, 0)) +
1362 m(2, 0) * (m(0, 1) * m(3, 3) - m(0, 3) * m(3, 1)) +
1363 m(2, 1) * (m(0, 3) * m(3, 0) - m(0, 0) * m(3, 3)));
1364 out(2, 2) = d * (m(3, 3) * (m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0)) +
1365 m(3, 0) * (m(0, 1) * m(1, 3) - m(0, 3) * m(1, 1)) +
1366 m(3, 1) * (m(0, 3) * m(1, 0) - m(0, 0) * m(1, 3)));
1367 out(2, 3) = d * (m(0, 3) * (m(1, 1) * m(2, 0) - m(1, 0) * m(2, 1)) +
1368 m(0, 0) * (m(1, 3) * m(2, 1) - m(1, 1) * m(2, 3)) +
1369 m(0, 1) * (m(1, 0) * m(2, 3) - m(1, 3) * m(2, 0)));
1370 out(3, 0) = d * (m(1, 0) * (m(2, 2) * m(3, 1) - m(2, 1) * m(3, 2)) +
1371 m(1, 1) * (m(2, 0) * m(3, 2) - m(2, 2) * m(3, 0)) +
1372 m(1, 2) * (m(2, 1) * m(3, 0) - m(2, 0) * m(3, 1)));
1373 out(3, 1) = d * (m(2, 0) * (m(0, 2) * m(3, 1) - m(0, 1) * m(3, 2)) +
1374 m(2, 1) * (m(0, 0) * m(3, 2) - m(0, 2) * m(3, 0)) +
1375 m(2, 2) * (m(0, 1) * m(3, 0) - m(0, 0) * m(3, 1)));
1376 out(3, 2) = d * (m(3, 0) * (m(0, 2) * m(1, 1) - m(0, 1) * m(1, 2)) +
1377 m(3, 1) * (m(0, 0) * m(1, 2) - m(0, 2) * m(1, 0)) +
1378 m(3, 2) * (m(0, 1) * m(1, 0) - m(0, 0) * m(1, 1)));
1379 out(3, 3) = d * (m(0, 0) * (m(1, 1) * m(2, 2) - m(1, 2) * m(2, 1)) +
1380 m(0, 1) * (m(1, 2) * m(2, 0) - m(1, 0) * m(2, 2)) +
1381 m(0, 2) * (m(1, 0) * m(2, 1) - m(1, 1) * m(2, 0)));
1382
1383#if defined ( USE_MATRIX_TEST )
1384 out.definitelyIdentityMatrix = definitelyIdentityMatrix;
1385#endif
1386 return true;
1387 }
1388
1389
1390 //! Inverts a primitive matrix which only contains a translation and a rotation
1391 //! \param out: where result matrix is written to.
1392 template <class T>
1393 inline bool CMatrix4<T>::getInversePrimitive ( CMatrix4<T>& out ) const
1394 {
1395 out.M[0 ] = M[0];
1396 out.M[1 ] = M[4];
1397 out.M[2 ] = M[8];
1398 out.M[3 ] = 0;
1399
1400 out.M[4 ] = M[1];
1401 out.M[5 ] = M[5];
1402 out.M[6 ] = M[9];
1403 out.M[7 ] = 0;
1404
1405 out.M[8 ] = M[2];
1406 out.M[9 ] = M[6];
1407 out.M[10] = M[10];
1408 out.M[11] = 0;
1409
1410 out.M[12] = (T)-(M[12]*M[0] + M[13]*M[1] + M[14]*M[2]);
1411 out.M[13] = (T)-(M[12]*M[4] + M[13]*M[5] + M[14]*M[6]);
1412 out.M[14] = (T)-(M[12]*M[8] + M[13]*M[9] + M[14]*M[10]);
1413 out.M[15] = 1;
1414
1415#if defined ( USE_MATRIX_TEST )
1416 out.definitelyIdentityMatrix = definitelyIdentityMatrix;
1417#endif
1418 return true;
1419 }
1420
1421 /*!
1422 */
1423 template <class T>
1424 inline bool CMatrix4<T>::makeInverse()
1425 {
1426#if defined ( USE_MATRIX_TEST )
1427 if (definitelyIdentityMatrix)
1428 return true;
1429#endif
1430 CMatrix4<T> temp ( EM4CONST_NOTHING );
1431
1432 if (getInverse(temp))
1433 {
1434 *this = temp;
1435 return true;
1436 }
1437
1438 return false;
1439 }
1440
1441
1442 template <class T>
1443 inline CMatrix4<T>& CMatrix4<T>::operator=(const CMatrix4<T> &other)
1444 {
1445 if (this==&other)
1446 return *this;
1447 memcpy(M, other.M, 16*sizeof(T));
1448#if defined ( USE_MATRIX_TEST )
1449 definitelyIdentityMatrix=other.definitelyIdentityMatrix;
1450#endif
1451 return *this;
1452 }
1453
1454
1455 template <class T>
1456 inline CMatrix4<T>& CMatrix4<T>::operator=(const T& scalar)
1457 {
1458 for (s32 i = 0; i < 16; ++i)
1459 M[i]=scalar;
1460
1461#if defined ( USE_MATRIX_TEST )
1462 definitelyIdentityMatrix=false;
1463#endif
1464 return *this;
1465 }
1466
1467
1468 template <class T>
1469 inline bool CMatrix4<T>::operator==(const CMatrix4<T> &other) const
1470 {
1471#if defined ( USE_MATRIX_TEST )
1472 if (definitelyIdentityMatrix && other.definitelyIdentityMatrix)
1473 return true;
1474#endif
1475 for (s32 i = 0; i < 16; ++i)
1476 if (M[i] != other.M[i])
1477 return false;
1478
1479 return true;
1480 }
1481
1482
1483 template <class T>
1484 inline bool CMatrix4<T>::operator!=(const CMatrix4<T> &other) const
1485 {
1486 return !(*this == other);
1487 }
1488
1489
1490 // Builds a right-handed perspective projection matrix based on a field of view
1491 template <class T>
1492 inline CMatrix4<T>& CMatrix4<T>::buildProjectionMatrixPerspectiveFovRH(
1493 f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar)
1494 {
1495 const f64 h = reciprocal(tan(fieldOfViewRadians*0.5));
1496 _IRR_DEBUG_BREAK_IF(aspectRatio==0.f); //divide by zero
1497 const T w = static_cast<T>(h / aspectRatio);
1498
1499 _IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero
1500 M[0] = w;
1501 M[1] = 0;
1502 M[2] = 0;
1503 M[3] = 0;
1504
1505 M[4] = 0;
1506 M[5] = (T)h;
1507 M[6] = 0;
1508 M[7] = 0;
1509
1510 M[8] = 0;
1511 M[9] = 0;
1512 M[10] = (T)(zFar/(zNear-zFar)); // DirectX version
1513// M[10] = (T)(zFar+zNear/(zNear-zFar)); // OpenGL version
1514 M[11] = -1;
1515
1516 M[12] = 0;
1517 M[13] = 0;
1518 M[14] = (T)(zNear*zFar/(zNear-zFar)); // DirectX version
1519// M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); // OpenGL version
1520 M[15] = 0;
1521
1522#if defined ( USE_MATRIX_TEST )
1523 definitelyIdentityMatrix=false;
1524#endif
1525 return *this;
1526 }
1527
1528
1529 // Builds a left-handed perspective projection matrix based on a field of view
1530 template <class T>
1531 inline CMatrix4<T>& CMatrix4<T>::buildProjectionMatrixPerspectiveFovLH(
1532 f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar)
1533 {
1534 const f64 h = reciprocal(tan(fieldOfViewRadians*0.5));
1535 _IRR_DEBUG_BREAK_IF(aspectRatio==0.f); //divide by zero
1536 const T w = static_cast<T>(h / aspectRatio);
1537
1538 _IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero
1539 M[0] = w;
1540 M[1] = 0;
1541 M[2] = 0;
1542 M[3] = 0;
1543
1544 M[4] = 0;
1545 M[5] = (T)h;
1546 M[6] = 0;
1547 M[7] = 0;
1548
1549 M[8] = 0;
1550 M[9] = 0;
1551 M[10] = (T)(zFar/(zFar-zNear));
1552 M[11] = 1;
1553
1554 M[12] = 0;
1555 M[13] = 0;
1556 M[14] = (T)(-zNear*zFar/(zFar-zNear));
1557 M[15] = 0;
1558
1559#if defined ( USE_MATRIX_TEST )
1560 definitelyIdentityMatrix=false;
1561#endif
1562 return *this;
1563 }
1564
1565
1566 // Builds a left-handed perspective projection matrix based on a field of view, with far plane culling at infinity
1567 template <class T>
1568 inline CMatrix4<T>& CMatrix4<T>::buildProjectionMatrixPerspectiveFovInfinityLH(
1569 f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 epsilon)
1570 {
1571 const f64 h = reciprocal(tan(fieldOfViewRadians*0.5));
1572 _IRR_DEBUG_BREAK_IF(aspectRatio==0.f); //divide by zero
1573 const T w = static_cast<T>(h / aspectRatio);
1574
1575 M[0] = w;
1576 M[1] = 0;
1577 M[2] = 0;
1578 M[3] = 0;
1579
1580 M[4] = 0;
1581 M[5] = (T)h;
1582 M[6] = 0;
1583 M[7] = 0;
1584
1585 M[8] = 0;
1586 M[9] = 0;
1587 M[10] = (T)(1.f-epsilon);
1588 M[11] = 1;
1589
1590 M[12] = 0;
1591 M[13] = 0;
1592 M[14] = (T)(zNear*(epsilon-1.f));
1593 M[15] = 0;
1594
1595#if defined ( USE_MATRIX_TEST )
1596 definitelyIdentityMatrix=false;
1597#endif
1598 return *this;
1599 }
1600
1601
1602 // Builds a left-handed orthogonal projection matrix.
1603 template <class T>
1604 inline CMatrix4<T>& CMatrix4<T>::buildProjectionMatrixOrthoLH(
1605 f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
1606 {
1607 _IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero
1608 _IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero
1609 _IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero
1610 M[0] = (T)(2/widthOfViewVolume);
1611 M[1] = 0;
1612 M[2] = 0;
1613 M[3] = 0;
1614
1615 M[4] = 0;
1616 M[5] = (T)(2/heightOfViewVolume);
1617 M[6] = 0;
1618 M[7] = 0;
1619
1620 M[8] = 0;
1621 M[9] = 0;
1622 M[10] = (T)(1/(zFar-zNear));
1623 M[11] = 0;
1624
1625 M[12] = 0;
1626 M[13] = 0;
1627 M[14] = (T)(zNear/(zNear-zFar));
1628 M[15] = 1;
1629
1630#if defined ( USE_MATRIX_TEST )
1631 definitelyIdentityMatrix=false;
1632#endif
1633 return *this;
1634 }
1635
1636
1637 // Builds a right-handed orthogonal projection matrix.
1638 template <class T>
1639 inline CMatrix4<T>& CMatrix4<T>::buildProjectionMatrixOrthoRH(
1640 f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
1641 {
1642 _IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero
1643 _IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero
1644 _IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero
1645 M[0] = (T)(2/widthOfViewVolume);
1646 M[1] = 0;
1647 M[2] = 0;
1648 M[3] = 0;
1649
1650 M[4] = 0;
1651 M[5] = (T)(2/heightOfViewVolume);
1652 M[6] = 0;
1653 M[7] = 0;
1654
1655 M[8] = 0;
1656 M[9] = 0;
1657 M[10] = (T)(1/(zNear-zFar));
1658 M[11] = 0;
1659
1660 M[12] = 0;
1661 M[13] = 0;
1662 M[14] = (T)(zNear/(zNear-zFar));
1663 M[15] = 1;
1664
1665#if defined ( USE_MATRIX_TEST )
1666 definitelyIdentityMatrix=false;
1667#endif
1668 return *this;
1669 }
1670
1671
1672 // Builds a right-handed perspective projection matrix.
1673 template <class T>
1674 inline CMatrix4<T>& CMatrix4<T>::buildProjectionMatrixPerspectiveRH(
1675 f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
1676 {
1677 _IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero
1678 _IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero
1679 _IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero
1680 M[0] = (T)(2*zNear/widthOfViewVolume);
1681 M[1] = 0;
1682 M[2] = 0;
1683 M[3] = 0;
1684
1685 M[4] = 0;
1686 M[5] = (T)(2*zNear/heightOfViewVolume);
1687 M[6] = 0;
1688 M[7] = 0;
1689
1690 M[8] = 0;
1691 M[9] = 0;
1692 M[10] = (T)(zFar/(zNear-zFar));
1693 M[11] = -1;
1694
1695 M[12] = 0;
1696 M[13] = 0;
1697 M[14] = (T)(zNear*zFar/(zNear-zFar));
1698 M[15] = 0;
1699
1700#if defined ( USE_MATRIX_TEST )
1701 definitelyIdentityMatrix=false;
1702#endif
1703 return *this;
1704 }
1705
1706
1707 // Builds a left-handed perspective projection matrix.
1708 template <class T>
1709 inline CMatrix4<T>& CMatrix4<T>::buildProjectionMatrixPerspectiveLH(
1710 f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
1711 {
1712 _IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero
1713 _IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero
1714 _IRR_DEBUG_BREAK_IF(zNear==zFar); //divide by zero
1715 M[0] = (T)(2*zNear/widthOfViewVolume);
1716 M[1] = 0;
1717 M[2] = 0;
1718 M[3] = 0;
1719
1720 M[4] = 0;
1721 M[5] = (T)(2*zNear/heightOfViewVolume);
1722 M[6] = 0;
1723 M[7] = 0;
1724
1725 M[8] = 0;
1726 M[9] = 0;
1727 M[10] = (T)(zFar/(zFar-zNear));
1728 M[11] = 1;
1729
1730 M[12] = 0;
1731 M[13] = 0;
1732 M[14] = (T)(zNear*zFar/(zNear-zFar));
1733 M[15] = 0;
1734#if defined ( USE_MATRIX_TEST )
1735 definitelyIdentityMatrix=false;
1736#endif
1737 return *this;
1738 }
1739
1740
1741 // Builds a matrix that flattens geometry into a plane.
1742 template <class T>
1743 inline CMatrix4<T>& CMatrix4<T>::buildShadowMatrix(const core::vector3df& light, core::plane3df plane, f32 point)
1744 {
1745 plane.Normal.normalize();
1746 const f32 d = plane.Normal.dotProduct(light);
1747
1748 M[ 0] = (T)(-plane.Normal.X * light.X + d);
1749 M[ 1] = (T)(-plane.Normal.X * light.Y);
1750 M[ 2] = (T)(-plane.Normal.X * light.Z);
1751 M[ 3] = (T)(-plane.Normal.X * point);
1752
1753 M[ 4] = (T)(-plane.Normal.Y * light.X);
1754 M[ 5] = (T)(-plane.Normal.Y * light.Y + d);
1755 M[ 6] = (T)(-plane.Normal.Y * light.Z);
1756 M[ 7] = (T)(-plane.Normal.Y * point);
1757
1758 M[ 8] = (T)(-plane.Normal.Z * light.X);
1759 M[ 9] = (T)(-plane.Normal.Z * light.Y);
1760 M[10] = (T)(-plane.Normal.Z * light.Z + d);
1761 M[11] = (T)(-plane.Normal.Z * point);
1762
1763 M[12] = (T)(-plane.D * light.X);
1764 M[13] = (T)(-plane.D * light.Y);
1765 M[14] = (T)(-plane.D * light.Z);
1766 M[15] = (T)(-plane.D * point + d);
1767#if defined ( USE_MATRIX_TEST )
1768 definitelyIdentityMatrix=false;
1769#endif
1770 return *this;
1771 }
1772
1773 // Builds a left-handed look-at matrix.
1774 template <class T>
1775 inline CMatrix4<T>& CMatrix4<T>::buildCameraLookAtMatrixLH(
1776 const vector3df& position,
1777 const vector3df& target,
1778 const vector3df& upVector)
1779 {
1780 vector3df zaxis = target - position;
1781 zaxis.normalize();
1782
1783 vector3df xaxis = upVector.crossProduct(zaxis);
1784 xaxis.normalize();
1785
1786 vector3df yaxis = zaxis.crossProduct(xaxis);
1787
1788 M[0] = (T)xaxis.X;
1789 M[1] = (T)yaxis.X;
1790 M[2] = (T)zaxis.X;
1791 M[3] = 0;
1792
1793 M[4] = (T)xaxis.Y;
1794 M[5] = (T)yaxis.Y;
1795 M[6] = (T)zaxis.Y;
1796 M[7] = 0;
1797
1798 M[8] = (T)xaxis.Z;
1799 M[9] = (T)yaxis.Z;
1800 M[10] = (T)zaxis.Z;
1801 M[11] = 0;
1802
1803 M[12] = (T)-xaxis.dotProduct(position);
1804 M[13] = (T)-yaxis.dotProduct(position);
1805 M[14] = (T)-zaxis.dotProduct(position);
1806 M[15] = 1;
1807#if defined ( USE_MATRIX_TEST )
1808 definitelyIdentityMatrix=false;
1809#endif
1810 return *this;
1811 }
1812
1813
1814 // Builds a right-handed look-at matrix.
1815 template <class T>
1816 inline CMatrix4<T>& CMatrix4<T>::buildCameraLookAtMatrixRH(
1817 const vector3df& position,
1818 const vector3df& target,
1819 const vector3df& upVector)
1820 {
1821 vector3df zaxis = position - target;
1822 zaxis.normalize();
1823
1824 vector3df xaxis = upVector.crossProduct(zaxis);
1825 xaxis.normalize();
1826
1827 vector3df yaxis = zaxis.crossProduct(xaxis);
1828
1829 M[0] = (T)xaxis.X;
1830 M[1] = (T)yaxis.X;
1831 M[2] = (T)zaxis.X;
1832 M[3] = 0;
1833
1834 M[4] = (T)xaxis.Y;
1835 M[5] = (T)yaxis.Y;
1836 M[6] = (T)zaxis.Y;
1837 M[7] = 0;
1838
1839 M[8] = (T)xaxis.Z;
1840 M[9] = (T)yaxis.Z;
1841 M[10] = (T)zaxis.Z;
1842 M[11] = 0;
1843
1844 M[12] = (T)-xaxis.dotProduct(position);
1845 M[13] = (T)-yaxis.dotProduct(position);
1846 M[14] = (T)-zaxis.dotProduct(position);
1847 M[15] = 1;
1848#if defined ( USE_MATRIX_TEST )
1849 definitelyIdentityMatrix=false;
1850#endif
1851 return *this;
1852 }
1853
1854
1855 // creates a new matrix as interpolated matrix from this and the passed one.
1856 template <class T>
1857 inline CMatrix4<T> CMatrix4<T>::interpolate(const core::CMatrix4<T>& b, f32 time) const
1858 {
1859 CMatrix4<T> mat ( EM4CONST_NOTHING );
1860
1861 for (u32 i=0; i < 16; i += 4)
1862 {
1863 mat.M[i+0] = (T)(M[i+0] + ( b.M[i+0] - M[i+0] ) * time);
1864 mat.M[i+1] = (T)(M[i+1] + ( b.M[i+1] - M[i+1] ) * time);
1865 mat.M[i+2] = (T)(M[i+2] + ( b.M[i+2] - M[i+2] ) * time);
1866 mat.M[i+3] = (T)(M[i+3] + ( b.M[i+3] - M[i+3] ) * time);
1867 }
1868 return mat;
1869 }
1870
1871
1872 // returns transposed matrix
1873 template <class T>
1874 inline CMatrix4<T> CMatrix4<T>::getTransposed() const
1875 {
1876 CMatrix4<T> t ( EM4CONST_NOTHING );
1877 getTransposed ( t );
1878 return t;
1879 }
1880
1881
1882 // returns transposed matrix
1883 template <class T>
1884 inline void CMatrix4<T>::getTransposed( CMatrix4<T>& o ) const
1885 {
1886 o[ 0] = M[ 0];
1887 o[ 1] = M[ 4];
1888 o[ 2] = M[ 8];
1889 o[ 3] = M[12];
1890
1891 o[ 4] = M[ 1];
1892 o[ 5] = M[ 5];
1893 o[ 6] = M[ 9];
1894 o[ 7] = M[13];
1895
1896 o[ 8] = M[ 2];
1897 o[ 9] = M[ 6];
1898 o[10] = M[10];
1899 o[11] = M[14];
1900
1901 o[12] = M[ 3];
1902 o[13] = M[ 7];
1903 o[14] = M[11];
1904 o[15] = M[15];
1905#if defined ( USE_MATRIX_TEST )
1906 o.definitelyIdentityMatrix=definitelyIdentityMatrix;
1907#endif
1908 }
1909
1910
1911 // used to scale <-1,-1><1,1> to viewport
1912 template <class T>
1913 inline CMatrix4<T>& CMatrix4<T>::buildNDCToDCMatrix( const core::rect<s32>& viewport, f32 zScale)
1914 {
1915 const f32 scaleX = (viewport.getWidth() - 0.75f ) * 0.5f;
1916 const f32 scaleY = -(viewport.getHeight() - 0.75f ) * 0.5f;
1917
1918 const f32 dx = -0.5f + ( (viewport.UpperLeftCorner.X + viewport.LowerRightCorner.X ) * 0.5f );
1919 const f32 dy = -0.5f + ( (viewport.UpperLeftCorner.Y + viewport.LowerRightCorner.Y ) * 0.5f );
1920
1921 makeIdentity();
1922 M[12] = (T)dx;
1923 M[13] = (T)dy;
1924 return setScale(core::vector3d<T>((T)scaleX, (T)scaleY, (T)zScale));
1925 }
1926
1927 //! Builds a matrix that rotates from one vector to another
1928 /** \param from: vector to rotate from
1929 \param to: vector to rotate to
1930
1931 http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/index.htm
1932 */
1933 template <class T>
1934 inline CMatrix4<T>& CMatrix4<T>::buildRotateFromTo(const core::vector3df& from, const core::vector3df& to)
1935 {
1936 // unit vectors
1937 core::vector3df f(from);
1938 core::vector3df t(to);
1939 f.normalize();
1940 t.normalize();
1941
1942 // axis multiplication by sin
1943 core::vector3df vs(t.crossProduct(f));
1944
1945 // axis of rotation
1946 core::vector3df v(vs);
1947 v.normalize();
1948
1949 // cosinus angle
1950 T ca = f.dotProduct(t);
1951
1952 core::vector3df vt(v * (1 - ca));
1953
1954 M[0] = vt.X * v.X + ca;
1955 M[5] = vt.Y * v.Y + ca;
1956 M[10] = vt.Z * v.Z + ca;
1957
1958 vt.X *= v.Y;
1959 vt.Z *= v.X;
1960 vt.Y *= v.Z;
1961
1962 M[1] = vt.X - vs.Z;
1963 M[2] = vt.Z + vs.Y;
1964 M[3] = 0;
1965
1966 M[4] = vt.X + vs.Z;
1967 M[6] = vt.Y - vs.X;
1968 M[7] = 0;
1969
1970 M[8] = vt.Z - vs.Y;
1971 M[9] = vt.Y + vs.X;
1972 M[11] = 0;
1973
1974 M[12] = 0;
1975 M[13] = 0;
1976 M[14] = 0;
1977 M[15] = 1;
1978
1979 return *this;
1980 }
1981
1982 //! Builds a matrix which rotates a source vector to a look vector over an arbitrary axis
1983 /** \param camPos: viewer position in world coord
1984 \param center: object position in world-coord, rotation pivot
1985 \param translation: object final translation from center
1986 \param axis: axis to rotate about
1987 \param from: source vector to rotate from
1988 */
1989 template <class T>
1990 inline void CMatrix4<T>::buildAxisAlignedBillboard(
1991 const core::vector3df& camPos,
1992 const core::vector3df& center,
1993 const core::vector3df& translation,
1994 const core::vector3df& axis,
1995 const core::vector3df& from)
1996 {
1997 // axis of rotation
1998 core::vector3df up = axis;
1999 up.normalize();
2000 const core::vector3df forward = (camPos - center).normalize();
2001 const core::vector3df right = up.crossProduct(forward).normalize();
2002
2003 // correct look vector
2004 const core::vector3df look = right.crossProduct(up);
2005
2006 // rotate from to
2007 // axis multiplication by sin
2008 const core::vector3df vs = look.crossProduct(from);
2009
2010 // cosinus angle
2011 const f32 ca = from.dotProduct(look);
2012
2013 core::vector3df vt(up * (1.f - ca));
2014
2015 M[0] = static_cast<T>(vt.X * up.X + ca);
2016 M[5] = static_cast<T>(vt.Y * up.Y + ca);
2017 M[10] = static_cast<T>(vt.Z * up.Z + ca);
2018
2019 vt.X *= up.Y;
2020 vt.Z *= up.X;
2021 vt.Y *= up.Z;
2022
2023 M[1] = static_cast<T>(vt.X - vs.Z);
2024 M[2] = static_cast<T>(vt.Z + vs.Y);
2025 M[3] = 0;
2026
2027 M[4] = static_cast<T>(vt.X + vs.Z);
2028 M[6] = static_cast<T>(vt.Y - vs.X);
2029 M[7] = 0;
2030
2031 M[8] = static_cast<T>(vt.Z - vs.Y);
2032 M[9] = static_cast<T>(vt.Y + vs.X);
2033 M[11] = 0;
2034
2035 setRotationCenter(center, translation);
2036 }
2037
2038
2039 //! Builds a combined matrix which translate to a center before rotation and translate afterwards
2040 template <class T>
2041 inline void CMatrix4<T>::setRotationCenter(const core::vector3df& center, const core::vector3df& translation)
2042 {
2043 M[12] = -M[0]*center.X - M[4]*center.Y - M[8]*center.Z + (center.X - translation.X );
2044 M[13] = -M[1]*center.X - M[5]*center.Y - M[9]*center.Z + (center.Y - translation.Y );
2045 M[14] = -M[2]*center.X - M[6]*center.Y - M[10]*center.Z + (center.Z - translation.Z );
2046 M[15] = (T) 1.0;
2047#if defined ( USE_MATRIX_TEST )
2048 definitelyIdentityMatrix=false;
2049#endif
2050 }
2051
2052 /*!
2053 Generate texture coordinates as linear functions so that:
2054 u = Ux*x + Uy*y + Uz*z + Uw
2055 v = Vx*x + Vy*y + Vz*z + Vw
2056 The matrix M for this case is:
2057 Ux Vx 0 0
2058 Uy Vy 0 0
2059 Uz Vz 0 0
2060 Uw Vw 0 0
2061 */
2062
2063
2064 template <class T>
2065 inline CMatrix4<T>& CMatrix4<T>::buildTextureTransform( f32 rotateRad,
2066 const core::vector2df &rotatecenter,
2067 const core::vector2df &translate,
2068 const core::vector2df &scale)
2069 {
2070 const f32 c = cosf(rotateRad);
2071 const f32 s = sinf(rotateRad);
2072
2073 M[0] = (T)(c * scale.X);
2074 M[1] = (T)(s * scale.Y);
2075 M[2] = 0;
2076 M[3] = 0;
2077
2078 M[4] = (T)(-s * scale.X);
2079 M[5] = (T)(c * scale.Y);
2080 M[6] = 0;
2081 M[7] = 0;
2082
2083 M[8] = (T)(c * scale.X * rotatecenter.X + -s * rotatecenter.Y + translate.X);
2084 M[9] = (T)(s * scale.Y * rotatecenter.X + c * rotatecenter.Y + translate.Y);
2085 M[10] = 1;
2086 M[11] = 0;
2087
2088 M[12] = 0;
2089 M[13] = 0;
2090 M[14] = 0;
2091 M[15] = 1;
2092#if defined ( USE_MATRIX_TEST )
2093 definitelyIdentityMatrix=false;
2094#endif
2095 return *this;
2096 }
2097
2098
2099 // rotate about z axis, center ( 0.5, 0.5 )
2100 template <class T>
2101 inline CMatrix4<T>& CMatrix4<T>::setTextureRotationCenter( f32 rotateRad )
2102 {
2103 const f32 c = cosf(rotateRad);
2104 const f32 s = sinf(rotateRad);
2105 M[0] = (T)c;
2106 M[1] = (T)s;
2107
2108 M[4] = (T)-s;
2109 M[5] = (T)c;
2110
2111 M[8] = (T)(0.5f * ( s - c) + 0.5f);
2112 M[9] = (T)(-0.5f * ( s + c) + 0.5f);
2113
2114#if defined ( USE_MATRIX_TEST )
2115 definitelyIdentityMatrix = definitelyIdentityMatrix && (rotateRad==0.0f);
2116#endif
2117 return *this;
2118 }
2119
2120
2121 template <class T>
2122 inline CMatrix4<T>& CMatrix4<T>::setTextureTranslate ( f32 x, f32 y )
2123 {
2124 M[8] = (T)x;
2125 M[9] = (T)y;
2126
2127#if defined ( USE_MATRIX_TEST )
2128 definitelyIdentityMatrix = definitelyIdentityMatrix && (x==0.0f) && (y==0.0f);
2129#endif
2130 return *this;
2131 }
2132
2133
2134 template <class T>
2135 inline CMatrix4<T>& CMatrix4<T>::setTextureTranslateTransposed ( f32 x, f32 y )
2136 {
2137 M[2] = (T)x;
2138 M[6] = (T)y;
2139
2140#if defined ( USE_MATRIX_TEST )
2141 definitelyIdentityMatrix = definitelyIdentityMatrix && (x==0.0f) && (y==0.0f) ;
2142#endif
2143 return *this;
2144 }
2145
2146 template <class T>
2147 inline CMatrix4<T>& CMatrix4<T>::setTextureScale ( f32 sx, f32 sy )
2148 {
2149 M[0] = (T)sx;
2150 M[5] = (T)sy;
2151#if defined ( USE_MATRIX_TEST )
2152 definitelyIdentityMatrix = definitelyIdentityMatrix && (sx==1.0f) && (sy==1.0f);
2153#endif
2154 return *this;
2155 }
2156
2157
2158 template <class T>
2159 inline CMatrix4<T>& CMatrix4<T>::setTextureScaleCenter( f32 sx, f32 sy )
2160 {
2161 M[0] = (T)sx;
2162 M[5] = (T)sy;
2163 M[8] = (T)(0.5f - 0.5f * sx);
2164 M[9] = (T)(0.5f - 0.5f * sy);
2165
2166#if defined ( USE_MATRIX_TEST )
2167 definitelyIdentityMatrix = definitelyIdentityMatrix && (sx==1.0f) && (sy==1.0f);
2168#endif
2169 return *this;
2170 }
2171
2172
2173 // sets all matrix data members at once
2174 template <class T>
2175 inline CMatrix4<T>& CMatrix4<T>::setM(const T* data)
2176 {
2177 memcpy(M,data, 16*sizeof(T));
2178
2179#if defined ( USE_MATRIX_TEST )
2180 definitelyIdentityMatrix=false;
2181#endif
2182 return *this;
2183 }
2184
2185
2186 // sets if the matrix is definitely identity matrix
2187 template <class T>
2188 inline void CMatrix4<T>::setDefinitelyIdentityMatrix( bool isDefinitelyIdentityMatrix)
2189 {
2190#if defined ( USE_MATRIX_TEST )
2191 definitelyIdentityMatrix = isDefinitelyIdentityMatrix;
2192#endif
2193 }
2194
2195
2196 // gets if the matrix is definitely identity matrix
2197 template <class T>
2198 inline bool CMatrix4<T>::getDefinitelyIdentityMatrix() const
2199 {
2200#if defined ( USE_MATRIX_TEST )
2201 return definitelyIdentityMatrix;
2202#else
2203 return false;
2204#endif
2205 }
2206
2207
2208 //! Compare two matrices using the equal method
2209 template <class T>
2210 inline bool CMatrix4<T>::equals(const core::CMatrix4<T>& other, const T tolerance) const
2211 {
2212#if defined ( USE_MATRIX_TEST )
2213 if (definitelyIdentityMatrix && other.definitelyIdentityMatrix)
2214 return true;
2215#endif
2216 for (s32 i = 0; i < 16; ++i)
2217 if (!core::equals(M[i],other.M[i], tolerance))
2218 return false;
2219
2220 return true;
2221 }
2222
2223
2224 // Multiply by scalar.
2225 template <class T>
2226 inline CMatrix4<T> operator*(const T scalar, const CMatrix4<T>& mat)
2227 {
2228 return mat*scalar;
2229 }
2230
2231
2232 //! Typedef for f32 matrix
2233 typedef CMatrix4<f32> matrix4;
2234
2235 //! global const identity matrix
2236 IRRLICHT_API extern const matrix4 IdentityMatrix;
2237
2238} // end namespace core
2239} // end namespace irr
2240
2241#endif
2242
diff --git a/src/others/irrlicht-1.8.1/include/path.h b/src/others/irrlicht-1.8.1/include/path.h
new file mode 100644
index 0000000..b537987
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/path.h
@@ -0,0 +1,88 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine" and the "irrXML" project.
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_PATH_H_INCLUDED__
6#define __IRR_PATH_H_INCLUDED__
7
8#include "irrString.h"
9
10namespace irr
11{
12namespace io
13{
14
15//! Type used for all file system related strings.
16/** This type will transparently handle different file system encodings. */
17typedef core::string<fschar_t> path;
18
19//! Used in places where we identify objects by a filename, but don't actually work with the real filename
20/** Irrlicht is internally not case-sensitive when it comes to names.
21 Also this class is a first step towards support for correctly serializing renamed objects.
22*/
23struct SNamedPath
24{
25 //! Constructor
26 SNamedPath() {}
27
28 //! Constructor
29 SNamedPath(const path& p) : Path(p), InternalName( PathToName(p) )
30 {
31 }
32
33 //! Is smaller comparator
34 bool operator <(const SNamedPath& other) const
35 {
36 return InternalName < other.InternalName;
37 }
38
39 //! Set the path.
40 void setPath(const path& p)
41 {
42 Path = p;
43 InternalName = PathToName(p);
44 }
45
46 //! Get the path.
47 const path& getPath() const
48 {
49 return Path;
50 };
51
52 //! Get the name which is used to identify the file.
53 //! This string is similar to the names and filenames used before Irrlicht 1.7
54 const path& getInternalName() const
55 {
56 return InternalName;
57 }
58
59 //! Implicit cast to io::path
60 operator core::stringc() const
61 {
62 return core::stringc(getPath());
63 }
64 //! Implicit cast to io::path
65 operator core::stringw() const
66 {
67 return core::stringw(getPath());
68 }
69
70protected:
71 // convert the given path string to a name string.
72 path PathToName(const path& p) const
73 {
74 path name(p);
75 name.replace( '\\', '/' );
76 name.make_lower();
77 return name;
78 }
79
80private:
81 path Path;
82 path InternalName;
83};
84
85} // io
86} // irr
87
88#endif // __IRR_PATH_H_INCLUDED__
diff --git a/src/others/irrlicht-1.8.1/include/plane3d.h b/src/others/irrlicht-1.8.1/include/plane3d.h
new file mode 100644
index 0000000..9056dcd
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/plane3d.h
@@ -0,0 +1,245 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_PLANE_3D_H_INCLUDED__
6#define __IRR_PLANE_3D_H_INCLUDED__
7
8#include "irrMath.h"
9#include "vector3d.h"
10
11namespace irr
12{
13namespace core
14{
15
16//! Enumeration for intersection relations of 3d objects
17enum EIntersectionRelation3D
18{
19 ISREL3D_FRONT = 0,
20 ISREL3D_BACK,
21 ISREL3D_PLANAR,
22 ISREL3D_SPANNING,
23 ISREL3D_CLIPPED
24};
25
26//! Template plane class with some intersection testing methods.
27/** It has to be ensured, that the normal is always normalized. The constructors
28 and setters of this class will not ensure this automatically. So any normal
29 passed in has to be normalized in advance. No change to the normal will be
30 made by any of the class methods.
31*/
32template <class T>
33class plane3d
34{
35 public:
36
37 // Constructors
38
39 plane3d(): Normal(0,1,0) { recalculateD(vector3d<T>(0,0,0)); }
40
41 plane3d(const vector3d<T>& MPoint, const vector3d<T>& Normal) : Normal(Normal) { recalculateD(MPoint); }
42
43 plane3d(T px, T py, T pz, T nx, T ny, T nz) : Normal(nx, ny, nz) { recalculateD(vector3d<T>(px, py, pz)); }
44
45 plane3d(const vector3d<T>& point1, const vector3d<T>& point2, const vector3d<T>& point3)
46 { setPlane(point1, point2, point3); }
47
48 plane3d(const vector3d<T> & normal, const T d) : Normal(normal), D(d) { }
49
50 // operators
51
52 inline bool operator==(const plane3d<T>& other) const { return (equals(D, other.D) && Normal==other.Normal);}
53
54 inline bool operator!=(const plane3d<T>& other) const { return !(*this == other);}
55
56 // functions
57
58 void setPlane(const vector3d<T>& point, const vector3d<T>& nvector)
59 {
60 Normal = nvector;
61 recalculateD(point);
62 }
63
64 void setPlane(const vector3d<T>& nvect, T d)
65 {
66 Normal = nvect;
67 D = d;
68 }
69
70 void setPlane(const vector3d<T>& point1, const vector3d<T>& point2, const vector3d<T>& point3)
71 {
72 // creates the plane from 3 memberpoints
73 Normal = (point2 - point1).crossProduct(point3 - point1);
74 Normal.normalize();
75
76 recalculateD(point1);
77 }
78
79
80 //! Get an intersection with a 3d line.
81 /** \param lineVect Vector of the line to intersect with.
82 \param linePoint Point of the line to intersect with.
83 \param outIntersection Place to store the intersection point, if there is one.
84 \return True if there was an intersection, false if there was not.
85 */
86 bool getIntersectionWithLine(const vector3d<T>& linePoint,
87 const vector3d<T>& lineVect,
88 vector3d<T>& outIntersection) const
89 {
90 T t2 = Normal.dotProduct(lineVect);
91
92 if (t2 == 0)
93 return false;
94
95 T t =- (Normal.dotProduct(linePoint) + D) / t2;
96 outIntersection = linePoint + (lineVect * t);
97 return true;
98 }
99
100 //! Get percentage of line between two points where an intersection with this plane happens.
101 /** Only useful if known that there is an intersection.
102 \param linePoint1 Point1 of the line to intersect with.
103 \param linePoint2 Point2 of the line to intersect with.
104 \return Where on a line between two points an intersection with this plane happened.
105 For example, 0.5 is returned if the intersection happened exactly in the middle of the two points.
106 */
107 f32 getKnownIntersectionWithLine(const vector3d<T>& linePoint1,
108 const vector3d<T>& linePoint2) const
109 {
110 vector3d<T> vect = linePoint2 - linePoint1;
111 T t2 = (f32)Normal.dotProduct(vect);
112 return (f32)-((Normal.dotProduct(linePoint1) + D) / t2);
113 }
114
115 //! Get an intersection with a 3d line, limited between two 3d points.
116 /** \param linePoint1 Point 1 of the line.
117 \param linePoint2 Point 2 of the line.
118 \param outIntersection Place to store the intersection point, if there is one.
119 \return True if there was an intersection, false if there was not.
120 */
121 bool getIntersectionWithLimitedLine(
122 const vector3d<T>& linePoint1,
123 const vector3d<T>& linePoint2,
124 vector3d<T>& outIntersection) const
125 {
126 return (getIntersectionWithLine(linePoint1, linePoint2 - linePoint1, outIntersection) &&
127 outIntersection.isBetweenPoints(linePoint1, linePoint2));
128 }
129
130 //! Classifies the relation of a point to this plane.
131 /** \param point Point to classify its relation.
132 \return ISREL3D_FRONT if the point is in front of the plane,
133 ISREL3D_BACK if the point is behind of the plane, and
134 ISREL3D_PLANAR if the point is within the plane. */
135 EIntersectionRelation3D classifyPointRelation(const vector3d<T>& point) const
136 {
137 const T d = Normal.dotProduct(point) + D;
138
139 if (d < -ROUNDING_ERROR_f32)
140 return ISREL3D_BACK;
141
142 if (d > ROUNDING_ERROR_f32)
143 return ISREL3D_FRONT;
144
145 return ISREL3D_PLANAR;
146 }
147
148 //! Recalculates the distance from origin by applying a new member point to the plane.
149 void recalculateD(const vector3d<T>& MPoint)
150 {
151 D = - MPoint.dotProduct(Normal);
152 }
153
154 //! Gets a member point of the plane.
155 vector3d<T> getMemberPoint() const
156 {
157 return Normal * -D;
158 }
159
160 //! Tests if there is an intersection with the other plane
161 /** \return True if there is a intersection. */
162 bool existsIntersection(const plane3d<T>& other) const
163 {
164 vector3d<T> cross = other.Normal.crossProduct(Normal);
165 return cross.getLength() > core::ROUNDING_ERROR_f32;
166 }
167
168 //! Intersects this plane with another.
169 /** \param other Other plane to intersect with.
170 \param outLinePoint Base point of intersection line.
171 \param outLineVect Vector of intersection.
172 \return True if there is a intersection, false if not. */
173 bool getIntersectionWithPlane(const plane3d<T>& other,
174 vector3d<T>& outLinePoint,
175 vector3d<T>& outLineVect) const
176 {
177 const T fn00 = Normal.getLength();
178 const T fn01 = Normal.dotProduct(other.Normal);
179 const T fn11 = other.Normal.getLength();
180 const f64 det = fn00*fn11 - fn01*fn01;
181
182 if (fabs(det) < ROUNDING_ERROR_f64 )
183 return false;
184
185 const f64 invdet = 1.0 / det;
186 const f64 fc0 = (fn11*-D + fn01*other.D) * invdet;
187 const f64 fc1 = (fn00*-other.D + fn01*D) * invdet;
188
189 outLineVect = Normal.crossProduct(other.Normal);
190 outLinePoint = Normal*(T)fc0 + other.Normal*(T)fc1;
191 return true;
192 }
193
194 //! Get the intersection point with two other planes if there is one.
195 bool getIntersectionWithPlanes(const plane3d<T>& o1,
196 const plane3d<T>& o2, vector3d<T>& outPoint) const
197 {
198 vector3d<T> linePoint, lineVect;
199 if (getIntersectionWithPlane(o1, linePoint, lineVect))
200 return o2.getIntersectionWithLine(linePoint, lineVect, outPoint);
201
202 return false;
203 }
204
205 //! Test if the triangle would be front or backfacing from any point.
206 /** Thus, this method assumes a camera position from
207 which the triangle is definitely visible when looking into
208 the given direction.
209 Note that this only works if the normal is Normalized.
210 Do not use this method with points as it will give wrong results!
211 \param lookDirection: Look direction.
212 \return True if the plane is front facing and
213 false if it is backfacing. */
214 bool isFrontFacing(const vector3d<T>& lookDirection) const
215 {
216 const f32 d = Normal.dotProduct(lookDirection);
217 return F32_LOWER_EQUAL_0 ( d );
218 }
219
220 //! Get the distance to a point.
221 /** Note that this only works if the normal is normalized. */
222 T getDistanceTo(const vector3d<T>& point) const
223 {
224 return point.dotProduct(Normal) + D;
225 }
226
227 //! Normal vector of the plane.
228 vector3d<T> Normal;
229
230 //! Distance from origin.
231 T D;
232};
233
234
235//! Typedef for a f32 3d plane.
236typedef plane3d<f32> plane3df;
237
238//! Typedef for an integer 3d plane.
239typedef plane3d<s32> plane3di;
240
241} // end namespace core
242} // end namespace irr
243
244#endif
245
diff --git a/src/others/irrlicht-1.8.1/include/position2d.h b/src/others/irrlicht-1.8.1/include/position2d.h
new file mode 100644
index 0000000..63275d2
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/position2d.h
@@ -0,0 +1,32 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5//! As of Irrlicht 1.6, position2d is a synonym for vector2d.
6/** You should consider position2d to be deprecated, and use vector2d by preference. */
7
8#ifndef __IRR_POSITION_H_INCLUDED__
9#define __IRR_POSITION_H_INCLUDED__
10
11#include "vector2d.h"
12
13namespace irr
14{
15namespace core
16{
17
18// Use typedefs where possible as they are more explicit...
19
20//! \deprecated position2d is now a synonym for vector2d, but vector2d should be used directly.
21typedef vector2d<f32> position2df;
22
23//! \deprecated position2d is now a synonym for vector2d, but vector2d should be used directly.
24typedef vector2d<s32> position2di;
25} // namespace core
26} // namespace irr
27
28// ...and use a #define to catch the rest, for (e.g.) position2d<f64>
29#define position2d vector2d
30
31#endif // __IRR_POSITION_H_INCLUDED__
32
diff --git a/src/others/irrlicht-1.8.1/include/quaternion.h b/src/others/irrlicht-1.8.1/include/quaternion.h
new file mode 100644
index 0000000..f2e3921
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/quaternion.h
@@ -0,0 +1,696 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_QUATERNION_H_INCLUDED__
6#define __IRR_QUATERNION_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "irrMath.h"
10#include "matrix4.h"
11#include "vector3d.h"
12
13// Between Irrlicht 1.7 and Irrlicht 1.8 the quaternion-matrix conversions got fixed.
14// This define disables all involved functions completely to allow finding all places
15// where the wrong conversions had been in use.
16#define IRR_TEST_BROKEN_QUATERNION_USE 0
17
18namespace irr
19{
20namespace core
21{
22
23//! Quaternion class for representing rotations.
24/** It provides cheap combinations and avoids gimbal locks.
25Also useful for interpolations. */
26class quaternion
27{
28 public:
29
30 //! Default Constructor
31 quaternion() : X(0.0f), Y(0.0f), Z(0.0f), W(1.0f) {}
32
33 //! Constructor
34 quaternion(f32 x, f32 y, f32 z, f32 w) : X(x), Y(y), Z(z), W(w) { }
35
36 //! Constructor which converts euler angles (radians) to a quaternion
37 quaternion(f32 x, f32 y, f32 z);
38
39 //! Constructor which converts euler angles (radians) to a quaternion
40 quaternion(const vector3df& vec);
41
42#if !IRR_TEST_BROKEN_QUATERNION_USE
43 //! Constructor which converts a matrix to a quaternion
44 quaternion(const matrix4& mat);
45#endif
46
47 //! Equalilty operator
48 bool operator==(const quaternion& other) const;
49
50 //! inequality operator
51 bool operator!=(const quaternion& other) const;
52
53 //! Assignment operator
54 inline quaternion& operator=(const quaternion& other);
55
56#if !IRR_TEST_BROKEN_QUATERNION_USE
57 //! Matrix assignment operator
58 inline quaternion& operator=(const matrix4& other);
59#endif
60
61 //! Add operator
62 quaternion operator+(const quaternion& other) const;
63
64 //! Multiplication operator
65 quaternion operator*(const quaternion& other) const;
66
67 //! Multiplication operator with scalar
68 quaternion operator*(f32 s) const;
69
70 //! Multiplication operator with scalar
71 quaternion& operator*=(f32 s);
72
73 //! Multiplication operator
74 vector3df operator*(const vector3df& v) const;
75
76 //! Multiplication operator
77 quaternion& operator*=(const quaternion& other);
78
79 //! Calculates the dot product
80 inline f32 dotProduct(const quaternion& other) const;
81
82 //! Sets new quaternion
83 inline quaternion& set(f32 x, f32 y, f32 z, f32 w);
84
85 //! Sets new quaternion based on euler angles (radians)
86 inline quaternion& set(f32 x, f32 y, f32 z);
87
88 //! Sets new quaternion based on euler angles (radians)
89 inline quaternion& set(const core::vector3df& vec);
90
91 //! Sets new quaternion from other quaternion
92 inline quaternion& set(const core::quaternion& quat);
93
94 //! returns if this quaternion equals the other one, taking floating point rounding errors into account
95 inline bool equals(const quaternion& other,
96 const f32 tolerance = ROUNDING_ERROR_f32 ) const;
97
98 //! Normalizes the quaternion
99 inline quaternion& normalize();
100
101#if !IRR_TEST_BROKEN_QUATERNION_USE
102 //! Creates a matrix from this quaternion
103 matrix4 getMatrix() const;
104#endif
105
106 //! Creates a matrix from this quaternion
107 void getMatrix( matrix4 &dest, const core::vector3df &translation=core::vector3df() ) const;
108
109 /*!
110 Creates a matrix from this quaternion
111 Rotate about a center point
112 shortcut for
113 core::quaternion q;
114 q.rotationFromTo ( vin[i].Normal, forward );
115 q.getMatrixCenter ( lookat, center, newPos );
116
117 core::matrix4 m2;
118 m2.setInverseTranslation ( center );
119 lookat *= m2;
120
121 core::matrix4 m3;
122 m2.setTranslation ( newPos );
123 lookat *= m3;
124
125 */
126 void getMatrixCenter( matrix4 &dest, const core::vector3df &center, const core::vector3df &translation ) const;
127
128 //! Creates a matrix from this quaternion
129 inline void getMatrix_transposed( matrix4 &dest ) const;
130
131 //! Inverts this quaternion
132 quaternion& makeInverse();
133
134 //! Set this quaternion to the linear interpolation between two quaternions
135 /** \param q1 First quaternion to be interpolated.
136 \param q2 Second quaternion to be interpolated.
137 \param time Progress of interpolation. For time=0 the result is
138 q1, for time=1 the result is q2. Otherwise interpolation
139 between q1 and q2.
140 */
141 quaternion& lerp(quaternion q1, quaternion q2, f32 time);
142
143 //! Set this quaternion to the result of the spherical interpolation between two quaternions
144 /** \param q1 First quaternion to be interpolated.
145 \param q2 Second quaternion to be interpolated.
146 \param time Progress of interpolation. For time=0 the result is
147 q1, for time=1 the result is q2. Otherwise interpolation
148 between q1 and q2.
149 \param threshold To avoid inaccuracies at the end (time=1) the
150 interpolation switches to linear interpolation at some point.
151 This value defines how much of the remaining interpolation will
152 be calculated with lerp. Everything from 1-threshold up will be
153 linear interpolation.
154 */
155 quaternion& slerp(quaternion q1, quaternion q2,
156 f32 time, f32 threshold=.05f);
157
158 //! Create quaternion from rotation angle and rotation axis.
159 /** Axis must be unit length.
160 The quaternion representing the rotation is
161 q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k).
162 \param angle Rotation Angle in radians.
163 \param axis Rotation axis. */
164 quaternion& fromAngleAxis (f32 angle, const vector3df& axis);
165
166 //! Fills an angle (radians) around an axis (unit vector)
167 void toAngleAxis (f32 &angle, core::vector3df& axis) const;
168
169 //! Output this quaternion to an euler angle (radians)
170 void toEuler(vector3df& euler) const;
171
172 //! Set quaternion to identity
173 quaternion& makeIdentity();
174
175 //! Set quaternion to represent a rotation from one vector to another.
176 quaternion& rotationFromTo(const vector3df& from, const vector3df& to);
177
178 //! Quaternion elements.
179 f32 X; // vectorial (imaginary) part
180 f32 Y;
181 f32 Z;
182 f32 W; // real part
183};
184
185
186// Constructor which converts euler angles to a quaternion
187inline quaternion::quaternion(f32 x, f32 y, f32 z)
188{
189 set(x,y,z);
190}
191
192
193// Constructor which converts euler angles to a quaternion
194inline quaternion::quaternion(const vector3df& vec)
195{
196 set(vec.X,vec.Y,vec.Z);
197}
198
199#if !IRR_TEST_BROKEN_QUATERNION_USE
200// Constructor which converts a matrix to a quaternion
201inline quaternion::quaternion(const matrix4& mat)
202{
203 (*this) = mat;
204}
205#endif
206
207// equal operator
208inline bool quaternion::operator==(const quaternion& other) const
209{
210 return ((X == other.X) &&
211 (Y == other.Y) &&
212 (Z == other.Z) &&
213 (W == other.W));
214}
215
216// inequality operator
217inline bool quaternion::operator!=(const quaternion& other) const
218{
219 return !(*this == other);
220}
221
222// assignment operator
223inline quaternion& quaternion::operator=(const quaternion& other)
224{
225 X = other.X;
226 Y = other.Y;
227 Z = other.Z;
228 W = other.W;
229 return *this;
230}
231
232#if !IRR_TEST_BROKEN_QUATERNION_USE
233// matrix assignment operator
234inline quaternion& quaternion::operator=(const matrix4& m)
235{
236 const f32 diag = m[0] + m[5] + m[10] + 1;
237
238 if( diag > 0.0f )
239 {
240 const f32 scale = sqrtf(diag) * 2.0f; // get scale from diagonal
241
242 // TODO: speed this up
243 X = (m[6] - m[9]) / scale;
244 Y = (m[8] - m[2]) / scale;
245 Z = (m[1] - m[4]) / scale;
246 W = 0.25f * scale;
247 }
248 else
249 {
250 if (m[0]>m[5] && m[0]>m[10])
251 {
252 // 1st element of diag is greatest value
253 // find scale according to 1st element, and double it
254 const f32 scale = sqrtf(1.0f + m[0] - m[5] - m[10]) * 2.0f;
255
256 // TODO: speed this up
257 X = 0.25f * scale;
258 Y = (m[4] + m[1]) / scale;
259 Z = (m[2] + m[8]) / scale;
260 W = (m[6] - m[9]) / scale;
261 }
262 else if (m[5]>m[10])
263 {
264 // 2nd element of diag is greatest value
265 // find scale according to 2nd element, and double it
266 const f32 scale = sqrtf(1.0f + m[5] - m[0] - m[10]) * 2.0f;
267
268 // TODO: speed this up
269 X = (m[4] + m[1]) / scale;
270 Y = 0.25f * scale;
271 Z = (m[9] + m[6]) / scale;
272 W = (m[8] - m[2]) / scale;
273 }
274 else
275 {
276 // 3rd element of diag is greatest value
277 // find scale according to 3rd element, and double it
278 const f32 scale = sqrtf(1.0f + m[10] - m[0] - m[5]) * 2.0f;
279
280 // TODO: speed this up
281 X = (m[8] + m[2]) / scale;
282 Y = (m[9] + m[6]) / scale;
283 Z = 0.25f * scale;
284 W = (m[1] - m[4]) / scale;
285 }
286 }
287
288 return normalize();
289}
290#endif
291
292
293// multiplication operator
294inline quaternion quaternion::operator*(const quaternion& other) const
295{
296 quaternion tmp;
297
298 tmp.W = (other.W * W) - (other.X * X) - (other.Y * Y) - (other.Z * Z);
299 tmp.X = (other.W * X) + (other.X * W) + (other.Y * Z) - (other.Z * Y);
300 tmp.Y = (other.W * Y) + (other.Y * W) + (other.Z * X) - (other.X * Z);
301 tmp.Z = (other.W * Z) + (other.Z * W) + (other.X * Y) - (other.Y * X);
302
303 return tmp;
304}
305
306
307// multiplication operator
308inline quaternion quaternion::operator*(f32 s) const
309{
310 return quaternion(s*X, s*Y, s*Z, s*W);
311}
312
313
314// multiplication operator
315inline quaternion& quaternion::operator*=(f32 s)
316{
317 X*=s;
318 Y*=s;
319 Z*=s;
320 W*=s;
321 return *this;
322}
323
324// multiplication operator
325inline quaternion& quaternion::operator*=(const quaternion& other)
326{
327 return (*this = other * (*this));
328}
329
330// add operator
331inline quaternion quaternion::operator+(const quaternion& b) const
332{
333 return quaternion(X+b.X, Y+b.Y, Z+b.Z, W+b.W);
334}
335
336#if !IRR_TEST_BROKEN_QUATERNION_USE
337// Creates a matrix from this quaternion
338inline matrix4 quaternion::getMatrix() const
339{
340 core::matrix4 m;
341 getMatrix(m);
342 return m;
343}
344#endif
345
346/*!
347 Creates a matrix from this quaternion
348*/
349inline void quaternion::getMatrix(matrix4 &dest,
350 const core::vector3df &center) const
351{
352 dest[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
353 dest[1] = 2.0f*X*Y + 2.0f*Z*W;
354 dest[2] = 2.0f*X*Z - 2.0f*Y*W;
355 dest[3] = 0.0f;
356
357 dest[4] = 2.0f*X*Y - 2.0f*Z*W;
358 dest[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
359 dest[6] = 2.0f*Z*Y + 2.0f*X*W;
360 dest[7] = 0.0f;
361
362 dest[8] = 2.0f*X*Z + 2.0f*Y*W;
363 dest[9] = 2.0f*Z*Y - 2.0f*X*W;
364 dest[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
365 dest[11] = 0.0f;
366
367 dest[12] = center.X;
368 dest[13] = center.Y;
369 dest[14] = center.Z;
370 dest[15] = 1.f;
371
372 dest.setDefinitelyIdentityMatrix ( false );
373}
374
375
376/*!
377 Creates a matrix from this quaternion
378 Rotate about a center point
379 shortcut for
380 core::quaternion q;
381 q.rotationFromTo(vin[i].Normal, forward);
382 q.getMatrix(lookat, center);
383
384 core::matrix4 m2;
385 m2.setInverseTranslation(center);
386 lookat *= m2;
387*/
388inline void quaternion::getMatrixCenter(matrix4 &dest,
389 const core::vector3df &center,
390 const core::vector3df &translation) const
391{
392 dest[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
393 dest[1] = 2.0f*X*Y + 2.0f*Z*W;
394 dest[2] = 2.0f*X*Z - 2.0f*Y*W;
395 dest[3] = 0.0f;
396
397 dest[4] = 2.0f*X*Y - 2.0f*Z*W;
398 dest[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
399 dest[6] = 2.0f*Z*Y + 2.0f*X*W;
400 dest[7] = 0.0f;
401
402 dest[8] = 2.0f*X*Z + 2.0f*Y*W;
403 dest[9] = 2.0f*Z*Y - 2.0f*X*W;
404 dest[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
405 dest[11] = 0.0f;
406
407 dest.setRotationCenter ( center, translation );
408}
409
410// Creates a matrix from this quaternion
411inline void quaternion::getMatrix_transposed(matrix4 &dest) const
412{
413 dest[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
414 dest[4] = 2.0f*X*Y + 2.0f*Z*W;
415 dest[8] = 2.0f*X*Z - 2.0f*Y*W;
416 dest[12] = 0.0f;
417
418 dest[1] = 2.0f*X*Y - 2.0f*Z*W;
419 dest[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
420 dest[9] = 2.0f*Z*Y + 2.0f*X*W;
421 dest[13] = 0.0f;
422
423 dest[2] = 2.0f*X*Z + 2.0f*Y*W;
424 dest[6] = 2.0f*Z*Y - 2.0f*X*W;
425 dest[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
426 dest[14] = 0.0f;
427
428 dest[3] = 0.f;
429 dest[7] = 0.f;
430 dest[11] = 0.f;
431 dest[15] = 1.f;
432
433 dest.setDefinitelyIdentityMatrix(false);
434}
435
436
437// Inverts this quaternion
438inline quaternion& quaternion::makeInverse()
439{
440 X = -X; Y = -Y; Z = -Z;
441 return *this;
442}
443
444
445// sets new quaternion
446inline quaternion& quaternion::set(f32 x, f32 y, f32 z, f32 w)
447{
448 X = x;
449 Y = y;
450 Z = z;
451 W = w;
452 return *this;
453}
454
455
456// sets new quaternion based on euler angles
457inline quaternion& quaternion::set(f32 x, f32 y, f32 z)
458{
459 f64 angle;
460
461 angle = x * 0.5;
462 const f64 sr = sin(angle);
463 const f64 cr = cos(angle);
464
465 angle = y * 0.5;
466 const f64 sp = sin(angle);
467 const f64 cp = cos(angle);
468
469 angle = z * 0.5;
470 const f64 sy = sin(angle);
471 const f64 cy = cos(angle);
472
473 const f64 cpcy = cp * cy;
474 const f64 spcy = sp * cy;
475 const f64 cpsy = cp * sy;
476 const f64 spsy = sp * sy;
477
478 X = (f32)(sr * cpcy - cr * spsy);
479 Y = (f32)(cr * spcy + sr * cpsy);
480 Z = (f32)(cr * cpsy - sr * spcy);
481 W = (f32)(cr * cpcy + sr * spsy);
482
483 return normalize();
484}
485
486// sets new quaternion based on euler angles
487inline quaternion& quaternion::set(const core::vector3df& vec)
488{
489 return set(vec.X, vec.Y, vec.Z);
490}
491
492// sets new quaternion based on other quaternion
493inline quaternion& quaternion::set(const core::quaternion& quat)
494{
495 return (*this=quat);
496}
497
498
499//! returns if this quaternion equals the other one, taking floating point rounding errors into account
500inline bool quaternion::equals(const quaternion& other, const f32 tolerance) const
501{
502 return core::equals(X, other.X, tolerance) &&
503 core::equals(Y, other.Y, tolerance) &&
504 core::equals(Z, other.Z, tolerance) &&
505 core::equals(W, other.W, tolerance);
506}
507
508
509// normalizes the quaternion
510inline quaternion& quaternion::normalize()
511{
512 const f32 n = X*X + Y*Y + Z*Z + W*W;
513
514 if (n == 1)
515 return *this;
516
517 //n = 1.0f / sqrtf(n);
518 return (*this *= reciprocal_squareroot ( n ));
519}
520
521
522// set this quaternion to the result of the linear interpolation between two quaternions
523inline quaternion& quaternion::lerp(quaternion q1, quaternion q2, f32 time)
524{
525 const f32 scale = 1.0f - time;
526 return (*this = (q1*scale) + (q2*time));
527}
528
529
530// set this quaternion to the result of the interpolation between two quaternions
531inline quaternion& quaternion::slerp(quaternion q1, quaternion q2, f32 time, f32 threshold)
532{
533 f32 angle = q1.dotProduct(q2);
534
535 // make sure we use the short rotation
536 if (angle < 0.0f)
537 {
538 q1 *= -1.0f;
539 angle *= -1.0f;
540 }
541
542 if (angle <= (1-threshold)) // spherical interpolation
543 {
544 const f32 theta = acosf(angle);
545 const f32 invsintheta = reciprocal(sinf(theta));
546 const f32 scale = sinf(theta * (1.0f-time)) * invsintheta;
547 const f32 invscale = sinf(theta * time) * invsintheta;
548 return (*this = (q1*scale) + (q2*invscale));
549 }
550 else // linear interploation
551 return lerp(q1,q2,time);
552}
553
554
555// calculates the dot product
556inline f32 quaternion::dotProduct(const quaternion& q2) const
557{
558 return (X * q2.X) + (Y * q2.Y) + (Z * q2.Z) + (W * q2.W);
559}
560
561
562//! axis must be unit length, angle in radians
563inline quaternion& quaternion::fromAngleAxis(f32 angle, const vector3df& axis)
564{
565 const f32 fHalfAngle = 0.5f*angle;
566 const f32 fSin = sinf(fHalfAngle);
567 W = cosf(fHalfAngle);
568 X = fSin*axis.X;
569 Y = fSin*axis.Y;
570 Z = fSin*axis.Z;
571 return *this;
572}
573
574
575inline void quaternion::toAngleAxis(f32 &angle, core::vector3df &axis) const
576{
577 const f32 scale = sqrtf(X*X + Y*Y + Z*Z);
578
579 if (core::iszero(scale) || W > 1.0f || W < -1.0f)
580 {
581 angle = 0.0f;
582 axis.X = 0.0f;
583 axis.Y = 1.0f;
584 axis.Z = 0.0f;
585 }
586 else
587 {
588 const f32 invscale = reciprocal(scale);
589 angle = 2.0f * acosf(W);
590 axis.X = X * invscale;
591 axis.Y = Y * invscale;
592 axis.Z = Z * invscale;
593 }
594}
595
596inline void quaternion::toEuler(vector3df& euler) const
597{
598 const f64 sqw = W*W;
599 const f64 sqx = X*X;
600 const f64 sqy = Y*Y;
601 const f64 sqz = Z*Z;
602 const f64 test = 2.0 * (Y*W - X*Z);
603
604 if (core::equals(test, 1.0, 0.000001))
605 {
606 // heading = rotation about z-axis
607 euler.Z = (f32) (-2.0*atan2(X, W));
608 // bank = rotation about x-axis
609 euler.X = 0;
610 // attitude = rotation about y-axis
611 euler.Y = (f32) (core::PI64/2.0);
612 }
613 else if (core::equals(test, -1.0, 0.000001))
614 {
615 // heading = rotation about z-axis
616 euler.Z = (f32) (2.0*atan2(X, W));
617 // bank = rotation about x-axis
618 euler.X = 0;
619 // attitude = rotation about y-axis
620 euler.Y = (f32) (core::PI64/-2.0);
621 }
622 else
623 {
624 // heading = rotation about z-axis
625 euler.Z = (f32) atan2(2.0 * (X*Y +Z*W),(sqx - sqy - sqz + sqw));
626 // bank = rotation about x-axis
627 euler.X = (f32) atan2(2.0 * (Y*Z +X*W),(-sqx - sqy + sqz + sqw));
628 // attitude = rotation about y-axis
629 euler.Y = (f32) asin( clamp(test, -1.0, 1.0) );
630 }
631}
632
633
634inline vector3df quaternion::operator* (const vector3df& v) const
635{
636 // nVidia SDK implementation
637
638 vector3df uv, uuv;
639 vector3df qvec(X, Y, Z);
640 uv = qvec.crossProduct(v);
641 uuv = qvec.crossProduct(uv);
642 uv *= (2.0f * W);
643 uuv *= 2.0f;
644
645 return v + uv + uuv;
646}
647
648// set quaternion to identity
649inline core::quaternion& quaternion::makeIdentity()
650{
651 W = 1.f;
652 X = 0.f;
653 Y = 0.f;
654 Z = 0.f;
655 return *this;
656}
657
658inline core::quaternion& quaternion::rotationFromTo(const vector3df& from, const vector3df& to)
659{
660 // Based on Stan Melax's article in Game Programming Gems
661 // Copy, since cannot modify local
662 vector3df v0 = from;
663 vector3df v1 = to;
664 v0.normalize();
665 v1.normalize();
666
667 const f32 d = v0.dotProduct(v1);
668 if (d >= 1.0f) // If dot == 1, vectors are the same
669 {
670 return makeIdentity();
671 }
672 else if (d <= -1.0f) // exactly opposite
673 {
674 core::vector3df axis(1.0f, 0.f, 0.f);
675 axis = axis.crossProduct(v0);
676 if (axis.getLength()==0)
677 {
678 axis.set(0.f,1.f,0.f);
679 axis = axis.crossProduct(v0);
680 }
681 // same as fromAngleAxis(core::PI, axis).normalize();
682 return set(axis.X, axis.Y, axis.Z, 0).normalize();
683 }
684
685 const f32 s = sqrtf( (1+d)*2 ); // optimize inv_sqrt
686 const f32 invs = 1.f / s;
687 const vector3df c = v0.crossProduct(v1)*invs;
688 return set(c.X, c.Y, c.Z, s * 0.5f).normalize();
689}
690
691
692} // end namespace core
693} // end namespace irr
694
695#endif
696
diff --git a/src/others/irrlicht-1.8.1/include/rect.h b/src/others/irrlicht-1.8.1/include/rect.h
new file mode 100644
index 0000000..3f3883e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/rect.h
@@ -0,0 +1,279 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_RECT_H_INCLUDED__
6#define __IRR_RECT_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "dimension2d.h"
10#include "position2d.h"
11
12namespace irr
13{
14namespace core
15{
16
17 //! Rectangle template.
18 /** Mostly used by 2D GUI elements and for 2D drawing methods.
19 It has 2 positions instead of position and dimension and a fast
20 method for collision detection with other rectangles and points.
21
22 Coordinates are (0,0) for top-left corner, and increasing to the right
23 and to the bottom.
24 */
25 template <class T>
26 class rect
27 {
28 public:
29
30 //! Default constructor creating empty rectangle at (0,0)
31 rect() : UpperLeftCorner(0,0), LowerRightCorner(0,0) {}
32
33 //! Constructor with two corners
34 rect(T x, T y, T x2, T y2)
35 : UpperLeftCorner(x,y), LowerRightCorner(x2,y2) {}
36
37 //! Constructor with two corners
38 rect(const position2d<T>& upperLeft, const position2d<T>& lowerRight)
39 : UpperLeftCorner(upperLeft), LowerRightCorner(lowerRight) {}
40
41 //! Constructor with upper left corner and dimension
42 template <class U>
43 rect(const position2d<T>& pos, const dimension2d<U>& size)
44 : UpperLeftCorner(pos), LowerRightCorner(pos.X + size.Width, pos.Y + size.Height) {}
45
46 //! move right by given numbers
47 rect<T> operator+(const position2d<T>& pos) const
48 {
49 rect<T> ret(*this);
50 return ret+=pos;
51 }
52
53 //! move right by given numbers
54 rect<T>& operator+=(const position2d<T>& pos)
55 {
56 UpperLeftCorner += pos;
57 LowerRightCorner += pos;
58 return *this;
59 }
60
61 //! move left by given numbers
62 rect<T> operator-(const position2d<T>& pos) const
63 {
64 rect<T> ret(*this);
65 return ret-=pos;
66 }
67
68 //! move left by given numbers
69 rect<T>& operator-=(const position2d<T>& pos)
70 {
71 UpperLeftCorner -= pos;
72 LowerRightCorner -= pos;
73 return *this;
74 }
75
76 //! equality operator
77 bool operator==(const rect<T>& other) const
78 {
79 return (UpperLeftCorner == other.UpperLeftCorner &&
80 LowerRightCorner == other.LowerRightCorner);
81 }
82
83 //! inequality operator
84 bool operator!=(const rect<T>& other) const
85 {
86 return (UpperLeftCorner != other.UpperLeftCorner ||
87 LowerRightCorner != other.LowerRightCorner);
88 }
89
90 //! compares size of rectangles
91 bool operator<(const rect<T>& other) const
92 {
93 return getArea() < other.getArea();
94 }
95
96 //! Returns size of rectangle
97 T getArea() const
98 {
99 return getWidth() * getHeight();
100 }
101
102 //! Returns if a 2d point is within this rectangle.
103 /** \param pos Position to test if it lies within this rectangle.
104 \return True if the position is within the rectangle, false if not. */
105 bool isPointInside(const position2d<T>& pos) const
106 {
107 return (UpperLeftCorner.X <= pos.X &&
108 UpperLeftCorner.Y <= pos.Y &&
109 LowerRightCorner.X >= pos.X &&
110 LowerRightCorner.Y >= pos.Y);
111 }
112
113 //! Check if the rectangle collides with another rectangle.
114 /** \param other Rectangle to test collision with
115 \return True if the rectangles collide. */
116 bool isRectCollided(const rect<T>& other) const
117 {
118 return (LowerRightCorner.Y > other.UpperLeftCorner.Y &&
119 UpperLeftCorner.Y < other.LowerRightCorner.Y &&
120 LowerRightCorner.X > other.UpperLeftCorner.X &&
121 UpperLeftCorner.X < other.LowerRightCorner.X);
122 }
123
124 //! Clips this rectangle with another one.
125 /** \param other Rectangle to clip with */
126 void clipAgainst(const rect<T>& other)
127 {
128 if (other.LowerRightCorner.X < LowerRightCorner.X)
129 LowerRightCorner.X = other.LowerRightCorner.X;
130 if (other.LowerRightCorner.Y < LowerRightCorner.Y)
131 LowerRightCorner.Y = other.LowerRightCorner.Y;
132
133 if (other.UpperLeftCorner.X > UpperLeftCorner.X)
134 UpperLeftCorner.X = other.UpperLeftCorner.X;
135 if (other.UpperLeftCorner.Y > UpperLeftCorner.Y)
136 UpperLeftCorner.Y = other.UpperLeftCorner.Y;
137
138 // correct possible invalid rect resulting from clipping
139 if (UpperLeftCorner.Y > LowerRightCorner.Y)
140 UpperLeftCorner.Y = LowerRightCorner.Y;
141 if (UpperLeftCorner.X > LowerRightCorner.X)
142 UpperLeftCorner.X = LowerRightCorner.X;
143 }
144
145 //! Moves this rectangle to fit inside another one.
146 /** \return True on success, false if not possible */
147 bool constrainTo(const rect<T>& other)
148 {
149 if (other.getWidth() < getWidth() || other.getHeight() < getHeight())
150 return false;
151
152 T diff = other.LowerRightCorner.X - LowerRightCorner.X;
153 if (diff < 0)
154 {
155 LowerRightCorner.X += diff;
156 UpperLeftCorner.X += diff;
157 }
158
159 diff = other.LowerRightCorner.Y - LowerRightCorner.Y;
160 if (diff < 0)
161 {
162 LowerRightCorner.Y += diff;
163 UpperLeftCorner.Y += diff;
164 }
165
166 diff = UpperLeftCorner.X - other.UpperLeftCorner.X;
167 if (diff < 0)
168 {
169 UpperLeftCorner.X -= diff;
170 LowerRightCorner.X -= diff;
171 }
172
173 diff = UpperLeftCorner.Y - other.UpperLeftCorner.Y;
174 if (diff < 0)
175 {
176 UpperLeftCorner.Y -= diff;
177 LowerRightCorner.Y -= diff;
178 }
179
180 return true;
181 }
182
183 //! Get width of rectangle.
184 T getWidth() const
185 {
186 return LowerRightCorner.X - UpperLeftCorner.X;
187 }
188
189 //! Get height of rectangle.
190 T getHeight() const
191 {
192 return LowerRightCorner.Y - UpperLeftCorner.Y;
193 }
194
195 //! If the lower right corner of the rect is smaller then the upper left, the points are swapped.
196 void repair()
197 {
198 if (LowerRightCorner.X < UpperLeftCorner.X)
199 {
200 T t = LowerRightCorner.X;
201 LowerRightCorner.X = UpperLeftCorner.X;
202 UpperLeftCorner.X = t;
203 }
204
205 if (LowerRightCorner.Y < UpperLeftCorner.Y)
206 {
207 T t = LowerRightCorner.Y;
208 LowerRightCorner.Y = UpperLeftCorner.Y;
209 UpperLeftCorner.Y = t;
210 }
211 }
212
213 //! Returns if the rect is valid to draw.
214 /** It would be invalid if the UpperLeftCorner is lower or more
215 right than the LowerRightCorner. */
216 bool isValid() const
217 {
218 return ((LowerRightCorner.X >= UpperLeftCorner.X) &&
219 (LowerRightCorner.Y >= UpperLeftCorner.Y));
220 }
221
222 //! Get the center of the rectangle
223 position2d<T> getCenter() const
224 {
225 return position2d<T>(
226 (UpperLeftCorner.X + LowerRightCorner.X) / 2,
227 (UpperLeftCorner.Y + LowerRightCorner.Y) / 2);
228 }
229
230 //! Get the dimensions of the rectangle
231 dimension2d<T> getSize() const
232 {
233 return dimension2d<T>(getWidth(), getHeight());
234 }
235
236
237 //! Adds a point to the rectangle
238 /** Causes the rectangle to grow bigger if point is outside of
239 the box
240 \param p Point to add to the box. */
241 void addInternalPoint(const position2d<T>& p)
242 {
243 addInternalPoint(p.X, p.Y);
244 }
245
246 //! Adds a point to the bounding rectangle
247 /** Causes the rectangle to grow bigger if point is outside of
248 the box
249 \param x X-Coordinate of the point to add to this box.
250 \param y Y-Coordinate of the point to add to this box. */
251 void addInternalPoint(T x, T y)
252 {
253 if (x>LowerRightCorner.X)
254 LowerRightCorner.X = x;
255 if (y>LowerRightCorner.Y)
256 LowerRightCorner.Y = y;
257
258 if (x<UpperLeftCorner.X)
259 UpperLeftCorner.X = x;
260 if (y<UpperLeftCorner.Y)
261 UpperLeftCorner.Y = y;
262 }
263
264 //! Upper left corner
265 position2d<T> UpperLeftCorner;
266 //! Lower right corner
267 position2d<T> LowerRightCorner;
268 };
269
270 //! Rectangle with float values
271 typedef rect<f32> rectf;
272 //! Rectangle with int values
273 typedef rect<s32> recti;
274
275} // end namespace core
276} // end namespace irr
277
278#endif
279
diff --git a/src/others/irrlicht-1.8.1/include/triangle3d.h b/src/others/irrlicht-1.8.1/include/triangle3d.h
new file mode 100644
index 0000000..2f5a36c
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/triangle3d.h
@@ -0,0 +1,279 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_TRIANGLE_3D_H_INCLUDED__
6#define __IRR_TRIANGLE_3D_H_INCLUDED__
7
8#include "vector3d.h"
9#include "line3d.h"
10#include "plane3d.h"
11#include "aabbox3d.h"
12
13namespace irr
14{
15namespace core
16{
17
18 //! 3d triangle template class for doing collision detection and other things.
19 template <class T>
20 class triangle3d
21 {
22 public:
23
24 //! Constructor for an all 0 triangle
25 triangle3d() {}
26 //! Constructor for triangle with given three vertices
27 triangle3d(vector3d<T> v1, vector3d<T> v2, vector3d<T> v3) : pointA(v1), pointB(v2), pointC(v3) {}
28
29 //! Equality operator
30 bool operator==(const triangle3d<T>& other) const
31 {
32 return other.pointA==pointA && other.pointB==pointB && other.pointC==pointC;
33 }
34
35 //! Inequality operator
36 bool operator!=(const triangle3d<T>& other) const
37 {
38 return !(*this==other);
39 }
40
41 //! Determines if the triangle is totally inside a bounding box.
42 /** \param box Box to check.
43 \return True if triangle is within the box, otherwise false. */
44 bool isTotalInsideBox(const aabbox3d<T>& box) const
45 {
46 return (box.isPointInside(pointA) &&
47 box.isPointInside(pointB) &&
48 box.isPointInside(pointC));
49 }
50
51 //! Determines if the triangle is totally outside a bounding box.
52 /** \param box Box to check.
53 \return True if triangle is outside the box, otherwise false. */
54 bool isTotalOutsideBox(const aabbox3d<T>& box) const
55 {
56 return ((pointA.X > box.MaxEdge.X && pointB.X > box.MaxEdge.X && pointC.X > box.MaxEdge.X) ||
57
58 (pointA.Y > box.MaxEdge.Y && pointB.Y > box.MaxEdge.Y && pointC.Y > box.MaxEdge.Y) ||
59 (pointA.Z > box.MaxEdge.Z && pointB.Z > box.MaxEdge.Z && pointC.Z > box.MaxEdge.Z) ||
60 (pointA.X < box.MinEdge.X && pointB.X < box.MinEdge.X && pointC.X < box.MinEdge.X) ||
61 (pointA.Y < box.MinEdge.Y && pointB.Y < box.MinEdge.Y && pointC.Y < box.MinEdge.Y) ||
62 (pointA.Z < box.MinEdge.Z && pointB.Z < box.MinEdge.Z && pointC.Z < box.MinEdge.Z));
63 }
64
65 //! Get the closest point on a triangle to a point on the same plane.
66 /** \param p Point which must be on the same plane as the triangle.
67 \return The closest point of the triangle */
68 core::vector3d<T> closestPointOnTriangle(const core::vector3d<T>& p) const
69 {
70 const core::vector3d<T> rab = line3d<T>(pointA, pointB).getClosestPoint(p);
71 const core::vector3d<T> rbc = line3d<T>(pointB, pointC).getClosestPoint(p);
72 const core::vector3d<T> rca = line3d<T>(pointC, pointA).getClosestPoint(p);
73
74 const T d1 = rab.getDistanceFrom(p);
75 const T d2 = rbc.getDistanceFrom(p);
76 const T d3 = rca.getDistanceFrom(p);
77
78 if (d1 < d2)
79 return d1 < d3 ? rab : rca;
80
81 return d2 < d3 ? rbc : rca;
82 }
83
84 //! Check if a point is inside the triangle (border-points count also as inside)
85 /*
86 \param p Point to test. Assumes that this point is already
87 on the plane of the triangle.
88 \return True if the point is inside the triangle, otherwise false. */
89 bool isPointInside(const vector3d<T>& p) const
90 {
91 vector3d<f64> af64((f64)pointA.X, (f64)pointA.Y, (f64)pointA.Z);
92 vector3d<f64> bf64((f64)pointB.X, (f64)pointB.Y, (f64)pointB.Z);
93 vector3d<f64> cf64((f64)pointC.X, (f64)pointC.Y, (f64)pointC.Z);
94 vector3d<f64> pf64((f64)p.X, (f64)p.Y, (f64)p.Z);
95 return (isOnSameSide(pf64, af64, bf64, cf64) &&
96 isOnSameSide(pf64, bf64, af64, cf64) &&
97 isOnSameSide(pf64, cf64, af64, bf64));
98 }
99
100 //! Check if a point is inside the triangle (border-points count also as inside)
101 /** This method uses a barycentric coordinate system.
102 It is faster than isPointInside but is more susceptible to floating point rounding
103 errors. This will especially be noticable when the FPU is in single precision mode
104 (which is for example set on default by Direct3D).
105 \param p Point to test. Assumes that this point is already
106 on the plane of the triangle.
107 \return True if point is inside the triangle, otherwise false. */
108 bool isPointInsideFast(const vector3d<T>& p) const
109 {
110 const vector3d<T> a = pointC - pointA;
111 const vector3d<T> b = pointB - pointA;
112 const vector3d<T> c = p - pointA;
113
114 const f64 dotAA = a.dotProduct( a);
115 const f64 dotAB = a.dotProduct( b);
116 const f64 dotAC = a.dotProduct( c);
117 const f64 dotBB = b.dotProduct( b);
118 const f64 dotBC = b.dotProduct( c);
119
120 // get coordinates in barycentric coordinate system
121 const f64 invDenom = 1/(dotAA * dotBB - dotAB * dotAB);
122 const f64 u = (dotBB * dotAC - dotAB * dotBC) * invDenom;
123 const f64 v = (dotAA * dotBC - dotAB * dotAC ) * invDenom;
124
125 // We count border-points as inside to keep downward compatibility.
126 // Rounding-error also needed for some test-cases.
127 return (u > -ROUNDING_ERROR_f32) && (v >= 0) && (u + v < 1+ROUNDING_ERROR_f32);
128
129 }
130
131
132 //! Get an intersection with a 3d line.
133 /** \param line Line to intersect with.
134 \param outIntersection Place to store the intersection point, if there is one.
135 \return True if there was an intersection, false if not. */
136 bool getIntersectionWithLimitedLine(const line3d<T>& line,
137 vector3d<T>& outIntersection) const
138 {
139 return getIntersectionWithLine(line.start,
140 line.getVector(), outIntersection) &&
141 outIntersection.isBetweenPoints(line.start, line.end);
142 }
143
144
145 //! Get an intersection with a 3d line.
146 /** Please note that also points are returned as intersection which
147 are on the line, but not between the start and end point of the line.
148 If you want the returned point be between start and end
149 use getIntersectionWithLimitedLine().
150 \param linePoint Point of the line to intersect with.
151 \param lineVect Vector of the line to intersect with.
152 \param outIntersection Place to store the intersection point, if there is one.
153 \return True if there was an intersection, false if there was not. */
154 bool getIntersectionWithLine(const vector3d<T>& linePoint,
155 const vector3d<T>& lineVect, vector3d<T>& outIntersection) const
156 {
157 if (getIntersectionOfPlaneWithLine(linePoint, lineVect, outIntersection))
158 return isPointInside(outIntersection);
159
160 return false;
161 }
162
163
164 //! Calculates the intersection between a 3d line and the plane the triangle is on.
165 /** \param lineVect Vector of the line to intersect with.
166 \param linePoint Point of the line to intersect with.
167 \param outIntersection Place to store the intersection point, if there is one.
168 \return True if there was an intersection, else false. */
169 bool getIntersectionOfPlaneWithLine(const vector3d<T>& linePoint,
170 const vector3d<T>& lineVect, vector3d<T>& outIntersection) const
171 {
172 // Work with f64 to get more precise results (makes enough difference to be worth the casts).
173 const vector3d<f64> linePointf64(linePoint.X, linePoint.Y, linePoint.Z);
174 const vector3d<f64> lineVectf64(lineVect.X, lineVect.Y, lineVect.Z);
175 vector3d<f64> outIntersectionf64;
176
177 core::triangle3d<irr::f64> trianglef64(vector3d<f64>((f64)pointA.X, (f64)pointA.Y, (f64)pointA.Z)
178 ,vector3d<f64>((f64)pointB.X, (f64)pointB.Y, (f64)pointB.Z)
179 , vector3d<f64>((f64)pointC.X, (f64)pointC.Y, (f64)pointC.Z));
180 const vector3d<irr::f64> normalf64 = trianglef64.getNormal().normalize();
181 f64 t2;
182
183 if ( core::iszero ( t2 = normalf64.dotProduct(lineVectf64) ) )
184 return false;
185
186 f64 d = trianglef64.pointA.dotProduct(normalf64);
187 f64 t = -(normalf64.dotProduct(linePointf64) - d) / t2;
188 outIntersectionf64 = linePointf64 + (lineVectf64 * t);
189
190 outIntersection.X = (T)outIntersectionf64.X;
191 outIntersection.Y = (T)outIntersectionf64.Y;
192 outIntersection.Z = (T)outIntersectionf64.Z;
193 return true;
194 }
195
196
197 //! Get the normal of the triangle.
198 /** Please note: The normal is not always normalized. */
199 vector3d<T> getNormal() const
200 {
201 return (pointB - pointA).crossProduct(pointC - pointA);
202 }
203
204 //! Test if the triangle would be front or backfacing from any point.
205 /** Thus, this method assumes a camera position from which the
206 triangle is definitely visible when looking at the given direction.
207 Do not use this method with points as it will give wrong results!
208 \param lookDirection Look direction.
209 \return True if the plane is front facing and false if it is backfacing. */
210 bool isFrontFacing(const vector3d<T>& lookDirection) const
211 {
212 const vector3d<T> n = getNormal().normalize();
213 const f32 d = (f32)n.dotProduct(lookDirection);
214 return F32_LOWER_EQUAL_0(d);
215 }
216
217 //! Get the plane of this triangle.
218 plane3d<T> getPlane() const
219 {
220 return plane3d<T>(pointA, pointB, pointC);
221 }
222
223 //! Get the area of the triangle
224 T getArea() const
225 {
226 return (pointB - pointA).crossProduct(pointC - pointA).getLength() * 0.5f;
227
228 }
229
230 //! sets the triangle's points
231 void set(const core::vector3d<T>& a, const core::vector3d<T>& b, const core::vector3d<T>& c)
232 {
233 pointA = a;
234 pointB = b;
235 pointC = c;
236 }
237
238 //! the three points of the triangle
239 vector3d<T> pointA;
240 vector3d<T> pointB;
241 vector3d<T> pointC;
242
243 private:
244 // Using f64 instead of <T> to avoid integer overflows when T=int (maybe also less floating point troubles).
245 bool isOnSameSide(const vector3d<f64>& p1, const vector3d<f64>& p2,
246 const vector3d<f64>& a, const vector3d<f64>& b) const
247 {
248 vector3d<f64> bminusa = b - a;
249 vector3d<f64> cp1 = bminusa.crossProduct(p1 - a);
250 vector3d<f64> cp2 = bminusa.crossProduct(p2 - a);
251 f64 res = cp1.dotProduct(cp2);
252 if ( res < 0 )
253 {
254 // This catches some floating point troubles.
255 // Unfortunately slightly expensive and we don't really know the best epsilon for iszero.
256 vector3d<f64> cp1 = bminusa.normalize().crossProduct((p1 - a).normalize());
257 if ( core::iszero(cp1.X, (f64)ROUNDING_ERROR_f32)
258 && core::iszero(cp1.Y, (f64)ROUNDING_ERROR_f32)
259 && core::iszero(cp1.Z, (f64)ROUNDING_ERROR_f32) )
260 {
261 res = 0.f;
262 }
263 }
264 return (res >= 0.0f);
265 }
266 };
267
268
269 //! Typedef for a f32 3d triangle.
270 typedef triangle3d<f32> triangle3df;
271
272 //! Typedef for an integer 3d triangle.
273 typedef triangle3d<s32> triangle3di;
274
275} // end namespace core
276} // end namespace irr
277
278#endif
279
diff --git a/src/others/irrlicht-1.8.1/include/vector2d.h b/src/others/irrlicht-1.8.1/include/vector2d.h
new file mode 100644
index 0000000..360da8f
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/vector2d.h
@@ -0,0 +1,342 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_POINT_2D_H_INCLUDED__
6#define __IRR_POINT_2D_H_INCLUDED__
7
8#include "irrMath.h"
9#include "dimension2d.h"
10
11namespace irr
12{
13namespace core
14{
15
16
17//! 2d vector template class with lots of operators and methods.
18/** As of Irrlicht 1.6, this class supercedes position2d, which should
19 be considered deprecated. */
20template <class T>
21class vector2d
22{
23public:
24 //! Default constructor (null vector)
25 vector2d() : X(0), Y(0) {}
26 //! Constructor with two different values
27 vector2d(T nx, T ny) : X(nx), Y(ny) {}
28 //! Constructor with the same value for both members
29 explicit vector2d(T n) : X(n), Y(n) {}
30 //! Copy constructor
31 vector2d(const vector2d<T>& other) : X(other.X), Y(other.Y) {}
32
33 vector2d(const dimension2d<T>& other) : X(other.Width), Y(other.Height) {}
34
35 // operators
36
37 vector2d<T> operator-() const { return vector2d<T>(-X, -Y); }
38
39 vector2d<T>& operator=(const vector2d<T>& other) { X = other.X; Y = other.Y; return *this; }
40
41 vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; }
42
43 vector2d<T> operator+(const vector2d<T>& other) const { return vector2d<T>(X + other.X, Y + other.Y); }
44 vector2d<T> operator+(const dimension2d<T>& other) const { return vector2d<T>(X + other.Width, Y + other.Height); }
45 vector2d<T>& operator+=(const vector2d<T>& other) { X+=other.X; Y+=other.Y; return *this; }
46 vector2d<T> operator+(const T v) const { return vector2d<T>(X + v, Y + v); }
47 vector2d<T>& operator+=(const T v) { X+=v; Y+=v; return *this; }
48 vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Height; return *this; }
49
50 vector2d<T> operator-(const vector2d<T>& other) const { return vector2d<T>(X - other.X, Y - other.Y); }
51 vector2d<T> operator-(const dimension2d<T>& other) const { return vector2d<T>(X - other.Width, Y - other.Height); }
52 vector2d<T>& operator-=(const vector2d<T>& other) { X-=other.X; Y-=other.Y; return *this; }
53 vector2d<T> operator-(const T v) const { return vector2d<T>(X - v, Y - v); }
54 vector2d<T>& operator-=(const T v) { X-=v; Y-=v; return *this; }
55 vector2d<T>& operator-=(const dimension2d<T>& other) { X -= other.Width; Y -= other.Height; return *this; }
56
57 vector2d<T> operator*(const vector2d<T>& other) const { return vector2d<T>(X * other.X, Y * other.Y); }
58 vector2d<T>& operator*=(const vector2d<T>& other) { X*=other.X; Y*=other.Y; return *this; }
59 vector2d<T> operator*(const T v) const { return vector2d<T>(X * v, Y * v); }
60 vector2d<T>& operator*=(const T v) { X*=v; Y*=v; return *this; }
61
62 vector2d<T> operator/(const vector2d<T>& other) const { return vector2d<T>(X / other.X, Y / other.Y); }
63 vector2d<T>& operator/=(const vector2d<T>& other) { X/=other.X; Y/=other.Y; return *this; }
64 vector2d<T> operator/(const T v) const { return vector2d<T>(X / v, Y / v); }
65 vector2d<T>& operator/=(const T v) { X/=v; Y/=v; return *this; }
66
67 //! sort in order X, Y. Equality with rounding tolerance.
68 bool operator<=(const vector2d<T>&other) const
69 {
70 return (X<other.X || core::equals(X, other.X)) ||
71 (core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y)));
72 }
73
74 //! sort in order X, Y. Equality with rounding tolerance.
75 bool operator>=(const vector2d<T>&other) const
76 {
77 return (X>other.X || core::equals(X, other.X)) ||
78 (core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y)));
79 }
80
81 //! sort in order X, Y. Difference must be above rounding tolerance.
82 bool operator<(const vector2d<T>&other) const
83 {
84 return (X<other.X && !core::equals(X, other.X)) ||
85 (core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y));
86 }
87
88 //! sort in order X, Y. Difference must be above rounding tolerance.
89 bool operator>(const vector2d<T>&other) const
90 {
91 return (X>other.X && !core::equals(X, other.X)) ||
92 (core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y));
93 }
94
95 bool operator==(const vector2d<T>& other) const { return equals(other); }
96 bool operator!=(const vector2d<T>& other) const { return !equals(other); }
97
98 // functions
99
100 //! Checks if this vector equals the other one.
101 /** Takes floating point rounding errors into account.
102 \param other Vector to compare with.
103 \return True if the two vector are (almost) equal, else false. */
104 bool equals(const vector2d<T>& other) const
105 {
106 return core::equals(X, other.X) && core::equals(Y, other.Y);
107 }
108
109 vector2d<T>& set(T nx, T ny) {X=nx; Y=ny; return *this; }
110 vector2d<T>& set(const vector2d<T>& p) { X=p.X; Y=p.Y; return *this; }
111
112 //! Gets the length of the vector.
113 /** \return The length of the vector. */
114 T getLength() const { return core::squareroot( X*X + Y*Y ); }
115
116 //! Get the squared length of this vector
117 /** This is useful because it is much faster than getLength().
118 \return The squared length of the vector. */
119 T getLengthSQ() const { return X*X + Y*Y; }
120
121 //! Get the dot product of this vector with another.
122 /** \param other Other vector to take dot product with.
123 \return The dot product of the two vectors. */
124 T dotProduct(const vector2d<T>& other) const
125 {
126 return X*other.X + Y*other.Y;
127 }
128
129 //! Gets distance from another point.
130 /** Here, the vector is interpreted as a point in 2-dimensional space.
131 \param other Other vector to measure from.
132 \return Distance from other point. */
133 T getDistanceFrom(const vector2d<T>& other) const
134 {
135 return vector2d<T>(X - other.X, Y - other.Y).getLength();
136 }
137
138 //! Returns squared distance from another point.
139 /** Here, the vector is interpreted as a point in 2-dimensional space.
140 \param other Other vector to measure from.
141 \return Squared distance from other point. */
142 T getDistanceFromSQ(const vector2d<T>& other) const
143 {
144 return vector2d<T>(X - other.X, Y - other.Y).getLengthSQ();
145 }
146
147 //! rotates the point anticlockwise around a center by an amount of degrees.
148 /** \param degrees Amount of degrees to rotate by, anticlockwise.
149 \param center Rotation center.
150 \return This vector after transformation. */
151 vector2d<T>& rotateBy(f64 degrees, const vector2d<T>& center=vector2d<T>())
152 {
153 degrees *= DEGTORAD64;
154 const f64 cs = cos(degrees);
155 const f64 sn = sin(degrees);
156
157 X -= center.X;
158 Y -= center.Y;
159
160 set((T)(X*cs - Y*sn), (T)(X*sn + Y*cs));
161
162 X += center.X;
163 Y += center.Y;
164 return *this;
165 }
166
167 //! Normalize the vector.
168 /** The null vector is left untouched.
169 \return Reference to this vector, after normalization. */
170 vector2d<T>& normalize()
171 {
172 f32 length = (f32)(X*X + Y*Y);
173 if ( length == 0 )
174 return *this;
175 length = core::reciprocal_squareroot ( length );
176 X = (T)(X * length);
177 Y = (T)(Y * length);
178 return *this;
179 }
180
181 //! Calculates the angle of this vector in degrees in the trigonometric sense.
182 /** 0 is to the right (3 o'clock), values increase counter-clockwise.
183 This method has been suggested by Pr3t3nd3r.
184 \return Returns a value between 0 and 360. */
185 f64 getAngleTrig() const
186 {
187 if (Y == 0)
188 return X < 0 ? 180 : 0;
189 else
190 if (X == 0)
191 return Y < 0 ? 270 : 90;
192
193 if ( Y > 0)
194 if (X > 0)
195 return atan((irr::f64)Y/(irr::f64)X) * RADTODEG64;
196 else
197 return 180.0-atan((irr::f64)Y/-(irr::f64)X) * RADTODEG64;
198 else
199 if (X > 0)
200 return 360.0-atan(-(irr::f64)Y/(irr::f64)X) * RADTODEG64;
201 else
202 return 180.0+atan(-(irr::f64)Y/-(irr::f64)X) * RADTODEG64;
203 }
204
205 //! Calculates the angle of this vector in degrees in the counter trigonometric sense.
206 /** 0 is to the right (3 o'clock), values increase clockwise.
207 \return Returns a value between 0 and 360. */
208 inline f64 getAngle() const
209 {
210 if (Y == 0) // corrected thanks to a suggestion by Jox
211 return X < 0 ? 180 : 0;
212 else if (X == 0)
213 return Y < 0 ? 90 : 270;
214
215 // don't use getLength here to avoid precision loss with s32 vectors
216 // avoid floating-point trouble as sqrt(y*y) is occasionally larger than y, so clamp
217 const f64 tmp = core::clamp(Y / sqrt((f64)(X*X + Y*Y)), -1.0, 1.0);
218 const f64 angle = atan( core::squareroot(1 - tmp*tmp) / tmp) * RADTODEG64;
219
220 if (X>0 && Y>0)
221 return angle + 270;
222 else
223 if (X>0 && Y<0)
224 return angle + 90;
225 else
226 if (X<0 && Y<0)
227 return 90 - angle;
228 else
229 if (X<0 && Y>0)
230 return 270 - angle;
231
232 return angle;
233 }
234
235 //! Calculates the angle between this vector and another one in degree.
236 /** \param b Other vector to test with.
237 \return Returns a value between 0 and 90. */
238 inline f64 getAngleWith(const vector2d<T>& b) const
239 {
240 f64 tmp = (f64)(X*b.X + Y*b.Y);
241
242 if (tmp == 0.0)
243 return 90.0;
244
245 tmp = tmp / core::squareroot((f64)((X*X + Y*Y) * (b.X*b.X + b.Y*b.Y)));
246 if (tmp < 0.0)
247 tmp = -tmp;
248 if ( tmp > 1.0 ) // avoid floating-point trouble
249 tmp = 1.0;
250
251 return atan(sqrt(1 - tmp*tmp) / tmp) * RADTODEG64;
252 }
253
254 //! Returns if this vector interpreted as a point is on a line between two other points.
255 /** It is assumed that the point is on the line.
256 \param begin Beginning vector to compare between.
257 \param end Ending vector to compare between.
258 \return True if this vector is between begin and end, false if not. */
259 bool isBetweenPoints(const vector2d<T>& begin, const vector2d<T>& end) const
260 {
261 if (begin.X != end.X)
262 {
263 return ((begin.X <= X && X <= end.X) ||
264 (begin.X >= X && X >= end.X));
265 }
266 else
267 {
268 return ((begin.Y <= Y && Y <= end.Y) ||
269 (begin.Y >= Y && Y >= end.Y));
270 }
271 }
272
273 //! Creates an interpolated vector between this vector and another vector.
274 /** \param other The other vector to interpolate with.
275 \param d Interpolation value between 0.0f (all the other vector) and 1.0f (all this vector).
276 Note that this is the opposite direction of interpolation to getInterpolated_quadratic()
277 \return An interpolated vector. This vector is not modified. */
278 vector2d<T> getInterpolated(const vector2d<T>& other, f64 d) const
279 {
280 f64 inv = 1.0f - d;
281 return vector2d<T>((T)(other.X*inv + X*d), (T)(other.Y*inv + Y*d));
282 }
283
284 //! Creates a quadratically interpolated vector between this and two other vectors.
285 /** \param v2 Second vector to interpolate with.
286 \param v3 Third vector to interpolate with (maximum at 1.0f)
287 \param d Interpolation value between 0.0f (all this vector) and 1.0f (all the 3rd vector).
288 Note that this is the opposite direction of interpolation to getInterpolated() and interpolate()
289 \return An interpolated vector. This vector is not modified. */
290 vector2d<T> getInterpolated_quadratic(const vector2d<T>& v2, const vector2d<T>& v3, f64 d) const
291 {
292 // this*(1-d)*(1-d) + 2 * v2 * (1-d) + v3 * d * d;
293 const f64 inv = 1.0f - d;
294 const f64 mul0 = inv * inv;
295 const f64 mul1 = 2.0f * d * inv;
296 const f64 mul2 = d * d;
297
298 return vector2d<T> ( (T)(X * mul0 + v2.X * mul1 + v3.X * mul2),
299 (T)(Y * mul0 + v2.Y * mul1 + v3.Y * mul2));
300 }
301
302 //! Sets this vector to the linearly interpolated vector between a and b.
303 /** \param a first vector to interpolate with, maximum at 1.0f
304 \param b second vector to interpolate with, maximum at 0.0f
305 \param d Interpolation value between 0.0f (all vector b) and 1.0f (all vector a)
306 Note that this is the opposite direction of interpolation to getInterpolated_quadratic()
307 */
308 vector2d<T>& interpolate(const vector2d<T>& a, const vector2d<T>& b, f64 d)
309 {
310 X = (T)((f64)b.X + ( ( a.X - b.X ) * d ));
311 Y = (T)((f64)b.Y + ( ( a.Y - b.Y ) * d ));
312 return *this;
313 }
314
315 //! X coordinate of vector.
316 T X;
317
318 //! Y coordinate of vector.
319 T Y;
320};
321
322 //! Typedef for f32 2d vector.
323 typedef vector2d<f32> vector2df;
324
325 //! Typedef for integer 2d vector.
326 typedef vector2d<s32> vector2di;
327
328 template<class S, class T>
329 vector2d<T> operator*(const S scalar, const vector2d<T>& vector) { return vector*scalar; }
330
331 // These methods are declared in dimension2d, but need definitions of vector2d
332 template<class T>
333 dimension2d<T>::dimension2d(const vector2d<T>& other) : Width(other.X), Height(other.Y) { }
334
335 template<class T>
336 bool dimension2d<T>::operator==(const vector2d<T>& other) const { return Width == other.X && Height == other.Y; }
337
338} // end namespace core
339} // end namespace irr
340
341#endif
342
diff --git a/src/others/irrlicht-1.8.1/include/vector3d.h b/src/others/irrlicht-1.8.1/include/vector3d.h
new file mode 100644
index 0000000..fd6c50d
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/vector3d.h
@@ -0,0 +1,458 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_POINT_3D_H_INCLUDED__
6#define __IRR_POINT_3D_H_INCLUDED__
7
8#include "irrMath.h"
9
10namespace irr
11{
12namespace core
13{
14
15 //! 3d vector template class with lots of operators and methods.
16 /** The vector3d class is used in Irrlicht for three main purposes:
17 1) As a direction vector (most of the methods assume this).
18 2) As a position in 3d space (which is synonymous with a direction vector from the origin to this position).
19 3) To hold three Euler rotations, where X is pitch, Y is yaw and Z is roll.
20 */
21 template <class T>
22 class vector3d
23 {
24 public:
25 //! Default constructor (null vector).
26 vector3d() : X(0), Y(0), Z(0) {}
27 //! Constructor with three different values
28 vector3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {}
29 //! Constructor with the same value for all elements
30 explicit vector3d(T n) : X(n), Y(n), Z(n) {}
31 //! Copy constructor
32 vector3d(const vector3d<T>& other) : X(other.X), Y(other.Y), Z(other.Z) {}
33
34 // operators
35
36 vector3d<T> operator-() const { return vector3d<T>(-X, -Y, -Z); }
37
38 vector3d<T>& operator=(const vector3d<T>& other) { X = other.X; Y = other.Y; Z = other.Z; return *this; }
39
40 vector3d<T> operator+(const vector3d<T>& other) const { return vector3d<T>(X + other.X, Y + other.Y, Z + other.Z); }
41 vector3d<T>& operator+=(const vector3d<T>& other) { X+=other.X; Y+=other.Y; Z+=other.Z; return *this; }
42 vector3d<T> operator+(const T val) const { return vector3d<T>(X + val, Y + val, Z + val); }
43 vector3d<T>& operator+=(const T val) { X+=val; Y+=val; Z+=val; return *this; }
44
45 vector3d<T> operator-(const vector3d<T>& other) const { return vector3d<T>(X - other.X, Y - other.Y, Z - other.Z); }
46 vector3d<T>& operator-=(const vector3d<T>& other) { X-=other.X; Y-=other.Y; Z-=other.Z; return *this; }
47 vector3d<T> operator-(const T val) const { return vector3d<T>(X - val, Y - val, Z - val); }
48 vector3d<T>& operator-=(const T val) { X-=val; Y-=val; Z-=val; return *this; }
49
50 vector3d<T> operator*(const vector3d<T>& other) const { return vector3d<T>(X * other.X, Y * other.Y, Z * other.Z); }
51 vector3d<T>& operator*=(const vector3d<T>& other) { X*=other.X; Y*=other.Y; Z*=other.Z; return *this; }
52 vector3d<T> operator*(const T v) const { return vector3d<T>(X * v, Y * v, Z * v); }
53 vector3d<T>& operator*=(const T v) { X*=v; Y*=v; Z*=v; return *this; }
54
55 vector3d<T> operator/(const vector3d<T>& other) const { return vector3d<T>(X / other.X, Y / other.Y, Z / other.Z); }
56 vector3d<T>& operator/=(const vector3d<T>& other) { X/=other.X; Y/=other.Y; Z/=other.Z; return *this; }
57 vector3d<T> operator/(const T v) const { T i=(T)1.0/v; return vector3d<T>(X * i, Y * i, Z * i); }
58 vector3d<T>& operator/=(const T v) { T i=(T)1.0/v; X*=i; Y*=i; Z*=i; return *this; }
59
60 //! sort in order X, Y, Z. Equality with rounding tolerance.
61 bool operator<=(const vector3d<T>&other) const
62 {
63 return (X<other.X || core::equals(X, other.X)) ||
64 (core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y))) ||
65 (core::equals(X, other.X) && core::equals(Y, other.Y) && (Z<other.Z || core::equals(Z, other.Z)));
66 }
67
68 //! sort in order X, Y, Z. Equality with rounding tolerance.
69 bool operator>=(const vector3d<T>&other) const
70 {
71 return (X>other.X || core::equals(X, other.X)) ||
72 (core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y))) ||
73 (core::equals(X, other.X) && core::equals(Y, other.Y) && (Z>other.Z || core::equals(Z, other.Z)));
74 }
75
76 //! sort in order X, Y, Z. Difference must be above rounding tolerance.
77 bool operator<(const vector3d<T>&other) const
78 {
79 return (X<other.X && !core::equals(X, other.X)) ||
80 (core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y)) ||
81 (core::equals(X, other.X) && core::equals(Y, other.Y) && Z<other.Z && !core::equals(Z, other.Z));
82 }
83
84 //! sort in order X, Y, Z. Difference must be above rounding tolerance.
85 bool operator>(const vector3d<T>&other) const
86 {
87 return (X>other.X && !core::equals(X, other.X)) ||
88 (core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y)) ||
89 (core::equals(X, other.X) && core::equals(Y, other.Y) && Z>other.Z && !core::equals(Z, other.Z));
90 }
91
92 //! use weak float compare
93 bool operator==(const vector3d<T>& other) const
94 {
95 return this->equals(other);
96 }
97
98 bool operator!=(const vector3d<T>& other) const
99 {
100 return !this->equals(other);
101 }
102
103 // functions
104
105 //! returns if this vector equals the other one, taking floating point rounding errors into account
106 bool equals(const vector3d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
107 {
108 return core::equals(X, other.X, tolerance) &&
109 core::equals(Y, other.Y, tolerance) &&
110 core::equals(Z, other.Z, tolerance);
111 }
112
113 vector3d<T>& set(const T nx, const T ny, const T nz) {X=nx; Y=ny; Z=nz; return *this;}
114 vector3d<T>& set(const vector3d<T>& p) {X=p.X; Y=p.Y; Z=p.Z;return *this;}
115
116 //! Get length of the vector.
117 T getLength() const { return core::squareroot( X*X + Y*Y + Z*Z ); }
118
119 //! Get squared length of the vector.
120 /** This is useful because it is much faster than getLength().
121 \return Squared length of the vector. */
122 T getLengthSQ() const { return X*X + Y*Y + Z*Z; }
123
124 //! Get the dot product with another vector.
125 T dotProduct(const vector3d<T>& other) const
126 {
127 return X*other.X + Y*other.Y + Z*other.Z;
128 }
129
130 //! Get distance from another point.
131 /** Here, the vector is interpreted as point in 3 dimensional space. */
132 T getDistanceFrom(const vector3d<T>& other) const
133 {
134 return vector3d<T>(X - other.X, Y - other.Y, Z - other.Z).getLength();
135 }
136
137 //! Returns squared distance from another point.
138 /** Here, the vector is interpreted as point in 3 dimensional space. */
139 T getDistanceFromSQ(const vector3d<T>& other) const
140 {
141 return vector3d<T>(X - other.X, Y - other.Y, Z - other.Z).getLengthSQ();
142 }
143
144 //! Calculates the cross product with another vector.
145 /** \param p Vector to multiply with.
146 \return Crossproduct of this vector with p. */
147 vector3d<T> crossProduct(const vector3d<T>& p) const
148 {
149 return vector3d<T>(Y * p.Z - Z * p.Y, Z * p.X - X * p.Z, X * p.Y - Y * p.X);
150 }
151
152 //! Returns if this vector interpreted as a point is on a line between two other points.
153 /** It is assumed that the point is on the line.
154 \param begin Beginning vector to compare between.
155 \param end Ending vector to compare between.
156 \return True if this vector is between begin and end, false if not. */
157 bool isBetweenPoints(const vector3d<T>& begin, const vector3d<T>& end) const
158 {
159 const T f = (end - begin).getLengthSQ();
160 return getDistanceFromSQ(begin) <= f &&
161 getDistanceFromSQ(end) <= f;
162 }
163
164 //! Normalizes the vector.
165 /** In case of the 0 vector the result is still 0, otherwise
166 the length of the vector will be 1.
167 \return Reference to this vector after normalization. */
168 vector3d<T>& normalize()
169 {
170 f64 length = X*X + Y*Y + Z*Z;
171 if (length == 0 ) // this check isn't an optimization but prevents getting NAN in the sqrt.
172 return *this;
173 length = core::reciprocal_squareroot(length);
174
175 X = (T)(X * length);
176 Y = (T)(Y * length);
177 Z = (T)(Z * length);
178 return *this;
179 }
180
181 //! Sets the length of the vector to a new value
182 vector3d<T>& setLength(T newlength)
183 {
184 normalize();
185 return (*this *= newlength);
186 }
187
188 //! Inverts the vector.
189 vector3d<T>& invert()
190 {
191 X *= -1;
192 Y *= -1;
193 Z *= -1;
194 return *this;
195 }
196
197 //! Rotates the vector by a specified number of degrees around the Y axis and the specified center.
198 /** \param degrees Number of degrees to rotate around the Y axis.
199 \param center The center of the rotation. */
200 void rotateXZBy(f64 degrees, const vector3d<T>& center=vector3d<T>())
201 {
202 degrees *= DEGTORAD64;
203 f64 cs = cos(degrees);
204 f64 sn = sin(degrees);
205 X -= center.X;
206 Z -= center.Z;
207 set((T)(X*cs - Z*sn), Y, (T)(X*sn + Z*cs));
208 X += center.X;
209 Z += center.Z;
210 }
211
212 //! Rotates the vector by a specified number of degrees around the Z axis and the specified center.
213 /** \param degrees: Number of degrees to rotate around the Z axis.
214 \param center: The center of the rotation. */
215 void rotateXYBy(f64 degrees, const vector3d<T>& center=vector3d<T>())
216 {
217 degrees *= DEGTORAD64;
218 f64 cs = cos(degrees);
219 f64 sn = sin(degrees);
220 X -= center.X;
221 Y -= center.Y;
222 set((T)(X*cs - Y*sn), (T)(X*sn + Y*cs), Z);
223 X += center.X;
224 Y += center.Y;
225 }
226
227 //! Rotates the vector by a specified number of degrees around the X axis and the specified center.
228 /** \param degrees: Number of degrees to rotate around the X axis.
229 \param center: The center of the rotation. */
230 void rotateYZBy(f64 degrees, const vector3d<T>& center=vector3d<T>())
231 {
232 degrees *= DEGTORAD64;
233 f64 cs = cos(degrees);
234 f64 sn = sin(degrees);
235 Z -= center.Z;
236 Y -= center.Y;
237 set(X, (T)(Y*cs - Z*sn), (T)(Y*sn + Z*cs));
238 Z += center.Z;
239 Y += center.Y;
240 }
241
242 //! Creates an interpolated vector between this vector and another vector.
243 /** \param other The other vector to interpolate with.
244 \param d Interpolation value between 0.0f (all the other vector) and 1.0f (all this vector).
245 Note that this is the opposite direction of interpolation to getInterpolated_quadratic()
246 \return An interpolated vector. This vector is not modified. */
247 vector3d<T> getInterpolated(const vector3d<T>& other, f64 d) const
248 {
249 const f64 inv = 1.0 - d;
250 return vector3d<T>((T)(other.X*inv + X*d), (T)(other.Y*inv + Y*d), (T)(other.Z*inv + Z*d));
251 }
252
253 //! Creates a quadratically interpolated vector between this and two other vectors.
254 /** \param v2 Second vector to interpolate with.
255 \param v3 Third vector to interpolate with (maximum at 1.0f)
256 \param d Interpolation value between 0.0f (all this vector) and 1.0f (all the 3rd vector).
257 Note that this is the opposite direction of interpolation to getInterpolated() and interpolate()
258 \return An interpolated vector. This vector is not modified. */
259 vector3d<T> getInterpolated_quadratic(const vector3d<T>& v2, const vector3d<T>& v3, f64 d) const
260 {
261 // this*(1-d)*(1-d) + 2 * v2 * (1-d) + v3 * d * d;
262 const f64 inv = (T) 1.0 - d;
263 const f64 mul0 = inv * inv;
264 const f64 mul1 = (T) 2.0 * d * inv;
265 const f64 mul2 = d * d;
266
267 return vector3d<T> ((T)(X * mul0 + v2.X * mul1 + v3.X * mul2),
268 (T)(Y * mul0 + v2.Y * mul1 + v3.Y * mul2),
269 (T)(Z * mul0 + v2.Z * mul1 + v3.Z * mul2));
270 }
271
272 //! Sets this vector to the linearly interpolated vector between a and b.
273 /** \param a first vector to interpolate with, maximum at 1.0f
274 \param b second vector to interpolate with, maximum at 0.0f
275 \param d Interpolation value between 0.0f (all vector b) and 1.0f (all vector a)
276 Note that this is the opposite direction of interpolation to getInterpolated_quadratic()
277 */
278 vector3d<T>& interpolate(const vector3d<T>& a, const vector3d<T>& b, f64 d)
279 {
280 X = (T)((f64)b.X + ( ( a.X - b.X ) * d ));
281 Y = (T)((f64)b.Y + ( ( a.Y - b.Y ) * d ));
282 Z = (T)((f64)b.Z + ( ( a.Z - b.Z ) * d ));
283 return *this;
284 }
285
286
287 //! Get the rotations that would make a (0,0,1) direction vector point in the same direction as this direction vector.
288 /** Thanks to Arras on the Irrlicht forums for this method. This utility method is very useful for
289 orienting scene nodes towards specific targets. For example, if this vector represents the difference
290 between two scene nodes, then applying the result of getHorizontalAngle() to one scene node will point
291 it at the other one.
292 Example code:
293 // Where target and seeker are of type ISceneNode*
294 const vector3df toTarget(target->getAbsolutePosition() - seeker->getAbsolutePosition());
295 const vector3df requiredRotation = toTarget.getHorizontalAngle();
296 seeker->setRotation(requiredRotation);
297
298 \return A rotation vector containing the X (pitch) and Y (raw) rotations (in degrees) that when applied to a
299 +Z (e.g. 0, 0, 1) direction vector would make it point in the same direction as this vector. The Z (roll) rotation
300 is always 0, since two Euler rotations are sufficient to point in any given direction. */
301 vector3d<T> getHorizontalAngle() const
302 {
303 vector3d<T> angle;
304
305 const f64 tmp = (atan2((f64)X, (f64)Z) * RADTODEG64);
306 angle.Y = (T)tmp;
307
308 if (angle.Y < 0)
309 angle.Y += 360;
310 if (angle.Y >= 360)
311 angle.Y -= 360;
312
313 const f64 z1 = core::squareroot(X*X + Z*Z);
314
315 angle.X = (T)(atan2((f64)z1, (f64)Y) * RADTODEG64 - 90.0);
316
317 if (angle.X < 0)
318 angle.X += 360;
319 if (angle.X >= 360)
320 angle.X -= 360;
321
322 return angle;
323 }
324
325 //! Get the spherical coordinate angles
326 /** This returns Euler degrees for the point represented by
327 this vector. The calculation assumes the pole at (0,1,0) and
328 returns the angles in X and Y.
329 */
330 vector3d<T> getSphericalCoordinateAngles() const
331 {
332 vector3d<T> angle;
333 const f64 length = X*X + Y*Y + Z*Z;
334
335 if (length)
336 {
337 if (X!=0)
338 {
339 angle.Y = (T)(atan2((f64)Z,(f64)X) * RADTODEG64);
340 }
341 else if (Z<0)
342 angle.Y=180;
343
344 angle.X = (T)(acos(Y * core::reciprocal_squareroot(length)) * RADTODEG64);
345 }
346 return angle;
347 }
348
349 //! Builds a direction vector from (this) rotation vector.
350 /** This vector is assumed to be a rotation vector composed of 3 Euler angle rotations, in degrees.
351 The implementation performs the same calculations as using a matrix to do the rotation.
352
353 \param[in] forwards The direction representing "forwards" which will be rotated by this vector.
354 If you do not provide a direction, then the +Z axis (0, 0, 1) will be assumed to be forwards.
355 \return A direction vector calculated by rotating the forwards direction by the 3 Euler angles
356 (in degrees) represented by this vector. */
357 vector3d<T> rotationToDirection(const vector3d<T> & forwards = vector3d<T>(0, 0, 1)) const
358 {
359 const f64 cr = cos( core::DEGTORAD64 * X );
360 const f64 sr = sin( core::DEGTORAD64 * X );
361 const f64 cp = cos( core::DEGTORAD64 * Y );
362 const f64 sp = sin( core::DEGTORAD64 * Y );
363 const f64 cy = cos( core::DEGTORAD64 * Z );
364 const f64 sy = sin( core::DEGTORAD64 * Z );
365
366 const f64 srsp = sr*sp;
367 const f64 crsp = cr*sp;
368
369 const f64 pseudoMatrix[] = {
370 ( cp*cy ), ( cp*sy ), ( -sp ),
371 ( srsp*cy-cr*sy ), ( srsp*sy+cr*cy ), ( sr*cp ),
372 ( crsp*cy+sr*sy ), ( crsp*sy-sr*cy ), ( cr*cp )};
373
374 return vector3d<T>(
375 (T)(forwards.X * pseudoMatrix[0] +
376 forwards.Y * pseudoMatrix[3] +
377 forwards.Z * pseudoMatrix[6]),
378 (T)(forwards.X * pseudoMatrix[1] +
379 forwards.Y * pseudoMatrix[4] +
380 forwards.Z * pseudoMatrix[7]),
381 (T)(forwards.X * pseudoMatrix[2] +
382 forwards.Y * pseudoMatrix[5] +
383 forwards.Z * pseudoMatrix[8]));
384 }
385
386 //! Fills an array of 4 values with the vector data (usually floats).
387 /** Useful for setting in shader constants for example. The fourth value
388 will always be 0. */
389 void getAs4Values(T* array) const
390 {
391 array[0] = X;
392 array[1] = Y;
393 array[2] = Z;
394 array[3] = 0;
395 }
396
397 //! Fills an array of 3 values with the vector data (usually floats).
398 /** Useful for setting in shader constants for example.*/
399 void getAs3Values(T* array) const
400 {
401 array[0] = X;
402 array[1] = Y;
403 array[2] = Z;
404 }
405
406
407 //! X coordinate of the vector
408 T X;
409
410 //! Y coordinate of the vector
411 T Y;
412
413 //! Z coordinate of the vector
414 T Z;
415 };
416
417 //! partial specialization for integer vectors
418 // Implementor note: inline keyword needed due to template specialization for s32. Otherwise put specialization into a .cpp
419 template <>
420 inline vector3d<s32> vector3d<s32>::operator /(s32 val) const {return core::vector3d<s32>(X/val,Y/val,Z/val);}
421 template <>
422 inline vector3d<s32>& vector3d<s32>::operator /=(s32 val) {X/=val;Y/=val;Z/=val; return *this;}
423
424 template <>
425 inline vector3d<s32> vector3d<s32>::getSphericalCoordinateAngles() const
426 {
427 vector3d<s32> angle;
428 const f64 length = X*X + Y*Y + Z*Z;
429
430 if (length)
431 {
432 if (X!=0)
433 {
434 angle.Y = round32((f32)(atan2((f64)Z,(f64)X) * RADTODEG64));
435 }
436 else if (Z<0)
437 angle.Y=180;
438
439 angle.X = round32((f32)(acos(Y * core::reciprocal_squareroot(length)) * RADTODEG64));
440 }
441 return angle;
442 }
443
444 //! Typedef for a f32 3d vector.
445 typedef vector3d<f32> vector3df;
446
447 //! Typedef for an integer 3d vector.
448 typedef vector3d<s32> vector3di;
449
450 //! Function multiplying a scalar and a vector component-wise.
451 template<class S, class T>
452 vector3d<T> operator*(const S scalar, const vector3d<T>& vector) { return vector*scalar; }
453
454} // end namespace core
455} // end namespace irr
456
457#endif
458