Merged revisions 2897:3173 from trunk. Huge update with uncountable fixes, additions, etc.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@3174 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2010-01-23 20:13:43 +00:00
parent bd615dca68
commit d07fc00916
519 changed files with 90376 additions and 15002 deletions

View File

@ -1,12 +1,81 @@
Changes in 1.7 Changes in 1.7
- Define sorting order for vector2d and vector3d in operators <, <=, > and >= to fix bugs 2783509 and 2783510. Operators order now by X,Y,Z and use float tolerances.
- Fix tooltips for gui-elements with sub-element like IGUISpinBox (id: 2927079, found by ArakisTheKitsune)
- ITimer no longer stops when started twice
- Add hasType to IGUIElement as a dynamic_cast substitute.
- Add another parameter to IGUISkin::draw3DWindowBackground to allow getting the client area without actually drawing
- Add function getClientRect to IGUIWindow for getting the draw-able area
- Fix bug that menus on IGUIWindows with titlebar got drawn too high (id: 2714400)
- Renamed OctTree to Octree
- Allow getting a ConstIterator from a non-const core:list
- Add swap functions to irrMath and to the core classes.
- Deprecate map::isEmpty() and replace it with map::empty() to make it similar to other base classes.
- Allow to set the logging level already in SIrrlichtCreationParameters.
- Add clearSystemMessages to devices (implemented only for Linux and Win32 so far).
- Fix incorrect cursorpos for resizable windows on Windows Vista (found and patched by buffer)
- Change the beginScene window parameter from void* to SExposedVideoData&. This will allow to manage contexts for OpenGL at some point.
- Add bzip2 and LZMA decompression modes for zip loader.
- Add OBJ_TEXTURE_PATH and B3D_TEXTURE_PATH to SceneParameters to allow setting texture-paths for obj and b3d.
- Irrlicht keeps now filenames additionally to the internally used names, thereby fixing some problems with uppercase-filenames on Linux.
- Bugfix: Mousewheel no longer sends EMIE_MOUSE_WHEEL messages twice on Linux.
- refactoring: E_ATTRIBUTE_TYPE and IAttribute have now own headers
- CStringWArrayAttribute speedup
- SceneNodeAnimatorFollowSpline can now loop and pingpong
- Meshviewer.example got some fast-scale buttons.
- Support AES-encrypted zip files. Should work with 128, 196, and 256 bit AES. This addition also adds a new PRNG, SHA, and other algorithms to the engine, though no interface is yet added for them. The implementation of the encryption algorithms is provided by Dr Brian Gladman.
- Added geometry shaders for OpenGL. A first version of the code was submitted by Matthew Kielan (devsh).
- Bugfix: irrArray should no longer crash when using other allocators.
- Add MaterialViewer example.
- Checkbox uses now disabled text color when disabled.
- Changed colors for window-title caption to keep them readable when not active.
- Draw sub-menus to left side if they would be outside main-window otherwise.
- Give ListBox better defaults for the ScrollBar stepsizes.
- Double and triple click events now for each mouse-button. Old events for that got removed.
- Fix adding archives twice, which caused multiple archives of the same name and type covering each other. This one required a texture name change from using backslashes to slashes under Windows.
- Give access to texture mipmaps. You can provide custom mipmap textures upon generation, regeneration, and locking.
Make sure the provided data is large enough and covers all miplevels. Also the returned pointer (from lock) will only cover the smaller data of the mipmap level dimension chosen (level 0 is the original texture).
- Separate TextureWrap mode into U and V fields - Separate TextureWrap mode into U and V fields
- Add mirror texture wrap modes - Add mirror texture wrap modes
- windows show now active/inactive state - windows show now active/inactive state
- remove unneed drop/grab calls found by manik_sheeri - remove unneeded drop/grab calls found by manik_sheeri
- fix rounding problem in IGUIElements which have EGUIA_SCALE alignments. - fix rounding problem in IGUIElements which have EGUIA_SCALE alignments.
@ -52,13 +121,13 @@ Changes in 1.7
- Bounding Box updates for skinned meshes fixed - Bounding Box updates for skinned meshes fixed
- The current FPS for an animated scene node cn be queried now, added some variables to serialization - The current FPS for an animated scene node can be queried now, added some variables to serialization
- Scrollbars fixed - Scrollbars fixed
- Fixed 2d vertex primitive method to correctly handle transparency - Fixed 2d vertex primitive method to correctly handle transparency
- Fullscreen handling has been ehanced for Windows, now proper resolution is restored on Alt-Tab etc. - Fullscreen handling has been enhanced for Windows, now proper resolution is restored on Alt-Tab etc.
- Cameras can now be added to the scene node without automatically activating them - Cameras can now be added to the scene node without automatically activating them
Clone method added Clone method added
@ -84,8 +153,49 @@ Changes in 1.7
---------------- ----------------
Changes in 1.6.1 Changes in 1.6.1
- Fix pingpong for CSceneNodeAnimatorFlyStraight (found by gbox)
- Fix bug with IGUIEditBox where the cursor position is reset on text change.
- Make sure the window top-left corner on Windows is not negative on start so that Windows sytem-menu is always visible.
- Fix problem that the window did sometimes not get the keyboard focus in X11 in fullscreen. Add more debug output in case focus grabbing goes wrong.
- Fix screensize in videodriver when we didn't get the requested window size. This also prevents that gui-clicks are no longer synchronized with gui-drawing and elements can't be hit anymore.
- Bugfix: Prevent a crash when getTypeName was called for the guienvironment. EGUIET_ELEMENT got changed for this.
- Bugfix: Horizontal centered font with linebreaks draw now all lines. For example multiline TextSceneNodes work again.
- Bugfix: spinbox can no longer get in an endless loop due to floating point rounding error (found by slavik262)
- !!API change!! Disabled AntiAliasing of Lines in material default
Please enable this manually per material when sure that it won't lead to SW rendering.
- IGUIComboBox: clicking on the statictext displaying the active selection does now close and open listbox correctly. (Bug found by Reiko)
- Scrollbuttons in IGUITabControl adapt now to tab-height.
- Fix texturing of cylinder mesh
- Fix modal dialog position (found by LoneBoco: http://sourceforge.net/tracker/?func=detail&aid=2900266&group_id=74339&atid=540676)
- Fix DMF loading
- Fixing left+right special keys (ctrl, shift, alt) on Win32 (thanks to pc0de for good patch-ideas).
- Make stringarrays for enums in IGUISkin a little safer
- Add support for keys KEY_PRINT, KEY_HOME (on numpad) and KEY_NUMLOCK on Linux.
- Fix material handling in createMeshWith1TCoords
- Fix another (OldValue == NewValue) before drop()/grap(), this time in CTextureAttribute::setTexture. - Fix another (OldValue == NewValue) before drop()/grap(), this time in CTextureAttribute::setTexture.
- Fix LIGHTMAP_LIGHTING for D3D drivers.
- AntiAliasing disabled for debug render elements.
- Bugfix: CGUIToolBar::addButton does no longer mess up when no image is set and does now actually work with the text. - Bugfix: CGUIToolBar::addButton does no longer mess up when no image is set and does now actually work with the text.
- Fix ninja animation range which got messed up a little when b3d animations got fixed (thx gbox for finding) - Fix ninja animation range which got messed up a little when b3d animations got fixed (thx gbox for finding)
@ -742,7 +852,13 @@ Changes in 1.6 (23.09.2009)
- Add a hitPosition out parameter to ISceneCollisionManager::getCollisionResultPosition() - this is a (small) API breaking change. - Add a hitPosition out parameter to ISceneCollisionManager::getCollisionResultPosition() - this is a (small) API breaking change.
------------------------------------- -------------------------------------
Changes in version 1.5.2 (??.??.2009) Changes in version 1.5.2 (16.12.2009)
- Properly check boundaries in getFont and setFont.
- Reinit values in the driver when scene manager is cleared.
- Normals handling fixed in createMeshWithTangents, existing normals are not always destroyed now.
- Fix terrain smoothing, bug found by loverlinfish - Fix terrain smoothing, bug found by loverlinfish

34
doc/aesGladman.txt Normal file
View File

@ -0,0 +1,34 @@
The Irrlicht Engine may be compiled to provide support for AES encrypted files. The implementation used by Irrlicht is provided by Dr Brian Gladman. The license for these files (including AES, a PRNG, SHA, and other algorithms) is as follows
/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
*/

42
doc/bzip2-license.txt Normal file
View File

@ -0,0 +1,42 @@
--------------------------------------------------------------------------
This program, "bzip2", the associated library "libbzip2", and all
documentation, are copyright (C) 1996-2007 Julian R Seward. All
rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
3. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
4. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Julian Seward, jseward@bzip.org
bzip2/libbzip2 version 1.0.5 of 10 December 2007
--------------------------------------------------------------------------

View File

@ -1642,3 +1642,860 @@ Split hardware mapping hint into vertex and index part
vector2d.h vector2d.h
Fix angle calculation for integer vectors Fix angle calculation for integer vectors
Changes for Version 1.5.2
-------------------------
Even less visible changes have been made in this version. Only the automatic Solaris OS recognition has changed, so make sure you have all things defined properly if you compile for Solaris. And the float parser bugfix is a visible change, though non-interfering for existing code.
Changes for Version 1.6.0
-------------------------
This releases has many changes in method signatures. The most obvious ones are signedness changes from s32 to u32. Since many templates won't accept both types, you need to change the types manually in your code. The other major change is from many different types of strings to the new class io::path. These changes should be transparent to the app, unless you need proper overrides in derived classes.
Finally, some deprecated methods have been removed, and some were simply renamed. Just check the API if some methods is not found anymore.
IMeshSceneNode.h
Added default parameters for identity transformation
IMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& rotation = core::vector3df(0,0,0),
const core::vector3df& scale = core::vector3df(1,1,1))
path.h
This is a new type, which handles stuff with UTF file systems.
typedef core::string<fschar_t> io::path;
ESceneNodeTypes.h
New scene node identifiers
ESNT_SKY_DOME = MAKE_IRR_ID('s','k','y','d'),
ESNT_Q3SHADER_SCENE_NODE = MAKE_IRR_ID('q','3','s','h'),
ESNT_VOLUME_LIGHT = MAKE_IRR_ID('v','o','l','l'),
IGUIListBox.h
New methods
virtual void setSelected(const wchar_t *item) = 0;
virtual void setItemHeight( s32 height ) = 0;
virtual void setDrawBackground(bool draw) = 0;
ITexture.h
New texture generation flag for burnings video driver
//! Allow the Driver to use Non-Power-2-Textures
ETCF_ALLOW_NON_POWER_2 = 0x00000040,
Parameter change (now using path type instead of C-strings)
ITexture(const io::path& name)
Signedness change
virtual const core::dimension2d<u32>& getOriginalSize() const = 0;
virtual const core::dimension2d<u32>& getSize() const = 0;
New method
virtual bool hasAlpha() const
Parameter change (now using path type instead of stringc)
const io::path& getName() const
ILightManager.h
This is a new interface for the light manager
class ILightManager : public IReferenceCounted
IGUIEditBox.h
Signedness change
virtual core::dimension2du getTextDimension() = 0;
ITriangleSelector.h
New method
virtual const ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const = 0;
IMeshManipulator.h
New methods
virtual void makePlanarTextureMapping(scene::IMeshBuffer* meshbuffer, f32 resolution=0.001f) const =0;
virtual void makePlanarTextureMapping(scene::IMeshBuffer* buffer, f32 resolutionS, f32 resolutionT, u8 axis, const core::vector3df& offset) const =0;
virtual IMesh* createMeshWith1TCoords(IMesh* mesh) const = 0;
SceneParameters.h
Removed parameter
const c8* const DMF_USE_MATERIALS_DIRS = "DMF_MaterialsDir";
New parameters
const c8* const DMF_IGNORE_MATERIALS_DIRS = "DMF_IgnoreMaterialsDir";
const c8* const OBJ_LOADER_IGNORE_MATERIAL_FILES = "OBJ_IgnoreMaterialFiles";
const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag";
const c8* const DEBUG_NORMAL_LENGTH = "DEBUG_Normal_Length";
const c8* const DEBUG_NORMAL_COLOR = "DEBUG_Normal_Color";
SViewFrustum.h
Removed method (use getTransform)
void setTransformState( video::E_TRANSFORMATION_STATE state);
New methods
core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state);
const core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state) const;
bool clipLine(core::line3d<f32>& line) const;
IFileList.h
Changed parameters (to io::path)
virtual const io::path& getFileName(u32 index) const = 0;
virtual const io::path& getFullFileName(u32 index) const = 0;
New methods
virtual u32 getFileSize(u32 index) const = 0;
virtual s32 findFile(const io::path& filename, bool isFolder=false) const = 0;
virtual const io::path& getPath() const = 0;
coreutil.h
New methods
s32 isFileExtension(const io::path& filename,
const io::path& ext0, const io::path& ext1, const io::path& ext2)
bool hasFileExtension(const io::path& filename,
const io::path& ext0, const io::path& ext1 = "", const io::path& ext2 = "")
stringw& cutFilenameExtension ( stringw &dest, const stringw &source )
core::stringw& deletePathFromFilename(core::stringw& filename)
core::stringc& deletePathFromFilename(core::stringc& filename)
io::path& deletePathFromPath(io::path& filename, s32 pathCount)
s32 isInSameDirectory ( const io::path& path, const io::path& file )
IGUIComboBox.h
New methods
virtual u32 getItemData(u32 idx) const = 0;
virtual s32 getIndexForItemData(u32 data ) const = 0;
New parameter
virtual u32 addItem(const wchar_t* text, u32 data = 0) = 0;
irrArray.h
New allocation scheme member
array()
Use overload instead of different name
s32 binary_search(const T& element) const
New method
void setAllocStrategy ( eAllocStrategy newStrategy = ALLOC_STRATEGY_DOUBLE )
s32 binary_search_multi(const T& element, s32 &last)
IrrCompileConfig.h
New compiler flags
#define _IRR_MATERIAL_MAX_TEXTURES_ 4
//! Define _IRR_D3D_USE_LEGACY_HLSL_COMPILER to enable the old HLSL compiler in recent DX SDKs
#define BURNINGVIDEO_RENDERER_CE
#define IGNORE_DEPRECATED_WARNING
#define _IRR_COMPILE_WITH_PLY_LOADER_
#define _IRR_COMPILE_WITH_PLY_WRITER_
#define _IRR_COMPILE_WITH_RGB_LOADER_
#define __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
#define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
#define __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_
#define __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_
//! _IRR_WINDOWS_CE_PLATFORM_ for Windows CE
//! _IRR_COMPILE_WITH_WINDOWS_DEVICE_ for Windows API based device
//! _IRR_COMPILE_WITH_WINDOWS_CE_DEVICE_ for Windows CE API based device
//! _IRR_COMPILE_WITH_OSX_DEVICE_ for Cocoa native windowing on OSX
//! _IRR_COMPILE_WITH_X11_DEVICE_ for Linux X11 based device
//! _IRR_COMPILE_WITH_SDL_DEVICE_ for platform independent SDL framework
//! _IRR_COMPILE_WITH_CONSOLE_DEVICE_ for no windowing system, used as a fallback
Removed compiler flags
//! _IRR_USE_SDL_DEVICE_ for platform independent SDL framework
//! _IRR_USE_WINDOWS_DEVICE_ for Windows API based device
//! _IRR_USE_WINDOWS_CE_DEVICE_ for Windows CE API based device
//! _IRR_USE_LINUX_DEVICE_ for X11 based device
//! _IRR_USE_OSX_DEVICE_ for Cocoa native windowing on OSX
Old compilers rejected
# error "Only Microsoft Visual Studio 7.0 and later are supported."
Force symbol export in shared libraries built with gcc.
#define IRRLICHT_API __attribute__ ((visibility("default")))
IGUIFileOpenDialog.h
New method
virtual const io::path& getDirectoryName() = 0;
EDeviceTypes.h
New enum for multi-device support
enum E_DEVICE_TYPE
IMeshLoader.h
Changed parameter to use io::path instead of C strings
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
IAnimatedMeshSceneNode.h
Changed return value to pointer type
virtual const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname) = 0;
ISceneManager.h
New enum values and numbering
enum E_SCENE_NODE_RENDER_PASS
ESNRP_NONE =0,
ESNRP_TRANSPARENT =16,
ESNRP_TRANSPARENT_EFFECT =32,
Changed parameter to use io::path instead of C strings
virtual IAnimatedMesh* getMesh(const io::path& filename) = 0;
New methods
virtual io::IFileSystem* getFileSystem() = 0;
virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0;
virtual ISkinnedMesh* createSkinnedMesh() = 0;
virtual void setLightManager(ILightManager* lightManager) = 0;
virtual const IGeometryCreator* getGeometryCreator(void) const = 0;
virtual bool isCulled(const ISceneNode* node) const =0;
Changed return type to IMeshSceneNode
virtual IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0;
virtual IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
virtual IMeshSceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::IShader * shader,
ISceneNode* parent=0, s32 id=-1) = 0;
New parameter invertMouse
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
f32 jumpSpeed = 0.f, bool invertMouse=false) = 0;
New parameter radius
virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
u32 horiRes=16, u32 vertRes=8,
f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f,
ISceneNode* parent=0, s32 id=-1) = 0;
Changed to use io::path instead of C strings
virtual ITerrainSceneNode* addTerrainSceneNode(
const io::path& heightMapFileName,
ISceneNode* parent=0, s32 id=-1,
virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name,
const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
video::SMaterial* material = 0, f32 hillHeight = 0.0f,
const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f),
const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0;
virtual IAnimatedMesh* addArrowMesh(const io::path& name,
video::SColor vtxColor0=0xFFFFFFFF,
video::SColor vtxColor1=0xFFFFFFFF,
u32 tesselationCylinder=4, u32 tesselationCone=8,
virtual IAnimatedMesh* addSphereMesh(const io::path& name,
f32 radius=5.f, u32 polyCountX = 16,
u32 polyCountY = 16) = 0;
virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
Changed to use io::path instead of C strings and signedness change
virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname,
video::IImage* texture, video::IImage* heightmap,
const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f),
f32 maxHeight=200.0f,
const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)) = 0;
New method
virtual IAnimatedMesh* addVolumeLightMesh(const io::path& name,
const u32 SubdivideU = 32, const u32 SubdivideV = 32,
const video::SColor FootColor = video::SColor(51, 0, 230, 180),
const video::SColor TailColor = video::SColor(0, 0, 0, 0)) = 0;
Constification of method
virtual ICameraSceneNode* getActiveCamera() const =0;
New parameters
virtual ISceneNodeAnimator* createFlyCircleAnimator(
const core::vector3df& center=core::vector3df(0.f,0.f,0.f),
f32 radius=100.f, f32 speed=0.001f,
const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f),
f32 startPosition = 0.f,
f32 radiusEllipsoid = 0.f) = 0;
virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint,
const core::vector3df& endPoint, u32 timeForWay, bool loop=false, bool pingpong = false) = 0;
ISceneNodeAnimatorCollisionResponse.h
New interface
class ICollisionCallback : public virtual IReferenceCounted
New methods for ISceneNodeAnimatorCollisionResponse
virtual void setAnimateTarget ( bool enable ) = 0;
virtual bool getAnimateTarget () const = 0;
virtual void setTargetNode(ISceneNode * node) = 0;
virtual ISceneNode* getTargetNode(void) const = 0;
virtual bool collisionOccurred() const = 0;
virtual const core::vector3df & getCollisionPoint() const = 0;
virtual const core::triangle3df & getCollisionTriangle() const = 0;
virtual const core::vector3df & getCollisionResultPosition(void) const = 0;
virtual const ISceneNode* getCollisionNode(void) const = 0;
virtual void setCollisionCallback(ICollisionCallback* callback) = 0;
ILightSceneNode.h
New methods
virtual void setVisible(bool isVisible) = 0;
EMeshWriterEnums.h
New enums
EMWT_PLY = MAKE_IRR_ID('p','l','y',0)
EMWF_WRITE_BINARY = 0x4
ISceneNodeAnimator.h
New method
virtual bool hasFinished(void) const
SMaterialLayer.h
Changed types
u8 TextureWrap;
bool BilinearFilter:1;
bool TrilinearFilter:1;
u8 AnisotropicFilter;
New member
s8 LODBias;
IVideoModeList.h
Signedness change
virtual core::dimension2d<u32> getVideoModeResolution(s32 modeNumber) const = 0;
virtual core::dimension2d<u32> getVideoModeResolution(const core::dimension2d<u32>& minSize, const core::dimension2d<u32>& maxSize) const = 0;
virtual const core::dimension2d<u32>& getDesktopResolution() const = 0;
EMaterialFlags.h
Enum values changed (all renumbered)
ISkinnedMesh.h
Renamed methods (was create... before, but these methods grab the things they create)
virtual SSkinMeshBuffer* addMeshBuffer() = 0;
virtual SJoint* addJoint(SJoint *parent=0) = 0;
virtual SWeight* addWeight(SJoint *joint) = 0;
virtual SPositionKey* addPositionKey(SJoint *joint) = 0;
virtual SScaleKey* addScaleKey(SJoint *joint) = 0;
virtual SRotationKey* addRotationKey(SJoint *joint) = 0;
SLight.h
Type change
bool CastShadows:1;
IGUITreeView.h
New element
// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de
class IGUITreeView : public IGUIElement
IAnimatedMeshMD3.h
Renamed class (from SMD3QuaterionTag)
struct SMD3QuaternionTag
IGUIEnvironment.h
New methods
virtual IGUIImageList* createImageList( video::ITexture* texture,
core::dimension2d<s32> imageSize, bool useAlphaChannel ) = 0;
virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
Changed parameters to use io::path (instead of C strings)
virtual IGUIFont* getFont(const io::path& filename) = 0;
virtual IGUISpriteBank* getSpriteBank(const io::path& filename) = 0;
virtual IGUISpriteBank* addEmptySpriteBank(const io::path& name) = 0;
virtual bool saveGUI(const io::path& filename, IGUIElement* start=0) = 0;
virtual bool loadGUI(const io::path& filename, IGUIElement* parent=0) = 0;
New parameter "border"
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
IQ3Shader.h
Made non-const
static core::stringc irrEmptyStringc("");
New enum values
enum eQ3MeshIndex
E_Q3_MESH_FOG,
E_Q3_MESH_UNRESOLVED,
IGeometryCreator.h
New interface
class IGeometryCreator : public IReferenceCounted
IFileArchive.h
New interfaces
class IFileArchive : public virtual IReferenceCounted
class IArchiveLoader : public virtual IReferenceCounted
IFileSystem.h
Changed parameters to use io::path (instead of C strings/stringc)
virtual IReadFile* createAndOpenFile(const path& filename) =0;
virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
virtual IWriteFile* createAndWriteFile(const path& filename, bool append=false) =0;
virtual const path& getWorkingDirectory() =0;
virtual bool changeWorkingDirectoryTo(const path& newDirectory) =0;
virtual path getAbsolutePath(const path& filename) const =0;
virtual path getFileDir(const path& filename) const =0;
virtual path getFileBasename(const path& filename, bool keepExtension=true) const =0;
virtual bool existFile(const path& filename) const =0;
virtual IXMLReader* createXMLReader(const path& filename) =0;
virtual IXMLReaderUTF8* createXMLReaderUTF8(const path& filename) =0;
virtual IXMLWriter* createXMLWriter(const path& filename) =0;
New methods
virtual IReadFile* createLimitReadFile(const path& fileName,
IReadFile* alreadyOpenedFile, long pos, long areaSize) =0;
virtual IWriteFile* createMemoryWriteFile(void* memory, s32 len, const path& fileName, bool deleteMemoryWhenDropped=false) =0;
virtual bool addFileArchive(const path& filename, bool ignoreCase=true, bool ignorePaths=true,
E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN) =0;
virtual void addArchiveLoader(IArchiveLoader* loader) =0;
virtual u32 getFileArchiveCount() const =0;
virtual bool removeFileArchive(u32 index) =0;
virtual bool removeFileArchive(const path& filename) =0;
virtual bool moveFileArchive(u32 sourceIndex, s32 relative) =0;
virtual IFileArchive* getFileArchive(u32 index) =0;
virtual path& flattenFilename(path& directory, const path& root="/") const =0;
virtual EFileSystemType setFileListSystem(EFileSystemType listType) =0;
Deprecate methods
virtual bool addZipFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
virtual bool addPakFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
Constification of method
virtual IFileList* createFileList() =0;
IrrlichtDevice.h
Renamed method (from setResizeAble)
virtual void setResizable(bool resize=false) = 0;
New methods
virtual void minimizeWindow() =0;
virtual void maximizeWindow() =0;
virtual void restoreWindow() =0;
virtual bool setGammaRamp(f32 red, f32 green, f32 blue,
f32 relativebrightness, f32 relativecontrast) =0;
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
f32 &brightness, f32 &contrast) =0;
virtual E_DEVICE_TYPE getType() const = 0;
irrMath.h
Renamed from ROUNDING_ERROR_32
const f32 ROUNDING_ERROR_f32 = 0.000001f;
Renamed from ROUNDING_ERROR_64
const f64 ROUNDING_ERROR_f64 = 0.00000001;
New constant
const s32 ROUNDING_ERROR_S32 = 1;
New methods
bool isnotzero(const f32 a, const f32 tolerance = ROUNDING_ERROR_f32)
u16 if_c_a_else_b ( const s16 condition, const u16 a, const u16 b )
f32 squareroot(const f32 f)
f64 squareroot(const f64 f)
s32 squareroot(const s32 f)
f64 reciprocal_squareroot(const f64 x)
s32 reciprocal_squareroot(const s32 x)
f64 reciprocal ( const f64 f )
IGPUProgrammingServices.h
Changed parameters to use io::path
virtual s32 addHighLevelShaderMaterialFromFiles(
const io::path& vertexShaderProgramFileName,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const io::path& pixelShaderProgramFileName = "",
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0,
virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
const io::path& pixelShaderProgramFileName,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
ISceneNode.h
New method
virtual bool isTrulyVisible() const
IEventReceiver.h
New enum values
EMIE_MOUSE_DOUBLE_CLICK,
EMIE_MOUSE_TRIPLE_CLICK,
EGET_DIRECTORY_SELECTED,
EGET_EDITBOX_CHANGED,
EGET_EDITBOX_MARKING_CHANGED,
EGET_TREEVIEW_NODE_DESELECT,
EGET_TREEVIEW_NODE_SELECT,
EGET_TREEVIEW_NODE_EXPAND,
EGET_TREEVIEW_NODE_COLLAPS,
EGET_COUNT
New enum
enum E_MOUSE_BUTTON_STATE_MASK
New members
bool Shift:1;
bool Control:1;
u32 ButtonStates;
New methods
bool isLeftPressed() const { return 0 != ( ButtonStates & EMBSM_LEFT ); }
bool isRightPressed() const { return 0 != ( ButtonStates & EMBSM_RIGHT ); }
bool isMiddlePressed() const { return 0 != ( ButtonStates & EMBSM_MIDDLE ); }
Types changed
bool PressedDown:1;
bool Shift:1;
bool Control:1;
IGUISpriteBank.h
New method
virtual void draw2DSpriteBatch(const core::array<u32>& indices, const core::array<core::position2di>& pos,
const core::rect<s32>* clip=0,
const video::SColor& color= video::SColor(255,255,255,255),
u32 starttime=0, u32 currenttime=0,
bool loop=true, bool center=false) = 0;
SMaterial.h
New enums
enum E_COMPARISON_FUNC
enum E_COLOR_PLANE
enum E_ALPHA_SOURCE
enum E_ANTI_ALIASING_MODE
enum E_COLOR_MATERIAL
New parameters
inline f32 pack_texureBlendFunc ( const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE )
inline void unpack_texureBlendFunc ( E_BLEND_FACTOR &srcFact, E_BLEND_FACTOR &dstFact,
E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param )
New methods
inline bool textureBlendFunc_hasAlpha ( const E_BLEND_FACTOR factor )
Default value set elsewhere now (see IrrCompileConfig.h)
const u32 MATERIAL_MAX_TEXTURES = _IRR_MATERIAL_MAX_TEXTURES_;
Types changed
u8 ZBuffer;
bool Wireframe:1;
bool PointCloud:1;
bool GouraudShading:1;
bool Lighting:1;
bool ZWriteEnable:1;
bool BackfaceCulling:1;
bool FrontfaceCulling:1;
bool FogEnable:1;
bool NormalizeNormals:1;
New members
u8 AntiAliasing;
u8 ColorMask:4;
u8 ColorMaterial:3;
New constant
IRRLICHT_API extern SMaterial IdentityMaterial;
IGUISkin.h
New enum values
EGDS_TITLEBARTEXT_DISTANCE_X,
EGDS_TITLEBARTEXT_DISTANCE_Y,
quaternion.h
New parameters
void getMatrix( matrix4 &dest, const vector3df &translation ) const;
New method
void getMatrixCenter( matrix4 &dest, const vector3df &center, const vector3df &translation ) const;
ISceneNodeAnimatorCameraFPS.h
New method
virtual void setInvertMouse(bool invert) = 0;
IImage.h
New enum values
/** Floating Point formats. The following formats may only be used for render target textures. */
ECF_R16F,
ECF_G16R16F,
ECF_A16B16G16R16F,
ECF_R32F,
ECF_G32R32F,
ECF_A32B32G32R32F,
ECF_UNKNOWN
Signedness change
virtual const core::dimension2d<u32>& getDimension() const = 0;
virtual void copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0) =0;
New parameter
virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ) = 0;
New method
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false) = 0;
static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
IVideoDriver.h
New enum values (only existing if _IRR_MATERIAL_MAX_TEXTURES_ large enough)
ETS_TEXTURE_4
ETS_TEXTURE_5
ETS_TEXTURE_6
ETS_TEXTURE_7
New enums
enum E_RENDER_TARGET
enum E_FOG_TYPE
New type
struct SOverrideMaterial
New methods
virtual u32 getImageLoaderCount() const = 0;
virtual IImageLoader* getImageLoader(u32 n) = 0;
virtual u32 getImageWriterCount() const = 0;
virtual IImageWriter* getImageWriter(u32 n) = 0;
virtual bool setRenderTarget(E_RENDER_TARGET target, bool clearTarget=true,
bool clearZBuffer=true, SColor color=video::SColor(0,0,0,0)) =0;
virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount,
const void* indexList, u32 primCount,
E_VERTEX_TYPE vType=EVT_STANDARD,
scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES,
E_INDEX_TYPE iType=EIT_16BIT) =0;
virtual void draw2DImageBatch(const video::ITexture* texture,
const core::array<core::position2d<s32> >& positions,
const core::array<core::rect<s32> >& sourceRects,
const core::rect<s32>* clipRect=0,
SColor color=SColor(255,255,255,255),
bool useAlphaChannelOfTexture=false) =0;
virtual void turnLightOn(s32 lightIndex, bool turnOn) =0;
virtual bool writeImageToFile(IImage* image, io::IWriteFile* file, u32 param =0) =0;
virtual IImage* createImage(ITexture* texture,
const core::position2d<s32>& pos, const core::dimension2d<u32>& size) =0;
virtual void setMinHardwareBufferVertexCount(u32 count) =0;
virtual SOverrideMaterial& getOverrideMaterial() =0;
Changed parameters to use io::path
virtual ITexture* getTexture(const io::path& filename) = 0;
virtual void renameTexture(ITexture* texture, const io::path& newName) = 0;
virtual ITexture* addTexture(const io::path& name, IImage* image) = 0;
virtual IImage* createImageFromFile(const io::path& filename) = 0;
virtual bool writeImageToFile(IImage* image, const io::path& filename, u32 param = 0) = 0;
virtual video::ITexture* findTexture(const io::path& filename) = 0;
Changed signedness
virtual ITexture* addTexture(const core::dimension2d<u32>& size,
const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;
virtual const core::dimension2d<u32>& getScreenSize() const =0;
virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const =0;
virtual IImage* createImageFromData(ECOLOR_FORMAT format,
const core::dimension2d<u32>& size, void *data,
bool ownForeignMemory=false,
bool deleteMemory = true) =0;
virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) =0;
virtual IImage* createImage(IImage* imageToCopy,
const core::position2d<s32>& pos,
const core::dimension2d<u32>& size) =0;
virtual void OnResize(const core::dimension2d<u32>& size) =0;
Changed signedness and usage of io::path
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;
Removed deprecated method
virtual ITexture* createRenderTargetTexture(const core::dimension2d<s32>& size,
const c8* name=0) =0;
New parameter
virtual void makeColorKeyTexture(video::ITexture* texture,
video::SColor color, bool zeroTexels = false) const =0;
virtual void makeColorKeyTexture(video::ITexture* texture,
core::position2d<s32> colorKeyPixelPos, bool zeroTexels = false) const =0;
Changed parameters
virtual void setFog(SColor color=SColor(0,255,255,255),
E_FOG_TYPE fogType=EFT_FOG_LINEAR,
f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
bool pixelFog=false, bool rangeFog=false) =0;
Changed return types
virtual s32 addDynamicLight(const SLight& light) =0;
EDriverFeatures.h
New enum values
EVDF_ALPHA_TO_COVERAGE,
EVDF_COLOR_MASK,
IGUIScrollBar.h
New methods
virtual void setMin(s32 max) = 0;
virtual s32 getMin() const = 0;
IQ3LevelMesh.h
Removed method
virtual void releaseMesh(s32 index) = 0;
Made return value non-const
virtual quake3::tQ3EntityList& getEntityList() = 0;
ISceneCollisionManager.h
New parameter
virtual bool getCollisionPoint(const core::line3d<f32>& ray,
ITriangleSelector* selector, core::vector3df& outCollisionPoint,
core::triangle3df& outTriangle, const ISceneNode*& outNode) =0;
virtual core::vector3df getCollisionResultPosition(
ITriangleSelector* selector,
const core::vector3df &ellipsoidPosition,
const core::vector3df& ellipsoidRadius,
const core::vector3df& ellipsoidDirectionAndSpeed,
core::triangle3df& triout,
core::vector3df& hitPosition,
bool& outFalling,
const ISceneNode*& outNode,
f32 slidingSpeed = 0.0005f,
const core::vector3df& gravityDirectionAndSpeed = core::vector3df(0.0f, 0.0f, 0.0f)) = 0;
Made parameter const&
virtual core::line3d<f32> getRayFromScreenCoordinates(
const core::position2d<s32> & pos, ICameraSceneNode* camera = 0) = 0;
virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition(
const core::vector3df & pos, ICameraSceneNode* camera=0) = 0;
Made parameter const& and added new parameter
virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(const core::position2d<s32>& pos,
s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) =0;
virtual ISceneNode* getSceneNodeFromRayBB(const core::line3d<f32>& ray,
s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) =0;
New method
virtual ISceneNode* getSceneNodeAndCollisionPointFromRay(
core::line3df ray, core::vector3df & outCollisionPoint,
core::triangle3df & outTriangle, s32 idBitMask = 0,
ISceneNode * collisionRootNode = 0, bool noDebugObjects = false) = 0;
irrlicht.h
Changed interface of method (qualifiers and signedness)
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDevice(
video::E_DRIVER_TYPE deviceType = video::EDT_SOFTWARE,
// parantheses are necessary for some compilers
const core::dimension2d<u32>& windowSize = (core::dimension2d<u32>(640,480)),
u32 bits = 16,
bool fullscreen = false,
bool stencilbuffer = false,
bool vsync = false,
IEventReceiver* receiver = 0);
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
const SIrrlichtCreationParameters& parameters);
IImageLoader.h
Changed parameters to use io::path
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
IGUIWindow.h
New methods
virtual bool isDraggable() const = 0;
virtual void setDraggable(bool draggable) = 0;
virtual void setDrawBackground(bool draw) = 0;
virtual bool getDrawBackground() const = 0;
virtual void setDrawTitlebar(bool draw) = 0;
virtual bool getDrawTitlebar() const = 0;
ICameraSceneNode.h
New methods
virtual void setViewMatrixAffector(const core::matrix4& affector) =0;
virtual const core::matrix4& getViewMatrixAffector() const =0;
EGUIElementTypes.h
New enum value
EGUIET_TREE_VIEW,
IImageWriter.h
Changed parameters to use io::path
virtual bool isAWriteableFileExtension(const io::path& filename) const = 0;
SIrrCreationParameters.h
Added members
E_DEVICE_TYPE DeviceType;
bool Doublebuffer;
bool Stereobuffer;
Changed signedness
core::dimension2d<u32> WindowSize;
Changed type (from bool)
u8 AntiAlias;
matrix4.h
New methods
bool isOrthogonal() const;
CMatrix4<T>& buildRotateFromTo(const core::vector3df& from, const core::vector3df& to);
void setRotationCenter(const core::vector3df& center, const core::vector3df& translate);
void buildAxisAlignedBillboard( const core::vector3df& camPos,
const core::vector3df& center, const core::vector3df& translation,
const core::vector3df& axis, const core::vector3df& from);
IWriteFile.h
Changed parameters to use io::path
virtual const path& getFileName() const = 0;
IGUITable.h
New methods
virtual void setSelected( s32 index ) = 0;
Changed type (from wide c string)
virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text) = 0;
virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text, video::SColor color) = 0;
SKeyMap.h
New enum value
EKA_CROUCH,
IGUIFont.h
Changed type (from wide c string)
virtual void draw(const core::stringw& text, const core::rect<s32>& position,
video::SColor color, bool hcenter=false, bool vcenter=false,
const core::rect<s32>* clip=0) = 0;
Changed signedness
virtual core::dimension2d<u32> getDimension(const wchar_t* text) const = 0;
New method
virtual void setInvisibleCharacters( const wchar_t *s ) = 0;
IMeshCache.h
Changed parameters to use io::path
virtual void addMesh(const io::path& filename, IAnimatedMesh* mesh) = 0;
virtual IAnimatedMesh* getMeshByFilename(const io::path& filename) = 0;
virtual const io::path& getMeshFilename(u32 index) const = 0;
virtual const io::path& getMeshFilename(const IAnimatedMesh* const mesh) const = 0;
virtual const io::path& getMeshFilename(const IMesh* const mesh) const = 0;
virtual bool setMeshFilename(u32 index, const io::path& filename) = 0;
virtual bool setMeshFilename(const IAnimatedMesh* const mesh, const io::path& filename) = 0;
virtual bool setMeshFilename(const IMesh* const mesh, const io::path& filename) = 0;
virtual bool isMeshLoaded(const io::path& filename) = 0;
IGUIButton.h
Added default value
virtual void setImage(video::ITexture* image=0) = 0;
virtual void setPressedImage(video::ITexture* image=0) = 0;
virtual void setSpriteBank(IGUISpriteBank* bank=0) = 0;
virtual void setIsPushButton(bool isPushButton=true) = 0;
virtual void setPressed(bool pressed=true) = 0;
virtual void setUseAlphaChannel(bool useAlphaChannel=true) = 0;
virtual void setDrawBorder(bool border=true) = 0;
New methods
virtual void setScaleImage(bool scaleImage=true) = 0;
virtual bool isScalingImage() const = 0;
position2d.h
Replaced by vector2d
IGUIImageList.h
New interface
class IGUIImageList : public virtual IReferenceCounted
rect.h
Added second template parameter to allow mismatched signedness
template <class U>
rect(const position2d<T>& pos, const dimension2d<U>& size)
IParticleEmitter.h
Removed wrong overrides
virtual void serializeAttributes(io::IAttributes* out,
io::SAttributeReadWriteOptions* options=0) const {}
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in,
io::SAttributeReadWriteOptions* options=0) { return 0; }
IOSOperator.h
Return const string
virtual const c8* getTextFromClipboard() const = 0;
IGUIElement.h
Signedness change
void setMaxSize(core::dimension2du size)
void setMinSize(core::dimension2du size)
IReadFile.h
Changed parameters to use io::path
virtual const io::path& getFileName() const = 0;
IReadFile* createReadFile(const io::path& fileName);
IReadFile* createLimitReadFile(const io::path& fileName, IReadFile* alreadyOpenedFile, long pos, long areaSize);
IReadFile* createMemoryReadFile(void* memory, long size, const io::path& fileName, bool deleteMemoryWhenDropped);
IGUITabControl.h
New methods
virtual void setTabMaxWidth(s32 width ) = 0;
virtual s32 getTabMaxWidth() const = 0;
IParticleAffector.h
Removed wrong overrides
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; }
ILogger.h
New method
virtual void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
vector2d.h
New methods
vector2d(const dimension2d<T>& other) : X(other.Width), Y(other.Height) {}
vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; }
vector2d<T> operator+(const dimension2d<T>& other) const { return vector2d<T>(X + other.Width, Y + other.Height); }
vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Height; return *this; }
vector2d<T> operator-(const dimension2d<T>& other) const { return vector2d<T>(X - other.Width, Y - other.Height); }
vector2d<T>& operator-=(const dimension2d<T>& other) { X -= other.Width; Y -= other.Height; return *this; }
// These methods are declared in dimension2d, but need definitions of vector2d
template<class T>
dimension2d<T>::dimension2d(const vector2d<T>& other) : Width(other.X), Height(other.Y) { }
template<class T>
bool dimension2d<T>::operator==(const vector2d<T>& other) const { return Width == other.X && Height == other.Y; }
Changes for Version 1.6.1
-------------------------
This is again just a bugfix release. However, some minor API changes have happened. The most important one is the removal of lins anti-aliasing from SMaterial's default values. Please add that line smoothing flag to the materials you want to be smoothed. But note that this may lead to drastically reduced performance, if no multi-sampling is active.
IFileList.h
new methods
virtual u32 getID(u32 index) const = 0;
virtual u32 addItem(const io::path& fullPath, u32 size, bool isDirectory, u32 id=0) = 0;
virtual void sort() = 0;
IrrCompileConfig.h
Removed auto recognition of Solaris OS, please define the setting on your own if you need it
_IRR_SOLARIS_PLATFORM_
IGUITreeView.h
removed methods (use automatically generated versions)
IGUITreeViewNode() {}
virtual ~IGUITreeViewNode() {}
virtual ~IGUITreeView() {}
IFileSystem.h
new method
virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths) =0;
SMaterial.h
Removed default value (EAAM_LINE_SMOOTH from AntiAliasing)
ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
IGUISkin.h
new enum value
EGST_COUNT

View File

@ -6,7 +6,7 @@ controlled camera.
Please note that you should know the basics of the engine before starting this Please note that you should know the basics of the engine before starting this
tutorial. Just take a short look at the first tutorial, if you haven't done tutorial. Just take a short look at the first tutorial, if you haven't done
this yet: http://irrlicht.sourceforge.net/tut001.html this yet: http://irrlicht.sourceforge.net/tut001.html
Lets start like the HelloWorld example: We include the irrlicht header files Lets start like the HelloWorld example: We include the irrlicht header files
and an additional file to be able to ask the user for a driver type using the and an additional file to be able to ask the user for a driver type using the
@ -71,7 +71,7 @@ int main()
case 'f': driverType = video::EDT_BURNINGSVIDEO;break; case 'f': driverType = video::EDT_BURNINGSVIDEO;break;
case 'g': driverType = video::EDT_NULL; break; case 'g': driverType = video::EDT_NULL; break;
default: return 1; default: return 1;
} }
// create device and exit if creation failed // create device and exit if creation failed
@ -105,24 +105,24 @@ int main()
really animated, they are only a huge chunk of static geometry with really animated, they are only a huge chunk of static geometry with
some materials attached. Hence the IAnimatedMesh consists of only one some materials attached. Hence the IAnimatedMesh consists of only one
frame, so we get the "first frame" of the "animation", which is our frame, so we get the "first frame" of the "animation", which is our
quake level and create an OctTree scene node with it, using quake level and create an Octree scene node with it, using
irr::scene::ISceneManager::addOctTreeSceneNode(). irr::scene::ISceneManager::addOctreeSceneNode().
The OctTree optimizes the scene a little bit, trying to draw only geometry The Octree optimizes the scene a little bit, trying to draw only geometry
which is currently visible. An alternative to the OctTree would be a which is currently visible. An alternative to the Octree would be a
irr::scene::IMeshSceneNode, which would always draw the complete irr::scene::IMeshSceneNode, which would always draw the complete
geometry of the mesh, without optimization. Try it: Use geometry of the mesh, without optimization. Try it: Use
irr::scene::ISceneManager::addMeshSceneNode() instead of irr::scene::ISceneManager::addMeshSceneNode() instead of
addOctTreeSceneNode() and compare the primitives drawn by the video addOctreeSceneNode() and compare the primitives drawn by the video
driver. (There is a irr::video::IVideoDriver::getPrimitiveCountDrawn() driver. (There is a irr::video::IVideoDriver::getPrimitiveCountDrawn()
method in the irr::video::IVideoDriver class). Note that this method in the irr::video::IVideoDriver class). Note that this
optimization with the OctTree is only useful when drawing huge meshes optimization with the Octree is only useful when drawing huge meshes
consisting of lots of geometry. consisting of lots of geometry.
*/ */
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp"); scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* node = 0; scene::ISceneNode* node = 0;
if (mesh) if (mesh)
node = smgr->addOctTreeSceneNode(mesh->getMesh(0), 0, -1, 1024); node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);
// node = smgr->addMeshSceneNode(mesh->getMesh(0)); // node = smgr->addMeshSceneNode(mesh->getMesh(0));
/* /*

View File

@ -132,7 +132,7 @@ public:
driver->setMaterial(Material); driver->setMaterial(Material);
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
driver->drawVertexPrimitiveList(&Vertices[0], 4, &indices[0], 4, video::EVT_STANDARD, scene::EPT_POINTS); driver->drawVertexPrimitiveList(&Vertices[0], 4, &indices[0], 4, video::EVT_STANDARD, scene::EPT_TRIANGLES, video::EIT_16BIT);
} }
/* /*

View File

@ -89,6 +89,12 @@ int main()
core::rect<s32> imp1(349,15,385,78); core::rect<s32> imp1(349,15,385,78);
core::rect<s32> imp2(387,15,423,78); core::rect<s32> imp2(387,15,423,78);
/*
Prepare a nicely filtering 2d render mode for special cases.
*/
driver->getMaterial2D().TextureLayer[0].BilinearFilter=true;
driver->getMaterial2D().AntiAliasing=video::EAAM_FULL_BASIC;
/* /*
Everything is prepared, now we can draw everything in the draw loop, Everything is prepared, now we can draw everything in the draw loop,
between the begin scene and end scene calls. In this example, we are between the begin scene and end scene calls. In this example, we are
@ -148,16 +154,18 @@ int main()
video::SColor(255,time % 255,time % 255,255)); video::SColor(255,time % 255,time % 255,255));
/* /*
At last, we draw the Irrlicht Engine logo (without Next, we draw the Irrlicht Engine logo (without
using a color or an alpha channel) and a transparent 2d using a color or an alpha channel). Since we slightly scale
Rectangle at the position of the mouse cursor. the image we use the prepared filter mode.
*/ */
driver->enableMaterial2D();
// draw logo driver->draw2DImage(images, core::rect<s32>(10,10,108,48),
driver->draw2DImage(images, core::position2d<s32>(10,10),
core::rect<s32>(354,87,442,118)); core::rect<s32>(354,87,442,118));
driver->enableMaterial2D(false);
// draw transparent rect under cursor /*
Finally draw a half-transparent rect under the mouse cursor.
*/
core::position2d<s32> m = device->getCursorControl()->getPosition(); core::position2d<s32> m = device->getCursorControl()->getPosition();
driver->draw2DRectangle(video::SColor(100,255,255,255), driver->draw2DRectangle(video::SColor(100,255,255,255),
core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20)); core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20));

View File

@ -78,7 +78,7 @@ int main()
// The Quake mesh is pickable, but doesn't get highlighted. // The Quake mesh is pickable, but doesn't get highlighted.
if (q3levelmesh) if (q3levelmesh)
q3node = smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0), 0, IDFlag_IsPickable); q3node = smgr->addOctreeSceneNode(q3levelmesh->getMesh(0), 0, IDFlag_IsPickable);
/* /*
So far so good, we've loaded the quake 3 level like in tutorial 2. Now, So far so good, we've loaded the quake 3 level like in tutorial 2. Now,
@ -87,7 +87,7 @@ int main()
nodes for doing different things with them, for example collision nodes for doing different things with them, for example collision
detection. There are different triangle selectors, and all can be detection. There are different triangle selectors, and all can be
created with the ISceneManager. In this example, we create an created with the ISceneManager. In this example, we create an
OctTreeTriangleSelector, which optimizes the triangle output a little OctreeTriangleSelector, which optimizes the triangle output a little
bit by reducing it like an octree. This is very useful for huge meshes bit by reducing it like an octree. This is very useful for huge meshes
like quake 3 levels. After we created the triangle selector, we attach like quake 3 levels. After we created the triangle selector, we attach
it to the q3node. This is not necessary, but in this way, we do not it to the q3node. This is not necessary, but in this way, we do not
@ -101,7 +101,7 @@ int main()
{ {
q3node->setPosition(core::vector3df(-1350,-130,-1400)); q3node->setPosition(core::vector3df(-1350,-130,-1400));
selector = smgr->createOctTreeTriangleSelector( selector = smgr->createOctreeTriangleSelector(
q3node->getMesh(), q3node, 128); q3node->getMesh(), q3node, 128);
q3node->setTriangleSelector(selector); q3node->setTriangleSelector(selector);
// We're not done with this selector yet, so don't drop it. // We're not done with this selector yet, so don't drop it.
@ -237,6 +237,9 @@ int main()
scene::ISceneCollisionManager* collMan = smgr->getSceneCollisionManager(); scene::ISceneCollisionManager* collMan = smgr->getSceneCollisionManager();
int lastFPS = -1; int lastFPS = -1;
// draw the selection triangle only as wireframe
material.Wireframe=true;
while(device->run()) while(device->run())
if (device->isWindowActive()) if (device->isWindowActive())
{ {

View File

@ -16,7 +16,6 @@ tutorial, we use a lot stuff from the gui namespace.
#include <irrlicht.h> #include <irrlicht.h>
#include <iostream> #include <iostream>
using namespace irr; using namespace irr;
using namespace gui; using namespace gui;
@ -35,7 +34,7 @@ core::stringw Caption;
scene::ISceneNode* Model = 0; scene::ISceneNode* Model = 0;
scene::ISceneNode* SkyBox = 0; scene::ISceneNode* SkyBox = 0;
bool Octree=false; bool Octree=false;
bool useLight=false; bool UseLight=false;
scene::ICameraSceneNode* Camera[2] = {0, 0}; scene::ICameraSceneNode* Camera[2] = {0, 0};
@ -76,11 +75,24 @@ enum
GUI_ID_ABOUT, GUI_ID_ABOUT,
GUI_ID_QUIT, GUI_ID_QUIT,
GUI_ID_TEXTUREFILTER,
GUI_ID_SKIN_TRANSPARENCY,
GUI_ID_SKIN_ANIMATION_FPS,
GUI_ID_BUTTON_SET_SCALE,
GUI_ID_BUTTON_SCALE_MUL10,
GUI_ID_BUTTON_SCALE_DIV10,
GUI_ID_BUTTON_OPEN_MODEL,
GUI_ID_BUTTON_SHOW_ABOUT,
GUI_ID_BUTTON_SHOW_TOOLBOX,
GUI_ID_BUTTON_SELECT_ARCHIVE,
// And some magic numbers // And some magic numbers
MAX_FRAMERATE = 1000, MAX_FRAMERATE = 1000,
DEFAULT_FRAMERATE = 30 DEFAULT_FRAMERATE = 30
}; };
/* /*
Toggle between various cameras Toggle between various cameras
*/ */
@ -96,6 +108,42 @@ void setActiveCamera(scene::ICameraSceneNode* newActive)
Device->getSceneManager()->setActiveCamera(newActive); Device->getSceneManager()->setActiveCamera(newActive);
} }
/*
Set the skin transparency by changing the alpha values of all skin-colors
*/
void SetSkinTransparency(s32 alpha, irr::gui::IGUISkin * skin)
{
for (s32 i=0; i<irr::gui::EGDC_COUNT ; ++i)
{
video::SColor col = skin->getColor((EGUI_DEFAULT_COLOR)i);
col.setAlpha(alpha);
skin->setColor((EGUI_DEFAULT_COLOR)i, col);
}
}
/*
Update the display of the model scaling
*/
void UpdateScaleInfo(scene::ISceneNode* model)
{
IGUIElement* toolboxWnd = Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, true);
if (!toolboxWnd)
return;
if (!model)
{
toolboxWnd->getElementFromId(GUI_ID_X_SCALE, true)->setText( L"-" );
toolboxWnd->getElementFromId(GUI_ID_Y_SCALE, true)->setText( L"-" );
toolboxWnd->getElementFromId(GUI_ID_Z_SCALE, true)->setText( L"-" );
}
else
{
core::vector3df scale = model->getScale();
toolboxWnd->getElementFromId(GUI_ID_X_SCALE, true)->setText( core::stringw(scale.X).c_str() );
toolboxWnd->getElementFromId(GUI_ID_Y_SCALE, true)->setText( core::stringw(scale.Y).c_str() );
toolboxWnd->getElementFromId(GUI_ID_Z_SCALE, true)->setText( core::stringw(scale.Z).c_str() );
}
}
/* /*
The three following functions do several stuff used by the mesh viewer. The The three following functions do several stuff used by the mesh viewer. The
first function showAboutText() simply displays a messagebox with a caption and first function showAboutText() simply displays a messagebox with a caption and
@ -131,7 +179,8 @@ void loadModel(const c8* fn)
extension == ".png" || extension == ".ppm" || extension == ".png" || extension == ".ppm" ||
extension == ".pgm" || extension == ".pbm" || extension == ".pgm" || extension == ".pbm" ||
extension == ".psd" || extension == ".tga" || extension == ".psd" || extension == ".tga" ||
extension == ".bmp" || extension == ".wal") extension == ".bmp" || extension == ".wal" ||
extension == ".rgb" || extension == ".rgba")
{ {
video::ITexture * texture = video::ITexture * texture =
Device->getVideoDriver()->getTexture( filename ); Device->getVideoDriver()->getTexture( filename );
@ -146,14 +195,9 @@ void loadModel(const c8* fn)
return; return;
} }
// if a archive is loaded add it to the FileArchive.. // if a archive is loaded add it to the FileArchive..
else if (extension == ".pk3" || extension == ".zip") else if (extension == ".pk3" || extension == ".zip" || extension == ".pak" || extension == ".npk")
{ {
Device->getFileSystem()->addZipFileArchive(filename.c_str()); Device->getFileSystem()->addFileArchive(filename.c_str());
return;
}
else if (extension == ".pak")
{
Device->getFileSystem()->addPakFileArchive(filename.c_str());
return; return;
} }
@ -164,6 +208,16 @@ void loadModel(const c8* fn)
Model = 0; Model = 0;
if (extension==".irr")
{
core::array<scene::ISceneNode*> outNodes;
Device->getSceneManager()->loadScene(filename);
Device->getSceneManager()->getSceneNodesFromType(scene::ESNT_ANIMATED_MESH, outNodes);
if (outNodes.size())
Model = outNodes[0];
return;
}
scene::IAnimatedMesh* m = Device->getSceneManager()->getMesh( filename.c_str() ); scene::IAnimatedMesh* m = Device->getSceneManager()->getMesh( filename.c_str() );
if (!m) if (!m)
@ -180,15 +234,15 @@ void loadModel(const c8* fn)
// set default material properties // set default material properties
if (Octree) if (Octree)
Model = Device->getSceneManager()->addOctTreeSceneNode(m->getMesh(0)); Model = Device->getSceneManager()->addOctreeSceneNode(m->getMesh(0));
else else
{ {
scene::IAnimatedMeshSceneNode* animModel = Device->getSceneManager()->addAnimatedMeshSceneNode(m); scene::IAnimatedMeshSceneNode* animModel = Device->getSceneManager()->addAnimatedMeshSceneNode(m);
animModel->setAnimationSpeed(30); animModel->setAnimationSpeed(30);
Model = animModel; Model = animModel;
} }
Model->setMaterialFlag(video::EMF_LIGHTING, useLight); Model->setMaterialFlag(video::EMF_LIGHTING, UseLight);
Model->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, useLight); Model->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, UseLight);
// Model->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false); // Model->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);
Model->setDebugDataVisible(scene::EDS_OFF); Model->setDebugDataVisible(scene::EDS_OFF);
@ -198,13 +252,7 @@ void loadModel(const c8* fn)
if (menu) if (menu)
for(int item = 1; item < 6; ++item) for(int item = 1; item < 6; ++item)
menu->setItemChecked(item, false); menu->setItemChecked(item, false);
IGUIElement* toolboxWnd = Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, true); UpdateScaleInfo(Model);
if ( toolboxWnd )
{
toolboxWnd->getElementFromId(GUI_ID_X_SCALE, true)->setText(L"1.0");
toolboxWnd->getElementFromId(GUI_ID_Y_SCALE, true)->setText(L"1.0");
toolboxWnd->getElementFromId(GUI_ID_Z_SCALE, true)->setText(L"1.0");
}
} }
@ -234,7 +282,7 @@ void createToolBox()
// add some edit boxes and a button to tab one // add some edit boxes and a button to tab one
env->addStaticText(L"Scale:", env->addStaticText(L"Scale:",
core::rect<s32>(10,20,150,45), false, false, t1); core::rect<s32>(10,20,60,45), false, false, t1);
env->addStaticText(L"X:", core::rect<s32>(22,48,40,66), false, false, t1); env->addStaticText(L"X:", core::rect<s32>(22,48,40,66), false, false, t1);
env->addEditBox(L"1.0", core::rect<s32>(40,46,130,66), true, t1, GUI_ID_X_SCALE); env->addEditBox(L"1.0", core::rect<s32>(40,46,130,66), true, t1, GUI_ID_X_SCALE);
env->addStaticText(L"Y:", core::rect<s32>(22,82,40,GUI_ID_OPEN_MODEL), false, false, t1); env->addStaticText(L"Y:", core::rect<s32>(22,82,40,GUI_ID_OPEN_MODEL), false, false, t1);
@ -242,13 +290,19 @@ void createToolBox()
env->addStaticText(L"Z:", core::rect<s32>(22,108,40,126), false, false, t1); env->addStaticText(L"Z:", core::rect<s32>(22,108,40,126), false, false, t1);
env->addEditBox(L"1.0", core::rect<s32>(40,106,130,126), true, t1, GUI_ID_Z_SCALE); env->addEditBox(L"1.0", core::rect<s32>(40,106,130,126), true, t1, GUI_ID_Z_SCALE);
env->addButton(core::rect<s32>(10,134,85,165), t1, 1101, L"Set"); env->addButton(core::rect<s32>(10,134,85,165), t1, GUI_ID_BUTTON_SET_SCALE, L"Set");
// quick scale buttons
env->addButton(core::rect<s32>(65,20,95,40), t1, GUI_ID_BUTTON_SCALE_MUL10, L"* 10");
env->addButton(core::rect<s32>(100,20,130,40), t1, GUI_ID_BUTTON_SCALE_DIV10, L"* 0.1");
UpdateScaleInfo(Model);
// add transparency control // add transparency control
env->addStaticText(L"GUI Transparency Control:", env->addStaticText(L"GUI Transparency Control:",
core::rect<s32>(10,200,150,225), true, false, t1); core::rect<s32>(10,200,150,225), true, false, t1);
IGUIScrollBar* scrollbar = env->addScrollBar(true, IGUIScrollBar* scrollbar = env->addScrollBar(true,
core::rect<s32>(10,225,150,240), t1, 104); core::rect<s32>(10,225,150,240), t1, GUI_ID_SKIN_TRANSPARENCY);
scrollbar->setMax(255); scrollbar->setMax(255);
scrollbar->setPos(255); scrollbar->setPos(255);
@ -256,8 +310,9 @@ void createToolBox()
env->addStaticText(L"Framerate:", env->addStaticText(L"Framerate:",
core::rect<s32>(10,240,150,265), true, false, t1); core::rect<s32>(10,240,150,265), true, false, t1);
scrollbar = env->addScrollBar(true, scrollbar = env->addScrollBar(true,
core::rect<s32>(10,265,150,280), t1, 105); core::rect<s32>(10,265,150,280), t1, GUI_ID_SKIN_ANIMATION_FPS);
scrollbar->setMax(MAX_FRAMERATE); scrollbar->setMax(MAX_FRAMERATE);
scrollbar->setMin(-MAX_FRAMERATE);
scrollbar->setPos(DEFAULT_FRAMERATE); scrollbar->setPos(DEFAULT_FRAMERATE);
// bring irrlicht engine logo to front, because it // bring irrlicht engine logo to front, because it
@ -265,7 +320,6 @@ void createToolBox()
root->bringToFront(root->getElementFromId(666, true)); root->bringToFront(root->getElementFromId(666, true));
} }
/* /*
To get all the events sent by the GUI Elements, we need to create an event To get all the events sent by the GUI Elements, we need to create an event
receiver. This one is really simple. If an event occurs, it checks the id of receiver. This one is really simple. If an event occurs, it checks the id of
@ -281,42 +335,8 @@ public:
if (event.EventType == EET_KEY_INPUT_EVENT && if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.PressedDown == false) event.KeyInput.PressedDown == false)
{ {
if (event.KeyInput.Key == irr::KEY_ESCAPE) if ( OnKeyUp(event.KeyInput.Key) )
{ return true;
if (Device)
{
scene::ICameraSceneNode * camera =
Device->getSceneManager()->getActiveCamera();
if (camera)
{
camera->setInputReceiverEnabled( !camera->isInputReceiverEnabled() );
}
return true;
}
}
else if (event.KeyInput.Key == irr::KEY_F1)
{
if (Device)
{
IGUIElement* elem = Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_POSITION_TEXT);
if (elem)
elem->setVisible(!elem->isVisible());
}
}
else if (event.KeyInput.Key == irr::KEY_KEY_M)
{
if (Device)
Device->minimizeWindow();
}
else if (event.KeyInput.Key == irr::KEY_KEY_L)
{
useLight=!useLight;
if (Model)
{
Model->setMaterialFlag(video::EMF_LIGHTING, useLight);
Model->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, useLight);
}
}
} }
if (event.EventType == EET_GUI_EVENT) if (event.EventType == EET_GUI_EVENT)
@ -327,107 +347,9 @@ public:
switch(event.GUIEvent.EventType) switch(event.GUIEvent.EventType)
{ {
case EGET_MENU_ITEM_SELECTED: case EGET_MENU_ITEM_SELECTED:
{
// a menu item was clicked // a menu item was clicked
OnMenuItemSelected( (IGUIContextMenu*)event.GUIEvent.Caller );
IGUIContextMenu* menu = (IGUIContextMenu*)event.GUIEvent.Caller;
s32 id = menu->getItemCommandId(menu->getSelectedItem());
switch(id)
{
case GUI_ID_OPEN_MODEL: // File -> Open Model
env->addFileOpenDialog(L"Please select a model file to open");
break;
case GUI_ID_SET_MODEL_ARCHIVE: // File -> Set Model Archive
env->addFileOpenDialog(L"Please select your game archive/directory");
break;
case GUI_ID_LOAD_AS_OCTREE: // File -> LoadAsOctree
Octree = !Octree;
menu->setItemChecked(menu->getSelectedItem(), Octree);
break;
case GUI_ID_QUIT: // File -> Quit
Device->closeDevice();
break;
case GUI_ID_SKY_BOX_VISIBLE: // View -> Skybox
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
SkyBox->setVisible(!SkyBox->isVisible());
break;
case GUI_ID_DEBUG_OFF: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem()+1, false);
menu->setItemChecked(menu->getSelectedItem()+2, false);
menu->setItemChecked(menu->getSelectedItem()+3, false);
menu->setItemChecked(menu->getSelectedItem()+4, false);
menu->setItemChecked(menu->getSelectedItem()+5, false);
menu->setItemChecked(menu->getSelectedItem()+6, false);
if (Model)
Model->setDebugDataVisible(scene::EDS_OFF);
break;
case GUI_ID_DEBUG_BOUNDING_BOX: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_BBOX));
break;
case GUI_ID_DEBUG_NORMALS: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_NORMALS));
break;
case GUI_ID_DEBUG_SKELETON: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_SKELETON));
break;
case GUI_ID_DEBUG_WIRE_OVERLAY: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_MESH_WIRE_OVERLAY));
break;
case GUI_ID_DEBUG_HALF_TRANSPARENT: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_HALF_TRANSPARENCY));
break;
case GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_BBOX_BUFFERS));
break;
case GUI_ID_DEBUG_ALL: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem()-1, true);
menu->setItemChecked(menu->getSelectedItem()-2, true);
menu->setItemChecked(menu->getSelectedItem()-3, true);
menu->setItemChecked(menu->getSelectedItem()-4, true);
menu->setItemChecked(menu->getSelectedItem()-5, true);
menu->setItemChecked(menu->getSelectedItem()-6, true);
if (Model)
Model->setDebugDataVisible(scene::EDS_FULL);
break;
case GUI_ID_ABOUT: // Help->About
showAboutText();
break;
case GUI_ID_MODEL_MATERIAL_SOLID: // View -> Material -> Solid
if (Model)
Model->setMaterialType(video::EMT_SOLID);
break;
case GUI_ID_MODEL_MATERIAL_TRANSPARENT: // View -> Material -> Transparent
if (Model)
Model->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
break;
case GUI_ID_MODEL_MATERIAL_REFLECTION: // View -> Material -> Reflection
if (Model)
Model->setMaterialType(video::EMT_SPHERE_MAP);
break;
case GUI_ID_CAMERA_MAYA:
setActiveCamera(Camera[0]);
break;
case GUI_ID_CAMERA_FIRST_PERSON:
setActiveCamera(Camera[1]);
break;
}
break; break;
}
case EGET_FILE_SELECTED: case EGET_FILE_SELECTED:
{ {
@ -441,17 +363,13 @@ public:
case EGET_SCROLL_BAR_CHANGED: case EGET_SCROLL_BAR_CHANGED:
// control skin transparency // control skin transparency
if (id == 104) if (id == GUI_ID_SKIN_TRANSPARENCY)
{ {
const s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos(); const s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
for (s32 i=0; i<irr::gui::EGDC_COUNT ; ++i) SetSkinTransparency(pos, env->getSkin());
{
video::SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
col.setAlpha(pos);
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
}
} }
else if (id == 105) // control animation speed
else if (id == GUI_ID_SKIN_ANIMATION_FPS)
{ {
const s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos(); const s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
if (scene::ESNT_ANIMATED_MESH == Model->getType()) if (scene::ESNT_ANIMATED_MESH == Model->getType())
@ -462,46 +380,9 @@ public:
case EGET_COMBO_BOX_CHANGED: case EGET_COMBO_BOX_CHANGED:
// control anti-aliasing/filtering // control anti-aliasing/filtering
if (id == 108) if (id == GUI_ID_TEXTUREFILTER)
{ {
s32 pos = ((IGUIComboBox*)event.GUIEvent.Caller)->getSelected(); OnTextureFilterSelected( (IGUIComboBox*)event.GUIEvent.Caller );
switch (pos)
{
case 0:
if (Model)
{
Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, false);
Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, false);
}
break;
case 1:
if (Model)
{
Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, true);
Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, false);
}
break;
case 2:
if (Model)
{
Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, true);
}
break;
case 3:
if (Model)
{
Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, true);
}
break;
case 4:
if (Model)
{
Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, false);
}
break;
}
} }
break; break;
@ -509,7 +390,7 @@ public:
switch(id) switch(id)
{ {
case 1101: case GUI_ID_BUTTON_SET_SCALE:
{ {
// set scale // set scale
gui::IGUIElement* root = env->getRootGUIElement(); gui::IGUIElement* root = env->getRootGUIElement();
@ -525,18 +406,29 @@ public:
if (Model) if (Model)
Model->setScale(scale); Model->setScale(scale);
UpdateScaleInfo(Model);
} }
break; break;
case 1102: case GUI_ID_BUTTON_SCALE_MUL10:
if (Model)
Model->setScale(Model->getScale()*10.f);
UpdateScaleInfo(Model);
break;
case GUI_ID_BUTTON_SCALE_DIV10:
if (Model)
Model->setScale(Model->getScale()*0.1f);
UpdateScaleInfo(Model);
break;
case GUI_ID_BUTTON_OPEN_MODEL:
env->addFileOpenDialog(L"Please select a model file to open"); env->addFileOpenDialog(L"Please select a model file to open");
break; break;
case 1103: case GUI_ID_BUTTON_SHOW_ABOUT:
showAboutText(); showAboutText();
break; break;
case 1104: case GUI_ID_BUTTON_SHOW_TOOLBOX:
createToolBox(); createToolBox();
break; break;
case 1105: case GUI_ID_BUTTON_SELECT_ARCHIVE:
env->addFileOpenDialog(L"Please select your game archive/directory"); env->addFileOpenDialog(L"Please select your game archive/directory");
break; break;
} }
@ -549,6 +441,199 @@ public:
return false; return false;
} }
/*
Handle key-up events
*/
bool OnKeyUp(irr::EKEY_CODE keyCode)
{
if (keyCode == irr::KEY_ESCAPE)
{
if (Device)
{
scene::ICameraSceneNode * camera =
Device->getSceneManager()->getActiveCamera();
if (camera)
{
camera->setInputReceiverEnabled( !camera->isInputReceiverEnabled() );
}
return true;
}
}
else if (keyCode == irr::KEY_F1)
{
if (Device)
{
IGUIElement* elem = Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_POSITION_TEXT);
if (elem)
elem->setVisible(!elem->isVisible());
}
}
else if (keyCode == irr::KEY_KEY_M)
{
if (Device)
Device->minimizeWindow();
}
else if (keyCode == irr::KEY_KEY_L)
{
UseLight=!UseLight;
if (Model)
{
Model->setMaterialFlag(video::EMF_LIGHTING, UseLight);
Model->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, UseLight);
}
}
return false;
}
/*
Handle "menu item clicked" events.
*/
void OnMenuItemSelected( IGUIContextMenu* menu )
{
s32 id = menu->getItemCommandId(menu->getSelectedItem());
IGUIEnvironment* env = Device->getGUIEnvironment();
switch(id)
{
case GUI_ID_OPEN_MODEL: // FilOnButtonSetScalinge -> Open Model
env->addFileOpenDialog(L"Please select a model file to open");
break;
case GUI_ID_SET_MODEL_ARCHIVE: // File -> Set Model Archive
env->addFileOpenDialog(L"Please select your game archive/directory");
break;
case GUI_ID_LOAD_AS_OCTREE: // File -> LoadAsOctree
Octree = !Octree;
menu->setItemChecked(menu->getSelectedItem(), Octree);
break;
case GUI_ID_QUIT: // File -> Quit
Device->closeDevice();
break;
case GUI_ID_SKY_BOX_VISIBLE: // View -> Skybox
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
SkyBox->setVisible(!SkyBox->isVisible());
break;
case GUI_ID_DEBUG_OFF: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem()+1, false);
menu->setItemChecked(menu->getSelectedItem()+2, false);
menu->setItemChecked(menu->getSelectedItem()+3, false);
menu->setItemChecked(menu->getSelectedItem()+4, false);
menu->setItemChecked(menu->getSelectedItem()+5, false);
menu->setItemChecked(menu->getSelectedItem()+6, false);
if (Model)
Model->setDebugDataVisible(scene::EDS_OFF);
break;
case GUI_ID_DEBUG_BOUNDING_BOX: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_BBOX));
break;
case GUI_ID_DEBUG_NORMALS: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_NORMALS));
break;
case GUI_ID_DEBUG_SKELETON: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_SKELETON));
break;
case GUI_ID_DEBUG_WIRE_OVERLAY: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_MESH_WIRE_OVERLAY));
break;
case GUI_ID_DEBUG_HALF_TRANSPARENT: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_HALF_TRANSPARENCY));
break;
case GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
if (Model)
Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_BBOX_BUFFERS));
break;
case GUI_ID_DEBUG_ALL: // View -> Debug Information
menu->setItemChecked(menu->getSelectedItem()-1, true);
menu->setItemChecked(menu->getSelectedItem()-2, true);
menu->setItemChecked(menu->getSelectedItem()-3, true);
menu->setItemChecked(menu->getSelectedItem()-4, true);
menu->setItemChecked(menu->getSelectedItem()-5, true);
menu->setItemChecked(menu->getSelectedItem()-6, true);
if (Model)
Model->setDebugDataVisible(scene::EDS_FULL);
break;
case GUI_ID_ABOUT: // Help->About
showAboutText();
break;
case GUI_ID_MODEL_MATERIAL_SOLID: // View -> Material -> Solid
if (Model)
Model->setMaterialType(video::EMT_SOLID);
break;
case GUI_ID_MODEL_MATERIAL_TRANSPARENT: // View -> Material -> Transparent
if (Model)
Model->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
break;
case GUI_ID_MODEL_MATERIAL_REFLECTION: // View -> Material -> Reflection
if (Model)
Model->setMaterialType(video::EMT_SPHERE_MAP);
break;
case GUI_ID_CAMERA_MAYA:
setActiveCamera(Camera[0]);
break;
case GUI_ID_CAMERA_FIRST_PERSON:
setActiveCamera(Camera[1]);
break;
}
}
/*
Handle the event that one of the texture-filters was selected in the corresponding combobox.
*/
void OnTextureFilterSelected( IGUIComboBox* combo )
{
s32 pos = combo->getSelected();
switch (pos)
{
case 0:
if (Model)
{
Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, false);
Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, false);
}
break;
case 1:
if (Model)
{
Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, true);
Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, false);
}
break;
case 2:
if (Model)
{
Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, true);
}
break;
case 3:
if (Model)
{
Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, true);
}
break;
case 4:
if (Model)
{
Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, false);
}
break;
}
}
}; };
@ -586,7 +671,6 @@ int main(int argc, char* argv[])
} }
// create device and exit if creation failed // create device and exit if creation failed
MyEventReceiver receiver; MyEventReceiver receiver;
Device = createDevice(driverType, core::dimension2d<u32>(800, 600), Device = createDevice(driverType, core::dimension2d<u32>(800, 600),
16, false, false, false, &receiver); 16, false, false, false, &receiver);
@ -605,9 +689,9 @@ int main(int argc, char* argv[])
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true); driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
smgr->addLightSceneNode();
smgr->addLightSceneNode(0, core::vector3df(200,200,200), smgr->addLightSceneNode(0, core::vector3df(200,200,200),
video::SColorf(1.0f,1.0f,1.0f),2000); video::SColorf(1.0f,1.0f,1.0f),2000);
smgr->setAmbientLight(video::SColorf(0.3f,0.3f,0.3f));
// add our media directory as "search path" // add our media directory as "search path"
Device->getFileSystem()->addFolderFileArchive("../../media/"); Device->getFileSystem()->addFolderFileArchive("../../media/");
@ -733,20 +817,20 @@ int main(int argc, char* argv[])
gui::IGUIToolBar* bar = env->addToolBar(); gui::IGUIToolBar* bar = env->addToolBar();
video::ITexture* image = driver->getTexture("open.png"); video::ITexture* image = driver->getTexture("open.png");
bar->addButton(1102, 0, L"Open a model",image, 0, false, true); bar->addButton(GUI_ID_BUTTON_OPEN_MODEL, 0, L"Open a model",image, 0, false, true);
image = driver->getTexture("tools.png"); image = driver->getTexture("tools.png");
bar->addButton(1104, 0, L"Open Toolset",image, 0, false, true); bar->addButton(GUI_ID_BUTTON_SHOW_TOOLBOX, 0, L"Open Toolset",image, 0, false, true);
image = driver->getTexture("zip.png"); image = driver->getTexture("zip.png");
bar->addButton(1105, 0, L"Set Model Archive",image, 0, false, true); bar->addButton(GUI_ID_BUTTON_SELECT_ARCHIVE, 0, L"Set Model Archive",image, 0, false, true);
image = driver->getTexture("help.png"); image = driver->getTexture("help.png");
bar->addButton(1103, 0, L"Open Help", image, 0, false, true); bar->addButton(GUI_ID_BUTTON_SHOW_ABOUT, 0, L"Open Help", image, 0, false, true);
// create a combobox with some senseless texts // create a combobox with some senseless texts
gui::IGUIComboBox* box = env->addComboBox(core::rect<s32>(250,4,350,23), bar, 108); gui::IGUIComboBox* box = env->addComboBox(core::rect<s32>(250,4,350,23), bar, GUI_ID_TEXTUREFILTER);
box->addItem(L"No filtering"); box->addItem(L"No filtering");
box->addItem(L"Bilinear"); box->addItem(L"Bilinear");
box->addItem(L"Trilinear"); box->addItem(L"Trilinear");

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="14.Win32Window_vc9" Name="14.Win32Window_vc9"
ProjectGUID="{772FBE05-D05A-467B-9842-BEC409EEA8D0}" ProjectGUID="{772FBE05-D05A-467B-9842-BEC409EEA8D0}"
RootNamespace="Win32Window_vc9" RootNamespace="Win32Window_vc9"
@ -72,7 +72,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib" AdditionalDependencies="kernel32.lib user32.lib gdi32.lib opengl32.lib"
OutputFile="..\..\bin\Win32-VisualStudio\14.Win32Window.exe" OutputFile="..\..\bin\Win32-VisualStudio\14.Win32Window.exe"
LinkIncremental="0" LinkIncremental="0"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -164,6 +164,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib"
OutputFile="..\..\bin\Win32-VisualStudio\14.Win32Window.exe" OutputFile="..\..\bin\Win32-VisualStudio\14.Win32Window.exe"
LinkIncremental="0" LinkIncremental="0"
SuppressStartupBanner="true" SuppressStartupBanner="true"

View File

@ -14,6 +14,7 @@ windows book for details.
#error Windows only example #error Windows only example
#else #else
#include <windows.h> // this example only runs with windows #include <windows.h> // this example only runs with windows
#include <iostream>
using namespace irr; using namespace irr;
@ -50,9 +51,45 @@ static LRESULT CALLBACK CustomWndProc(HWND hWnd, UINT message,
} }
/*
Now ask for the driver and create the Windows specific window.
*/
int main() int main()
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hpre, LPSTR cmd, int cc) //int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hpre, LPSTR cmd, int cc)
{ {
// ask user for driver
video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D8;
printf("Please select the driver you want for this example:\n"\
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
" (f) NullDevice\n (otherKey) exit\n\n");
char key;
std::cin >> key;
switch(key)
{
case 'a': driverType = video::EDT_DIRECT3D9;break;
case 'b': driverType = video::EDT_DIRECT3D8;break;
case 'c': driverType = video::EDT_OPENGL; break;
case 'd': driverType = video::EDT_SOFTWARE; break;
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 1;
}
printf("Select the render window (some dead window may exist too):\n"\
" (a) Window with button (via CreationParam)\n"\
" (b) Window with button (via beginScene)\n"\
" (c) Own Irrlicht window (default behavior)\n"\
" (otherKey) exit\n\n");
std::cin >> key;
if (key != 'a' && key != 'b' && key != 'c')
return 1;
HINSTANCE hInstance = 0; HINSTANCE hInstance = 0;
// create dialog // create dialog
@ -105,6 +142,7 @@ int main()
HWND hIrrlichtWindow = CreateWindow("BUTTON", "", HWND hIrrlichtWindow = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
50, 80, 320, 220, hWnd, NULL, hInstance, NULL); 50, 80, 320, 220, hWnd, NULL, hInstance, NULL);
video::SExposedVideoData videodata((key=='b')?hIrrlichtWindow:0);
/* /*
So now that we have some window, we can create an Irrlicht device So now that we have some window, we can create an Irrlicht device
@ -115,8 +153,9 @@ int main()
// create irrlicht device in the button window // create irrlicht device in the button window
irr::SIrrlichtCreationParameters param; irr::SIrrlichtCreationParameters param;
param.WindowId = reinterpret_cast<void*>(hIrrlichtWindow); // hColorButton param.DriverType = driverType;
param.DriverType = video::EDT_OPENGL; if (key=='a')
param.WindowId = reinterpret_cast<void*>(hIrrlichtWindow);
irr::IrrlichtDevice* device = irr::createDeviceEx(param); irr::IrrlichtDevice* device = irr::createDeviceEx(param);
@ -125,6 +164,21 @@ int main()
irr::scene::ISceneManager* smgr = device->getSceneManager(); irr::scene::ISceneManager* smgr = device->getSceneManager();
video::IVideoDriver* driver = device->getVideoDriver(); video::IVideoDriver* driver = device->getVideoDriver();
if (driverType==video::EDT_OPENGL)
{
HDC HDc=GetDC(hIrrlichtWindow);
PIXELFORMATDESCRIPTOR pfd={0};
pfd.nSize=sizeof(PIXELFORMATDESCRIPTOR);
int pf = GetPixelFormat(HDc);
DescribePixelFormat(HDc, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;
pfd.cDepthBits=16;
pf = ChoosePixelFormat(HDc, &pfd);
SetPixelFormat(HDc, pf, &pfd);
videodata.OpenGLWin32.HDc = HDc;
videodata.OpenGLWin32.HRc=wglCreateContext(HDc);
wglShareLists((HGLRC)driver->getExposedVideoData().OpenGLWin32.HRc, (HGLRC)videodata.OpenGLWin32.HRc);
}
scene::ICameraSceneNode* cam = smgr->addCameraSceneNode(); scene::ICameraSceneNode* cam = smgr->addCameraSceneNode();
cam->setTarget(core::vector3df(0,0,0)); cam->setTarget(core::vector3df(0,0,0));
@ -169,7 +223,7 @@ int main()
while (device->run()) while (device->run())
{ {
driver->beginScene(true, true, 0); driver->beginScene(true, true, 0, videodata);
smgr->drawAll(); smgr->drawAll();
driver->endScene(); driver->endScene();
} }
@ -195,7 +249,7 @@ int main()
device->getTimer()->tick(); device->getTimer()->tick();
// draw engine picture // draw engine picture
driver->beginScene(true, true, 0); driver->beginScene(true, true, 0, (key=='c')?hIrrlichtWindow:0);
smgr->drawAll(); smgr->drawAll();
driver->endScene(); driver->endScene();
}*/ }*/

View File

@ -115,8 +115,8 @@ int main(int argc, char** argv)
selector = smgr->createTerrainTriangleSelector((scene::ITerrainSceneNode*)node); selector = smgr->createTerrainTriangleSelector((scene::ITerrainSceneNode*)node);
break; break;
case scene::ESNT_OCT_TREE: case scene::ESNT_OCTREE:
selector = smgr->createOctTreeTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node); selector = smgr->createOctreeTriangleSelector(((scene::IMeshSceneNode*)node)->getMesh(), node);
break; break;
default: default:

View File

@ -97,7 +97,10 @@ public:
else else
if (event.KeyInput.Key == KEY_F8) if (event.KeyInput.Key == KEY_F8)
{ {
Node->setDebugDataVisible(scene::EDS_BBOX_ALL); if (Node->isDebugDataVisible())
Node->setDebugDataVisible(scene::EDS_OFF);
else
Node->setDebugDataVisible(scene::EDS_BBOX_ALL);
} }
} }
return false; return false;
@ -146,10 +149,10 @@ int IRRCALLCONV main(int argc, char* argv[])
case 'e': driverType = video::EDT_BURNINGSVIDEO;break; case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break; case 'f': driverType = video::EDT_NULL; break;
default: return 1; default: return 1;
} }
// create device and exit if creation failed // create device and exit if creation failed
const core::dimension2du videoDim ( 800,600 ); const core::dimension2du videoDim(800,600);
IrrlichtDevice *device = createDevice(driverType, videoDim, 32, false ); IrrlichtDevice *device = createDevice(driverType, videoDim, 32, false );
@ -182,15 +185,13 @@ int IRRCALLCONV main(int argc, char* argv[])
directly be stored on disk. directly be stored on disk.
*/ */
if (argc>2) if (argc>2)
device->getFileSystem()->QUAKE3_STORAGE_FORMAT (argv[1]); device->getFileSystem()->QUAKE3_STORAGE_FORMAT(argv[1]);
else else
device->getFileSystem()->QUAKE3_STORAGE_FORMAT ( QUAKE3_STORAGE_1 ); device->getFileSystem()->QUAKE3_STORAGE_FORMAT(QUAKE3_STORAGE_1);
#ifdef QUAKE3_STORAGE_2 #ifdef QUAKE3_STORAGE_2
device->getFileSystem()->QUAKE3_STORAGE_FORMAT ( QUAKE3_STORAGE_2 ); device->getFileSystem()->QUAKE3_STORAGE_FORMAT(QUAKE3_STORAGE_2);
#endif #endif
// Quake3 Shader controls Z-Writing // Quake3 Shader controls Z-Writing
smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true); smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
@ -200,17 +201,17 @@ int IRRCALLCONV main(int argc, char* argv[])
they are only a huge chunk of static geometry with some materials they are only a huge chunk of static geometry with some materials
attached. Hence the IAnimated mesh consists of only one frame, attached. Hence the IAnimated mesh consists of only one frame,
so we get the "first frame" of the "animation", which is our quake level so we get the "first frame" of the "animation", which is our quake level
and create an OctTree scene node with it, using addOctTreeSceneNode(). and create an Octree scene node with it, using addOctreeSceneNode().
The OctTree optimizes the scene a little bit, trying to draw only geometry The Octree optimizes the scene a little bit, trying to draw only geometry
which is currently visible. An alternative to the OctTree would be a which is currently visible. An alternative to the Octree would be a
AnimatedMeshSceneNode, which would draw always the complete geometry of AnimatedMeshSceneNode, which would draw always the complete geometry of
the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode
instead of addOctTreeSceneNode and compare the primitives drawed by the instead of addOctreeSceneNode and compare the primitives drawed by the
video driver. (There is a getPrimitiveCountDrawed() method in the video driver. (There is a getPrimitiveCountDrawed() method in the
IVideoDriver class). Note that this optimization with the Octree is only IVideoDriver class). Note that this optimization with the Octree is only
useful when drawing huge meshes consisting of lots of geometry. useful when drawing huge meshes consisting of lots of geometry.
*/ */
scene::IQ3LevelMesh* mesh = scene::IQ3LevelMesh* const mesh =
(scene::IQ3LevelMesh*) smgr->getMesh(mapname); (scene::IQ3LevelMesh*) smgr->getMesh(mapname);
/* /*
@ -218,16 +219,15 @@ int IRRCALLCONV main(int argc, char* argv[])
The Geometry mesh is optimised for faster drawing The Geometry mesh is optimised for faster drawing
*/ */
scene::ISceneNode* node = 0; scene::ISceneNode* node = 0;
if ( mesh ) if (mesh)
{ {
scene::IMesh *geometry = mesh->getMesh(quake3::E_Q3_MESH_GEOMETRY); scene::IMesh * const geometry = mesh->getMesh(quake3::E_Q3_MESH_GEOMETRY);
// node = smgr->addMeshSceneNode ( geometry ); node = smgr->addOctreeSceneNode(geometry, 0, -1, 1024);
node = smgr->addOctTreeSceneNode(geometry, 0, -1, 1024);
} }
// create an event receiver for making screenshots // create an event receiver for making screenshots
CScreenShotFactory screenshotFactory ( device, mapname, node ); CScreenShotFactory screenshotFactory(device, mapname, node);
device->setEventReceiver ( &screenshotFactory ); device->setEventReceiver(&screenshotFactory);
/* /*
now construct SceneNodes for each Shader now construct SceneNodes for each Shader
@ -238,24 +238,24 @@ int IRRCALLCONV main(int argc, char* argv[])
if ( mesh ) if ( mesh )
{ {
// the additional mesh can be quite huge and is unoptimized // the additional mesh can be quite huge and is unoptimized
scene::IMesh * additional_mesh = mesh->getMesh ( quake3::E_Q3_MESH_ITEMS ); const scene::IMesh * const additional_mesh = mesh->getMesh(quake3::E_Q3_MESH_ITEMS);
#ifdef SHOW_SHADER_NAME #ifdef SHOW_SHADER_NAME
gui::IGUIFont *font = device->getGUIEnvironment()->getFont("../../media/fontlucida.png"); gui::IGUIFont *font = device->getGUIEnvironment()->getFont("../../media/fontlucida.png");
u32 count = 0; u32 count = 0;
#endif #endif
for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i ) for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount(); ++i )
{ {
IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i ); const IMeshBuffer* meshBuffer = additional_mesh->getMeshBuffer(i);
const video::SMaterial &material = meshBuffer->getMaterial(); const video::SMaterial& material = meshBuffer->getMaterial();
//! The ShaderIndex is stored in the material parameter // The ShaderIndex is stored in the material parameter
s32 shaderIndex = (s32) material.MaterialTypeParam2; const s32 shaderIndex = (s32) material.MaterialTypeParam2;
// the meshbuffer can be rendered without additional support, or it has no shader // the meshbuffer can be rendered without additional support, or it has no shader
const quake3::IShader *shader = mesh->getShader ( shaderIndex ); const quake3::IShader *shader = mesh->getShader(shaderIndex);
if ( 0 == shader ) if (0 == shader)
{ {
continue; continue;
} }
@ -266,25 +266,17 @@ int IRRCALLCONV main(int argc, char* argv[])
// would be full... // would be full...
// quake3::dumpShader ( Shader ); // quake3::dumpShader ( Shader );
#ifndef SHOW_SHADER_NAME node = smgr->addQuake3SceneNode(meshBuffer, shader);
smgr->addQuake3SceneNode ( meshBuffer, shader );
#else #ifdef SHOW_SHADER_NAME
count += 1; count += 1;
node = smgr->addQuake3SceneNode ( meshBuffer, shader );
core::stringw name( node->getName() ); core::stringw name( node->getName() );
node = smgr->addBillboardTextSceneNode( node = smgr->addBillboardTextSceneNode(
font, font, name.c_str(), node,
name.c_str(),
node,
core::dimension2d<f32>(80.0f, 8.0f), core::dimension2d<f32>(80.0f, 8.0f),
core::vector3df(0, 10, 0) core::vector3df(0, 10, 0));
);
#endif #endif
} }
} }
/* /*
@ -305,38 +297,36 @@ int IRRCALLCONV main(int argc, char* argv[])
we can ask the Quake3 Loader for all entities with class_name we can ask the Quake3 Loader for all entities with class_name
"info_player_deathmatch" "info_player_deathmatch"
we choose a random launch we choose a random launch
*/ */
if ( mesh ) if ( mesh )
{ {
quake3::tQ3EntityList &entityList = mesh->getEntityList (); quake3::tQ3EntityList &entityList = mesh->getEntityList();
quake3::IEntity search; quake3::IEntity search;
search.name = "info_player_deathmatch"; search.name = "info_player_deathmatch";
s32 index = entityList.binary_search ( search ); s32 index = entityList.binary_search(search);
if ( index >= 0 ) if (index >= 0)
{ {
const quake3::SVarGroup *group;
s32 notEndList; s32 notEndList;
do do
{ {
group = entityList[ index ].getGroup(1); const quake3::SVarGroup *group = entityList[index].getGroup(1);
u32 parsepos = 0; u32 parsepos = 0;
core::vector3df pos = const core::vector3df pos =
quake3::getAsVector3df ( group->get ( "origin" ), parsepos ); quake3::getAsVector3df(group->get("origin"), parsepos);
parsepos = 0; parsepos = 0;
f32 angle = quake3::getAsFloat ( group->get ( "angle"), parsepos ); const f32 angle = quake3::getAsFloat(group->get("angle"), parsepos);
core::vector3df target ( 0.f, 0.f, 1.f ); core::vector3df target(0.f, 0.f, 1.f);
target.rotateXZBy ( angle, core::vector3df () ); target.rotateXZBy(angle);
camera->setPosition ( pos ); camera->setPosition(pos);
camera->setTarget ( pos + target ); camera->setTarget(pos + target);
index += 1; ++index;
/* /*
notEndList = ( index < (s32) entityList.size () && notEndList = ( index < (s32) entityList.size () &&
entityList[index].name == search.name && entityList[index].name == search.name &&
@ -346,7 +336,6 @@ int IRRCALLCONV main(int argc, char* argv[])
notEndList = index == 2; notEndList = index == 2;
} while ( notEndList ); } while ( notEndList );
} }
} }
/* /*
@ -360,19 +349,19 @@ int IRRCALLCONV main(int argc, char* argv[])
core::position2d<s32>(10, 10)); core::position2d<s32>(10, 10));
// show the driver logo // show the driver logo
core::position2di pos ( videoDim.Width - 128, videoDim.Height - 64 ); const core::position2di pos(videoDim.Width - 128, videoDim.Height - 64);
switch ( driverType ) switch ( driverType )
{ {
case video::EDT_BURNINGSVIDEO: case video::EDT_BURNINGSVIDEO:
gui->addImage(driver->getTexture("burninglogo.png"),pos); gui->addImage(driver->getTexture("burninglogo.png"), pos);
break; break;
case video::EDT_OPENGL: case video::EDT_OPENGL:
gui->addImage(driver->getTexture("opengllogo.png"),pos); gui->addImage(driver->getTexture("opengllogo.png"), pos);
break; break;
case video::EDT_DIRECT3D8: case video::EDT_DIRECT3D8:
case video::EDT_DIRECT3D9: case video::EDT_DIRECT3D9:
gui->addImage(driver->getTexture("directxlogo.png"),pos); gui->addImage(driver->getTexture("directxlogo.png"), pos);
break; break;
} }
@ -391,32 +380,26 @@ int IRRCALLCONV main(int argc, char* argv[])
driver->beginScene(true, true, video::SColor(255,20,20,40)); driver->beginScene(true, true, video::SColor(255,20,20,40));
smgr->drawAll(); smgr->drawAll();
gui->drawAll(); gui->drawAll();
driver->endScene(); driver->endScene();
int fps = driver->getFPS(); int fps = driver->getFPS();
//if (lastFPS != fps) //if (lastFPS != fps)
{ {
io::IAttributes * attr = smgr->getParameters(); io::IAttributes * const attr = smgr->getParameters();
s32 calls = attr->getAttributeAsInt ( "calls" );
s32 culled = attr->getAttributeAsInt ( "culled" );
core::stringw str = L"Q3 ["; core::stringw str = L"Q3 [";
str += driver->getName(); str += driver->getName();
str += "] FPS:"; str += "] FPS:";
str += fps; str += fps;
str += " Cull:"; str += " Cull:";
str += calls; str += attr->getAttributeAsInt("calls");
str += "/"; str += "/";
str += culled; str += attr->getAttributeAsInt("culled");
str += " Draw: "; str += " Draw: ";
str += attr->getAttributeAsInt ( "drawn_solid" ); str += attr->getAttributeAsInt("drawn_solid");
str += "/"; str += "/";
str += attr->getAttributeAsInt ( "drawn_transparent" ); str += attr->getAttributeAsInt("drawn_transparent");
str += "/"; str += "/";
str += attr->getAttributeAsInt ( "drawn_transparent_effect" ); str += attr->getAttributeAsInt("drawn_transparent_effect");
device->setWindowCaption(str.c_str()); device->setWindowCaption(str.c_str());
lastFPS = fps; lastFPS = fps;
@ -427,7 +410,7 @@ int IRRCALLCONV main(int argc, char* argv[])
In the end, delete the Irrlicht device. In the end, delete the Irrlicht device.
*/ */
device->drop(); device->drop();
return 0; return 0;
} }

View File

@ -0,0 +1,182 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="17.HelloWorld for Windows Mobile on PC"
ProjectGUID="{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}"
RootNamespace="My17HelloWorldforWindowsMobileonPC"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\17.HelloWorld_Mobile on PC.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\17.HelloWorld_Mobile on PC.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\main.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -134,9 +134,9 @@ IrrlichtDevice *startup()
wchar_t buf[255]; wchar_t buf[255];
GetModuleFileNameW ( 0, buf, 255 ); GetModuleFileNameW ( 0, buf, 255 );
string<c16> base = buf; io::path base = buf;
base = base.subString ( 0, base.findLast ( '\\' ) + 1 ); base = base.subString ( 0, base.findLast ( '\\' ) + 1 );
device->getFileSystem()->registerFileArchive ( base ); device->getFileSystem()->addFileArchive ( base );
} }
#endif #endif

View File

@ -128,7 +128,7 @@
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
DebugInformationFormat="0" DebugInformationFormat="0"
CallingConvention="1" CallingConvention="0"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"

View File

@ -73,7 +73,7 @@ VideoDriver, load an animated mesh from .md2 and a map from
.pk3. Because that's old stuff, I won't explain every step. .pk3. Because that's old stuff, I won't explain every step.
Just take care of the maps position. Just take care of the maps position.
*/ */
int main() int main(int argc, char** argv)
{ {
video::E_DRIVER_TYPE driverType; video::E_DRIVER_TYPE driverType;
@ -129,7 +129,7 @@ int main()
IAnimatedMesh *map = smgr->getMesh("20kdm2.bsp"); IAnimatedMesh *map = smgr->getMesh("20kdm2.bsp");
if (map) if (map)
{ {
ISceneNode *map_node = smgr->addOctTreeSceneNode(map->getMesh(0)); ISceneNode *map_node = smgr->addOctreeSceneNode(map->getMesh(0));
//Set position //Set position
map_node->setPosition(vector3df(-850,-220,-850)); map_node->setPosition(vector3df(-850,-220,-850));
} }

View File

@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 8.00 Microsoft Visual Studio Solution File, Format Version 8.00
Project("{830FD174-FABE-4667-B9FC-F7F8B8378EE7}") = "19.Quake3MapExplorer", "Quake3MapShader.vcproj", "{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}" Project("{830FD174-FABE-4667-B9FC-F7F8B8378EE7}") = "21.Quake3MapExplorer", "Quake3MapShader.vcproj", "{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject

View File

@ -32,7 +32,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe" OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
@ -89,7 +89,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe" OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"

View File

@ -89,7 +89,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe" OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"

View File

@ -4,7 +4,7 @@
Version="9,00" Version="9,00"
Name="21.Quake3Explorer_vc9" Name="21.Quake3Explorer_vc9"
ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}" ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
RootNamespace="19.Quake3Explorer_vc9" RootNamespace="21.Quake3Explorer_vc9"
Keyword="Win32Proj" Keyword="Win32Proj"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
> >

View File

@ -85,7 +85,7 @@ void GameData::setDefault ()
deviceParam.WindowSize.Width = 800; deviceParam.WindowSize.Width = 800;
deviceParam.WindowSize.Height = 600; deviceParam.WindowSize.Height = 600;
deviceParam.Fullscreen = false; deviceParam.Fullscreen = false;
deviceParam.Bits = 32; deviceParam.Bits = 24;
deviceParam.ZBufferBits = 16; deviceParam.ZBufferBits = 16;
deviceParam.Vsync = false; deviceParam.Vsync = false;
deviceParam.AntiAlias = false; deviceParam.AntiAlias = false;
@ -1040,12 +1040,14 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
IFileSystem *fs = Game->Device->getFileSystem(); IFileSystem *fs = Game->Device->getFileSystem();
ISceneManager *smgr = Game->Device->getSceneManager (); ISceneManager *smgr = Game->Device->getSceneManager ();
IReadFile* file = fs->createMemoryReadFile ( &Game->loadParam, sizeof ( Game->loadParam ), IReadFile* file = fs->createMemoryReadFile(&Game->loadParam,
L"levelparameter.cfg", false); sizeof(Game->loadParam), L"levelparameter.cfg", false);
// load cfg file
smgr->getMesh( file ); smgr->getMesh( file );
file->drop (); file->drop ();
// load the actual map
Mesh = (IQ3LevelMesh*) smgr->getMesh(mapName); Mesh = (IQ3LevelMesh*) smgr->getMesh(mapName);
if ( 0 == Mesh ) if ( 0 == Mesh )
return; return;
@ -1072,12 +1074,11 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
//s32 minimalNodes = b0 ? core::s32_max ( 2048, b0->getVertexCount() / 32 ) : 2048; //s32 minimalNodes = b0 ? core::s32_max ( 2048, b0->getVertexCount() / 32 ) : 2048;
s32 minimalNodes = 2048; s32 minimalNodes = 2048;
MapParent = smgr->addMeshSceneNode( geometry ); MapParent = smgr->addOctreeSceneNode(geometry, 0, -1, minimalNodes);
//MapParent = smgr->addOctTreeSceneNode(geometry, 0, -1, minimalNodes);
MapParent->setName ( mapName ); MapParent->setName ( mapName );
if ( Meta ) if ( Meta )
{ {
selector = smgr->createOctTreeTriangleSelector( geometry,MapParent, minimalNodes); selector = smgr->createOctreeTriangleSelector( geometry,MapParent, minimalNodes);
//selector = smgr->createTriangleSelector ( geometry, MapParent ); //selector = smgr->createTriangleSelector ( geometry, MapParent );
Meta->addTriangleSelector( selector); Meta->addTriangleSelector( selector);
selector->drop (); selector->drop ();
@ -1105,7 +1106,6 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
if ( BulletParent ) if ( BulletParent )
BulletParent->setName ( "Bullet Container" ); BulletParent->setName ( "Bullet Container" );
/* /*
now construct SceneNodes for each Shader now construct SceneNodes for each Shader
The Objects are stored in the quake mesh E_Q3_MESH_ITEMS The Objects are stored in the quake mesh E_Q3_MESH_ITEMS
@ -1116,12 +1116,10 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_FOG,FogParent, 0, false ); Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_FOG,FogParent, 0, false );
Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_UNRESOLVED,UnresolvedParent, Meta, true ); Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_UNRESOLVED,UnresolvedParent, Meta, true );
/* /*
Now construct Models from Entity List Now construct Models from Entity List
*/ */
Q3ModelFactory ( Game->loadParam, Game->Device, Mesh, ItemParent, false ); Q3ModelFactory ( Game->loadParam, Game->Device, Mesh, ItemParent, false );
} }
/* /*
@ -1142,7 +1140,7 @@ void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNod
case ESNT_CAMERA: imageIndex = 1; break; case ESNT_CAMERA: imageIndex = 1; break;
case ESNT_EMPTY: imageIndex = 2; break; case ESNT_EMPTY: imageIndex = 2; break;
case ESNT_MESH: imageIndex = 3; break; case ESNT_MESH: imageIndex = 3; break;
case ESNT_OCT_TREE: imageIndex = 3; break; case ESNT_OCTREE: imageIndex = 3; break;
case ESNT_ANIMATED_MESH: imageIndex = 4; break; case ESNT_ANIMATED_MESH: imageIndex = 4; break;
case ESNT_SKY_BOX: imageIndex = 5; break; case ESNT_SKY_BOX: imageIndex = 5; break;
case ESNT_BILLBOARD: imageIndex = 6; break; case ESNT_BILLBOARD: imageIndex = 6; break;
@ -1193,7 +1191,6 @@ void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNod
addSceneTreeItem ( *it, node ); addSceneTreeItem ( *it, node );
} }
} }
@ -1203,6 +1200,7 @@ void CQuake3EventHandler::CreatePlayers()
Player[0].create ( Game->Device, Mesh, MapParent, Meta ); Player[0].create ( Game->Device, Mesh, MapParent, Meta );
} }
// Adds a skydome to the scene // Adds a skydome to the scene
void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture) void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
{ {
@ -1237,28 +1235,16 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
{ {
snprintf ( buf, 64, "%s.jpg", texture ); snprintf ( buf, 64, "%s.jpg", texture );
SkyNode = smgr->addSkyDomeSceneNode( SkyNode = smgr->addSkyDomeSceneNode(
driver->getTexture( buf ), driver->getTexture( buf ), 32,32,
32,32, 1.f, 1.f, 1000.f, 0, 11);
1.f,
1.f,
1000.f,
0,
11
);
} }
else else
if ( 2 == dome ) if ( 2 == dome )
{ {
snprintf ( buf, 64, "%s.jpg", texture ); snprintf ( buf, 64, "%s.jpg", texture );
SkyNode = smgr->addSkyDomeSceneNode( SkyNode = smgr->addSkyDomeSceneNode(
driver->getTexture( buf ), driver->getTexture( buf ), 16,8,
16,8, 0.95f, 2.f, 1000.f, 0, 11);
0.95f,
2.f,
1000.f,
0,
11
);
} }
if (SkyNode) if (SkyNode)
@ -1266,7 +1252,6 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
//SkyNode->getMaterial(0).ZBuffer = video::EMDF_DEPTH_LESS_EQUAL; //SkyNode->getMaterial(0).ZBuffer = video::EMDF_DEPTH_LESS_EQUAL;
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState); driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
} }
@ -1311,7 +1296,6 @@ void CQuake3EventHandler::SetGUIActive( s32 command)
} }
/* /*
Handle game input Handle game input
*/ */

View File

@ -1,6 +1,6 @@
/*! /*!
Model Factory. Model Factory.
create the additional scenenodes for ( bullets, health... ) create the additional scenenodes for ( bullets, health... )
Defines the Entities for Quake3 Defines the Entities for Quake3
*/ */
@ -122,7 +122,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE SPECIAL_SFX_ROTATE
}, },
{ {
"item_armor_body", "item_armor_body",
{"models/powerups/armor/armor_red.md3", {"models/powerups/armor/armor_red.md3",
""}, ""},
"sound/misc/ar2_pkup.wav", "sound/misc/ar2_pkup.wav",
@ -134,7 +134,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE SPECIAL_SFX_ROTATE
}, },
{ {
"item_armor_combat", "item_armor_combat",
{"models/powerups/armor/armor_yel.md3", {"models/powerups/armor/armor_yel.md3",
""}, ""},
"sound/misc/ar2_pkup.wav", "sound/misc/ar2_pkup.wav",
@ -146,7 +146,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE SPECIAL_SFX_ROTATE
}, },
{ {
"item_armor_shard", "item_armor_shard",
{"models/powerups/armor/shard.md3", {"models/powerups/armor/shard.md3",
""}, ""},
"sound/misc/ar1_pkup.wav", "sound/misc/ar1_pkup.wav",
@ -158,7 +158,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE SPECIAL_SFX_ROTATE
}, },
{ {
"weapon_gauntlet", "weapon_gauntlet",
{"models/weapons2/gauntlet/gauntlet.md3", {"models/weapons2/gauntlet/gauntlet.md3",
""}, ""},
"sound/misc/w_pkup.wav", "sound/misc/w_pkup.wav",
@ -170,7 +170,7 @@ static const SItemElement Quake3ItemElement [] = {
SPECIAL_SFX_ROTATE SPECIAL_SFX_ROTATE
}, },
{ {
"weapon_shotgun", "weapon_shotgun",
{"models/weapons2/shotgun/shotgun.md3", {"models/weapons2/shotgun/shotgun.md3",
""}, ""},
"sound/misc/w_pkup.wav", "sound/misc/w_pkup.wav",
@ -290,7 +290,7 @@ const SItemElement * getItemElement ( const stringc& key )
{ {
const SItemElement *item = Quake3ItemElement; const SItemElement *item = Quake3ItemElement;
while ( item->key[0] ) while ( item->key )
{ {
if ( 0 == strcmp ( key.c_str(), item->key ) ) if ( 0 == strcmp ( key.c_str(), item->key ) )
return item; return item;
@ -304,8 +304,8 @@ const SItemElement * getItemElement ( const stringc& key )
Takes the mesh buffers and creates scenenodes for their associated shaders Takes the mesh buffers and creates scenenodes for their associated shaders
*/ */
void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam, void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
IrrlichtDevice *device, IrrlichtDevice *device,
IQ3LevelMesh* mesh, IQ3LevelMesh* mesh,
eQ3MeshIndex meshIndex, eQ3MeshIndex meshIndex,
ISceneNode *parent, ISceneNode *parent,
IMetaTriangleSelector *meta, IMetaTriangleSelector *meta,
@ -463,7 +463,7 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
m = node->getMesh(); m = node->getMesh();
} }
//selector = smgr->createOctTreeTriangleSelector ( m, 0, 128 ); //selector = smgr->createOctreeTriangleSelector ( m, 0, 128 );
selector = smgr->createTriangleSelector ( m, 0 ); selector = smgr->createTriangleSelector ( m, 0 );
meta->addTriangleSelector ( selector ); meta->addTriangleSelector ( selector );
selector->drop (); selector->drop ();
@ -479,7 +479,7 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
#if 0 #if 0
if ( meta ) if ( meta )
{ {
selector = smgr->createOctTreeTriangleSelector ( additional_mesh, 0 ); selector = smgr->createOctreeTriangleSelector ( additional_mesh, 0 );
meta->addTriangleSelector ( selector ); meta->addTriangleSelector ( selector );
selector->drop (); selector->drop ();
} }
@ -488,8 +488,8 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
if ( loadParam.verbose > 0 ) if ( loadParam.verbose > 0 )
{ {
loadParam.endTime = device->getTimer()->getRealTime (); loadParam.endTime = device->getTimer()->getRealTime ();
snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes", snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes",
loadParam.endTime - loadParam.startTime, loadParam.endTime - loadParam.startTime,
sceneNodeID sceneNodeID
); );
device->getLogger()->log(buf, ELL_INFORMATION); device->getLogger()->log(buf, ELL_INFORMATION);
@ -502,8 +502,8 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
create Items from Entity create Items from Entity
*/ */
void Q3ModelFactory ( Q3LevelLoadParameter &loadParam, void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
IrrlichtDevice *device, IrrlichtDevice *device,
IQ3LevelMesh* masterMesh, IQ3LevelMesh* masterMesh,
ISceneNode *parent, ISceneNode *parent,
bool showShaderName bool showShaderName
) )
@ -620,7 +620,7 @@ void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
if ( itemElement->special & SPECIAL_SFX_BOUNCE ) if ( itemElement->special & SPECIAL_SFX_BOUNCE )
{ {
//anim = smgr->createFlyStraightAnimator ( //anim = smgr->createFlyStraightAnimator (
// p, p + vector3df ( 0.f, 60.f, 0.f ), 1000, true, true ); // p, p + vector3df ( 0.f, 60.f, 0.f ), 1000, true, true );
anim = smgr->createFlyCircleAnimator ( anim = smgr->createFlyCircleAnimator (
p + vector3df( 0.f, 20.f, 0.f ), p + vector3df( 0.f, 20.f, 0.f ),
@ -745,7 +745,7 @@ vector3df getGravity ( const c8 * surface )
if ( 0 == strcmp ( surface, "moon" ) ) return vector3df ( 0.f, -6.f / 100.f, 0.f ); if ( 0 == strcmp ( surface, "moon" ) ) return vector3df ( 0.f, -6.f / 100.f, 0.f );
if ( 0 == strcmp ( surface, "water" ) ) return vector3df ( 0.1f / 100.f, -2.f / 100.f, 0.f ); if ( 0 == strcmp ( surface, "water" ) ) return vector3df ( 0.1f / 100.f, -2.f / 100.f, 0.f );
if ( 0 == strcmp ( surface, "ice" ) ) return vector3df ( 0.2f / 100.f, -9.f / 100.f, 0.3f / 100.f ); if ( 0 == strcmp ( surface, "ice" ) ) return vector3df ( 0.2f / 100.f, -9.f / 100.f, 0.3f / 100.f );
return vector3df ( 0.f, 0.f, 0.f ); return vector3df ( 0.f, 0.f, 0.f );
} }

View File

@ -0,0 +1,38 @@
# Makefile for Irrlicht Examples
# It's usually sufficient to change just the target name and source file list
# and be sure that CXX is set to a valid compiler
Target = 22.MaterialViewer
Sources = main.cpp
# general compiler settings
CPPFLAGS = -I../../include -I/usr/X11R6/include
#CXXFLAGS = -O3 -ffast-math
CXXFLAGS = -g -Wall
#default target is Linux
all: all_linux
ifeq ($(HOSTTYPE), x86_64)
LIBSELECT=64
endif
# target specific settings
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
all_linux clean_linux: SYSTEM=Linux
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
all_win32 clean_win32: SYSTEM=Win32-gcc
all_win32 clean_win32: SUF=.exe
# name of the binary - only valid for targets which set SYSTEM
DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
all_linux all_win32:
$(warning Building...)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
clean: clean_linux clean_win32
$(warning Cleaning...)
clean_linux clean_win32:
@$(RM) $(DESTPATH)
.PHONY: all all_win32 clean clean_linux clean_win32

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 22 Material Viewer" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="Windows">
<Option platforms="Windows;" />
<Option output="../../bin/Win32-gcc/MaterialViewer" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
<Compiler>
<Add option="-W" />
<Add option="-g" />
<Add option="-D_IRR_STATIC_LIB_" />
</Compiler>
<Linker>
<Add directory="../../lib/Win32-gcc" />
</Linker>
</Target>
<Target title="Linux">
<Option platforms="Unix;" />
<Option output="../../bin/Linux/MaterialViewer" prefix_auto="0" extension_auto="0" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-W" />
<Add option="-g" />
</Compiler>
<Linker>
<Add library="Xxf86vm" />
<Add library="GL" />
<Add directory="../../lib/Linux" />
</Linker>
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="Windows;" />
</VirtualTargets>
<Compiler>
<Add option="-W" />
<Add option="-g" />
<Add directory="../../include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@ -0,0 +1,59 @@
[Project]
FileName=example.dev
Name=Irrlicht Example 22 Material Viewer
UnitCount=1
Type=1
Ver=1
ObjFiles=
Includes=..\..\include
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
IsCpp=1
Icon=
ExeOutput=../../bin/Win32-gcc
ObjectOutput=obj
OverrideOutput=1
OverrideOutputName=22.MaterialViewer.exe
HostApplication=
Folders=
CommandLine=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=Projekt1
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0

View File

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MaterialViewer", "MaterialViewer.vcproj", "{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}.Debug.ActiveCfg = Debug|Win32
{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}.Debug.Build.0 = Debug|Win32
{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}.Release.ActiveCfg = Release|Win32
{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="22.MaterialViewer"
ProjectGUID="{AFC223BD-4371-4A8B-A90B-0D338BD2DEBB}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/MaterialViewer.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\22.MaterialViewer.exe"
LinkIncremental="0"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
ProgramDatabaseFile=".\Release/MaterialViewer.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/MaterialViewer.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="3079"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/MaterialViewer.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\22.MaterialViewer.exe"
LinkIncremental="0"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/MaterialViewer.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/MaterialViewer.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="3079"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="main.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,231 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="22.MaterialViewer_vc8"
ProjectGUID="{0914E5C8-5352-467B-8421-C9EB35BD5596}"
RootNamespace="MaterialViewer_vc8"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/MaterialViewer.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/MaterialViewer.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="3079"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\22.MaterialViewer.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
ProgramDatabaseFile=".\Release/MaterialViewer.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/MaterialViewer.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/MaterialViewer.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="3079"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\22.MaterialViewer.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/MaterialViewer.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="main.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="22.MaterialViewer_vc9"
ProjectGUID="{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}"
RootNamespace="MaterialViewer_vc9"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/MaterialViewer.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/MaterialViewer.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="3079"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\22.MaterialViewer.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
ProgramDatabaseFile=".\Release/MaterialViewer.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/MaterialViewer.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/MaterialViewer.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="3079"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\22.MaterialViewer.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/MaterialViewer.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="main.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
# Makefile for Irrlicht Examples
# It's usually sufficient to change just the target name and source file list
# and be sure that CXX is set to a valid compiler
Target = 23.SMeshHandling
Sources = main.cpp
# general compiler settings
CPPFLAGS = -I../../include -I/usr/X11R6/include
CXXFLAGS = -O3 -ffast-math
#CXXFLAGS = -g -Wall
#default target is Linux
all: all_linux
ifeq ($(HOSTTYPE), x86_64)
LIBSELECT=64
endif
# target specific settings
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11
all_linux clean_linux: SYSTEM=Linux
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
all_win32 clean_win32: SYSTEM=Win32-gcc
all_win32 clean_win32: SUF=.exe
# name of the binary - only valid for targets which set SYSTEM
DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
all_linux all_win32:
$(warning Building...)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
clean: clean_linux clean_win32
$(warning Cleaning...)
clean_linux clean_win32:
@$(RM) $(DESTPATH)
.PHONY: all all_win32 clean clean_linux clean_win32

View File

@ -0,0 +1,59 @@
[Project]
FileName=example.dev
Name=Irrlicht Example 23 SMeshHandling
UnitCount=1
Type=1
Ver=1
ObjFiles=
Includes=..\..\include
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
IsCpp=1
Icon=
ExeOutput=../../bin/Win32-gcc
ObjectOutput=obj
OverrideOutput=1
OverrideOutputName=23.SMeshHandling.exe
HostApplication=
Folders=
CommandLine=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=Projekt1
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0

View File

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.SMeshHandling", "SMeshHandling.vcproj", "{EB3B38EA-5CE7-4983-845B-880661E69D09}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Debug.ActiveCfg = Debug|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Debug.Build.0 = Debug|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.ActiveCfg = Release|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -2,8 +2,8 @@
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="7.10" Version="7.10"
Name="TestProject" Name="23.SMeshHandling"
ProjectGUID="{853A396E-C031-4C26-A716-5B4E176BE11D}" ProjectGUID="{EB3B38EA-5CE7-4983-845B-880661E69D09}"
Keyword="Win32Proj"> Keyword="Win32Proj">
<Platforms> <Platforms>
<Platform <Platform
@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\include" AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="5" RuntimeLibrary="5"
@ -32,10 +32,11 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="../../bin/Win32-visualstudio/TestProject.exe" OutputFile="..\..\bin\Win32-VisualStudio\23.SMeshHandling.exe"
LinkIncremental="2" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/TestProject.pdb" ProgramDatabaseFile="$(OutDir)/SMeshHandling.pdb"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
@ -64,23 +65,35 @@
OutputDirectory="Release" OutputDirectory="Release"
IntermediateDirectory="Release" IntermediateDirectory="Release"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="2"> CharacterSet="2"
WholeProgramOptimization="TRUE">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/QIfist /Oa"
Optimization="3"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\..\include" AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="4" RuntimeLibrary="4"
BufferSecurityCheck="FALSE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/> DebugInformationFormat="0"
CallingConvention="1"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="../../bin/Win32-visualstudio/TestProject.exe" OutputFile="..\..\bin\Win32-VisualStudio\23.SMeshHandling.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="FALSE"
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"

View File

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="23.SMeshHandling_vc8"
ProjectGUID="{EB3B38EA-5CE7-4983-845B-880661E69D09}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\23.SMeshHandling.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/SMeshHandling.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
CallingConvention="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\23.SMeshHandling.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\main.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="23.SMeshHandling_vc9"
ProjectGUID="{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}"
RootNamespace="19.SMeshHandling_vc9"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\23.SMeshHandling.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/SMeshHandling.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
ExceptionHandling="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="0"
CallingConvention="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\19.SMeshHandling.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\main.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,441 @@
/** Example 023 SMeshBufferHandling
A tutorial by geoff.
In this tutorial we'll learn how to create custom meshes and deal with them
with Irrlicht. We'll create an interesting heightmap with some lighting effects.
With keys 1,2,3 you can choose a different mesh layout, which is put into the
mesh buffers as desired. All positions, normals, etc. are updated accordingly.
Ok, let's start with the headers (I think there's nothing to say about it)
*/
#include <irrlicht.h>
#include <iostream>
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
//Namespaces for the engine
using namespace irr;
using namespace video;
using namespace core;
using namespace scene;
using namespace io;
using namespace gui;
/* This is the type of the functions which work out the colour. */
typedef SColor colour_func(f32 x, f32 y, f32 z);
/* Here comes a set of functions which can be used for coloring the nodes while
creating the mesh. */
// Greyscale, based on the height.
SColor grey(f32, f32, f32 z)
{
u32 n = (u32)(255.f * z);
return SColor(255, n, n, n);
}
// Interpolation between blue and white, with red added in one
// direction and green in the other.
SColor yellow(f32 x, f32 y, f32)
{
return SColor(255, 128 + (u32)(127.f * x), 128 + (u32)(127.f * y), 255);
}
// Pure white.
SColor white(f32, f32, f32) { return SColor(255, 255, 255, 255); }
/* The type of the functions which generate the heightmap. x and y
range between -0.5 and 0.5, and s is the scale of the heightmap. */
typedef f32 generate_func(s16 x, s16 y, f32 s);
// An interesting sample function :-)
f32 eggbox(s16 x, s16 y, f32 s)
{
const f32 r = 4.f*sqrtf((f32)(x*x + y*y))/s;
const f32 z = expf(-r * 2) * (cosf(0.2f * x) + cosf(0.2f * y));
return 0.25f+0.25f*z;
}
// A rather dumb sine function :-/
f32 moresine(s16 x, s16 y, f32 s)
{
const f32 xx=0.3f*(f32)x/s;
const f32 yy=12*y/s;
const f32 z = sinf(xx*xx+yy)*sinf(xx+yy*yy);
return 0.25f + 0.25f * z;
}
// A simple function
f32 justexp(s16 x, s16 y, f32 s)
{
const f32 xx=6*x/s;
const f32 yy=6*y/s;
const f32 z = (xx*xx+yy*yy);
return 0.3f*z*cosf(xx*yy);
}
/* A simple class for representing heightmaps. Most of this should be obvious. */
class HeightMap
{
private:
const u16 Width;
const u16 Height;
f32 s;
core::array<f32> data;
public:
HeightMap(u16 _w, u16 _h) : Width(_w), Height(_h), s(0.f), data(0)
{
s = sqrtf((f32)(Width * Width + Height * Height));
data.set_used(Width * Height);
}
// Fill the heightmap with values generated from f.
void generate(generate_func f)
{
u32 i=0;
for(u16 y = 0; y < Height; ++y)
for(u16 x = 0; x < Width; ++x)
set(i++, calc(f, x, y));
}
u16 height() const { return Height; }
u16 width() const { return Width; }
f32 calc(generate_func f, u16 x, u16 y) const
{
const f32 xx = (f32)x - Width*0.5f;
const f32 yy = (f32)y - Height*0.5f;
return f((u16)xx, (u16)yy, s);
}
// The height at (x, y) is at position y * Width + x.
void set(u16 x, u16 y, f32 z) { data[y * Width + x] = z; }
void set(u32 i, f32 z) { data[i] = z; }
f32 get(u16 x, u16 y) const { return data[y * Width + x]; }
/* The only difficult part. This considers the normal at (x, y) to
be the cross product of the vectors between the adjacent points
in the horizontal and vertical directions.
s is a scaling factor, which is necessary if the height units are
different from the coordinate units; for example, if your map has
heights in metres and the coordinates are in units of a
kilometer. */
vector3df getnormal(u16 x, u16 y, f32 s) const
{
const f32 zc = get(x, y);
f32 zl, zr, zu, zd;
if (x == 0)
{
zr = get(x + 1, y);
zl = zc + zc - zr;
}
else if (x == Width - 1)
{
zl = get(x - 1, y);
zr = zc + zc - zl;
}
else
{
zr = get(x + 1, y);
zl = get(x - 1, y);
}
if (y == 0)
{
zd = get(x, y + 1);
zu = zc + zc - zd;
}
else if (y == Height - 1)
{
zu = get(x, y - 1);
zd = zc + zc - zu;
}
else
{
zd = get(x, y + 1);
zu = get(x, y - 1);
}
return vector3df(s * 2 * (zl - zr), 4, s * 2 * (zd - zu)).normalize();
}
};
/* A class which generates a mesh from a heightmap. */
class TMesh
{
private:
u16 Width;
u16 Height;
f32 Scale;
public:
SMesh* Mesh;
TMesh() : Mesh(0), Width(0), Height(0), Scale(1.f)
{
Mesh = new SMesh();
}
~TMesh()
{
Mesh->drop();
}
// Unless the heightmap is small, it won't all fit into a single
// SMeshBuffer. This function chops it into pieces and generates a
// buffer from each one.
void init(const HeightMap &hm, f32 scale, colour_func cf, IVideoDriver *driver)
{
Scale = scale;
const u32 mp = driver -> getMaximalPrimitiveCount();
Width = hm.width();
Height = hm.height();
const u32 sw = mp / (6 * Height); // the width of each piece
u32 i=0;
for(u32 y0 = 0; y0 < Height; y0 += sw)
{
u16 y1 = y0 + sw;
if (y1 >= Height)
y1 = Height - 1; // the last one might be narrower
addstrip(hm, cf, y0, y1, i);
++i;
}
if (i<Mesh->getMeshBufferCount())
{
// clear the rest
for (u32 j=i; j<Mesh->getMeshBufferCount(); ++j)
{
Mesh->getMeshBuffer(j)->drop();
}
Mesh->MeshBuffers.erase(i,Mesh->getMeshBufferCount()-i);
}
Mesh->recalculateBoundingBox();
}
// Generate a SMeshBuffer which represents all the vertices and
// indices for values of y between y0 and y1, and add it to the
// mesh.
void addstrip(const HeightMap &hm, colour_func cf, u16 y0, u16 y1, u32 bufNum)
{
SMeshBuffer *buf = 0;
if (bufNum<Mesh->getMeshBufferCount())
{
buf = (SMeshBuffer*)Mesh->getMeshBuffer(bufNum);
}
else
{
// create new buffer
buf = new SMeshBuffer();
Mesh->addMeshBuffer(buf);
// to simplify things we drop here but continue using buf
buf->drop();
}
buf->Vertices.set_used((1 + y1 - y0) * Width);
u32 i=0;
for (u16 y = y0; y <= y1; ++y)
{
for (u16 x = 0; x < Width; ++x)
{
const f32 z = hm.get(x, y);
const f32 xx = (f32)x/(f32)Width;
const f32 yy = (f32)y/(f32)Height;
S3DVertex& v = buf->Vertices[i++];
v.Pos.set(x, Scale * z, y);
v.Normal.set(hm.getnormal(x, y, Scale));
v.Color=cf(xx, yy, z);
v.TCoords.set(xx, yy);
}
}
buf->Indices.set_used(6 * (Width - 1) * (y1 - y0));
i=0;
for(u16 y = y0; y < y1; ++y)
{
for(u16 x = 0; x < Width - 1; ++x)
{
const u16 n = (y-y0) * Width + x;
buf->Indices[i]=n;
buf->Indices[++i]=n + Height;
buf->Indices[++i]=n + Height + 1;
buf->Indices[++i]=n + Height + 1;
buf->Indices[++i]=n + 1;
buf->Indices[++i]=n;
++i;
}
}
buf->recalculateBoundingBox();
}
};
/*
Our event receiver implementation, taken from tutorial 4.
*/
class MyEventReceiver : public IEventReceiver
{
public:
// This is the one method that we have to implement
virtual bool OnEvent(const SEvent& event)
{
// Remember whether each key is down or up
if (event.EventType == irr::EET_KEY_INPUT_EVENT)
KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
return false;
}
// This is used to check whether a key is being held down
virtual bool IsKeyDown(EKEY_CODE keyCode) const
{
return KeyIsDown[keyCode];
}
MyEventReceiver()
{
for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
KeyIsDown[i] = false;
}
private:
// We use this array to store the current state of each key
bool KeyIsDown[KEY_KEY_CODES_COUNT];
};
/*
Much of this is code taken from some of the examples. We merely set
up a mesh from a heightmap, light it with a moving light, and allow
the user to navigate around it.
*/
int main(int argc, char* argv[])
{
// ask user for driver
video::E_DRIVER_TYPE driverType;
printf("Please select the driver you want for this example:\n"\
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
" (f) NullDevice\n (otherKey) exit\n\n");
char i;
std::cin >> i;
switch(i)
{
case 'a': driverType = video::EDT_DIRECT3D9;break;
case 'b': driverType = video::EDT_DIRECT3D8;break;
case 'c': driverType = video::EDT_OPENGL; break;
case 'd': driverType = video::EDT_SOFTWARE; break;
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 1;
}
MyEventReceiver receiver;
IrrlichtDevice* device = createDevice(driverType,
core::dimension2du(800, 600), 32, false, false, false,
&receiver);
if(device == 0)
return 1;
IVideoDriver *driver = device->getVideoDriver();
ISceneManager *smgr = device->getSceneManager();
device->setWindowCaption(L"Irrlicht Example for SMesh usage.");
/*
Create the custom mesh and initialize with a heightmap
*/
TMesh mesh;
HeightMap hm = HeightMap(255, 255);
hm.generate(eggbox);
mesh.init(hm, 50.f, grey, driver);
// Add the mesh to the scene graph
IMeshSceneNode* meshnode = smgr -> addMeshSceneNode(mesh.Mesh);
meshnode->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);
// light is just for nice effects
ILightSceneNode *node = smgr->addLightSceneNode(0, vector3df(0,100,0),
SColorf(1.0f, 0.6f, 0.7f, 1.0f), 500.0f);
if (node)
{
node->getLightData().Attenuation.set(0.f, 1.f/500.f, 0.f);
ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator(vector3df(0,150,0),250.0f);
if (anim)
{
node->addAnimator(anim);
anim->drop();
}
}
ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
if (camera)
{
camera->setPosition(vector3df(-20.f, 150.f, -20.f));
camera->setTarget(vector3df(200.f, -80.f, 150.f));
camera->setFarValue(20000.0f);
}
/*
Just a usual render loop with event handling. The custom mesh is
a usual part of the scene graph which gets rendered by drawAll.
*/
while(device->run())
{
if(!device->isWindowActive())
{
device->sleep(100);
continue;
}
if(receiver.IsKeyDown(irr::KEY_KEY_W))
{
meshnode->setMaterialFlag(video::EMF_WIREFRAME, !meshnode->getMaterial(0).Wireframe);
}
else if(receiver.IsKeyDown(irr::KEY_KEY_1))
{
hm.generate(eggbox);
mesh.init(hm, 50.f, grey, driver);
}
else if(receiver.IsKeyDown(irr::KEY_KEY_2))
{
hm.generate(moresine);
mesh.init(hm, 50.f, yellow, driver);
}
else if(receiver.IsKeyDown(irr::KEY_KEY_3))
{
hm.generate(justexp);
mesh.init(hm, 50.f, yellow, driver);
}
driver->beginScene(true, true, SColor(0xff000000));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
/*
That's it! Just compile and play around with the program.
**/

View File

@ -21,6 +21,7 @@
<Project filename="19.MouseAndJoystick/MouseAndJoystick.cbp" /> <Project filename="19.MouseAndJoystick/MouseAndJoystick.cbp" />
<Project filename="20.ManagedLights/ManagedLights.cbp" /> <Project filename="20.ManagedLights/ManagedLights.cbp" />
<Project filename="21.Quake3Explorer/Quake3Explorer.cbp" active="1" /> <Project filename="21.Quake3Explorer/Quake3Explorer.cbp" active="1" />
<Project filename="22.MaterialViewer/MaterialViewer.cbp" />
<Project filename="Demo/demo.cbp" /> <Project filename="Demo/demo.cbp" />
<Project filename="../tools/GUIEditor/GUIEditor_gcc.cbp" /> <Project filename="../tools/GUIEditor/GUIEditor_gcc.cbp" />
<Project filename="../tools/MeshConverter/MeshConverter.cbp" /> <Project filename="../tools/MeshConverter/MeshConverter.cbp" />

View File

@ -89,12 +89,54 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16.Quake3MapShader_vc9", "1
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "18.SplitScreen_vc9", "18.SplitScreen\SplitScreen_vc9.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "18.SplitScreen_vc9", "18.SplitScreen\SplitScreen_vc9.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick_vc9", "19.MouseAndJoystick\MouseAndJoystick_vc9.vcproj", "{FE853A36-E0D1-4AC5-A792-B643E70D2953}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick_vc9", "19.MouseAndJoystick\MouseAndJoystick_vc9.vcproj", "{FE853A36-E0D1-4AC5-A792-B643E70D2953}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights_vc9", "20.ManagedLights\ManagedLights_vc9.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights_vc9", "20.ManagedLights\ManagedLights_vc9.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "21.Quake3Explorer_vc9", "21.Quake3Explorer\Quake3Explorer_vc9.vcproj", "{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "21.Quake3Explorer_vc9", "21.Quake3Explorer\Quake3Explorer_vc9.vcproj", "{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "22.MaterialViewer_vc9", "22.MaterialViewer\MaterialViewer_vc9.vcproj", "{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "23.SMeshHandling_vc9", "23.SMeshHandling\SMeshHandling_vc9.vcproj", "{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "17.HelloWorld for Windows Mobile on PC", "17.HelloWorld_Mobile\17. HelloWorld for Windows Mobile on PC_v9.vcproj", "{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUI Editor_v9", "..\tools\GUIEditor\GUI Editor_v9.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "..\tools\IrrFontTool\newFontTool\irrFontTool_v9.vcproj", "{4D53E40F-37E3-42B1-8848-F4C6F8313A17}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mesh Converter", "..\tools\MeshConverter\MeshConverter_v9.vcproj", "{E72B637E-4AA6-46F3-885F-AC67B4B470ED}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -164,8 +206,8 @@ Global
{78C9F424-523C-49AC-94B7-823AA4A26BF9}.Release|Win32.Build.0 = Release|Win32 {78C9F424-523C-49AC-94B7-823AA4A26BF9}.Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release - Fast FPU|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release - Fast FPU|Win32 {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32
{6F076455-D955-45D4-9C68-4AD4E45F2D47}.Debug|Win32.ActiveCfg = Debug|Win32 {6F076455-D955-45D4-9C68-4AD4E45F2D47}.Debug|Win32.ActiveCfg = Debug|Win32
{6F076455-D955-45D4-9C68-4AD4E45F2D47}.Debug|Win32.Build.0 = Debug|Win32 {6F076455-D955-45D4-9C68-4AD4E45F2D47}.Debug|Win32.Build.0 = Debug|Win32
{6F076455-D955-45D4-9C68-4AD4E45F2D47}.Release|Win32.ActiveCfg = Release|Win32 {6F076455-D955-45D4-9C68-4AD4E45F2D47}.Release|Win32.ActiveCfg = Release|Win32
@ -190,6 +232,30 @@ Global
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug|Win32.Build.0 = Debug|Win32 {CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug|Win32.Build.0 = Debug|Win32
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release|Win32.ActiveCfg = Release|Win32 {CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release|Win32.ActiveCfg = Release|Win32
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release|Win32.Build.0 = Release|Win32 {CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release|Win32.Build.0 = Release|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Debug|Win32.ActiveCfg = Debug|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Debug|Win32.Build.0 = Debug|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Release|Win32.ActiveCfg = Release|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Release|Win32.Build.0 = Release|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Debug|Win32.ActiveCfg = Debug|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Debug|Win32.Build.0 = Debug|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Release|Win32.ActiveCfg = Release|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Release|Win32.Build.0 = Release|Win32
{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}.Debug|Win32.ActiveCfg = Debug|Win32
{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}.Debug|Win32.Build.0 = Debug|Win32
{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}.Release|Win32.ActiveCfg = Release|Win32
{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}.Release|Win32.Build.0 = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.ActiveCfg = Debug|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.Build.0 = Debug|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.ActiveCfg = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.Build.0 = Release|Win32
{4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.ActiveCfg = Debug|Win32
{4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.Build.0 = Debug|Win32
{4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.ActiveCfg = Release|Win32
{4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.Build.0 = Release|Win32
{E72B637E-4AA6-46F3-885F-AC67B4B470ED}.Debug|Win32.ActiveCfg = Debug|Win32
{E72B637E-4AA6-46F3-885F-AC67B4B470ED}.Debug|Win32.Build.0 = Debug|Win32
{E72B637E-4AA6-46F3-885F-AC67B4B470ED}.Release|Win32.ActiveCfg = Release|Win32
{E72B637E-4AA6-46F3-885F-AC67B4B470ED}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -60,13 +60,13 @@ void CDemo::run()
return; return;
if (device->getFileSystem()->existFile("irrlicht.dat")) if (device->getFileSystem()->existFile("irrlicht.dat"))
device->getFileSystem()->addZipFileArchive("irrlicht.dat"); device->getFileSystem()->addFileArchive("irrlicht.dat");
else else
device->getFileSystem()->addZipFileArchive("../../media/irrlicht.dat"); device->getFileSystem()->addFileArchive("../../media/irrlicht.dat");
if (device->getFileSystem()->existFile("map-20kdm2.pk3")) if (device->getFileSystem()->existFile("map-20kdm2.pk3"))
device->getFileSystem()->addZipFileArchive("map-20kdm2.pk3"); device->getFileSystem()->addFileArchive("map-20kdm2.pk3");
else else
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3"); device->getFileSystem()->addFileArchive("../../media/map-20kdm2.pk3");
video::IVideoDriver* driver = device->getVideoDriver(); video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager(); scene::ISceneManager* smgr = device->getSceneManager();
@ -77,12 +77,12 @@ void CDemo::run()
// set ambient light // set ambient light
smgr->setAmbientLight ( video::SColorf ( 0x00c0c0c0 ) ); smgr->setAmbientLight ( video::SColorf ( 0x00c0c0c0 ) );
wchar_t tmp[255]; wchar_t tmp[255];
// draw everything // draw everything
s32 now = 0; s32 now = 0;
s32 lastfps = 0;
sceneStartTime = device->getTimer()->getTime(); sceneStartTime = device->getTimer()->getTime();
while(device->run() && driver) while(device->run() && driver)
{ {
@ -106,23 +106,19 @@ void CDemo::run()
smgr->drawAll(); smgr->drawAll();
guienv->drawAll(); guienv->drawAll();
driver->endScene(); driver->endScene();
// write statistics // write statistics
static s32 lastfps = 0; const s32 nowfps = driver->getFPS();
s32 nowfps = driver->getFPS();
swprintf(tmp, 255, L"%ls fps:%3d triangles:%0.3f mio", swprintf(tmp, 255, L"%ls fps:%3d triangles:%0.3f mio/s",
driver->getName(), driver->getName(), driver->getFPS(),
driver->getFPS(), driver->getPrimitiveCountDrawn(1) * (1.f / 1000000.f));
(f32) driver->getPrimitiveCountDrawn( 1 ) * ( 1.f / 1000000.f )
);
statusText->setText(tmp); statusText->setText(tmp);
if ( nowfps != lastfps ) if ( nowfps != lastfps )
{ {
device->setWindowCaption ( tmp ); device->setWindowCaption(tmp);
lastfps = nowfps; lastfps = nowfps;
} }
} }
@ -340,7 +336,6 @@ void CDemo::switchToNextScene()
} }
sceneStartTime = device->getTimer()->getTime(); sceneStartTime = device->getTimer()->getTime();
} }
@ -362,23 +357,20 @@ void CDemo::loadSceneData()
//move all quake level meshes (non-realtime) //move all quake level meshes (non-realtime)
core::matrix4 m; core::matrix4 m;
m.setTranslation ( core::vector3df(-1300,-70,-1249) ); m.setTranslation(core::vector3df(-1300,-70,-1249));
for ( i = 0; i!= scene::quake3::E_Q3_MESH_SIZE; ++i ) for ( i = 0; i!= scene::quake3::E_Q3_MESH_SIZE; ++i )
{ sm->getMeshManipulator()->transform(quakeLevelMesh->getMesh(i), m);
sm->getMeshManipulator()->transformMesh ( quakeLevelMesh->getMesh(i), m );
}
quakeLevelNode = sm->addOctTreeSceneNode( quakeLevelNode = sm->addOctreeSceneNode(
quakeLevelMesh->getMesh( scene::quake3::E_Q3_MESH_GEOMETRY) quakeLevelMesh->getMesh( scene::quake3::E_Q3_MESH_GEOMETRY));
);
if (quakeLevelNode) if (quakeLevelNode)
{ {
//quakeLevelNode->setPosition(core::vector3df(-1300,-70,-1249)); //quakeLevelNode->setPosition(core::vector3df(-1300,-70,-1249));
quakeLevelNode->setVisible(true); quakeLevelNode->setVisible(true);
// create map triangle selector // create map triangle selector
mapSelector = sm->createOctTreeTriangleSelector(quakeLevelMesh->getMesh(0), mapSelector = sm->createOctreeTriangleSelector(quakeLevelMesh->getMesh(0),
quakeLevelNode, 128); quakeLevelNode, 128);
// if not using shader and no gamma it's better to use more lighting, because // if not using shader and no gamma it's better to use more lighting, because
@ -410,7 +402,6 @@ void CDemo::loadSceneData()
// Now add the MeshBuffer(s) with the current Shader to the Manager // Now add the MeshBuffer(s) with the current Shader to the Manager
sm->addQuake3SceneNode ( meshBuffer, shader ); sm->addQuake3SceneNode ( meshBuffer, shader );
} }
} }
// load sydney model and create 2 instances // load sydney model and create 2 instances
@ -427,9 +418,9 @@ void CDemo::loadSceneData()
model1->setScale(core::vector3df(2,2,2)); model1->setScale(core::vector3df(2,2,2));
model1->setMD2Animation(scene::EMAT_STAND); model1->setMD2Animation(scene::EMAT_STAND);
model1->setMaterialFlag(video::EMF_LIGHTING, false); model1->setMaterialFlag(video::EMF_LIGHTING, false);
model1->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
model1->setMaterialType(video::EMT_SPHERE_MAP); model1->setMaterialType(video::EMT_SPHERE_MAP);
model1->addShadowVolumeSceneNode(); model1->addShadowVolumeSceneNode();
model1->setAutomaticCulling ( scene::EAC_BOX );
} }
model2 = sm->addAnimatedMeshSceneNode(mesh); model2 = sm->addAnimatedMeshSceneNode(mesh);
@ -440,8 +431,8 @@ void CDemo::loadSceneData()
model2->setMD2Animation(scene::EMAT_RUN); model2->setMD2Animation(scene::EMAT_RUN);
model2->setMaterialTexture(0, device->getVideoDriver()->getTexture("../../media/sydney.bmp")); model2->setMaterialTexture(0, device->getVideoDriver()->getTexture("../../media/sydney.bmp"));
model2->setMaterialFlag(video::EMF_LIGHTING, true); model2->setMaterialFlag(video::EMF_LIGHTING, true);
model1->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
model2->addShadowVolumeSceneNode(); model2->addShadowVolumeSceneNode();
model2->setAutomaticCulling ( scene::EAC_BOX );
} }
} }
@ -458,8 +449,6 @@ void CDemo::loadSceneData()
driver->getTexture("../../media/irrlicht2_bk.jpg")); driver->getTexture("../../media/irrlicht2_bk.jpg"));
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true); driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
//driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
// create walk-between-portals animation // create walk-between-portals animation
core::vector3df waypoint[2]; core::vector3df waypoint[2];
@ -468,8 +457,8 @@ void CDemo::loadSceneData()
if (model2) if (model2)
{ {
anim = device->getSceneManager()->createFlyStraightAnimator(waypoint[0], anim = device->getSceneManager()->createFlyStraightAnimator(
waypoint[1], 2000, true); waypoint[0], waypoint[1], 2000, true);
model2->addAnimator(anim); model2->addAnimator(anim);
anim->drop(); anim->drop();
} }
@ -533,7 +522,6 @@ void CDemo::loadSceneData()
campFire->setPosition(core::vector3df(100,120,600)); campFire->setPosition(core::vector3df(100,120,600));
campFire->setScale(core::vector3df(2,2,2)); campFire->setScale(core::vector3df(2,2,2));
scene::IParticleEmitter* em = campFire->createBoxEmitter( scene::IParticleEmitter* em = campFire->createBoxEmitter(
core::aabbox3d<f32>(-7,0,-7,7,1,7), core::aabbox3d<f32>(-7,0,-7,7,1,7),
core::vector3df(0.0f,0.06f,0.0f), core::vector3df(0.0f,0.06f,0.0f),
@ -563,11 +551,9 @@ void CDemo::loadSceneData()
if (music) if (music)
startSound(); startSound();
#endif #endif
} }
void CDemo::createLoadingScreen() void CDemo::createLoadingScreen()
{ {
core::dimension2d<u32> size = device->getVideoDriver()->getScreenSize(); core::dimension2d<u32> size = device->getVideoDriver()->getScreenSize();
@ -610,7 +596,6 @@ void CDemo::createLoadingScreen()
} }
void CDemo::shoot() void CDemo::shoot()
{ {
scene::ISceneManager* sm = device->getSceneManager(); scene::ISceneManager* sm = device->getSceneManager();
@ -701,7 +686,6 @@ void CDemo::shoot()
} }
void CDemo::createParticleImpacts() void CDemo::createParticleImpacts()
{ {
u32 now = device->getTimer()->getTime(); u32 now = device->getTimer()->getTime();
@ -765,7 +749,6 @@ void CDemo::createParticleImpacts()
} }
#ifdef USE_IRRKLANG #ifdef USE_IRRKLANG
void CDemo::startIrrKlang() void CDemo::startIrrKlang()
{ {

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="Demo_vc9" Name="Demo_vc9"
ProjectGUID="{6F076455-D955-45D4-9C68-4AD4E45F2D47}" ProjectGUID="{6F076455-D955-45D4-9C68-4AD4E45F2D47}"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
@ -48,7 +48,8 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\include" AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true" StringPooling="true"

View File

@ -1,35 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestProject", "TestProject.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}"
ProjectSection(ProjectDependencies) = postProject
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "..\..\source\Irrlicht\Irrlicht7.1.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Relase - Fast FPU = Relase - Fast FPU
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug.ActiveCfg = Debug|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug.Build.0 = Debug|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Relase - Fast FPU.ActiveCfg = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Relase - Fast FPU.Build.0 = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release.ActiveCfg = Release|Win32
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU.ActiveCfg = Relase - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU.Build.0 = Relase - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -1,298 +0,0 @@
/*
In this tutorial, I will show how to collision detection with the Irrlicht
Engine. I will describe 3 methods: Automatic collision detection for moving
through 3d worlds with stair climbing and sliding, manual triangle picking and
manual scene node picking.
To start, we take the program from tutorial 2, which loaded and displayed a
quake 3 level. We will use the level to walk in it and to pick triangles from
it. In addition we'll place 3 animated models into it for scene node picking.
The following code starts up the engine and loads a quake 3 level. I will not
explain it, because it should already be known from tutorial 2.
*/
#include <irrlicht.h>
#include <iostream>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
int main()
{
// let user select driver type
video::E_DRIVER_TYPE driverType;
printf("Please select the driver you want for this example:\n"\
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
" (f) NullDevice\n (otherKey) exit\n\n");
char i;
std::cin >> i;
switch(i)
{
case 'a': driverType = video::EDT_DIRECT3D9;break;
case 'b': driverType = video::EDT_DIRECT3D8;break;
case 'c': driverType = video::EDT_OPENGL; break;
case 'd': driverType = video::EDT_OGLES1; break;
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 0;
}
// create device
IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<s32>(640, 480), 16, false);
if (device == 0)
return 1; // could not create selected driver.
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
scene::IAnimatedMesh* q3levelmesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* q3node = 0;
if (q3levelmesh)
q3node = smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0));
/*
So far so good, we've loaded the quake 3 level like in tutorial 2. Now, here
comes something different: We create a triangle selector. A triangle selector
is a class which can fetch the triangles from scene nodes for doing different
things with them, for example collision detection. There are different triangle
selectors, and all can be created with the ISceneManager. In this example,
we create an OctTreeTriangleSelector, which optimizes the triangle output a l
little bit by reducing it like an octree. This is very useful for huge meshes
like quake 3 levels.
Afte we created the triangle selector, we attach it to the q3node. This is not
necessary, but in this way, we do not need to care for the selector, for example
dropping it after we do not need it anymore.
*/
scene::ITriangleSelector* selector = 0;
if (q3node)
{
q3node->setPosition(core::vector3df(-1350,-130,-1400));
selector = smgr->createOctTreeTriangleSelector(
q3levelmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(selector);
selector->drop();
}
/*
We add a first person shooter camera to the scene for being able to
move in the quake 3 level like in tutorial 2. But this, time, we add a
special animator to the camera: A Collision Response animator. This
thing modifies the scene node to which it is attached to in that way,
that it may no more move through walls and is affected by gravity. The
only thing we have to tell the animator is how the world looks like,
how big the scene node is, how gravity and so on. After the collision
response animator is attached to the camera, we do not have to do
anything more for collision detection, anything is done automaticly,
all other collision detection code below is for picking. And please
note another cool feature: The collsion response animator can be
attached also to all other scene nodes, not only to cameras. And it can
be mixed with other scene node animators. In this way, collision
detection and response in the Irrlicht engine is really, really easy.
Now we'll take a closer look on the parameters of
createCollisionResponseAnimator().
The first parameter is the TriangleSelector, which specifies how the
world, against collision detection is done looks like. The second
parameter is the scene node, which is the object, which is affected by
collision detection, in our case it is the camera. The third defines
how big the object is, it is the radius of an ellipsoid. Try it out and
change the radius to smaller values, the camera will be able to move
closer to walls after this. The next parameter is the direction and
speed of gravity. You could set it to (0,0,0) to disable gravity. And
the last value is just a translation: Without this, the ellipsoid with
which collision detection is done would be around the camera, and the
camera would be in the middle of the ellipsoid. But as human beings, we
are used to have our eyes on top of the body, with which we collide
with our world, not in the middle of it. So we place the scene node 50
units over the center of the ellipsoid with this parameter. And that's
it, collision detection works now.
*/
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0, 100.0f, 300.0f, -1, 0, 0, true);
camera->setPosition(core::vector3df(-100,50,-150));
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
camera->addAnimator(anim);
anim->drop();
/*
Because collision detection is no big deal in irrlicht, I'll describe how to
do two different types of picking in the next section. But before this,
I'll prepare the scene a little. I need three animated characters which we
could pick later, a dynamic light for lighting them,
a billboard for drawing where we found an intersection, and, yes, I need to
get rid of this mouse cursor. :)
*/
// disable mouse cursor
device->getCursorControl()->setVisible(false);
// add billboard
scene::IBillboardSceneNode * bill = smgr->addBillboardSceneNode();
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR );
bill->setMaterialTexture(0, driver->getTexture("../../media/particle.bmp"));
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setMaterialFlag(video::EMF_ZBUFFER, false);
bill->setSize(core::dimension2d<f32>(20.0f, 20.0f));
// add 3 animated faeries.
video::SMaterial material;
material.Textures[0] = driver->getTexture("../../media/faerie2.bmp");
material.Lighting = true;
scene::IAnimatedMeshSceneNode* node = 0;
scene::IAnimatedMesh* faerie = smgr->getMesh("../../media/faerie.md2");
if (faerie)
{
node = smgr->addAnimatedMeshSceneNode(faerie);
node->setPosition(core::vector3df(-70,0,-90));
node->setMD2Animation(scene::EMAT_RUN);
node->getMaterial(0) = material;
node = smgr->addAnimatedMeshSceneNode(faerie);
node->setPosition(core::vector3df(-70,0,-30));
node->setMD2Animation(scene::EMAT_SALUTE);
node->getMaterial(0) = material;
node = smgr->addAnimatedMeshSceneNode(faerie);
node->setPosition(core::vector3df(-70,0,-60));
node->setMD2Animation(scene::EMAT_JUMP);
node->getMaterial(0) = material;
}
material.Textures[0] = 0;
material.Lighting = false;
// Add a light
smgr->addLightSceneNode(0, core::vector3df(-60,100,400),
video::SColorf(1.0f,1.0f,1.0f,1.0f),
600.0f);
/*
For not making it to complicated, I'm doing picking inside the drawing loop.
We take two pointers for storing the current and the last selected scene node and
start the loop.
*/
scene::ISceneNode* selectedSceneNode = 0;
scene::ISceneNode* lastSelectedSceneNode = 0;
int lastFPS = -1;
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
/*
After we've drawn the whole scene whit smgr->drawAll(), we'll
do the first picking: We want to know which triangle of the
world we are looking at. In addition, we want the exact point
of the quake 3 level we are looking at. For this, we create a
3d line starting at the position of the camera and going
through the lookAt-target of it. Then we ask the collision
manager if this line collides with a triangle of the world
stored in the triangle selector. If yes, we draw the 3d
triangle and set the position of the billboard to the
intersection point.
*/
core::line3d<f32> line;
line.start = camera->getPosition();
line.end = line.start + (camera->getTarget() - line.start).normalize() * 1000.0f;
core::vector3df intersection;
core::triangle3df tri;
if (smgr->getSceneCollisionManager()->getCollisionPoint(
line, selector, intersection, tri))
{
bill->setPosition(intersection);
driver->setTransform(video::ETS_WORLD, core::matrix4());
driver->setMaterial(material);
driver->draw3DTriangle(tri, video::SColor(0,255,0,0));
}
/*
Another type of picking supported by the Irrlicht Engine is scene node picking
based on bouding boxes. Every scene node has got a bounding box, and because of
that, it's very fast for example to get the scene node which the camera looks
at. Again, we ask the collision manager for this, and if we've got a scene node,
we highlight it by disabling Lighting in its material, if it is not the
billboard or the quake 3 level.
*/
selectedSceneNode =
smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera);
if (lastSelectedSceneNode)
lastSelectedSceneNode->setMaterialFlag(video::EMF_LIGHTING, true);
if (selectedSceneNode == q3node || selectedSceneNode == bill)
selectedSceneNode = 0;
if (selectedSceneNode)
selectedSceneNode->setMaterialFlag(video::EMF_LIGHTING, false);
lastSelectedSceneNode = selectedSceneNode;
/*
That's it, we just have to finish drawing.
*/
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str =
L"Collision detection example - Irrlicht Engine [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
return 0;
}

View File

@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
[ -z $1 ] || TARGET=$1 [ -z $1 ] || TARGET=$1
[ -z $TARGET ] && TARGET=all [ -z $TARGET ] && TARGET=all
for i in [01]* Demo; do for i in [012]* Demo; do
echo "Building $i"; echo "Building $i";
pushd $i && make clean $TARGET; pushd $i && make clean $TARGET;
popd; popd;

98
include/EAttributes.h Normal file
View File

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

View File

@ -34,6 +34,12 @@ namespace irr
in by defining the IRR_USE_SDL_DEVICE macro in IrrCompileConfig.h */ in by defining the IRR_USE_SDL_DEVICE macro in IrrCompileConfig.h */
EIDT_SDL, EIDT_SDL,
//! A device for raw framebuffer access
/** Best used with embedded devices and mobile systems.
Does not need X11 or other graphical subsystems.
May support hw-acceleration via OpenGL-ES for FBDirect */
EIDT_FRAMEBUFFER,
//! A simple text only device supported by all platforms. //! A simple text only device supported by all platforms.
/** This device allows applications to run from the command line without opening a window. /** This device allows applications to run from the command line without opening a window.
It can render the output of the software drivers to the console as ASCII. It only supports It can render the output of the software drivers to the console as ASCII. It only supports

View File

@ -85,12 +85,12 @@ enum EGUI_ELEMENT_TYPE
//! A window //! A window
EGUIET_WINDOW, EGUIET_WINDOW,
//! Not an element, amount of elements in there
EGUIET_COUNT,
//! Unknown type. //! Unknown type.
EGUIET_ELEMENT, EGUIET_ELEMENT,
//! Not an element, amount of elements in there
EGUIET_COUNT,
//! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit. //! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit.
EGUIET_FORCE_32_BIT = 0x7fffffff EGUIET_FORCE_32_BIT = 0x7fffffff
@ -122,6 +122,7 @@ const c8* const GUIElementTypeNames[] =
"toolBar", "toolBar",
"treeview", "treeview",
"window", "window",
"element",
0 0
}; };

56
include/EPrimitiveTypes.h Normal file
View File

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

View File

@ -42,8 +42,8 @@ namespace scene
//! Shadow Volume Scene Node //! Shadow Volume Scene Node
ESNT_SHADOW_VOLUME = MAKE_IRR_ID('s','h','d','w'), ESNT_SHADOW_VOLUME = MAKE_IRR_ID('s','h','d','w'),
//! OctTree Scene Node //! Octree Scene Node
ESNT_OCT_TREE = MAKE_IRR_ID('o','c','t','t'), ESNT_OCTREE = MAKE_IRR_ID('o','c','t','r'),
//! Mesh Scene Node //! Mesh Scene Node
ESNT_MESH = MAKE_IRR_ID('m','e','s','h'), ESNT_MESH = MAKE_IRR_ID('m','e','s','h'),

90
include/EShaderTypes.h Normal file
View File

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

View File

@ -25,10 +25,7 @@ namespace scene
EJUOR_READ, EJUOR_READ,
//! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() ) //! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() )
EJUOR_CONTROL, EJUOR_CONTROL
//! count of all available interpolation modes
EJUOR_COUNT
}; };

View File

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

View File

@ -99,13 +99,29 @@ namespace irr
//! in what direction and how fast. //! in what direction and how fast.
EMIE_MOUSE_WHEEL, EMIE_MOUSE_WHEEL,
//! Mouse double click. //! Left mouse button double click.
//! This event is generated after the second EMIE_LMOUSE_PRESSED_DOWN event. //! This event is generated after the second EMIE_LMOUSE_PRESSED_DOWN event.
EMIE_MOUSE_DOUBLE_CLICK, EMIE_LMOUSE_DOUBLE_CLICK,
//! Mouse triple click. //! Right mouse button double click.
//! This event is generated after the second EMIE_RMOUSE_PRESSED_DOWN event.
EMIE_RMOUSE_DOUBLE_CLICK,
//! Middle mouse button double click.
//! This event is generated after the second EMIE_MMOUSE_PRESSED_DOWN event.
EMIE_MMOUSE_DOUBLE_CLICK,
//! Left mouse button triple click.
//! This event is generated after the third EMIE_LMOUSE_PRESSED_DOWN event. //! This event is generated after the third EMIE_LMOUSE_PRESSED_DOWN event.
EMIE_MOUSE_TRIPLE_CLICK, EMIE_LMOUSE_TRIPLE_CLICK,
//! Right mouse button triple click.
//! This event is generated after the third EMIE_RMOUSE_PRESSED_DOWN event.
EMIE_RMOUSE_TRIPLE_CLICK,
//! Middle mouse button triple click.
//! This event is generated after the third EMIE_MMOUSE_PRESSED_DOWN event.
EMIE_MMOUSE_TRIPLE_CLICK,
//! No real event. Just for convenience to get number of events //! No real event. Just for convenience to get number of events
EMIE_COUNT EMIE_COUNT
@ -415,7 +431,11 @@ public:
virtual ~IEventReceiver() {} virtual ~IEventReceiver() {}
//! Called if an event happened. //! Called if an event happened.
/** \return True if the event was processed. */ /** Please take care that you should only return 'true' when you want to _prevent_ Irrlicht
* from processing the event any further. So 'true' does mean that an event is completely done.
* Therefore your return value for all unprocessed events should be 'false'.
\return True if the event was processed.
*/
virtual bool OnEvent(const SEvent& event) = 0; virtual bool OnEvent(const SEvent& event) = 0;
}; };

View File

@ -71,6 +71,13 @@ public:
//! get the archive type //! get the archive type
virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_UNKNOWN; } virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_UNKNOWN; }
//! An optionally used password string
/** This variable is publicly accessible from the interface in order to
avoid single access patterns to this place, and hence allow some more
obscurity.
*/
core::stringc Password;
}; };
//! Class which is able to create an archive from a file. //! Class which is able to create an archive from a file.

View File

@ -92,26 +92,32 @@ public:
virtual IWriteFile* createAndWriteFile(const path& filename, bool append=false) =0; virtual IWriteFile* createAndWriteFile(const path& filename, bool append=false) =0;
//! Adds an archive to the file system. //! Adds an archive to the file system.
/** After calling this, the Irrlicht Engine will also search and open files directly from this archive. /** After calling this, the Irrlicht Engine will also search and open
This is useful for hiding data from the end user, speeding up file access and making it possible to files directly from this archive. This is useful for hiding data from
access for example Quake3 .pk3 files, which are no different than .zip files. the end user, speeding up file access and making it possible to access
By default Irrlicht supports ZIP, PAK, TAR and directories as archives. You can provide your own archive for example Quake3 .pk3 files, which are just renamed .zip files. By
types by implementing IArchiveLoader and passing an instance to addArchiveLoader. default Irrlicht supports ZIP, PAK, TAR, PNK, and directories as
archives. You can provide your own archive types by implementing
IArchiveLoader and passing an instance to addArchiveLoader.
\param filename: Filename of the archive to add to the file system. \param filename: Filename of the archive to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without \param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case. writing all letters in the right case.
\param ignorePaths: If set to true, files in the added archive can be accessed \param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path. without its complete path.
\param archiveType: If no specific E_FILE_ARCHIVE_TYPE is selected then the type of archive will depend on \param archiveType: If no specific E_FILE_ARCHIVE_TYPE is selected then
the extension of the file name. If you use a different extension then you can use this parameter to force the type of archive will depend on the extension of the file name. If
you use a different extension then you can use this parameter to force
a specific type of archive. a specific type of archive.
\param password An optional password, which is used in case of encrypted archives.
\return Returns true if the archive was added successfully, false if not. */ \return Returns true if the archive was added successfully, false if not. */
virtual bool addFileArchive(const path& filename, bool ignoreCase=true, bool ignorePaths=true, virtual bool addFileArchive(const path& filename, bool ignoreCase=true,
E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN) =0; bool ignorePaths=true,
E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
const core::stringc& password="") =0;
//! Adds an external archive loader to the engine. //! Adds an external archive loader to the engine.
/** Use this function to add support for new archive types to the engine, for example propiatrary or /** Use this function to add support for new archive types to the
encyrpted file storage. */ engine, for example proprietary or encrypted file storage. */
virtual void addArchiveLoader(IArchiveLoader* loader) =0; virtual void addArchiveLoader(IArchiveLoader* loader) =0;
//! Returns the number of archives currently attached to the file system //! Returns the number of archives currently attached to the file system
@ -141,9 +147,10 @@ public:
//! Returns the archive at a given index. //! Returns the archive at a given index.
virtual IFileArchive* getFileArchive(u32 index) =0; virtual IFileArchive* getFileArchive(u32 index) =0;
//! Adds a zip archive to the file system. Deprecated! This function is provided for compatibility //! Adds a zip archive to the file system.
/** with older versions of Irrlicht and may be removed in future versions, you should use /** \deprecated This function is provided for compatibility
addFileArchive instead. with older versions of Irrlicht and may be removed in future versions,
you should use addFileArchive instead.
After calling this, the Irrlicht Engine will search and open files directly from this archive too. After calling this, the Irrlicht Engine will search and open files directly from this archive too.
This is useful for hiding data from the end user, speeding up file access and making it possible to This is useful for hiding data from the end user, speeding up file access and making it possible to
access for example Quake3 .pk3 files, which are no different than .zip files. access for example Quake3 .pk3 files, which are no different than .zip files.
@ -159,8 +166,9 @@ public:
} }
//! Adds an unzipped archive (or basedirectory with subdirectories..) to the file system. //! Adds an unzipped archive (or basedirectory with subdirectories..) to the file system.
/** Deprecated! This function is provided for compatibility with older versions of Irrlicht /** \deprecated This function is provided for compatibility
and may be removed in future versions, you should use addFileArchive instead. with older versions of Irrlicht and may be removed in future versions,
you should use addFileArchive instead.
Useful for handling data which will be in a zip file Useful for handling data which will be in a zip file
\param filename: Filename of the unzipped zip archive base directory to add to the file system. \param filename: Filename of the unzipped zip archive base directory to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without \param ignoreCase: If set to true, files in the archive can be accessed without
@ -174,8 +182,9 @@ public:
} }
//! Adds a pak archive to the file system. //! Adds a pak archive to the file system.
/** Deprecated! This function is provided for compatibility with older versions of Irrlicht /** \deprecated This function is provided for compatibility
and may be removed in future versions, you should use addFileArchive instead. with older versions of Irrlicht and may be removed in future versions,
you should use addFileArchive instead.
After calling this, the Irrlicht Engine will search and open files directly from this archive too. After calling this, the Irrlicht Engine will search and open files directly from this archive too.
This is useful for hiding data from the end user, speeding up file access and making it possible to This is useful for hiding data from the end user, speeding up file access and making it possible to
access for example Quake2/KingPin/Hexen2 .pak files access for example Quake2/KingPin/Hexen2 .pak files

View File

@ -5,8 +5,9 @@
#ifndef __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__ #ifndef __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
#define __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__ #define __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
#include "IReferenceCounted.h" #include "EShaderTypes.h"
#include "SMaterial.h" #include "EMaterialTypes.h"
#include "EPrimitiveTypes.h"
#include "path.h" #include "path.h"
namespace irr namespace irr
@ -23,54 +24,6 @@ namespace video
class IVideoDriver; class IVideoDriver;
class IShaderConstantSetCallBack; class IShaderConstantSetCallBack;
//! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_VERTEX_SHADER_TYPE
{
EVST_VS_1_1 = 0,
EVST_VS_2_0,
EVST_VS_2_a,
EVST_VS_3_0,
//! This is not a type, but a value indicating how much types there are.
EVST_COUNT
};
//! Names for all vertex shader types, each entry corresponds to a E_VERTEX_SHADER_TYPE entry.
const c8* const VERTEX_SHADER_TYPE_NAMES[] = {
"vs_1_1",
"vs_2_0",
"vs_2_a",
"vs_3_0",
0 };
//! Compile target enumeration for the addHighLevelShaderMaterial() method.
enum E_PIXEL_SHADER_TYPE
{
EPST_PS_1_1 = 0,
EPST_PS_1_2,
EPST_PS_1_3,
EPST_PS_1_4,
EPST_PS_2_0,
EPST_PS_2_a,
EPST_PS_2_b,
EPST_PS_3_0,
//! This is not a type, but a value indicating how much types there are.
EPST_COUNT
};
//! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry.
const c8* const PIXEL_SHADER_TYPE_NAMES[] = {
"ps_1_1",
"ps_1_2",
"ps_1_3",
"ps_1_4",
"ps_2_0",
"ps_2_a",
"ps_2_b",
"ps_3_0",
0 };
//! Interface making it possible to create and use programs running on the GPU. //! Interface making it possible to create and use programs running on the GPU.
class IGPUProgrammingServices class IGPUProgrammingServices
{ {
@ -85,17 +38,29 @@ public:
shader program. This can be 0 if no vertex program shall be used. shader program. This can be 0 if no vertex program shall be used.
\param vertexShaderEntryPointName: Name of the entry function of the \param vertexShaderEntryPointName: Name of the entry function of the
vertexShaderProgram vertexShaderProgram
\param vsCompileTarget: Vertex shader version where the high level \param vsCompileTarget: Vertex shader version the high level shader
shader shall be compiled to. shall be compiled to.
\param pixelShaderProgram: String containing the source of the pixel \param pixelShaderProgram: String containing the source of the pixel
shader program. This can be 0 if no pixel shader shall be used. shader program. This can be 0 if no pixel shader shall be used.
\param pixelShaderEntryPointName: Entry name of the function of the \param pixelShaderEntryPointName: Entry name of the function of the
pixelShaderEntryPointName pixelShaderEntryPointName
\param psCompileTarget: Pixel shader version where the high level \param psCompileTarget: Pixel shader version the high level shader
shader shall be compiled to. shall be compiled to.
\param geometryShaderProgram: String containing the source of the
geometry shader program. This can be 0 if no geometry shader shall be
used.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderEntryPointName
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader
\param outType Type of vertices created by geometry shader
\param verticesOut Maximal number of vertices created by geometry
shader. If 0, maximal number supported is assumed.
\param callback: Pointer to an implementation of \param callback: Pointer to an implementation of
IShaderConstantSetCallBack in which you can set the needed vertex and IShaderConstantSetCallBack in which you can set the needed vertex,
pixel shader program constants. Set this to 0 if you don't need this. pixel, and geometry shader program constants. Set this to 0 if you
don't need this.
\param baseMaterial: Base material which renderstates will be used to \param baseMaterial: Base material which renderstates will be used to
shade the material. shade the material.
\param userData: a user data int. This int can be set to any value and \param userData: a user data int. This int can be set to any value and
@ -103,13 +68,30 @@ public:
OnSetConstants(). In this way it is easily possible to use the same OnSetConstants(). In this way it is easily possible to use the same
callback method for multiple materials and distinguish between them callback method for multiple materials and distinguish between them
during the call. during the call.
\return Returns the number of the material type which can be set in \return Number of the material type which can be set in
SMaterial::MaterialType to use the renderer. -1 is returned if an SMaterial::MaterialType to use the renderer. -1 is returned if an error
error occured, e.g. if a vertex or pixel shader program could not be occured, e.g. if a shader program could not be compiled or a compile
compiled or a compile target is not reachable. The error strings are target is not reachable. The error strings are then printed to the
then printed to the error log and can be catched with a custom event error log and can be catched with a custom event receiver. */
receiver. */
virtual s32 addHighLevelShaderMaterial( virtual s32 addHighLevelShaderMaterial(
const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const c8* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
const c8* geometryShaderProgram = 0,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
u32 verticesOut = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0 ) = 0;
//! convenience function for use without geometry shaders
s32 addHighLevelShaderMaterial(
const c8* vertexShaderProgram, const c8* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main", const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
@ -118,31 +100,47 @@ public:
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0, IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0 ) = 0; s32 userData = 0 )
{
return addHighLevelShaderMaterial(
vertexShaderProgram, vertexShaderEntryPointName,
vsCompileTarget, pixelShaderProgram,
pixelShaderEntryPointName, psCompileTarget,
0, "main", EGST_GS_4_0,
scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
callback, baseMaterial, userData);
}
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files. //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
/** \param vertexShaderProgram: Text file containing the source of the /** \param vertexShaderProgramFileName: Text file containing the source
* vertex shader program. of the vertex shader program. Set to empty string if no vertex shader
Set to 0 if no shader shall be created. shall be created.
\param vertexShaderEntryPointName: Name of the entry function of the \param vertexShaderEntryPointName: Name of the entry function of the
vertexShaderProgram vertexShaderProgram
\param vsCompileTarget: Vertex shader version where the high level \param vsCompileTarget: Vertex shader version the high level shader
shader shall be compiled to. shall be compiled to.
\param pixelShaderProgram: Text file containing the source of the pixel \param pixelShaderProgramFileName: Text file containing the source of
shader program. Set to 0 if no shader shall be created. the pixel shader program. Set to empty string if no pixel shader shall
\param vertexShaderEntryPointName: Name of the entry function of the be created.
vertexShaderProgram
\param vsCompileTarget: Vertex shader version where the high level
shader shall be compiled to.
\param pixelShaderProgram: String containing the source of the pixel
shader program. This can be 0 if no pixel shader shall be used.
\param pixelShaderEntryPointName: Entry name of the function of the \param pixelShaderEntryPointName: Entry name of the function of the
pixelShaderEntryPointName pixelShaderEntryPointName
\param psCompileTarget: Pixel shader version where the high level \param psCompileTarget: Pixel shader version the high level shader
shader shall be compiled to. shall be compiled to.
\param geometryShaderProgramFileName: String containing the source of
the geometry shader program. Set to empty string if no geometry shader
shall be created.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderEntryPointName
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader
\param outType Type of vertices created by geometry shader
\param verticesOut Maximal number of vertices created by geometry
shader. If 0, maximal number supported is assumed.
\param callback: Pointer to an implementation of \param callback: Pointer to an implementation of
IShaderConstantSetCallBack in which you can set the needed vertex and IShaderConstantSetCallBack in which you can set the needed vertex,
pixel shader program constants. Set this to 0 if you don't need this. pixel, and geometry shader program constants. Set this to 0 if you
don't need this.
\param baseMaterial: Base material which renderstates will be used to \param baseMaterial: Base material which renderstates will be used to
shade the material. shade the material.
\param userData: a user data int. This int can be set to any value and \param userData: a user data int. This int can be set to any value and
@ -150,13 +148,30 @@ public:
OnSetConstants(). In this way it is easily possible to use the same OnSetConstants(). In this way it is easily possible to use the same
callback method for multiple materials and distinguish between them callback method for multiple materials and distinguish between them
during the call. during the call.
\return Returns the number of the material type which can be set in \return Number of the material type which can be set in
SMaterial::MaterialType to use the renderer. -1 is returned if an SMaterial::MaterialType to use the renderer. -1 is returned if an error
error occured, e.g. if a vertex or pixel shader program could not be occured, e.g. if a shader program could not be compiled or a compile
compiled or a compile target is not reachable. The error strings are target is not reachable. The error strings are then printed to the
then printed to the error log and can be catched with a custom event error log and can be catched with a custom event receiver. */
receiver. */
virtual s32 addHighLevelShaderMaterialFromFiles( virtual s32 addHighLevelShaderMaterialFromFiles(
const io::path& vertexShaderProgramFileName,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
const io::path& pixelShaderProgramFileName = "",
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
const io::path& geometryShaderProgramFileName="",
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
u32 verticesOut = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! convenience function for use without geometry shaders
s32 addHighLevelShaderMaterialFromFiles(
const io::path& vertexShaderProgramFileName, const io::path& vertexShaderProgramFileName,
const c8* vertexShaderEntryPointName = "main", const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
@ -165,25 +180,42 @@ public:
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0, IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0; s32 userData = 0)
{
return addHighLevelShaderMaterialFromFiles(
vertexShaderProgramFileName, vertexShaderEntryPointName,
vsCompileTarget, pixelShaderProgramFileName,
pixelShaderEntryPointName, psCompileTarget,
"", "main", EGST_GS_4_0,
scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
callback, baseMaterial, userData);
}
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files. //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
/** \param vertexShaderProgram: Text file handle containing the source /** \param vertexShaderProgram: Text file handle containing the source
* of the vertex shader program. of the vertex shader program. Set to 0 if no vertex shader shall be
Set to 0 if no shader shall be created. created.
\param vertexShaderEntryPointName: Name of the entry function of the \param vertexShaderEntryPointName: Name of the entry function of the
vertexShaderProgram vertexShaderProgram
\param vsCompileTarget: Vertex shader version where the high level \param vsCompileTarget: Vertex shader version the high level shader
shader shall be compiled to. shall be compiled to.
\param pixelShaderProgram: Text file containing the source of the pixel
shader program. Set to
\param pixelShaderProgram: Text file handle containing the source of \param pixelShaderProgram: Text file handle containing the source of
the pixel shader program. Set to 0 if no shader shall be created. the pixel shader program. Set to 0 if no pixel shader shall be created.
\param pixelShaderEntryPointName: Entry name of the function of the \param pixelShaderEntryPointName: Entry name of the function of the
pixelShaderEntryPointName pixelShaderEntryPointName
\param psCompileTarget: Pixel shader version where the high level \param psCompileTarget: Pixel shader version the high level shader
shader shall be compiled to. shall be compiled to.
\param geometryShaderProgram: Text file handle containing the source of
the geometry shader program. Set to 0 if no geometry shader shall be
created.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderEntryPointName
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader
\param outType Type of vertices created by geometry shader
\param verticesOut Maximal number of vertices created by geometry
shader. If 0, maximal number supported is assumed.
\param callback: Pointer to an implementation of \param callback: Pointer to an implementation of
IShaderConstantSetCallBack in which you can set the needed vertex and IShaderConstantSetCallBack in which you can set the needed vertex and
pixel shader program constants. Set this to 0 if you don't need this. pixel shader program constants. Set this to 0 if you don't need this.
@ -194,13 +226,30 @@ public:
OnSetConstants(). In this way it is easily possible to use the same OnSetConstants(). In this way it is easily possible to use the same
callback method for multiple materials and distinguish between them callback method for multiple materials and distinguish between them
during the call. during the call.
\return Returns the number of the material type which can be set in \return Number of the material type which can be set in
SMaterial::MaterialType to use the renderer. -1 is returned if an SMaterial::MaterialType to use the renderer. -1 is returned if an
error occured, e.g. if a vertex or pixel shader program could not be error occured, e.g. if a shader program could not be compiled or a
compiled or a compile target is not reachable. The error strings are compile target is not reachable. The error strings are then printed to
then printed to the error log and can be catched with a custom event the error log and can be catched with a custom event receiver. */
receiver. */
virtual s32 addHighLevelShaderMaterialFromFiles( virtual s32 addHighLevelShaderMaterialFromFiles(
io::IReadFile* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
io::IReadFile* pixelShaderProgram = 0,
const c8* pixelShaderEntryPointName = "main",
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
io::IReadFile* geometryShaderProgram = 0,
const c8* geometryShaderEntryPointName = "main",
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
u32 verticesOut = 0,
IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0;
//! convenience function for use without geometry shaders
s32 addHighLevelShaderMaterialFromFiles(
io::IReadFile* vertexShaderProgram, io::IReadFile* vertexShaderProgram,
const c8* vertexShaderEntryPointName = "main", const c8* vertexShaderEntryPointName = "main",
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
@ -209,7 +258,16 @@ public:
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
IShaderConstantSetCallBack* callback = 0, IShaderConstantSetCallBack* callback = 0,
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
s32 userData = 0) = 0; s32 userData = 0)
{
return addHighLevelShaderMaterialFromFiles(
vertexShaderProgram, vertexShaderEntryPointName,
vsCompileTarget, pixelShaderProgram,
pixelShaderEntryPointName, psCompileTarget,
0, "main", EGST_GS_4_0,
scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
callback, baseMaterial, userData);
}
//! Adds a new ASM shader material renderer to the VideoDriver //! Adds a new ASM shader material renderer to the VideoDriver
/** Note that it is a good idea to call IVideoDriver::queryFeature() in /** Note that it is a good idea to call IVideoDriver::queryFeature() in

View File

@ -39,7 +39,7 @@ namespace gui
//! set behaviour when menus are closed //! set behaviour when menus are closed
virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0; virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0;
//! get current behaviour when the menue will be closed //! get current behaviour when the menu will be closed
virtual ECONTEXT_MENU_CLOSE getCloseHandling() const = 0; virtual ECONTEXT_MENU_CLOSE getCloseHandling() const = 0;
//! Get amount of menu items //! Get amount of menu items
@ -53,8 +53,9 @@ namespace gui
set to whatever you want. set to whatever you want.
\param enabled: Specifies if the menu item should be enabled. \param enabled: Specifies if the menu item should be enabled.
\param hasSubMenu: Set this to true if there should be a submenu \param hasSubMenu: Set this to true if there should be a submenu
at this item. You can acess this submenu via getSubMenu(). at this item. You can access this submenu via getSubMenu().
\param checked: Specifies if the menu item should be initially checked. \param checked: Specifies if the menu item should be initially checked.
\param autoChecking: Specifies if the item should be checked by clicking
\return Returns the index of the new item */ \return Returns the index of the new item */
virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true, virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0; bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
@ -69,16 +70,17 @@ namespace gui
set to whatever you want. set to whatever you want.
\param enabled: Specifies if the menu item should be enabled. \param enabled: Specifies if the menu item should be enabled.
\param hasSubMenu: Set this to true if there should be a submenu \param hasSubMenu: Set this to true if there should be a submenu
at this item. You can acess this submenu via getSubMenu(). at this item. You can access this submenu via getSubMenu().
\param checked: Specifies if the menu item should be initially checked. \param checked: Specifies if the menu item should be initially checked.
\param autoChecking: Specifies if the item should be checked by clicking
\return Returns the index of the new item */ \return Returns the index of the new item */
virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId=-1, bool enabled=true, virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId=-1, bool enabled=true,
bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0; bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
//! Find an item by it's CommandID //! Find an item by it's CommandID
/** /**
\param commandId: We are looking for the first item which has this commandID \param commandId: We are looking for the first item which has this commandID
\param idxStartSearch: Start searching from this index. \param idxStartSearch: Start searching from this index.
\return Returns the index of the item when found or otherwise -1. */ \return Returns the index of the item when found or otherwise -1. */
virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const = 0; virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const = 0;

View File

@ -38,7 +38,7 @@ namespace gui
\param color: New color of the text. */ \param color: New color of the text. */
virtual void setOverrideColor(video::SColor color) = 0; virtual void setOverrideColor(video::SColor color) = 0;
//! Sets if the text should use the overide color or the color in the gui skin. //! Sets if the text should use the override color or the color in the gui skin.
/** \param enable: If set to true, the override color, which can be set /** \param enable: If set to true, the override color, which can be set
with IGUIEditBox::setOverrideColor is used, otherwise the with IGUIEditBox::setOverrideColor is used, otherwise the
EGDC_BUTTON_TEXT color of the skin. */ EGDC_BUTTON_TEXT color of the skin. */
@ -70,7 +70,7 @@ namespace gui
virtual void setMultiLine(bool enable) = 0; virtual void setMultiLine(bool enable) = 0;
//! Checks if multi line editing is enabled //! Checks if multi line editing is enabled
/** \return true if mult-line is enabled, false otherwise */ /** \return true if multi-line is enabled, false otherwise */
virtual bool isMultiLineEnabled() const = 0; virtual bool isMultiLineEnabled() const = 0;
//! Enables or disables automatic scrolling with cursor position //! Enables or disables automatic scrolling with cursor position

View File

@ -28,7 +28,7 @@ public:
//! Constructor //! Constructor
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment* environment, IGUIElement* parent, IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle) s32 id, const core::rect<s32>& rectangle)
: Parent(0), RelativeRect(rectangle), AbsoluteRect(rectangle), : Parent(0), RelativeRect(rectangle), AbsoluteRect(rectangle),
AbsoluteClippingRect(rectangle), DesiredRect(rectangle), AbsoluteClippingRect(rectangle), DesiredRect(rectangle),
MaxSize(0,0), MinSize(1,1), IsVisible(true), IsEnabled(true), MaxSize(0,0), MinSize(1,1), IsVisible(true), IsEnabled(true),
@ -42,8 +42,10 @@ public:
// if we were given a parent to attach to // if we were given a parent to attach to
if (parent) if (parent)
parent->addChild(this); {
parent->addChildToEnd(this);
recalculateAbsolutePosition(true);
}
} }
@ -213,120 +215,7 @@ public:
//! Updates the absolute position. //! Updates the absolute position.
virtual void updateAbsolutePosition() virtual void updateAbsolutePosition()
{ {
core::rect<s32> parentAbsolute(0,0,0,0); recalculateAbsolutePosition(false);
core::rect<s32> parentAbsoluteClip;
f32 fw=0.f, fh=0.f;
if (Parent)
{
parentAbsolute = Parent->AbsoluteRect;
if (NoClip)
{
IGUIElement* p=this;
while (p && p->Parent)
p = p->Parent;
parentAbsoluteClip = p->AbsoluteClippingRect;
}
else
parentAbsoluteClip = Parent->AbsoluteClippingRect;
}
const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
fw = (f32)parentAbsolute.getWidth();
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.X = core::round32(ScaleRect.UpperLeftCorner.X * fw);
break;
}
switch (AlignRight)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.X = core::round32(ScaleRect.LowerRightCorner.X * fw);
break;
}
switch (AlignTop)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.Y = core::round32(ScaleRect.UpperLeftCorner.Y * fh);
break;
}
switch (AlignBottom)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.Y = core::round32(ScaleRect.LowerRightCorner.Y * fh);
break;
}
RelativeRect = DesiredRect;
const s32 w = RelativeRect.getWidth();
const s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed
if (w < (s32)MinSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MinSize.Width;
if (h < (s32)MinSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MinSize.Height;
if (MaxSize.Width && w > (s32)MaxSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MaxSize.Width;
if (MaxSize.Height && h > (s32)MaxSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height;
RelativeRect.repair();
AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
if (!Parent)
parentAbsoluteClip = AbsoluteRect;
AbsoluteClippingRect = AbsoluteRect;
AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
LastParentRect = parentAbsolute;
// update all children // update all children
core::list<IGUIElement*>::Iterator it = Children.begin(); core::list<IGUIElement*>::Iterator it = Children.begin();
@ -348,7 +237,7 @@ public:
\param point: The point at which to find a GUI element. \param point: The point at which to find a GUI element.
\return The topmost GUI element at that point, or 0 if there are \return The topmost GUI element at that point, or 0 if there are
no candidate elements at this point. no candidate elements at this point.
*/ */
IGUIElement* getElementFromPoint(const core::position2d<s32>& point) IGUIElement* getElementFromPoint(const core::position2d<s32>& point)
{ {
IGUIElement* target = 0; IGUIElement* target = 0;
@ -388,13 +277,9 @@ public:
//! Adds a GUI element as new child of this element. //! Adds a GUI element as new child of this element.
virtual void addChild(IGUIElement* child) virtual void addChild(IGUIElement* child)
{ {
addChildToEnd(child);
if (child) if (child)
{ {
child->grab(); // prevent destruction when removed
child->remove(); // remove from old parent
child->LastParentRect = getAbsolutePosition();
child->Parent = this;
Children.push_back(child);
child->updateAbsolutePosition(); child->updateAbsolutePosition();
} }
} }
@ -798,6 +683,20 @@ public:
return Type; return Type;
} }
//! Returns true if the gui element supports the given type.
/** This is mostly used to check if you can cast a gui element to the class that goes with the type.
Most gui elements will only support their own type, but if you derive your own classes from interfaces
you can overload this function and add a check for the type of the base-class additionally.
This allows for checks comparable to the dynamic_cast of c++ with enabled rtti.
Note that you can't do that by calling BaseClass::hasType(type), but you have to do an explicit
comparison check, because otherwise the base class usually just checks for the membervariable
Type which contains the type of your derived class.
*/
virtual bool hasType(EGUI_ELEMENT_TYPE type) const
{
return type == Type;
}
//! Returns the type name of the gui element. //! Returns the type name of the gui element.
/** This is needed serializing elements. For serializing your own elements, override this function /** This is needed serializing elements. For serializing your own elements, override this function
@ -860,6 +759,149 @@ public:
setNotClipped(in->getAttributeAsBool("NoClip")); setNotClipped(in->getAttributeAsBool("NoClip"));
} }
protected:
// not virtual because needed in constructor
void addChildToEnd(IGUIElement* child)
{
if (child)
{
child->grab(); // prevent destruction when removed
child->remove(); // remove from old parent
child->LastParentRect = getAbsolutePosition();
child->Parent = this;
Children.push_back(child);
}
}
// not virtual because needed in constructor
void recalculateAbsolutePosition(bool recursive)
{
core::rect<s32> parentAbsolute(0,0,0,0);
core::rect<s32> parentAbsoluteClip;
f32 fw=0.f, fh=0.f;
if (Parent)
{
parentAbsolute = Parent->AbsoluteRect;
if (NoClip)
{
IGUIElement* p=this;
while (p && p->Parent)
p = p->Parent;
parentAbsoluteClip = p->AbsoluteClippingRect;
}
else
parentAbsoluteClip = Parent->AbsoluteClippingRect;
}
const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
fw = (f32)parentAbsolute.getWidth();
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.X = core::round32(ScaleRect.UpperLeftCorner.X * fw);
break;
}
switch (AlignRight)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.X = core::round32(ScaleRect.LowerRightCorner.X * fw);
break;
}
switch (AlignTop)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.Y = core::round32(ScaleRect.UpperLeftCorner.Y * fh);
break;
}
switch (AlignBottom)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.Y = core::round32(ScaleRect.LowerRightCorner.Y * fh);
break;
}
RelativeRect = DesiredRect;
const s32 w = RelativeRect.getWidth();
const s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed
if (w < (s32)MinSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MinSize.Width;
if (h < (s32)MinSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MinSize.Height;
if (MaxSize.Width && w > (s32)MaxSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MaxSize.Width;
if (MaxSize.Height && h > (s32)MaxSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height;
RelativeRect.repair();
AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
if (!Parent)
parentAbsoluteClip = AbsoluteRect;
AbsoluteClippingRect = AbsoluteRect;
AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
LastParentRect = parentAbsolute;
if ( recursive )
{
// update all children
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
(*it)->recalculateAbsolutePosition(recursive);
}
}
}
protected: protected:
//! List of all children of this element //! List of all children of this element

View File

@ -15,7 +15,7 @@ namespace gui
{ {
class IGUIElement; class IGUIElement;
//! Interface making it possible to dynamicly create GUI elements //! Interface making it possible to dynamically create GUI elements
/** To be able to add custom elements to Irrlicht and to make it possible for the /** To be able to add custom elements to Irrlicht and to make it possible for the
scene manager to save and load them, simply implement this interface and register it scene manager to save and load them, simply implement this interface and register it
in your gui environment via IGUIEnvironment::registerGUIElementFactory. in your gui environment via IGUIEnvironment::registerGUIElementFactory.

View File

@ -166,6 +166,14 @@ public:
more information. */ more information. */
virtual IGUIFont* getFont(const io::path& filename) = 0; virtual IGUIFont* getFont(const io::path& filename) = 0;
//! Adds an externally loaded font to the font list.
/** This method allows to attach an already loaded font to the list of
existing fonts. The font is grabbed if non-null and adding was successful.
\param name Name the font should be stored as.
\param font Pointer to font to add.
\return Pointer to the font stored. This can differ from given parameter if the name previously existed. */
virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
//! Returns the default built-in font. //! Returns the default built-in font.
/** \return Pointer to the default built-in font. /** \return Pointer to the default built-in font.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
@ -201,7 +209,7 @@ public:
\param id Id with which the gui element can be identified. \param id Id with which the gui element can be identified.
\param text Text displayed on the button. \param text Text displayed on the button.
\param tooltiptext Text displayed in the tooltip. \param tooltiptext Text displayed in the tooltip.
\return Pointer to the created button. Returns 0 if an error occured. \return Pointer to the created button. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUIButton* addButton(const core::rect<s32>& rectangle, virtual IGUIButton* addButton(const core::rect<s32>& rectangle,
@ -215,7 +223,7 @@ public:
\param text Text displayed as the window title. \param text Text displayed as the window title.
\param parent Parent gui element of the window. \param parent Parent gui element of the window.
\param id Id with which the gui element can be identified. \param id Id with which the gui element can be identified.
\return Pointer to the created window. Returns 0 if an error occured. \return Pointer to the created window. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false, virtual IGUIWindow* addWindow(const core::rect<s32>& rectangle, bool modal = false,
@ -225,7 +233,7 @@ public:
/** This control stops its parent's members from being able to receive /** This control stops its parent's members from being able to receive
input until its last child is removed, it then deletes itself. input until its last child is removed, it then deletes itself.
\param parent Parent gui element of the modal. \param parent Parent gui element of the modal.
\return Pointer to the created modal. Returns 0 if an error occured. \return Pointer to the created modal. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0; virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
@ -243,7 +251,7 @@ public:
\param id Id with which the gui element can be identified. \param id Id with which the gui element can be identified.
\param image Optional texture which will be displayed beside the text as an image \param image Optional texture which will be displayed beside the text as an image
\return Pointer to the created message box. Returns 0 if an error \return Pointer to the created message box. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0, virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0; bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
@ -255,7 +263,7 @@ public:
\param parent Parent gui element of the scroll bar. \param parent Parent gui element of the scroll bar.
\param id Id to identify the gui element. \param id Id to identify the gui element.
\return Pointer to the created scrollbar. Returns 0 if an error \return Pointer to the created scrollbar. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle, virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
@ -270,7 +278,7 @@ public:
\param id Id to identify the gui element. \param id Id to identify the gui element.
\param text Title text of the image. \param text Title text of the image.
\return Pointer to the created image element. Returns 0 if an error \return Pointer to the created image element. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos, virtual IGUIImage* addImage(video::ITexture* image, core::position2d<s32> pos,
bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
@ -282,7 +290,7 @@ public:
\param id Id to identify the gui element. \param id Id to identify the gui element.
\param text Title text of the image. \param text Title text of the image.
\return Pointer to the created image element. Returns 0 if an error \return Pointer to the created image element. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIImage* addImage(const core::rect<s32>& rectangle, virtual IGUIImage* addImage(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
@ -294,7 +302,7 @@ public:
\param id Id to identify the gui element. \param id Id to identify the gui element.
\param text Title text of the check box. \param text Title text of the check box.
\return Pointer to the created check box. Returns 0 if an error \return Pointer to the created check box. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle, virtual IGUICheckBox* addCheckBox(bool checked, const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
@ -304,7 +312,7 @@ public:
\param parent Parent gui element of the list box. \param parent Parent gui element of the list box.
\param id Id to identify the gui element. \param id Id to identify the gui element.
\param drawBackground Flag whether the background should be drawn. \param drawBackground Flag whether the background should be drawn.
\return Pointer to the created list box. Returns 0 if an error occured. \return Pointer to the created list box. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle, virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
@ -317,7 +325,7 @@ public:
\param drawBackground Flag whether the background should be drawn. \param drawBackground Flag whether the background should be drawn.
\param scrollBarVertical Flag whether a vertical scrollbar should be used \param scrollBarVertical Flag whether a vertical scrollbar should be used
\param scrollBarHorizontal Flag whether a horizontal scrollbar should be used \param scrollBarHorizontal Flag whether a horizontal scrollbar should be used
\return Pointer to the created list box. Returns 0 if an error occured. \return Pointer to the created list box. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle, virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
@ -330,7 +338,7 @@ public:
\param id Id to identify the gui element. \param id Id to identify the gui element.
\param text Title text of the mesh viewer. \param text Title text of the mesh viewer.
\return Pointer to the created mesh viewer. Returns 0 if an error \return Pointer to the created mesh viewer. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle, virtual IGUIMeshViewer* addMeshViewer(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0;
@ -343,7 +351,7 @@ public:
\param parent Parent gui element of the dialog. \param parent Parent gui element of the dialog.
\param id Id to identify the gui element. \param id Id to identify the gui element.
\return Pointer to the created file open dialog. Returns 0 if an error \return Pointer to the created file open dialog. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0, virtual IGUIFileOpenDialog* addFileOpenDialog(const wchar_t* title = 0,
bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0; bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
@ -356,7 +364,7 @@ public:
\param parent The parent of the dialog. \param parent The parent of the dialog.
\param id The ID of the dialog. \param id The ID of the dialog.
\return Pointer to the created file open dialog. Returns 0 if an error \return Pointer to the created file open dialog. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0, virtual IGUIColorSelectDialog* addColorSelectDialog(const wchar_t* title = 0,
bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0; bool modal=true, IGUIElement* parent=0, s32 id=-1) = 0;
@ -371,7 +379,7 @@ public:
\param fillBackground Enable if the background shall be filled. \param fillBackground Enable if the background shall be filled.
Defaults to false. Defaults to false.
\return Pointer to the created static text. Returns 0 if an error \return Pointer to the created static text. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle, virtual IGUIStaticText* addStaticText(const wchar_t* text, const core::rect<s32>& rectangle,
bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1, bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1,
@ -389,7 +397,7 @@ public:
\param parent Parent item of the element, e.g. a window. \param parent Parent item of the element, e.g. a window.
Set it to 0 to place the edit box directly in the environment. Set it to 0 to place the edit box directly in the environment.
\param id The ID of the element. \param id The ID of the element.
\return Pointer to the created edit box. Returns 0 if an error occured. \return Pointer to the created edit box. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle, virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect<s32>& rectangle,
@ -403,7 +411,7 @@ public:
\param parent Parent item of the element, e.g. a window. \param parent Parent item of the element, e.g. a window.
Set it to 0 to place the spin box directly in the environment. Set it to 0 to place the spin box directly in the environment.
\param id The ID of the element. \param id The ID of the element.
\return Pointer to the created spin box. Returns 0 if an error occured. \return Pointer to the created spin box. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle, virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
@ -415,7 +423,7 @@ public:
\param parent Parent item of the element, e.g. a window. \param parent Parent item of the element, e.g. a window.
\param id An identifier for the fader. \param id An identifier for the fader.
\return Pointer to the created in-out-fader. Returns 0 if an error \return Pointer to the created in-out-fader. Returns 0 if an error
occured. This pointer should not be dropped. See occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0; virtual IGUIInOutFader* addInOutFader(const core::rect<s32>* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0;
@ -430,7 +438,7 @@ public:
the environment without a window as parent. the environment without a window as parent.
\param id An identifier for the tab control. \param id An identifier for the tab control.
\return Pointer to the created tab control element. Returns 0 if an \return Pointer to the created tab control element. Returns 0 if an
error occured. This pointer should not be dropped. See error occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle, virtual IGUITabControl* addTabControl(const core::rect<s32>& rectangle,
IGUIElement* parent=0, bool fillbackground=false, IGUIElement* parent=0, bool fillbackground=false,
@ -445,7 +453,7 @@ public:
Set it to 0 to place the tab directly in the environment. Set it to 0 to place the tab directly in the environment.
\param id An identifier for the tab. \param id An identifier for the tab.
\return Pointer to the created tab. Returns 0 if an \return Pointer to the created tab. Returns 0 if an
error occured. This pointer should not be dropped. See error occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUITab* addTab(const core::rect<s32>& rectangle, virtual IGUITab* addTab(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
@ -457,7 +465,7 @@ public:
Set it to 0 to place the menu directly in the environment. Set it to 0 to place the menu directly in the environment.
\param id An identifier for the menu. \param id An identifier for the menu.
\return Pointer to the created context menu. Returns 0 if an \return Pointer to the created context menu. Returns 0 if an
error occured. This pointer should not be dropped. See error occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle, virtual IGUIContextMenu* addContextMenu(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
@ -469,7 +477,7 @@ public:
Set it to 0 to place the menu directly in the environment. Set it to 0 to place the menu directly in the environment.
\param id An identifier for the menu. \param id An identifier for the menu.
\return Pointer to the created menu. Returns 0 if an \return Pointer to the created menu. Returns 0 if an
error occured. This pointer should not be dropped. See error occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0; virtual IGUIContextMenu* addMenu(IGUIElement* parent=0, s32 id=-1) = 0;
@ -480,7 +488,7 @@ public:
Set it to 0 to place the tool bar directly in the environment. Set it to 0 to place the tool bar directly in the environment.
\param id An identifier for the tool bar. \param id An identifier for the tool bar.
\return Pointer to the created tool bar. Returns 0 if an \return Pointer to the created tool bar. Returns 0 if an
error occured. This pointer should not be dropped. See error occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0; virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0;
@ -490,7 +498,7 @@ public:
Set it to 0 to place the combo box directly in the environment. Set it to 0 to place the combo box directly in the environment.
\param id An identifier for the combo box. \param id An identifier for the combo box.
\return Pointer to the created combo box. Returns 0 if an \return Pointer to the created combo box. Returns 0 if an
error occured. This pointer should not be dropped. See error occurred. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */ IReferenceCounted::drop() for more information. */
virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle, virtual IGUIComboBox* addComboBox(const core::rect<s32>& rectangle,
IGUIElement* parent=0, s32 id=-1) = 0; IGUIElement* parent=0, s32 id=-1) = 0;
@ -501,7 +509,7 @@ public:
to place the element directly in the environment. to place the element directly in the environment.
\param id An identifier for the table. \param id An identifier for the table.
\param drawBackground Flag whether the background should be drawn. \param drawBackground Flag whether the background should be drawn.
\return Pointer to the created table. Returns 0 if an error occured. \return Pointer to the created table. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */ more information. */
virtual IGUITable* addTable(const core::rect<s32>& rectangle, virtual IGUITable* addTable(const core::rect<s32>& rectangle,

View File

@ -44,7 +44,7 @@ public:
/** \param text: Text to draw /** \param text: Text to draw
\param position: Rectangle specifying position where to draw the text. \param position: Rectangle specifying position where to draw the text.
\param color: Color of the text \param color: Color of the text
\param hcenter: Specifiies if the text should be centered horizontally into the rectangle. \param hcenter: Specifies if the text should be centered horizontally into the rectangle.
\param vcenter: Specifies if the text should be centered vertically into the rectangle. \param vcenter: Specifies if the text should be centered vertically into the rectangle.
\param clip: Optional pointer to a rectangle against which the text will be clipped. \param clip: Optional pointer to a rectangle against which the text will be clipped.
If the pointer is null, no clipping will be done. */ If the pointer is null, no clipping will be done. */

View File

@ -26,8 +26,8 @@ public:
//! \param destPos: Position of the image to draw //! \param destPos: Position of the image to draw
//! \param clip: Optional pointer to a rectalgle against which the text will be clipped. //! \param clip: Optional pointer to a rectalgle against which the text will be clipped.
//! If the pointer is null, no clipping will be done. //! If the pointer is null, no clipping will be done.
virtual void draw( s32 index, const core::position2d<s32>& destPos, virtual void draw(s32 index, const core::position2d<s32>& destPos,
const core::rect<s32>* clip = 0 ) = 0; const core::rect<s32>* clip = 0) = 0;
//! Returns the count of Images in the list. //! Returns the count of Images in the list.
//! \return Returns the count of Images in the list. //! \return Returns the count of Images in the list.

View File

@ -44,14 +44,14 @@ namespace gui
/** In the beginning the whole rect is drawn by the set color /** In the beginning the whole rect is drawn by the set color
(black by default) and at the end of the overgiven time the (black by default) and at the end of the overgiven time the
color has faded out. color has faded out.
\param time: Time specifing how long it should need to fade in, \param time: Time specifying how long it should need to fade in,
in milliseconds. */ in milliseconds. */
virtual void fadeIn(u32 time) = 0; virtual void fadeIn(u32 time) = 0;
//! Starts the fade out process. //! Starts the fade out process.
/** In the beginning everything is visible, and at the end of /** In the beginning everything is visible, and at the end of
the time only the set color (black by the fault) will be drawn. the time only the set color (black by the fault) will be drawn.
\param time: Time specifing how long it should need to fade out, \param time: Time specifying how long it should need to fade out,
in milliseconds. */ in milliseconds. */
virtual void fadeOut(u32 time) = 0; virtual void fadeOut(u32 time) = 0;

View File

@ -118,8 +118,8 @@ namespace gui
//! set global itemHeight //! set global itemHeight
virtual void setItemHeight( s32 height ) = 0; virtual void setItemHeight( s32 height ) = 0;
//! Sets whether to draw the background //! Sets whether to draw the background
virtual void setDrawBackground(bool draw) = 0; virtual void setDrawBackground(bool draw) = 0;
}; };

View File

@ -38,7 +38,7 @@ namespace gui
//! An unknown skin, not serializable at present //! An unknown skin, not serializable at present
EGST_UNKNOWN, EGST_UNKNOWN,
//! this value is not used, it only specifies the number of skin types //! this value is not used, it only specifies the number of skin types
EGST_COUNT EGST_COUNT
}; };
@ -448,11 +448,16 @@ namespace gui
\param drawTitleBar: True to enable title drawing. \param drawTitleBar: True to enable title drawing.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. \param clip: Clip area.
\return Returns rect where it would be good to draw title bar text. */ \param checkClientArea: When set to non-null the function will not draw anything,
but will instead return the clientArea which can be used for drawing by the calling window.
That is the area without borders and without titlebar.
\return Returns rect where it would be good to draw title bar text. This will
work even when checkClientArea is set to a non-null value.*/
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element, virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor, bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) = 0; const core::rect<s32>* clip=0,
core::rect<s32>* checkClientArea=0) = 0;
//! draws a standard 3d menu pane //! draws a standard 3d menu pane
/** Used for drawing for menus and context menus. /** Used for drawing for menus and context menus.

View File

@ -39,6 +39,9 @@ struct SGUISprite
//! Sprite bank interface. //! Sprite bank interface.
/** See http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=25742&highlight=spritebank
* for more information how to use the spritebank.
*/
class IGUISpriteBank : public virtual IReferenceCounted class IGUISpriteBank : public virtual IReferenceCounted
{ {
public: public:
@ -61,6 +64,14 @@ public:
//! Changes one of the textures in the sprite bank //! Changes one of the textures in the sprite bank
virtual void setTexture(u32 index, video::ITexture* texture) = 0; virtual void setTexture(u32 index, video::ITexture* texture) = 0;
//! Add the texture and use it for a single non-animated sprite.
//! The texture and the corresponding rectangle and sprite will all be added to the end of each array.
//! returns the index of the sprite or -1 on failure
virtual s32 addTextureAsSprite(video::ITexture* texture) = 0;
//! clears sprites, rectangles and textures
virtual void clear() = 0;
//! Draws a sprite in 2d with position and color //! Draws a sprite in 2d with position and color
virtual void draw2DSprite(u32 index, const core::position2di& pos, virtual void draw2DSprite(u32 index, const core::position2di& pos,
const core::rect<s32>* clip=0, const core::rect<s32>* clip=0,

View File

@ -13,7 +13,8 @@ namespace irr
{ {
namespace gui namespace gui
{ {
//! A tab, onto which other gui elements could be added. //! A tab-page, onto which other gui elements could be added.
/** IGUITab refers to the page itself, not to the tab in the tabbar of an IGUITabControl. */
class IGUITab : public IGUIElement class IGUITab : public IGUIElement
{ {
public: public:
@ -88,10 +89,10 @@ namespace gui
//! set the maximal width of a tab. Per default width is 0 which means "no width restriction". //! set the maximal width of a tab. Per default width is 0 which means "no width restriction".
virtual void setTabMaxWidth(s32 width ) = 0; virtual void setTabMaxWidth(s32 width ) = 0;
//! get the maximal width of a tab //! get the maximal width of a tab
virtual s32 getTabMaxWidth() const = 0; virtual s32 getTabMaxWidth() const = 0;
//! Set the alignment of the tabs //! Set the alignment of the tabs
/** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */ /** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */
virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0; virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0;

View File

@ -139,7 +139,7 @@ namespace gui
will be placed after it. If the row is larger than the actual will be placed after it. If the row is larger than the actual
number of row by more than one, it won't be created. Note that number of row by more than one, it won't be created. Note that
if you create a row that's not at the end, there might be if you create a row that's not at the end, there might be
performance issues. performance issues.
\return index of inserted row. */ \return index of inserted row. */
virtual u32 addRow(u32 rowIndex) = 0; virtual u32 addRow(u32 rowIndex) = 0;

View File

@ -20,16 +20,10 @@ namespace gui
class IGUITreeViewNode : public IReferenceCounted class IGUITreeViewNode : public IReferenceCounted
{ {
public: public:
//! constructor
IGUITreeViewNode() {}
//! destructor
virtual ~IGUITreeViewNode() {}
//! returns the owner (tree view) of this node //! returns the owner (tree view) of this node
virtual IGUITreeView* getOwner() const = 0; virtual IGUITreeView* getOwner() const = 0;
//! Returns the parent node of this node. //! Returns the parent node of this node.
/** For the root node this will return 0. */ /** For the root node this will return 0. */
virtual IGUITreeViewNode* getParent() const = 0; virtual IGUITreeViewNode* getParent() const = 0;
@ -87,13 +81,10 @@ namespace gui
\param data2 user data2 (IReferenceCounted*) of the new node \param data2 user data2 (IReferenceCounted*) of the new node
\return The new node \return The new node
*/ */
virtual IGUITreeViewNode* addChildBack( virtual IGUITreeViewNode* addChildBack(
const wchar_t* text, const wchar_t* text, const wchar_t* icon = 0,
const wchar_t* icon = 0, s32 imageIndex=-1, s32 selectedImageIndex=-1,
s32 imageIndex = -1, void* data=0, IReferenceCounted* data2=0) =0;
s32 selectedImageIndex = -1,
void* data = 0,
IReferenceCounted* data2 = 0 ) = 0;
//! Adds a new node before the first child node. //! Adds a new node before the first child node.
/** \param text text of the new node /** \param text text of the new node
@ -104,15 +95,12 @@ namespace gui
\param data2 user data2 (IReferenceCounted*) of the new node \param data2 user data2 (IReferenceCounted*) of the new node
\return The new node \return The new node
*/ */
virtual IGUITreeViewNode* addChildFront( virtual IGUITreeViewNode* addChildFront(
const wchar_t* text, const wchar_t* text, const wchar_t* icon = 0,
const wchar_t* icon = 0, s32 imageIndex=-1, s32 selectedImageIndex=-1,
s32 imageIndex = -1, void* data=0, IReferenceCounted* data2=0 ) =0;
s32 selectedImageIndex = -1,
void* data = 0,
IReferenceCounted* data2 = 0 ) = 0;
//! Adds a new node behind the other node. //! Adds a new node behind the other node.
/** The other node has also te be a child node from this node. /** The other node has also te be a child node from this node.
\param other Node to insert after \param other Node to insert after
\param text text of the new node \param text text of the new node
@ -123,16 +111,13 @@ namespace gui
\param data2 user data2 (IReferenceCounted*) of the new node \param data2 user data2 (IReferenceCounted*) of the new node
\return The new node or 0 if other is no child node from this \return The new node or 0 if other is no child node from this
*/ */
virtual IGUITreeViewNode* insertChildAfter( virtual IGUITreeViewNode* insertChildAfter(
IGUITreeViewNode* other, IGUITreeViewNode* other,
const wchar_t* text, const wchar_t* text, const wchar_t* icon = 0,
const wchar_t* icon = 0, s32 imageIndex=-1, s32 selectedImageIndex=-1,
s32 imageIndex = -1, void* data=0, IReferenceCounted* data2=0) =0;
s32 selectedImageIndex = -1,
void* data = 0,
IReferenceCounted* data2 = 0 ) = 0;
//! Adds a new node before the other node. //! Adds a new node before the other node.
/** The other node has also te be a child node from this node. /** The other node has also te be a child node from this node.
\param other Node to insert before \param other Node to insert before
\param text text of the new node \param text text of the new node
@ -143,14 +128,11 @@ namespace gui
\param data2 user data2 (IReferenceCounted*) of the new node \param data2 user data2 (IReferenceCounted*) of the new node
\return The new node or 0 if other is no child node from this \return The new node or 0 if other is no child node from this
*/ */
virtual IGUITreeViewNode* insertChildBefore( virtual IGUITreeViewNode* insertChildBefore(
IGUITreeViewNode* other, IGUITreeViewNode* other,
const wchar_t* text, const wchar_t* text, const wchar_t* icon = 0,
const wchar_t* icon = 0, s32 imageIndex=-1, s32 selectedImageIndex=-1,
s32 imageIndex = -1, void* data=0, IReferenceCounted* data2=0) = 0;
s32 selectedImageIndex = -1,
void* data = 0,
IReferenceCounted* data2 = 0 ) = 0;
//! Return the first child node from this node. //! Return the first child node from this node.
/** \return The first child node or 0 if this node has no childs. */ /** \return The first child node or 0 if this node has no childs. */
@ -214,21 +196,17 @@ namespace gui
//! Default tree view GUI element. //! Default tree view GUI element.
/** Displays a windows like tree buttons to expand/collaps the child nodes of an node /** Displays a windows like tree buttons to expand/collaps the child
and optional tree lines. nodes of an node and optional tree lines. Each node consits of an
Each node consits of an text, an icon text and a void pointer for user data. text, an icon text and a void pointer for user data. */
*/
class IGUITreeView : public IGUIElement class IGUITreeView : public IGUIElement
{ {
public: public:
//! constructor //! constructor
IGUITreeView( IGUIEnvironment* environment, IGUIElement* parent, s32 id, IGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
core::rect<s32> rectangle ) s32 id, core::rect<s32> rectangle)
: IGUIElement( EGUIET_TREE_VIEW, environment, parent, id, rectangle ) {} : IGUIElement( EGUIET_TREE_VIEW, environment, parent, id, rectangle ) {}
//! destructor
virtual ~IGUITreeView() {}
//! returns the root node (not visible) from the tree. //! returns the root node (not visible) from the tree.
virtual IGUITreeViewNode* getRoot() const = 0; virtual IGUITreeViewNode* getRoot() const = 0;

View File

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

View File

@ -35,7 +35,7 @@ public:
//! Create a pseudo-random mesh representing a hilly terrain. //! Create a pseudo-random mesh representing a hilly terrain.
/** /**
\param tileSize The size of each time. \param tileSize The size of each tile.
\param tileCount The number of tiles in each dimension. \param tileCount The number of tiles in each dimension.
\param material The material to apply to the mesh. \param material The material to apply to the mesh.
\param hillHeight The maximum height of the hills. \param hillHeight The maximum height of the hills.
@ -50,6 +50,23 @@ public:
const core::dimension2d<f32>& countHills, const core::dimension2d<f32>& countHills,
const core::dimension2d<f32>& textureRepeatCount) const =0; const core::dimension2d<f32>& textureRepeatCount) const =0;
//! Create a simple rectangular textured plane mesh.
/**
\param tileSize The size of each tile.
\param tileCount The number of tiles in each dimension.
\param material The material to apply to the mesh.
\param textureRepeatCount The number of times to repeat the material texture along each dimension.
\return Generated mesh.
*/
IMesh* createPlaneMesh(
const core::dimension2d<f32>& tileSize,
const core::dimension2d<u32>& tileCount,
video::SMaterial* material,
const core::dimension2d<f32>& textureRepeatCount) const
{
return createHillPlaneMesh(tileSize, tileCount, material, 0.f, core::dimension2df(), textureRepeatCount);
}
//! Create a terrain mesh from an image representing a heightfield. //! Create a terrain mesh from an image representing a heightfield.
/** /**
\param texture The texture to apply to the terrain. \param texture The texture to apply to the terrain.

View File

@ -5,7 +5,6 @@
#ifndef __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__ #ifndef __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__
#define __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__ #define __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__
#include "IReferenceCounted.h"
#include "SMaterial.h" #include "SMaterial.h"
#include "S3DVertex.h" #include "S3DVertex.h"

View File

@ -11,51 +11,12 @@
#include "S3DVertex.h" #include "S3DVertex.h"
#include "SVertexIndex.h" #include "SVertexIndex.h"
#include "EHardwareBufferFlags.h" #include "EHardwareBufferFlags.h"
#include "EPrimitiveTypes.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
//! Enumeration for all primitive types there are.
enum E_PRIMITIVE_TYPE
{
//! All vertices are non-connected points.
EPT_POINTS=0,
//! All vertices form a single connected line.
EPT_LINE_STRIP,
//! Just as LINE_STRIP, but the last and the first vertex is also connected.
EPT_LINE_LOOP,
//! Every two vertices are connected creating n/2 lines.
EPT_LINES,
//! After the first two vertices each vertex defines a new triangle.
//! Always the two last and the new one form a new triangle.
EPT_TRIANGLE_STRIP,
//! After the first two vertices each vertex defines a new triangle.
//! All around the common first vertex.
EPT_TRIANGLE_FAN,
//! Explicitly set all vertices for each triangle.
EPT_TRIANGLES,
//! After the first two vertices each further tw vetices create a quad with the preceding two.
EPT_QUAD_STRIP,
//! Every four vertices create a quad.
EPT_QUADS,
//! Just as LINE_LOOP, but filled.
EPT_POLYGON,
//! The single vertices are expanded to quad billboards on the GPU.
EPT_POINT_SPRITES
};
//! Struct for holding a mesh with a single material. //! Struct for holding a mesh with a single material.
/** A part of an IMesh which has the same material on each face of that /** A part of an IMesh which has the same material on each face of that
group. Logical groups of an IMesh need not be put into separate mesh group. Logical groups of an IMesh need not be put into separate mesh

View File

@ -42,12 +42,12 @@ namespace scene
with one call. They can add additional meshes with this method with one call. They can add additional meshes with this method
to the scene manager. The COLLADA loader for example uses this to the scene manager. The COLLADA loader for example uses this
method. method.
\param filename Filename of the mesh. When calling \param name Name of the mesh. When calling
ISceneManager::getMesh() with this name it will return the mesh ISceneManager::getMesh() with this name it will return the mesh
set by this method. set by this method.
\param mesh Pointer to a mesh which will now be referenced by \param mesh Pointer to a mesh which will now be referenced by
this name. */ this name. */
virtual void addMesh(const io::path& filename, IAnimatedMesh* mesh) = 0; virtual void addMesh(const io::path& name, IAnimatedMesh* mesh) = 0;
//! Removes a mesh from the cache. //! Removes a mesh from the cache.
/** After loading a mesh with getMesh(), the mesh can be /** After loading a mesh with getMesh(), the mesh can be
@ -67,7 +67,7 @@ namespace scene
/** You can load new meshes into the cache using getMesh() and /** You can load new meshes into the cache using getMesh() and
addMesh(). If you ever need to access the internal mesh cache, addMesh(). If you ever need to access the internal mesh cache,
you can do this using removeMesh(), getMeshNumber(), you can do this using removeMesh(), getMeshNumber(),
getMeshByIndex() and getMeshFilename(). getMeshByIndex() and getMeshName().
\return Number of meshes in cache. */ \return Number of meshes in cache. */
virtual u32 getMeshCount() const = 0; virtual u32 getMeshCount() const = 0;
@ -90,60 +90,106 @@ namespace scene
number. */ number. */
virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0; virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0;
//! Returns a mesh based on its filename. //! Returns a mesh based on its name (often a filename).
/** \param filename Name of the mesh. /** \deprecated Use getMeshByName() instead. */
_IRR_DEPRECATED_ IAnimatedMesh* getMeshByFilename(const io::path& filename)
{
return getMeshByName(filename);
}
//! Get the name of a loaded mesh, based on its index. (Name is often identical to the filename).
/** \deprecated Use getMeshName() instead. */
_IRR_DEPRECATED_ const io::path& getMeshFilename(u32 index) const
{
return getMeshName(index).getInternalName();
}
//! Get the name of a loaded mesh, if there is any. (Name is often identical to the filename).
/** \deprecated Use getMeshName() instead. */
_IRR_DEPRECATED_ const io::path& getMeshFilename(const IAnimatedMesh* const mesh) const
{
return getMeshName(mesh).getInternalName();
}
//! Get the name of a loaded mesh, if there is any. (Name is often identical to the filename).
/** \deprecated Use getMeshName() instead. */
_IRR_DEPRECATED_ const io::path& getMeshFilename(const IMesh* const mesh) const
{
return getMeshName(mesh).getInternalName();
}
//! Renames a loaded mesh.
/** \deprecated Use renameMesh() instead. */
_IRR_DEPRECATED_ bool setMeshFilename(u32 index, const io::path& filename)
{
return renameMesh(index, filename);
}
//! Renames a loaded mesh.
/** \deprecated Use renameMesh() instead. */
_IRR_DEPRECATED_ bool setMeshFilename(const IAnimatedMesh* const mesh, const io::path& filename)
{
return renameMesh(mesh, filename);
}
//! Renames a loaded mesh.
/** \deprecated Use renameMesh() instead. */
_IRR_DEPRECATED_ bool setMeshFilename(const IMesh* const mesh, const io::path& filename)
{
return renameMesh(mesh, filename);
}
//! Returns a mesh based on its name.
/** \param name Name of the mesh. Usually a filename.
\return Pointer to the mesh or 0 if there is none with this number. */ \return Pointer to the mesh or 0 if there is none with this number. */
virtual IAnimatedMesh* getMeshByFilename(const io::path& filename) = 0; virtual IAnimatedMesh* getMeshByName(const io::path& name) = 0;
//! Get the filename of a loaded mesh, based on its index. //! Get the name of a loaded mesh, based on its index.
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1. /** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
\return String with name if mesh was found and has a name, else \return The name if mesh was found and has a name, else the path is empty. */
0. */ virtual const io::SNamedPath& getMeshName(u32 index) const = 0;
virtual const io::path& getMeshFilename(u32 index) const = 0;
//! Get the filename of a loaded mesh, if there is any. //! Get the name of a loaded mesh, if there is any.
/** \param mesh Pointer to mesh to query. /** \param mesh Pointer to mesh to query.
\return String with name if mesh was found and has a name, else \return The name if mesh was found and has a name, else the path is empty. */
0. */ virtual const io::SNamedPath& getMeshName(const IAnimatedMesh* const mesh) const = 0;
virtual const io::path& getMeshFilename(const IAnimatedMesh* const mesh) const = 0;
//! Get the filename of a loaded mesh, if there is any. //! Get the name of a loaded mesh, if there is any.
/** \param mesh Pointer to mesh to query. /** \param mesh Pointer to mesh to query.
\return String with name if mesh was found and has a name, else \return The name if mesh was found and has a name, else the path is empty. */
0. */ virtual const io::SNamedPath& getMeshName(const IMesh* const mesh) const = 0;
virtual const io::path& getMeshFilename(const IMesh* const mesh) const = 0;
//! Renames a loaded mesh. //! Renames a loaded mesh.
/** Note that renaming meshes might change the ordering of the /** Note that renaming meshes might change the ordering of the
meshes, and so the index of the meshes as returned by meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. getMeshIndex() or taken by some methods will change.
\param index The index of the mesh in the cache. \param index The index of the mesh in the cache.
\param filename New name for the mesh. \param name New name for the mesh.
\return True if mesh was renamed. */ \return True if mesh was renamed. */
virtual bool setMeshFilename(u32 index, const io::path& filename) = 0; virtual bool renameMesh(u32 index, const io::path& name) = 0;
//! Renames a loaded mesh. //! Renames a loaded mesh.
/** Note that renaming meshes might change the ordering of the /** Note that renaming meshes might change the ordering of the
meshes, and so the index of the meshes as returned by meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. getMeshIndex() or taken by some methods will change.
\param mesh Mesh to be renamed. \param mesh Mesh to be renamed.
\param filename New name for the mesh. \param name New name for the mesh.
\return True if mesh was renamed. */ \return True if mesh was renamed. */
virtual bool setMeshFilename(const IAnimatedMesh* const mesh, const io::path& filename) = 0; virtual bool renameMesh(const IAnimatedMesh* const mesh, const io::path& name) = 0;
//! Renames a loaded mesh. //! Renames a loaded mesh.
/** Note that renaming meshes might change the ordering of the /** Note that renaming meshes might change the ordering of the
meshes, and so the index of the meshes as returned by meshes, and so the index of the meshes as returned by
getMeshIndex() or taken by some methods will change. getMeshIndex() or taken by some methods will change.
\param mesh Mesh to be renamed. \param mesh Mesh to be renamed.
\param filename New name for the mesh. \param name New name for the mesh.
\return True if mesh was renamed. */ \return True if mesh was renamed. */
virtual bool setMeshFilename(const IMesh* const mesh, const io::path& filename) = 0; virtual bool renameMesh(const IMesh* const mesh, const io::path& name) = 0;
//! Check if a mesh was already loaded. //! Check if a mesh was already loaded.
/** \param filename Name of the mesh. /** \param name Name of the mesh. Usually a filename.
\return True if the mesh has been loaded, else false. */ \return True if the mesh has been loaded, else false. */
virtual bool isMeshLoaded(const io::path& filename) = 0; virtual bool isMeshLoaded(const io::path& name) = 0;
//! Clears the whole mesh cache, removing all meshes. //! Clears the whole mesh cache, removing all meshes.
/** All meshes will be reloaded completely when using ISceneManager::getMesh() /** All meshes will be reloaded completely when using ISceneManager::getMesh()

View File

@ -259,9 +259,9 @@ namespace scene
if (boundingBoxUpdate) if (boundingBoxUpdate)
{ {
if (0==i) if (0==i)
bufferbox.reset(mesh->getBoundingBox()); bufferbox.reset(mesh->getMeshBuffer(i)->getBoundingBox());
else else
bufferbox.addInternalBox(mesh->getBoundingBox()); bufferbox.addInternalBox(mesh->getMeshBuffer(i)->getBoundingBox());
} }
} }
if (boundingBoxUpdate) if (boundingBoxUpdate)

View File

@ -782,7 +782,7 @@ namespace quake3
textures.clear(); textures.clear();
core::stringc loadFile; io::path loadFile;
for ( u32 i = 0; i!= stringList.size (); ++i ) for ( u32 i = 0; i!= stringList.size (); ++i )
{ {
video::ITexture* texture = 0; video::ITexture* texture = 0;

View File

@ -25,14 +25,14 @@ namespace scene
{ {
public: public:
//! Finds the collision point of a line and lots of triangles, if there is one. //! Finds the nearest collision point of a line and lots of triangles, if there is one.
/** \param ray: Line with which collisions are tested. /** \param ray: Line with which collisions are tested.
\param selector: TriangleSelector containing the triangles. It \param selector: TriangleSelector containing the triangles. It
can be created for example using can be created for example using
ISceneManager::createTriangleSelector() or ISceneManager::createTriangleSelector() or
ISceneManager::createTriangleOctTreeSelector(). ISceneManager::createTriangleOctreeSelector().
\param outCollisionPoint: If a collision is detected, this will \param outCollisionPoint: If a collision is detected, this will
contain the position of the nearest collision. contain the position of the nearest collision to the line-start.
\param outTriangle: If a collision is detected, this will \param outTriangle: If a collision is detected, this will
contain the triangle with which the ray collided. contain the triangle with which the ray collided.
\param outNode: If a collision is detected, this will contain \param outNode: If a collision is detected, this will contain
@ -51,7 +51,7 @@ namespace scene
\param selector: TriangleSelector containing the triangles of \param selector: TriangleSelector containing the triangles of
the world. It can be created for example using the world. It can be created for example using
ISceneManager::createTriangleSelector() or ISceneManager::createTriangleSelector() or
ISceneManager::createTriangleOctTreeSelector(). ISceneManager::createTriangleOctreeSelector().
\param ellipsoidPosition: Position of the ellipsoid. \param ellipsoidPosition: Position of the ellipsoid.
\param ellipsoidRadius: Radius of the ellipsoid. \param ellipsoidRadius: Radius of the ellipsoid.
\param ellipsoidDirectionAndSpeed: Direction and speed of the \param ellipsoidDirectionAndSpeed: Direction and speed of the
@ -143,8 +143,8 @@ namespace scene
against this ray. The collision tests are done using a bounding against this ray. The collision tests are done using a bounding
box for each scene node. box for each scene node.
\param camera: Camera from which the ray is casted. \param camera: Camera from which the ray is casted.
\param idBitMask: Only scene nodes with an id which matches at least one of the \param idBitMask: Only scene nodes with an id which matches at least one of the
bits contained in this mask will be tested. However, if this parameter is 0, then bits contained in this mask will be tested. However, if this parameter is 0, then
all nodes are checked. all nodes are checked.
feature is disabled. feature is disabled.
Please note that the default node id of -1 will match with Please note that the default node id of -1 will match with
@ -158,33 +158,33 @@ namespace scene
s32 idBitMask=0, bool bNoDebugObjects = false) = 0; s32 idBitMask=0, bool bNoDebugObjects = false) = 0;
//! Perform a ray/box and ray/triangle collision check on a heirarchy of scene nodes. //! Perform a ray/box and ray/triangle collision check on a heirarchy of scene nodes.
/** This checks all scene nodes under the specified one, first by ray/bounding /** This checks all scene nodes under the specified one, first by ray/bounding
box, and then by accurate ray/triangle collision, finding the nearest collision, box, and then by accurate ray/triangle collision, finding the nearest collision,
and the scene node containg it. It returns the node hit, and (via output and the scene node containg it. It returns the node hit, and (via output
parameters) the position of the collision, and the triangle that was hit. parameters) the position of the collision, and the triangle that was hit.
All scene nodes in the hierarchy tree under the specified node are checked. Only All scene nodes in the hierarchy tree under the specified node are checked. Only
notes that are visible, with an ID that matches at least one bit in the supplied notes that are visible, with an ID that matches at least one bit in the supplied
bitmask, and which have a triangle selector are considered as candidates for being hit. bitmask, and which have a triangle selector are considered as candidates for being hit.
You do not have to build a meta triangle selector; the individual triangle selectors You do not have to build a meta triangle selector; the individual triangle selectors
of each candidate scene node are used automatically. of each candidate scene node are used automatically.
\param ray: Line with which collisions are tested. \param ray: Line with which collisions are tested.
\param outCollisionPoint: If a collision is detected, this will contain the \param outCollisionPoint: If a collision is detected, this will contain the
position of the nearest collision. position of the nearest collision.
\param outTriangle: If a collision is detected, this will contain the triangle \param outTriangle: If a collision is detected, this will contain the triangle
with which the ray collided. with which the ray collided.
\param idBitMask: Only scene nodes with an id which matches at least one of the \param idBitMask: Only scene nodes with an id which matches at least one of the
bits contained in this mask will be tested. However, if this parameter is 0, then bits contained in this mask will be tested. However, if this parameter is 0, then
all nodes are checked. all nodes are checked.
\param collisionRootNode: the scene node at which to begin checking. Only this \param collisionRootNode: the scene node at which to begin checking. Only this
node and its children will be checked. If you want to check the entire scene, node and its children will be checked. If you want to check the entire scene,
pass 0, and the root scene node will be used (this is the default). pass 0, and the root scene node will be used (this is the default).
\param noDebugObjects: when true, debug objects are not considered viable targets. \param noDebugObjects: when true, debug objects are not considered viable targets.
Debug objects are scene nodes with IsDebugObject() = true. Debug objects are scene nodes with IsDebugObject() = true.
\return Returns the scene node containing the hit triangle nearest to ray.start. \return Returns the scene node containing the hit triangle nearest to ray.start.
If no collision is detected, then 0 is returned. */ If no collision is detected, then 0 is returned. */
virtual ISceneNode* getSceneNodeAndCollisionPointFromRay( virtual ISceneNode* getSceneNodeAndCollisionPointFromRay(
core::line3df ray, core::line3df ray,
core::vector3df & outCollisionPoint, core::vector3df & outCollisionPoint,
core::triangle3df & outTriangle, core::triangle3df & outTriangle,

View File

@ -132,7 +132,7 @@ namespace scene
//! The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff. //! The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff.
/** All Scene nodes can be created only here. There is a always growing /** All Scene nodes can be created only here. There is a always growing
list of scene nodes for lots of purposes: Indoor rendering scene nodes list of scene nodes for lots of purposes: Indoor rendering scene nodes
like the Octree (addOctTreeSceneNode()) or the terrain renderer like the Octree (addOctreeSceneNode()) or the terrain renderer
(addTerrainSceneNode()), different Camera scene nodes (addTerrainSceneNode()), different Camera scene nodes
(addCameraSceneNode(), addCameraSceneNodeMaya()), scene nodes for Light (addCameraSceneNode(), addCameraSceneNodeMaya()), scene nodes for Light
(addLightSceneNode()), Billboards (addBillboardSceneNode()) and so on. (addLightSceneNode()), Billboards (addBillboardSceneNode()) and so on.
@ -493,38 +493,54 @@ namespace scene
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
//! Adds a scene node for rendering using a octtree to the scene graph. //! Adds a scene node for rendering using a octree to the scene graph.
/** This a good method for rendering /** This a good method for rendering
scenes with lots of geometry. The Octree is built on the fly from the mesh. scenes with lots of geometry. The Octree is built on the fly from the mesh.
\param mesh: The mesh containing all geometry from which the octtree will be build. \param mesh: The mesh containing all geometry from which the octree will be build.
If this animated mesh has more than one frames in it, the first frame is taken. If this animated mesh has more than one frames in it, the first frame is taken.
\param parent: Parent node of the octtree node. \param parent: Parent node of the octree node.
\param id: id of the node. This id can be used to identify the node. \param id: id of the node. This id can be used to identify the node.
\param minimalPolysPerNode: Specifies the minimal polygons contained a octree node. \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node.
If a node gets less polys than this value it will not be split into If a node gets less polys than this value it will not be split into
smaller nodes. smaller nodes.
\param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed. \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
\return Pointer to the OctTree if successful, otherwise 0. \return Pointer to the Octree if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0; s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0;
//! Adds a scene node for rendering using a octtree to the scene graph. //! Adds a scene node for rendering using a octree to the scene graph.
/** \deprecated Use addOctreeSceneNode instead. */
_IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false)
{
return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero);
}
//! Adds a scene node for rendering using a octree to the scene graph.
/** This a good method for rendering scenes with lots of /** This a good method for rendering scenes with lots of
geometry. The Octree is built on the fly from the mesh, much geometry. The Octree is built on the fly from the mesh, much
faster then a bsp tree. faster then a bsp tree.
\param mesh: The mesh containing all geometry from which the octtree will be build. \param mesh: The mesh containing all geometry from which the octree will be build.
\param parent: Parent node of the octtree node. \param parent: Parent node of the octree node.
\param id: id of the node. This id can be used to identify the node. \param id: id of the node. This id can be used to identify the node.
\param minimalPolysPerNode: Specifies the minimal polygons contained a octree node. \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node.
If a node gets less polys than this value it will not be split into If a node gets less polys than this value it will not be split into
smaller nodes. smaller nodes.
\param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed. \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
\return Pointer to the octtree if successful, otherwise 0. \return Pointer to the octree if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0, virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0; s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
//! Adds a scene node for rendering using a octree to the scene graph.
/** \deprecated Use addOctreeSceneNode instead. */
_IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false)
{
return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero);
}
//! Adds a camera scene node to the scene graph and sets it as active camera. //! Adds a camera scene node to the scene graph and sets it as active camera.
/** This camera does not react on user input like for example the one created with /** This camera does not react on user input like for example the one created with
addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the
@ -841,7 +857,7 @@ namespace scene
/** A Quake3 Scene renders multiple meshes for a specific HighLanguage Shader (Quake3 Style ) /** A Quake3 Scene renders multiple meshes for a specific HighLanguage Shader (Quake3 Style )
\return Pointer to the quake3 scene node if successful, otherwise NULL. \return Pointer to the quake3 scene node if successful, otherwise NULL.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IMeshSceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::IShader * shader, virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
ISceneNode* parent=0, s32 id=-1 ISceneNode* parent=0, s32 id=-1
) = 0; ) = 0;
@ -981,6 +997,10 @@ namespace scene
//! Add a volume light mesh to the meshpool //! Add a volume light mesh to the meshpool
/** \param name Name of the mesh /** \param name Name of the mesh
\param SubdivideU Horizontal subdivision count
\param SubdivideV Vertical subdivision count
\param FootColor Color of the bottom of the light
\param TailColor Color of the top of the light
\return Pointer to the volume light mesh if successful, otherwise 0. \return Pointer to the volume light mesh if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. This pointer should not be dropped. See IReferenceCounted::drop() for more information.
*/ */
@ -1188,13 +1208,13 @@ namespace scene
See IReferenceCounted::drop() for more information. */ See IReferenceCounted::drop() for more information. */
virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime, virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
const core::array< core::vector3df >& points, const core::array< core::vector3df >& points,
f32 speed = 1.0f, f32 tightness = 0.5f) = 0; f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false) = 0;
//! Creates a simple ITriangleSelector, based on a mesh. //! Creates a simple ITriangleSelector, based on a mesh.
/** Triangle selectors /** Triangle selectors
can be used for doing collision detection. Don't use this selector can be used for doing collision detection. Don't use this selector
for a huge amount of triangles like in Quake3 maps. for a huge amount of triangles like in Quake3 maps.
Instead, use for example ISceneManager::createOctTreeTriangleSelector(). Instead, use for example ISceneManager::createOctreeTriangleSelector().
Please note that the created triangle selector is not automaticly attached Please note that the created triangle selector is not automaticly attached
to the scene node. You will have to call ISceneNode::setTriangleSelector() to the scene node. You will have to call ISceneNode::setTriangleSelector()
for this. To create and attach a triangle selector is done like this: for this. To create and attach a triangle selector is done like this:
@ -1231,15 +1251,15 @@ namespace scene
See IReferenceCounted::drop() for more information. */ See IReferenceCounted::drop() for more information. */
virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0; virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0;
//! Creates a Triangle Selector, optimized by an octtree. //! Creates a Triangle Selector, optimized by an octree.
/** Triangle selectors /** Triangle selectors
can be used for doing collision detection. This triangle selector is can be used for doing collision detection. This triangle selector is
optimized for huge amounts of triangle, it organizes them in an octtree. optimized for huge amounts of triangle, it organizes them in an octree.
Please note that the created triangle selector is not automaticly attached Please note that the created triangle selector is not automaticly attached
to the scene node. You will have to call ISceneNode::setTriangleSelector() to the scene node. You will have to call ISceneNode::setTriangleSelector()
for this. To create and attach a triangle selector is done like this: for this. To create and attach a triangle selector is done like this:
\code \code
ITriangleSelector* s = sceneManager->createOctTreeTriangleSelector(yourMesh, ITriangleSelector* s = sceneManager->createOctreeTriangleSelector(yourMesh,
yourSceneNode); yourSceneNode);
yourSceneNode->setTriangleSelector(s); yourSceneNode->setTriangleSelector(s);
s->drop(); s->drop();
@ -1254,9 +1274,17 @@ namespace scene
\return The selector, or null if not successful. \return The selector, or null if not successful.
If you no longer need the selector, you should call ITriangleSelector::drop(). If you no longer need the selector, you should call ITriangleSelector::drop().
See IReferenceCounted::drop() for more information. */ See IReferenceCounted::drop() for more information. */
virtual ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh, virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh,
ISceneNode* node, s32 minimalPolysPerNode=32) = 0; ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
//! //! Creates a Triangle Selector, optimized by an octree.
/** \deprecated Use createOctreeTriangleSelector instead. */
_IRR_DEPRECATED_ ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
ISceneNode* node, s32 minimalPolysPerNode=32)
{
return createOctreeTriangleSelector(mesh, node, minimalPolysPerNode);
}
//! Creates a meta triangle selector. //! Creates a meta triangle selector.
/** A meta triangle selector is nothing more than a /** A meta triangle selector is nothing more than a
collection of one or more triangle selectors providing together collection of one or more triangle selectors providing together

View File

@ -120,7 +120,7 @@ namespace scene
ISceneNodeAnimator* anim = *ait; ISceneNodeAnimator* anim = *ait;
++ait; ++ait;
anim->animateNode(this, timeMs); anim->animateNode(this, timeMs);
} }
// update absolute position // update absolute position
updateAbsolutePosition(); updateAbsolutePosition();
@ -289,7 +289,9 @@ namespace scene
//! Removes a child from this scene node. //! Removes a child from this scene node.
/** \param child A pointer to the new child. /** If found in the children list, the child pointer is also
dropped and might be deleted if no other grab exists.
\param child A pointer to the child which shall be removed.
\return True if the child was removed, and false if not, \return True if the child was removed, and false if not,
e.g. because it couldn't be found in the children list. */ e.g. because it couldn't be found in the children list. */
virtual bool removeChild(ISceneNode* child) virtual bool removeChild(ISceneNode* child)
@ -310,6 +312,9 @@ namespace scene
//! Removes all children of this scene node //! Removes all children of this scene node
/** The scene nodes found in the children list are also dropped
and might be deleted if no other grab exists on them.
*/
virtual void removeAll() virtual void removeAll()
{ {
ISceneNodeList::Iterator it = Children.begin(); ISceneNodeList::Iterator it = Children.begin();
@ -323,7 +328,9 @@ namespace scene
} }
//! Removes this scene node from the scene, deleting it. //! Removes this scene node from the scene
/** If no other grab exists for this node, it will be deleted.
*/
virtual void remove() virtual void remove()
{ {
if (Parent) if (Parent)
@ -352,21 +359,27 @@ namespace scene
//! Removes an animator from this scene node. //! Removes an animator from this scene node.
/** \param animator A pointer to the animator to be deleted. */ /** If the animator is found, it is also dropped and might be
deleted if not other grab exists for it.
\param animator A pointer to the animator to be deleted. */
virtual void removeAnimator(ISceneNodeAnimator* animator) virtual void removeAnimator(ISceneNodeAnimator* animator)
{ {
ISceneNodeAnimatorList::Iterator it = Animators.begin(); ISceneNodeAnimatorList::Iterator it = Animators.begin();
for (; it != Animators.end(); ++it) for (; it != Animators.end(); ++it)
{
if ((*it) == animator) if ((*it) == animator)
{ {
(*it)->drop(); (*it)->drop();
Animators.erase(it); Animators.erase(it);
return; return;
} }
}
} }
//! Removes all animators from this scene node. //! Removes all animators from this scene node.
/** The animators might also be deleted if no other grab exists
for them. */
virtual void removeAnimators() virtual void removeAnimators()
{ {
ISceneNodeAnimatorList::Iterator it = Animators.begin(); ISceneNodeAnimatorList::Iterator it = Animators.begin();
@ -435,8 +448,8 @@ namespace scene
//! Gets the scale of the scene node relative to its parent. //! Gets the scale of the scene node relative to its parent.
/** This is the scale of this node relative to its parent. /** This is the scale of this node relative to its parent.
If you want the absolute scale, use If you want the absolute scale, use
getAbsoluteTransformation().getScale() getAbsoluteTransformation().getScale()
\return The scale of the scene node. */ \return The scale of the scene node. */
virtual const core::vector3df& getScale() const virtual const core::vector3df& getScale() const
@ -524,7 +537,7 @@ namespace scene
//! Sets if debug data like bounding boxes should be drawn. //! Sets if debug data like bounding boxes should be drawn.
/** A bitwise OR of the types from @ref irr::scene::E_DEBUG_SCENE_TYPE. /** A bitwise OR of the types from @ref irr::scene::E_DEBUG_SCENE_TYPE.
Please note that not all scene nodes support all debug data types. Please note that not all scene nodes support all debug data types.
\param state The debug data visibility state to be used. */ \param state The debug data visibility state to be used. */
virtual void setDebugDataVisible(s32 state) virtual void setDebugDataVisible(s32 state)
@ -533,7 +546,7 @@ namespace scene
} }
//! Returns if debug data like bounding boxes are drawn. //! Returns if debug data like bounding boxes are drawn.
/** \return A bitwise OR of the debug data values from /** \return A bitwise OR of the debug data values from
@ref irr::scene::E_DEBUG_SCENE_TYPE that are currently visible. */ @ref irr::scene::E_DEBUG_SCENE_TYPE that are currently visible. */
s32 isDebugDataVisible() const s32 isDebugDataVisible() const
{ {
@ -589,7 +602,7 @@ namespace scene
/** The Selector can be used by the engine for doing collision /** The Selector can be used by the engine for doing collision
detection. You can create a TriangleSelector with detection. You can create a TriangleSelector with
ISceneManager::createTriangleSelector() or ISceneManager::createTriangleSelector() or
ISceneManager::createOctTreeTriangleSelector and set it with ISceneManager::createOctreeTriangleSelector and set it with
ISceneNode::setTriangleSelector(). If a scene node got no triangle ISceneNode::setTriangleSelector(). If a scene node got no triangle
selector, but collision tests should be done with it, a triangle selector, but collision tests should be done with it, a triangle
selector is created using the bounding box of the scene node. selector is created using the bounding box of the scene node.
@ -605,7 +618,7 @@ namespace scene
/** The Selector can be used by the engine for doing collision /** The Selector can be used by the engine for doing collision
detection. You can create a TriangleSelector with detection. You can create a TriangleSelector with
ISceneManager::createTriangleSelector() or ISceneManager::createTriangleSelector() or
ISceneManager::createOctTreeTriangleSelector(). Some nodes may ISceneManager::createOctreeTriangleSelector(). Some nodes may
create their own selector by default, so it would be good to create their own selector by default, so it would be good to
check if there is already a selector in this node by calling check if there is already a selector in this node by calling
ISceneNode::getTriangleSelector(). ISceneNode::getTriangleSelector().
@ -625,7 +638,7 @@ namespace scene
//! Updates the absolute position based on the relative and the parents position //! Updates the absolute position based on the relative and the parents position
/** Note: This does not recursively update the parents absolute positions, so if you have a deeper /** Note: This does not recursively update the parents absolute positions, so if you have a deeper
hierarchy you might want to update the parents first.*/ hierarchy you might want to update the parents first.*/
virtual void updateAbsolutePosition() virtual void updateAbsolutePosition()
{ {

View File

@ -17,7 +17,7 @@ namespace scene
enum E_INTERPOLATION_MODE enum E_INTERPOLATION_MODE
{ {
// constant interpolation // constant does use the current key-values without interpolation
EIM_CONSTANT = 0, EIM_CONSTANT = 0,
// linear interpolation // linear interpolation

View File

@ -85,9 +85,8 @@ class ITexture : public virtual IReferenceCounted
public: public:
//! constructor //! constructor
ITexture(const io::path& name) : Name(name) ITexture(const io::path& name) : NamedPath(name)
{ {
Name.make_lower();
} }
//! Lock function. //! Lock function.
@ -98,10 +97,12 @@ public:
number of previous locks. number of previous locks.
\param readOnly Specifies that no changes to the locked texture are \param readOnly Specifies that no changes to the locked texture are
made. Unspecified behavior will arise if still write access happens. made. Unspecified behavior will arise if still write access happens.
\param mipmapLevel Number of the mipmapLevel to lock. 0 is main texture.
Non-existing levels will silently fail and return 0.
\return Returns a pointer to the pixel data. The format of the pixel can \return Returns a pointer to the pixel data. The format of the pixel can
be determined by using getColorFormat(). 0 is returned, if be determined by using getColorFormat(). 0 is returned, if
the texture cannot be locked. */ the texture cannot be locked. */
virtual void* lock(bool readOnly = false) = 0; virtual void* lock(bool readOnly = false, u32 mipmapLevel=0) = 0;
//! Unlock function. Must be called after a lock() to the texture. //! Unlock function. Must be called after a lock() to the texture.
/** One should avoid to call unlock more than once before another lock. */ /** One should avoid to call unlock more than once before another lock. */
@ -149,14 +150,14 @@ public:
//! Regenerates the mip map levels of the texture. //! Regenerates the mip map levels of the texture.
/** Required after modifying the texture, usually after calling unlock(). */ /** Required after modifying the texture, usually after calling unlock(). */
virtual void regenerateMipMapLevels() = 0; virtual void regenerateMipMapLevels(void* mipmapData=0) = 0;
//! Check whether the texture is a render target //! Check whether the texture is a render target
/** \return True if this is a render target, otherwise false. */ /** \return True if this is a render target, otherwise false. */
virtual bool isRenderTarget() const { return false; } virtual bool isRenderTarget() const { return false; }
//! Get name of texture (in most cases this is the filename) //! Get name of texture (in most cases this is the filename)
const io::path& getName() const { return Name; } const io::SNamedPath& getName() const { return NamedPath; }
protected: protected:
@ -176,7 +177,7 @@ protected:
return ETCF_OPTIMIZED_FOR_SPEED; return ETCF_OPTIMIZED_FOR_SPEED;
} }
io::path Name; io::SNamedPath NamedPath;
}; };

View File

@ -18,6 +18,7 @@
#include "triangle3d.h" #include "triangle3d.h"
#include "EDriverTypes.h" #include "EDriverTypes.h"
#include "EDriverFeatures.h" #include "EDriverFeatures.h"
#include "SExposedVideoData.h"
namespace irr namespace irr
{ {
@ -39,7 +40,6 @@ namespace video
struct S3DVertex2TCoords; struct S3DVertex2TCoords;
struct S3DVertexTangents; struct S3DVertexTangents;
struct SLight; struct SLight;
struct SExposedVideoData;
class IImageLoader; class IImageLoader;
class IImageWriter; class IImageWriter;
class IMaterialRenderer; class IMaterialRenderer;
@ -106,6 +106,8 @@ namespace video
ERT_FRAME_BUFFER=0, ERT_FRAME_BUFFER=0,
//! Render target is a render texture //! Render target is a render texture
ERT_RENDER_TEXTURE, ERT_RENDER_TEXTURE,
//! Multi-Render target textures
ERT_MULTI_RENDER_TEXTURES,
//! Render target is the main color frame buffer //! Render target is the main color frame buffer
ERT_STEREO_LEFT_BUFFER, ERT_STEREO_LEFT_BUFFER,
//! Render target is the right color buffer (left is the main buffer) //! Render target is the right color buffer (left is the main buffer)
@ -247,9 +249,9 @@ namespace video
be cleared. It is not nesesarry to do so if only 2d drawing is be cleared. It is not nesesarry to do so if only 2d drawing is
used. used.
\param color The color used for back buffer clearing \param color The color used for back buffer clearing
\param windowId Handle of another window, if you want the \param videoData Handle of another window, if you want the
bitmap to be displayed on another window. If this is null, bitmap to be displayed on another window. If this is an empty
everything will be displayed in the default window. element, everything will be displayed in the default window.
Note: This feature is not fully implemented for all devices. Note: This feature is not fully implemented for all devices.
\param sourceRect Pointer to a rectangle defining the source \param sourceRect Pointer to a rectangle defining the source
rectangle of the area to be presented. Set to null to present rectangle of the area to be presented. Set to null to present
@ -257,7 +259,7 @@ namespace video
\return False if failed. */ \return False if failed. */
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
SColor color=SColor(255,0,0,0), SColor color=SColor(255,0,0,0),
void* windowId=0, const SExposedVideoData& videoData=SExposedVideoData(),
core::rect<s32>* sourceRect=0) =0; core::rect<s32>* sourceRect=0) =0;
//! Presents the rendered image to the screen. //! Presents the rendered image to the screen.
@ -380,10 +382,14 @@ namespace video
/** \param name A name for the texture. Later calls of /** \param name A name for the texture. Later calls of
getTexture() with this name will return this texture getTexture() with this name will return this texture
\param image Image the texture is created from. \param image Image the texture is created from.
\param mipmapData Optional pointer to a set of images which
build up the whole mipmap set. Must be images of the same color
type as image. If this parameter is not given, the mipmaps are
derived from image.
\return Pointer to the newly created texture. This pointer \return Pointer to the newly created texture. This pointer
should not be dropped. See IReferenceCounted::drop() for more should not be dropped. See IReferenceCounted::drop() for more
information. */ information. */
virtual ITexture* addTexture(const io::path& name, IImage* image) = 0; virtual ITexture* addTexture(const io::path& name, IImage* image, void* mipmapData=0) = 0;
//! Adds a new render target texture to the texture cache. //! Adds a new render target texture to the texture cache.
/** \param size Size of the texture, in pixels. Width and /** \param size Size of the texture, in pixels. Width and
@ -784,8 +790,8 @@ namespace video
The subtextures are defined by the array of sourceRects and are The subtextures are defined by the array of sourceRects and are
positioned using the array of positions. positioned using the array of positions.
\param texture Texture to be drawn. \param texture Texture to be drawn.
\param pos Array of upper left 2d destinations where the images \param positions Array of upper left 2d destinations where the
will be drawn. images will be drawn.
\param sourceRects Source rectangles of the image. \param sourceRects Source rectangles of the image.
\param clipRect Pointer to rectangle on the screen where the \param clipRect Pointer to rectangle on the screen where the
images are clipped to. images are clipped to.
@ -1137,7 +1143,7 @@ namespace video
virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) =0; virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) =0;
//! Creates a software image by converting it to given format from another image. //! Creates a software image by converting it to given format from another image.
/** /** \deprecated Create an empty image and use copyTo()
\param format Desired color format of the image. \param format Desired color format of the image.
\param imageToCopy Image to copy to the new image. \param imageToCopy Image to copy to the new image.
\return The created image. \return The created image.
@ -1146,7 +1152,7 @@ namespace video
virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy) =0; virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy) =0;
//! Creates a software image from a part of another image. //! Creates a software image from a part of another image.
/** /** \deprecated Create an empty image and use copyTo()
\param imageToCopy Image to copy to the new image in part. \param imageToCopy Image to copy to the new image in part.
\param pos Position of rectangle to copy. \param pos Position of rectangle to copy.
\param size Extents of rectangle to copy. \param size Extents of rectangle to copy.
@ -1317,6 +1323,27 @@ namespace video
\return Reference to the Override Material. */ \return Reference to the Override Material. */
virtual SOverrideMaterial& getOverrideMaterial() =0; virtual SOverrideMaterial& getOverrideMaterial() =0;
//! Get the 2d override material for altering its values
/** The 2d override materual allows to alter certain render
states of the 2d methods. Not all members of SMaterial are
honored, especially not MaterialType and Textures. Moreover,
the zbuffer is always ignored, and lighting is always off. All
other flags can be changed, though some might have to effect
in most cases.
Please note that you have to enable/disable this effect with
enableInitMaterial2D(). This effect is costly, as it increases
the number of state changes considerably. Always reset the
values when done.
\return Material reference which should be altered to reflect
the new settings.
*/
virtual SMaterial& getMaterial2D() =0;
//! Enable the 2d override material
/** \param enable Flag which tells whether the material shall be
enabled or disabled. */
virtual void enableMaterial2D(bool enable=true) =0;
//! Returns the graphics card vendor name. //! Returns the graphics card vendor name.
virtual core::stringc getVendorInfo() =0; virtual core::stringc getVendorInfo() =0;

View File

@ -13,7 +13,7 @@ namespace irr
namespace io namespace io
{ {
//! Interface providing write acess to a file. //! Interface providing write access to a file.
class IWriteFile : public virtual IReferenceCounted class IWriteFile : public virtual IReferenceCounted
{ {
public: public:

View File

@ -8,11 +8,11 @@
//! Irrlicht SDK Version //! Irrlicht SDK Version
#define IRRLICHT_VERSION_MAJOR 1 #define IRRLICHT_VERSION_MAJOR 1
#define IRRLICHT_VERSION_MINOR 7 #define IRRLICHT_VERSION_MINOR 7
#define IRRLICHT_VERSION_REVISION 0-alpha #define IRRLICHT_VERSION_REVISION 0
// This flag will be defined only in SVN, the official release code will have // This flag will be defined only in SVN, the official release code will have
// it undefined // it undefined
#define IRRLICHT_VERSION_SVN #define IRRLICHT_VERSION_SVN -beta
#define IRRLICHT_SDK_VERSION "1.7.0-alpha" #define IRRLICHT_SDK_VERSION "1.7.0-beta"
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw #include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
@ -37,6 +37,7 @@
//! _IRR_COMPILE_WITH_SDL_DEVICE_ for platform independent SDL framework //! _IRR_COMPILE_WITH_SDL_DEVICE_ for platform independent SDL framework
//! _IRR_COMPILE_WITH_CONSOLE_DEVICE_ for no windowing system, used as a fallback //! _IRR_COMPILE_WITH_CONSOLE_DEVICE_ for no windowing system, used as a fallback
//! _IRR_COMPILE_WITH_IPHONE_DEVICE_ for UIKit windowing on iPhoneOS (aka embeded OSX) //! _IRR_COMPILE_WITH_IPHONE_DEVICE_ for UIKit windowing on iPhoneOS (aka embeded OSX)
//! _IRR_COMPILE_WITH_FB_DEVICE_ for framebuffer systems
//! Uncomment this line to compile with the SDL device //! Uncomment this line to compile with the SDL device
@ -199,18 +200,6 @@ disable this feature, the engine behave as before (ansi). This is currently only
for Windows based systems. */ for Windows based systems. */
//#define _IRR_WCHAR_FILESYSTEM //#define _IRR_WCHAR_FILESYSTEM
//! Define _IRR_COMPILE_WITH_ZLIB_ to enable compiling the engine using zlib.
/** This enables the engine to read from compressed .zip archives. If you
disable this feature, the engine can still read archives, but only uncompressed
ones. */
#define _IRR_COMPILE_WITH_ZLIB_
//! Define _IRR_USE_NON_SYSTEM_ZLIB_ to let irrlicht use the zlib which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the zlib installed in the system.
This is only used when _IRR_COMPILE_WITH_ZLIB_ is defined. */
#define _IRR_USE_NON_SYSTEM_ZLIB_
//! Define _IRR_COMPILE_WITH_JPEGLIB_ to enable compiling the engine using libjpeg. //! Define _IRR_COMPILE_WITH_JPEGLIB_ to enable compiling the engine using libjpeg.
/** This enables the engine to read jpeg images. If you comment this out, /** This enables the engine to read jpeg images. If you comment this out,
the engine will no longer read .jpeg images. */ the engine will no longer read .jpeg images. */
@ -379,7 +368,37 @@ B3D, MS3D or X meshes */
#define _IRR_COMPILE_WITH_TGA_WRITER_ #define _IRR_COMPILE_WITH_TGA_WRITER_
//! Define __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ if you want to open ZIP and GZIP archives //! Define __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ if you want to open ZIP and GZIP archives
/** ZIP reading has several more options below to configure. */
#define __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_ #define __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
#ifdef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
//! Define _IRR_COMPILE_WITH_ZLIB_ to enable compiling the engine using zlib.
/** This enables the engine to read from compressed .zip archives. If you
disable this feature, the engine can still read archives, but only uncompressed
ones. */
#define _IRR_COMPILE_WITH_ZLIB_
//! Define _IRR_USE_NON_SYSTEM_ZLIB_ to let irrlicht use the zlib which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the zlib
installed on the system. This is only used when _IRR_COMPILE_WITH_ZLIB_ is
defined. */
#define _IRR_USE_NON_SYSTEM_ZLIB_
//! Define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_ if you want to read AES-encrypted ZIP archives
#define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
//! Define _IRR_COMPILE_WITH_BZIP2_ if you want to support bzip2 compressed zip archives
/** bzip2 is superior to the original zip file compression modes, but requires
a certain amount of memory for decompression and adds several files to the
library. */
#define _IRR_COMPILE_WITH_BZIP2_
//! Define _IRR_USE_NON_SYSTEM_BZLIB_ to let irrlicht use the bzlib which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the bzlib
installed on the system. This is only used when _IRR_COMPILE_WITH_BZLIB_ is
defined. */
#define _IRR_USE_NON_SYSTEM_BZLIB_
//! Define _IRR_COMPILE_WITH_LZMA_ if you want to use LZMA compressed zip files.
/** LZMA is a very efficient compression code, known from 7zip. Irrlicht
currently only supports zip archives, though. */
#define _IRR_COMPILE_WITH_LZMA_
#endif
//! Define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ if you want to mount folders as archives //! Define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ if you want to mount folders as archives
#define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ #define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
//! Define __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_ if you want to open ID software PAK archives //! Define __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_ if you want to open ID software PAK archives

View File

@ -179,8 +179,8 @@ namespace irr
\return String which contains the version. */ \return String which contains the version. */
virtual const c8* getVersion() const = 0; virtual const c8* getVersion() const = 0;
//! Sets a new user event receiver which will receive events from the engine. //! Sets a new user event receiver which will receive events from the engine.
/** Return true in IEventReceiver::OnEvent to prevent the event from continuing along /** Return true in IEventReceiver::OnEvent to prevent the event from continuing along
the chain of event receivers. The path that an event takes through the system depends the chain of event receivers. The path that an event takes through the system depends
on its type. See irr::EEVENT_TYPE for details. on its type. See irr::EEVENT_TYPE for details.
\param receiver New receiver to be used. */ \param receiver New receiver to be used. */
@ -221,7 +221,7 @@ namespace irr
//! Activate any joysticks, and generate events for them. //! Activate any joysticks, and generate events for them.
/** Irrlicht contains support for joysticks, but does not generate joystick events by default, /** Irrlicht contains support for joysticks, but does not generate joystick events by default,
as this would consume joystick info that 3rd party libraries might rely on. Call this method to as this would consume joystick info that 3rd party libraries might rely on. Call this method to
activate joystick support in Irrlicht and to receive irr::SJoystickEvent events. activate joystick support in Irrlicht and to receive irr::SJoystickEvent events.
\param joystickInfo On return, this will contain an array of each joystick that was found and activated. \param joystickInfo On return, this will contain an array of each joystick that was found and activated.
\return true if joysticks are supported on this device and _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ \return true if joysticks are supported on this device and _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
@ -237,6 +237,18 @@ namespace irr
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue, virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
f32 &brightness, f32 &contrast) =0; f32 &brightness, f32 &contrast) =0;
//! Remove messages pending in the system message loop
/** This function is usually used after messages have been buffered for a longer time, for example
when loading a large scene. Clearing the message loop prevents that mouse- or buttonclicks which users
have pressed in the meantime will now trigger unexpected actions in the gui. <br>
So far the following messages are cleared:<br>
Win32: All keyboard and mouse messages<br>
Linux: All keyboard and mouse messages<br>
All other devices are not yet supported here.<br>
The function is still somewhat experimental, as the kind of messages we clear is based on just a few use-cases.
If you think further messages should be cleared, or some messages should not be cleared here, then please tell us. */
virtual void clearSystemMessages() = 0;
//! Get the type of the device. //! Get the type of the device.
/** This allows the user to check which windowing system is currently being /** This allows the user to check which windowing system is currently being
used. */ used. */

View File

@ -24,6 +24,9 @@ you are using the software or the null device.
*/ */
struct SExposedVideoData struct SExposedVideoData
{ {
SExposedVideoData() {OpenGLWin32.HDc=0; OpenGLWin32.HRc=0; OpenGLWin32.HWnd=0;}
explicit SExposedVideoData(void* Window) {OpenGLWin32.HDc=0; OpenGLWin32.HRc=0; OpenGLWin32.HWnd=Window;}
union union
{ {
struct struct

View File

@ -8,6 +8,7 @@
#include "EDriverTypes.h" #include "EDriverTypes.h"
#include "EDeviceTypes.h" #include "EDeviceTypes.h"
#include "dimension2d.h" #include "dimension2d.h"
#include "ILogger.h"
namespace irr namespace irr
{ {
@ -35,6 +36,7 @@ namespace irr
HighPrecisionFPU(false), HighPrecisionFPU(false),
EventReceiver(0), EventReceiver(0),
WindowId(0), WindowId(0),
LoggingLevel(ELL_INFORMATION),
SDK_version_do_not_use(IRRLICHT_SDK_VERSION) SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
{ {
} }
@ -61,6 +63,7 @@ namespace irr
HighPrecisionFPU = other.HighPrecisionFPU; HighPrecisionFPU = other.HighPrecisionFPU;
EventReceiver = other.EventReceiver; EventReceiver = other.EventReceiver;
WindowId = other.WindowId; WindowId = other.WindowId;
LoggingLevel = other.LoggingLevel;
return *this; return *this;
} }
@ -228,6 +231,14 @@ namespace irr
do it how you like. */ do it how you like. */
void* WindowId; void* WindowId;
//! Specifies the logging level used in the logging interface.
/** The default value is ELL_INFORMATION. You can access the ILogger interface
later on from the IrrlichtDevice with getLogger() and set another level.
But if you need more or less logging information already from device creation,
then you have to change it here.
*/
ELOG_LEVEL LoggingLevel;
//! Don't use or change this parameter. //! Don't use or change this parameter.
/** Always set it to IRRLICHT_SDK_VERSION, which is done by default. /** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
This is needed for sdk version checks. */ This is needed for sdk version checks. */

View File

@ -100,7 +100,7 @@ namespace video
/** alpha source can be an OR'ed combination of E_ALPHA_SOURCE values. */ /** alpha source can be an OR'ed combination of E_ALPHA_SOURCE values. */
inline f32 pack_texureBlendFunc ( const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE ) inline f32 pack_texureBlendFunc ( const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE )
{ {
const u32 tmp = (alphaSource << 24) | (modulate << 16) | (srcFact << 8) | dstFact; const u32 tmp = (alphaSource << 12) | (modulate << 8) | (srcFact << 4) | dstFact;
return FR(tmp); return FR(tmp);
} }
@ -110,10 +110,10 @@ namespace video
E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param ) E_MODULATE_FUNC &modulo, u32& alphaSource, const f32 param )
{ {
const u32 state = IR(param); const u32 state = IR(param);
alphaSource = (state & 0xFF000000) >> 24; alphaSource = (state & 0x0000F000) >> 12;
modulo = E_MODULATE_FUNC( ( state & 0x00FF0000 ) >> 16 ); modulo = E_MODULATE_FUNC( ( state & 0x00000F00 ) >> 8 );
srcFact = E_BLEND_FACTOR ( ( state & 0x0000FF00 ) >> 8 ); srcFact = E_BLEND_FACTOR ( ( state & 0x000000F0 ) >> 4 );
dstFact = E_BLEND_FACTOR ( ( state & 0x000000FF ) ); dstFact = E_BLEND_FACTOR ( ( state & 0x0000000F ) );
} }
//! EMT_ONETEXTURE_BLEND: has BlendFactor Alphablending //! EMT_ONETEXTURE_BLEND: has BlendFactor Alphablending
@ -194,7 +194,7 @@ namespace video
: MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255), : MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255),
EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255), EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f), Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f),
ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE|EAAM_LINE_SMOOTH), ColorMask(ECP_ALL), ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
ColorMaterial(ECM_DIFFUSE), ColorMaterial(ECM_DIFFUSE),
Wireframe(false), PointCloud(false), GouraudShading(true), Lighting(true), ZWriteEnable(true), Wireframe(false), PointCloud(false), GouraudShading(true), Lighting(true), ZWriteEnable(true),
BackfaceCulling(true), FrontfaceCulling(false), FogEnable(false), NormalizeNormals(false) BackfaceCulling(true), FrontfaceCulling(false), FogEnable(false), NormalizeNormals(false)

View File

@ -78,10 +78,10 @@ namespace scene
//! recalculates the bounding box member based on the planes //! recalculates the bounding box member based on the planes
inline void recalculateBoundingBox(); inline void recalculateBoundingBox();
//! update the given state's matrix based on video::E_TRANSFORMATION_STATE //! get the given state's matrix based on frustum E_TRANSFORMATION_STATE
core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state); core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state);
//! get the given state's matrix based on frustum E_TRANSFORMATION_STATE_FRUSTUM //! get the given state's matrix based on frustum E_TRANSFORMATION_STATE
const core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state) const; const core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state) const;
//! clips a line to the view frustum. //! clips a line to the view frustum.

View File

@ -111,6 +111,14 @@ namespace scene
const c8* const DMF_FLIP_ALPHA_TEXTURES = "DMF_FlipAlpha"; const c8* const DMF_FLIP_ALPHA_TEXTURES = "DMF_FlipAlpha";
//! Name of the parameter for changing the texture path of the built-in obj loader.
/** Use it like this:
\code
SceneManager->getParameters()->setAttribute(scene::OBJ_TEXTURE_PATH, "path/to/your/textures");
\endcode
**/
const c8* const OBJ_TEXTURE_PATH = "OBJ_TexturePath";
//! Flag to avoid loading group structures in .obj files //! Flag to avoid loading group structures in .obj files
/** Use it like this: /** Use it like this:
\code \code
@ -137,6 +145,13 @@ namespace scene
**/ **/
const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag"; const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag";
//! Name of the parameter for changing the texture path of the built-in b3d loader.
/** Use it like this:
\code
SceneManager->getParameters()->setAttribute(scene::B3D_TEXTURE_PATH, "path/to/your/textures");
\endcode
**/
const c8* const B3D_TEXTURE_PATH = "B3D_TexturePath";
//! Flag set as parameter when the scene manager is used as editor //! Flag set as parameter when the scene manager is used as editor
/** In this way special animators like deletion animators can be stopped from /** In this way special animators like deletion animators can be stopped from

View File

@ -43,23 +43,6 @@ class aabbox3d
// functions // functions
//! Adds a point to the bounding box
/** The box grows bigger, if point was outside of the box.
\param p: Point to add into the box. */
void addInternalPoint(const vector3d<T>& p)
{
addInternalPoint(p.X, p.Y, p.Z);
}
//! Adds another bounding box
/** The box grows bigger, if the new box was outside of the box.
\param b: Other bounding box to add into this box. */
void addInternalBox(const aabbox3d<T>& b)
{
addInternalPoint(b.MaxEdge);
addInternalPoint(b.MinEdge);
}
//! Resets the bounding box to a one-point box. //! Resets the bounding box to a one-point box.
/** \param x X coord of the point. /** \param x X coord of the point.
\param y Y coord of the point. \param y Y coord of the point.
@ -85,6 +68,23 @@ class aabbox3d
MinEdge = initValue; MinEdge = initValue;
} }
//! Adds a point to the bounding box
/** The box grows bigger, if point was outside of the box.
\param p: Point to add into the box. */
void addInternalPoint(const vector3d<T>& p)
{
addInternalPoint(p.X, p.Y, p.Z);
}
//! Adds another bounding box
/** The box grows bigger, if the new box was outside of the box.
\param b: Other bounding box to add into this box. */
void addInternalBox(const aabbox3d<T>& b)
{
addInternalPoint(b.MaxEdge);
addInternalPoint(b.MinEdge);
}
//! Adds a point to the bounding box //! Adds a point to the bounding box
/** The box grows bigger, if point is outside of the box. /** The box grows bigger, if point is outside of the box.
\param x X coordinate of the point to add to this box. \param x X coordinate of the point to add to this box.
@ -101,8 +101,102 @@ class aabbox3d
if (z<MinEdge.Z) MinEdge.Z = z; if (z<MinEdge.Z) MinEdge.Z = z;
} }
//! Get center of the bounding box
/** \return Center of the bounding box. */
vector3d<T> getCenter() const
{
return (MinEdge + MaxEdge) / 2;
}
//! Get extent of the box (maximal distance of two points in the box)
/** \return Extent of the bounding box. */
vector3d<T> getExtent() const
{
return MaxEdge - MinEdge;
}
//! Check if the box is empty.
/** This means that there is no space between the min and max edge.
\return True if box is empty, else false. */
bool isEmpty() const
{
return MinEdge.equals ( MaxEdge );
}
//! Get the volume enclosed by the box in cubed units
T getVolume() const
{
const vector3d<T> e = getExtent();
return e.X * e.Y * e.Z;
}
//! Get the surface area of the box in squared units
T getArea() const
{
const vector3d<T> e = getExtent();
return 2*(e.X*e.Y + e.X*e.Z + e.Y*e.Z);
}
//! Stores all 8 edges of the box into an array
/** \param edges: Pointer to array of 8 edges. */
void getEdges(vector3d<T> *edges) const
{
const core::vector3d<T> middle = getCenter();
const core::vector3d<T> diag = middle - MaxEdge;
/*
Edges are stored in this way:
Hey, am I an ascii artist, or what? :) niko.
/3--------/7
/ | / |
/ | / |
1---------5 |
| /2- - -|- -6
| / | /
|/ | /
0---------4/
*/
edges[0].set(middle.X + diag.X, middle.Y + diag.Y, middle.Z + diag.Z);
edges[1].set(middle.X + diag.X, middle.Y - diag.Y, middle.Z + diag.Z);
edges[2].set(middle.X + diag.X, middle.Y + diag.Y, middle.Z - diag.Z);
edges[3].set(middle.X + diag.X, middle.Y - diag.Y, middle.Z - diag.Z);
edges[4].set(middle.X - diag.X, middle.Y + diag.Y, middle.Z + diag.Z);
edges[5].set(middle.X - diag.X, middle.Y - diag.Y, middle.Z + diag.Z);
edges[6].set(middle.X - diag.X, middle.Y + diag.Y, middle.Z - diag.Z);
edges[7].set(middle.X - diag.X, middle.Y - diag.Y, middle.Z - diag.Z);
}
//! Repairs the box.
/** Necessary if for example MinEdge and MaxEdge are swapped. */
void repair()
{
T t;
if (MinEdge.X > MaxEdge.X)
{ t=MinEdge.X; MinEdge.X = MaxEdge.X; MaxEdge.X=t; }
if (MinEdge.Y > MaxEdge.Y)
{ t=MinEdge.Y; MinEdge.Y = MaxEdge.Y; MaxEdge.Y=t; }
if (MinEdge.Z > MaxEdge.Z)
{ t=MinEdge.Z; MinEdge.Z = MaxEdge.Z; MaxEdge.Z=t; }
}
//! Calculates a new interpolated bounding box.
/** d=0 returns other, d=1 returns this, all other values blend between
the two boxes.
\param other Other box to interpolate between
\param d Value between 0.0f and 1.0f.
\return Interpolated box. */
aabbox3d<T> getInterpolated(const aabbox3d<T>& other, f32 d) const
{
f32 inv = 1.0f - d;
return aabbox3d<T>((other.MinEdge*inv) + (MinEdge*d),
(other.MaxEdge*inv) + (MaxEdge*d));
}
//! Determines if a point is within this box. //! Determines if a point is within this box.
/** \param p: Point to check. /** Border is included (IS part of the box)!
\param p: Point to check.
\return True if the point is within the box and false if not */ \return True if the point is within the box and false if not */
bool isPointInside(const vector3d<T>& p) const bool isPointInside(const vector3d<T>& p) const
{ {
@ -111,8 +205,9 @@ class aabbox3d
p.Z >= MinEdge.Z && p.Z <= MaxEdge.Z); p.Z >= MinEdge.Z && p.Z <= MaxEdge.Z);
} }
//! Determines if a point is within this box and its borders. //! Determines if a point is within this box and not its borders.
/** \param p: Point to check. /** Border is excluded (NOT part of the box)!
\param p: Point to check.
\return True if the point is within the box and false if not. */ \return True if the point is within the box and false if not. */
bool isPointTotalInside(const vector3d<T>& p) const bool isPointTotalInside(const vector3d<T>& p) const
{ {
@ -121,15 +216,6 @@ class aabbox3d
p.Z > MinEdge.Z && p.Z < MaxEdge.Z); p.Z > MinEdge.Z && p.Z < MaxEdge.Z);
} }
//! Determines if the box intersects with another box.
/** \param other: Other box to check a intersection with.
\return True if there is an intersection with the other box,
otherwise false. */
bool intersectsWithBox(const aabbox3d<T>& other) const
{
return (MinEdge <= other.MaxEdge && MaxEdge >= other.MinEdge);
}
//! Check if this box is completely inside the 'other' box. //! Check if this box is completely inside the 'other' box.
/** \param other: Other box to check against. /** \param other: Other box to check against.
\return True if this box is completly inside the other box, \return True if this box is completly inside the other box,
@ -139,6 +225,15 @@ class aabbox3d
return MinEdge >= other.MinEdge && MaxEdge <= other.MaxEdge; return MinEdge >= other.MinEdge && MaxEdge <= other.MaxEdge;
} }
//! Determines if the box intersects with another box.
/** \param other: Other box to check a intersection with.
\return True if there is an intersection with the other box,
otherwise false. */
bool intersectsWithBox(const aabbox3d<T>& other) const
{
return (MinEdge <= other.MaxEdge && MaxEdge >= other.MinEdge);
}
//! Tests if the box intersects with a line //! Tests if the box intersects with a line
/** \param line: Line to test intersection with. /** \param line: Line to test intersection with.
\return True if there is an intersection , else false. */ \return True if there is an intersection , else false. */
@ -154,8 +249,7 @@ class aabbox3d
\param halflength Half length of the line. \param halflength Half length of the line.
\return True if there is an intersection, else false. */ \return True if there is an intersection, else false. */
bool intersectsWithLine(const vector3d<T>& linemiddle, bool intersectsWithLine(const vector3d<T>& linemiddle,
const vector3d<T>& linevect, const vector3d<T>& linevect, T halflength) const
T halflength) const
{ {
const vector3d<T> e = getExtent() * (T)0.5; const vector3d<T> e = getExtent() * (T)0.5;
const vector3d<T> t = getCenter() - linemiddle; const vector3d<T> t = getCenter() - linemiddle;
@ -217,103 +311,6 @@ class aabbox3d
return ISREL3D_BACK; return ISREL3D_BACK;
} }
//! Get center of the bounding box
/** \return Center of the bounding box. */
vector3d<T> getCenter() const
{
return (MinEdge + MaxEdge) / 2;
}
//! Get extent of the box
/** \return Extent of the bounding box. */
vector3d<T> getExtent() const
{
return MaxEdge - MinEdge;
}
//! Stores all 8 edges of the box into an array
/** \param edges: Pointer to array of 8 edges. */
void getEdges(vector3d<T> *edges) const
{
const core::vector3d<T> middle = getCenter();
const core::vector3d<T> diag = middle - MaxEdge;
/*
Edges are stored in this way:
Hey, am I an ascii artist, or what? :) niko.
/3--------/7
/ | / |
/ | / |
1---------5 |
| 2- - -| -6
| / | /
|/ | /
0---------4/
*/
edges[0].set(middle.X + diag.X, middle.Y + diag.Y, middle.Z + diag.Z);
edges[1].set(middle.X + diag.X, middle.Y - diag.Y, middle.Z + diag.Z);
edges[2].set(middle.X + diag.X, middle.Y + diag.Y, middle.Z - diag.Z);
edges[3].set(middle.X + diag.X, middle.Y - diag.Y, middle.Z - diag.Z);
edges[4].set(middle.X - diag.X, middle.Y + diag.Y, middle.Z + diag.Z);
edges[5].set(middle.X - diag.X, middle.Y - diag.Y, middle.Z + diag.Z);
edges[6].set(middle.X - diag.X, middle.Y + diag.Y, middle.Z - diag.Z);
edges[7].set(middle.X - diag.X, middle.Y - diag.Y, middle.Z - diag.Z);
}
//! Check if the box is empty.
/** This means that there is no space between the min and max
edge.
\return True if box is empty, else false. */
bool isEmpty() const
{
return MinEdge.equals ( MaxEdge );
}
//! Repairs the box.
/** Necessary if for example MinEdge and MaxEdge are swapped. */
void repair()
{
T t;
if (MinEdge.X > MaxEdge.X)
{ t=MinEdge.X; MinEdge.X = MaxEdge.X; MaxEdge.X=t; }
if (MinEdge.Y > MaxEdge.Y)
{ t=MinEdge.Y; MinEdge.Y = MaxEdge.Y; MaxEdge.Y=t; }
if (MinEdge.Z > MaxEdge.Z)
{ t=MinEdge.Z; MinEdge.Z = MaxEdge.Z; MaxEdge.Z=t; }
}
//! Calculates a new interpolated bounding box.
/** \param other: other box to interpolate between
\param d: value between 0.0f and 1.0f.
\return Interpolated box. */
aabbox3d<T> getInterpolated(const aabbox3d<T>& other, f32 d) const
{
f32 inv = 1.0f - d;
return aabbox3d<T>((other.MinEdge*inv) + (MinEdge*d),
(other.MaxEdge*inv) + (MaxEdge*d));
}
//! Get the volume enclosed by the box in cubed units
T getVolume() const
{
const vector3d<T> e = getExtent();
return e.X * e.Y * e.Z;
}
//! Get the surface area of the box in squared units
T getArea() const
{
const vector3d<T> e = getExtent();
return 2*(e.X*e.Y + e.X*e.Z + e.Y*e.Z);
}
//! The near edge //! The near edge
vector3d<T> MinEdge; vector3d<T> MinEdge;

View File

@ -45,24 +45,16 @@ inline bool hasFileExtension ( const io::path& filename,
return isFileExtension ( filename, ext0, ext1, ext2 ) > 0; return isFileExtension ( filename, ext0, ext1, ext2 ) > 0;
} }
//! cut the filename extension from a source string and stores in the dest string //! cut the filename extension from a source file path and store it in a dest file path
inline stringc& cutFilenameExtension ( stringc &dest, const stringc &source ) inline io::path& cutFilenameExtension ( io::path &dest, const io::path &source )
{ {
s32 endPos = source.findLast ( '.' ); s32 endPos = source.findLast ( '.' );
dest = source.subString ( 0, endPos < 0 ? source.size () : endPos ); dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
return dest; return dest;
} }
//! cut the filename extension from a source string and stores in the dest string //! get the filename extension from a file path
inline stringw& cutFilenameExtension ( stringw &dest, const stringw &source ) inline io::path& getFileNameExtension ( io::path &dest, const io::path &source )
{
s32 endPos = source.findLast ( '.' );
dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
return dest;
}
//! get the filename extension from a string
inline stringc& getFileNameExtension ( stringc &dest, const stringc &source )
{ {
s32 endPos = source.findLast ( '.' ); s32 endPos = source.findLast ( '.' );
if ( endPos < 0 ) if ( endPos < 0 )
@ -73,30 +65,11 @@ inline stringc& getFileNameExtension ( stringc &dest, const stringc &source )
} }
//! delete path from filename //! delete path from filename
inline core::stringw& deletePathFromFilename(core::stringw& filename) inline io::path& deletePathFromFilename(io::path& filename)
{ {
// delete path from filename // delete path from filename
const wchar_t *s = filename.c_str(); const fschar_t* s = filename.c_str();
const wchar_t* p = s + filename.size(); const fschar_t* p = s + filename.size();
// search for path separator or beginning
while ( *p != '/' && *p != '\\' && p != s )
p--;
if ( p != s )
{
++p;
filename = p;
}
return filename;
}
//! delete path from filename
inline core::stringc& deletePathFromFilename(core::stringc& filename)
{
// delete path from filename
const c8 *s = filename.c_str();
const c8* p = s + filename.size();
// search for path separator or beginning // search for path separator or beginning
while ( *p != '/' && *p != '\\' && p != s ) while ( *p != '/' && *p != '\\' && p != s )
@ -117,21 +90,23 @@ inline io::path& deletePathFromPath(io::path& filename, s32 pathCount)
s32 i = filename.size(); s32 i = filename.size();
// search for path separator or beginning // search for path separator or beginning
while ( i ) while ( i>=0 )
{ {
if ( filename[i] == '/' || filename[i] == '\\' ) if ( filename[i] == '/' || filename[i] == '\\' )
{ {
if ( --pathCount <= 0 ) if ( --pathCount <= 0 )
break; break;
} }
i -= 1; --i;
} }
if ( i ) if ( i>0 )
{ {
filename [ i + 1 ] = 0; filename [ i + 1 ] = 0;
filename.validate(); filename.validate();
} }
else
filename="";
return filename; return filename;
} }

View File

@ -8,6 +8,7 @@
#include "irrTypes.h" #include "irrTypes.h"
#include "heapsort.h" #include "heapsort.h"
#include "irrAllocator.h" #include "irrAllocator.h"
#include "irrMath.h"
namespace irr namespace irr
{ {
@ -42,7 +43,7 @@ public:
//! Copy constructor //! Copy constructor
array(const array<T>& other) : data(0) array(const array<T, TAlloc>& other) : data(0)
{ {
*this = other; *this = other;
} }
@ -163,18 +164,25 @@ public:
} }
else else
{ {
// move array content and construct new element // element inserted not at end
// first move end one up if ( used > index )
for (u32 i=used; i>index; --i)
{ {
if (i<used) // create one new element at the end
allocator.destruct(&data[i]); allocator.construct(&data[used], data[used-1]);
allocator.construct(&data[i], data[i-1]); // data[i] = data[i-1];
// move the rest of the array content
for (u32 i=used-1; i>index; --i)
{
data[i] = data[i-1];
}
// insert the new element
data[index] = element;
}
else
{
// insert the new element to the end
allocator.construct(&data[index], element);
} }
// then add new element
if (used > index)
allocator.destruct(&data[index]);
allocator.construct(&data[index], element); // data[index] = element;
} }
// set to false as we don't know if we have the comparison operators // set to false as we don't know if we have the comparison operators
is_sorted = false; is_sorted = false;
@ -247,8 +255,10 @@ public:
//! Assignment operator //! Assignment operator
void operator=(const array<T>& other) const array<T, TAlloc>& operator=(const array<T, TAlloc>& other)
{ {
if (this == &other)
return *this;
strategy = other.strategy; strategy = other.strategy;
if (data) if (data)
@ -267,11 +277,13 @@ public:
for (u32 i=0; i<other.used; ++i) for (u32 i=0; i<other.used; ++i)
allocator.construct(&data[i], other.data[i]); // data[i] = other.data[i]; allocator.construct(&data[i], other.data[i]); // data[i] = other.data[i];
return *this;
} }
//! Equality operator //! Equality operator
bool operator == (const array<T>& other) const bool operator == (const array<T, TAlloc>& other) const
{ {
if (used != other.used) if (used != other.used)
return false; return false;
@ -284,7 +296,7 @@ public:
//! Inequality operator //! Inequality operator
bool operator != (const array<T>& other) const bool operator != (const array<T, TAlloc>& other) const
{ {
return !(*this==other); return !(*this==other);
} }
@ -372,7 +384,7 @@ public:
O(n*log n) in worst case. */ O(n*log n) in worst case. */
void sort() void sort()
{ {
if (!is_sorted || used>1) if (!is_sorted && used>1)
heapsort(data, used); heapsort(data, used);
is_sorted = true; is_sorted = true;
} }
@ -535,7 +547,10 @@ public:
\param count: Amount of elements to be erased. */ \param count: Amount of elements to be erased. */
void erase(u32 index, s32 count) void erase(u32 index, s32 count)
{ {
_IRR_DEBUG_BREAK_IF(index>=used || count<1 || index+count>used) // access violation if (index>=used || count<1)
return;
if (index+count>used)
count = used-index;
u32 i; u32 i;
for (i=index; i<index+count; ++i) for (i=index; i<index+count; ++i)
@ -563,6 +578,28 @@ public:
} }
//! Swap the content of this array container with the content of another array
/** Afterwards this object will contain the content of the other object and the other
object will contain the content of this object.
\param other Swap content with this object */
void swap(array<T, TAlloc>& other)
{
core::swap(data, other.data);
core::swap(allocated, other.allocated);
core::swap(used, other.used);
core::swap(allocator, other.allocator); // memory is still released by the same allocator used for allocation
eAllocStrategy helper_strategy(strategy); // can't use core::swap with bitfields
strategy = other.strategy;
other.strategy = helper_strategy;
bool helper_free_when_destroyed(free_when_destroyed);
free_when_destroyed = other.free_when_destroyed;
other.free_when_destroyed = helper_free_when_destroyed;
bool helper_is_sorted(is_sorted);
is_sorted = other.is_sorted;
other.is_sorted = helper_is_sorted;
}
private: private:
T* data; T* data;
u32 allocated; u32 allocated;

View File

@ -7,6 +7,7 @@
#include "irrTypes.h" #include "irrTypes.h"
#include "irrAllocator.h" #include "irrAllocator.h"
#include "irrMath.h"
namespace irr namespace irr
{ {
@ -74,11 +75,12 @@ public:
T * operator ->() { return &Current->Element; } T * operator ->() { return &Current->Element; }
private: private:
Iterator(SKListNode* begin) : Current(begin) {} explicit Iterator(SKListNode* begin) : Current(begin) {}
SKListNode* Current; SKListNode* Current;
friend class list<T>; friend class list<T>;
friend class ConstIterator;
}; };
//! List iterator for const access. //! List iterator for const access.
@ -87,6 +89,7 @@ public:
public: public:
ConstIterator() : Current(0) {} ConstIterator() : Current(0) {}
ConstIterator(const Iterator& iter) : Current(iter.Current) {}
ConstIterator& operator ++() { Current = Current->Next; return *this; } ConstIterator& operator ++() { Current = Current->Next; return *this; }
ConstIterator& operator --() { Current = Current->Prev; return *this; } ConstIterator& operator --() { Current = Current->Prev; return *this; }
@ -121,7 +124,7 @@ public:
ConstIterator & operator =(const Iterator & iterator) { Current = iterator.Current; return *this; } ConstIterator & operator =(const Iterator & iterator) { Current = iterator.Current; return *this; }
private: private:
ConstIterator(SKListNode* begin) : Current(begin) {} explicit ConstIterator(SKListNode* begin) : Current(begin) {}
SKListNode* Current; SKListNode* Current;
@ -382,8 +385,22 @@ public:
return returnIterator; return returnIterator;
} }
//! Swap the content of this list container with the content of another list
/** Afterwards this object will contain the content of the other object and the other
object will contain the content of this object. Iterators will afterwards be valid for
the swapped object.
\param other Swap content with this object */
void swap(list<T>& other)
{
core::swap(First, other.First);
core::swap(Last, other.Last);
core::swap(Size, other.Size);
core::swap(allocator, other.allocator); // memory is still released by the same allocator used for allocation
}
private: private:
SKListNode* First; SKListNode* First;
SKListNode* Last; SKListNode* Last;
u32 Size; u32 Size;

View File

@ -6,6 +6,7 @@
#define __IRR_MAP_H_INCLUDED__ #define __IRR_MAP_H_INCLUDED__
#include "irrTypes.h" #include "irrTypes.h"
#include "irrMath.h"
namespace irr namespace irr
{ {
@ -49,7 +50,7 @@ class map
RBTree* getLeftChild() const { return LeftChild; } RBTree* getLeftChild() const { return LeftChild; }
RBTree* getRightChild() const { return RightChild; } RBTree* getRightChild() const { return RightChild; }
RBTree* getParent() const { return Parent; } RBTree* getParent() const { return Parent; }
ValueTypeRB getValue() const ValueTypeRB getValue() const
{ {
@ -730,12 +731,18 @@ class map
//! Is the tree empty? //! Is the tree empty?
//! \return Returns true if empty, false if not //! \return Returns true if empty, false if not
bool isEmpty() const bool empty() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Root == 0; return Root == 0;
} }
//! \deprecated Use empty() instead.
_IRR_DEPRECATED_ bool isEmpty() const
{
return empty();
}
//! Search for a node with the specified key. //! Search for a node with the specified key.
//! \param keyToFind: The key to find //! \param keyToFind: The key to find
//! \return Returns 0 if node couldn't be found. //! \return Returns 0 if node couldn't be found.
@ -772,6 +779,17 @@ class map
return Size; return Size;
} }
//! Swap the content of this map container with the content of another map
/** Afterwards this object will contain the content of the other object and the other
object will contain the content of this object. Iterators will afterwards be valid for
the swapped object.
\param other Swap content with this object */
void swap(map<KeyType, ValueType>& other)
{
core::swap(Root, other.Root);
core::swap(Size, other.Size);
}
//------------------------------ //------------------------------
// Public Iterators // Public Iterators
//------------------------------ //------------------------------

View File

@ -47,7 +47,7 @@ namespace core
#endif #endif
//! Constant for PI. //! Constant for PI.
const f32 PI = 3.14159265359f; const f32 PI = 3.14159265359f;
//! Constant for reciprocal of PI. //! Constant for reciprocal of PI.
const f32 RECIPROCAL_PI = 1.0f/PI; const f32 RECIPROCAL_PI = 1.0f/PI;
@ -161,6 +161,15 @@ namespace core
return min_ (max_(value,low), high); return min_ (max_(value,low), high);
} }
//! swaps the content of the passed parameters
template <class T>
inline void swap(T& a, T& b)
{
T c(a);
a = b;
b = c;
}
//! returns if a equals b, taking possible rounding errors into account //! returns if a equals b, taking possible rounding errors into account
inline bool equals(const f64 a, const f64 b, const f64 tolerance = ROUNDING_ERROR_f64) inline bool equals(const f64 a, const f64 b, const f64 tolerance = ROUNDING_ERROR_f64)
{ {
@ -462,7 +471,7 @@ namespace core
__asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f) __asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f)
__asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f) __asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f)
__asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f) __asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f)
__asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f) __asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f)
// - f * rcpss(f) * rcpss(f) // - f * rcpss(f) * rcpss(f)
__asm movss rec, xmm0 // return xmm0 __asm movss rec, xmm0 // return xmm0
return rec; return rec;
@ -502,7 +511,7 @@ namespace core
__asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f) __asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f)
__asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f) __asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f)
__asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f) __asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f)
__asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f) __asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f)
// - f * rcpss(f) * rcpss(f) // - f * rcpss(f) * rcpss(f)
__asm movss rec, xmm0 // return xmm0 __asm movss rec, xmm0 // return xmm0
return rec; return rec;

View File

@ -84,15 +84,15 @@ public:
//! Constructor //! Constructor
string(const string<T>& other) string(const string<T,TAlloc>& other)
: array(0), allocated(0), used(0) : array(0), allocated(0), used(0)
{ {
*this = other; *this = other;
} }
//! Constructor from other string types //! Constructor from other string types
template <class B> template <class B, class A>
string(const string<B>& other) string(const string<B, A>& other)
: array(0), allocated(0), used(0) : array(0), allocated(0), used(0)
{ {
*this = other; *this = other;
@ -227,7 +227,7 @@ public:
//! Assignment operator //! Assignment operator
string<T>& operator=(const string<T>& other) string<T,TAlloc>& operator=(const string<T,TAlloc>& other)
{ {
if (this == &other) if (this == &other)
return *this; return *this;
@ -248,8 +248,8 @@ public:
} }
//! Assignment operator for other string types //! Assignment operator for other string types
template <class B> template <class B, class A>
string<T>& operator=(const string<B>& other) string<T,TAlloc>& operator=(const string<B,A>& other)
{ {
*this = other.c_str(); *this = other.c_str();
return *this; return *this;
@ -258,7 +258,7 @@ public:
//! Assignment operator for strings, ascii and unicode //! Assignment operator for strings, ascii and unicode
template <class B> template <class B>
string<T>& operator=(const B* const c) string<T,TAlloc>& operator=(const B* const c)
{ {
if (!c) if (!c)
{ {
@ -304,9 +304,9 @@ public:
//! Append operator for other strings //! Append operator for other strings
string<T> operator+(const string<T>& other) const string<T,TAlloc> operator+(const string<T,TAlloc>& other) const
{ {
string<T> str(*this); string<T,TAlloc> str(*this);
str.append(other); str.append(other);
return str; return str;
@ -315,9 +315,9 @@ public:
//! Append operator for strings, ascii and unicode //! Append operator for strings, ascii and unicode
template <class B> template <class B>
string<T> operator+(const B* const c) const string<T,TAlloc> operator+(const B* const c) const
{ {
string<T> str(*this); string<T,TAlloc> str(*this);
str.append(c); str.append(c);
return str; return str;
@ -356,7 +356,7 @@ public:
//! Equality operator //! Equality operator
bool operator ==(const string<T>& other) const bool operator ==(const string<T,TAlloc>& other) const
{ {
for(u32 i=0; array[i] && other.array[i]; ++i) for(u32 i=0; array[i] && other.array[i]; ++i)
if (array[i] != other.array[i]) if (array[i] != other.array[i])
@ -367,7 +367,7 @@ public:
//! Is smaller comparator //! Is smaller comparator
bool operator <(const string<T>& other) const bool operator <(const string<T,TAlloc>& other) const
{ {
for(u32 i=0; array[i] && other.array[i]; ++i) for(u32 i=0; array[i] && other.array[i]; ++i)
{ {
@ -388,7 +388,7 @@ public:
//! Inequality operator //! Inequality operator
bool operator !=(const string<T>& other) const bool operator !=(const string<T,TAlloc>& other) const
{ {
return !(*this == other); return !(*this == other);
} }
@ -430,7 +430,7 @@ public:
//! Compares the strings ignoring case. //! Compares the strings ignoring case.
/** \param other: Other string to compare. /** \param other: Other string to compare.
\return True if the strings are equal ignoring case. */ \return True if the strings are equal ignoring case. */
bool equals_ignore_case(const string<T>& other) const bool equals_ignore_case(const string<T,TAlloc>& other) const
{ {
for(u32 i=0; array[i] && other[i]; ++i) for(u32 i=0; array[i] && other[i]; ++i)
if (locale_lower( array[i]) != locale_lower(other[i])) if (locale_lower( array[i]) != locale_lower(other[i]))
@ -443,7 +443,7 @@ public:
/** \param other: Other string to compare. /** \param other: Other string to compare.
\param sourcePos: where to start to compare in the string \param sourcePos: where to start to compare in the string
\return True if the strings are equal ignoring case. */ \return True if the strings are equal ignoring case. */
bool equals_substring_ignore_case(const string<T>&other, const s32 sourcePos = 0 ) const bool equals_substring_ignore_case(const string<T,TAlloc>&other, const s32 sourcePos = 0 ) const
{ {
if ( (u32) sourcePos > used ) if ( (u32) sourcePos > used )
return false; return false;
@ -460,7 +460,7 @@ public:
//! Compares the strings ignoring case. //! Compares the strings ignoring case.
/** \param other: Other string to compare. /** \param other: Other string to compare.
\return True if this string is smaller ignoring case. */ \return True if this string is smaller ignoring case. */
bool lower_ignore_case(const string<T>& other) const bool lower_ignore_case(const string<T,TAlloc>& other) const
{ {
for(u32 i=0; array[i] && other.array[i]; ++i) for(u32 i=0; array[i] && other.array[i]; ++i)
{ {
@ -477,7 +477,7 @@ public:
/** \param other Other string to compare. /** \param other Other string to compare.
\param n Number of characters to compare \param n Number of characters to compare
\return True if the n first characters of both strings are equal. */ \return True if the n first characters of both strings are equal. */
bool equalsn(const string<T>& other, u32 n) const bool equalsn(const string<T,TAlloc>& other, u32 n) const
{ {
u32 i; u32 i;
for(i=0; array[i] && other[i] && i < n; ++i) for(i=0; array[i] && other[i] && i < n; ++i)
@ -553,7 +553,7 @@ public:
//! Appends a string to this string //! Appends a string to this string
/** \param other: String to append. */ /** \param other: String to append. */
void append(const string<T>& other) void append(const string<T,TAlloc>& other)
{ {
--used; --used;
u32 len = other.size()+1; u32 len = other.size()+1;
@ -571,7 +571,7 @@ public:
//! Appends a string of the length l to this string. //! Appends a string of the length l to this string.
/** \param other: other String to append to this string. /** \param other: other String to append to this string.
\param length: How much characters of the other string to add to this one. */ \param length: How much characters of the other string to add to this one. */
void append(const string<T>& other, u32 length) void append(const string<T,TAlloc>& other, u32 length)
{ {
if (other.size() < length) if (other.size() < length)
{ {
@ -775,17 +775,17 @@ public:
//! Returns a substring //! Returns a substring
/** \param begin: Start of substring. /** \param begin: Start of substring.
\param length: Length of substring. */ \param length: Length of substring. */
string<T> subString(u32 begin, s32 length) const string<T,TAlloc> subString(u32 begin, s32 length) const
{ {
// if start after string // if start after string
// or no proper substring length // or no proper substring length
if ((length <= 0) || (begin>=size())) if ((length <= 0) || (begin>=size()))
return string<T>(""); return string<T,TAlloc>("");
// clamp length to maximal value // clamp length to maximal value
if ((length+begin) > size()) if ((length+begin) > size())
length = size()-begin; length = size()-begin;
string<T> o; string<T,TAlloc> o;
o.reserve(length+1); o.reserve(length+1);
for (s32 i=0; i<length; ++i) for (s32 i=0; i<length; ++i)
@ -800,7 +800,7 @@ public:
//! Appends a character to this string //! Appends a character to this string
/** \param c Character to append. */ /** \param c Character to append. */
string<T>& operator += (T c) string<T,TAlloc>& operator += (T c)
{ {
append(c); append(c);
return *this; return *this;
@ -809,7 +809,7 @@ public:
//! Appends a char string to this string //! Appends a char string to this string
/** \param c Char string to append. */ /** \param c Char string to append. */
string<T>& operator += (const T* const c) string<T,TAlloc>& operator += (const T* const c)
{ {
append(c); append(c);
return *this; return *this;
@ -818,7 +818,7 @@ public:
//! Appends a string to this string //! Appends a string to this string
/** \param other String to append. */ /** \param other String to append. */
string<T>& operator += (const string<T>& other) string<T,TAlloc>& operator += (const string<T,TAlloc>& other)
{ {
append(other); append(other);
return *this; return *this;
@ -827,54 +827,54 @@ public:
//! Appends a string representation of a number to this string //! Appends a string representation of a number to this string
/** \param i Number to append. */ /** \param i Number to append. */
string<T>& operator += (const int i) string<T,TAlloc>& operator += (const int i)
{ {
append(string<T>(i)); append(string<T,TAlloc>(i));
return *this; return *this;
} }
//! Appends a string representation of a number to this string //! Appends a string representation of a number to this string
/** \param i Number to append. */ /** \param i Number to append. */
string<T>& operator += (const unsigned int i) string<T,TAlloc>& operator += (const unsigned int i)
{ {
append(string<T>(i)); append(string<T,TAlloc>(i));
return *this; return *this;
} }
//! Appends a string representation of a number to this string //! Appends a string representation of a number to this string
/** \param i Number to append. */ /** \param i Number to append. */
string<T>& operator += (const long i) string<T,TAlloc>& operator += (const long i)
{ {
append(string<T>(i)); append(string<T,TAlloc>(i));
return *this; return *this;
} }
//! Appends a string representation of a number to this string //! Appends a string representation of a number to this string
/** \param i Number to append. */ /** \param i Number to append. */
string<T>& operator += (const unsigned long& i) string<T,TAlloc>& operator += (const unsigned long& i)
{ {
append(string<T>(i)); append(string<T,TAlloc>(i));
return *this; return *this;
} }
//! Appends a string representation of a number to this string //! Appends a string representation of a number to this string
/** \param i Number to append. */ /** \param i Number to append. */
string<T>& operator += (const double i) string<T,TAlloc>& operator += (const double i)
{ {
append(string<T>(i)); append(string<T,TAlloc>(i));
return *this; return *this;
} }
//! Appends a string representation of a number to this string //! Appends a string representation of a number to this string
/** \param i Number to append. */ /** \param i Number to append. */
string<T>& operator += (const float i) string<T,TAlloc>& operator += (const float i)
{ {
append(string<T>(i)); append(string<T,TAlloc>(i));
return *this; return *this;
} }
@ -913,7 +913,7 @@ public:
//! Removes a string from the string. //! Removes a string from the string.
/** \param toRemove: String to remove. */ /** \param toRemove: String to remove. */
void remove(const string<T> toRemove) void remove(const string<T,TAlloc> toRemove)
{ {
u32 size = toRemove.size(); u32 size = toRemove.size();
u32 pos = 0; u32 pos = 0;
@ -943,7 +943,7 @@ public:
//! Removes characters from a string. //! Removes characters from a string.
/** \param characters: Characters to remove. */ /** \param characters: Characters to remove. */
void removeChars(const string<T> & characters) void removeChars(const string<T,TAlloc> & characters)
{ {
u32 pos = 0; u32 pos = 0;
u32 found = 0; u32 found = 0;
@ -974,7 +974,7 @@ public:
//! Trims the string. //! Trims the string.
/** Removes the specified characters (by default, Latin-1 whitespace) /** Removes the specified characters (by default, Latin-1 whitespace)
from the begining and the end of the string. */ from the begining and the end of the string. */
string<T>& trim(const string<T> & whitespace = " \t\n\r") string<T,TAlloc>& trim(const string<T,TAlloc> & whitespace = " \t\n\r")
{ {
// find start and end of the substring without the specified characters // find start and end of the substring without the specified characters
const s32 begin = findFirstCharNotInList(whitespace.c_str(), whitespace.used); const s32 begin = findFirstCharNotInList(whitespace.c_str(), whitespace.used);
@ -1068,7 +1068,7 @@ public:
{ {
if ((!ignoreEmptyTokens || i - lastpos != 0) && if ((!ignoreEmptyTokens || i - lastpos != 0) &&
!lastWasSeparator) !lastWasSeparator)
ret.push_back(string<T>(&array[lastpos], i - lastpos)); ret.push_back(string<T,TAlloc>(&array[lastpos], i - lastpos));
foundSeparator = true; foundSeparator = true;
lastpos = (keepSeparators ? i : i + 1); lastpos = (keepSeparators ? i : i + 1);
break; break;
@ -1077,7 +1077,7 @@ public:
lastWasSeparator = foundSeparator; lastWasSeparator = foundSeparator;
} }
if ((used - 1) > lastpos) if ((used - 1) > lastpos)
ret.push_back(string<T>(&array[lastpos], (used - 1) - lastpos)); ret.push_back(string<T,TAlloc>(&array[lastpos], (used - 1) - lastpos));
return ret.size()-oldSize; return ret.size()-oldSize;
} }

View File

@ -139,7 +139,7 @@ strings
//! define a break macro for debugging. //! define a break macro for debugging.
#if defined(_DEBUG) #if defined(_DEBUG)
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE) #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
#if defined(_WIN64) // using portable common solution for x64 configuration #if defined(WIN64) || defined(_WIN64) // using portable common solution for x64 configuration
#include <crtdbg.h> #include <crtdbg.h>
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();} #define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}
#else #else

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