Changes in version 1.6, TA
- FileSystem 2.0 SUPER MASTER MAJOR API CHANGE !!! The FileSystem is know build internally like for e.q the texture-, and the meshloaders. There exists a known list of ArchiveLoader, which know how to produce a Archive. The Loaders and the Archive can be attached/detached on runtime. The FileNames are now stored as core::string<c16>. where c16 is toggled between char/wchar with the #define flag _IRR_WCHAR_FILESYSTEM, to supported unicode backends (default:off) I replaced all (const c8* filename) to string references. Basically the FileSystem is divided into two regions. Native and Virtual. Native means using the backend OS. Virtual means only use currently attach IArchives. Browsing each FileSystem has it's own workdirectory and it's own methods to - create a FileTree - add/remove files & directory ( to be done ) Hint: store a savegame in a zip archive... basic browsing for all archives is implemented. Example 21. Quake3Explorer shows this TODO: - a file filter should be implemented. - The IArchive should have a function to create a filetree for now CFileList is used. Class Hiarchy: IArchiveLoader: is able to produce a IFileArchive - ZipLoader - PakLoader - MountPointReader ( formaly known as CUnzipReader ) IFileArchive: -ZipArchive -PakArchive -MountPoint (known as FolderFile) IFileSystem - addArchiveLoader - changed implementation of isALoadableFileExtension in all loaders to have consistent behavior - added a parameter to IFileList * createFileList setFileListSystem allows to query files in any of the game archives standard behavior listtype = SYSTEM ( default) - CLimitReadFile added multiple file random-access support. solved problems with mixed compressed & uncompressed files in a zip TODO: - Big Big Testing!! - Linux Version ( minor ) - remove all double loader interfaces where only the filename differs (IReadFile/const char *filename). This blows up the the interface - many loaders use their own private filesearching we should rework this - there are a lot of helper function ( getAbsolutePath, getFileDir ) which should be adapted to the virtual filesystem - IrrlichtDevice added: virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) = 0; virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue ) = 0; and calculating methods to DeviceStub. implemented in Win32, TODO: other Devices - irrlicht.h changed exported irrlicht.dll routines createDevice, createDeviceEx, IdentityMatrix to extern "C" name mangling. for easier dynamically loading the irrlicht library and different versions - ParticleSystem removed the private (old?,wrong?) interface from the ParticleEffectors to match the parent class irr::io::IAttributeExchangingObject::deserializeAttributes TODO: please test if the serialization works! - Generic - vector3d<T>& normalize() #if 0 f32 length = (f32)(X*X + Y*Y + Z*Z); if (core::equals(length, 0.f)) return *this; length = core::reciprocal_squareroot ( (f32)length ); #else const T length = core::reciprocal_squareroot ( (X*X + Y*Y + Z*Z) ); #endif Weak checking on zero?!?! just to avoid a sqrt?. mhm, maybe not;-) added reciprocal_squareroot for f64 - dimension2d added operator dimension2d<T>& operator=(const dimension2d<U>& other) to cast between different types - vector2d bugfix: vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Width; return *this; } to vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Height; return *this; } - C3DMeshLoader renamed chunks const u16 to a enum removing "variable declared but never used warning" - added a global const identity Material changed all references *((video::SMaterial*)0) to point to IdentityMaterial removed warning: "a NULL reference is not allowed" - modified IRRLICHT_MATH to not support reciprocal stuff but to use faster float-to-int conversion. gcc troubles may they are. i'm using intel-compiler..;-) - core::matrix4 USE_MATRIX_TEST i tried to optimize the identity-check ( in means of performance) i didn't succeed so well, so i made a define for the matrix isIdentity -check for now it's sometimes faster to always calculate versus identity-check but if there are a lot of scenenodes/ particles one can profit from the fast_inverse matrix, when no scaling is used. further approvement could be done on inverse for just tranlastion! ( many static scenenodes are not rotated, they are just placed somewhere in the world) one thing to take in account is that sizeof(matrix) is 64 byte and with the additional bool/u32 makes it 66 byte which is not really cache-friendly.. - added buildRotateFromTo Builds a matrix that rotates from one vector to another - irr::array. changed allocating routine in push_back okt, 2008. it's only allowed to alloc one element, if default constructor has to be called. removes existing crashes. ( MD3 Mesh ) and possible others ones. A new list template should be made. one with constructor/destructor calls ( safe_array ) and one without. like the array since the beginning of irrlicht. currently the array/string is extremly slow.. also a hint for the user has to be done, so that a struct T of array<T> must have a copy constructor of type T ( const T&other ). i needed hours to track that down... added a new method setAllocStrategy, safe ( used + 1 ), double ( used * 2 + 1) better default strategies will be implemented - removed binary_search_const i added it quite a long time ago, but it doesnt make real sense a call to a sort method should happen always. i just wanted to safe a few cycles.. - added binary_search_multi searches for a multi-set ( more than 1 entry in the sorted array) returns start and end-index - changed some identity matrix settings to use core::IdentityMatrix - added deletePathFromFilename to generic string functions in coreutil.h and removed from CZipReader and CPakReader - s32 deserializeAttributes used instead of virtual void deserializeAttributes in ParticleSystem ( wrong virtual was used) - strings & Locale - started to add locale support - added verify to string - added some helper functions - XBOX i have access to a XBOX development machine now. I started to compile for the XBOX. Question: Who did the previous implementation?. There is no XBOX-Device inhere. maybe it's forbidden because of using the offical Microsoft XDK. I will implement a native or sdl device based on opendk. irrlicht compiles without errors on the xbox but can't be used. TODO: - native XBOX Device - Windows Mobile reworked a little. added the mobile example to the windows solution for cross development. added maximal 128x128 texture size for windows mobile ( memory issues ) - Collision Speed Up The Collision Speed Up greatly improves with many small static child-nodes - added COctTreeTriangleSelector::getTriangles for 3dline from user Piraaate - modified createOctTreeTriangleSelector and createTriangleSelector to allow node == 0, to be added to a meta selector - CSceneNodeAnimatorCollisionResponse has the same problem as CSceneNodeAnimatorFPS on first update: Problem. you start setting the map. (setWorld). First update cames 4000 ms later. The Animator applies the missing force... big problem... changed to react on first update like camera. - add Variable FirstUpdate. if set to true ( on all changes ) then position, lasttime, and falling are initialized -added #define OCTTREE_USE_HARDWARE in Octree.h if defined octtree uses internally a derived scene::MeshBuffer which has the possibility to use the Hardware Vertex Buffer for static vertices and dirty indices;-) if defined OCTTREE_USE_HARDWARE octree uses internally a derived scene::CMeshBuffer so it's not just a replacement inside the octree. It also in the OctTreeSceneNode. #if defined (OCTTREE_USE_HARDWARE) driver->drawMeshBuffer ( &LightMapMeshes[i] ); #else driver->drawIndexedTriangleList( &LightMapMeshes[i].Vertices[0], LightMapMeshes[i].Vertices.size(), d[i].Indices, d[i].CurrentSize / 3); #endif #define OCTTREE_PARENTTEST is also used. It's skip testing on fully outside and takes everything on fully inside - virtual void ISceneNode::updateAbsolutePosition() - changed inline CMatrix4<T> CMatrix4<T>::operator*(const CMatrix4<T>& m2) const all two matrices have to be checked by isIdentity() to let the isIdentity work always -changed inline bool CMatrix4<T>::isIdentity() const on full identityCheck-> to look first on Translation, because this is the most challenging element which will likely not to be identity.. - virtual core::matrix4 getRelativeTransformation() const Hiarchy on Identity-Check 1) ->getRelativeTransform -> 9 floating point checks to be passed as Identity 2) ->isIdentity () -> 16 floating point checks to be passed as Identity - inline void CMatrix4<T>::transformBoxEx(core::aabbox3d<f32>& box) const added isIdentity() check - changed CSceneNodeAnimatorCollisionResponse - added CSceneNodeAnimatorCollisionResponse::setGravity needed to set the differents Forces for the Animator. for eq. water.. - added CSceneNodeAnimatorCollisionResponse::setAnimateTarget - added CSceneNodeAnimatorCollisionResponse::getAnimateTarget - changed CSceneNodeAnimatorCollisionResponse::animateNode to react on FirstUpdate - changad Gravity to - TODO: set Gravity to Physically frame independent values.. current response uses an frame depdended acceleration vector. ~9.81 m/s^2 was achieved at around 50 fps with a setting of -0.03 may effect existing application.. - SceneNodes - CSkyDomeSceneNode moved radius ( default 1000 ) to constructor added Normals added DebugInfo added Material.ZBuffer, added SceneMaanager - CVolumeLightSceneNode: changed default blending OneTextureBlendgl_src_color gl_src_alpha to EMT_TRANSPARENT_ADD_COLOR ( gl_src_color gl_one ) which gives the same effect on non-transparent-materials. Following the unspoken guide-line, lowest effect as default - added LensFlareSceneNode (from forum user gammaray, modified to work ) showing in example special fx - changed SceneNode Skydome f64 to f32, - AnimatedMesh -Debug Data: mesh normals didn't rotate with the scenenode fixed ( matrix-multiplication order) - Camera SceneNode setPosition Camera now finally allow to change position and target and updates all effected animators.. a call to OnAnimate ( ) lastime < time or OnAnimate ( 0 ) will reset the camera and fr. the collision animator to a new position - Device: added the current mousebutton state to the Mouse Event so i need to get the current mouse state from the OS -a dded to CIrrDeviceWin32 TODO: - Linux and SDL Device - GUI - CGUIFont: - added virtual void setInvisibleCharacters( const wchar_t *s ) = 0; define which characters should not be drawn ( send to driver) by the font. for example " " would not draw any space which is usually blank in most fonts and saves rendering of ususally full blank alpha-sprites. This saves a lot of rendering... default: setInvisibleCharacters ( L" " ); - added MultiLine rendering should avoid to us CStaticText breaking text in future - CGUIListBox - changed Scrollbar LargeStepSize to ItemHeight which easy enables to scroll line by line - CGUIScrollBar bug: Create a Window and inside a listbox with a scrollbar or a windowed irrlicht application Click & hold Scrollbar Slider. move outside it's region. Release Mouse. Go Back to Scrollbar.. it's moving always... it's generally missing the event PRESSED_MOVED, which leads to problem when an element is dragging, has a focus, or position loose and gets focus back again. ( think of a drunken mouse sliding left&right during tracking ) so added the mouse Input Buttonstates on every mouse event IrrDeviceWin32: added event.MouseInput.ButtonStates = wParam & ( MK_LBUTTON | MK_RBUTTON | MK_MBUTTON ); TODO: Linux & SDL so now i can do this case irr::EMIE_MOUSE_MOVED: if ( !event.MouseInput.isLeftPressed () ) { Dragging = false; } - bug: Scrollbar notifyListBox notify when the scrollbar is clicked. - changed timed event in draw to OnPostRender Why the hell is a gui element firing a timed event in a draw routine!!!!!. This should be corrected for all gui-elements. - added GUI Image List from Reinhard Ostermeier, modified to work added GUI Tree View from Reinhard Ostermeier, modified to work shown in the Quake3MapShader Example TODO: Spritebanks - FileOpenDialog changed the static text for the filename to an edit box. - changed the interface for addEditBox to match with addStaticText - changed the interface for addSpinBox to match with addEditBox - added MouseWheel to Spinbox - changed CGUITable CLICK_AREA from 3 to 12 to enable clicking on the visible marker - CGUISpritebank removed some crashes with empty Sprite banks - IGUIScrollBar added SetMin before min was always 0 changed ScrollWheel Direction on horizontal to move right on wheel up, left on wheel down - IComboBox -added ItemData - removed IsVisbile check in IGUIElement::draw - Image Loaders - added TGA file type 2 ( grayscale uncompressed ) - added TGA file type (1) 8 Bit indexed color uncompressed ColorConverter: - added convert_B8G8R8toA8R8G8B8 - added convert_B8G8R8A8toA8R8G8B8 - Media Files - added missing shaders and textures to map-20kdm2. Taken from free implementation - ball.wav. adjusted DC-Offset, amplified to -4dB, trim cross-zero - impact.wav clip-restoration, trim cross-zero - added gun.md2, gun.pcx to media-files copyright issues!. i don't know from where this file came from... i hope this is not from original quake2.. - added new irrlicht logo irrlicht3.png i've taken the new layout. i should ask niko to use it. - added Skydome picture to media files (skydome2.jpg) half/sphere - OctTree -added #define OCTTREE_PARENTTEST ( default: disabled ) used to leave-out children test if the parent passed a complete frustum. plus: leaves out children test minus: all edges have to be checked - added MesBuffer Hardware Hint Vertex to octtree - CQuake3ShaderSceneNode: - removed function releaseMesh Shader doesn't copy the original mesh anymore ( saving memory ) so therefore this (for others often misleading ) function was removed - changed constructor to take a (shared) destination meshbuffer for rendering reducing vertex-memory to a half - don't copy the original vertices anymore - added deformvertexes autosprite - added deformvertexes move - added support for RTCW and Raven BSPs ( qmap2 ) - added polygonoffset (TODO: not perfect) - added added nomipmaps - added rgbgen const - added alphagen - added MesBuffer Hardware Hint Vertex/Index to Quake3: static geometry, dynamic indices - added Quake3Explorer examples - added wave noise - added tcmod transform - added whiteimage - added collision to Quake3Explorer - renamed SMD3QuaterionTag* to SMD3QuaternionTag* ( typo ) - updated quake3:blendfunc - added crouch to Quake3Explorer (modifying the ellipsiodRadius of the camera animator ) added crouch to CSceneNodeAnimatorCameraFPS still problems with stand up and collision - Quake3MapLoader modified memory allocation for faster loading - Quake3LoadParam added Parameter to the Mesh-Loader - added The still existing missing caulking of curved surfaces. using round in the coordinates doesn't solve the problem. but for the demo bsp mesh it solves the problem... (luck) so for now it's switchable. TJUNCTION_SOLVER_ROUND default:off - BurningVideo - pushed BurningsVideo to 0.40 - added blendfunc gl_one_minus_dst_alpha gl_one - added blendfunc gl_dst_color gl_zero - added blendfunc gl_dst_color src_alpha - modified AlphaChannel_Ref renderer to support alpha test lessequal - addded 32 Bit Index Buffer - added sourceRect/destRect check to 2D-Blitter ( slower, but resolves crash ) - added setTextureCreationFlag video::ETCF_ALLOW_NON_POWER_2 Burning checks this flag and when set, it bypasses the power2 size check, which is necessary on 3D but can be avoided on 2D. used on fonts automatically. - added Support for Destination Alpha - OpenGL - Fixed a bug in COpenGLExtensenionHandler where a glint was downcasted to u8!!!!!! MaxTextureSize=static_cast<u32>(num); - TODO: COpenGLMaterialRenderer_ONETEXTURE_BLEND to work as expected - Direct3D8 - compile and links again - added 32 Bit Index Buffer - D3DSAMP_MIPMAPLODBIAS doesnt compile!. it is d3d9 i think. - compile for XBOX - Direc3D9 - fixed crash on RTT Textures DepthBuffer freed twice. added deleteAllTextures to destuctor - NullDriver - removeallTextures. added setMaterial ( SMaterial() ) to clean pointers for freed textures git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2147 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
d5eff56acd
commit
cf2cfa5f14
463
changes.txt
463
changes.txt
|
@ -1,3 +1,466 @@
|
|||
Changes in version 1.6, TA
|
||||
|
||||
- FileSystem 2.0 SUPER MASTER MAJOR API CHANGE !!!
|
||||
|
||||
The FileSystem is know build internally like for e.q the texture-, and the meshloaders.
|
||||
There exists a known list of ArchiveLoader, which know how to produce a Archive.
|
||||
The Loaders and the Archive can be attached/detached on runtime.
|
||||
|
||||
The FileNames are now stored as core::string<c16>. where c16 is toggled between char/wchar
|
||||
with the #define flag _IRR_WCHAR_FILESYSTEM, to supported unicode backends (default:off)
|
||||
I replaced all (const c8* filename) to string references.
|
||||
|
||||
Basically the FileSystem is divided into two regions. Native and Virtual.
|
||||
Native means using the backend OS.
|
||||
Virtual means only use currently attach IArchives.
|
||||
|
||||
Browsing
|
||||
each FileSystem has it's own workdirectory and it's own methods to
|
||||
- create a FileTree
|
||||
- add/remove files & directory ( to be done )
|
||||
Hint: store a savegame in a zip archive...
|
||||
|
||||
basic browsing for all archives is implemented.
|
||||
Example 21. Quake3Explorer shows this
|
||||
|
||||
TODO:
|
||||
- a file filter should be implemented.
|
||||
- The IArchive should have a function to create a filetree
|
||||
for now CFileList is used.
|
||||
|
||||
Class Hiarchy:
|
||||
|
||||
IArchiveLoader: is able to produce a IFileArchive
|
||||
- ZipLoader
|
||||
- PakLoader
|
||||
- MountPointReader ( formaly known as CUnzipReader )
|
||||
|
||||
IFileArchive:
|
||||
-ZipArchive
|
||||
-PakArchive
|
||||
-MountPoint (known as FolderFile)
|
||||
|
||||
IFileSystem
|
||||
- addArchiveLoader
|
||||
|
||||
- changed implementation of isALoadableFileExtension in all loaders
|
||||
to have consistent behavior
|
||||
- added a parameter to IFileList * createFileList
|
||||
setFileListSystem
|
||||
allows to query files in any of the game archives
|
||||
standard behavior listtype = SYSTEM ( default)
|
||||
|
||||
- CLimitReadFile
|
||||
added multiple file random-access support.
|
||||
solved problems with mixed compressed & uncompressed files in a zip
|
||||
|
||||
TODO:
|
||||
- Big Big Testing!!
|
||||
- Linux Version ( minor )
|
||||
- remove all double loader interfaces where only the filename differs
|
||||
(IReadFile/const char *filename). This blows up the the interface
|
||||
- many loaders use their own private filesearching
|
||||
we should rework this
|
||||
- there are a lot of helper function ( getAbsolutePath, getFileDir )
|
||||
which should be adapted to the virtual filesystem
|
||||
|
||||
- IrrlichtDevice
|
||||
added:
|
||||
virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) = 0;
|
||||
virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue ) = 0;
|
||||
|
||||
and calculating methods to DeviceStub.
|
||||
implemented in Win32, TODO: other Devices
|
||||
|
||||
- irrlicht.h
|
||||
changed exported irrlicht.dll routines createDevice, createDeviceEx, IdentityMatrix
|
||||
to extern "C" name mangling.
|
||||
|
||||
for easier dynamically loading the irrlicht library and different versions
|
||||
|
||||
- ParticleSystem
|
||||
removed the private (old?,wrong?) interface from the ParticleEffectors
|
||||
to match the parent class irr::io::IAttributeExchangingObject::deserializeAttributes
|
||||
TODO:
|
||||
please test if the serialization works!
|
||||
|
||||
- Generic
|
||||
- vector3d<T>& normalize()
|
||||
#if 0
|
||||
f32 length = (f32)(X*X + Y*Y + Z*Z);
|
||||
if (core::equals(length, 0.f))
|
||||
return *this;
|
||||
length = core::reciprocal_squareroot ( (f32)length );
|
||||
#else
|
||||
const T length = core::reciprocal_squareroot ( (X*X + Y*Y + Z*Z) );
|
||||
#endif
|
||||
|
||||
Weak checking on zero?!?! just to avoid a sqrt?. mhm, maybe not;-)
|
||||
added reciprocal_squareroot for f64
|
||||
|
||||
- dimension2d
|
||||
added operator dimension2d<T>& operator=(const dimension2d<U>& other)
|
||||
to cast between different types
|
||||
- vector2d
|
||||
bugfix:
|
||||
vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Width; return *this; }
|
||||
to
|
||||
vector2d<T>& operator+=(const dimension2d<T>& other) { X += other.Width; Y += other.Height; return *this; }
|
||||
|
||||
- C3DMeshLoader renamed chunks const u16 to a enum
|
||||
removing "variable declared but never used warning"
|
||||
- added a global const identity Material
|
||||
changed all references *((video::SMaterial*)0) to point to IdentityMaterial
|
||||
removed warning: "a NULL reference is not allowed"
|
||||
|
||||
- modified IRRLICHT_MATH to not support reciprocal stuff
|
||||
but to use faster float-to-int conversion.
|
||||
gcc troubles may they are. i'm using intel-compiler..;-)
|
||||
- core::matrix4
|
||||
USE_MATRIX_TEST
|
||||
|
||||
i tried to optimize the identity-check ( in means of performance)
|
||||
i didn't succeed so well, so i made a define for the matrix isIdentity -check
|
||||
for now it's sometimes faster to always calculate versus identity-check
|
||||
but if there are a lot of scenenodes/ particles one can profit from the
|
||||
fast_inverse matrix, when no scaling is used. further approvement could
|
||||
be done on inverse for just tranlastion! ( many static scenenodes are not rotated,
|
||||
they are just placed somewhere in the world)
|
||||
one thing to take in account is that sizeof(matrix) is 64 byte and
|
||||
with the additional bool/u32 makes it 66 byte which is not really cache-friendly..
|
||||
|
||||
- added buildRotateFromTo
|
||||
Builds a matrix that rotates from one vector to another
|
||||
|
||||
- irr::array. changed allocating routine in push_back
|
||||
|
||||
okt, 2008. it's only allowed to alloc one element, if
|
||||
default constructor has to be called.
|
||||
|
||||
removes existing crashes. ( MD3 Mesh ) and possible others ones.
|
||||
|
||||
A new list template should be made.
|
||||
one with constructor/destructor calls ( safe_array ) and
|
||||
one without. like the array since the beginning of irrlicht.
|
||||
currently the array/string is extremly slow..
|
||||
|
||||
also a hint for the user has to be done, so that a struct T of
|
||||
array<T> must have a copy constructor of type T ( const T&other ).
|
||||
|
||||
i needed hours to track that down...
|
||||
|
||||
added a new method setAllocStrategy,
|
||||
safe ( used + 1 ), double ( used * 2 + 1)
|
||||
|
||||
better default strategies will be implemented
|
||||
|
||||
- removed binary_search_const
|
||||
i added it quite a long time ago, but it doesnt make real sense
|
||||
a call to a sort method should happen always. i just wanted to safe
|
||||
a few cycles..
|
||||
- added binary_search_multi
|
||||
searches for a multi-set ( more than 1 entry in the sorted array)
|
||||
returns start and end-index
|
||||
|
||||
- changed some identity matrix settings to use core::IdentityMatrix
|
||||
- added deletePathFromFilename to generic string functions in coreutil.h and
|
||||
removed from CZipReader and CPakReader
|
||||
|
||||
- s32 deserializeAttributes used instead of virtual void deserializeAttributes in
|
||||
ParticleSystem ( wrong virtual was used)
|
||||
|
||||
- strings & Locale
|
||||
- started to add locale support
|
||||
- added verify to string
|
||||
- added some helper functions
|
||||
|
||||
|
||||
- XBOX
|
||||
i have access to a XBOX development machine now. I started to compile
|
||||
for the XBOX. Question: Who did the previous implementation?. There
|
||||
is no XBOX-Device inhere. maybe it's forbidden because of using the offical
|
||||
Microsoft XDK. I will implement a native or sdl device based on opendk.
|
||||
irrlicht compiles without errors on the xbox but can't be used.
|
||||
|
||||
TODO:
|
||||
- native XBOX Device
|
||||
- Windows Mobile
|
||||
reworked a little. added the mobile example to the windows solution for
|
||||
cross development.
|
||||
added maximal 128x128 texture size for windows mobile ( memory issues )
|
||||
- Collision Speed Up
|
||||
|
||||
The Collision Speed Up greatly improves with many small static child-nodes
|
||||
|
||||
- added COctTreeTriangleSelector::getTriangles for 3dline from user Piraaate
|
||||
- modified createOctTreeTriangleSelector and createTriangleSelector
|
||||
to allow node == 0, to be added to a meta selector
|
||||
- CSceneNodeAnimatorCollisionResponse has the same problem as CSceneNodeAnimatorFPS
|
||||
on first update:
|
||||
Problem. you start setting the map. (setWorld). First update cames 4000 ms later.
|
||||
The Animator applies the missing force... big problem...
|
||||
changed to react on first update like camera.
|
||||
|
||||
- add Variable FirstUpdate. if set to true ( on all changes )
|
||||
then position, lasttime, and falling are initialized
|
||||
|
||||
-added #define OCTTREE_USE_HARDWARE in Octree.h
|
||||
|
||||
if defined octtree uses internally a derived scene::MeshBuffer which has
|
||||
the possibility to use the Hardware Vertex Buffer for static vertices and
|
||||
dirty indices;-)
|
||||
|
||||
if defined OCTTREE_USE_HARDWARE octree uses internally a derived scene::CMeshBuffer
|
||||
so it's not just a replacement inside the octree. It also in the OctTreeSceneNode.
|
||||
#if defined (OCTTREE_USE_HARDWARE)
|
||||
driver->drawMeshBuffer ( &LightMapMeshes[i] );
|
||||
#else
|
||||
driver->drawIndexedTriangleList( &LightMapMeshes[i].Vertices[0], LightMapMeshes[i].Vertices.size(),
|
||||
d[i].Indices, d[i].CurrentSize / 3);
|
||||
#endif
|
||||
#define OCTTREE_PARENTTEST is also used. It's skip testing on fully outside and takes everything on fully inside
|
||||
|
||||
|
||||
- virtual void ISceneNode::updateAbsolutePosition()
|
||||
- changed
|
||||
inline CMatrix4<T> CMatrix4<T>::operator*(const CMatrix4<T>& m2) const
|
||||
|
||||
all two matrices have to be checked by isIdentity()
|
||||
to let the isIdentity work always
|
||||
|
||||
-changed inline bool CMatrix4<T>::isIdentity() const
|
||||
|
||||
on full identityCheck->
|
||||
to look first on Translation, because this is the most challenging element
|
||||
which will likely not to be identity..
|
||||
|
||||
- virtual core::matrix4 getRelativeTransformation() const
|
||||
|
||||
Hiarchy on Identity-Check
|
||||
1) ->getRelativeTransform -> 9 floating point checks to be passed as Identity
|
||||
2) ->isIdentity () -> 16 floating point checks to be passed as Identity
|
||||
|
||||
- inline void CMatrix4<T>::transformBoxEx(core::aabbox3d<f32>& box) const
|
||||
added isIdentity() check
|
||||
|
||||
|
||||
- changed CSceneNodeAnimatorCollisionResponse
|
||||
- added CSceneNodeAnimatorCollisionResponse::setGravity
|
||||
needed to set the differents Forces for the Animator. for eq. water..
|
||||
- added CSceneNodeAnimatorCollisionResponse::setAnimateTarget
|
||||
- added CSceneNodeAnimatorCollisionResponse::getAnimateTarget
|
||||
- changed CSceneNodeAnimatorCollisionResponse::animateNode to react on FirstUpdate
|
||||
- changad Gravity to
|
||||
- TODO: set Gravity to Physically frame independent values..
|
||||
current response uses an frame depdended acceleration vector.
|
||||
~9.81 m/s^2 was achieved at around 50 fps with a setting of -0.03
|
||||
may effect existing application..
|
||||
|
||||
- SceneNodes
|
||||
- CSkyDomeSceneNode
|
||||
moved radius ( default 1000 ) to constructor
|
||||
added Normals
|
||||
added DebugInfo
|
||||
added Material.ZBuffer, added SceneMaanager
|
||||
|
||||
- CVolumeLightSceneNode:
|
||||
changed default blending OneTextureBlendgl_src_color gl_src_alpha to
|
||||
EMT_TRANSPARENT_ADD_COLOR ( gl_src_color gl_one )
|
||||
which gives the same effect on non-transparent-materials.
|
||||
Following the unspoken guide-line, lowest effect as default
|
||||
- added LensFlareSceneNode (from forum user gammaray, modified to work )
|
||||
showing in example special fx
|
||||
- changed SceneNode Skydome f64 to f32,
|
||||
- AnimatedMesh
|
||||
-Debug Data:
|
||||
mesh normals didn't rotate with the scenenode fixed ( matrix-multiplication order)
|
||||
- Camera SceneNode setPosition
|
||||
Camera now finally allow to change position and target and updates all
|
||||
effected animators..
|
||||
|
||||
a call to OnAnimate ( ) lastime < time or OnAnimate ( 0 ) will reset the
|
||||
camera and fr. the collision animator to a new position
|
||||
|
||||
- Device:
|
||||
added the current mousebutton state to the Mouse Event
|
||||
so i need to get the current mouse state from the OS
|
||||
|
||||
-a dded to CIrrDeviceWin32
|
||||
TODO:
|
||||
- Linux and SDL Device
|
||||
- GUI
|
||||
|
||||
- CGUIFont:
|
||||
- added virtual void setInvisibleCharacters( const wchar_t *s ) = 0;
|
||||
|
||||
define which characters should not be drawn ( send to driver) by the font.
|
||||
for example " " would not draw any space which is usually blank in most fonts
|
||||
and saves rendering of ususally full blank alpha-sprites.
|
||||
This saves a lot of rendering...
|
||||
|
||||
default:
|
||||
setInvisibleCharacters ( L" " );
|
||||
|
||||
- added MultiLine rendering
|
||||
should avoid to us CStaticText breaking text in future
|
||||
- CGUIListBox
|
||||
- changed Scrollbar LargeStepSize to ItemHeight
|
||||
which easy enables to scroll line by line
|
||||
|
||||
- CGUIScrollBar
|
||||
bug:
|
||||
Create a Window and inside a listbox with a scrollbar or
|
||||
a windowed irrlicht application
|
||||
|
||||
Click & hold Scrollbar Slider. move outside it's region.
|
||||
Release Mouse. Go Back to Scrollbar.. it's moving always...
|
||||
|
||||
it's generally missing the event PRESSED_MOVED, which
|
||||
leads to problem when an element is dragging, has a focus, or position loose
|
||||
and gets focus back again. ( think of a drunken mouse sliding left&right during tracking )
|
||||
|
||||
so added the mouse Input Buttonstates on every mouse event
|
||||
IrrDeviceWin32:
|
||||
added event.MouseInput.ButtonStates = wParam & ( MK_LBUTTON | MK_RBUTTON | MK_MBUTTON );
|
||||
TODO:
|
||||
Linux & SDL
|
||||
|
||||
so now i can do this
|
||||
case irr::EMIE_MOUSE_MOVED:
|
||||
if ( !event.MouseInput.isLeftPressed () )
|
||||
{
|
||||
Dragging = false;
|
||||
}
|
||||
|
||||
- bug:
|
||||
Scrollbar notifyListBox notify when the scrollbar is clicked.
|
||||
|
||||
- changed timed event in draw to OnPostRender
|
||||
Why the hell is a gui element firing a timed event
|
||||
in a draw routine!!!!!. This should be corrected for all gui-elements.
|
||||
|
||||
|
||||
- added GUI Image List from Reinhard Ostermeier, modified to work
|
||||
added GUI Tree View from Reinhard Ostermeier, modified to work
|
||||
shown in the Quake3MapShader Example
|
||||
TODO: Spritebanks
|
||||
|
||||
|
||||
- FileOpenDialog
|
||||
changed the static text for the filename to an edit box.
|
||||
- changed the interface for addEditBox to match with addStaticText
|
||||
- changed the interface for addSpinBox to match with addEditBox
|
||||
- added MouseWheel to Spinbox
|
||||
- changed CGUITable CLICK_AREA from 3 to 12 to enable clicking on the visible marker
|
||||
- CGUISpritebank
|
||||
removed some crashes with empty Sprite banks
|
||||
- IGUIScrollBar
|
||||
added SetMin before min was always 0
|
||||
changed ScrollWheel Direction on horizontal to move right on wheel up, left on wheel down
|
||||
|
||||
- IComboBox
|
||||
-added ItemData
|
||||
- removed IsVisbile check in IGUIElement::draw
|
||||
|
||||
|
||||
- Image Loaders
|
||||
- added TGA file type 2 ( grayscale uncompressed )
|
||||
- added TGA file type (1) 8 Bit indexed color uncompressed
|
||||
|
||||
ColorConverter:
|
||||
- added convert_B8G8R8toA8R8G8B8
|
||||
- added convert_B8G8R8A8toA8R8G8B8
|
||||
|
||||
- Media Files
|
||||
- added missing shaders and textures to map-20kdm2.
|
||||
Taken from free implementation
|
||||
- ball.wav. adjusted DC-Offset, amplified to -4dB, trim cross-zero
|
||||
- impact.wav clip-restoration, trim cross-zero
|
||||
- added gun.md2, gun.pcx to media-files
|
||||
copyright issues!. i don't know from where this file came from...
|
||||
i hope this is not from original quake2..
|
||||
- added new irrlicht logo irrlicht3.png
|
||||
i've taken the new layout. i should ask niko to use it.
|
||||
- added Skydome picture to media files (skydome2.jpg) half/sphere
|
||||
|
||||
- OctTree
|
||||
-added
|
||||
#define OCTTREE_PARENTTEST ( default: disabled )
|
||||
used to leave-out children test if the parent passed a complete frustum.
|
||||
plus: leaves out children test
|
||||
minus: all edges have to be checked
|
||||
- added MesBuffer Hardware Hint Vertex to octtree
|
||||
|
||||
- CQuake3ShaderSceneNode:
|
||||
- removed function releaseMesh
|
||||
Shader doesn't copy the original mesh anymore ( saving memory )
|
||||
so therefore this (for others often misleading ) function was removed
|
||||
- changed constructor to take a (shared) destination meshbuffer for rendering
|
||||
reducing vertex-memory to a half
|
||||
- don't copy the original vertices anymore
|
||||
- added deformvertexes autosprite
|
||||
- added deformvertexes move
|
||||
- added support for RTCW and Raven BSPs ( qmap2 )
|
||||
- added polygonoffset (TODO: not perfect)
|
||||
- added added nomipmaps
|
||||
- added rgbgen const
|
||||
- added alphagen
|
||||
- added MesBuffer Hardware Hint Vertex/Index to Quake3: static geometry, dynamic indices
|
||||
- added Quake3Explorer examples
|
||||
- added wave noise
|
||||
- added tcmod transform
|
||||
- added whiteimage
|
||||
- added collision to Quake3Explorer
|
||||
- renamed SMD3QuaterionTag* to SMD3QuaternionTag* ( typo )
|
||||
- updated quake3:blendfunc
|
||||
- added crouch to Quake3Explorer
|
||||
(modifying the ellipsiodRadius of the camera animator )
|
||||
added crouch to CSceneNodeAnimatorCameraFPS
|
||||
still problems with stand up and collision
|
||||
- Quake3MapLoader
|
||||
modified memory allocation for faster loading
|
||||
- Quake3LoadParam
|
||||
added Parameter to the Mesh-Loader
|
||||
- added
|
||||
The still existing missing caulking of curved surfaces.
|
||||
using round in the coordinates doesn't solve the problem.
|
||||
but for the demo bsp mesh it solves the problem... (luck)
|
||||
so for now it's switchable.
|
||||
TJUNCTION_SOLVER_ROUND
|
||||
default:off
|
||||
|
||||
- BurningVideo
|
||||
- pushed BurningsVideo to 0.40
|
||||
- added blendfunc gl_one_minus_dst_alpha gl_one
|
||||
- added blendfunc gl_dst_color gl_zero
|
||||
- added blendfunc gl_dst_color src_alpha
|
||||
- modified AlphaChannel_Ref renderer to support alpha test lessequal
|
||||
- addded 32 Bit Index Buffer
|
||||
- added sourceRect/destRect check to 2D-Blitter ( slower, but resolves crash )
|
||||
- added setTextureCreationFlag video::ETCF_ALLOW_NON_POWER_2
|
||||
Burning checks this flag and when set, it bypasses the power2 size check,
|
||||
which is necessary on 3D but can be avoided on 2D.
|
||||
used on fonts automatically.
|
||||
- added Support for Destination Alpha
|
||||
|
||||
- OpenGL
|
||||
- Fixed a bug in COpenGLExtensenionHandler where a glint was downcasted to u8!!!!!!
|
||||
MaxTextureSize=static_cast<u32>(num);
|
||||
|
||||
- TODO: COpenGLMaterialRenderer_ONETEXTURE_BLEND to work as expected
|
||||
|
||||
- Direct3D8
|
||||
- compile and links again
|
||||
- added 32 Bit Index Buffer
|
||||
- D3DSAMP_MIPMAPLODBIAS doesnt compile!. it is d3d9 i think.
|
||||
- compile for XBOX
|
||||
- Direc3D9
|
||||
- fixed crash on RTT Textures DepthBuffer freed twice.
|
||||
added deleteAllTextures to destuctor
|
||||
- NullDriver
|
||||
- removeallTextures. added setMaterial ( SMaterial() ) to clean pointers for freed textures
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Changes in version 1.6
|
||||
|
||||
- New scene parameter B3D_LOADER_IGNORE_MIPMAP_FLAG to ignore the often missing mipmap flag in b3d files. If this parameter is true, the old pre Irrlicht-1.5 behavior is restored.
|
||||
|
|
|
@ -171,7 +171,10 @@ int main()
|
|||
*/
|
||||
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
|
||||
if (!mesh)
|
||||
{
|
||||
device->drop();
|
||||
return 1;
|
||||
}
|
||||
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
|
||||
|
||||
/*
|
||||
|
|
|
@ -191,7 +191,7 @@ int main()
|
|||
To be able to look at and move around in this scene, we create a first
|
||||
person shooter style camera and make the mouse cursor invisible.
|
||||
*/
|
||||
smgr->addCameraSceneNodeFPS(0, 100.0f, .1f);
|
||||
smgr->addCameraSceneNodeFPS();
|
||||
device->getCursorControl()->setVisible(false);
|
||||
|
||||
/*
|
||||
|
|
|
@ -104,7 +104,7 @@ int main()
|
|||
want to.
|
||||
*/
|
||||
|
||||
mesh = smgr->addHillPlaneMesh("myHill",
|
||||
mesh = smgr->addHillPlaneMesh( "myHill",
|
||||
core::dimension2d<f32>(20,20),
|
||||
core::dimension2d<u32>(40,40), 0, 0,
|
||||
core::dimension2d<f32>(0,0),
|
||||
|
|
|
@ -133,18 +133,18 @@ void loadModel(const c8* fn)
|
|||
extension == ".bmp" || extension == ".wal")
|
||||
{
|
||||
video::ITexture * texture =
|
||||
Device->getVideoDriver()->getTexture( filename.c_str() );
|
||||
Device->getVideoDriver()->getTexture( filename );
|
||||
if ( texture && Model )
|
||||
{
|
||||
// always reload texture
|
||||
Device->getVideoDriver()->removeTexture(texture);
|
||||
texture = Device->getVideoDriver()->getTexture( filename.c_str() );
|
||||
texture = Device->getVideoDriver()->getTexture( filename );
|
||||
|
||||
Model->setMaterialTexture(0, texture);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// if a archive is loaded add it to the FileSystems..
|
||||
// if a archive is loaded add it to the FileArchive..
|
||||
else if (extension == ".pk3" || extension == ".zip")
|
||||
{
|
||||
Device->getFileSystem()->addZipFileArchive(filename.c_str());
|
||||
|
@ -614,7 +614,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
// read configuration from xml file
|
||||
|
||||
io::IXMLReader* xml = Device->getFileSystem()->createXMLReader("config.xml");
|
||||
io::IXMLReader* xml = Device->getFileSystem()->createXMLReader( L"config.xml");
|
||||
|
||||
while(xml && xml->read())
|
||||
{
|
||||
|
|
|
@ -171,8 +171,8 @@ int main()
|
|||
addShaderMaterial() instead of addShaderMaterialFromFiles().
|
||||
*/
|
||||
|
||||
const c8* vsFileName = 0; // filename for the vertex shader
|
||||
const c8* psFileName = 0; // filename for the pixel shader
|
||||
core::string<c16> vsFileName; // filename for the vertex shader
|
||||
core::string<c16> psFileName; // filename for the pixel shader
|
||||
|
||||
switch(driverType)
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ int main()
|
|||
{
|
||||
device->getLogger()->log("WARNING: Pixel shaders disabled "\
|
||||
"because of missing driver/hardware support.");
|
||||
psFileName = 0;
|
||||
psFileName = "";
|
||||
}
|
||||
|
||||
if (!driver->queryFeature(video::EVDF_VERTEX_SHADER_1_1) &&
|
||||
|
@ -233,7 +233,7 @@ int main()
|
|||
{
|
||||
device->getLogger()->log("WARNING: Vertex shaders disabled "\
|
||||
"because of missing driver/hardware support.");
|
||||
vsFileName = 0;
|
||||
vsFileName = "";
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -380,7 +380,7 @@ int main()
|
|||
|
||||
// add a camera and disable the mouse cursor
|
||||
|
||||
scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(0, 100.0f, .1f);
|
||||
scene::ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS();
|
||||
cam->setPosition(core::vector3df(-100,50,100));
|
||||
cam->setTarget(core::vector3df(0,0,0));
|
||||
device->getCursorControl()->setVisible(false);
|
||||
|
|
|
@ -207,8 +207,7 @@ int main()
|
|||
core::position2d<s32>(10,10));
|
||||
|
||||
// add camera
|
||||
scene::ICameraSceneNode* camera =
|
||||
smgr->addCameraSceneNodeFPS(0, 100.0f, .3f);
|
||||
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
|
||||
camera->setPosition(core::vector3df(-200,200,-200));
|
||||
|
||||
// disable mouse cursor
|
||||
|
|
|
@ -68,7 +68,7 @@ int main()
|
|||
*/
|
||||
|
||||
// load the scene
|
||||
smgr->loadScene("../../media/example.irr");
|
||||
smgr->loadScene( "../../media/example.irr");
|
||||
|
||||
/*
|
||||
Now we'll create a camera, and give it a collision response animator
|
||||
|
|
|
@ -191,6 +191,9 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
|
||||
|
||||
|
||||
// Quake3 Shader controls Z-Writing
|
||||
smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
|
||||
|
||||
/*
|
||||
Now we can load the mesh by calling getMesh(). We get a pointer returned
|
||||
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
|
||||
|
@ -251,7 +254,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
s32 shaderIndex = (s32) material.MaterialTypeParam2;
|
||||
|
||||
// the meshbuffer can be rendered without additional support, or it has no shader
|
||||
const quake3::SShader *shader = mesh->getShader ( shaderIndex );
|
||||
const quake3::IShader *shader = mesh->getShader ( shaderIndex );
|
||||
if ( 0 == shader )
|
||||
{
|
||||
continue;
|
||||
|
@ -294,8 +297,6 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
|
||||
// original mesh is not needed anymore
|
||||
mesh->releaseMesh ( quake3::E_Q3_MESH_ITEMS );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -422,6 +423,12 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
str += calls;
|
||||
str += "/";
|
||||
str += culled;
|
||||
str += " Draw: ";
|
||||
str += attr->getAttributeAsInt ( "drawn_solid" );
|
||||
str += "/";
|
||||
str += attr->getAttributeAsInt ( "drawn_transparent" );
|
||||
str += "/";
|
||||
str += attr->getAttributeAsInt ( "drawn_transparent_effect" );
|
||||
|
||||
device->setWindowCaption(str.c_str());
|
||||
lastFPS = fps;
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "17.HelloWorld_mobile", "HelloWorld_mobile.vcproj", "{AD95D5D7-91D2-4030-B28D-23A6FE5C0359}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "..\..\source\Irrlicht\Irrlicht_mobile6.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
|
||||
EndProject
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
ForceDirty="-1"
|
||||
RemoteDirectory="%CSIDL_PROGRAM_FILES%\irrlicht\bin\wince-visualstudio"
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles="sydney.md2|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;sydney.bmp|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht.dll|$(InputDir)$(OutDir)|%CSIDL_PROGRAM_FILES%\irrlicht\bin\wince-visualstudio|0"
|
||||
AdditionalFiles="sydney.md2|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;sydney.bmp|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;ninja.b3d|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;nskinbl.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlichtlogo3.png|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;terrain-heightmap.bmp|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;terrain-texture.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;detailmap3.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_up.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_dn.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_lf.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_rt.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_ft.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_bk.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;skydome.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht.dll|$(InputDir)$(OutDir)|%CSIDL_PROGRAM_FILES%\irrlicht\bin\wince-visualstudio|0"
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
|
@ -130,7 +130,7 @@
|
|||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
DebugInformationFormat="0"
|
||||
EnableFloatingPointEmulation="true"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -179,7 +179,7 @@
|
|||
ForceDirty="-1"
|
||||
RemoteDirectory="%CSIDL_PROGRAM_FILES%\irrlicht\bin\wince-visualstudio"
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles="sydney.md2|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;sydney.bmp|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht.dll|$(InputDir)$(OutDir)|%CSIDL_PROGRAM_FILES%\irrlicht\bin\wince-visualstudio|0"
|
||||
AdditionalFiles="sydney.md2|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;sydney.bmp|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;ninja.b3d|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;nskinbl.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlichtlogo3.png|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;terrain-heightmap.bmp|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;terrain-texture.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;detailmap3.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_up.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_dn.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_lf.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_rt.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_ft.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht2_bk.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;skydome.jpg|$(InputDir)..\..\media|%CSIDL_PROGRAM_FILES%\irrlicht\media|0;irrlicht.dll|$(InputDir)$(OutDir)|%CSIDL_PROGRAM_FILES%\irrlicht\bin\wince-visualstudio|0"
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
/** Example 017 Helloworld mobile
|
||||
|
||||
This example show Hello World for Windows mobile
|
||||
This example show Hello World for Windows mobile.
|
||||
It compiles on other platform too. The only differences between the original
|
||||
examples are. You need a GUI, because otherwise you can't quit the application.
|
||||
You need a Filesystem, which is relative based to your executable.
|
||||
*/
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
#ifdef _IRR_USE_WINDOWS_CE_DEVICE_
|
||||
#include <windows.h>
|
||||
#if defined ( _IRR_WINDOWS_ )
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
using namespace irr;
|
||||
|
@ -18,12 +20,12 @@ using namespace gui;
|
|||
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
|
||||
class MyEventReceiver : public IEventReceiver
|
||||
class EventReceiver_basic : public IEventReceiver
|
||||
{
|
||||
private:
|
||||
IrrlichtDevice *Device;
|
||||
public:
|
||||
MyEventReceiver ( IrrlichtDevice *device ): Device ( device ) {}
|
||||
EventReceiver_basic ( IrrlichtDevice *device ): Device ( device ) {}
|
||||
|
||||
virtual bool OnEvent(const SEvent& event)
|
||||
{
|
||||
|
@ -101,49 +103,98 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine,
|
||||
int nCmdShow )
|
||||
#else
|
||||
int main()
|
||||
#endif
|
||||
/*!
|
||||
Startup a Windows Mobile Device
|
||||
*/
|
||||
IrrlichtDevice *startup()
|
||||
{
|
||||
E_DRIVER_TYPE driverType = EDT_BURNINGSVIDEO;
|
||||
// both software and burnings video can be used
|
||||
E_DRIVER_TYPE driverType = EDT_SOFTWARE; // EDT_BURNINGSVIDEO;
|
||||
|
||||
// create device
|
||||
IrrlichtDevice *device = 0;
|
||||
|
||||
IrrlichtDevice *device =
|
||||
createDevice(driverType, dimension2d<s32>(240, 320), 16, true );
|
||||
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
// create engine and camera
|
||||
MyEventReceiver receiver(device);
|
||||
device->setEventReceiver(&receiver);
|
||||
device->setWindowCaption(L"Irrlicht CE Demo");
|
||||
#if defined (_IRR_USE_WINDOWS_CE_DEVICE_)
|
||||
// set to standard mobile fullscreen 240x320
|
||||
device = createDevice(driverType, dimension2d<u32>(240, 320), 16, true );
|
||||
#else
|
||||
// on PC. use window mode
|
||||
device = createDevice(driverType, dimension2d<u32>(240, 320), 16, false );
|
||||
#endif
|
||||
if ( 0 == device )
|
||||
return 0;
|
||||
|
||||
IVideoDriver* driver = device->getVideoDriver();
|
||||
ISceneManager* smgr = device->getSceneManager();
|
||||
IGUIEnvironment* guienv = device->getGUIEnvironment();
|
||||
|
||||
// set the filesystem relative to the executable
|
||||
#if defined (_IRR_WINDOWS_)
|
||||
{
|
||||
wchar_t buf[255];
|
||||
GetModuleFileNameW ( 0, buf, 255 );
|
||||
|
||||
stringc base = buf;
|
||||
base = base.subString ( 0, base.findLast ( '\\' ) );
|
||||
device->getFileSystem()->addFolderFileArchive ( base.c_str() );
|
||||
string<c16> base = buf;
|
||||
base = base.subString ( 0, base.findLast ( '\\' ) + 1 );
|
||||
device->getFileSystem()->registerFileArchive ( base );
|
||||
}
|
||||
#endif
|
||||
|
||||
IGUIStaticText *text = guienv->addStaticText(L"FPS: 25",
|
||||
rect<s32>(140,15,200,30), false, false, 0, 100 );
|
||||
|
||||
guienv->addButton(core::rect<int>(200,10,238,30), 0, 2, L"Quit");
|
||||
|
||||
// add irrlicht logo
|
||||
guienv->addImage(driver->getTexture("../../media/irrlichtlogo3.png"),
|
||||
core::position2d<s32>(0,-2));
|
||||
return device;
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
int run ( IrrlichtDevice *device )
|
||||
{
|
||||
while(device->run())
|
||||
if (device->isWindowActive())
|
||||
{
|
||||
device->getVideoDriver()->beginScene(true, true, SColor(0,100,100,100));
|
||||
device->getSceneManager()->drawAll();
|
||||
device->getGUIEnvironment()->drawAll();
|
||||
device->getVideoDriver()->endScene ();
|
||||
|
||||
IGUIElement *stat = device->getGUIEnvironment()->
|
||||
getRootGUIElement()->getElementFromId ( 100 );
|
||||
if ( stat )
|
||||
{
|
||||
stringw str = L"FPS: ";
|
||||
str += (s32)device->getVideoDriver()->getFPS();
|
||||
|
||||
stat->setText ( str.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
device->drop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
IGUIStaticText *text =
|
||||
guienv->addStaticText(L"FPS: 25",
|
||||
rect<s32>(60,5,200,20), false );
|
||||
/*!
|
||||
*/
|
||||
int example_customscenenode()
|
||||
{
|
||||
// create device
|
||||
IrrlichtDevice *device = startup();
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
// create engine and camera
|
||||
EventReceiver_basic receiver(device);
|
||||
device->setEventReceiver(&receiver);
|
||||
|
||||
IVideoDriver* driver = device->getVideoDriver();
|
||||
ISceneManager* smgr = device->getSceneManager();
|
||||
IGUIEnvironment* guienv = device->getGUIEnvironment();
|
||||
|
||||
guienv->addButton(core::rect<int>(10,5,50,20), 0, 2, L"Quit");
|
||||
|
||||
smgr->addCameraSceneNode(0, vector3df(0,-40,0), vector3df(0,0,0));
|
||||
|
||||
|
@ -163,27 +214,289 @@ int main()
|
|||
myNode->drop();
|
||||
myNode = 0; // As I shouldn't refer to it again, ensure that I can't
|
||||
|
||||
u32 frames=0;
|
||||
while(device->run())
|
||||
return run ( device );
|
||||
}
|
||||
|
||||
class EventReceiver_terrain : public IEventReceiver
|
||||
{
|
||||
public:
|
||||
|
||||
EventReceiver_terrain(IrrlichtDevice *device, scene::ISceneNode* terrain, scene::ISceneNode* skybox, scene::ISceneNode* skydome) :
|
||||
Device ( device ), Terrain(terrain), Skybox(skybox), Skydome(skydome), showBox(true)
|
||||
{
|
||||
driver->beginScene(true, true, SColor(0,100,100,100));
|
||||
smgr->drawAll();
|
||||
guienv->drawAll();
|
||||
driver->endScene();
|
||||
|
||||
if (++frames==10)
|
||||
{
|
||||
stringw str = L"FPS: ";
|
||||
str += (s32)driver->getFPS();
|
||||
|
||||
text->setText ( str.c_str() );
|
||||
frames=0;
|
||||
}
|
||||
Skybox->setVisible(true);
|
||||
Skydome->setVisible(false);
|
||||
}
|
||||
|
||||
device->drop();
|
||||
bool OnEvent(const SEvent& event)
|
||||
{
|
||||
if (event.EventType == EET_GUI_EVENT)
|
||||
{
|
||||
s32 id = event.GUIEvent.Caller->getID();
|
||||
|
||||
switch(event.GUIEvent.EventType)
|
||||
{
|
||||
case EGET_BUTTON_CLICKED:
|
||||
if (id == 2)
|
||||
{
|
||||
Device->closeDevice();
|
||||
return true;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
// check if user presses the key 'W' or 'D'
|
||||
if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
|
||||
{
|
||||
switch (event.KeyInput.Key)
|
||||
{
|
||||
case irr::KEY_KEY_W: // switch wire frame mode
|
||||
Terrain->setMaterialFlag(video::EMF_WIREFRAME,
|
||||
!Terrain->getMaterial(0).Wireframe);
|
||||
Terrain->setMaterialFlag(video::EMF_POINTCLOUD, false);
|
||||
return true;
|
||||
case irr::KEY_KEY_P: // switch wire frame mode
|
||||
Terrain->setMaterialFlag(video::EMF_POINTCLOUD,
|
||||
!Terrain->getMaterial(0).PointCloud);
|
||||
Terrain->setMaterialFlag(video::EMF_WIREFRAME, false);
|
||||
return true;
|
||||
case irr::KEY_KEY_D: // toggle detail map
|
||||
Terrain->setMaterialType(
|
||||
Terrain->getMaterial(0).MaterialType == video::EMT_SOLID ?
|
||||
video::EMT_DETAIL_MAP : video::EMT_SOLID);
|
||||
return true;
|
||||
case irr::KEY_KEY_S: // toggle skies
|
||||
showBox=!showBox;
|
||||
Skybox->setVisible(showBox);
|
||||
Skydome->setVisible(!showBox);
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
IrrlichtDevice *Device;
|
||||
scene::ISceneNode* Terrain;
|
||||
scene::ISceneNode* Skybox;
|
||||
scene::ISceneNode* Skydome;
|
||||
bool showBox;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
The start of the main function starts like in most other example. We ask the user
|
||||
for the desired renderer and start it up. This time with the advanced parameter handling.
|
||||
*/
|
||||
int example_terrain()
|
||||
{
|
||||
// create device
|
||||
IrrlichtDevice *device = startup();
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
return 0;
|
||||
/*
|
||||
First, we add standard stuff to the scene: A nice irrlicht engine
|
||||
logo, a small help text, a user controlled camera, and we disable
|
||||
the mouse cursor.
|
||||
*/
|
||||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();
|
||||
gui::IGUIEnvironment* env = device->getGUIEnvironment();
|
||||
|
||||
|
||||
//set other font
|
||||
//env->getSkin()->setFont(env->getFont("../../media/fontlucida.png"));
|
||||
|
||||
// add some help text
|
||||
env->addStaticText(
|
||||
L"Press 'W' to change wireframe mode\nPress 'D' to toggle detail map\nPress 'S' to toggle skybox/skydome",
|
||||
core::rect<s32>(5,250,235,320), true, true, 0, -1, true);
|
||||
|
||||
// add camera
|
||||
scene::ICameraSceneNode* camera =
|
||||
smgr->addCameraSceneNodeFPS(0,100.0f,1.2f);
|
||||
|
||||
camera->setPosition(core::vector3df(2700*2,255*2,2600*2));
|
||||
camera->setTarget(core::vector3df(2397*2,343*2,2700*2));
|
||||
camera->setFarValue(42000.0f);
|
||||
|
||||
// disable mouse cursor
|
||||
device->getCursorControl()->setVisible(false);
|
||||
|
||||
/*
|
||||
Here comes the terrain renderer scene node: We add it just like any
|
||||
other scene node to the scene using
|
||||
ISceneManager::addTerrainSceneNode(). The only parameter we use is a
|
||||
file name to the heightmap we use. A heightmap is simply a gray scale
|
||||
texture. The terrain renderer loads it and creates the 3D terrain from
|
||||
it.
|
||||
|
||||
To make the terrain look more big, we change the scale factor of
|
||||
it to (40, 4.4, 40). Because we don't have any dynamic lights in the
|
||||
scene, we switch off the lighting, and we set the file
|
||||
terrain-texture.jpg as texture for the terrain and detailmap3.jpg as
|
||||
second texture, called detail map. At last, we set the scale values for
|
||||
the texture: The first texture will be repeated only one time over the
|
||||
whole terrain, and the second one (detail map) 20 times.
|
||||
*/
|
||||
|
||||
// add terrain scene node
|
||||
scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(
|
||||
"../../media/terrain-heightmap.bmp",
|
||||
0, // parent node
|
||||
-1, // node id
|
||||
core::vector3df(0.f, 0.f, 0.f), // position
|
||||
core::vector3df(0.f, 0.f, 0.f), // rotation
|
||||
core::vector3df(40.f, 4.4f, 40.f), // scale
|
||||
video::SColor ( 255, 255, 255, 255 ), // vertexColor
|
||||
5, // maxLOD
|
||||
scene::ETPS_17, // patchSize
|
||||
4 // smoothFactor
|
||||
);
|
||||
|
||||
if ( terrain )
|
||||
{
|
||||
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
|
||||
terrain->setMaterialTexture(0,
|
||||
driver->getTexture("../../media/terrain-texture.jpg"));
|
||||
terrain->setMaterialTexture(1,
|
||||
driver->getTexture("../../media/detailmap3.jpg"));
|
||||
|
||||
terrain->setMaterialType(video::EMT_DETAIL_MAP);
|
||||
|
||||
terrain->scaleTexture(1.0f, 20.0f);
|
||||
//terrain->setDebugDataVisible ( true );
|
||||
|
||||
/*
|
||||
To be able to do collision with the terrain, we create a triangle selector.
|
||||
If you want to know what triangle selectors do, just take a look into the
|
||||
collision tutorial. The terrain triangle selector works together with the
|
||||
terrain. To demonstrate this, we create a collision response animator
|
||||
and attach it to the camera, so that the camera will not be able to fly
|
||||
through the terrain.
|
||||
*/
|
||||
|
||||
// create triangle selector for the terrain
|
||||
scene::ITriangleSelector* selector
|
||||
= smgr->createTerrainTriangleSelector(terrain, 0);
|
||||
terrain->setTriangleSelector(selector);
|
||||
|
||||
// create collision response animator and attach it to the camera
|
||||
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
|
||||
selector, camera, core::vector3df(60,100,60),
|
||||
core::vector3df(0,0,0),
|
||||
core::vector3df(0,50,0));
|
||||
selector->drop();
|
||||
camera->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
/* If you need access to the terrain data you can also do this directly via the following code fragment.
|
||||
*/
|
||||
scene::CDynamicMeshBuffer* buffer = new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT);
|
||||
terrain->getMeshBufferForLOD(*buffer, 0);
|
||||
video::S3DVertex2TCoords* data = (video::S3DVertex2TCoords*)buffer->getVertexBuffer().getData();
|
||||
// Work on data or get the IndexBuffer with a similar call.
|
||||
buffer->drop(); // When done drop the buffer again.
|
||||
}
|
||||
|
||||
/*
|
||||
To make the user be able to switch between normal and wireframe mode,
|
||||
we create an instance of the event reciever from above and let Irrlicht
|
||||
know about it. In addition, we add the skybox which we already used in
|
||||
lots of Irrlicht examples and a skydome, which is shown mutually
|
||||
exclusive with the skybox by pressing 'S'.
|
||||
*/
|
||||
|
||||
// create skybox and skydome
|
||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
|
||||
|
||||
scene::ISceneNode* skybox=smgr->addSkyBoxSceneNode(
|
||||
driver->getTexture("../../media/irrlicht2_up.jpg"),
|
||||
driver->getTexture("../../media/irrlicht2_dn.jpg"),
|
||||
driver->getTexture("../../media/irrlicht2_lf.jpg"),
|
||||
driver->getTexture("../../media/irrlicht2_rt.jpg"),
|
||||
driver->getTexture("../../media/irrlicht2_ft.jpg"),
|
||||
driver->getTexture("../../media/irrlicht2_bk.jpg"));
|
||||
scene::ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("../../media/skydome.jpg"),16,8,0.95f,2.0f);
|
||||
|
||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
|
||||
|
||||
// create event receiver
|
||||
EventReceiver_terrain receiver( device, terrain, skybox, skydome);
|
||||
device->setEventReceiver(&receiver);
|
||||
|
||||
return run ( device );
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
int example_helloworld()
|
||||
{
|
||||
// create device
|
||||
IrrlichtDevice *device = startup();
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
IVideoDriver* driver = device->getVideoDriver();
|
||||
ISceneManager* smgr = device->getSceneManager();
|
||||
IGUIEnvironment* guienv = device->getGUIEnvironment();
|
||||
|
||||
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
|
||||
if (!mesh)
|
||||
{
|
||||
device->drop();
|
||||
return 1;
|
||||
}
|
||||
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
|
||||
|
||||
/*
|
||||
To let the mesh look a little bit nicer, we change its material. We
|
||||
disable lighting because we do not have a dynamic light in here, and
|
||||
the mesh would be totally black otherwise. Then we set the frame loop,
|
||||
such that the predefined STAND animation is used. And last, we apply a
|
||||
texture to the mesh. Without it the mesh would be drawn using only a
|
||||
color.
|
||||
*/
|
||||
if (node)
|
||||
{
|
||||
node->setMaterialFlag(EMF_LIGHTING, false);
|
||||
node->setMD2Animation(scene::EMAT_STAND);
|
||||
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
|
||||
}
|
||||
|
||||
/*
|
||||
To look at the mesh, we place a camera into 3d space at the position
|
||||
(0, 30, -40). The camera looks from there to (0,5,0), which is
|
||||
approximately the place where our md2 model is.
|
||||
*/
|
||||
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
|
||||
|
||||
EventReceiver_basic receiver(device);
|
||||
device->setEventReceiver(&receiver);
|
||||
|
||||
return run ( device );
|
||||
|
||||
}
|
||||
|
||||
#if defined (_IRR_USE_WINDOWS_CE_DEVICE_)
|
||||
#pragma comment(linker, "/subsystem:WINDOWSCE /ENTRY:main")
|
||||
#elif defined (_IRR_WINDOWS_)
|
||||
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
|
||||
#endif
|
||||
|
||||
/*
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
example_helloworld ();
|
||||
example_customscenenode();
|
||||
//example_terrain();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -182,7 +182,15 @@ int main()
|
|||
/*
|
||||
We'll create an arrow mesh and move it around either with the joystick axis/hat,
|
||||
or make it follow the mouse pointer. */
|
||||
scene::ISceneNode * node = smgr->addMeshSceneNode(smgr->addArrowMesh("Arrow", video::SColor(255, 255, 0, 0), video::SColor(255, 0, 255, 0)));
|
||||
scene::ISceneNode * node = smgr->addMeshSceneNode(
|
||||
smgr->addArrowMesh( "Arrow",
|
||||
video::SColor(255, 255, 0, 0),
|
||||
video::SColor(255, 0, 255, 0),
|
||||
16,16,
|
||||
2.f, 1.3f,
|
||||
0.1f, 0.6f
|
||||
)
|
||||
);
|
||||
node->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
|
||||
scene::ICameraSceneNode * camera = smgr->addCameraSceneNode();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="20.ManagedLights_vc8"
|
||||
ProjectGUID="{16007FE2-142B-47F8-93E1-519BA3F39E71}"
|
||||
RootNamespace="ManagedLights_vc8"
|
||||
|
|
|
@ -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 = 16.Quake3MapShader
|
||||
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
|
|
@ -0,0 +1,21 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{830FD174-FABE-4667-B9FC-F7F8B8378EE7}") = "19.Quake3MapExplorer", "Quake3MapShader.vcproj", "{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}.Debug.ActiveCfg = Debug|Win32
|
||||
{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}.Debug.Build.0 = Debug|Win32
|
||||
{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}.Release.ActiveCfg = Release|Win32
|
||||
{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="19.Quake3Explorer"
|
||||
ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/Quake3MapShader.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/QIfist /Oa"
|
||||
Optimization="3"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="4"
|
||||
BufferSecurityCheck="FALSE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"
|
||||
CallingConvention="1"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="FALSE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\main.cpp">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="21.Quake3Explorer"
|
||||
ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/Quake3MapShader.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/QIfist /Oa"
|
||||
Optimization="3"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="4"
|
||||
BufferSecurityCheck="FALSE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="0"
|
||||
CallingConvention="1"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="FALSE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\main.cpp">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -0,0 +1,210 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="21.Quake3Explorer_vc8"
|
||||
ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
|
||||
RootNamespace="21.Quake3Explorer_vc8"
|
||||
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"
|
||||
DisableSpecificWarnings="4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/Quake3MapShader.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"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="0"
|
||||
CallingConvention="1"
|
||||
DisableSpecificWarnings="4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.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>
|
||||
<File
|
||||
RelativePath=".\q3factory.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\q3factory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sound.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sound.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -0,0 +1,188 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="19.Quake3Explorer_vc9"
|
||||
ProjectGUID="{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}"
|
||||
RootNamespace="19.Quake3Explorer_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\19.Quake3MapExplorer.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/Quake3MapShader.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"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
CallingConvention="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.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>
|
|
@ -0,0 +1,59 @@
|
|||
[Project]
|
||||
FileName=example.dev
|
||||
Name=Irrlicht Example 16 Quake3 Map Shader
|
||||
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=16.Quake3MapShader.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
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,739 @@
|
|||
/*!
|
||||
Model Factory.
|
||||
create the additional scenenodes for ( bullets, health... )
|
||||
|
||||
Defines the Entities for Quake3
|
||||
*/
|
||||
|
||||
#include "q3factory.h"
|
||||
#include "sound.h"
|
||||
|
||||
using namespace irr;
|
||||
using namespace scene;
|
||||
using namespace gui;
|
||||
using namespace video;
|
||||
using namespace core;
|
||||
using namespace quake3;
|
||||
|
||||
//! This list is based on the original quake3.
|
||||
static const SItemElement Quake3ItemElement [] = {
|
||||
{ "item_health",
|
||||
"models/powerups/health/medium_cross.md3",
|
||||
"models/powerups/health/medium_sphere.md3",
|
||||
"sound/items/n_health.wav",
|
||||
"icons/iconh_yellow",
|
||||
"25 Health",
|
||||
25,
|
||||
HEALTH,
|
||||
SUB_NONE
|
||||
},
|
||||
{ "item_health_large",
|
||||
"models/powerups/health/large_cross.md3",
|
||||
"models/powerups/health/large_sphere.md3",
|
||||
"sound/items/l_health.wav",
|
||||
"icons/iconh_red",
|
||||
"50 Health",
|
||||
50,
|
||||
HEALTH,
|
||||
SUB_NONE
|
||||
},
|
||||
{
|
||||
"item_health_mega",
|
||||
"models/powerups/health/mega_cross.md3",
|
||||
"models/powerups/health/mega_sphere.md3",
|
||||
"sound/items/m_health.wav",
|
||||
"icons/iconh_mega",
|
||||
"Mega Health",
|
||||
100,
|
||||
HEALTH,
|
||||
SUB_NONE,
|
||||
},
|
||||
{
|
||||
"item_health_small",
|
||||
"models/powerups/health/small_cross.md3",
|
||||
"models/powerups/health/small_sphere.md3",
|
||||
"sound/items/s_health.wav",
|
||||
"icons/iconh_green",
|
||||
"5 Health",
|
||||
5,
|
||||
HEALTH,
|
||||
SUB_NONE,
|
||||
},
|
||||
{ "ammo_bullets",
|
||||
"models/powerups/ammo/machinegunam.md3",
|
||||
"",
|
||||
"sound/misc/am_pkup.wav",
|
||||
"icons/icona_machinegun",
|
||||
"Bullets",
|
||||
50,
|
||||
AMMO,
|
||||
MACHINEGUN
|
||||
},
|
||||
{
|
||||
"ammo_cells",
|
||||
"models/powerups/ammo/plasmaam.md3",
|
||||
"",
|
||||
"sound/misc/am_pkup.wav",
|
||||
"icons/icona_plasma",
|
||||
"Cells",
|
||||
30,
|
||||
AMMO,
|
||||
PLASMAGUN,
|
||||
},
|
||||
{ "ammo_rockets",
|
||||
"models/powerups/ammo/rocketam.md3",
|
||||
"",
|
||||
"",
|
||||
"icons/icona_rocket",
|
||||
"Rockets",
|
||||
5,
|
||||
AMMO,
|
||||
ROCKET_LAUNCHER,
|
||||
},
|
||||
{
|
||||
"ammo_shells",
|
||||
"models/powerups/ammo/shotgunam.md3",
|
||||
"",
|
||||
"sound/misc/am_pkup.wav",
|
||||
"icons/icona_shotgun",
|
||||
"Shells",
|
||||
10,
|
||||
AMMO,
|
||||
SHOTGUN,
|
||||
},
|
||||
{
|
||||
"ammo_slugs",
|
||||
"models/powerups/ammo/railgunam.md3",
|
||||
"",
|
||||
"sound/misc/am_pkup.wav",
|
||||
"icons/icona_railgun",
|
||||
"Slugs",
|
||||
10,
|
||||
AMMO,
|
||||
RAILGUN,
|
||||
},
|
||||
{
|
||||
"item_armor_body",
|
||||
"models/powerups/armor/armor_red.md3",
|
||||
"",
|
||||
"sound/misc/ar2_pkup.wav",
|
||||
"icons/iconr_red",
|
||||
"Heavy Armor",
|
||||
100,
|
||||
ARMOR,
|
||||
SUB_NONE,
|
||||
},
|
||||
{
|
||||
"item_armor_combat",
|
||||
"models/powerups/armor/armor_yel.md3",
|
||||
"",
|
||||
"sound/misc/ar2_pkup.wav",
|
||||
"icons/iconr_yellow",
|
||||
"Armor",
|
||||
50,
|
||||
ARMOR,
|
||||
SUB_NONE,
|
||||
},
|
||||
{
|
||||
"item_armor_shard",
|
||||
"models/powerups/armor/shard.md3",
|
||||
"",
|
||||
"sound/misc/ar1_pkup.wav",
|
||||
"icons/iconr_shard",
|
||||
"Armor Shard",
|
||||
5,
|
||||
ARMOR,
|
||||
SUB_NONE,
|
||||
},
|
||||
{
|
||||
"weapon_gauntlet",
|
||||
"models/weapons2/gauntlet/gauntlet.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_gauntlet",
|
||||
"Gauntlet",
|
||||
0,
|
||||
WEAPON,
|
||||
GAUNTLET,
|
||||
},
|
||||
{
|
||||
"weapon_shotgun",
|
||||
"models/weapons2/shotgun/shotgun.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_shotgun",
|
||||
"Shotgun",
|
||||
10,
|
||||
WEAPON,
|
||||
SHOTGUN,
|
||||
},
|
||||
{
|
||||
"weapon_machinegun",
|
||||
"models/weapons2/machinegun/machinegun.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_machinegun",
|
||||
"Machinegun",
|
||||
40,
|
||||
WEAPON,
|
||||
MACHINEGUN,
|
||||
},
|
||||
{
|
||||
"weapon_grenadelauncher",
|
||||
"models/weapons2/grenadel/grenadel.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_grenade",
|
||||
"Grenade Launcher",
|
||||
10,
|
||||
WEAPON,
|
||||
GRENADE_LAUNCHER,
|
||||
},
|
||||
{
|
||||
"weapon_rocketlauncher",
|
||||
"models/weapons2/rocketl/rocketl.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_rocket",
|
||||
"Rocket Launcher",
|
||||
10,
|
||||
WEAPON,
|
||||
ROCKET_LAUNCHER,
|
||||
},
|
||||
{
|
||||
"weapon_lightning",
|
||||
"models/weapons2/lightning/lightning.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_lightning",
|
||||
"Lightning Gun",
|
||||
100,
|
||||
WEAPON,
|
||||
LIGHTNING,
|
||||
},
|
||||
{
|
||||
"weapon_railgun",
|
||||
"models/weapons2/railgun/railgun.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_railgun",
|
||||
"Railgun",
|
||||
10,
|
||||
WEAPON,
|
||||
RAILGUN,
|
||||
},
|
||||
{
|
||||
"weapon_plasmagun",
|
||||
"models/weapons2/plasma/plasma.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_plasma",
|
||||
"Plasma Gun",
|
||||
50,
|
||||
WEAPON,
|
||||
PLASMAGUN,
|
||||
},
|
||||
{
|
||||
"weapon_bfg",
|
||||
"models/weapons2/bfg/bfg.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_bfg",
|
||||
"BFG10K",
|
||||
20,
|
||||
WEAPON,
|
||||
BFG,
|
||||
},
|
||||
{
|
||||
"weapon_grapplinghook",
|
||||
"models/weapons2/grapple/grapple.md3",
|
||||
"",
|
||||
"sound/misc/w_pkup.wav",
|
||||
"icons/iconw_grapple",
|
||||
"Grappling Hook",
|
||||
0,
|
||||
WEAPON,
|
||||
GRAPPLING_HOOK,
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
*/
|
||||
const SItemElement * getItemElement ( const stringc& key )
|
||||
{
|
||||
const SItemElement *item = Quake3ItemElement;
|
||||
|
||||
while ( item->key[0] )
|
||||
{
|
||||
if ( 0 == strcmp ( key.c_str(), item->key ) )
|
||||
return item;
|
||||
item += 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Quake3 Model Factory.
|
||||
Takes the mesh buffers and creates scenenodes for their associated shaders
|
||||
*/
|
||||
void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
|
||||
IrrlichtDevice *device,
|
||||
IQ3LevelMesh* mesh,
|
||||
eQ3MeshIndex meshIndex,
|
||||
ISceneNode *parent,
|
||||
IMetaTriangleSelector *meta,
|
||||
bool showShaderName )
|
||||
{
|
||||
if ( 0 == mesh || 0 == device )
|
||||
return;
|
||||
|
||||
IMeshSceneNode* node = 0;
|
||||
ISceneManager* smgr = device->getSceneManager();
|
||||
ITriangleSelector * selector = 0;
|
||||
|
||||
// the additional mesh can be quite huge and is unoptimized
|
||||
// Save to cast to SMesh
|
||||
SMesh * additional_mesh = (SMesh*) mesh->getMesh ( meshIndex );
|
||||
if ( 0 == additional_mesh || additional_mesh->getMeshBufferCount() == 0)
|
||||
return;
|
||||
|
||||
char buf[128];
|
||||
if ( loadParam.verbose > 0 )
|
||||
{
|
||||
loadParam.startTime = device->getTimer()->getRealTime();
|
||||
if ( loadParam.verbose > 1 )
|
||||
{
|
||||
snprintf(buf, 128, "q3shaderfactory start" );
|
||||
device->getLogger()->log( buf, ELL_INFORMATION);
|
||||
}
|
||||
}
|
||||
|
||||
IGUIFont *font = 0;
|
||||
if ( showShaderName )
|
||||
font = device->getGUIEnvironment()->getFont("fontlucida.png");
|
||||
|
||||
IVideoDriver *driver = device->getVideoDriver();
|
||||
|
||||
// create helper textures
|
||||
if ( 1 )
|
||||
{
|
||||
tTexArray tex;
|
||||
u32 pos = 0;
|
||||
getTextures ( tex, "$redimage $blueimage $whiteimage $checkerimage", pos,
|
||||
device->getFileSystem(), driver );
|
||||
}
|
||||
|
||||
s32 sceneNodeID = 0;
|
||||
for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i )
|
||||
{
|
||||
IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i );
|
||||
const SMaterial &material = meshBuffer->getMaterial();
|
||||
|
||||
//! The ShaderIndex is stored in the second material parameter
|
||||
s32 shaderIndex = (s32) material.MaterialTypeParam2;
|
||||
|
||||
// the meshbuffer can be rendered without additional support, or it has no shader
|
||||
IShader *shader = (IShader *) mesh->getShader ( shaderIndex );
|
||||
|
||||
// no shader, or mapped to existing material
|
||||
if ( 0 == shader )
|
||||
{
|
||||
|
||||
#if 1
|
||||
// clone mesh
|
||||
SMesh * m = new SMesh ();
|
||||
m->addMeshBuffer ( meshBuffer );
|
||||
SMaterial &mat = m->getMeshBuffer( 0 )->getMaterial();
|
||||
if ( mat.getTexture( 0 ) == 0 )
|
||||
mat.setTexture ( 0, driver->getTexture ( "$blueimage" ) );
|
||||
if ( mat.getTexture( 1 ) == 0 )
|
||||
mat.setTexture ( 1, driver->getTexture ( "$redimage" ) );
|
||||
|
||||
IMesh * store = smgr->getMeshManipulator ()->createMeshWith2TCoords ( m );
|
||||
m->drop();
|
||||
|
||||
node = smgr->addMeshSceneNode ( store, parent, sceneNodeID );
|
||||
node->setAutomaticCulling ( scene::EAC_OFF );
|
||||
store->drop ();
|
||||
sceneNodeID += 1;
|
||||
#endif
|
||||
}
|
||||
else if ( 1 )
|
||||
{
|
||||
/*
|
||||
stringc s;
|
||||
dumpShader ( s, shader );
|
||||
printf ( s.c_str () );
|
||||
*/
|
||||
// create sceneNode
|
||||
node = smgr->addQuake3SceneNode ( meshBuffer, shader, parent, sceneNodeID );
|
||||
node->setAutomaticCulling ( scene::EAC_FRUSTUM_BOX );
|
||||
sceneNodeID += 1;
|
||||
}
|
||||
|
||||
// show Debug Shader Name
|
||||
if ( showShaderName && node )
|
||||
{
|
||||
IBillboardTextSceneNode* node2 = 0;
|
||||
swprintf ( (wchar_t*) buf, 64, L"%hs:%d", node->getName(),node->getID() );
|
||||
node2 = smgr->addBillboardTextSceneNode(
|
||||
font,
|
||||
(wchar_t*) buf,
|
||||
node,
|
||||
dimension2d<f32>(80.0f, 8.0f),
|
||||
vector3df(0, 10, 0),
|
||||
sceneNodeID
|
||||
);
|
||||
snprintf ( buf, 64, "%hs:%d", node->getName(),node->getID() );
|
||||
//node2->setName ( buf );
|
||||
sceneNodeID += 1;
|
||||
}
|
||||
|
||||
// create Portal Rendertargets
|
||||
if ( shader )
|
||||
{
|
||||
const SVarGroup *group = shader->getGroup(1);
|
||||
if ( group->isDefined( "surfaceparm", "portal" ) )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// add collision
|
||||
// find out if shader is marked als nonsolid
|
||||
u8 doCreate = meta !=0 ;
|
||||
|
||||
if ( shader )
|
||||
{
|
||||
const SVarGroup *group = shader->getGroup(1);
|
||||
if ( group->isDefined( "surfaceparm", "trans" )
|
||||
// || group->isDefined( "surfaceparm", "sky" )
|
||||
// || group->isDefined( "surfaceparm", "nonsolid" )
|
||||
)
|
||||
{
|
||||
if ( !group->isDefined( "surfaceparm", "metalsteps" ) )
|
||||
{
|
||||
doCreate = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( doCreate )
|
||||
{
|
||||
IMesh *m = 0;
|
||||
|
||||
//! controls if triangles are modified by the scenenode during runtime
|
||||
bool takeOriginal = true;
|
||||
|
||||
if ( takeOriginal )
|
||||
{
|
||||
m = new SMesh;
|
||||
((SMesh*) m )->addMeshBuffer (meshBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
m = node->getMesh();
|
||||
}
|
||||
|
||||
//selector = smgr->createOctTreeTriangleSelector ( m, 0, 128 );
|
||||
selector = smgr->createTriangleSelector ( m, 0 );
|
||||
meta->addTriangleSelector ( selector );
|
||||
selector->drop ();
|
||||
|
||||
if ( takeOriginal )
|
||||
{
|
||||
delete m;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
if ( meta )
|
||||
{
|
||||
selector = smgr->createOctTreeTriangleSelector ( additional_mesh, 0 );
|
||||
meta->addTriangleSelector ( selector );
|
||||
selector->drop ();
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( loadParam.verbose > 0 )
|
||||
{
|
||||
loadParam.endTime = device->getTimer()->getRealTime ();
|
||||
snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes",
|
||||
loadParam.endTime - loadParam.startTime,
|
||||
sceneNodeID
|
||||
);
|
||||
device->getLogger()->log(buf, ELL_INFORMATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
*/
|
||||
void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||
IrrlichtDevice *device,
|
||||
IQ3LevelMesh* masterMesh,
|
||||
ISceneNode *parent
|
||||
)
|
||||
{
|
||||
if ( 0 == masterMesh )
|
||||
return;
|
||||
|
||||
tQ3EntityList &entity = masterMesh->getEntityList ();
|
||||
ISceneManager* smgr = device->getSceneManager();
|
||||
|
||||
|
||||
char buf[128];
|
||||
const SVarGroup *group;
|
||||
SEntity search;
|
||||
s32 index;
|
||||
s32 lastIndex;
|
||||
|
||||
/*
|
||||
stringc s;
|
||||
FILE *f = 0;
|
||||
f = fopen ( "entity.txt", "wb" );
|
||||
for ( index = 0; (u32) index < entityList.size (); ++index )
|
||||
{
|
||||
const SEntity *entity = &entityList[ index ];
|
||||
s = entity->name;
|
||||
dumpShader ( s, entity );
|
||||
fwrite ( s.c_str(), 1, s.size(), f );
|
||||
}
|
||||
fclose ( f );
|
||||
*/
|
||||
IAnimatedMeshMD3* model;
|
||||
SMD3Mesh * mesh;
|
||||
const SMD3MeshBuffer *meshBuffer;
|
||||
IMeshSceneNode* node;
|
||||
const IShader *shader;
|
||||
u32 pos;
|
||||
vector3df p;
|
||||
|
||||
|
||||
const SItemElement *itemElement;
|
||||
|
||||
// walk list
|
||||
for ( index = 0; (u32) index < entity.size(); ++index )
|
||||
{
|
||||
itemElement = getItemElement ( entity[index].name );
|
||||
if ( 0 == itemElement )
|
||||
continue;
|
||||
|
||||
pos = 0;
|
||||
p = getAsVector3df ( entity[index].getGroup(1)->get ( "origin" ), pos );
|
||||
|
||||
for ( u32 g = 0; g < 2; ++g )
|
||||
{
|
||||
if ( 0 == itemElement->model[g] || itemElement->model[g][0] == 0 )
|
||||
continue;
|
||||
model = (IAnimatedMeshMD3*) smgr->getMesh( itemElement->model[g] );
|
||||
if ( 0 == model )
|
||||
continue;
|
||||
|
||||
mesh = model->getOriginalMesh();
|
||||
for ( u32 j = 0; j != mesh->Buffer.size (); ++j )
|
||||
{
|
||||
meshBuffer = mesh->Buffer[j];
|
||||
if ( 0 == meshBuffer )
|
||||
continue;
|
||||
|
||||
shader = masterMesh->getShader ( meshBuffer->Shader, false );
|
||||
if ( 0 == shader )
|
||||
{
|
||||
snprintf ( buf, 128, "q3ModelFactory shader %s failed", meshBuffer->Shader.c_str() );
|
||||
device->getLogger()->log ( buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
node = smgr->addQuake3SceneNode ( model->getMesh(0)->getMeshBuffer(j), shader, parent );
|
||||
if ( 0 == node )
|
||||
continue;
|
||||
|
||||
node->setName ( shader->name.c_str () );
|
||||
node->setPosition ( p );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// music
|
||||
search.name = "worldspawn";
|
||||
index = entity.binary_search_multi ( search, lastIndex );
|
||||
|
||||
if ( index >= 0 )
|
||||
{
|
||||
group = entity[ index ].getGroup(1);
|
||||
background_music ( group->get ( "music" ).c_str () );
|
||||
}
|
||||
|
||||
// music
|
||||
search.name = "worldspawn";
|
||||
index = entity.binary_search_multi ( search, lastIndex );
|
||||
|
||||
if ( index >= 0 )
|
||||
{
|
||||
group = entity[ index ].getGroup(1);
|
||||
background_music ( group->get ( "music" ).c_str () );
|
||||
}
|
||||
|
||||
//IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
|
||||
//IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
so we need a good starting Position in the level.
|
||||
we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch"
|
||||
*/
|
||||
s32 Q3StartPosition ( IQ3LevelMesh* mesh,
|
||||
ICameraSceneNode* camera,
|
||||
s32 startposIndex,
|
||||
const vector3df &translation
|
||||
)
|
||||
{
|
||||
if ( 0 == mesh )
|
||||
return 0;
|
||||
|
||||
tQ3EntityList &entityList = mesh->getEntityList ();
|
||||
|
||||
SEntity search;
|
||||
search.name = "info_player_start"; // "info_player_deathmatch";
|
||||
|
||||
// find all entities in the multi-list
|
||||
s32 lastIndex;
|
||||
s32 index = entityList.binary_search_multi ( search, lastIndex );
|
||||
|
||||
if ( index < 0 )
|
||||
{
|
||||
search.name = "info_player_deathmatch";
|
||||
index = entityList.binary_search_multi ( search, lastIndex );
|
||||
}
|
||||
|
||||
if ( index < 0 )
|
||||
return 0;
|
||||
|
||||
index += core::clamp ( startposIndex, 0, lastIndex - index );
|
||||
|
||||
u32 parsepos;
|
||||
|
||||
const SVarGroup *group;
|
||||
group = entityList[ index ].getGroup(1);
|
||||
|
||||
parsepos = 0;
|
||||
vector3df pos = getAsVector3df ( group->get ( "origin" ), parsepos );
|
||||
pos += translation;
|
||||
|
||||
parsepos = 0;
|
||||
f32 angle = getAsFloat ( group->get ( "angle"), parsepos );
|
||||
|
||||
vector3df target ( 0.f, 0.f, 1.f );
|
||||
target.rotateXZBy ( angle - 90.f, vector3df () );
|
||||
|
||||
if ( camera )
|
||||
{
|
||||
camera->setPosition ( pos );
|
||||
camera->setTarget ( pos + target );
|
||||
//! New. FPSCamera and animators catches reset on animate 0
|
||||
camera->OnAnimate ( 0 );
|
||||
}
|
||||
return lastIndex - index + 1;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
gets a accumulated force on a given surface
|
||||
*/
|
||||
vector3df getGravity ( const c8 * surface )
|
||||
{
|
||||
if ( 0 == strcmp ( surface, "earth" ) ) return vector3df ( 0.f, -90.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, "ice" ) ) return vector3df ( 0.2f / 100.f, -9.f / 100.f, 0.3f / 100.f );
|
||||
|
||||
return vector3df ( 0.f, 0.f, 0.f );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Dynamically load the Irrlicht Library
|
||||
*/
|
||||
|
||||
#if defined(_IRR_WINDOWS_API_) && 1
|
||||
#include <windows.h>
|
||||
|
||||
funcptr_createDevice load_createDevice ( const c8 * filename)
|
||||
{
|
||||
return (funcptr_createDevice) GetProcAddress ( LoadLibrary ( filename ), "createDevice" );
|
||||
}
|
||||
|
||||
funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename)
|
||||
{
|
||||
return (funcptr_createDeviceEx) GetProcAddress ( LoadLibrary ( filename ), "createDeviceEx" );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// TODO: Dynamic Loading for other os
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
|
||||
funcptr_createDevice load_createDevice ( const c8 * filename)
|
||||
{
|
||||
return createDevice;
|
||||
}
|
||||
|
||||
funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename)
|
||||
{
|
||||
return createDeviceEx;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
get the current collision respone camera animator
|
||||
*/
|
||||
ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device )
|
||||
{
|
||||
ICameraSceneNode *camera = device->getSceneManager()->getActiveCamera();
|
||||
ISceneNodeAnimatorCollisionResponse *a = 0;
|
||||
|
||||
list<ISceneNodeAnimator*>::ConstIterator it = camera->getAnimators().begin();
|
||||
for (; it != camera->getAnimators().end(); ++it)
|
||||
{
|
||||
a = (ISceneNodeAnimatorCollisionResponse*) (*it);
|
||||
if ( a->getType() == ESNAT_COLLISION_RESPONSE )
|
||||
return a;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//! internal Animation
|
||||
void setTimeFire ( TimeFire *t, u32 delta, u32 flags )
|
||||
{
|
||||
t->flags = flags;
|
||||
t->next = 0;
|
||||
t->delta = delta;
|
||||
}
|
||||
|
||||
|
||||
void checkTimeFire ( TimeFire *t, u32 listSize, u32 now )
|
||||
{
|
||||
u32 i;
|
||||
for ( i = 0; i < listSize; ++i )
|
||||
{
|
||||
if ( now < t[i].next )
|
||||
continue;
|
||||
|
||||
t[i].next = core::max_ ( now + t[i].delta, t[i].next + t[i].delta );
|
||||
t[i].flags |= FIRED;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
/*!
|
||||
Model Factory.
|
||||
create the additional scenenodes for ( bullets, health... )
|
||||
|
||||
Defines the Entities for Quake3
|
||||
*/
|
||||
#ifndef __QUAKE3_FACTORY__H_INCLUDED__
|
||||
#define __QUAKE3_FACTORY__H_INCLUDED__
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
|
||||
using namespace irr;
|
||||
using namespace scene;
|
||||
using namespace gui;
|
||||
using namespace video;
|
||||
using namespace core;
|
||||
using namespace quake3;
|
||||
|
||||
|
||||
|
||||
//! Defines to which group the entities belong
|
||||
enum eItemGroup
|
||||
{
|
||||
WEAPON,
|
||||
AMMO,
|
||||
ARMOR,
|
||||
HEALTH,
|
||||
POWERUP
|
||||
};
|
||||
|
||||
//! define a supgroup for the item. for e.q the Weapons
|
||||
enum eItemSubGroup
|
||||
{
|
||||
SUB_NONE = 0,
|
||||
GAUNTLET,
|
||||
MACHINEGUN,
|
||||
SHOTGUN,
|
||||
GRENADE_LAUNCHER,
|
||||
ROCKET_LAUNCHER,
|
||||
LIGHTNING,
|
||||
RAILGUN,
|
||||
PLASMAGUN,
|
||||
BFG,
|
||||
GRAPPLING_HOOK,
|
||||
NAILGUN,
|
||||
PROX_LAUNCHER,
|
||||
CHAINGUN,
|
||||
};
|
||||
|
||||
// a List for defining a model
|
||||
struct SItemElement
|
||||
{
|
||||
const c8 *key;
|
||||
const c8 *model[2];
|
||||
const c8 *sound;
|
||||
const c8 *icon;
|
||||
const c8 *pickup;
|
||||
s32 value;
|
||||
eItemGroup group;
|
||||
eItemSubGroup sub;
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
Get's an entity based on it's key
|
||||
*/
|
||||
const SItemElement * getItemElement ( const stringc& key );
|
||||
|
||||
/*!
|
||||
Quake3 Model Factory.
|
||||
Takes the mesh buffers and creates scenenodes for their associated shaders
|
||||
*/
|
||||
void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
|
||||
IrrlichtDevice *device,
|
||||
IQ3LevelMesh* mesh,
|
||||
eQ3MeshIndex meshIndex,
|
||||
ISceneNode *parent,
|
||||
IMetaTriangleSelector *meta,
|
||||
bool showShaderName
|
||||
);
|
||||
|
||||
|
||||
/*!
|
||||
Creates Model based on the entity list
|
||||
*/
|
||||
void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||
IrrlichtDevice *device,
|
||||
IQ3LevelMesh* masterMesh,
|
||||
ISceneNode *parent
|
||||
);
|
||||
|
||||
/*!
|
||||
so we need a good starting Position in the level.
|
||||
we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch"
|
||||
*/
|
||||
s32 Q3StartPosition ( IQ3LevelMesh* mesh,
|
||||
ICameraSceneNode* camera,
|
||||
s32 startposIndex,
|
||||
const vector3df &translation
|
||||
);
|
||||
/*!
|
||||
gets a accumulated force on a given surface
|
||||
*/
|
||||
vector3df getGravity ( const c8 * surface );
|
||||
|
||||
|
||||
/*
|
||||
Dynamically load the Irrlicht Library
|
||||
*/
|
||||
funcptr_createDevice load_createDevice ( const c8 * filename);
|
||||
funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename);
|
||||
|
||||
|
||||
//! Macro for save Dropping an Element
|
||||
#define dropElement(x) if (x) { x->remove(); x = 0; }
|
||||
|
||||
|
||||
/*
|
||||
get the current collision respone camera animator
|
||||
*/
|
||||
ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device );
|
||||
|
||||
//! internal Animation
|
||||
enum eTimeFireFlag
|
||||
{
|
||||
FIRED = 1,
|
||||
};
|
||||
|
||||
struct TimeFire
|
||||
{
|
||||
u32 flags;
|
||||
u32 next;
|
||||
u32 delta;
|
||||
};
|
||||
|
||||
void setTimeFire ( TimeFire *t, u32 delta, u32 flags = 0 );
|
||||
void checkTimeFire ( TimeFire *t, u32 listSize, u32 now );
|
||||
|
||||
#endif // __QUAKE3_FACTORY__H_INCLUDED__
|
||||
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
/*!
|
||||
Sound Factory.
|
||||
provides a sound interface
|
||||
|
||||
*/
|
||||
|
||||
#include "sound.h"
|
||||
|
||||
|
||||
//#define USE_IRRKLANG
|
||||
|
||||
#ifdef USE_IRRKLANG
|
||||
|
||||
#include <irrKlang.h>
|
||||
#ifdef _IRR_WINDOWS_
|
||||
#pragma comment (lib, "irrKlang.lib")
|
||||
#endif
|
||||
|
||||
using namespace irrklang;
|
||||
|
||||
struct soundfile: public IFileReader
|
||||
{
|
||||
soundfile ( io::IReadFile* f ): file (f ) {}
|
||||
virtual ~soundfile () { file->drop (); }
|
||||
|
||||
virtual ik_s32 read(void* buffer, ik_u32 sizeToRead) { return file->read ( buffer, sizeToRead ); }
|
||||
virtual bool seek(ik_s32 finalPos, bool relativeMovement = false) { return file->seek ( finalPos, relativeMovement ); }
|
||||
virtual ik_s32 getSize(){ return file->getSize (); }
|
||||
virtual ik_s32 getPos() {return file->getPos (); }
|
||||
virtual const ik_c8* getFileName() { return file->getFileName (); }
|
||||
io::IReadFile* file;
|
||||
};
|
||||
|
||||
struct klangFactory : public irrklang::IFileFactory
|
||||
{
|
||||
klangFactory ( IrrlichtDevice *device ) { Device = device; }
|
||||
|
||||
virtual irrklang::IFileReader* createFileReader(const ik_c8* filename)
|
||||
{
|
||||
io::IReadFile* file = Device->getFileSystem()->createAndOpenFile(filename);
|
||||
if ( 0 == file )
|
||||
return 0;
|
||||
|
||||
return new soundfile ( file );
|
||||
}
|
||||
|
||||
IrrlichtDevice *Device;
|
||||
};
|
||||
|
||||
ISoundEngine *engine = 0;
|
||||
ISound *backMusic = 0;
|
||||
|
||||
void sound_init ( IrrlichtDevice *device )
|
||||
{
|
||||
engine = createIrrKlangDevice ();
|
||||
if ( 0 == engine )
|
||||
return;
|
||||
|
||||
klangFactory *f = new klangFactory ( device );
|
||||
engine->addFileFactory ( f );
|
||||
}
|
||||
|
||||
void sound_shutdown ()
|
||||
{
|
||||
if ( backMusic )
|
||||
backMusic->drop ();
|
||||
|
||||
if ( engine )
|
||||
engine->drop ();
|
||||
}
|
||||
|
||||
void background_music ( const c8 * file )
|
||||
{
|
||||
if ( 0 == engine )
|
||||
return;
|
||||
|
||||
if ( backMusic )
|
||||
{
|
||||
backMusic->stop ();
|
||||
backMusic->drop ();
|
||||
}
|
||||
|
||||
backMusic = engine->play2D ( file, true, false, true );
|
||||
|
||||
if ( backMusic )
|
||||
{
|
||||
backMusic->setVolume ( 0.5f );
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void sound_init ( IrrlichtDevice *device ) {}
|
||||
void sound_shutdown () {}
|
||||
void background_music ( const c8 * file ) {}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/*!
|
||||
Sound Factory.
|
||||
provides a sound interface
|
||||
|
||||
*/
|
||||
#ifndef __QUAKE3_SOUND__H_INCLUDED__
|
||||
#define __QUAKE3_SOUND__H_INCLUDED__
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
void sound_init ( IrrlichtDevice *device );
|
||||
void sound_shutdown ();
|
||||
void background_music ( const c8 * file );
|
||||
|
||||
|
||||
#endif // __QUAKE3_SOUND__H_INCLUDED__
|
|
@ -75,8 +75,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16.Quake3MapShader", "16.Qu
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick", "19.MouseAndJoystick\MouseAndJoystick.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights_vc8", "20.ManagedLights\ManagedLights_vc8.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights", "20.ManagedLights\ManagedLights_vc7.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "21.Quake3Explorer", "21.Quake3Explorer\Quake3Explorer_vc7.vcproj", "{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
|
@ -156,6 +165,16 @@ Global
|
|||
{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
|
||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
|
||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.ActiveCfg = Release|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug.ActiveCfg = Debug|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug.Build.0 = Debug|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release.ActiveCfg = Release|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release.Build.0 = Release|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug.ActiveCfg = Debug|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug.Build.0 = Debug|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release.ActiveCfg = Release|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
|
|
@ -6,6 +6,9 @@ EndProject
|
|||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "02.Quake3Map_vc8", "02.Quake3Map\Quake3Map_vc8.vcproj", "{D1A464A2-D479-458C-98A2-60965D823CD1}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "03.CustomSceneNode_vc8", "03.CustomSceneNode\CustomSceneNode_vc8.vcproj", "{171CCDFA-C140-4956-8EB7-F0168F4521D3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "04.Movement_vc8", "04.Movement\Movement_vc8.vcproj", "{7BDBB7E8-E0C9-4A0D-83C1-D389D6140FEF}"
|
||||
EndProject
|
||||
|
@ -43,6 +46,16 @@ EndProject
|
|||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick_vc8", "19.MouseAndJoystick\MouseAndJoystick_vc8.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights_vc8", "20.ManagedLights\ManagedLights_vc8.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "21.Quake3Explorer_vc8", "21.Quake3Explorer\Quake3Explorer_vc8.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}") = "17. HelloWorld for Windows Mobile on PC", "17.HelloWorld_Mobile\17. HelloWorld for Windows Mobile on PC_v8.vcproj", "{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -112,8 +125,8 @@ Global
|
|||
{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.Build.0 = Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release - Fast FPU|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release - Fast FPU|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|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.Build.0 = Debug|Win32
|
||||
{6F076455-D955-45D4-9C68-4AD4E45F2D47}.Release|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -130,6 +143,14 @@ Global
|
|||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release|Win32.Build.0 = Release|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug|Win32.ActiveCfg = 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.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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -351,6 +351,9 @@ void CDemo::loadSceneData()
|
|||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* sm = device->getSceneManager();
|
||||
|
||||
// Quake3 Shader controls Z-Writing
|
||||
sm->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
|
||||
|
||||
quakeLevelMesh = (scene::IQ3LevelMesh*) sm->getMesh("maps/20kdm2.bsp");
|
||||
|
||||
if (quakeLevelMesh)
|
||||
|
@ -399,7 +402,7 @@ void CDemo::loadSceneData()
|
|||
s32 shaderIndex = (s32) material.MaterialTypeParam2;
|
||||
|
||||
// the meshbuffer can be rendered without additional support, or it has no shader
|
||||
const scene::quake3::SShader *shader = quakeLevelMesh->getShader ( shaderIndex );
|
||||
const scene::quake3::IShader *shader = quakeLevelMesh->getShader ( shaderIndex );
|
||||
if ( 0 == shader )
|
||||
{
|
||||
continue;
|
||||
|
@ -408,9 +411,6 @@ void CDemo::loadSceneData()
|
|||
sm->addQuake3SceneNode ( meshBuffer, shader );
|
||||
}
|
||||
|
||||
// original mesh is not needed anymore
|
||||
quakeLevelMesh->releaseMesh ( scene::quake3::E_Q3_MESH_ITEMS );
|
||||
|
||||
}
|
||||
|
||||
// load sydney model and create 2 instances
|
||||
|
@ -482,7 +482,7 @@ void CDemo::loadSceneData()
|
|||
core::stringc tmp("../../media/portal");
|
||||
tmp += g;
|
||||
tmp += ".bmp";
|
||||
video::ITexture* t = driver->getTexture( tmp.c_str () );
|
||||
video::ITexture* t = driver->getTexture( tmp );
|
||||
textures.push_back(t);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// This is a Demo of the Irrlicht Engine (c) 2005-2009 by N.Gebhardt.
|
||||
// This is a Demo of the Irrlicht Engine (c) 2005-2008 by N.Gebhardt.
|
||||
// This file is not documented.
|
||||
|
||||
#include "CMainMenu.h"
|
||||
|
@ -116,7 +116,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
|
|||
box->addItem(L"OpenGL 1.5");
|
||||
box->addItem(L"Direct3D 8.1");
|
||||
box->addItem(L"Direct3D 9.0c");
|
||||
box->addItem(L"Burning's Video 0.39");
|
||||
box->addItem(L"Burning's Video 0.40");
|
||||
box->addItem(L"Irrlicht Software Renderer 1.0");
|
||||
box->setSelected(selected);
|
||||
|
||||
|
|
|
@ -82,6 +82,9 @@ enum EGUI_ELEMENT_TYPE
|
|||
//! A window
|
||||
EGUIET_WINDOW,
|
||||
|
||||
//! A Tree View
|
||||
EGUIET_TREE_VIEW,
|
||||
|
||||
//! Not an element, amount of elements in there
|
||||
EGUIET_COUNT,
|
||||
|
||||
|
|
|
@ -66,6 +66,9 @@ namespace scene
|
|||
//! Particle System Scene Node
|
||||
ESNT_PARTICLE_SYSTEM = MAKE_IRR_ID('p','t','c','l'),
|
||||
|
||||
//! Quake3 Shader Scene Node
|
||||
ESNT_Q3SHADER_SCENE_NODE = MAKE_IRR_ID('q','3','s','h'),
|
||||
|
||||
//! Quake3 Model Scene Node ( has tag to link to )
|
||||
ESNT_MD3_SCENE_NODE = MAKE_IRR_ID('m','d','3','_'),
|
||||
|
||||
|
|
|
@ -89,15 +89,15 @@ namespace scene
|
|||
struct SMD3Header
|
||||
{
|
||||
c8 headerID[4]; //id of file, always "IDP3"
|
||||
s32 Version; //this is a version number, always 15
|
||||
s32 Version; //this is a version number, always 15
|
||||
s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars
|
||||
s32 numFrames; //number of KeyFrames
|
||||
s32 numTags; //number of 'tags' per frame
|
||||
s32 numMeshes; //number of meshes/skins
|
||||
s32 numMaxSkins; //maximum number of unique skins used in md3 file
|
||||
s32 headerSize; //always equal to the length of this header
|
||||
s32 tagStart; //starting position of tag-structures
|
||||
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
|
||||
s32 numFrames; //number of KeyFrames
|
||||
s32 numTags; //number of 'tags' per frame
|
||||
s32 numMeshes; //number of meshes/skins
|
||||
s32 numMaxSkins; //maximum number of unique skins used in md3 file. artefact md2
|
||||
s32 frameStart; //starting position of frame-structur
|
||||
s32 tagStart; //starting position of tag-structures
|
||||
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
|
||||
s32 fileSize;
|
||||
};
|
||||
|
||||
|
@ -151,9 +151,10 @@ namespace scene
|
|||
//! Holding Frame Data for a Mesh
|
||||
struct SMD3MeshBuffer : public IReferenceCounted
|
||||
{
|
||||
virtual ~SMD3MeshBuffer () {}
|
||||
SMD3MeshHeader MeshHeader;
|
||||
|
||||
core::array < core::stringc > Shader;
|
||||
core::stringc Shader;
|
||||
core::array < s32 > Indices;
|
||||
core::array < SMD3Vertex > Vertices;
|
||||
core::array < SMD3TexCoord > Tex;
|
||||
|
@ -161,44 +162,74 @@ namespace scene
|
|||
|
||||
//! hold a tag info for connecting meshes
|
||||
/** Basically its an alternate way to describe a transformation. */
|
||||
struct SMD3QuaterionTag
|
||||
struct SMD3QuaternionTag
|
||||
{
|
||||
SMD3QuaterionTag() {}
|
||||
virtual ~SMD3QuaternionTag()
|
||||
{
|
||||
position.X = 0.f;
|
||||
}
|
||||
|
||||
SMD3QuaterionTag( const core::stringc& name )
|
||||
// construct copy constructor
|
||||
SMD3QuaternionTag( const SMD3QuaternionTag & copyMe )
|
||||
{
|
||||
*this = copyMe;
|
||||
}
|
||||
|
||||
// construct for searching
|
||||
SMD3QuaternionTag( const core::stringc& name )
|
||||
: Name ( name ) {}
|
||||
|
||||
// construct from a matrix
|
||||
SMD3QuaterionTag ( const core::stringc& name, const core::matrix4 &m ) : Name(name), position(m.getTranslation()), rotation(m)
|
||||
{ }
|
||||
SMD3QuaternionTag ( const core::stringc& name, const core::matrix4 &m )
|
||||
: Name(name), position(m.getTranslation()), rotation(m) {}
|
||||
|
||||
// construct from a position and euler angles in degrees
|
||||
SMD3QuaterionTag ( const core::vector3df &pos, const core::vector3df &angle ) : position(pos), rotation(angle * core::DEGTORAD)
|
||||
{ }
|
||||
SMD3QuaternionTag ( const core::vector3df &pos, const core::vector3df &angle )
|
||||
: position(pos), rotation(angle * core::DEGTORAD) {}
|
||||
|
||||
// set to matrix
|
||||
void setto ( core::matrix4 &m )
|
||||
{
|
||||
rotation.getMatrix ( m );
|
||||
m.setTranslation ( position );
|
||||
rotation.getMatrix ( m, position );
|
||||
}
|
||||
|
||||
bool operator == ( const SMD3QuaterionTag &other ) const
|
||||
bool operator == ( const SMD3QuaternionTag &other ) const
|
||||
{
|
||||
return Name == other.Name;
|
||||
}
|
||||
|
||||
SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe )
|
||||
{
|
||||
Name = copyMe.Name;
|
||||
position = copyMe.position;
|
||||
rotation = copyMe.rotation;
|
||||
return *this;
|
||||
}
|
||||
|
||||
core::stringc Name;
|
||||
core::vector3df position;
|
||||
core::quaternion rotation;
|
||||
};
|
||||
|
||||
//! holds a associative list of named quaternions
|
||||
struct SMD3QuaterionTagList : public virtual IReferenceCounted
|
||||
struct SMD3QuaternionTagList
|
||||
{
|
||||
SMD3QuaterionTag* get ( const core::stringc& name )
|
||||
SMD3QuaternionTagList ()
|
||||
{
|
||||
SMD3QuaterionTag search ( name );
|
||||
Container.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
|
||||
}
|
||||
|
||||
// construct copy constructor
|
||||
SMD3QuaternionTagList( const SMD3QuaternionTagList & copyMe )
|
||||
{
|
||||
*this = copyMe;
|
||||
}
|
||||
|
||||
virtual ~SMD3QuaternionTagList () {}
|
||||
|
||||
SMD3QuaternionTag* get ( const core::stringc& name )
|
||||
{
|
||||
SMD3QuaternionTag search ( name );
|
||||
s32 index = Container.linear_search ( search );
|
||||
if ( index >= 0 )
|
||||
return &Container[index];
|
||||
|
@ -210,39 +241,61 @@ namespace scene
|
|||
return Container.size();
|
||||
}
|
||||
|
||||
const SMD3QuaterionTag& operator[](u32 index) const
|
||||
void set_used ( u32 new_size)
|
||||
{
|
||||
s32 diff = (s32) new_size - (s32) Container.allocated_size ();
|
||||
if ( diff > 0 )
|
||||
{
|
||||
SMD3QuaternionTag e ( "" );
|
||||
for ( s32 i = 0; i < diff; ++i )
|
||||
Container.push_back ( e );
|
||||
}
|
||||
}
|
||||
|
||||
const SMD3QuaternionTag& operator[](u32 index) const
|
||||
{
|
||||
return Container[index];
|
||||
}
|
||||
|
||||
SMD3QuaterionTag& operator[](u32 index)
|
||||
SMD3QuaternionTag& operator[](u32 index)
|
||||
{
|
||||
return Container[index];
|
||||
}
|
||||
|
||||
SMD3QuaterionTagList & operator = (const SMD3QuaterionTagList & copyMe)
|
||||
void push_back ( const SMD3QuaternionTag& other )
|
||||
{
|
||||
Container.push_back ( other );
|
||||
}
|
||||
|
||||
SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe)
|
||||
{
|
||||
Container = copyMe.Container;
|
||||
return *this;
|
||||
}
|
||||
|
||||
core::array < SMD3QuaterionTag > Container;
|
||||
private:
|
||||
core::array < SMD3QuaternionTag > Container;
|
||||
};
|
||||
|
||||
|
||||
//! Holding Frames Buffers and Tag Infos
|
||||
struct SMD3Mesh: public IReferenceCounted
|
||||
{
|
||||
~SMD3Mesh()
|
||||
SMD3Mesh ()
|
||||
{
|
||||
MD3Header.numFrames = 0;
|
||||
}
|
||||
|
||||
virtual ~SMD3Mesh()
|
||||
{
|
||||
for (u32 i=0; i<Buffer.size(); ++i)
|
||||
Buffer[i]->drop();
|
||||
}
|
||||
|
||||
SMD3Header MD3Header;
|
||||
core::stringc Name;
|
||||
core::array < SMD3MeshBuffer * > Buffer;
|
||||
SMD3QuaterionTagList TagList;
|
||||
SMD3QuaternionTagList TagList;
|
||||
SMD3Header MD3Header;
|
||||
};
|
||||
|
||||
|
||||
|
@ -255,7 +308,7 @@ namespace scene
|
|||
virtual void setInterpolationShift ( u32 shift, u32 loopMode ) = 0;
|
||||
|
||||
//! get the tag list of the mesh.
|
||||
virtual SMD3QuaterionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) = 0;
|
||||
virtual SMD3QuaternionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) = 0;
|
||||
|
||||
//! get the original md3 mesh.
|
||||
virtual SMD3Mesh * getOriginalMesh () = 0;
|
||||
|
|
|
@ -193,7 +193,7 @@ namespace scene
|
|||
virtual IAnimatedMesh* getMesh(void) = 0;
|
||||
|
||||
//! Get the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, or the absolutetransformation if it's a normal scenenode
|
||||
virtual const SMD3QuaterionTag& getMD3TagTransformation( const core::stringc & tagname) = 0;
|
||||
virtual const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname) = 0;
|
||||
|
||||
//! Set how the joints should be updated on render
|
||||
virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode)=0;
|
||||
|
|
|
@ -149,6 +149,9 @@ namespace irr
|
|||
//! A file has been selected in the file dialog
|
||||
EGET_FILE_SELECTED,
|
||||
|
||||
//! A directory has been selected in the file dialog
|
||||
EGET_DIRECTORY_SELECTED,
|
||||
|
||||
//! A file open dialog has been closed without choosing a file
|
||||
EGET_FILE_CHOOSE_DIALOG_CANCELLED,
|
||||
|
||||
|
@ -181,7 +184,19 @@ namespace irr
|
|||
//! A table has changed
|
||||
EGET_TABLE_CHANGED,
|
||||
EGET_TABLE_HEADER_CHANGED,
|
||||
EGET_TABLE_SELECTED_AGAIN
|
||||
EGET_TABLE_SELECTED_AGAIN,
|
||||
|
||||
//! A tree view node lost selection. See IGUITreeView::getLastEventNode().
|
||||
EGET_TREEVIEW_NODE_DESELECT,
|
||||
|
||||
//! A tree view node was selected. See IGUITreeView::getLastEventNode().
|
||||
EGET_TREEVIEW_NODE_SELECT,
|
||||
|
||||
//! A tree view node was expanded. See IGUITreeView::getLastEventNode().
|
||||
EGET_TREEVIEW_NODE_EXPAND,
|
||||
|
||||
//! A tree view node was collapsed. See IGUITreeView::getLastEventNode().
|
||||
EGET_TREEVIEW_NODE_COLLAPS,
|
||||
|
||||
};
|
||||
} // end namespace gui
|
||||
|
@ -217,6 +232,13 @@ struct SEvent
|
|||
/** Only valid if event was EMIE_MOUSE_WHEEL */
|
||||
f32 Wheel;
|
||||
|
||||
//! A bitmap of button states. You can use IsButtonPressed() to
|
||||
/** Only valid if event was EMIE_MOUSE_MOVED */
|
||||
u32 ButtonStates;
|
||||
bool isLeftPressed () const { return 0 != ( ButtonStates & 0x0001 ); }
|
||||
bool isRightPressed () const { return 0 != ( ButtonStates & 0x0002 ); }
|
||||
bool isMiddlePressed () const { return 0 != ( ButtonStates & 0x0010 ); }
|
||||
|
||||
//! Type of mouse event
|
||||
EMOUSE_INPUT_EVENT Event;
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define __I_FILE_LIST_H_INCLUDED__
|
||||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "irrString.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -25,13 +26,13 @@ public:
|
|||
\param index is the zero based index of the file which name should
|
||||
be returned. The index has to be smaller than the amount getFileCount() returns.
|
||||
\return File name of the file. Returns 0, if an error occured. */
|
||||
virtual const c8* getFileName(u32 index) const = 0;
|
||||
virtual const core::string<c16>& getFileName(u32 index) const = 0;
|
||||
|
||||
//! Gets the full name of a file in the list, path included, based on an index.
|
||||
/** \param index is the zero based index of the file which name should
|
||||
be returned. The index has to be smaller than the amount getFileCount() returns.
|
||||
\return File name of the file. Returns 0, if an error occured. */
|
||||
virtual const c8* getFullFileName(u32 index) = 0;
|
||||
virtual const core::string<c16>& getFullFileName(u32 index) = 0;
|
||||
|
||||
//! Check if the file is a directory
|
||||
/** \param index The zero based index of the file whose name shall
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "IXMLReader.h"
|
||||
#include "irrString.h"
|
||||
#include "IFileArchive.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ class IFileList;
|
|||
class IXMLWriter;
|
||||
class IAttributes;
|
||||
|
||||
|
||||
//! The FileSystem manages files and archives and provides access to them.
|
||||
/** It manages where files are, so that modules which use the the IO do not
|
||||
need to know where every file is located. A file could be in a .zip-Archive or
|
||||
|
@ -37,7 +38,7 @@ public:
|
|||
\return Returns a pointer to the created file interface.
|
||||
The returned pointer should be dropped when no longer needed.
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IReadFile* createAndOpenFile(const c8* filename) = 0;
|
||||
virtual IReadFile* createAndOpenFile(const core::string<c16>& filename) = 0;
|
||||
|
||||
//! Creates an IReadFile interface for accessing memory like a file.
|
||||
/** This allows you to use a pointer to memory where an IReadFile is requested.
|
||||
|
@ -50,7 +51,7 @@ public:
|
|||
The returned pointer should be dropped when no longer needed.
|
||||
See IReferenceCounted::drop() for more information.
|
||||
*/
|
||||
virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const c8* fileName, bool deleteMemoryWhenDropped=false) = 0;
|
||||
virtual IReadFile* createMemoryReadFile(void* memory, s32 len, const core::string<c16>& fileName, bool deleteMemoryWhenDropped=false) = 0;
|
||||
|
||||
//! Creates an IWriteFile interface for accessing memory like a file.
|
||||
/** This allows you to use a pointer to memory where an IWriteFile is requested.
|
||||
|
@ -64,7 +65,7 @@ public:
|
|||
The returned pointer should be dropped when no longer needed.
|
||||
See IReferenceCounted::drop() for more information.
|
||||
*/
|
||||
virtual IWriteFile* createMemoryWriteFile(void* memory, s32 len, const c8* fileName, bool deleteMemoryWhenDropped=false) = 0;
|
||||
virtual IWriteFile* createMemoryWriteFile(void* memory, s32 len, const core::string<c16>& fileName, bool deleteMemoryWhenDropped=false) = 0;
|
||||
|
||||
|
||||
//! Opens a file for write access.
|
||||
|
@ -75,7 +76,28 @@ public:
|
|||
file could not created or opened for writing.
|
||||
The returned pointer should be dropped when no longer needed.
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IWriteFile* createAndWriteFile(const c8* filename, bool append=false) = 0;
|
||||
virtual IWriteFile* createAndWriteFile(const core::string<c16>& filename, bool append=false) = 0;
|
||||
|
||||
//! Adds an archive to the file system.
|
||||
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
|
||||
This is useful for hiding data from the end user, speeding up file access and making it possible to
|
||||
access for example Quake3 .pk3 files, which are nothing different than .zip files.
|
||||
\param filename: Filename of the zip archive to add to the file system.
|
||||
\param ignoreCase: If set to true, files in the archive can be accessed without
|
||||
writing all letters in the right case.
|
||||
\param ignorePaths: If set to true, files in the added archive can be accessed
|
||||
without its complete path.
|
||||
\return Returns true if the archive was added successful, false if not. */
|
||||
virtual bool registerFileArchive( const core::string<c16>& filename, bool ignoreCase = true, bool ignorePaths = true, s32 index = -1) = 0;
|
||||
|
||||
//! Adds an external archive loader to the engine.
|
||||
virtual void addArchiveLoader(IArchiveLoader* loader) = 0;
|
||||
//! return the amount of currently attached Archives
|
||||
virtual u32 getFileArchiveCount() = 0;
|
||||
//! removes an archive from the file system.
|
||||
virtual bool unregisterFileArchive( u32 index ) = 0;
|
||||
//! get the Archive number index
|
||||
virtual IFileArchive* getFileArchive( u32 index ) = 0;
|
||||
|
||||
//! Adds an zip archive to the file system.
|
||||
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
|
||||
|
@ -87,7 +109,11 @@ public:
|
|||
\param ignorePaths: If set to true, files in the added archive can be accessed
|
||||
without its complete path.
|
||||
\return Returns true if the archive was added successful, false if not. */
|
||||
virtual bool addZipFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
|
||||
virtual bool addZipFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true)
|
||||
{
|
||||
return registerFileArchive ( filename, ignoreCase, ignorePaths );
|
||||
}
|
||||
|
||||
|
||||
//! Adds an unzipped archive ( or basedirectory with subdirectories..) to the file system.
|
||||
/** Useful for handling data which will be in a zip file
|
||||
|
@ -97,7 +123,10 @@ public:
|
|||
\param ignorePaths: If set to true, files in the added archive can be accessed
|
||||
without its complete path.
|
||||
\return Returns true if the archive was added successful, false if not. */
|
||||
virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
|
||||
virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true)
|
||||
{
|
||||
return registerFileArchive ( filename, ignoreCase, ignorePaths );
|
||||
}
|
||||
|
||||
//! Adds an pak archive to the file system.
|
||||
/** After calling this, the Irrlicht Engine will search and open files directly from this archive too.
|
||||
|
@ -109,51 +138,53 @@ public:
|
|||
\param ignorePaths: If set to true, files in the added archive can be accessed
|
||||
without its complete path.(should not use with Quake2 paks
|
||||
\return Returns true if the archive was added successful, false if not. */
|
||||
virtual bool addPakFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true) = 0;
|
||||
virtual bool addPakFileArchive(const c8* filename, bool ignoreCase = true, bool ignorePaths = true)
|
||||
{
|
||||
return registerFileArchive ( filename, ignoreCase, ignorePaths );
|
||||
}
|
||||
|
||||
//! Get the current working directory.
|
||||
/** \return Current working directory as a string. */
|
||||
virtual const c8* getWorkingDirectory() = 0;
|
||||
virtual const core::string<c16>& getWorkingDirectory() = 0;
|
||||
|
||||
//! Changes the current working directory.
|
||||
/** \param newDirectory: A string specifying the new working directory.
|
||||
The string is operating system dependent. Under Windows it has
|
||||
the form "<drive>:\<directory>\<sudirectory>\<..>". An example would be: "C:\Windows\"
|
||||
\return True if successful, otherwise false. */
|
||||
virtual bool changeWorkingDirectoryTo(const c8* newDirectory) = 0;
|
||||
virtual bool changeWorkingDirectoryTo(const core::string<c16>& newDirectory) = 0;
|
||||
|
||||
//! Converts a relative path to an absolute (unique) path, resolving symbolic links if required
|
||||
/** \param filename Possibly relative filename begin queried.
|
||||
\result Absolute filename which points to the same file. */
|
||||
virtual core::stringc getAbsolutePath(const core::stringc& filename) const = 0;
|
||||
virtual core::string<c16> getAbsolutePath(const core::string<c16>& filename) const = 0;
|
||||
|
||||
//! Returns the directory a file is located in.
|
||||
/** \param filename: The file to get the directory from.
|
||||
\return String containing the directory of the file. */
|
||||
virtual core::stringc getFileDir(const core::stringc& filename) const = 0;
|
||||
virtual core::string<c16> getFileDir(const core::string<c16>& filename) const = 0;
|
||||
|
||||
//! Returns the base part of a filename, i.e. the name without the directory
|
||||
//! part. If no directory is prefixed, the full name is returned.
|
||||
/** \param filename: The file to get the basename from
|
||||
\param keepExtension True if filename with extension is returned otherwise everything
|
||||
after the final '.' is removed as well. */
|
||||
virtual core::stringc getFileBasename(const core::stringc& filename, bool keepExtension=true) const = 0;
|
||||
virtual core::string<c16> getFileBasename(const core::string<c16>& filename, bool keepExtension=true) const = 0;
|
||||
|
||||
//! flaten a path and file name for example: "/you/me/../." becomes "/you"
|
||||
virtual core::string<c16>& flatenFilename( core::string<c16>& directory, const core::string<c16>& root = "/" ) const = 0;
|
||||
|
||||
//! Creates a list of files and directories in the current working directory and returns it.
|
||||
/** \return a Pointer to the created IFileList is returned. After the list has been used
|
||||
it has to be deleted using its IFileList::drop() method.
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IFileList* createFileList() const = 0;
|
||||
virtual eFileSystemType setFileListSystem( eFileSystemType listType) = 0;
|
||||
virtual IFileList* createFileList() = 0;
|
||||
|
||||
//! Determines if a file exists and could be opened.
|
||||
/** \param filename is the string identifying the file which should be tested for existence.
|
||||
\return Returns true if file exists, and false if it does not exist or an error occured. */
|
||||
virtual bool existFile(const c8* filename) const = 0;
|
||||
|
||||
//! Determines if a file exists and could be opened.
|
||||
/** \param filename is the string identifying the file which should be tested for existence.
|
||||
\return Returns true if file exists, and false if it does not exist or an error occured. */
|
||||
virtual bool existFile(const core::stringc& filename) const = 0;
|
||||
virtual bool existFile(const core::string<c16>& filename) const = 0;
|
||||
|
||||
//! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
|
||||
/** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
|
||||
|
@ -162,7 +193,7 @@ public:
|
|||
IXMLReader is returned. After use, the reader
|
||||
has to be deleted using its IXMLReader::drop() method.
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IXMLReader* createXMLReader(const c8* filename) = 0;
|
||||
virtual IXMLReader* createXMLReader(const core::string<c16>& filename) = 0;
|
||||
|
||||
//! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
|
||||
/** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
|
||||
|
@ -180,7 +211,7 @@ public:
|
|||
IXMLReader is returned. After use, the reader
|
||||
has to be deleted using its IXMLReaderUTF8::drop() method.
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IXMLReaderUTF8* createXMLReaderUTF8(const c8* filename) = 0;
|
||||
virtual IXMLReaderUTF8* createXMLReaderUTF8(const core::string<c16>& filename) = 0;
|
||||
|
||||
//! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
|
||||
/** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
|
||||
|
@ -196,7 +227,7 @@ public:
|
|||
IXMLWriter is returned. After use, the reader
|
||||
has to be deleted using its IXMLWriter::drop() method.
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IXMLWriter* createXMLWriter(const c8* filename) = 0;
|
||||
virtual IXMLWriter* createXMLWriter(const core::string<c16>& filename) = 0;
|
||||
|
||||
//! Creates a XML Writer from a file.
|
||||
/** \return 0, if file could not be opened, otherwise a pointer to the created
|
||||
|
|
|
@ -156,10 +156,10 @@ public:
|
|||
then printed to the error log and can be catched with a custom event
|
||||
receiver. */
|
||||
virtual s32 addHighLevelShaderMaterialFromFiles(
|
||||
const c8* vertexShaderProgram,
|
||||
const core::string<c16>& vertexShaderProgramFileName,
|
||||
const c8* vertexShaderEntryPointName = "main",
|
||||
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
|
||||
const c8* pixelShaderProgram = 0,
|
||||
const core::string<c16>& pixelShaderProgramFileName = "",
|
||||
const c8* pixelShaderEntryPointName = "main",
|
||||
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
|
||||
IShaderConstantSetCallBack* callback = 0,
|
||||
|
@ -293,8 +293,8 @@ public:
|
|||
error occured. -1 is returned for example if a vertex or pixel shader
|
||||
program could not be compiled, the error strings are then printed out
|
||||
into the error log, and can be catched with a custom event receiver. */
|
||||
virtual s32 addShaderMaterialFromFiles(const c8* vertexShaderProgramFileName,
|
||||
const c8* pixelShaderProgramFileName,
|
||||
virtual s32 addShaderMaterialFromFiles(const core::string<c16>& vertexShaderProgramFileName,
|
||||
const core::string<c16>& pixelShaderProgramFileName,
|
||||
IShaderConstantSetCallBack* callback = 0,
|
||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
||||
s32 userData = 0) = 0;
|
||||
|
|
|
@ -27,8 +27,14 @@ namespace gui
|
|||
//! Returns string of an item. the idx may be a value from 0 to itemCount-1
|
||||
virtual const wchar_t* getItem(u32 idx) const = 0;
|
||||
|
||||
//! Returns item data of an item. the idx may be a value from 0 to itemCount-1
|
||||
virtual u32 getItemData(u32 idx) const = 0;
|
||||
|
||||
//! Returns index based on item data
|
||||
virtual s32 getIndexForItemData(u32 data ) const = 0;
|
||||
|
||||
//! Adds an item and returns the index of it
|
||||
virtual u32 addItem(const wchar_t* text) = 0;
|
||||
virtual u32 addItem(const wchar_t* text, u32 data = 0) = 0;
|
||||
|
||||
//! Removes an item from the combo box.
|
||||
/** Warning. This will change the index of all following items */
|
||||
|
|
|
@ -432,24 +432,24 @@ public:
|
|||
//! Draws the element and its children.
|
||||
virtual void draw()
|
||||
{
|
||||
if (!IsVisible)
|
||||
return;
|
||||
|
||||
core::list<IGUIElement*>::Iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
(*it)->draw();
|
||||
if ( IsVisible )
|
||||
{
|
||||
core::list<IGUIElement*>::Iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
(*it)->draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! animate the element and its children.
|
||||
virtual void OnPostRender(u32 timeMs)
|
||||
{
|
||||
if (!IsVisible)
|
||||
return;
|
||||
|
||||
core::list<IGUIElement*>::Iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
(*it)->OnPostRender( timeMs );
|
||||
if ( IsVisible )
|
||||
{
|
||||
core::list<IGUIElement*>::Iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
(*it)->OnPostRender( timeMs );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ class IGUIImage;
|
|||
class IGUIMeshViewer;
|
||||
class IGUICheckBox;
|
||||
class IGUIListBox;
|
||||
class IGUITreeView;
|
||||
class IGUIImageList;
|
||||
class IGUIFileOpenDialog;
|
||||
class IGUIColorSelectDialog;
|
||||
class IGUIInOutFader;
|
||||
|
@ -144,13 +146,23 @@ public:
|
|||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
|
||||
|
||||
|
||||
//! Creates the image list from the given texture.
|
||||
/** Loads the font if it was not loaded before.
|
||||
\param filename Filename of the Font.
|
||||
\return Pointer to the font. Returns 0 if the font could not be loaded.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||
more information. */
|
||||
virtual IGUIImageList* createImageList( video::ITexture* texture,
|
||||
core::dimension2d<s32> imageSize, bool useAlphaChannel ) = 0;
|
||||
|
||||
//! Returns pointer to the font with the specified filename.
|
||||
/** Loads the font if it was not loaded before.
|
||||
\param filename Filename of the Font.
|
||||
\return Pointer to the font. Returns 0 if the font could not be loaded.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||
more information. */
|
||||
virtual IGUIFont* getFont(const c8* filename) = 0;
|
||||
virtual IGUIFont* getFont(const core::string<c16>& filename) = 0;
|
||||
|
||||
//! Returns the default built-in font.
|
||||
/** \return Pointer to the default built-in font.
|
||||
|
@ -163,13 +175,13 @@ public:
|
|||
\param filename Filename of the sprite bank's origin.
|
||||
\return Pointer to the sprite bank. Returns 0 if it could not be loaded.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
||||
virtual IGUISpriteBank* getSpriteBank(const c8* filename) = 0;
|
||||
virtual IGUISpriteBank* getSpriteBank(const core::string<c16>& filename) = 0;
|
||||
|
||||
//! Adds an empty sprite bank to the manager
|
||||
/** \param name Name of the new sprite bank.
|
||||
\return Pointer to the sprite bank.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
||||
virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0;
|
||||
virtual IGUISpriteBank* addEmptySpriteBank(const core::string<c16>& name) = 0;
|
||||
|
||||
//! Returns the root gui element.
|
||||
/** This is the first gui element, the (direct or indirect) parent of all
|
||||
|
@ -295,6 +307,18 @@ public:
|
|||
virtual IGUIListBox* addListBox(const core::rect<s32>& rectangle,
|
||||
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0;
|
||||
|
||||
//! Adds a tree view element.
|
||||
/** \param rectangle Position and dimension of list box.
|
||||
\param parent Parent gui element of the list box.
|
||||
\param id Id to identify the gui element.
|
||||
\param drawBackground Flag whether the background should be drawn.
|
||||
\return Pointer to the created list box. Returns 0 if an error occured.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||
more information. */
|
||||
virtual IGUITreeView* addTreeView(const core::rect<s32>& rectangle,
|
||||
IGUIElement* parent=0, s32 id=-1, bool drawBackground=false,
|
||||
bool scrollBarVertical = true, bool scrollBarHorizontal = false) = 0;
|
||||
|
||||
//! Adds a mesh viewer. Not 100% implemented yet.
|
||||
/** \param rectangle Position and dimension of mesh viewer.
|
||||
\param parent Parent gui element of the mesh viewer.
|
||||
|
@ -377,7 +401,7 @@ public:
|
|||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||
more information. */
|
||||
virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect<s32>& rectangle,
|
||||
IGUIElement* parent=0, s32 id=-1) = 0;
|
||||
bool border=true,IGUIElement* parent=0, s32 id=-1) = 0;
|
||||
|
||||
//! Adds an element for fading in or out.
|
||||
/* \param rectangle Rectangle specifying the borders of the element.
|
||||
|
@ -503,7 +527,7 @@ public:
|
|||
//! Saves the current gui into a file.
|
||||
/** \param filename Name of the file.
|
||||
\param start The GUIElement to start with. Root if 0. */
|
||||
virtual bool saveGUI(const c8* filename, IGUIElement* start=0) = 0;
|
||||
virtual bool saveGUI(const core::string<c16>& filename, IGUIElement* start=0) = 0;
|
||||
|
||||
//! Saves the current gui into a file.
|
||||
/** \param file The file to write to.
|
||||
|
@ -513,7 +537,7 @@ public:
|
|||
//! Loads the gui. Note that the current gui is not cleared before.
|
||||
/** \param filename Name of the file.
|
||||
\param parent Parent for the loaded GUI, root if 0. */
|
||||
virtual bool loadGUI(const c8* filename, IGUIElement* parent=0) = 0;
|
||||
virtual bool loadGUI(const c16* filename, IGUIElement* parent=0) = 0;
|
||||
|
||||
//! Loads the gui. Note that the current gui is not cleared before.
|
||||
/** \param file The file to load from.
|
||||
|
|
|
@ -23,6 +23,10 @@ namespace gui
|
|||
|
||||
//! Returns the filename of the selected file. Returns NULL, if no file was selected.
|
||||
virtual const wchar_t* getFileName() const = 0;
|
||||
|
||||
//! Returns the directory of the selected file. Returns NULL, if no directory was selected.
|
||||
virtual const core::string<c16>& getDirectoryName() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -85,6 +85,13 @@ public:
|
|||
|
||||
//! Returns the distance between letters
|
||||
virtual s32 getKerningHeight() const = 0;
|
||||
|
||||
//! define which characters should not be drawn by the font. for example " " would
|
||||
// not draw any space which is usually blank in most fonts.
|
||||
/**
|
||||
\param invisible: string of symbols, which are not send down to the videodriver
|
||||
*/
|
||||
virtual void setInvisibleCharacters( const wchar_t *s ) = 0;
|
||||
};
|
||||
|
||||
} // end namespace gui
|
||||
|
|
|
@ -21,11 +21,15 @@ namespace gui
|
|||
IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
|
||||
: IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {}
|
||||
|
||||
//! sets the maximum value of the scrollbar.
|
||||
virtual void setMax(s32 max) = 0;
|
||||
//! gets the maximum value of the scrollbar.
|
||||
virtual s32 getMax() const = 0;
|
||||
|
||||
//! sets the maximum value of the scrollbar.
|
||||
virtual void setMax(s32 max) = 0;
|
||||
virtual void setMin(s32 max) = 0;
|
||||
//! gets the maximum value of the scrollbar.
|
||||
virtual s32 getMin() const = 0;
|
||||
|
||||
//! gets the small step value
|
||||
virtual s32 getSmallStep() const = 0;
|
||||
|
|
|
@ -136,8 +136,9 @@ namespace gui
|
|||
will be placed after it. If the row is larger than the actual
|
||||
number of row by more than one, it won't be created. Note that
|
||||
if you create a row that's not at the end, there might be
|
||||
performance issues. */
|
||||
virtual void addRow(u32 rowIndex) = 0;
|
||||
performance issues.
|
||||
\returns: index of inteserted row*/
|
||||
virtual u32 addRow(u32 rowIndex) = 0;
|
||||
|
||||
//! Remove a row from the table
|
||||
virtual void removeRow(u32 rowIndex) = 0;
|
||||
|
@ -158,10 +159,10 @@ namespace gui
|
|||
virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE) = 0;
|
||||
|
||||
//! Set the text of a cell
|
||||
virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text) = 0;
|
||||
virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text) = 0;
|
||||
|
||||
//! Set the text of a cell, and set a color of this cell.
|
||||
virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text, video::SColor color) = 0;
|
||||
virtual void setCellText(u32 rowIndex, u32 columnIndex, const core::stringw& text, video::SColor color) = 0;
|
||||
|
||||
//! Set the data of a cell
|
||||
virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data) = 0;
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace gui
|
|||
|
||||
//! Returns pointer to the maximize button
|
||||
virtual IGUIButton* getMaximizeButton() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -113,6 +113,9 @@ public:
|
|||
const core::rect<s32>& sourceRect, const SColor &color,
|
||||
const core::rect<s32>* clipRect = 0) =0;
|
||||
|
||||
//! copies this surface into another, scaling it to fit, appyling a box filter
|
||||
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0) = 0;
|
||||
|
||||
//! fills the surface with black or white
|
||||
virtual void fill(const SColor &color) =0;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "IImage.h"
|
||||
#include "irrString.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -30,7 +31,7 @@ public:
|
|||
/** Check is based on the file extension (e.g. ".tga")
|
||||
\param fileName Name of file to check.
|
||||
\return True if file seems to be loadable. */
|
||||
virtual bool isALoadableFileExtension(const c8* fileName) const = 0;
|
||||
virtual bool isALoadableFileExtension(const core::string<c16>& filename) const = 0;
|
||||
|
||||
//! Check if the file might be loaded by this class
|
||||
/** Check might look into the file.
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#define _I_IMAGE_WRITER_H_INCLUDED__
|
||||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "irrString.h"
|
||||
#include "coreutil.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -26,7 +28,7 @@ public:
|
|||
//! Check if this writer can write a file with the given extension
|
||||
/** \param fileName Name of the file to check.
|
||||
\return True if file extension specifies a writable type. */
|
||||
virtual bool isAWriteableFileExtension(const c8* fileName) const = 0;
|
||||
virtual bool isAWriteableFileExtension(const core::string<c16>& filename) const = 0;
|
||||
|
||||
//! Write image to file
|
||||
/** \param file File handle to write to.
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
filtered with these levels. If you want to be a text displayed,
|
||||
independent on what level filter is set, use ELL_NONE. */
|
||||
virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
|
||||
virtual void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
|
||||
|
||||
//! Prints out a text into the log
|
||||
/** \param text: Text to print out.
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace scene
|
|||
set by this method.
|
||||
\param mesh Pointer to a mesh which will now be referenced by
|
||||
this name. */
|
||||
virtual void addMesh(const c8* filename, IAnimatedMesh* mesh) = 0;
|
||||
virtual void addMesh(const core::string<c16>& filename, IAnimatedMesh* mesh) = 0;
|
||||
|
||||
//! Removes a mesh from the cache.
|
||||
/** After loading a mesh with getMesh(), the mesh can be
|
||||
|
@ -93,25 +93,25 @@ namespace scene
|
|||
//! Returns a mesh based on its filename.
|
||||
/** \param filename Name of the mesh.
|
||||
\return Pointer to the mesh or 0 if there is none with this number. */
|
||||
virtual IAnimatedMesh* getMeshByFilename(const c8* filename) = 0;
|
||||
virtual IAnimatedMesh* getMeshByFilename(const core::string<c16>& filename) = 0;
|
||||
|
||||
//! Get the filename of a loaded mesh, based on its index.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
\return String with name if mesh was found and has a name, else
|
||||
0. */
|
||||
virtual const c8* getMeshFilename(u32 index) const = 0;
|
||||
virtual const c16* getMeshFilename(u32 index) const = 0;
|
||||
|
||||
//! Get the filename of a loaded mesh, if there is any.
|
||||
/** \param mesh Pointer to mesh to query.
|
||||
\return String with name if mesh was found and has a name, else
|
||||
0. */
|
||||
virtual const c8* getMeshFilename(const IAnimatedMesh* const mesh) const = 0;
|
||||
virtual const c16* getMeshFilename(const IAnimatedMesh* const mesh) const = 0;
|
||||
|
||||
//! Get the filename of a loaded mesh, if there is any.
|
||||
/** \param mesh Pointer to mesh to query.
|
||||
\return String with name if mesh was found and has a name, else
|
||||
0. */
|
||||
virtual const c8* getMeshFilename(const IMesh* const mesh) const = 0;
|
||||
virtual const c16* getMeshFilename(const IMesh* const mesh) const = 0;
|
||||
|
||||
//! Renames a loaded mesh.
|
||||
/** Note that renaming meshes might change the ordering of the
|
||||
|
@ -120,7 +120,7 @@ namespace scene
|
|||
\param index The index of the mesh in the cache.
|
||||
\param filename New name for the mesh.
|
||||
\return True if mesh was renamed. */
|
||||
virtual bool setMeshFilename(u32 index, const c8* filename) = 0;
|
||||
virtual bool setMeshFilename(u32 index, const c16* filename) = 0;
|
||||
|
||||
//! Renames a loaded mesh.
|
||||
/** Note that renaming meshes might change the ordering of the
|
||||
|
@ -129,7 +129,7 @@ namespace scene
|
|||
\param mesh Mesh to be renamed.
|
||||
\param filename New name for the mesh.
|
||||
\return True if mesh was renamed. */
|
||||
virtual bool setMeshFilename(const IAnimatedMesh* const mesh, const c8* filename) = 0;
|
||||
virtual bool setMeshFilename(const IAnimatedMesh* const mesh, const c16* filename) = 0;
|
||||
|
||||
//! Renames a loaded mesh.
|
||||
/** Note that renaming meshes might change the ordering of the
|
||||
|
@ -138,12 +138,12 @@ namespace scene
|
|||
\param mesh Mesh to be renamed.
|
||||
\param filename New name for the mesh.
|
||||
\return True if mesh was renamed. */
|
||||
virtual bool setMeshFilename(const IMesh* const mesh, const c8* filename) = 0;
|
||||
virtual bool setMeshFilename(const IMesh* const mesh, const c16* filename) = 0;
|
||||
|
||||
//! Check if a mesh was already loaded.
|
||||
/** \param filename Name of the mesh.
|
||||
\return True if the mesh has been loaded, else false. */
|
||||
virtual bool isMeshLoaded(const c8* filename) = 0;
|
||||
virtual bool isMeshLoaded(const core::string<c16>& filename) = 0;
|
||||
|
||||
//! Clears the whole mesh cache, removing all meshes.
|
||||
/** All meshes will be reloaded completely when using ISceneManager::getMesh()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define __I_MESH_LOADER_H_INCLUDED__
|
||||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "irrString.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -34,7 +35,7 @@ public:
|
|||
only.
|
||||
\param fileName Name of the file to test.
|
||||
\return True if the file might be loaded by this class. */
|
||||
virtual bool isALoadableFileExtension(const c8* fileName) const = 0;
|
||||
virtual bool isALoadableFileExtension(const core::string<c16>& filename) const = 0;
|
||||
|
||||
//! Creates/loads an animated mesh from the file.
|
||||
/** \param file File handler to load the file from.
|
||||
|
|
|
@ -57,20 +57,6 @@ public:
|
|||
//! Gets whether or not the affector is currently enabled.
|
||||
virtual bool getEnabled() const { return Enabled; }
|
||||
|
||||
//! Writes attributes of the object.
|
||||
/** Implement this to expose the attributes of your scene node animator for
|
||||
scripting languages, editors, debuggers or xml serialization purposes. */
|
||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const {}
|
||||
|
||||
//! Reads attributes of the object.
|
||||
/** Implement this to set the attributes of your scene node animator for
|
||||
scripting languages, editors, debuggers or xml deserialization purposes.
|
||||
\param startIndex start index where to start reading attributes.
|
||||
\param in The attributes to work with.
|
||||
\param options Additional options.
|
||||
\return Last index of an attribute read by this affector */
|
||||
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { return 0; }
|
||||
|
||||
//! Get emitter type
|
||||
virtual E_PARTICLE_AFFECTOR_TYPE getType() const = 0;
|
||||
|
||||
|
|
|
@ -96,21 +96,6 @@ public:
|
|||
//! Get the minimum starting size for particles
|
||||
virtual const core::dimension2df& getMinStartSize() const = 0;
|
||||
|
||||
//! Writes attributes of the object.
|
||||
/** Implement this to expose the attributes of your scene node animator for
|
||||
scripting languages, editors, debuggers or xml serialization purposes. */
|
||||
virtual void serializeAttributes(io::IAttributes* out,
|
||||
io::SAttributeReadWriteOptions* options=0) const {}
|
||||
|
||||
//! Reads attributes of the object.
|
||||
/** Implement this to set the attributes of your scene node animator for
|
||||
scripting languages, editors, debuggers or xml deserialization purposes.
|
||||
\param startIndex start index where to start reading attributes.
|
||||
\param in The attributes to work with.
|
||||
\param options Additional options.
|
||||
\return Last index of an attribute read by this affector */
|
||||
virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in,
|
||||
io::SAttributeReadWriteOptions* options=0) { return 0; }
|
||||
|
||||
//! Get emitter type
|
||||
virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_POINT; }
|
||||
|
|
|
@ -20,19 +20,21 @@ namespace scene
|
|||
{
|
||||
public:
|
||||
|
||||
//! releases a Mesh from the Q3 Loader
|
||||
virtual void releaseMesh(s32 index) = 0;
|
||||
|
||||
//! loads the shader definition from file
|
||||
/** \param filename Name of the shaderfile, defaults to /scripts if fileNameIsValid is false.
|
||||
\param fileNameIsValid Specifies whether the filename is valid in the current situation. */
|
||||
virtual const quake3::SShader* getShader( const c8* filename, bool fileNameIsValid=true ) = 0;
|
||||
virtual const quake3::IShader* getShader( const c8* filename, bool fileNameIsValid=true ) = 0;
|
||||
|
||||
virtual const quake3::IShader* getShader( const core::string<c16>& filename,bool fileNameIsValid=true )
|
||||
{
|
||||
return getShader ( core::stringc ( filename ).c_str(), fileNameIsValid );
|
||||
}
|
||||
|
||||
//! returns a already loaded Shader
|
||||
virtual const quake3::SShader* getShader(u32 index) const = 0;
|
||||
virtual const quake3::IShader* getShader(u32 index) const = 0;
|
||||
|
||||
//! get's an interface to the entities
|
||||
virtual const quake3::tQ3EntityList& getEntityList() = 0;
|
||||
virtual quake3::tQ3EntityList& getEntityList( const c8 * filename = 0) = 0;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define __I_READ_FILE_H_INCLUDED__
|
||||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "coreutil.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -40,15 +41,15 @@ namespace io
|
|||
|
||||
//! Get name of file.
|
||||
/** \return File name as zero terminated character string. */
|
||||
virtual const c8* getFileName() const = 0;
|
||||
virtual const core::string<c16>& getFileName() const = 0;
|
||||
};
|
||||
|
||||
//! Internal function, please do not use.
|
||||
IReadFile* createReadFile(const c8* fileName);
|
||||
IReadFile* createReadFile(const core::string<c16>& fileName);
|
||||
//! Internal function, please do not use.
|
||||
IReadFile* createLimitReadFile(const c8* fileName, IReadFile* alreadyOpenedFile, long areaSize);
|
||||
IReadFile* createLimitReadFile(const core::string<c16>& fileName, IReadFile* alreadyOpenedFile, long pos, long areaSize);
|
||||
//! Internal function, please do not use.
|
||||
IReadFile* createMemoryReadFile(void* memory, long size, const c8* fileName, bool deleteMemoryWhenDropped);
|
||||
IReadFile* createMemoryReadFile(void* memory, long size, const core::string<c16>& fileName, bool deleteMemoryWhenDropped);
|
||||
|
||||
} // end namespace io
|
||||
} // end namespace irr
|
||||
|
|
|
@ -373,7 +373,7 @@ namespace scene
|
|||
\return The material at that index. */
|
||||
virtual video::SMaterial& getMaterial(u32 num)
|
||||
{
|
||||
return *((video::SMaterial*)0);
|
||||
return video::IdentityMaterial;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,6 +97,10 @@ namespace scene
|
|||
to this animator's gravity vector. */
|
||||
virtual void jump(f32 jumpSpeed) = 0;
|
||||
|
||||
//! Should the Target react on collision ( default = true )
|
||||
virtual void setAnimateTarget ( bool enable ) = 0;
|
||||
virtual bool getAnimateTarget () const = 0;
|
||||
|
||||
//! Set translation of the collision ellipsoid.
|
||||
/** By default, the ellipsoid for collision detection is
|
||||
created around the center of the scene node, which means that
|
||||
|
|
|
@ -62,6 +62,10 @@ enum E_TEXTURE_CREATION_FLAG
|
|||
//! Discard any alpha layer and use non-alpha color format.
|
||||
ETCF_NO_ALPHA_CHANNEL = 0x00000020,
|
||||
|
||||
//! Allow the Driver to use Non-Power-2-Textures
|
||||
//! BurningVideo can handle Non-Power-2 Textures in 2D (GUI), but not it 3D
|
||||
ETCF_ALLOW_NON_POWER_2 = 0x00000040,
|
||||
|
||||
//! This flag is never used, it only forces the compiler to
|
||||
//! compile these enumeration values to 32 bit.
|
||||
ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff
|
||||
|
@ -99,7 +103,7 @@ class ITexture : public virtual IReferenceCounted
|
|||
public:
|
||||
|
||||
//! constructor
|
||||
ITexture(const c8* name) : Name(name)
|
||||
ITexture(const core::string<c16>& name) : Name(name)
|
||||
{
|
||||
Name.make_lower();
|
||||
}
|
||||
|
@ -167,11 +171,11 @@ public:
|
|||
virtual bool isRenderTarget() const { return false; }
|
||||
|
||||
//! Returns name of texture (in most cases this is the filename)
|
||||
const core::stringc& getName() const { return Name; }
|
||||
const core::string<c16>& getName() const { return Name; }
|
||||
|
||||
protected:
|
||||
|
||||
core::stringc Name;
|
||||
core::string<c16> Name;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define __I_WRITE_FILE_H_INCLUDED__
|
||||
|
||||
#include "IReferenceCounted.h"
|
||||
#include "irrString.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -36,11 +37,11 @@ namespace io
|
|||
|
||||
//! Get name of file.
|
||||
/** \return File name as zero terminated character string. */
|
||||
virtual const c8* getFileName() const = 0;
|
||||
virtual const core::string<c16>& getFileName() const = 0;
|
||||
};
|
||||
|
||||
//! Internal function, please do not use.
|
||||
IWriteFile* createWriteFile(const c8* fileName, bool append);
|
||||
IWriteFile* createWriteFile(const core::string<c16>& fileName, bool append);
|
||||
|
||||
} // end namespace io
|
||||
} // end namespace irr
|
||||
|
|
|
@ -42,9 +42,12 @@
|
|||
|
||||
// XBox only suppots the native Window stuff
|
||||
#if defined(_XBOX)
|
||||
#define _IRR_XBOX_PLATFORM_
|
||||
#define _IRR_WINDOWS_API_
|
||||
#define _IRR_USE_WINDOWS_DEVICE_
|
||||
#undef _IRR_WINDOWS_
|
||||
#define _IRR_XBOX_PLATFORM_
|
||||
#define _IRR_WINDOWS_API_
|
||||
//#define _IRR_USE_WINDOWS_DEVICE_
|
||||
#undef _IRR_USE_WINDOWS_DEVICE_
|
||||
//#define _IRR_USE_SDL_DEVICE_
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(MACOSX)
|
||||
|
@ -85,7 +88,7 @@ to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK
|
|||
and this to the linker settings: -ld3dx9 -ld3dx8 **/
|
||||
#if defined(_IRR_WINDOWS_API_) && (!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK))
|
||||
|
||||
//#define _IRR_COMPILE_WITH_DIRECT3D_8_
|
||||
#define _IRR_COMPILE_WITH_DIRECT3D_8_
|
||||
#define _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
|
||||
#endif
|
||||
|
@ -129,6 +132,13 @@ define out. */
|
|||
you will not be able to use anything provided by the GUI Environment, including loading fonts. */
|
||||
#define _IRR_COMPILE_WITH_GUI_
|
||||
|
||||
|
||||
//! Define _IRR_WCHAR_FILESYSTEM to enable unicode filesystem support for the engine.
|
||||
/** This enables the engine to read/write from unicode filesystem. If you
|
||||
disable this feature, the engine behave as before ( ansi)
|
||||
ones. */
|
||||
//#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
|
||||
|
@ -201,7 +211,7 @@ tool <http://developer.nvidia.com/object/nvperfhud_home.html>. */
|
|||
#define BURNINGVIDEO_RENDERER_BEAUTIFUL
|
||||
//#define BURNINGVIDEO_RENDERER_FAST
|
||||
//#define BURNINGVIDEO_RENDERER_ULTRA_FAST
|
||||
|
||||
//#define BURNINGVIDEO_RENDERER_CE
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ if you want to use bone based
|
||||
/** animated meshes. If you compile without this, you will be unable to load
|
||||
|
@ -341,24 +351,64 @@ precision will be lower but speed higher. currently X86 only
|
|||
|
||||
// XBox does not have OpenGL or DirectX9
|
||||
#if defined(_IRR_XBOX_PLATFORM_)
|
||||
#undef _IRR_COMPILE_WITH_OPENGL_
|
||||
#undef _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
#undef _IRR_COMPILE_WITH_OPENGL_
|
||||
#undef _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
#endif
|
||||
|
||||
// WinCE does not have OpenGL or DirectX9
|
||||
//! WinCE does not have OpenGL or DirectX9. use minimal loaders
|
||||
#if defined(_WIN32_WCE)
|
||||
#undef _IRR_COMPILE_WITH_OPENGL_
|
||||
#undef _IRR_COMPILE_WITH_DIRECT3D_8_
|
||||
#undef _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
#undef _IRR_COMPILE_WITH_SOFTWARE_
|
||||
|
||||
#undef BURNINGVIDEO_RENDERER_BEAUTIFUL
|
||||
#undef BURNINGVIDEO_RENDERER_FAST
|
||||
#undef BURNINGVIDEO_RENDERER_ULTRA_FAST
|
||||
#define BURNINGVIDEO_RENDERER_CE
|
||||
|
||||
#undef _IRR_USE_WINDOWS_DEVICE_
|
||||
#define _IRR_USE_WINDOWS_CE_DEVICE_
|
||||
#define BURNINGVIDEO_RENDERER_CE
|
||||
//#define _IRR_WCHAR_FILESYSTEM
|
||||
|
||||
#undef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
|
||||
//#undef _IRR_COMPILE_WITH_MD2_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_MD3_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_3DS_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_COLLADA_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_CSM_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_BSP_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_DMF_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_LMTS_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_MY3D_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_OBJ_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_OCT_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_OGRE_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_LWO_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_STL_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_IRR_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_COLLADA_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_STL_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_OBJ_WRITER_
|
||||
//#undef _IRR_COMPILE_WITH_BMP_LOADER_
|
||||
//#undef _IRR_COMPILE_WITH_JPG_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_PCX_LOADER_
|
||||
//#undef _IRR_COMPILE_WITH_PNG_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_PPM_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_PSD_LOADER_
|
||||
//#undef _IRR_COMPILE_WITH_TGA_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_WAL_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_BMP_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_JPG_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_PCX_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_PNG_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_PPM_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_PSD_WRITER_
|
||||
#undef _IRR_COMPILE_WITH_TGA_WRITER_
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_SOLARIS_PLATFORM_)
|
||||
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
#endif
|
||||
|
||||
#endif // __IRR_COMPILE_CONFIG_H_INCLUDED__
|
||||
|
|
|
@ -217,6 +217,17 @@ namespace irr
|
|||
is defined, false if joysticks are not supported or support is compiled out.
|
||||
*/
|
||||
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) = 0;
|
||||
|
||||
//! Set the current Gamma Value for the Display
|
||||
/** Gamma in
|
||||
*/
|
||||
virtual bool setGammaRamp( f32 red, f32 green, f32 blue,
|
||||
f32 relativebrightness, f32 relativecontrast ) = 0;
|
||||
|
||||
//! Get the current Gamma Value for the Display
|
||||
virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue,
|
||||
f32 &brightness, f32 &contrast ) = 0;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace irr
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace irr
|
|||
EKA_STRAFE_LEFT,
|
||||
EKA_STRAFE_RIGHT,
|
||||
EKA_JUMP_UP,
|
||||
EKA_CROUCH,
|
||||
EKA_COUNT,
|
||||
|
||||
//! This value is not used. It only forces this enumeration to compile in 32 bit.
|
||||
|
|
|
@ -98,6 +98,18 @@ namespace video
|
|||
dstFact = E_BLEND_FACTOR ( ( state & 0x000000FF ) );
|
||||
}
|
||||
|
||||
//! These flags are used to specify the DebthBuffer Function for the Material
|
||||
/** Usally this is set to less equal
|
||||
*/
|
||||
//! DebthBuffer Function
|
||||
enum E_DEPTHBUFFER_FUNC
|
||||
{
|
||||
EMDF_DEPTH_OFF = 0,
|
||||
EMDF_DEPTH_LESS_EQUAL = 1,
|
||||
EMDF_DEPTH_EQUAL = 2,
|
||||
EMDF_DEPTH_GREATER_EQUAL = 3
|
||||
};
|
||||
|
||||
//! These flags are used to specify the anti-aliasing and smoothing modes
|
||||
/** Techniques supported are multisampling, geometry smoothing, and alpha
|
||||
to coverage.
|
||||
|
@ -518,6 +530,9 @@ namespace video
|
|||
}
|
||||
};
|
||||
|
||||
//! global const identity Material
|
||||
IRRLICHT_API extern SMaterial IdentityMaterial;
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -133,11 +133,12 @@ namespace scene
|
|||
}
|
||||
|
||||
//! set the hardware mapping hint, for driver
|
||||
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint )
|
||||
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX )
|
||||
{
|
||||
MappingHint=NewMappingHint;
|
||||
}
|
||||
|
||||
|
||||
//! flags the mesh as changed, reloads hardware buffers
|
||||
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,35 @@ namespace core
|
|||
|
||||
// ----------- some basic quite often used string functions -----------------
|
||||
|
||||
//! cut the filename extension from a string
|
||||
//! search if a filename has a proper extension
|
||||
inline s32 isFileExtension ( const core::string<c16>& filename,
|
||||
const core::string<c16>& ext0,
|
||||
const core::string<c16>& ext1,
|
||||
const core::string<c16>& ext2
|
||||
)
|
||||
{
|
||||
s32 extPos = filename.findLast ( '.' );
|
||||
if ( extPos < 0 )
|
||||
return 0;
|
||||
|
||||
extPos += 1;
|
||||
if ( filename.equals_substring_ignore_case ( ext0, extPos ) ) return 1;
|
||||
if ( filename.equals_substring_ignore_case ( ext1, extPos ) ) return 2;
|
||||
if ( filename.equals_substring_ignore_case ( ext2, extPos ) ) return 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! search if a filename has a proper extension
|
||||
inline bool hasFileExtension ( const core::string<c16>& filename,
|
||||
const core::string<c16>& ext0,
|
||||
const core::string<c16>& ext1 = "",
|
||||
const core::string<c16>& ext2 = ""
|
||||
)
|
||||
{
|
||||
return isFileExtension ( filename, ext0, ext1, ext2 ) > 0;
|
||||
}
|
||||
|
||||
//! cut the filename extension from a source string and stores in the dest string
|
||||
inline stringc& cutFilenameExtension ( stringc &dest, const stringc &source )
|
||||
{
|
||||
s32 endPos = source.findLast ( '.' );
|
||||
|
@ -26,6 +54,14 @@ inline stringc& cutFilenameExtension ( stringc &dest, const stringc &source )
|
|||
return dest;
|
||||
}
|
||||
|
||||
//! cut the filename extension from a source string and stores in the dest string
|
||||
inline stringw& cutFilenameExtension ( stringw &dest, const stringw &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 )
|
||||
{
|
||||
|
@ -37,6 +73,104 @@ inline stringc& getFileNameExtension ( stringc &dest, const stringc &source )
|
|||
return dest;
|
||||
}
|
||||
|
||||
//! delete path from filename
|
||||
inline core::stringw& deletePathFromFilename(core::stringw& filename)
|
||||
{
|
||||
// delete path from filename
|
||||
const wchar_t *s = filename.c_str();
|
||||
const wchar_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
|
||||
while ( *p != '/' && *p != '\\' && p != s )
|
||||
p--;
|
||||
|
||||
if ( p != s )
|
||||
{
|
||||
++p;
|
||||
filename = p;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
//! trim paths
|
||||
inline core::string<c16>& deletePathFromPath(core::string<c16>& filename, s32 pathCount)
|
||||
{
|
||||
// delete path from filename
|
||||
s32 i = filename.size();
|
||||
|
||||
// search for path separator or beginning
|
||||
while ( i )
|
||||
{
|
||||
if ( filename[i] == '/' || filename[i] == '\\' )
|
||||
{
|
||||
if ( --pathCount <= 0 )
|
||||
break;
|
||||
}
|
||||
i -= 1;
|
||||
}
|
||||
|
||||
if ( i )
|
||||
{
|
||||
filename [ i + 1 ] = 0;
|
||||
filename.verify();
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
//! gets the last char of a string or null
|
||||
inline c16 lastChar( const core::string<c16>& s)
|
||||
{
|
||||
return s.size() ? s [ s.size() - 1 ] : 0;
|
||||
}
|
||||
|
||||
//! looks if file is in the same directory of path. returns offset of directory.
|
||||
//! 0 means in same directory. 1 means file is direct child of path
|
||||
inline s32 isInSameDirectory ( const core::string<c16>& path, const core::string<c16>& file )
|
||||
{
|
||||
s32 subA = 0;
|
||||
s32 subB = 0;
|
||||
s32 pos;
|
||||
|
||||
if ( path.size() && !path.equalsn ( file, path.size() ) )
|
||||
return -1;
|
||||
|
||||
pos = 0;
|
||||
while ( (pos = path.findNext ( '/', pos )) >= 0 )
|
||||
{
|
||||
subA += 1;
|
||||
pos += 1;
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
while ( (pos = file.findNext ( '/', pos )) >= 0 )
|
||||
{
|
||||
subB += 1;
|
||||
pos += 1;
|
||||
}
|
||||
|
||||
return subB - subA;
|
||||
}
|
||||
|
||||
|
||||
//! some standard function ( to remove dependencies )
|
||||
#undef isdigit
|
||||
#undef isspace
|
||||
|
|
|
@ -33,6 +33,15 @@ namespace core
|
|||
explicit dimension2d(const dimension2d<U>& other) :
|
||||
Width((T)other.Width), Height((T)other.Height) { }
|
||||
|
||||
template <class U>
|
||||
dimension2d<T>& operator=(const dimension2d<U>& other)
|
||||
{
|
||||
Width = (T) other.Width;
|
||||
Height = (T) other.Height;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//! Equality operator
|
||||
bool operator==(const dimension2d<T>& other) const
|
||||
{
|
||||
|
@ -118,23 +127,26 @@ namespace core
|
|||
return Width*Height;
|
||||
}
|
||||
|
||||
//! Get the optimal size according to some properties
|
||||
/** This is a function often used for texture dimension
|
||||
calculations. The function returns the next larger or
|
||||
smaller dimension which is a power-of-two dimension
|
||||
(2^n,2^m) and/or square (Width=Height).
|
||||
\param requirePowerOfTwo Forces the result to use only
|
||||
powers of two as values.
|
||||
\param requireSquare Makes width==height in the result
|
||||
\param larger Choose whether the result is larger or
|
||||
smaller than the current dimension. If one dimension
|
||||
need not be changed it is kept with any value of larger.
|
||||
\return The optimal dimension under the given
|
||||
constraints. */
|
||||
//! Get the optimal size according to some properties
|
||||
/** This is a function often used for texture dimension
|
||||
calculations. The function returns the next larger or
|
||||
smaller dimension which is a power-of-two dimension
|
||||
(2^n,2^m) and/or square (Width=Height).
|
||||
\param requirePowerOfTwo Forces the result to use only
|
||||
powers of two as values.
|
||||
\param requireSquare Makes width==height in the result
|
||||
\param larger Choose whether the result is larger or
|
||||
smaller than the current dimension. If one dimension
|
||||
need not be changed it is kept with any value of larger.
|
||||
\param maxValue Maximum texturesize. if value > 0 size is
|
||||
clamped to maxValue
|
||||
\return The optimal dimension under the given
|
||||
constraints. */
|
||||
dimension2d<T> getOptimalSize(
|
||||
bool requirePowerOfTwo=true,
|
||||
bool requireSquare=false,
|
||||
bool larger=true) const
|
||||
bool larger=true,
|
||||
u32 maxValue = 0) const
|
||||
{
|
||||
u32 i=1;
|
||||
u32 j=1;
|
||||
|
@ -162,6 +174,13 @@ namespace core
|
|||
else
|
||||
i=j;
|
||||
}
|
||||
|
||||
if ( maxValue > 0 && i > maxValue)
|
||||
i = maxValue;
|
||||
|
||||
if ( maxValue > 0 && j > maxValue)
|
||||
j = maxValue;
|
||||
|
||||
return dimension2d<T>((T)i,(T)j);
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,14 @@ public:
|
|||
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
//! defines an allocation strategy
|
||||
enum eAllocStrategy
|
||||
{
|
||||
ALLOC_STRATEGY_SAFE = 0,
|
||||
ALLOC_STRATEGY_DOUBLE = 1,
|
||||
ALLOC_STRATEGY_SQRT = 2,
|
||||
};
|
||||
|
||||
|
||||
} // end namespace core
|
||||
} // end namespace irr
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
//! Default constructor for empty array.
|
||||
array()
|
||||
: data(0), allocated(0), used(0),
|
||||
free_when_destroyed(true), is_sorted(true)
|
||||
free_when_destroyed(true), is_sorted(true),strategy ( ALLOC_STRATEGY_DOUBLE )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
/** \param start_count Amount of elements to pre-allocate. */
|
||||
array(u32 start_count)
|
||||
: data(0), allocated(0), used(0),
|
||||
free_when_destroyed(true), is_sorted(true)
|
||||
free_when_destroyed(true), is_sorted(true),strategy ( ALLOC_STRATEGY_DOUBLE )
|
||||
{
|
||||
reallocate(start_count);
|
||||
}
|
||||
|
@ -93,6 +93,15 @@ public:
|
|||
}
|
||||
|
||||
|
||||
//! set a new allocation strategy
|
||||
/** if the maximum size of the array is unknown, you can define how big the
|
||||
allocation should happen.
|
||||
\param element: newStratgey to applay to this array. */
|
||||
void setAllocStrategy ( eAllocStrategy newStrategy = ALLOC_STRATEGY_DOUBLE )
|
||||
{
|
||||
strategy = newStrategy;
|
||||
}
|
||||
|
||||
//! Adds an element at back of array.
|
||||
/** If the array is too small to add this new element it is made bigger.
|
||||
\param element: Element to add at the back of the array. */
|
||||
|
@ -100,14 +109,31 @@ public:
|
|||
{
|
||||
if (used + 1 > allocated)
|
||||
{
|
||||
// reallocate(used * 2 +1);
|
||||
// this doesn't work if the element is in the same array. So
|
||||
// we'll copy the element first to be sure we'll get no data
|
||||
// corruption
|
||||
|
||||
T e(element);
|
||||
reallocate(used * 2 +1); // increase data block
|
||||
//reallocate(used * 2 +1); // increase data block
|
||||
// TA: okt, 2008. it's only allowed to alloc one element, if
|
||||
// default constructor has to be called
|
||||
|
||||
// increase data block
|
||||
u32 newAlloc;
|
||||
switch ( strategy )
|
||||
{
|
||||
case ALLOC_STRATEGY_DOUBLE:
|
||||
newAlloc = used + 1 + (allocated < 500 ?
|
||||
(allocated < 5 ? 5 : used) : used >> 2);
|
||||
break;
|
||||
default:
|
||||
case ALLOC_STRATEGY_SAFE:
|
||||
newAlloc = used + 1;
|
||||
break;
|
||||
}
|
||||
reallocate( newAlloc);
|
||||
// construct new element
|
||||
// Attention!. in missing default constructors for faster alloc methods
|
||||
allocator.construct(&data[used++], e); // data[used++] = e; // push_back
|
||||
}
|
||||
else
|
||||
|
@ -215,6 +241,8 @@ public:
|
|||
//! Assignment operator
|
||||
void operator=(const array<T>& other)
|
||||
{
|
||||
strategy = other.strategy;
|
||||
|
||||
if (data)
|
||||
{
|
||||
for (u32 i=0; i<used; ++i)
|
||||
|
@ -408,6 +436,38 @@ public:
|
|||
}
|
||||
|
||||
|
||||
//! Performs a binary search for an element, returns -1 if not found.
|
||||
//! it is used for searching a multiset
|
||||
/** The array will be sorted before the binary search if it is not
|
||||
already sorted.
|
||||
\param element Element to search for.
|
||||
\param &last return lastIndex of equal elements
|
||||
\return Position of the first searched element if it was found,
|
||||
otherwise -1 is returned. */
|
||||
s32 binary_search_multi(const T& element, s32 &last)
|
||||
{
|
||||
sort();
|
||||
s32 index = binary_search(element, 0, used-1);
|
||||
if ( index < 0 )
|
||||
return index;
|
||||
|
||||
// The search can be somewhere in the middle of the set
|
||||
// look linear previous and past the index
|
||||
last = index;
|
||||
|
||||
while ( index > 0 && !(element < data[index - 1]) && !(data[index - 1] < element) )
|
||||
{
|
||||
index -= 1;
|
||||
}
|
||||
// look linear up
|
||||
while ( last < (s32) used - 1 && !(element < data[last + 1]) && !(data[last + 1] < element) )
|
||||
{
|
||||
last += 1;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
//! Finds an element in linear time, which is very slow.
|
||||
/** Use binary_search for faster finding. Only works if ==operator is
|
||||
implemented.
|
||||
|
@ -501,6 +561,7 @@ public:
|
|||
u32 used;
|
||||
bool free_when_destroyed;
|
||||
bool is_sorted;
|
||||
eAllocStrategy strategy;
|
||||
TAlloc allocator;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define powf(X,Y) (f32)pow((f64)(X),(f64)(Y))
|
||||
#define fmodf(X,Y) (f32)fmod((f64)(X),(f64)(Y))
|
||||
#define fabsf(X) (f32)fabs((f64)(X))
|
||||
#define logf(X) (f32)log((f64)(X))
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
|
@ -31,20 +32,15 @@ namespace core
|
|||
|
||||
//! Rounding error constant often used when comparing f32 values.
|
||||
|
||||
#ifdef IRRLICHT_FAST_MATH
|
||||
const f32 ROUNDING_ERROR_32 = 0.00005f;
|
||||
const f64 ROUNDING_ERROR_64 = 0.000005;
|
||||
#else
|
||||
const f32 ROUNDING_ERROR_32 = 0.000001f;
|
||||
const f64 ROUNDING_ERROR_64 = 0.00000001;
|
||||
#endif
|
||||
|
||||
#ifdef PI // make sure we don't collide with a define
|
||||
#undef PI
|
||||
#endif
|
||||
//! Constant for PI.
|
||||
const f32 PI = 3.14159265359f;
|
||||
|
||||
|
||||
//! Constant for reciprocal of PI.
|
||||
const f32 RECIPROCAL_PI = 1.0f/PI;
|
||||
|
||||
|
@ -207,6 +203,12 @@ namespace core
|
|||
return fabsf(a) <= tolerance;
|
||||
}
|
||||
|
||||
//! returns if a equals not zero, taking rounding errors into account
|
||||
inline bool isnotzero(const f32 a, const f32 tolerance = ROUNDING_ERROR_32)
|
||||
{
|
||||
return fabsf(a) > tolerance;
|
||||
}
|
||||
|
||||
//! returns if a equals zero, taking rounding errors into account
|
||||
inline bool iszero(const s32 a, const s32 tolerance = 0)
|
||||
{
|
||||
|
@ -322,6 +324,12 @@ namespace core
|
|||
return ( ( -condition >> 31 ) & ( a ^ b ) ) ^ b;
|
||||
}
|
||||
|
||||
//! conditional set based on mask and arithmetic shift
|
||||
REALINLINE u16 if_c_a_else_b ( const s16 condition, const s16 a, const s16 b )
|
||||
{
|
||||
return ( ( -condition >> 15 ) & ( a ^ b ) ) ^ b;
|
||||
}
|
||||
|
||||
//! conditional set based on mask and arithmetic shift
|
||||
REALINLINE u32 if_c_a_else_0 ( const s32 condition, const u32 a )
|
||||
{
|
||||
|
@ -346,6 +354,7 @@ namespace core
|
|||
REALINLINE void clearFPUException ()
|
||||
{
|
||||
#ifdef IRRLICHT_FAST_MATH
|
||||
return;
|
||||
#ifdef feclearexcept
|
||||
feclearexcept(FE_ALL_EXCEPT);
|
||||
#elif defined(_MSC_VER)
|
||||
|
@ -358,55 +367,107 @@ namespace core
|
|||
#endif
|
||||
}
|
||||
|
||||
REALINLINE f32 reciprocal_squareroot(const f32 x)
|
||||
// calculate: 1 / sqrt ( x )
|
||||
REALINLINE f64 reciprocal_squareroot(const f64 x)
|
||||
{
|
||||
#ifdef IRRLICHT_FAST_MATH
|
||||
return 1.0 / sqrt ( x );
|
||||
}
|
||||
|
||||
// calculate: 1 / sqrt ( x )
|
||||
REALINLINE f32 reciprocal_squareroot(const f32 f)
|
||||
{
|
||||
#if defined ( IRRLICHT_FAST_MATH )
|
||||
#if defined(_MSC_VER)
|
||||
// SSE reciprocal square root estimate, accurate to 12 significant
|
||||
// bits of the mantissa
|
||||
f32 recsqrt;
|
||||
__asm rsqrtss xmm0, f // xmm0 = rsqrtss(f)
|
||||
__asm movss recsqrt, xmm0 // return xmm0
|
||||
return recsqrt;
|
||||
|
||||
/*
|
||||
// comes from Nvidia
|
||||
#if 1
|
||||
u32 tmp = (u32(IEEE_1_0 << 1) + IEEE_1_0 - *(u32*)&x) >> 1;
|
||||
f32 y = *(f32*)&tmp;
|
||||
return y * (1.47f - 0.47f * x * y * y);
|
||||
#elif defined(_MSC_VER)
|
||||
// an sse2 version
|
||||
__asm
|
||||
{
|
||||
movss xmm0, x
|
||||
rsqrtss xmm0, xmm0
|
||||
movss x, xmm0
|
||||
}
|
||||
return x;
|
||||
#endif
|
||||
*/
|
||||
#else
|
||||
return 1.f / sqrtf ( f );
|
||||
#endif
|
||||
#else // no fast math
|
||||
return 1.f / sqrtf ( x );
|
||||
return 1.f / sqrtf ( f );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
// calculate: 1 / x
|
||||
REALINLINE f32 reciprocal ( const f32 f )
|
||||
{
|
||||
#ifdef IRRLICHT_FAST_MATH
|
||||
#if defined (IRRLICHT_FAST_MATH)
|
||||
|
||||
// SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
|
||||
// bi ts of the mantissa
|
||||
// One Newtown-Raphson Iteration:
|
||||
// f(i+1) = 2 * rcpss(f) - f * rcpss(f) * rcpss(f)
|
||||
f32 rec;
|
||||
__asm rcpss xmm0, f // xmm0 = rcpss(f)
|
||||
__asm movss xmm1, f // xmm1 = f
|
||||
__asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f)
|
||||
__asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f)
|
||||
__asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f)
|
||||
__asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f)
|
||||
// - f * rcpss(f) * rcpss(f)
|
||||
__asm movss rec, xmm0 // return xmm0
|
||||
return rec;
|
||||
|
||||
|
||||
//! i do not divide through 0.. (fpu expection)
|
||||
// instead set f to a high value to get a return value near zero..
|
||||
// -1000000000000.f.. is use minus to stay negative..
|
||||
// must test's here (plane.normal dot anything ) checks on <= 0.f
|
||||
return 1.f / f;
|
||||
//u32 x = (-(AIR(f) != 0 ) >> 31 ) & ( IR(f) ^ 0xd368d4a5 ) ^ 0xd368d4a5;
|
||||
//return 1.f / FR ( x );
|
||||
|
||||
#else // no fast math
|
||||
return 1.f / f;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
REALINLINE f32 reciprocal_approxim ( const f32 p )
|
||||
// calculate: 1 / x, low precision allowed
|
||||
REALINLINE f32 reciprocal_approxim ( const f32 f )
|
||||
{
|
||||
#ifdef IRRLICHT_FAST_MATH
|
||||
#if defined( IRRLICHT_FAST_MATH)
|
||||
|
||||
// SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
|
||||
// bi ts of the mantissa
|
||||
// One Newtown-Raphson Iteration:
|
||||
// f(i+1) = 2 * rcpss(f) - f * rcpss(f) * rcpss(f)
|
||||
f32 rec;
|
||||
__asm rcpss xmm0, f // xmm0 = rcpss(f)
|
||||
__asm movss xmm1, f // xmm1 = f
|
||||
__asm mulss xmm1, xmm0 // xmm1 = f * rcpss(f)
|
||||
__asm mulss xmm1, xmm0 // xmm2 = f * rcpss(f) * rcpss(f)
|
||||
__asm addss xmm0, xmm0 // xmm0 = 2 * rcpss(f)
|
||||
__asm subss xmm0, xmm1 // xmm0 = 2 * rcpss(f)
|
||||
// - f * rcpss(f) * rcpss(f)
|
||||
__asm movss rec, xmm0 // return xmm0
|
||||
return rec;
|
||||
|
||||
|
||||
/*
|
||||
// SSE reciprocal estimate, accurate to 12 significant bits of
|
||||
f32 rec;
|
||||
__asm rcpss xmm0, f // xmm0 = rcpss(f)
|
||||
__asm movss rec , xmm0 // return xmm0
|
||||
return rec;
|
||||
*/
|
||||
/*
|
||||
register u32 x = 0x7F000000 - IR ( p );
|
||||
const f32 r = FR ( x );
|
||||
return r * (2.0f - p * r);
|
||||
*/
|
||||
#else // no fast math
|
||||
return 1.f / p;
|
||||
return 1.f / f;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,46 @@ This means that c8 strings are treated as ASCII/Latin-1, not UTF-8, and
|
|||
are simply expanded to the equivalent wchar_t, while Unicode/wchar_t
|
||||
characters are truncated to 8-bit ASCII/Latin-1 characters, discarding all
|
||||
other information in the wchar_t.
|
||||
|
||||
Known bugs:
|
||||
Special characters like umlauts are ignored in the
|
||||
methods make_upper, make_lower and equals_ignore_case.
|
||||
*/
|
||||
|
||||
enum eLocaleID
|
||||
{
|
||||
IRR_LOCALE_ANSI = 0,
|
||||
IRR_LOCALE_GERMAN = 1
|
||||
};
|
||||
|
||||
static eLocaleID locale_current = IRR_LOCALE_ANSI;
|
||||
static inline void locale_set ( eLocaleID id )
|
||||
{
|
||||
locale_current = id;
|
||||
}
|
||||
|
||||
//! Returns a character converted to lower case
|
||||
static inline u32 locale_lower ( u32 x )
|
||||
{
|
||||
switch ( locale_current )
|
||||
{
|
||||
case IRR_LOCALE_GERMAN:
|
||||
break;
|
||||
}
|
||||
// ansi
|
||||
return x >= 'A' && x <= 'Z' ? x + 0x20 : x;
|
||||
}
|
||||
|
||||
//! Returns a character converted to upper case
|
||||
static inline u32 locale_upper ( u32 x )
|
||||
{
|
||||
switch ( locale_current )
|
||||
{
|
||||
case IRR_LOCALE_GERMAN:
|
||||
break;
|
||||
}
|
||||
|
||||
// ansi
|
||||
return x >= 'a' && x <= 'z' ? x + ( 'A' - 'a' ) : x;
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename TAlloc = irrAllocator<T> >
|
||||
class string
|
||||
{
|
||||
|
@ -185,7 +220,7 @@ public:
|
|||
|
||||
|
||||
//! Destructor
|
||||
~string()
|
||||
virtual ~string()
|
||||
{
|
||||
allocator.deallocate(array); // delete [] array;
|
||||
}
|
||||
|
@ -375,22 +410,15 @@ public:
|
|||
void make_lower()
|
||||
{
|
||||
for (u32 i=0; i<used; ++i)
|
||||
array[i] = ansi_lower ( array[i] );
|
||||
array[i] = locale_lower ( array[i] );
|
||||
}
|
||||
|
||||
|
||||
//! Makes the string upper case.
|
||||
void make_upper()
|
||||
{
|
||||
const T a = (T)'a';
|
||||
const T z = (T)'z';
|
||||
const T diff = (T)'A' - a;
|
||||
|
||||
for (u32 i=0; i<used; ++i)
|
||||
{
|
||||
if (array[i]>=a && array[i]<=z)
|
||||
array[i] += diff;
|
||||
}
|
||||
array[i] = locale_upper ( array[i] );
|
||||
}
|
||||
|
||||
|
||||
|
@ -400,12 +428,29 @@ public:
|
|||
bool equals_ignore_case(const string<T>& other) const
|
||||
{
|
||||
for(u32 i=0; array[i] && other[i]; ++i)
|
||||
if (ansi_lower(array[i]) != ansi_lower(other[i]))
|
||||
if (locale_lower( array[i]) != locale_lower(other[i]))
|
||||
return false;
|
||||
|
||||
return used == other.used;
|
||||
}
|
||||
|
||||
//! Compares the strings ignoring case.
|
||||
/** \param other: Other string to compare.
|
||||
\param sourcePos: where to start to compare in the string
|
||||
\return True if the strings are equal ignoring case. */
|
||||
bool equals_substring_ignore_case(const string<T>&other, const s32 sourcePos = 0 ) const
|
||||
{
|
||||
if ( (u32) sourcePos > used )
|
||||
return false;
|
||||
|
||||
u32 i;
|
||||
for( i=0; array[sourcePos + i] && other[i]; ++i)
|
||||
if (locale_lower( array[sourcePos + i]) != locale_lower(other[i]))
|
||||
return false;
|
||||
|
||||
return array[sourcePos + i] == 0 && other[i] == 0;
|
||||
}
|
||||
|
||||
|
||||
//! Compares the strings ignoring case.
|
||||
/** \param other: Other string to compare.
|
||||
|
@ -414,7 +459,7 @@ public:
|
|||
{
|
||||
for(u32 i=0; array[i] && other.array[i]; ++i)
|
||||
{
|
||||
s32 diff = (s32) ansi_lower ( array[i] ) - (s32) ansi_lower ( other.array[i] );
|
||||
s32 diff = (s32) locale_lower ( array[i] ) - (s32) locale_lower ( other.array[i] );
|
||||
if ( diff )
|
||||
return diff < 0;
|
||||
}
|
||||
|
@ -869,22 +914,32 @@ public:
|
|||
--used;
|
||||
}
|
||||
|
||||
private:
|
||||
/*
|
||||
T toLower(const T& t) const
|
||||
//! verify the existing string.
|
||||
void verify()
|
||||
{
|
||||
if (t>=(T)'A' && t<=(T)'Z')
|
||||
return t + ((T)'a' - (T)'A');
|
||||
// terminate on existing null
|
||||
for (u32 i=0; i<allocated; ++i)
|
||||
{
|
||||
if (array[i] == 0)
|
||||
{
|
||||
used = i + 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// terminate
|
||||
if ( allocated > 0 )
|
||||
{
|
||||
used = allocated - 1;
|
||||
array[used] = 0;
|
||||
}
|
||||
else
|
||||
return t;
|
||||
}
|
||||
*/
|
||||
//! Returns a character converted to lower case
|
||||
inline T ansi_lower ( u32 x ) const
|
||||
{
|
||||
return x >= 'A' && x <= 'Z' ? (T) x + 0x20 : (T) x;
|
||||
{
|
||||
used = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Reallocate the array, make it bigger or smaller
|
||||
void reallocate(u32 new_size)
|
||||
|
@ -904,7 +959,6 @@ private:
|
|||
allocator.deallocate(old_array); // delete [] old_array;
|
||||
}
|
||||
|
||||
|
||||
//--- member variables
|
||||
|
||||
T* array;
|
||||
|
@ -920,6 +974,7 @@ typedef string<c8> stringc;
|
|||
//! Typedef for wide character strings
|
||||
typedef string<wchar_t> stringw;
|
||||
|
||||
|
||||
} // end namespace core
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -119,6 +119,15 @@ typedef unsigned short wchar_t;
|
|||
#endif // microsoft compiler
|
||||
#endif // _IRR_WINDOWS_API_
|
||||
|
||||
//! Should the wide character version of the FileSystem be used
|
||||
#if defined(_IRR_WCHAR_FILESYSTEM)
|
||||
//! 16 bit character variable. Used for unicode Filesystem and unicode strings
|
||||
typedef wchar_t c16;
|
||||
#else
|
||||
//! 8 bit character variable. Used for ansi Filesystem and non-unicode strings
|
||||
typedef char c16;
|
||||
#endif
|
||||
|
||||
//! define a break macro for debugging.
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
#include "IGUITable.h"
|
||||
#include "IGUIToolbar.h"
|
||||
#include "IGUIWindow.h"
|
||||
#include "IGUITreeView.h"
|
||||
#include "IImage.h"
|
||||
#include "IImageLoader.h"
|
||||
#include "IImageWriter.h"
|
||||
|
@ -315,7 +316,7 @@ namespace irr
|
|||
\return Returns pointer to the created IrrlichtDevice or null if the
|
||||
device could not be created.
|
||||
*/
|
||||
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDevice(
|
||||
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)),
|
||||
|
@ -325,6 +326,17 @@ namespace irr
|
|||
bool vsync = false,
|
||||
IEventReceiver* receiver = 0);
|
||||
|
||||
//! typedef for Function Pointer
|
||||
typedef IrrlichtDevice* (IRRCALLCONV *funcptr_createDevice )(
|
||||
video::E_DRIVER_TYPE deviceType,
|
||||
const core::dimension2d<s32>& windowSize,
|
||||
u32 bits,
|
||||
bool fullscreen,
|
||||
bool stencilbuffer,
|
||||
bool vsync,
|
||||
IEventReceiver* receiver);
|
||||
|
||||
|
||||
//! Creates an Irrlicht device with the option to specify advanced parameters.
|
||||
/** Usually you should used createDevice() for creating an Irrlicht Engine device.
|
||||
Use this function only if you wish to specify advanced parameters like a window
|
||||
|
@ -333,9 +345,12 @@ namespace irr
|
|||
See irr::SIrrlichtCreationParameters for details.
|
||||
\return Returns pointer to the created IrrlichtDevice or null if the
|
||||
device could not be created. */
|
||||
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
|
||||
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
|
||||
const SIrrlichtCreationParameters& parameters);
|
||||
|
||||
//! typedef for Function Pointer
|
||||
typedef IrrlichtDevice* (IRRCALLCONV *funcptr_createDeviceEx )( const SIrrlichtCreationParameters& parameters );
|
||||
|
||||
|
||||
// THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES
|
||||
// EXISTING ONLY FOR THE DOCUMENTATION SOFTWARE DOXYGEN.
|
||||
|
|
|
@ -13,6 +13,23 @@
|
|||
#include "rect.h"
|
||||
#include "irrString.h"
|
||||
|
||||
//#define USE_MATRIX_TEST
|
||||
//#define USE_MATRIX_TEST_DEBUG
|
||||
|
||||
#if defined( USE_MATRIX_TEST_DEBUG )
|
||||
#include <windows.h>
|
||||
|
||||
struct MatrixTest
|
||||
{
|
||||
MatrixTest () : ID(0), Calls(0) {}
|
||||
char buf[256];
|
||||
int Calls;
|
||||
int ID;
|
||||
};
|
||||
static MatrixTest MTest;
|
||||
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace core
|
||||
|
@ -45,13 +62,25 @@ namespace core
|
|||
CMatrix4( const CMatrix4<T>& other,eConstructor constructor = EM4CONST_COPY);
|
||||
|
||||
//! Simple operator for directly accessing every element of the matrix.
|
||||
T& operator()(const s32 row, const s32 col) { definitelyIdentityMatrix=false; return M[ row * 4 + col ]; }
|
||||
T& operator()(const s32 row, const s32 col)
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return M[ row * 4 + col ];
|
||||
}
|
||||
|
||||
//! Simple operator for directly accessing every element of the matrix.
|
||||
const T& operator()(const s32 row, const s32 col) const { return M[row * 4 + col]; }
|
||||
|
||||
//! Simple operator for linearly accessing every element of the matrix.
|
||||
T& operator[](u32 index) { definitelyIdentityMatrix=false; return M[index]; }
|
||||
T& operator[](u32 index)
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return M[index];
|
||||
}
|
||||
|
||||
//! Simple operator for linearly accessing every element of the matrix.
|
||||
const T& operator[](u32 index) const { return M[index]; }
|
||||
|
@ -64,7 +93,13 @@ namespace core
|
|||
|
||||
//! Returns pointer to internal array
|
||||
const T* pointer() const { return M; }
|
||||
T* pointer() { definitelyIdentityMatrix=false; return M; }
|
||||
T* pointer()
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return M;
|
||||
}
|
||||
|
||||
//! Returns true if other matrix is equal to this matrix.
|
||||
bool operator==(const CMatrix4<T> &other) const;
|
||||
|
@ -264,6 +299,32 @@ namespace core
|
|||
//! Gets transposed matrix
|
||||
inline void getTransposed( CMatrix4<T>& dest ) const;
|
||||
|
||||
//! Builds a matrix that rotates from one vector to another
|
||||
/** \param from: vector to rotate from
|
||||
\param to: vector to rotate to
|
||||
*/
|
||||
CMatrix4<T>& buildRotateFromTo(const core::vector3df& from, const core::vector3df& to);
|
||||
|
||||
//! Builds a combined matrix which translate to a center before rotation and translate afterwards
|
||||
/** \param from: vector to rotate from
|
||||
\param to: vector to rotate to
|
||||
*/
|
||||
void setRotationCenter(const core::vector3df& center, const core::vector3df& translate);
|
||||
|
||||
//! Builds a matrix which rotates a source vector to a look vector over an arbitrary axis
|
||||
/** \param camPos: viewer position in world coo
|
||||
\param center: object position in world-coo and rotation pivot
|
||||
\param translation: object final translation from center
|
||||
\param axis: axis to rotate about
|
||||
\param from: source vector to rotate from
|
||||
*/
|
||||
void buildAxisAlignedBillboard( const core::vector3df& camPos,
|
||||
const core::vector3df& center,
|
||||
const core::vector3df& translation,
|
||||
const core::vector3df& axis,
|
||||
const core::vector3df& from
|
||||
);
|
||||
|
||||
/*
|
||||
construct 2D Texture transformations
|
||||
rotate about center, scale, and transform.
|
||||
|
@ -321,13 +382,26 @@ namespace core
|
|||
private:
|
||||
//! Matrix data, stored in row-major order
|
||||
T M[16];
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
//! Flag is this matrix is identity matrix
|
||||
mutable bool definitelyIdentityMatrix;
|
||||
mutable u32 definitelyIdentityMatrix;
|
||||
#endif
|
||||
#if defined ( USE_MATRIX_TEST_DEBUG )
|
||||
u32 id;
|
||||
mutable u32 calls;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
// Default constructor
|
||||
template <class T>
|
||||
inline CMatrix4<T>::CMatrix4( eConstructor constructor ) : definitelyIdentityMatrix(false)
|
||||
inline CMatrix4<T>::CMatrix4( eConstructor constructor )
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
: definitelyIdentityMatrix(BIT_UNTESTED)
|
||||
#endif
|
||||
#if defined ( USE_MATRIX_TEST_DEBUG )
|
||||
,id ( MTest.ID++), calls ( 0 )
|
||||
#endif
|
||||
{
|
||||
switch ( constructor )
|
||||
{
|
||||
|
@ -344,7 +418,13 @@ namespace core
|
|||
|
||||
// Copy constructor
|
||||
template <class T>
|
||||
inline CMatrix4<T>::CMatrix4( const CMatrix4<T>& other, eConstructor constructor) : definitelyIdentityMatrix(false)
|
||||
inline CMatrix4<T>::CMatrix4( const CMatrix4<T>& other, eConstructor constructor)
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
: definitelyIdentityMatrix(BIT_UNTESTED)
|
||||
#endif
|
||||
#if defined ( USE_MATRIX_TEST_DEBUG )
|
||||
,id ( MTest.ID++), calls ( 0 )
|
||||
#endif
|
||||
{
|
||||
switch ( constructor )
|
||||
{
|
||||
|
@ -526,6 +606,7 @@ namespace core
|
|||
template <class T>
|
||||
inline CMatrix4<T>& CMatrix4<T>::operator*=(const CMatrix4<T>& other)
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
// do checks on your own in order to avoid copy creation
|
||||
if ( !other.isIdentity() )
|
||||
{
|
||||
|
@ -540,6 +621,10 @@ namespace core
|
|||
}
|
||||
}
|
||||
return *this;
|
||||
#else
|
||||
CMatrix4<T> temp ( *this );
|
||||
return setbyproduct_nocheck( temp, other );
|
||||
#endif
|
||||
}
|
||||
|
||||
//! multiply by another matrix
|
||||
|
@ -570,7 +655,9 @@ namespace core
|
|||
M[13] = m1[1]*m2[12] + m1[5]*m2[13] + m1[9]*m2[14] + m1[13]*m2[15];
|
||||
M[14] = m1[2]*m2[12] + m1[6]*m2[13] + m1[10]*m2[14] + m1[14]*m2[15];
|
||||
M[15] = m1[3]*m2[12] + m1[7]*m2[13] + m1[11]*m2[14] + m1[15]*m2[15];
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -581,6 +668,7 @@ namespace core
|
|||
template <class T>
|
||||
inline CMatrix4<T>& CMatrix4<T>::setbyproduct(const CMatrix4<T>& other_a, const CMatrix4<T>& other_b )
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
if ( other_a.isIdentity () )
|
||||
return (*this = other_b);
|
||||
else
|
||||
|
@ -588,17 +676,22 @@ namespace core
|
|||
return (*this = other_a);
|
||||
else
|
||||
return setbyproduct_nocheck(other_a,other_b);
|
||||
#else
|
||||
return setbyproduct_nocheck(other_a,other_b);
|
||||
#endif
|
||||
}
|
||||
|
||||
//! multiply by another matrix
|
||||
template <class T>
|
||||
inline CMatrix4<T> CMatrix4<T>::operator*(const CMatrix4<T>& m2) const
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
// Testing purpose..
|
||||
if ( this->isIdentity() )
|
||||
return m2;
|
||||
if ( m2.isIdentity() )
|
||||
return *this;
|
||||
#endif
|
||||
|
||||
CMatrix4<T> m3 ( EM4CONST_NOTHING );
|
||||
|
||||
|
@ -641,7 +734,9 @@ namespace core
|
|||
M[12] = translation.X;
|
||||
M[13] = translation.Y;
|
||||
M[14] = translation.Z;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -651,7 +746,9 @@ namespace core
|
|||
M[12] = -translation.X;
|
||||
M[13] = -translation.Y;
|
||||
M[14] = -translation.Z;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -661,7 +758,9 @@ namespace core
|
|||
M[0] = scale.X;
|
||||
M[5] = scale.Y;
|
||||
M[10] = scale.Z;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -727,7 +826,9 @@ namespace core
|
|||
M[8] = (T)( crsp*cy+sr*sy );
|
||||
M[9] = (T)( crsp*sy-sr*cy );
|
||||
M[10] = (T)( cr*cp );
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -800,7 +901,9 @@ namespace core
|
|||
M[2] = (T)( crsp*cy+sr*sy );
|
||||
M[6] = (T)( crsp*sy-sr*cy );
|
||||
M[10] = (T)( cr*cp );
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -812,7 +915,9 @@ namespace core
|
|||
{
|
||||
memset(M, 0, 16*sizeof(T));
|
||||
M[0] = M[5] = M[10] = M[15] = (T)1;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=true;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -824,8 +929,10 @@ namespace core
|
|||
template <class T>
|
||||
inline bool CMatrix4<T>::isIdentity() const
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
if (definitelyIdentityMatrix)
|
||||
return true;
|
||||
#endif
|
||||
if (!equals( M[ 0], (T)1 ) ||
|
||||
!equals( M[ 5], (T)1 ) ||
|
||||
!equals( M[10], (T)1 ) ||
|
||||
|
@ -837,7 +944,9 @@ namespace core
|
|||
if ((j != i) && (!iszero((*this)(i,j))))
|
||||
return false;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -875,8 +984,10 @@ namespace core
|
|||
template <class T>
|
||||
inline bool CMatrix4<T>::isIdentity_integer_base() const
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
if (definitelyIdentityMatrix)
|
||||
return true;
|
||||
#endif
|
||||
if(IR(M[0])!=F32_VALUE_1) return false;
|
||||
if(IR(M[1])!=0) return false;
|
||||
if(IR(M[2])!=0) return false;
|
||||
|
@ -896,7 +1007,10 @@ namespace core
|
|||
if(IR(M[13])!=0) return false;
|
||||
if(IR(M[13])!=0) return false;
|
||||
if(IR(M[15])!=F32_VALUE_1) return false;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -998,8 +1112,10 @@ namespace core
|
|||
template <class T>
|
||||
inline void CMatrix4<T>::transformBox(core::aabbox3d<f32>& box) const
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
if (isIdentity())
|
||||
return;
|
||||
#endif
|
||||
|
||||
transformVect(box.MinEdge);
|
||||
transformVect(box.MaxEdge);
|
||||
|
@ -1010,6 +1126,11 @@ namespace core
|
|||
template <class T>
|
||||
inline void CMatrix4<T>::transformBoxEx(core::aabbox3d<f32>& box) const
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
if (isIdentity())
|
||||
return;
|
||||
#endif
|
||||
|
||||
const f32 Amin[3] = {box.MinEdge.X, box.MinEdge.Y, box.MinEdge.Z};
|
||||
const f32 Amax[3] = {box.MaxEdge.X, box.MaxEdge.Y, box.MaxEdge.Z};
|
||||
|
||||
|
@ -1099,12 +1220,13 @@ namespace core
|
|||
/// The inverse is calculated using Cramers rule.
|
||||
/// If no inverse exists then 'false' is returned.
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
if ( this->isIdentity() )
|
||||
{
|
||||
out=*this;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
const CMatrix4<T> &m = *this;
|
||||
|
||||
f32 d = (m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0)) * (m(2, 2) * m(3, 3) - m(2, 3) * m(3, 2)) -
|
||||
|
@ -1167,7 +1289,10 @@ namespace core
|
|||
out(3, 3) = d * (m(0, 0) * (m(1, 1) * m(2, 2) - m(1, 2) * m(2, 1)) +
|
||||
m(0, 1) * (m(1, 2) * m(2, 0) - m(1, 0) * m(2, 2)) +
|
||||
m(0, 2) * (m(1, 0) * m(2, 1) - m(1, 1) * m(2, 0)));
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
out.definitelyIdentityMatrix = definitelyIdentityMatrix;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1196,7 +1321,10 @@ namespace core
|
|||
out.M[13] = (T)-(M[12]*M[4] + M[13]*M[5] + M[14]*M[6]);
|
||||
out.M[14] = (T)-(M[12]*M[8] + M[13]*M[9] + M[14]*M[10]);
|
||||
out.M[15] = 1;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
out.definitelyIdentityMatrix = definitelyIdentityMatrix;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1205,9 +1333,10 @@ namespace core
|
|||
template <class T>
|
||||
inline bool CMatrix4<T>::makeInverse()
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
if (definitelyIdentityMatrix)
|
||||
return true;
|
||||
|
||||
#endif
|
||||
CMatrix4<T> temp ( EM4CONST_NOTHING );
|
||||
|
||||
if (getInverse(temp))
|
||||
|
@ -1226,7 +1355,9 @@ namespace core
|
|||
if (this==&other)
|
||||
return *this;
|
||||
memcpy(M, other.M, 16*sizeof(T));
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=other.definitelyIdentityMatrix;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1236,7 +1367,10 @@ namespace core
|
|||
{
|
||||
for (s32 i = 0; i < 16; ++i)
|
||||
M[i]=scalar;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1244,8 +1378,10 @@ namespace core
|
|||
template <class T>
|
||||
inline bool CMatrix4<T>::operator==(const CMatrix4<T> &other) const
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
if (definitelyIdentityMatrix && other.definitelyIdentityMatrix)
|
||||
return true;
|
||||
#endif
|
||||
for (s32 i = 0; i < 16; ++i)
|
||||
if (M[i] != other.M[i])
|
||||
return false;
|
||||
|
@ -1290,7 +1426,10 @@ namespace core
|
|||
M[14] = (T)(zNear*zFar/(zNear-zFar)); // DirectX version
|
||||
// M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); // OpenGL version
|
||||
M[15] = 0;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1322,7 +1461,10 @@ namespace core
|
|||
M[13] = 0;
|
||||
M[14] = (T)(-zNear*zFar/(zFar-zNear));
|
||||
M[15] = 0;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1351,7 +1493,10 @@ namespace core
|
|||
M[13] = 0;
|
||||
M[14] = (T)(zNear/(zNear-zFar));
|
||||
M[15] = 1;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1380,7 +1525,10 @@ namespace core
|
|||
M[13] = 0;
|
||||
M[14] = (T)(zNear/(zNear-zFar));
|
||||
M[15] = -1;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1409,7 +1557,10 @@ namespace core
|
|||
M[13] = 0;
|
||||
M[14] = (T)(zNear*zFar/(zNear-zFar));
|
||||
M[15] = 0;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1438,7 +1589,9 @@ namespace core
|
|||
M[13] = 0;
|
||||
M[14] = (T)(zNear*zFar/(zNear-zFar));
|
||||
M[15] = 0;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1469,7 +1622,9 @@ namespace core
|
|||
M[13] = (T)(-plane.D * light.Y);
|
||||
M[14] = (T)(-plane.D * light.Z);
|
||||
M[15] = (T)(-plane.D * point + d);
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1507,7 +1662,9 @@ namespace core
|
|||
M[13] = (T)-yaxis.dotProduct(position);
|
||||
M[14] = (T)-zaxis.dotProduct(position);
|
||||
M[15] = 1;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1546,7 +1703,9 @@ namespace core
|
|||
M[13] = (T)-yaxis.dotProduct(position);
|
||||
M[14] = (T)-zaxis.dotProduct(position);
|
||||
M[15] = 1;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1601,7 +1760,9 @@ namespace core
|
|||
o[13] = M[ 7];
|
||||
o[14] = M[11];
|
||||
o[15] = M[15];
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
o.definitelyIdentityMatrix=definitelyIdentityMatrix;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1621,6 +1782,140 @@ namespace core
|
|||
return setScale(core::vector3d<T>((T)scaleX, (T)scaleY, (T)zScale));
|
||||
}
|
||||
|
||||
//! Builds a matrix that rotates from one vector to another
|
||||
/** \param from: vector to rotate from
|
||||
\param to: vector to rotate to
|
||||
|
||||
http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/index.htm
|
||||
*/
|
||||
template <class T>
|
||||
inline CMatrix4<T>& CMatrix4<T>::buildRotateFromTo(const core::vector3df& from, const core::vector3df& to)
|
||||
{
|
||||
// unit vectors
|
||||
core::vector3df f ( from );
|
||||
core::vector3df t ( to );
|
||||
f.normalize ();
|
||||
t.normalize ();
|
||||
|
||||
// axis multiplication by sin
|
||||
core::vector3df vs ( t.crossProduct ( f ) );
|
||||
|
||||
// axis of rotation
|
||||
core::vector3df v ( vs );
|
||||
v.normalize();
|
||||
|
||||
// cosinus angle
|
||||
T ca = f.dotProduct ( t );
|
||||
|
||||
core::vector3df vt ( v * ( (T) 1 - ca ) );
|
||||
|
||||
M[0] = vt.X * v.X + ca;
|
||||
M[5] = vt.Y * v.Y + ca;
|
||||
M[10] = vt.Z * v.Z + ca;
|
||||
|
||||
vt.X *= v.Y;
|
||||
vt.Z *= v.X;
|
||||
vt.Y *= v.Z;
|
||||
|
||||
M[1] = vt.X - vs.Z;
|
||||
M[2] = vt.Z + vs.Y;
|
||||
M[3] = (T) 0;
|
||||
|
||||
M[4] = vt.X + vs.Z;
|
||||
M[6] = vt.Y - vs.X;
|
||||
M[7] = (T) 0;
|
||||
|
||||
M[8] = vt.Z - vs.Y;
|
||||
M[9] = vt.Y + vs.X;
|
||||
M[11] = (T) 0;
|
||||
|
||||
M[12] = (T) 0;
|
||||
M[13] = (T) 0;
|
||||
M[14] = (T) 0;
|
||||
M[15] = (T) 1;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Builds a matrix which rotates a source vector to a look vector over an arbitrary axis
|
||||
/** \param camPos: viewer position in world coo
|
||||
\param center: object position in world-coo and rotation pivot
|
||||
\param translation: object final translation from center
|
||||
\param axis: axis to rotate about
|
||||
\param from: source vector to rotate from
|
||||
*/
|
||||
template <class T>
|
||||
inline void CMatrix4<T>::buildAxisAlignedBillboard( const core::vector3df& camPos,
|
||||
const core::vector3df& center,
|
||||
const core::vector3df& translation,
|
||||
const core::vector3df& axis,
|
||||
const core::vector3df& from
|
||||
)
|
||||
{
|
||||
// axis of rotation
|
||||
core::vector3df up = axis;
|
||||
up.normalize ();
|
||||
|
||||
core::vector3df forward = camPos - center;
|
||||
forward.normalize();
|
||||
|
||||
core::vector3df right = up.crossProduct ( forward );
|
||||
right.normalize ();
|
||||
|
||||
// correct look vector
|
||||
core::vector3df look = right.crossProduct ( up );
|
||||
|
||||
// rotate from to
|
||||
|
||||
// axis multiplication by sin
|
||||
core::vector3df vs = look.crossProduct ( from );
|
||||
|
||||
// cosinus angle
|
||||
f32 ca = from.dotProduct ( look );
|
||||
|
||||
core::vector3df vt ( up * ( 1.f - ca ) );
|
||||
|
||||
M[0] = vt.X * up.X + ca;
|
||||
M[5] = vt.Y * up.Y + ca;
|
||||
M[10] = vt.Z * up.Z + ca;
|
||||
|
||||
vt.X *= up.Y;
|
||||
vt.Z *= up.X;
|
||||
vt.Y *= up.Z;
|
||||
|
||||
M[1] = vt.X - vs.Z;
|
||||
M[2] = vt.Z + vs.Y;
|
||||
M[3] = (T) 0;
|
||||
|
||||
M[4] = vt.X + vs.Z;
|
||||
M[6] = vt.Y - vs.X;
|
||||
M[7] = (T) 0;
|
||||
|
||||
M[8] = vt.Z - vs.Y;
|
||||
M[9] = vt.Y + vs.X;
|
||||
M[11] = (T) 0;
|
||||
|
||||
setRotationCenter ( center, translation );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//! Builds a combined matrix which translate to a center before rotation and translate afterwards
|
||||
/** \param from: vector to rotate from
|
||||
\param to: vector to rotate to
|
||||
*/
|
||||
template <class T>
|
||||
inline void CMatrix4<T>::setRotationCenter(const core::vector3df& center, const core::vector3df& translation)
|
||||
{
|
||||
M[12] = -M[0]*center.X - M[4]*center.Y - M[8]*center.Z + (center.X - translation.X );
|
||||
M[13] = -M[1]*center.X - M[5]*center.Y - M[9]*center.Z + (center.Y - translation.Y );
|
||||
M[14] = -M[2]*center.X - M[6]*center.Y - M[10]*center.Z + (center.Z - translation.Z );
|
||||
M[15] = (T) 1.0;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
Generate texture coordinates as linear functions so that:
|
||||
u = Ux*x + Uy*y + Uz*z + Uw
|
||||
|
@ -1661,7 +1956,9 @@ namespace core
|
|||
M[13] = 0;
|
||||
M[14] = 0;
|
||||
M[15] = 1;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1680,7 +1977,10 @@ namespace core
|
|||
|
||||
M[8] = (T)(0.5f * ( s - c) + 0.5f);
|
||||
M[9] = (T)(-0.5f * ( s + c) + 0.5f);
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix = definitelyIdentityMatrix && (rotateRad==0.0f);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1690,7 +1990,10 @@ namespace core
|
|||
{
|
||||
M[8] = (T)x;
|
||||
M[9] = (T)y;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix = definitelyIdentityMatrix && (x==0.0f) && (y==0.0f);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1700,7 +2003,10 @@ namespace core
|
|||
{
|
||||
M[2] = (T)x;
|
||||
M[6] = (T)y;
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix = definitelyIdentityMatrix && (x==0.0f) && (y==0.0f) ;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1709,7 +2015,9 @@ namespace core
|
|||
{
|
||||
M[0] = (T)sx;
|
||||
M[5] = (T)sy;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix = definitelyIdentityMatrix && (sx==1.0f) && (sy==1.0f);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1721,7 +2029,10 @@ namespace core
|
|||
M[5] = (T)sy;
|
||||
M[8] = (T)(0.5f - 0.5f * sx);
|
||||
M[9] = (T)(0.5f - 0.5f * sy);
|
||||
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix = definitelyIdentityMatrix && (sx==1.0f) && (sy==1.0f);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1732,7 +2043,9 @@ namespace core
|
|||
{
|
||||
memcpy(M,data, 16*sizeof(T));
|
||||
|
||||
definitelyIdentityMatrix = false;
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix=false;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1741,7 +2054,9 @@ namespace core
|
|||
template <class T>
|
||||
inline void CMatrix4<T>::setDefinitelyIdentityMatrix( bool isDefinitelyIdentityMatrix)
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
definitelyIdentityMatrix = isDefinitelyIdentityMatrix;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1749,7 +2064,11 @@ namespace core
|
|||
template <class T>
|
||||
inline bool CMatrix4<T>::getDefinitelyIdentityMatrix() const
|
||||
{
|
||||
#if defined ( USE_MATRIX_TEST )
|
||||
return definitelyIdentityMatrix;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -83,7 +83,26 @@ class quaternion
|
|||
matrix4 getMatrix() const;
|
||||
|
||||
//! Creates a matrix from this quaternion
|
||||
void getMatrix( matrix4 &dest ) const;
|
||||
void getMatrix( matrix4 &dest, const vector3df &translation ) const;
|
||||
|
||||
/*!
|
||||
Creates a matrix from this quaternion
|
||||
Rotate about a center point
|
||||
shortcut for
|
||||
core::quaternion q;
|
||||
q.rotationFromTo ( vin[i].Normal, forward );
|
||||
q.getMatrixCenter ( lookat, center, newPos );
|
||||
|
||||
core::matrix4 m2;
|
||||
m2.setInverseTranslation ( center );
|
||||
lookat *= m2;
|
||||
|
||||
core::matrix4 m3;
|
||||
m2.setTranslation ( newPos );
|
||||
lookat *= m3;
|
||||
|
||||
*/
|
||||
void getMatrixCenter( matrix4 &dest, const vector3df ¢er, const vector3df &translation ) const;
|
||||
|
||||
//! Creates a matrix from this quaternion
|
||||
inline void getMatrix_transposed( matrix4 &dest ) const;
|
||||
|
@ -275,28 +294,74 @@ inline matrix4 quaternion::getMatrix() const
|
|||
}
|
||||
|
||||
|
||||
// Creates a matrix from this quaternion
|
||||
inline void quaternion::getMatrix( matrix4 &dest ) const
|
||||
/*!
|
||||
Creates a matrix from this quaternion
|
||||
*/
|
||||
inline void quaternion::getMatrix( matrix4 &dest, const core::vector3df ¢er ) const
|
||||
{
|
||||
dest[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
|
||||
dest[1] = 2.0f*X*Y + 2.0f*Z*W;
|
||||
dest[2] = 2.0f*X*Z - 2.0f*Y*W;
|
||||
dest[3] = 0.0f;
|
||||
f32 * m = dest.pointer();
|
||||
|
||||
dest[4] = 2.0f*X*Y - 2.0f*Z*W;
|
||||
dest[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
|
||||
dest[6] = 2.0f*Z*Y + 2.0f*X*W;
|
||||
dest[7] = 0.0f;
|
||||
m[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
|
||||
m[1] = 2.0f*X*Y + 2.0f*Z*W;
|
||||
m[2] = 2.0f*X*Z - 2.0f*Y*W;
|
||||
m[3] = 0.0f;
|
||||
|
||||
dest[8] = 2.0f*X*Z + 2.0f*Y*W;
|
||||
dest[9] = 2.0f*Z*Y - 2.0f*X*W;
|
||||
dest[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
|
||||
dest[11] = 0.0f;
|
||||
m[4] = 2.0f*X*Y - 2.0f*Z*W;
|
||||
m[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
|
||||
m[6] = 2.0f*Z*Y + 2.0f*X*W;
|
||||
m[7] = 0.0f;
|
||||
|
||||
dest[12] = 0.f;
|
||||
dest[13] = 0.f;
|
||||
dest[14] = 0.f;
|
||||
dest[15] = 1.f;
|
||||
m[8] = 2.0f*X*Z + 2.0f*Y*W;
|
||||
m[9] = 2.0f*Z*Y - 2.0f*X*W;
|
||||
m[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
|
||||
m[11] = 0.0f;
|
||||
|
||||
m[12] = center.X;
|
||||
m[13] = center.Y;
|
||||
m[14] = center.Z;
|
||||
m[15] = 1.f;
|
||||
|
||||
//dest.setDefinitelyIdentityMatrix ( matrix4::BIT_IS_NOT_IDENTITY );
|
||||
dest.setDefinitelyIdentityMatrix ( false );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
Creates a matrix from this quaternion
|
||||
Rotate about a center point
|
||||
shortcut for
|
||||
core::quaternion q;
|
||||
q.rotationFromTo ( vin[i].Normal, forward );
|
||||
q.getMatrix ( lookat, center );
|
||||
|
||||
core::matrix4 m2;
|
||||
m2.setInverseTranslation ( center );
|
||||
lookat *= m2;
|
||||
*/
|
||||
inline void quaternion::getMatrixCenter( matrix4 &dest,
|
||||
const core::vector3df ¢er,
|
||||
const core::vector3df &translation
|
||||
) const
|
||||
{
|
||||
f32 * m = dest.pointer();
|
||||
|
||||
m[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;
|
||||
m[1] = 2.0f*X*Y + 2.0f*Z*W;
|
||||
m[2] = 2.0f*X*Z - 2.0f*Y*W;
|
||||
m[3] = 0.0f;
|
||||
|
||||
m[4] = 2.0f*X*Y - 2.0f*Z*W;
|
||||
m[5] = 1.0f - 2.0f*X*X - 2.0f*Z*Z;
|
||||
m[6] = 2.0f*Z*Y + 2.0f*X*W;
|
||||
m[7] = 0.0f;
|
||||
|
||||
m[8] = 2.0f*X*Z + 2.0f*Y*W;
|
||||
m[9] = 2.0f*Z*Y - 2.0f*X*W;
|
||||
m[10] = 1.0f - 2.0f*X*X - 2.0f*Y*Y;
|
||||
m[11] = 0.0f;
|
||||
|
||||
dest.setRotationCenter ( center, translation );
|
||||
}
|
||||
|
||||
// Creates a matrix from this quaternion
|
||||
|
@ -321,6 +386,8 @@ inline void quaternion::getMatrix_transposed( matrix4 &dest ) const
|
|||
dest[7] = 0.f;
|
||||
dest[11] = 0.f;
|
||||
dest[15] = 1.f;
|
||||
//dest.setDefinitelyIdentityMatrix ( matrix4::BIT_IS_NOT_IDENTITY );
|
||||
dest.setDefinitelyIdentityMatrix ( false );
|
||||
}
|
||||
|
||||
|
||||
|
@ -534,7 +601,6 @@ inline core::quaternion& quaternion::rotationFromTo(const vector3df& from, const
|
|||
const f32 s = sqrtf( (1+d)*2 ); // optimize inv_sqrt
|
||||
const f32 invs = 1.f / s;
|
||||
const vector3df c = v0.crossProduct(v1)*invs;
|
||||
|
||||
X = c.X;
|
||||
Y = c.Y;
|
||||
Z = c.Z;
|
||||
|
|
|
@ -35,7 +35,8 @@ namespace core
|
|||
rect(const position2d<T>& upperLeft, const position2d<T>& lowerRight)
|
||||
: UpperLeftCorner(upperLeft), LowerRightCorner(lowerRight) {}
|
||||
|
||||
rect(const position2d<T>& pos, const dimension2d<T>& size)
|
||||
template <class U>
|
||||
rect(const position2d<T>& pos, const dimension2d<U>& size)
|
||||
: UpperLeftCorner(pos), LowerRightCorner(pos.X + size.Width, pos.Y + size.Height) {}
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ public:
|
|||
vector2d<T> operator-() const { return vector2d<T>(-X, -Y); }
|
||||
|
||||
vector2d<T>& operator=(const vector2d<T>& other) { X = other.X; Y = other.Y; return *this; }
|
||||
vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Width; return *this; }
|
||||
|
||||
vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; }
|
||||
|
||||
vector2d<T> operator+(const vector2d<T>& other) const { return vector2d<T>(X + other.X, Y + other.Y); }
|
||||
vector2d<T> operator+(const dimension2d<T>& other) const { return vector2d<T>(X + other.Width, Y + other.Height); }
|
||||
|
|
|
@ -140,10 +140,15 @@ namespace core
|
|||
\return Reference to this vector after normalization. */
|
||||
vector3d<T>& normalize()
|
||||
{
|
||||
#if 0
|
||||
f32 length = (f32)(X*X + Y*Y + Z*Z);
|
||||
if (core::equals(length, 0.f))
|
||||
return *this;
|
||||
length = core::reciprocal_squareroot ( (f32)length );
|
||||
#else
|
||||
const T length = core::reciprocal_squareroot ( (X*X + Y*Y + Z*Z) );
|
||||
#endif
|
||||
|
||||
X = (T)(X * length);
|
||||
Y = (T)(Y * length);
|
||||
Z = (T)(Z * length);
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
@ -23,97 +23,103 @@ namespace scene
|
|||
{
|
||||
|
||||
|
||||
// Primary chunk
|
||||
const u16 C3DS_MAIN3DS = 0x4D4D;
|
||||
enum e3DSChunk
|
||||
{
|
||||
|
||||
// Main Chunks
|
||||
const u16 C3DS_EDIT3DS = 0x3D3D;
|
||||
const u16 C3DS_KEYF3DS = 0xB000;
|
||||
const u16 C3DS_VERSION = 0x0002;
|
||||
const u16 C3DS_MESHVERSION = 0x3D3E;
|
||||
// Primary chunk
|
||||
C3DS_MAIN3DS = 0x4D4D,
|
||||
|
||||
// sub chunks of C3DS_EDIT3DS
|
||||
const u16 C3DS_EDIT_MATERIAL = 0xAFFF;
|
||||
const u16 C3DS_EDIT_OBJECT = 0x4000;
|
||||
// Main Chunks
|
||||
C3DS_EDIT3DS = 0x3D3D,
|
||||
C3DS_KEYF3DS = 0xB000,
|
||||
C3DS_VERSION = 0x0002,
|
||||
C3DS_MESHVERSION = 0x3D3E,
|
||||
|
||||
// sub chunks of C3DS_EDIT_MATERIAL
|
||||
const u16 C3DS_MATNAME = 0xA000;
|
||||
const u16 C3DS_MATAMBIENT = 0xA010;
|
||||
const u16 C3DS_MATDIFFUSE = 0xA020;
|
||||
const u16 C3DS_MATSPECULAR = 0xA030;
|
||||
const u16 C3DS_MATSHININESS = 0xA040;
|
||||
const u16 C3DS_MATSHIN2PCT = 0xA041;
|
||||
const u16 C3DS_TRANSPARENCY = 0xA050;
|
||||
const u16 C3DS_TRANSPARENCY_FALLOFF = 0xA052;
|
||||
const u16 C3DS_REFL_BLUR = 0xA053;
|
||||
const u16 C3DS_TWO_SIDE = 0xA081;
|
||||
const u16 C3DS_WIRE = 0xA085;
|
||||
const u16 C3DS_SHADING = 0xA100;
|
||||
const u16 C3DS_MATTEXMAP = 0xA200;
|
||||
const u16 C3DS_MATSPECMAP = 0xA204;
|
||||
const u16 C3DS_MATOPACMAP = 0xA210;
|
||||
const u16 C3DS_MATREFLMAP = 0xA220;
|
||||
const u16 C3DS_MATBUMPMAP = 0xA230;
|
||||
const u16 C3DS_MATMAPFILE = 0xA300;
|
||||
const u16 C3DS_MAT_TEXTILING = 0xA351;
|
||||
const u16 C3DS_MAT_USCALE = 0xA354;
|
||||
const u16 C3DS_MAT_VSCALE = 0xA356;
|
||||
const u16 C3DS_MAT_UOFFSET = 0xA358;
|
||||
const u16 C3DS_MAT_VOFFSET = 0xA35A;
|
||||
// sub chunks of C3DS_EDIT3DS
|
||||
C3DS_EDIT_MATERIAL = 0xAFFF,
|
||||
C3DS_EDIT_OBJECT = 0x4000,
|
||||
|
||||
// subs of C3DS_EDIT_OBJECT
|
||||
const u16 C3DS_OBJTRIMESH = 0x4100;
|
||||
// sub chunks of C3DS_EDIT_MATERIAL
|
||||
C3DS_MATNAME = 0xA000,
|
||||
C3DS_MATAMBIENT = 0xA010,
|
||||
C3DS_MATDIFFUSE = 0xA020,
|
||||
C3DS_MATSPECULAR = 0xA030,
|
||||
C3DS_MATSHININESS = 0xA040,
|
||||
C3DS_MATSHIN2PCT = 0xA041,
|
||||
C3DS_TRANSPARENCY = 0xA050,
|
||||
C3DS_TRANSPARENCY_FALLOFF = 0xA052,
|
||||
C3DS_REFL_BLUR = 0xA053,
|
||||
C3DS_TWO_SIDE = 0xA081,
|
||||
C3DS_WIRE = 0xA085,
|
||||
C3DS_SHADING = 0xA100,
|
||||
C3DS_MATTEXMAP = 0xA200,
|
||||
C3DS_MATSPECMAP = 0xA204,
|
||||
C3DS_MATOPACMAP = 0xA210,
|
||||
C3DS_MATREFLMAP = 0xA220,
|
||||
C3DS_MATBUMPMAP = 0xA230,
|
||||
C3DS_MATMAPFILE = 0xA300,
|
||||
C3DS_MAT_TEXTILING = 0xA351,
|
||||
C3DS_MAT_USCALE = 0xA354,
|
||||
C3DS_MAT_VSCALE = 0xA356,
|
||||
C3DS_MAT_UOFFSET = 0xA358,
|
||||
C3DS_MAT_VOFFSET = 0xA35A,
|
||||
|
||||
// subs of C3DS_OBJTRIMESH
|
||||
const u16 C3DS_TRIVERT = 0x4110;
|
||||
const u16 C3DS_POINTFLAGARRAY= 0x4111;
|
||||
const u16 C3DS_TRIFACE = 0x4120;
|
||||
const u16 C3DS_TRIFACEMAT = 0x4130;
|
||||
const u16 C3DS_TRIUV = 0x4140;
|
||||
const u16 C3DS_TRISMOOTH = 0x4150;
|
||||
const u16 C3DS_TRIMATRIX = 0x4160;
|
||||
const u16 C3DS_MESHCOLOR = 0x4165;
|
||||
const u16 C3DS_DIRECT_LIGHT = 0x4600;
|
||||
const u16 C3DS_DL_INNER_RANGE= 0x4659;
|
||||
const u16 C3DS_DL_OUTER_RANGE= 0x465A;
|
||||
const u16 C3DS_DL_MULTIPLIER = 0x465B;
|
||||
const u16 C3DS_CAMERA = 0x4700;
|
||||
const u16 C3DS_CAM_SEE_CONE = 0x4710;
|
||||
const u16 C3DS_CAM_RANGES = 0x4720;
|
||||
// subs of C3DS_EDIT_OBJECT
|
||||
C3DS_OBJTRIMESH = 0x4100,
|
||||
|
||||
// subs of C3DS_KEYF3DS
|
||||
const u16 C3DS_KF_HDR = 0xB00A;
|
||||
const u16 C3DS_AMBIENT_TAG = 0xB001;
|
||||
const u16 C3DS_OBJECT_TAG = 0xB002;
|
||||
const u16 C3DS_CAMERA_TAG = 0xB003;
|
||||
const u16 C3DS_TARGET_TAG = 0xB004;
|
||||
const u16 C3DS_LIGHTNODE_TAG = 0xB005;
|
||||
const u16 C3DS_KF_SEG = 0xB008;
|
||||
const u16 C3DS_KF_CURTIME = 0xB009;
|
||||
const u16 C3DS_KF_NODE_HDR = 0xB010;
|
||||
const u16 C3DS_PIVOTPOINT = 0xB013;
|
||||
const u16 C3DS_BOUNDBOX = 0xB014;
|
||||
const u16 C3DS_MORPH_SMOOTH = 0xB015;
|
||||
const u16 C3DS_POS_TRACK_TAG = 0xB020;
|
||||
const u16 C3DS_ROT_TRACK_TAG = 0xB021;
|
||||
const u16 C3DS_SCL_TRACK_TAG = 0xB022;
|
||||
const u16 C3DS_NODE_ID = 0xB030;
|
||||
// subs of C3DS_OBJTRIMESH
|
||||
C3DS_TRIVERT = 0x4110,
|
||||
C3DS_POINTFLAGARRAY= 0x4111,
|
||||
C3DS_TRIFACE = 0x4120,
|
||||
C3DS_TRIFACEMAT = 0x4130,
|
||||
C3DS_TRIUV = 0x4140,
|
||||
C3DS_TRISMOOTH = 0x4150,
|
||||
C3DS_TRIMATRIX = 0x4160,
|
||||
C3DS_MESHCOLOR = 0x4165,
|
||||
C3DS_DIRECT_LIGHT = 0x4600,
|
||||
C3DS_DL_INNER_RANGE= 0x4659,
|
||||
C3DS_DL_OUTER_RANGE= 0x465A,
|
||||
C3DS_DL_MULTIPLIER = 0x465B,
|
||||
C3DS_CAMERA = 0x4700,
|
||||
C3DS_CAM_SEE_CONE = 0x4710,
|
||||
C3DS_CAM_RANGES = 0x4720,
|
||||
|
||||
// Viewport definitions
|
||||
const u16 C3DS_VIEWPORT_LAYOUT = 0x7001;
|
||||
const u16 C3DS_VIEWPORT_DATA = 0x7011;
|
||||
const u16 C3DS_VIEWPORT_DATA_3 = 0x7012;
|
||||
const u16 C3DS_VIEWPORT_SIZE = 0x7020;
|
||||
// subs of C3DS_KEYF3DS
|
||||
C3DS_KF_HDR = 0xB00A,
|
||||
C3DS_AMBIENT_TAG = 0xB001,
|
||||
C3DS_OBJECT_TAG = 0xB002,
|
||||
C3DS_CAMERA_TAG = 0xB003,
|
||||
C3DS_TARGET_TAG = 0xB004,
|
||||
C3DS_LIGHTNODE_TAG = 0xB005,
|
||||
C3DS_KF_SEG = 0xB008,
|
||||
C3DS_KF_CURTIME = 0xB009,
|
||||
C3DS_KF_NODE_HDR = 0xB010,
|
||||
C3DS_PIVOTPOINT = 0xB013,
|
||||
C3DS_BOUNDBOX = 0xB014,
|
||||
C3DS_MORPH_SMOOTH = 0xB015,
|
||||
C3DS_POS_TRACK_TAG = 0xB020,
|
||||
C3DS_ROT_TRACK_TAG = 0xB021,
|
||||
C3DS_SCL_TRACK_TAG = 0xB022,
|
||||
C3DS_NODE_ID = 0xB030,
|
||||
|
||||
// different color chunk types
|
||||
const u16 C3DS_COL_RGB = 0x0010;
|
||||
const u16 C3DS_COL_TRU = 0x0011;
|
||||
const u16 C3DS_COL_LIN_24 = 0x0012;
|
||||
const u16 C3DS_COL_LIN_F = 0x0013;
|
||||
// Viewport definitions
|
||||
C3DS_VIEWPORT_LAYOUT = 0x7001,
|
||||
C3DS_VIEWPORT_DATA = 0x7011,
|
||||
C3DS_VIEWPORT_DATA_3 = 0x7012,
|
||||
C3DS_VIEWPORT_SIZE = 0x7020,
|
||||
|
||||
// percentage chunk types
|
||||
const u16 C3DS_PERCENTAGE_I = 0x0030;
|
||||
const u16 C3DS_PERCENTAGE_F = 0x0031;
|
||||
// different color chunk types
|
||||
C3DS_COL_RGB = 0x0010,
|
||||
C3DS_COL_TRU = 0x0011,
|
||||
C3DS_COL_LIN_24 = 0x0012,
|
||||
C3DS_COL_LIN_F = 0x0013,
|
||||
|
||||
// percentage chunk types
|
||||
C3DS_PERCENTAGE_I = 0x0030,
|
||||
C3DS_PERCENTAGE_F = 0x0031,
|
||||
|
||||
C3DS_CHUNK_MAX = 0xFFFF
|
||||
};
|
||||
|
||||
|
||||
//! Constructor
|
||||
|
@ -147,9 +153,9 @@ C3DSMeshFileLoader::~C3DSMeshFileLoader()
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".bsp")
|
||||
bool C3DSMeshFileLoader::isALoadableFileExtension(const c8* filename) const
|
||||
bool C3DSMeshFileLoader::isALoadableFileExtension(const core::string<c16>& filename) const
|
||||
{
|
||||
return strstr(filename, ".3ds")!=0;
|
||||
return core::hasFileExtension ( filename, "3ds" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1133,13 +1139,13 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
if (Materials[i].Filename[0].size())
|
||||
{
|
||||
video::ITexture* texture = 0;
|
||||
if (FileSystem->existFile(Materials[i].Filename[0].c_str()))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[0].c_str());
|
||||
if (FileSystem->existFile(Materials[i].Filename[0]))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[0]);
|
||||
if (!texture)
|
||||
{
|
||||
const core::stringc fname = FileSystem->getFileDir(modelFilename) + "/" + FileSystem->getFileBasename(Materials[i].Filename[0]);
|
||||
if (FileSystem->existFile(fname.c_str()))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname.c_str());
|
||||
if (FileSystem->existFile(fname))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname);
|
||||
}
|
||||
if (!texture)
|
||||
os::Printer::log("Could not load a texture for entry in 3ds file",
|
||||
|
@ -1151,13 +1157,13 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
if (Materials[i].Filename[2].size())
|
||||
{
|
||||
video::ITexture* texture = 0;
|
||||
if (FileSystem->existFile(Materials[i].Filename[2].c_str()))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[2].c_str());
|
||||
if (FileSystem->existFile(Materials[i].Filename[2]))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[2]);
|
||||
if (!texture)
|
||||
{
|
||||
const core::stringc fname = FileSystem->getFileDir(modelFilename) + "/" + FileSystem->getFileBasename(Materials[i].Filename[2]);
|
||||
if (FileSystem->existFile(fname.c_str()))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname.c_str());
|
||||
if (FileSystem->existFile(fname))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname);
|
||||
}
|
||||
if (!texture)
|
||||
{
|
||||
|
@ -1174,13 +1180,13 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
if (Materials[i].Filename[3].size())
|
||||
{
|
||||
video::ITexture* texture = 0;
|
||||
if (FileSystem->existFile(Materials[i].Filename[3].c_str()))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[3].c_str());
|
||||
if (FileSystem->existFile(Materials[i].Filename[3]))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[3]);
|
||||
if (!texture)
|
||||
{
|
||||
const core::stringc fname = FileSystem->getFileDir(modelFilename) + "/" + FileSystem->getFileBasename(Materials[i].Filename[3]);
|
||||
if (FileSystem->existFile(fname.c_str()))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname.c_str());
|
||||
if (FileSystem->existFile(fname))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname);
|
||||
}
|
||||
|
||||
if (!texture)
|
||||
|
@ -1199,13 +1205,13 @@ void C3DSMeshFileLoader::loadMaterials(io::IReadFile* file)
|
|||
if (Materials[i].Filename[4].size())
|
||||
{
|
||||
video::ITexture* texture = 0;
|
||||
if (FileSystem->existFile(Materials[i].Filename[4].c_str()))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[4].c_str());
|
||||
if (FileSystem->existFile(Materials[i].Filename[4]))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(Materials[i].Filename[4]);
|
||||
if (!texture)
|
||||
{
|
||||
const core::stringc fname = FileSystem->getFileDir(modelFilename) + "/" + FileSystem->getFileBasename(Materials[i].Filename[4]);
|
||||
if (FileSystem->existFile(fname.c_str()))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname.c_str());
|
||||
if (FileSystem->existFile(fname))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(fname);
|
||||
}
|
||||
if (!texture)
|
||||
os::Printer::log("Could not load a texture for entry in 3ds file",
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".cob")
|
||||
virtual bool isALoadableFileExtension(const c8* fileName) const;
|
||||
virtual bool isALoadableFileExtension(const core::string<c16>& filename) const;
|
||||
|
||||
//! creates/loads an animated mesh from the file.
|
||||
//! \return Pointer to the created mesh. Returns 0 if loading failed.
|
||||
|
|
|
@ -25,16 +25,18 @@ namespace scene
|
|||
#endif
|
||||
|
||||
|
||||
struct SMD3Bone
|
||||
//! General properties of a single animation frame.
|
||||
struct SMD3Frame
|
||||
{
|
||||
f32 Mins[3]; // bounding box per frame
|
||||
f32 Maxs[3];
|
||||
f32 Position[3]; // position of bounding box
|
||||
f32 scale;
|
||||
c8 creator[16];
|
||||
f32 mins[3]; // bounding box per frame
|
||||
f32 maxs[3];
|
||||
f32 position[3]; // position of bounding box
|
||||
f32 radius; // radius of bounding sphere
|
||||
c8 creator[16]; // name of frame
|
||||
};
|
||||
|
||||
|
||||
//! An attachment point for another MD3 model.
|
||||
struct SMD3Tag
|
||||
{
|
||||
c8 Name[64]; //name of 'tag' as it's usually called in the md3 files try to see it as a sub-mesh/seperate mesh-part.
|
||||
|
@ -42,9 +44,11 @@ struct SMD3Tag
|
|||
f32 rotationMatrix[9]; //3x3 rotation direction of tag
|
||||
};
|
||||
|
||||
struct SMD3Skin
|
||||
//!Shader
|
||||
struct SMD3Shader
|
||||
{
|
||||
c8 name[68]; // name of skin
|
||||
c8 name[64]; // name of shader
|
||||
s32 shaderIndex;
|
||||
};
|
||||
|
||||
|
||||
|
@ -67,7 +71,6 @@ CAnimatedMeshMD3::CAnimatedMeshMD3()
|
|||
#endif
|
||||
|
||||
Mesh = new SMD3Mesh();
|
||||
memset( &Mesh->MD3Header, 0, sizeof ( Mesh->MD3Header ) );
|
||||
|
||||
setInterpolationShift ( 0, 0 );
|
||||
}
|
||||
|
@ -112,7 +115,7 @@ void CAnimatedMeshMD3::setDirty(E_BUFFER_TYPE buffer)
|
|||
|
||||
|
||||
//! Returns the animated tag list based on a detail level. 0 is the lowest, 255 the highest detail.
|
||||
SMD3QuaterionTagList *CAnimatedMeshMD3::getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)
|
||||
SMD3QuaternionTagList *CAnimatedMeshMD3::getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)
|
||||
{
|
||||
if ( 0 == Mesh )
|
||||
return 0;
|
||||
|
@ -175,7 +178,7 @@ IMesh* CAnimatedMeshMD3::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop,
|
|||
{
|
||||
buildVertexArray(frameA, frameB, iPol,
|
||||
Mesh->Buffer[i],
|
||||
(SMeshBuffer*) MeshIPol.getMeshBuffer(i)
|
||||
(SMeshBufferLightMap*) MeshIPol.getMeshBuffer(i)
|
||||
);
|
||||
}
|
||||
MeshIPol.recalculateBoundingBox ();
|
||||
|
@ -191,7 +194,7 @@ IMesh* CAnimatedMeshMD3::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop,
|
|||
//! create a Irrlicht MeshBuffer for a MD3 MeshBuffer
|
||||
IMeshBuffer * CAnimatedMeshMD3::createMeshBuffer(const SMD3MeshBuffer* source)
|
||||
{
|
||||
SMeshBuffer * dest = new SMeshBuffer();
|
||||
SMeshBufferLightMap * dest = new SMeshBufferLightMap();
|
||||
dest->Vertices.set_used( source->MeshHeader.numVertices );
|
||||
dest->Indices.set_used( source->Indices.size () );
|
||||
|
||||
|
@ -208,10 +211,12 @@ IMeshBuffer * CAnimatedMeshMD3::createMeshBuffer(const SMD3MeshBuffer* source)
|
|||
// fill in static vertex info
|
||||
for ( i = 0; i!= (u32)source->MeshHeader.numVertices; ++i )
|
||||
{
|
||||
video::S3DVertex &v = dest->Vertices[i];
|
||||
video::S3DVertex2TCoords &v = dest->Vertices[i];
|
||||
v.Color = 0xFFFFFFFF;
|
||||
v.TCoords.X = source->Tex[i].u;
|
||||
v.TCoords.Y = source->Tex[i].v;
|
||||
v.TCoords2.X = 0.f;
|
||||
v.TCoords2.Y = 0.f;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
@ -220,7 +225,7 @@ IMeshBuffer * CAnimatedMeshMD3::createMeshBuffer(const SMD3MeshBuffer* source)
|
|||
//! build final mesh's vertices from frames frameA and frameB with linear interpolation.
|
||||
void CAnimatedMeshMD3::buildVertexArray ( u32 frameA, u32 frameB, f32 interpolate,
|
||||
const SMD3MeshBuffer * source,
|
||||
SMeshBuffer * dest
|
||||
SMeshBufferLightMap * dest
|
||||
)
|
||||
{
|
||||
const u32 frameOffsetA = frameA * source->MeshHeader.numVertices;
|
||||
|
@ -229,7 +234,7 @@ void CAnimatedMeshMD3::buildVertexArray ( u32 frameA, u32 frameB, f32 interpolat
|
|||
|
||||
for (s32 i = 0; i != source->MeshHeader.numVertices; ++i)
|
||||
{
|
||||
video::S3DVertex &v = dest->Vertices [ i ];
|
||||
video::S3DVertex2TCoords &v = dest->Vertices [ i ];
|
||||
|
||||
const SMD3Vertex &vA = source->Vertices [ frameOffsetA + i ];
|
||||
const SMD3Vertex &vB = source->Vertices [ frameOffsetB + i ];
|
||||
|
@ -240,8 +245,8 @@ void CAnimatedMeshMD3::buildVertexArray ( u32 frameA, u32 frameB, f32 interpolat
|
|||
v.Pos.Z = scale * ( vA.position[1] + interpolate * ( vB.position[1] - vA.position[1] ) );
|
||||
|
||||
// normal
|
||||
const core::vector3df nA(getNormal ( vA.normal[0], vA.normal[1] ));
|
||||
const core::vector3df nB(getNormal ( vB.normal[0], vB.normal[1] ));
|
||||
const core::vector3df nA( quake3::getMD3Normal ( vA.normal[0], vA.normal[1] ));
|
||||
const core::vector3df nB( quake3::getMD3Normal ( vB.normal[0], vB.normal[1] ));
|
||||
|
||||
v.Normal.X = nA.X + interpolate * ( nB.X - nA.X );
|
||||
v.Normal.Y = nA.Z + interpolate * ( nB.Z - nA.Z );
|
||||
|
@ -260,10 +265,10 @@ void CAnimatedMeshMD3::buildTagArray ( u32 frameA, u32 frameB, f32 interpolate )
|
|||
|
||||
for ( s32 i = 0; i != Mesh->MD3Header.numTags; ++i )
|
||||
{
|
||||
SMD3QuaterionTag &d = TagListIPol [ i ];
|
||||
SMD3QuaternionTag &d = TagListIPol [ i ];
|
||||
|
||||
const SMD3QuaterionTag &qA = Mesh->TagList.Container[ frameOffsetA + i];
|
||||
const SMD3QuaterionTag &qB = Mesh->TagList.Container[ frameOffsetB + i];
|
||||
const SMD3QuaternionTag &qA = Mesh->TagList[ frameOffsetA + i];
|
||||
const SMD3QuaternionTag &qB = Mesh->TagList[ frameOffsetB + i];
|
||||
|
||||
// rotation
|
||||
d.rotation.slerp( qA.rotation, qB.rotation, interpolate );
|
||||
|
@ -298,19 +303,31 @@ bool CAnimatedMeshMD3::loadModelFile( u32 modelIndex, io::IReadFile* file)
|
|||
//! store model name
|
||||
Mesh->Name = file->getFileName();
|
||||
|
||||
//! Bone Frames Data ( ignore )
|
||||
u32 i;
|
||||
|
||||
//! Frame Data ( ignore )
|
||||
#if 0
|
||||
SMD3Frame frameImport;
|
||||
file->seek ( Mesh->MD3Header.frameStart );
|
||||
for (i = 0; i != Mesh->MD3Header.numFrames; ++i )
|
||||
{
|
||||
file->read(&frameImport, sizeof(frameImport) );
|
||||
}
|
||||
#endif
|
||||
|
||||
//! Tag Data
|
||||
const u32 totalTags = Mesh->MD3Header.numTags * Mesh->MD3Header.numFrames;
|
||||
|
||||
SMD3Tag import;
|
||||
SMD3QuaterionTag exp;
|
||||
u32 i;
|
||||
|
||||
file->seek( Mesh->MD3Header.tagStart );
|
||||
Mesh->TagList.set_used ( totalTags );
|
||||
for (i = 0; i != totalTags; ++i )
|
||||
{
|
||||
file->read(&import, sizeof(import) );
|
||||
|
||||
SMD3QuaternionTag &exp = Mesh->TagList[i];
|
||||
|
||||
//! tag name
|
||||
exp.Name = import.Name;
|
||||
|
||||
|
@ -325,14 +342,11 @@ bool CAnimatedMeshMD3::loadModelFile( u32 modelIndex, io::IReadFile* file)
|
|||
-import.rotationMatrix[6],
|
||||
1 + import.rotationMatrix[8]);
|
||||
exp.rotation.normalize ();
|
||||
Mesh->TagList.Container.push_back ( exp );
|
||||
}
|
||||
|
||||
//! Meshes
|
||||
u32 offset = Mesh->MD3Header.tagEnd;
|
||||
|
||||
SMD3Skin skin;
|
||||
|
||||
for (i = 0; i != (u32)Mesh->MD3Header.numMeshes; ++i )
|
||||
{
|
||||
//! construct a new mesh buffer
|
||||
|
@ -350,13 +364,17 @@ bool CAnimatedMeshMD3::loadModelFile( u32 modelIndex, io::IReadFile* file)
|
|||
buf->Indices.set_used ( meshHeader.numTriangles * 3 );
|
||||
buf->Tex.set_used ( meshHeader.numVertices );
|
||||
|
||||
|
||||
//! read skins (shaders)
|
||||
SMD3Shader skin;
|
||||
file->seek( offset + buf->MeshHeader.offset_shaders );
|
||||
for ( s32 g = 0; g != buf->MeshHeader.numShader; ++g )
|
||||
{
|
||||
file->read( &skin, sizeof(skin) );
|
||||
buf->Shader.push_back ( skin.name );
|
||||
|
||||
core::stringc name;
|
||||
cutFilenameExtension ( name, skin.name );
|
||||
name.replace ( '\\', '/' );
|
||||
buf->Shader = name;
|
||||
}
|
||||
|
||||
//! read texture coordinates
|
||||
|
@ -388,7 +406,7 @@ bool CAnimatedMeshMD3::loadModelFile( u32 modelIndex, io::IReadFile* file)
|
|||
// Init Tag Interpolation
|
||||
for (i = 0; i != (u32)Mesh->MD3Header.numTags; ++i )
|
||||
{
|
||||
TagListIPol.Container.push_back ( Mesh->TagList.Container[i] );
|
||||
TagListIPol.push_back ( Mesh->TagList[i] );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "irrString.h"
|
||||
#include "SMesh.h"
|
||||
#include "SMeshBuffer.h"
|
||||
#include "IQ3Shader.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -34,7 +35,7 @@ namespace scene
|
|||
// IAnimatedMeshMD3
|
||||
virtual void setInterpolationShift ( u32 shift, u32 loopMode );
|
||||
virtual SMD3Mesh * getOriginalMesh ();
|
||||
virtual SMD3QuaterionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop);
|
||||
virtual SMD3QuaternionTagList *getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop);
|
||||
|
||||
//IAnimatedMesh
|
||||
virtual u32 getFrameCount() const;
|
||||
|
@ -116,27 +117,20 @@ namespace scene
|
|||
|
||||
//! return a Mesh per frame
|
||||
SMesh MeshIPol;
|
||||
SMD3QuaterionTagList TagListIPol;
|
||||
SMD3QuaternionTagList TagListIPol;
|
||||
|
||||
IMeshBuffer * createMeshBuffer ( const SMD3MeshBuffer *source );
|
||||
|
||||
void buildVertexArray ( u32 frameA, u32 frameB, f32 interpolate,
|
||||
const SMD3MeshBuffer * source,
|
||||
SMeshBuffer * dest
|
||||
SMeshBufferLightMap * dest
|
||||
);
|
||||
|
||||
void buildTagArray ( u32 frameA, u32 frameB, f32 interpolate );
|
||||
|
||||
core::vector3df getNormal ( u32 i, u32 j )
|
||||
{
|
||||
const f32 lng = i * 2.0f * core::PI / 255.0f;
|
||||
const f32 lat = j * 2.0f * core::PI / 255.0f;
|
||||
return core::vector3df(cosf ( lat ) * sinf ( lng ),
|
||||
sinf ( lat ) * sinf ( lng ),
|
||||
cos ( lng ));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -36,8 +36,9 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh,
|
|||
CurrentFrameNr(0.f),
|
||||
JointMode(EJUOR_NONE), JointsUsed(false),
|
||||
TransitionTime(0), Transiting(0.f), TransitingBlend(0.f),
|
||||
Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(0),
|
||||
LoopCallBack(0), PassCount(0), Shadow(0)
|
||||
Looping(true), ReadOnlyMaterials(false),
|
||||
LoopCallBack(0), PassCount(0), Shadow(0), RenderFromIdentity(0),
|
||||
MD3Special ( 0 )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CAnimatedMeshSceneNode");
|
||||
|
@ -53,6 +54,9 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh,
|
|||
//! destructor
|
||||
CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode()
|
||||
{
|
||||
if ( MD3Special )
|
||||
MD3Special->drop ();
|
||||
|
||||
if (Mesh)
|
||||
Mesh->drop();
|
||||
|
||||
|
@ -200,7 +204,7 @@ void CAnimatedMeshSceneNode::OnRegisterSceneNode()
|
|||
}
|
||||
}
|
||||
|
||||
IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(void)
|
||||
IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControlJoints)
|
||||
{
|
||||
if(Mesh->getMeshType() != EAMT_SKINNED)
|
||||
{
|
||||
|
@ -249,6 +253,14 @@ void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
|
|||
{
|
||||
CurrentFrameNr = buildFrameNr ( timeMs );
|
||||
|
||||
if ( Mesh )
|
||||
{
|
||||
scene::IMesh * mesh = getMeshForCurrentFrame( true );
|
||||
|
||||
if ( mesh )
|
||||
Box = mesh->getBoundingBox();
|
||||
}
|
||||
|
||||
IAnimatedMeshSceneNode::OnAnimate ( timeMs );
|
||||
}
|
||||
|
||||
|
@ -267,7 +279,7 @@ void CAnimatedMeshSceneNode::render()
|
|||
|
||||
++PassCount;
|
||||
|
||||
scene::IMesh* m = getMeshForCurrentFrame();
|
||||
scene::IMesh* m = getMeshForCurrentFrame( false );
|
||||
|
||||
if(m)
|
||||
{
|
||||
|
@ -302,7 +314,7 @@ void CAnimatedMeshSceneNode::render()
|
|||
mat = Materials[i];
|
||||
mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
|
||||
if (RenderFromIdentity)
|
||||
driver->setTransform(video::ETS_WORLD, core::matrix4() );
|
||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix );
|
||||
else if (Mesh->getMeshType() == EAMT_SKINNED)
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
|
||||
|
||||
|
@ -328,7 +340,7 @@ void CAnimatedMeshSceneNode::render()
|
|||
scene::IMeshBuffer* mb = m->getMeshBuffer(i);
|
||||
|
||||
if (RenderFromIdentity)
|
||||
driver->setTransform(video::ETS_WORLD, core::matrix4() );
|
||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix );
|
||||
else if (Mesh->getMeshType() == EAMT_SKINNED)
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
|
||||
|
||||
|
@ -374,15 +386,16 @@ void CAnimatedMeshSceneNode::render()
|
|||
// Align to v->normal
|
||||
core::quaternion quatRot( v->Normal.Z, 0.f, -v->Normal.X, 1 + v->Normal.Y );
|
||||
quatRot.normalize();
|
||||
quatRot.getMatrix ( m2 );
|
||||
quatRot.getMatrix ( m2, v->Pos );
|
||||
|
||||
m2.setTranslation(v->Pos);
|
||||
if (Mesh->getMeshType() == EAMT_SKINNED)
|
||||
{
|
||||
m2 = (AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation) * m2;
|
||||
}
|
||||
else
|
||||
m2*=AbsoluteTransformation;
|
||||
{
|
||||
m2 = AbsoluteTransformation * m2;
|
||||
}
|
||||
|
||||
driver->setTransform(video::ETS_WORLD, m2 );
|
||||
for ( u32 a = 0; a != mesh->getMeshBufferCount(); ++a )
|
||||
|
@ -453,7 +466,7 @@ void CAnimatedMeshSceneNode::render()
|
|||
|
||||
core::matrix4 matr;
|
||||
|
||||
SMD3QuaterionTagList *taglist = ((IAnimatedMeshMD3*)Mesh)->getTagList(
|
||||
SMD3QuaternionTagList *taglist = ((IAnimatedMeshMD3*)Mesh)->getTagList(
|
||||
(s32)getFrameNr(), 255,
|
||||
getStartFrame(), getEndFrame());
|
||||
if ( taglist )
|
||||
|
@ -483,7 +496,7 @@ void CAnimatedMeshSceneNode::render()
|
|||
{
|
||||
const IMeshBuffer* mb = m->getMeshBuffer(g);
|
||||
if (RenderFromIdentity)
|
||||
driver->setTransform(video::ETS_WORLD, core::matrix4() );
|
||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix );
|
||||
else if (Mesh->getMeshType() == EAMT_SKINNED)
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
|
||||
driver->drawMeshBuffer(mb);
|
||||
|
@ -787,8 +800,8 @@ void CAnimatedMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAtt
|
|||
{
|
||||
IAnimatedMeshSceneNode::deserializeAttributes(in, options);
|
||||
|
||||
core::stringc oldMeshStr = SceneManager->getMeshCache()->getMeshFilename(Mesh);
|
||||
core::stringc newMeshStr = in->getAttributeAsString("Mesh");
|
||||
core::string<c16> oldMeshStr = SceneManager->getMeshCache()->getMeshFilename(Mesh);
|
||||
core::string<c16> newMeshStr = in->getAttributeAsString("Mesh");
|
||||
|
||||
Looping = in->getAttributeAsBool("Looping");
|
||||
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
|
||||
|
@ -847,14 +860,9 @@ void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh)
|
|||
|
||||
// returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh,
|
||||
// or the absolutetransformation if it's a normal scenenode
|
||||
const SMD3QuaterionTag& CAnimatedMeshSceneNode::getMD3TagTransformation( const core::stringc & tagname)
|
||||
const SMD3QuaternionTag* CAnimatedMeshSceneNode::getMD3TagTransformation( const core::stringc & tagname)
|
||||
{
|
||||
SMD3QuaterionTag * tag = MD3Special.AbsoluteTagList.get ( tagname );
|
||||
if ( tag )
|
||||
return *tag;
|
||||
|
||||
MD3Special.AbsoluteTagList.Container.push_back ( SMD3QuaterionTag ( tagname, AbsoluteTransformation ) );
|
||||
return *MD3Special.AbsoluteTagList.get ( tagname );
|
||||
return MD3Special ? MD3Special->AbsoluteTagList.get ( tagname ) : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -866,23 +874,32 @@ void CAnimatedMeshSceneNode::updateAbsolutePosition()
|
|||
if ( 0 == Mesh || Mesh->getMeshType() != EAMT_MD3 )
|
||||
return;
|
||||
|
||||
SMD3QuaterionTag parent;
|
||||
if ( Parent && Parent->getType () == ESNT_ANIMATED_MESH)
|
||||
{
|
||||
parent = ((IAnimatedMeshSceneNode*) Parent)->getMD3TagTransformation ( MD3Special.Tagname );
|
||||
}
|
||||
|
||||
SMD3QuaterionTag relative( RelativeTranslation, RelativeRotation );
|
||||
|
||||
SMD3QuaterionTagList *taglist;
|
||||
SMD3QuaternionTagList *taglist;
|
||||
taglist = ( (IAnimatedMeshMD3*) Mesh )->getTagList ( (s32)getFrameNr(),255,getStartFrame (),getEndFrame () );
|
||||
if ( taglist )
|
||||
{
|
||||
MD3Special.AbsoluteTagList.Container.set_used ( taglist->size () );
|
||||
if ( 0 == MD3Special )
|
||||
{
|
||||
MD3Special = new SMD3Special ();
|
||||
}
|
||||
|
||||
SMD3QuaternionTag parent ( MD3Special->Tagname );
|
||||
if ( Parent && Parent->getType () == ESNT_ANIMATED_MESH)
|
||||
{
|
||||
const SMD3QuaternionTag * p = ((IAnimatedMeshSceneNode*) Parent)->getMD3TagTransformation
|
||||
( MD3Special->Tagname );
|
||||
|
||||
if ( p )
|
||||
parent = *p;
|
||||
}
|
||||
|
||||
SMD3QuaternionTag relative( RelativeTranslation, RelativeRotation );
|
||||
|
||||
MD3Special->AbsoluteTagList.set_used ( taglist->size () );
|
||||
for ( u32 i=0; i!= taglist->size (); ++i )
|
||||
{
|
||||
MD3Special.AbsoluteTagList[i].position = parent.position + (*taglist)[i].position + relative.position;
|
||||
MD3Special.AbsoluteTagList[i].rotation = parent.rotation * (*taglist)[i].rotation * relative.rotation;
|
||||
MD3Special->AbsoluteTagList[i].position = parent.position + (*taglist)[i].position + relative.position;
|
||||
MD3Special->AbsoluteTagList[i].rotation = parent.rotation * (*taglist)[i].rotation * relative.rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1004,6 +1021,8 @@ void CAnimatedMeshSceneNode::animateJoints(bool CalculateAbsolutePositions)
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
*/
|
||||
void CAnimatedMeshSceneNode::checkJoints()
|
||||
{
|
||||
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
|
||||
|
@ -1021,7 +1040,8 @@ void CAnimatedMeshSceneNode::checkJoints()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
*/
|
||||
void CAnimatedMeshSceneNode::beginTransition()
|
||||
{
|
||||
if (!JointsUsed)
|
||||
|
@ -1046,6 +1066,8 @@ void CAnimatedMeshSceneNode::beginTransition()
|
|||
TransitingBlend = 0.f;
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
ISceneNode* CAnimatedMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
|
||||
{
|
||||
if (!newParent) newParent = Parent;
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace scene
|
|||
|
||||
// returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh,
|
||||
// or the absolutetransformation if it's a normal scenenode
|
||||
const SMD3QuaterionTag& getMD3TagTransformation( const core::stringc & tagname);
|
||||
const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname);
|
||||
|
||||
//! updates the absolute position based on the relative and the parents position
|
||||
virtual void updateAbsolutePosition();
|
||||
|
@ -162,7 +162,7 @@ namespace scene
|
|||
private:
|
||||
|
||||
//! Get a static mesh for the current frame of this animated mesh
|
||||
IMesh* getMeshForCurrentFrame(void);
|
||||
IMesh* getMeshForCurrentFrame(bool forceRecalcOfControlJoints);
|
||||
|
||||
f32 buildFrameNr( u32 timeMs);
|
||||
void checkJoints();
|
||||
|
@ -198,10 +198,14 @@ namespace scene
|
|||
core::array<IBoneSceneNode* > JointChildSceneNodes;
|
||||
core::array<core::matrix4> PretransitingSave;
|
||||
|
||||
struct SMD3Special
|
||||
// Quake3 Model
|
||||
struct SMD3Special : public virtual IReferenceCounted
|
||||
{
|
||||
virtual ~SMD3Special ()
|
||||
{
|
||||
}
|
||||
core::stringc Tagname;
|
||||
SMD3QuaterionTagList AbsoluteTagList;
|
||||
SMD3QuaternionTagList AbsoluteTagList;
|
||||
|
||||
SMD3Special & operator = (const SMD3Special & copyMe)
|
||||
{
|
||||
|
@ -210,7 +214,7 @@ namespace scene
|
|||
return *this;
|
||||
}
|
||||
};
|
||||
SMD3Special MD3Special;
|
||||
SMD3Special *MD3Special;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
|
|
|
@ -1831,14 +1831,6 @@ public:
|
|||
return Value ? Value->getName() : core::stringc();
|
||||
}
|
||||
|
||||
virtual void getString(char* target)
|
||||
{
|
||||
if (Value)
|
||||
strcpy(target, Value->getName().c_str());
|
||||
else
|
||||
target[0] = 0x0;
|
||||
}
|
||||
|
||||
virtual void setString(const char* text)
|
||||
{
|
||||
if (Driver)
|
||||
|
@ -1934,9 +1926,12 @@ public:
|
|||
return (Value != 0);
|
||||
}
|
||||
|
||||
virtual void getString(char* target)
|
||||
virtual core::stringw getStringW()
|
||||
{
|
||||
sprintf(target, "0x%x", *(int*)(&Value));
|
||||
wchar_t buf[32];
|
||||
swprintf(buf, 32, L"0x%x", *(int*)(&Value));
|
||||
|
||||
return core::stringw(buf);
|
||||
}
|
||||
|
||||
virtual void setString(const char* text)
|
||||
|
|
|
@ -36,9 +36,9 @@ CB3DMeshFileLoader::CB3DMeshFileLoader(scene::ISceneManager* smgr)
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".bsp")
|
||||
bool CB3DMeshFileLoader::isALoadableFileExtension(const c8* fileName) const
|
||||
bool CB3DMeshFileLoader::isALoadableFileExtension(const core::string<c16>& filename) const
|
||||
{
|
||||
return strstr(fileName, ".b3d") != 0;
|
||||
return core::hasFileExtension ( filename, "b3d" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -722,9 +722,9 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||
{
|
||||
// This is what blitz basic calls a brush, like a Irrlicht Material
|
||||
|
||||
const core::stringc name = readString();
|
||||
#ifdef _B3D_READER_DEBUG
|
||||
os::Printer::log("read Material", name.c_str());
|
||||
const core::stringc name = readString();
|
||||
os::Printer::log("read Material", name.c_str());
|
||||
#endif
|
||||
Materials.push_back(SB3dMaterial());
|
||||
SB3dMaterial& B3dMaterial=Materials.getLast();
|
||||
|
@ -909,7 +909,7 @@ void CB3DMeshFileLoader::loadTextures(SB3dMaterial& material) const
|
|||
{
|
||||
if (!SceneManager->getParameters()->getAttributeAsBool(B3D_LOADER_IGNORE_MIPMAP_FLAG))
|
||||
SceneManager->getVideoDriver()->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, (B3dTexture->Flags & 0x8) ? true:false);
|
||||
material.Material.setTexture(i, SceneManager->getVideoDriver()->getTexture( B3dTexture->TextureName.c_str() ));
|
||||
material.Material.setTexture(i, SceneManager->getVideoDriver()->getTexture( B3dTexture->TextureName ));
|
||||
if (material.Textures[i]->Flags & 0x10) // Clamp U
|
||||
material.Material.TextureLayer[i].TextureWrap=video::ETC_CLAMP;
|
||||
if (material.Textures[i]->Flags & 0x20) // Clamp V
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".bsp")
|
||||
virtual bool isALoadableFileExtension(const c8* fileName) const;
|
||||
virtual bool isALoadableFileExtension(const core::string<c16>& filename) const;
|
||||
|
||||
//! creates/loads an animated mesh from the file.
|
||||
//! \return Pointer to the created mesh. Returns 0 if loading failed.
|
||||
|
|
|
@ -38,9 +38,9 @@ CBSPMeshFileLoader::~CBSPMeshFileLoader()
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".bsp")
|
||||
bool CBSPMeshFileLoader::isALoadableFileExtension(const c8* filename) const
|
||||
bool CBSPMeshFileLoader::isALoadableFileExtension(const core::string<c16>& filename) const
|
||||
{
|
||||
return strstr(filename, ".bsp") || strstr(filename, ".shader");
|
||||
return core::hasFileExtension ( filename, "bsp", "shader", "cfg" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,27 +50,44 @@ bool CBSPMeshFileLoader::isALoadableFileExtension(const c8* filename) const
|
|||
//! See IReferenceCounted::drop() for more information.
|
||||
IAnimatedMesh* CBSPMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
// load quake 3 bsp
|
||||
if (strstr(file->getFileName(), ".bsp"))
|
||||
s32 type = core::isFileExtension ( file->getFileName(), "bsp", "shader", "cfg" );
|
||||
IQ3LevelMesh* q = 0;
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
CQ3LevelMesh* q = new CQ3LevelMesh(FileSystem, SceneManager);
|
||||
case 1:
|
||||
q = new CQ3LevelMesh(FileSystem, SceneManager, LoadParam);
|
||||
|
||||
q->getShader("scripts/models.shader");
|
||||
q->getShader("scripts/liquid.shader");
|
||||
//q->getShader("scripts/sky.shader");
|
||||
// determine real shaders in LoadParam
|
||||
if ( 0 == LoadParam.loadAllShaders )
|
||||
{
|
||||
q->getShader("scripts/common.shader");
|
||||
q->getShader("scripts/sfx.shader");
|
||||
q->getShader("scripts/gfx.shader");
|
||||
q->getShader("scripts/liquid.shader");
|
||||
q->getShader("scripts/models.shader");
|
||||
q->getShader("scripts/walls.shader");
|
||||
//q->getShader("scripts/sky.shader");
|
||||
}
|
||||
|
||||
if ( q->loadFile(file) )
|
||||
if ( ((CQ3LevelMesh*)q)->loadFile(file) )
|
||||
return q;
|
||||
|
||||
q->drop();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
q = new CQ3LevelMesh(FileSystem, SceneManager,LoadParam);
|
||||
q->getShader( file->getFileName() );
|
||||
return q;
|
||||
|
||||
q->drop();
|
||||
}
|
||||
|
||||
// load quake 3 shader container
|
||||
if (strstr(file->getFileName(), ".shader"))
|
||||
{
|
||||
CQ3LevelMesh* q = new CQ3LevelMesh(FileSystem, SceneManager);
|
||||
q->getShader(file->getFileName());
|
||||
return q;
|
||||
break;
|
||||
case 3:
|
||||
// load quake 3 loading parameter
|
||||
if ( file->getFileName() == "levelparameter.cfg" )
|
||||
{
|
||||
file->read ( &LoadParam, sizeof ( LoadParam ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "IFileSystem.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "ISceneManager.h"
|
||||
#include "IQ3Shader.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -28,7 +29,7 @@ public:
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".bsp")
|
||||
virtual bool isALoadableFileExtension(const c8* fileName) const;
|
||||
virtual bool isALoadableFileExtension(const core::string<c16>& filename) const;
|
||||
|
||||
//! creates/loads an animated mesh from the file.
|
||||
//! \return Pointer to the created mesh. Returns 0 if loading failed.
|
||||
|
@ -40,6 +41,8 @@ private:
|
|||
|
||||
io::IFileSystem* FileSystem;
|
||||
scene::ISceneManager* SceneManager;
|
||||
|
||||
quake3::Q3LevelLoadParameter LoadParam;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
|
|
|
@ -554,8 +554,8 @@ void CBurningShader_Raster_Reference::pShader_EMT_LIGHTMAP_M4 ()
|
|||
|
||||
f32 inversew = fix_inverse32 ( line.w[0] );
|
||||
|
||||
getSample_texture ( r0, g0, b0, &IT[0], f32_to_fixPoint ( line.t[0][0].x,inversew), f32_to_fixPoint ( line.t[0][0].y,inversew) );
|
||||
getSample_texture ( r1, g1, b1, &IT[1], f32_to_fixPoint ( line.t[1][0].x,inversew), f32_to_fixPoint ( line.t[1][0].y,inversew) );
|
||||
getSample_texture ( r0, g0, b0, &IT[0], tofix ( line.t[0][0].x,inversew), tofix ( line.t[0][0].y,inversew) );
|
||||
getSample_texture ( r1, g1, b1, &IT[1], tofix ( line.t[1][0].x,inversew), tofix ( line.t[1][0].y,inversew) );
|
||||
|
||||
|
||||
pShader.dst[pShader.i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex2 ( r0, r1 ) ),
|
||||
|
@ -574,8 +574,8 @@ void CBurningShader_Raster_Reference::pShader_1 ()
|
|||
|
||||
const f32 inversew = fix_inverse32 ( line.w[0] );
|
||||
|
||||
tx0 = f32_to_fixPoint ( line.t[0][0].x, inversew );
|
||||
ty0 = f32_to_fixPoint ( line.t[0][0].y, inversew );
|
||||
tx0 = tofix ( line.t[0][0].x, inversew );
|
||||
ty0 = tofix ( line.t[0][0].y, inversew );
|
||||
|
||||
getSample_texture ( r0, g0, b0, &IT[0], tx0, ty0 );
|
||||
pShader.dst[pShader.i] = fix_to_color ( r0, g0, b0 );
|
||||
|
@ -856,8 +856,8 @@ void CBurningShader_Raster_Reference::drawTriangle ( const s4DVertex *a,const s4
|
|||
|
||||
// sort on height, y
|
||||
if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b);
|
||||
if ( F32_A_GREATER_B ( a->Pos.y , c->Pos.y ) ) swapVertexPointer(&a, &c);
|
||||
if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c);
|
||||
if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b);
|
||||
|
||||
|
||||
// calculate delta y of the edges
|
||||
|
|
|
@ -372,9 +372,9 @@ namespace scene
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".bsp")
|
||||
bool CCSMLoader::isALoadableFileExtension(const c8* fileName) const
|
||||
bool CCSMLoader::isALoadableFileExtension(const core::string<c16>& filename) const
|
||||
{
|
||||
return strstr(fileName, ".csm")!=0;
|
||||
return core::hasFileExtension ( filename, "csm" );
|
||||
}
|
||||
|
||||
//! creates/loads an animated mesh from the file.
|
||||
|
@ -409,7 +409,7 @@ namespace scene
|
|||
|
||||
scene::IMesh* pMesh = createIrrlichtMesh(&csmFile,
|
||||
SceneManager->getParameters()->getAttributeAsString(CSM_TEXTURE_PATH),
|
||||
file->getFileName());
|
||||
core::stringc ( file->getFileName() ).c_str() );
|
||||
return pMesh;
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ namespace scene
|
|||
texName+= "/";
|
||||
texName+= surface->getTextureName();
|
||||
|
||||
video::ITexture* texture = driver->getTexture(texName.c_str());
|
||||
video::ITexture* texture = driver->getTexture(texName);
|
||||
scene::SMeshBufferLightMap *buffer = new scene::SMeshBufferLightMap();
|
||||
|
||||
//material
|
||||
|
@ -462,7 +462,7 @@ namespace scene
|
|||
lmapName += (int)surface->getLightMapId();
|
||||
|
||||
buffer->Material.setTexture(0, texture);
|
||||
buffer->Material.setTexture(1, driver->getTexture(lmapName.c_str()));
|
||||
buffer->Material.setTexture(1, driver->getTexture(lmapName));
|
||||
buffer->Material.Lighting = false;
|
||||
buffer->Material.MaterialType = video::EMT_LIGHTMAP_M4;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace scene
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".bsp")
|
||||
virtual bool isALoadableFileExtension(const c8* fileName) const;
|
||||
virtual bool isALoadableFileExtension(const core::string<c16>& filename) const;
|
||||
|
||||
//! creates/loads an animated mesh from the file.
|
||||
virtual IAnimatedMesh* createMesh(io::IReadFile* file);
|
||||
|
|
|
@ -328,9 +328,9 @@ CColladaFileLoader::~CColladaFileLoader()
|
|||
|
||||
//! Returns true if the file maybe is able to be loaded by this class.
|
||||
/** This decision should be based only on the file extension (e.g. ".cob") */
|
||||
bool CColladaFileLoader::isALoadableFileExtension(const c8* fileName) const
|
||||
bool CColladaFileLoader::isALoadableFileExtension(const core::string<c16>& filename) const
|
||||
{
|
||||
return strstr(fileName, ".xml") || strstr(fileName, ".dae");
|
||||
return core::hasFileExtension ( filename, "xml", "dae" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1774,7 +1774,7 @@ void CColladaFileLoader::readGeometry(io::IXMLReaderUTF8* reader)
|
|||
amesh->recalculateBoundingBox();
|
||||
|
||||
// create virtual file name
|
||||
core::stringc filename = CurrentlyLoadingMesh;
|
||||
core::string<c16> filename = CurrentlyLoadingMesh;
|
||||
filename += '#';
|
||||
filename += id;
|
||||
|
||||
|
@ -2696,9 +2696,9 @@ video::ITexture* CColladaFileLoader::getTextureFromImage(core::stringc uri)
|
|||
{
|
||||
if (Images[i].Source.size() && Images[i].SourceIsFilename)
|
||||
{
|
||||
if (FileSystem->existFile(Images[i].Source.c_str()))
|
||||
return driver->getTexture(Images[i].Source.c_str());
|
||||
return driver->getTexture((FileSystem->getFileDir(CurrentlyLoadingMesh)+"/"+Images[i].Source).c_str());
|
||||
if (FileSystem->existFile(Images[i].Source))
|
||||
return driver->getTexture(Images[i].Source);
|
||||
return driver->getTexture((FileSystem->getFileDir(CurrentlyLoadingMesh)+"/"+Images[i].Source));
|
||||
}
|
||||
else
|
||||
if (Images[i].Source.size())
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
//! based on the file extension (e.g. ".cob")
|
||||
virtual bool isALoadableFileExtension(const c8* fileName) const;
|
||||
virtual bool isALoadableFileExtension(const core::string<c16>& filename) const;
|
||||
|
||||
//! creates/loads an animated mesh from the file.
|
||||
//! \return Pointer to the created mesh. Returns 0 if loading failed.
|
||||
|
@ -337,7 +337,7 @@ private:
|
|||
core::stringc CurrentlyLoadingMesh;
|
||||
|
||||
scene::IAnimatedMesh* FirstLoadedMesh;
|
||||
core::stringc FirstLoadedMeshName;
|
||||
core::string<c16> FirstLoadedMeshName;
|
||||
s32 LoadedMeshCount;
|
||||
u32 Version;
|
||||
bool FlipAxis;
|
||||
|
|
|
@ -415,6 +415,38 @@ void CColorConverter::convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP)
|
|||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8* )sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB = 0xff000000 | (sB[2]<<16) | (sB[1]<<8) | sB[0];
|
||||
|
||||
sB += 3;
|
||||
++dB;
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8*)sP;
|
||||
u8* dB = (u8*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
{
|
||||
dB[0] = sB[3];
|
||||
dB[1] = sB[2];
|
||||
dB[2] = sB[1];
|
||||
dB[3] = sB[0];
|
||||
|
||||
sB += 4;
|
||||
dB += 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
u8 * sB = (u8 *)sP;
|
||||
|
|
|
@ -66,6 +66,8 @@ public:
|
|||
static void convert_R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
|
||||
static void convert_R5G6B5toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R5G6B5toR8G8B8(const void* sP, s32 sN, void* dP);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue