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@2148 dfc29bdd-3216-0410-991c-e03cc46cb475
master
engineer_apple 2009-01-27 15:57:07 +00:00
parent cf2cfa5f14
commit dfa2d627b2
12 changed files with 1193 additions and 351 deletions

View File

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

109
include/IFileArchive.h Normal file
View File

@ -0,0 +1,109 @@
// Copyright (C) 2002-2009 Nikolaus Gebhardt/ Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_FILE_ARCHIVE_H_INCLUDED__
#define __I_FILE_ARCHIVE_H_INCLUDED__
#include "IReadFile.h"
namespace irr
{
namespace io
{
//! FileSystemType: which Filesystem should be used for e.q browsing
enum eFileSystemType
{
FILESYSTEM_NATIVE = 0, // Native OS FileSystem
FILESYSTEM_VIRTUAL, // Virtual FileSystem
};
//! Base Info which all File archives must support on browsing
struct IFileArchiveEntry
{
IFileArchiveEntry () {}
core::string<c16> simpleFileName;
core::string<c16> path;
bool operator < (const IFileArchiveEntry& other) const
{
return simpleFileName < other.simpleFileName;
}
bool operator == (const IFileArchiveEntry& other) const
{
return simpleFileName == other.simpleFileName;
}
};
//! The FileArchive 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
as file on disk, using the IFileSystem makes no difference to this. */
struct IFileArchive : public virtual IReferenceCounted
{
//! return the id of the file Archive
virtual const core::string<c16>& getArchiveName () = 0;
//! get the class Type
virtual const core::string<c16>& getArchiveType() = 0;
//! opens a file by file name
virtual IReadFile* openFile(const core::string<c16>& filename) = 0;
//! returns fileindex
virtual s32 findFile(const core::string<c16>& filename) = 0;
//! Returns the amount of files in the filelist.
/** \return Amount of files and directories in the file list. */
virtual u32 getFileCount() = 0;
//! returns data of known file
virtual const IFileArchiveEntry* getFileInfo(u32 index) = 0;
};
//! Class which is able to create an archive from a file.
/** If you want the Irrlicht Engine be able to load archives of
currently unsupported file formats (e.g .wad), then implement
this and add your new Archive loader with
IFileSystem::addArchiveLoader() to the engine. */
struct IArchiveLoader : public virtual IReferenceCounted
{
//! Check if the file might be loaded by this class
/** Check is based on the file extension (e.g. ".zip")
\param fileName Name of file to check.
\return True if file seems to be loadable. */
virtual bool isALoadableFileFormat(const core::string<c16>& filename) const = 0;
//! Creates an archive from the filename
/** \param file File handle to check.
\return Pointer to newly created archive, or 0 upon error. */
virtual IFileArchive* createArchive(const core::string<c16>& filename, bool ignoreCase, bool ignorePaths) const = 0;
//! Check if the file might be loaded by this class
/** Check might look into the file.
\param file File handle to check.
\return True if file seems to be loadable. */
virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;
//! Creates an archive from the file
/** \param file File handle to check.
\return Pointer to newly created archive, or 0 upon error. */
virtual IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const = 0;
};
} // end namespace io
} // end namespace irr
#endif

45
include/IGUIImageList.h Normal file
View File

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

View File

@ -75,6 +75,9 @@ namespace gui
//! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 index) = 0;
//! sets the selected item. Set this to 0 if no item should be selected
virtual void setSelected(const wchar_t *item) = 0;
//! set whether the listbox should scroll to new or newly selected items
virtual void setAutoScrollEnabled(bool scroll) = 0;
@ -111,6 +114,10 @@ namespace gui
//! Swap the items at the given indices
virtual void swapItems(u32 index1, u32 index2) = 0;
//! set global itemHeight
virtual void setItemHeight( s32 height ) = 0;
};

277
include/IGUITreeView.h Normal file
View File

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

View File

@ -18,7 +18,7 @@ namespace scene
namespace quake3
{
static const core::stringc irrEmptyStringc("");
static core::stringc irrEmptyStringc("");
//! Hold the different Mesh Types used for getMesh
enum eQ3MeshIndex
@ -26,47 +26,63 @@ namespace quake3
E_Q3_MESH_GEOMETRY = 0,
E_Q3_MESH_ITEMS,
E_Q3_MESH_BILLBOARD,
E_Q3_MESH_FOG,
E_Q3_MESH_UNRESOLVED,
E_Q3_MESH_SIZE
};
// we are not using gamma, so quake3 is very dark.
// define the standard multiplication for lightmaps and vertex colors
const video::E_MATERIAL_TYPE defaultMaterialType = video::EMT_LIGHTMAP_M4;
const video::E_MODULATE_FUNC defaultModulate = video::EMFN_MODULATE_4X;
/*! used to customize Quake3 BSP Loader
*/
struct Q3LevelLoadParameter
{
Q3LevelLoadParameter ()
:defaultLightMapMaterial ( video::EMT_LIGHTMAP_M4 ),
defaultModulate ( video::EMFN_MODULATE_4X ),
patchTesselation ( 8 ),
verbose ( 0 ),
startTime ( 0 ), endTime ( 0 ),
mergeShaderBuffer ( 1 ),
cleanUnResolvedMeshes ( 1 ),
loadAllShaders ( 0 ),
loadSkyShader ( 0 ),
swapLump ( 0 ),
alpharef ( 1 ),
#ifdef __BIG_ENDIAN__
swapHeader ( 1 )
#else
swapHeader ( 0 )
#endif
{
memcpy ( scriptDir, "scripts\x0", 8 );
}
video::E_MATERIAL_TYPE defaultLightMapMaterial;
video::E_MODULATE_FUNC defaultModulate;
s32 patchTesselation;
s32 verbose;
u32 startTime;
u32 endTime;
s32 mergeShaderBuffer;
s32 cleanUnResolvedMeshes;
s32 alpharef;
s32 swapLump;
s32 swapHeader;
s32 loadAllShaders;
s32 loadSkyShader;
c8 scriptDir [ 64 ];
};
// some useful typedefs
typedef core::array< core::stringc > tStringList;
typedef core::array< video::ITexture* > tTexArray;
// name = "a b c .."
struct SVariable
{
core::stringc name;
core::stringc content;
void clear ()
{
name = "";
content = "";
}
s32 isValid () const
{
return name.size();
}
bool operator == ( const SVariable &other ) const
{
return name == other.name;
}
};
// string helper.. TODO: move to generic files
inline s32 isEqual ( const core::stringc &string, u32 &pos, const c8 *list[], u32 listSize )
inline s16 isEqual ( const core::stringc &string, u32 &pos, const c8 *list[], u16 listSize )
{
const char * in = string.c_str () + pos;
for ( u32 i = 0; i != listSize; ++i )
for ( u16 i = 0; i != listSize; ++i )
{
if (string.size() < pos)
return -2;
@ -79,7 +95,7 @@ namespace quake3
continue;
pos += len + 1;
return (s32) i;
return (s16) i;
}
return -2;
}
@ -93,6 +109,7 @@ namespace quake3
return value;
}
//! get a quake3 vector translated to irrlicht position (x,-z,y )
inline core::vector3df getAsVector3df ( const core::stringc &string, u32 &pos )
{
core::vector3df v;
@ -135,31 +152,33 @@ namespace quake3
//! A blend function for a q3 shader.
struct SBlendFunc
{
SBlendFunc ()
: type ( video::EMT_SOLID ), modulate ( defaultModulate ), param ( 0.f ),
isTransparent ( false ) {}
SBlendFunc ( video::E_MODULATE_FUNC mod )
: type ( video::EMT_SOLID ), modulate ( mod ),
param0( 0.f ),
isTransparent ( 0 ) {}
video::E_MATERIAL_TYPE type;
video::E_MODULATE_FUNC modulate;
f32 param;
bool isTransparent;
f32 param0;
u32 isTransparent;
};
// parses the content of Variable cull
inline bool isDisabled ( const core::stringc &string )
inline bool getCullingFunction ( const core::stringc &cull )
{
if ( string.size() == 0 )
if ( cull.size() == 0 )
return true;
bool ret = true;
static const c8 * funclist[] = { "none", "disable" };
static const c8 * funclist[] = { "none", "disable", "twosided" };
u32 pos = 0;
switch ( isEqual ( string, pos, funclist, 2 ) )
switch ( isEqual ( cull, pos, funclist, 3 ) )
{
case 0:
case 1:
case 2:
ret = false;
break;
}
@ -168,12 +187,13 @@ namespace quake3
// parses the content of Variable depthfunc
// return a z-test
inline u32 getDepthFunction ( const core::stringc &string )
inline u8 getDepthFunction ( const core::stringc &string )
{
if ( string.size() == 0 )
return 1;
u8 ret = video::EMDF_DEPTH_LESS_EQUAL;
if ( string.size() == 0 )
return ret;
u32 ret = 1;
static const c8 * funclist[] = { "lequal","equal" };
u32 pos = 0;
@ -189,7 +209,17 @@ namespace quake3
}
// parses the content of Variable blendfunc,alphafunc
/*!
parses the content of Variable blendfunc,alphafunc
it also make a hint for rendering as transparent or solid node.
we assume a typical quake scene would look like this..
1) Big Static Mesh ( solid )
2) static scene item ( may use transparency ) but rendered in the solid pass
3) additional transparency item in the transparent pass
it's not 100% accurate! it just empirical..
*/
inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc )
{
if ( string.size() == 0 )
@ -215,7 +245,7 @@ namespace quake3
"blend",
"ge128",
"gt0"
"gt0",
};
@ -230,20 +260,32 @@ namespace quake3
switch ( srcFact )
{
case video::EBF_ZERO:
switch ( dstFact )
{
// gl_zero gl_src_color == gl_dst_color gl_zero
case video::EBF_SRC_COLOR:
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
blendfunc.param0 = video::pack_texureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
blendfunc.isTransparent = 1;
resolved = 1;
break;
} break;
case video::EBF_ONE:
switch ( dstFact )
{
// gl_one gl_zero
case video::EBF_ZERO:
blendfunc.type = video::EMT_SOLID;
blendfunc.isTransparent = false;
blendfunc.isTransparent = 0;
resolved = 1;
break;
// gl_one gl_one
case video::EBF_ONE:
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
blendfunc.isTransparent = true;
blendfunc.isTransparent = 1;
resolved = 1;
break;
} break;
@ -254,8 +296,8 @@ namespace quake3
// gl_src_alpha gl_one_minus_src_alpha
case video::EBF_ONE_MINUS_SRC_ALPHA:
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
blendfunc.param0 = 1.f/255.f;
blendfunc.isTransparent = 1;
resolved = 1;
break;
} break;
@ -263,74 +305,133 @@ namespace quake3
case 11:
// add
blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
blendfunc.isTransparent = true;
blendfunc.isTransparent = 1;
resolved = 1;
break;
case 12:
// filter = gl_dst_color gl_zero
// filter = gl_dst_color gl_zero or gl_zero gl_src_color
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
blendfunc.param = video::pack_texureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, defaultModulate );
blendfunc.isTransparent = false;
blendfunc.param0 = video::pack_texureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
blendfunc.isTransparent = 1;
resolved = 1;
break;
case 13:
// blend
// blend = gl_src_alpha gl_one_minus_src_alpha
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
blendfunc.param0 = 1.f/255.f;
blendfunc.isTransparent = 1;
resolved = 1;
break;
case 14:
// alphafunc ge128
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
blendfunc.param = 0.5f;
blendfunc.isTransparent = true;
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param0 = 0.5f;
blendfunc.isTransparent = 1;
resolved = 1;
break;
case 15:
// alphafunc gt0
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
blendfunc.param = 1.f / 255.f;
blendfunc.isTransparent = true;
blendfunc.type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
blendfunc.param0 = 1.f / 255.f;
blendfunc.isTransparent = 1;
resolved = 1;
break;
}
// use the generic blender
if ( 0 == resolved )
{
blendfunc.type = video::EMT_ONETEXTURE_BLEND;
blendfunc.param = video::pack_texureBlendFunc (
blendfunc.param0 = video::pack_texureBlendFunc (
(video::E_BLEND_FACTOR) srcFact,
(video::E_BLEND_FACTOR) dstFact,
blendfunc.modulate);
if (srcFact == video::EBF_SRC_COLOR && dstFact == video::EBF_ZERO)
{
blendfunc.isTransparent = 0;
}
else
{
blendfunc.isTransparent = true;
}
blendfunc.isTransparent = 1;
}
}
// random noise [-1;1]
struct Noiser
{
static f32 get ()
{
static u32 RandomSeed = 0x69666966;
RandomSeed = (RandomSeed * 3631 + 1);
f32 value = ( (f32) (RandomSeed & 0x7FFF ) * (1.0f / (f32)(0x7FFF >> 1) ) ) - 1.f;
return value;
}
};
enum eQ3ModifierFunction
{
TCMOD = 0,
DEFORMVERTEXES = 1,
RGBGEN = 2,
TCGEN = 3,
MAP = 4,
ALPHAGEN = 5,
FUNCTION2 = 0x10,
SCROLL = FUNCTION2 + 1,
SCALE = FUNCTION2 + 2,
ROTATE = FUNCTION2 + 3,
STRETCH = FUNCTION2 + 4,
TURBULENCE = FUNCTION2 + 5,
WAVE = FUNCTION2 + 6,
IDENTITY = FUNCTION2 + 7,
VERTEX = FUNCTION2 + 8,
TEXTURE = FUNCTION2 + 9,
LIGHTMAP = FUNCTION2 + 10,
ENVIRONMENT = FUNCTION2 + 11,
$LIGHTMAP = FUNCTION2 + 12,
BULGE = FUNCTION2 + 13,
AUTOSPRITE = FUNCTION2 + 14,
AUTOSPRITE2 = FUNCTION2 + 15,
TRANSFORM = FUNCTION2 + 16,
EXACTVERTEX = FUNCTION2 + 17,
CONSTANT = FUNCTION2 + 18,
LIGHTINGSPECULAR = FUNCTION2 + 19,
MOVE = FUNCTION2 + 20,
NORMAL = FUNCTION2 + 21,
IDENTITYLIGHTING = FUNCTION2 + 22,
WAVE_MODIFIER_FUNCTION = 0x30,
SINUS = WAVE_MODIFIER_FUNCTION + 1,
COSINUS = WAVE_MODIFIER_FUNCTION + 2,
SQUARE = WAVE_MODIFIER_FUNCTION + 3,
TRIANGLE = WAVE_MODIFIER_FUNCTION + 4,
SAWTOOTH = WAVE_MODIFIER_FUNCTION + 5,
SAWTOOTH_INVERSE = WAVE_MODIFIER_FUNCTION + 6,
NOISE = WAVE_MODIFIER_FUNCTION + 7,
UNKNOWN = -2
};
struct SModifierFunction
{
SModifierFunction ()
: masterfunc0 ( -2 ), masterfunc1(0), func ( 0 ),
tcgen( 8 ), base ( 0 ), amp ( 1 ), phase ( 0 ), freq ( 1 ), wave(1) {}
: masterfunc0 ( UNKNOWN ), masterfunc1( UNKNOWN ), func ( SINUS ),
tcgen( TEXTURE ), rgbgen ( IDENTITY ), alphagen ( UNKNOWN ),
base ( 0 ), amp ( 1 ), phase ( 0 ), frequency ( 1 ),
wave ( 1 ),
x ( 0 ), y ( 0 ), z( 0 ), count( 0 ) {}
// "tcmod","deformvertexes","rgbgen", "tcgen"
s32 masterfunc0;
eQ3ModifierFunction masterfunc0;
// depends
s32 masterfunc1;
eQ3ModifierFunction masterfunc1;
// depends
s32 func;
eQ3ModifierFunction func;
s32 tcgen;
eQ3ModifierFunction tcgen;
eQ3ModifierFunction rgbgen;
eQ3ModifierFunction alphagen;
union
{
@ -348,44 +449,50 @@ namespace quake3
union
{
f32 freq;
f32 frequency;
f32 bulgespeed;
};
f32 wave;
union
{
f32 wave;
f32 div;
};
f32 x;
f32 y;
f32 z;
u32 count;
f32 evaluate ( f32 dt ) const
{
// phase in 0 and 1..
f32 x = core::fract( (dt + phase ) * freq );
f32 x = core::fract( (dt + phase ) * frequency );
f32 y = 0.f;
switch ( func )
{
// sin
case 0:
y = (f32) sin ( x * core::PI64 * 2.0 );
case SINUS:
y = sinf ( x * core::PI * 2.f );
break;
// cos
case 1:
y = (f32) cos ( x * core::PI64 * 2.0 );
case COSINUS:
y = cosf ( x * core::PI * 2.f );
break;
// square
case 2:
case SQUARE:
y = x < 0.5f ? 1.f : -1.f;
break;
// triangle
case 3:
y = x < 0.5f ? ( 2.f * x ) - 1.f : ( -2.f * x ) + 2.f;
case TRIANGLE:
y = x < 0.5f ? ( 4.f * x ) - 1.f : ( -4.f * x ) + 3.f;
break;
// sawtooth:
case 4:
case SAWTOOTH:
y = x;
break;
// inverse sawtooth:
case 5:
case SAWTOOTH_INVERSE:
y = 1.f - x;
break;
case NOISE:
y = Noiser::get();
break;
}
return base + ( y * amp );
@ -394,6 +501,15 @@ namespace quake3
};
inline core::vector3df getMD3Normal ( 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 ),
cosf ( lng ));
}
//
inline void getModifierFunc ( SModifierFunction& fill, const core::stringc &string, u32 &pos )
{
@ -402,64 +518,110 @@ namespace quake3
static const c8 * funclist[] =
{
"sin","cos","square", "triangle", "sawtooth","inversesawtooth"
"sin","cos","square",
"triangle", "sawtooth","inversesawtooth", "noise"
};
fill.func = quake3::isEqual ( string,pos, funclist,6 );
if ( fill.func == -2 )
fill.func = 0;
fill.func = (eQ3ModifierFunction) isEqual ( string,pos, funclist,7 );
fill.func = fill.func == UNKNOWN ? SINUS : (eQ3ModifierFunction) ((u32) fill.func + WAVE_MODIFIER_FUNCTION + 1);
fill.base = quake3::getAsFloat ( string, pos );
fill.amp = quake3::getAsFloat ( string, pos );
fill.phase = quake3::getAsFloat ( string, pos );
fill.freq = quake3::getAsFloat ( string, pos );
fill.base = getAsFloat ( string, pos );
fill.amp = getAsFloat ( string, pos );
fill.phase = getAsFloat ( string, pos );
fill.frequency = getAsFloat ( string, pos );
}
// name = "a b c .."
struct SVariable
{
core::stringc name;
core::stringc content;
SVariable ( const c8 * n, const c8 *c = 0 ) : name ( n ), content (c) {}
virtual ~SVariable () {}
void clear ()
{
name = "";
content = "";
}
s32 isValid () const
{
return name.size();
}
bool operator == ( const SVariable &other ) const
{
return 0 == strcmp ( name.c_str(), other.name.c_str () );
}
bool operator < ( const SVariable &other ) const
{
return 0 > strcmp ( name.c_str(), other.name.c_str () );
}
};
// string database. "a" = "Hello", "b" = "1234.6"
struct SVarGroup
{
// simple assoziative array
s32 getIndex( const c8 * name ) const
{
SVariable search;
search.name = name;
SVarGroup () {}
virtual ~SVarGroup () {}
return Variable.linear_search ( search );
u32 isDefined ( const c8 * name, const c8 * content = 0 ) const
{
for ( u32 i = 0; i != Variable.size (); ++i )
{
if ( 0 == strcmp ( Variable[i].name.c_str(), name ) &&
( 0 == content || strstr ( Variable[i].content.c_str(), content ) )
)
{
return i + 1;
}
}
return 0;
}
// searches for Variable name and returns is content
// if Variable is not found a reference to an Empty String is returned
const core::stringc &get( const c8 * name ) const
{
s32 index = getIndex ( name );
SVariable search ( name );
s32 index = Variable.linear_search ( search );
if ( index < 0 )
return irrEmptyStringc;
return Variable [ index ].content;
}
bool isDefined ( const c8 * name, const c8 * content = 0 ) const
// set the Variable name
void set ( const c8 * name, const c8 * content = 0 )
{
for ( u32 i = 0; i != Variable.size (); ++i )
u32 index = isDefined ( name, 0 );
if ( 0 == index )
{
if ( 0 == strcmp ( Variable[i].name.c_str(), name ) )
{
if ( 0 == content )
return true;
if ( 0 == strcmp ( Variable[i].content.c_str(), content ) )
return true;
}
Variable.push_back ( SVariable ( name, content ) );
}
else
{
Variable [ index ].content = content;
}
return false;
}
core::array < SVariable > Variable;
};
//! holding a group a variable
struct SVarGroupList: public IReferenceCounted
{
SVarGroupList () {}
SVarGroupList ()
{
VariableGroup.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
}
virtual ~SVarGroupList () {}
core::array < SVarGroup > VariableGroup;
@ -467,37 +629,49 @@ namespace quake3
//! A Parsed Shader Holding Variables ordered in Groups
class SShader
struct IShader
{
public:
bool operator == (const SShader &other ) const
{
return name == other.name;
}
IShader ()
: id ( 0 ), VarGroup ( 0 ) {}
virtual ~IShader () {}
bool operator < (const SShader &other ) const
{
return name < other.name;
}
void operator = (const IShader &other )
{
id = other.id;
VarGroup = other.VarGroup;
name = other.name;
}
const SVarGroup * getGroup ( u32 stage ) const
{
if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
return 0;
bool operator == (const IShader &other ) const
{
return 0 == strcmp ( name.c_str(), other.name.c_str () );
//return name == other.name;
}
return &VarGroup->VariableGroup [ stage ];
}
bool operator < (const IShader &other ) const
{
return strcmp ( name.c_str(), other.name.c_str () ) < 0;
//return name < other.name;
}
// id
s32 id;
const SVarGroup * getGroup ( u32 stage ) const
{
if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
return 0;
// Shader: shader name ( also first variable in first Vargroup )
// Entity: classname ( variable in Group(1) )
core::stringc name;
SVarGroupList *VarGroup; // reference
return &VarGroup->VariableGroup [ stage ];
}
// id
s32 id;
SVarGroupList *VarGroup; // reference
// Shader: shader name ( also first variable in first Vargroup )
// Entity: classname ( variable in Group(1) )
core::stringc name;
};
typedef SShader SEntity;
typedef IShader SEntity;
typedef core::array < SEntity > tQ3EntityList;
@ -546,16 +720,14 @@ namespace quake3
}
inline core::stringc & dumpShader ( core::stringc &dest, const SShader * shader )
inline core::stringc & dumpShader ( core::stringc &dest, const IShader * shader )
{
dest = "";
if ( 0 == shader )
return dest;
const SVarGroup * group;
const u32 size = shader->VarGroup->VariableGroup.size ();
for ( u32 i = 0; i != size; ++i )
{
group = &shader->VarGroup->VariableGroup[ i ];
@ -600,15 +772,76 @@ namespace quake3
video::ITexture* texture = 0;
for ( u32 g = 0; g != 2 ; ++g )
{
core::cutFilenameExtension ( loadFile, stringList[i] ).append ( extension[g] );
core::cutFilenameExtension ( loadFile, stringList[i] );
if ( fileSystem->existFile ( loadFile.c_str() ) )
if ( loadFile == "$whiteimage" )
{
texture = driver->getTexture( loadFile.c_str () );
if ( texture )
texture = driver->getTexture( "$whiteimage" );
if ( 0 == texture )
{
break;
core::dimension2du s ( 2, 2 );
u32 image[4] = { 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF };
video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
texture = driver->addTexture( "$whiteimage", w );
w->drop ();
}
}
else
if ( loadFile == "$redimage" )
{
texture = driver->getTexture( "$redimage" );
if ( 0 == texture )
{
core::dimension2du s ( 2, 2 );
u32 image[4] = { 0xFFFF0000, 0xFFFF0000,0xFFFF0000,0xFFFF0000 };
video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
texture = driver->addTexture( "$redimage", w );
w->drop ();
}
}
else
if ( loadFile == "$blueimage" )
{
texture = driver->getTexture( "$blueimage" );
if ( 0 == texture )
{
core::dimension2du s ( 2, 2 );
u32 image[4] = { 0xFF0000FF, 0xFF0000FF,0xFF0000FF,0xFF0000FF };
video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
texture = driver->addTexture( "$blueimage", w );
w->drop ();
}
}
else
if ( loadFile == "$checkerimage" )
{
texture = driver->getTexture( "$checkerimage" );
if ( 0 == texture )
{
core::dimension2du s ( 2, 2 );
u32 image[4] = { 0xFFFFFFFF, 0xFF000000,0xFF000000,0xFFFFFFFF };
video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
texture = driver->addTexture( "$checkerimage", w );
w->drop ();
}
}
else
if ( loadFile == "$lightmap" )
{
texture = 0;
}
else
{
loadFile.append ( extension[g] );
}
if ( fileSystem->existFile ( loadFile ) )
{
texture = driver->getTexture( loadFile );
if ( texture )
break;
texture = 0;
}
}
// take 0 Texture

View File

@ -7,6 +7,7 @@
#include "IReferenceCounted.h"
#include "irrArray.h"
#include "irrString.h"
#include "vector3d.h"
#include "dimension2d.h"
#include "SColor.h"
@ -83,6 +84,9 @@ namespace scene
//! Transparent scene nodes, drawn after shadow nodes. They are sorted from back to front and drawn in that order.
ESNRP_TRANSPARENT,
//! Transparent effect scene nodes, drawn after Transparent nodes. They are sorted from back to front and drawn in that order.
ESNRP_TRANSPARENT_EFFECT,
//! Never used, value specifing how much parameters there are.
ESNRP_COUNT
};
@ -117,7 +121,7 @@ namespace scene
namespace quake3
{
class SShader;
struct IShader;
} // end namespace quake3
//! The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff.
@ -157,7 +161,7 @@ namespace scene
* <TR>
* <TD>3D Studio (.3ds)</TD>
* <TD>Loader for 3D-Studio files which lots of 3D packages
* are able to export. Only static meshes are currently
* are able to export. Only static meshes are currently
* supported by this importer. </TD>
* </TR>
* <TR>
@ -171,7 +175,7 @@ namespace scene
* architecture and calculating lighting. Irrlicht can
* directly import .csm files thanks to the IrrCSM library
* created by Saurav Mohapatra which is now integrated
* directly in Irrlicht. If you are using this loader,
* directly in Irrlicht. If you are using this loader,
* please note that you'll have to set the path of the
* textures before loading .csm files. You can do this
* using
@ -181,51 +185,52 @@ namespace scene
* <TR>
* <TD>COLLADA (.dae, .xml)</TD>
* <TD>COLLADA is an open Digital Asset Exchange Schema for
* the interactive 3D industry. There are exporters and
* importers for this format available for most of the
* big 3d packagesat http://collada.org. Irrlicht can
* import COLLADA files by using the
* ISceneManager::getMesh() method. COLLADA files need
* not contain only one single mesh but multiple meshes
* and a whole scene setup with lights, cameras and mesh
* instances, this loader can set up a scene as
* described by the COLLADA file instead of loading and
* returning one single mesh. By default, this loader
* behaves like the other loaders and does not create
* instances, but it can be switched into this mode by
* using
* SceneManager->getParameters()->setParameter(COLLADA_CREATE_SCENE_INSTANCES, true);
* Created scene nodes will be named as the names of the
* nodes in the COLLADA file. The returned mesh is just
* a dummy object in this mode. Meshes included in the
* scene will be added into the scene manager with the
* following naming scheme:
* path/to/file/file.dea#meshname. The loading of such
* meshes is logged. Currently, this loader is able to
* create meshes (made of only polygons), lights, and
* cameras. Materials and animations are currently not
* supported but this will change with future releases.
* the interactive 3D industry. There are exporters and
* importers for this format available for most of the
* big 3d packagesat http://collada.org. Irrlicht can
* import COLLADA files by using the
* ISceneManager::getMesh() method. COLLADA files need
* not contain only one single mesh but multiple meshes
* and a whole scene setup with lights, cameras and mesh
* instances, this loader can set up a scene as
* described by the COLLADA file instead of loading and
* returning one single mesh. By default, this loader
* behaves like the other loaders and does not create
* instances, but it can be switched into this mode by
* using
* SceneManager->getParameters()->setParameter(COLLADA_CREATE_SCENE_INSTANCES, true);
* Created scene nodes will be named as the names of the
* nodes in the COLLADA file. The returned mesh is just
* a dummy object in this mode. Meshes included in the
* scene will be added into the scene manager with the
* following naming scheme:
* path/to/file/file.dea#meshname. The loading of such
* meshes is logged. Currently, this loader is able to
* create meshes (made of only polygons), lights, and
* cameras. Materials and animations are currently not
* supported but this will change with future releases.
* </TD>
* </TR>
* <TR>
* <TD>Delgine DeleD (.dmf)</TD>
* <TD>DeleD (delgine.com) is a 3D editor and level-editor
* combined into one and is specifically designed for 3D
* game-development. With this loader, it is possible to
* directly load all geometry is as well as textures and
* lightmaps from .dmf files. To set texture and
* material paths, see scene::DMF_USE_MATERIALS_DIRS and
* scene::DMF_TEXTURE_PATH. It is also possible to flip
* the alpha texture by setting
* scene::DMF_FLIP_ALPHA_TEXTURES to true and to set the
* material transparent reference value by setting
* scene::DMF_ALPHA_CHANNEL_REF to a float between 0 and
* 1. The loader is based on Salvatore Russo's .dmf
* loader, I just changed some parts of it. Thanks to
* Salvatore for his work and for allowing me to use his
* code in Irrlicht and put it under Irrlicht's license.
* For newer and more enchanced versions of the loader,
* take a look at delgine.com.</TD>
* combined into one and is specifically designed for 3D
* game-development. With this loader, it is possible to
* directly load all geometry is as well as textures and
* lightmaps from .dmf files. To set texture and
* material paths, see scene::DMF_USE_MATERIALS_DIRS and
* scene::DMF_TEXTURE_PATH. It is also possible to flip
* the alpha texture by setting
* scene::DMF_FLIP_ALPHA_TEXTURES to true and to set the
* material transparent reference value by setting
* scene::DMF_ALPHA_CHANNEL_REF to a float between 0 and
* 1. The loader is based on Salvatore Russo's .dmf
* loader, I just changed some parts of it. Thanks to
* Salvatore for his work and for allowing me to use his
* code in Irrlicht and put it under Irrlicht's license.
* For newer and more enchanced versions of the loader,
* take a look at delgine.com.
* </TD>
* </TR>
* <TR>
* <TD>DirectX (.x)</TD>
@ -234,7 +239,7 @@ namespace scene
* and there are several tools for them available, e.g.
* the Maya exporter included in the DX SDK.
* .x files can include skeletal animations and Irrlicht
* is able to play and display them. Currently, Irrlicht
* is able to play and display them. Currently, Irrlicht
* only supports uncompressed .x files.</TD>
* </TR>
* <TR>
@ -249,82 +254,83 @@ namespace scene
* <TD>.MS3D files contain models and sometimes skeletal
* animations from the Milkshape 3D modeling and animation
* software. This importer for Irrlicht can display and/or
* animate these files. </TD>
* animate these files. </TD>
* </TR>
* <TR>
* <TD>My3D (.my3d)</TD>
* <TD>.my3D is a flexible 3D file format. The My3DTools
* contains plug-ins to export .my3D files from several
* 3D packages. With this built-in importer, Irrlicht
* can read and display those files directly. This
* loader was written by Zhuck Dimitry who also created
* the whole My3DTools package. If you are using this
* loader, please note that you can set the path of the
* textures before loading .my3d files. You can do this
* using
* SceneManager-&gt;getParameters()-&gt;setParameter(scene::MY3D_TEXTURE_PATH,
* &quot;path/to/your/textures&quot;);</TD>
* </TR>
* <TR>
* <TD>OCT (.oct)</TD>
* <TD>The oct file format contains 3D geometry and
* lightmaps and can be loaded directly by Irrlicht. OCT
* files<br> can be created by FSRad, Paul Nette's
* radiosity processor or exported from Blender using
* OCTTools which can be found in the exporters/OCTTools
* directory of the SDK. Thanks to Murphy McCauley for
* creating all this.</TD>
* </TR>
* <TR>
* <TD>OGRE Meshes (.mesh)</TD>
* <TD>Ogre .mesh files contain 3D data for the OGRE 3D
* engine. Irrlicht can read and display them directly
* with this importer. To define materials for the mesh,
* copy a .material file named like the corresponding
* .mesh file where the .mesh file is. (For example
* ogrehead.material for ogrehead.mesh). Thanks to
* Christian Stehno who wrote and contributed this
* loader.</TD>
* </TR>
* <TR>
* <TD>Pulsar LMTools (.lmts)</TD>
* <TD>LMTools is a set of tools (Windows &amp; Linux) for
* creating lightmaps. Irrlicht can directly read .lmts
* files thanks to<br> the importer created by Jonas
* Petersen. If you are using this loader, please note
* that you can set the path of the textures before
* loading .lmts files. You can do this using
* SceneManager-&gt;getParameters()-&gt;setParameter(scene::LMTS_TEXTURE_PATH,
* &quot;path/to/your/textures&quot;);
* Notes for<br> this version of the loader:<br>
* - It does not recognise/support user data in the
* *.lmts files.<br>
* - The TGAs generated by LMTools don't work in
* Irrlicht for some reason (the textures are upside
* down). Opening and resaving them in a graphics app
* will solve the problem.</TD>
* </TR>
* <TR>
* <TD>Quake 3 levels (.bsp)</TD>
* <TD>Quake 3 is a popular game by IDSoftware, and .pk3
* files contain .bsp files and textures/lightmaps
* describing huge prelighted levels. Irrlicht can read
* .pk3 and .bsp files directly and thus render Quake 3
* levels directly. Written by Nikolaus Gebhardt
* enhanced by Dean P. Macri with the curved surfaces
* feature.</TD>
* </TR>
* <TR>
* <TD>Quake 2 models (.md2)</TD>
* <TD>Quake 2 models are characters with morph target
* animation. Irrlicht can read, display and animate
* them directly with this importer. </TD>
* </TR>
* </TABLE>
* <TD>My3D (.my3d)</TD>
* <TD>.my3D is a flexible 3D file format. The My3DTools
* contains plug-ins to export .my3D files from several
* 3D packages. With this built-in importer, Irrlicht
* can read and display those files directly. This
* loader was written by Zhuck Dimitry who also created
* the whole My3DTools package. If you are using this
* loader, please note that you can set the path of the
* textures before loading .my3d files. You can do this
* using
* SceneManager-&gt;getParameters()-&gt;setParameter(scene::MY3D_TEXTURE_PATH,
* &quot;path/to/your/textures&quot;);
* </TD>
* </TR>
* <TR>
* <TD>OCT (.oct)</TD>
* <TD>The oct file format contains 3D geometry and
* lightmaps and can be loaded directly by Irrlicht. OCT
* files<br> can be created by FSRad, Paul Nette's
* radiosity processor or exported from Blender using
* OCTTools which can be found in the exporters/OCTTools
* directory of the SDK. Thanks to Murphy McCauley for
* creating all this.</TD>
* </TR>
* <TR>
* <TD>OGRE Meshes (.mesh)</TD>
* <TD>Ogre .mesh files contain 3D data for the OGRE 3D
* engine. Irrlicht can read and display them directly
* with this importer. To define materials for the mesh,
* copy a .material file named like the corresponding
* .mesh file where the .mesh file is. (For example
* ogrehead.material for ogrehead.mesh). Thanks to
* Christian Stehno who wrote and contributed this
* loader.</TD>
* </TR>
* <TR>
* <TD>Pulsar LMTools (.lmts)</TD>
* <TD>LMTools is a set of tools (Windows &amp; Linux) for
* creating lightmaps. Irrlicht can directly read .lmts
* files thanks to<br> the importer created by Jonas
* Petersen. If you are using this loader, please note
* that you can set the path of the textures before
* loading .lmts files. You can do this using
* SceneManager-&gt;getParameters()-&gt;setParameter(scene::LMTS_TEXTURE_PATH,
* &quot;path/to/your/textures&quot;);
* Notes for<br> this version of the loader:<br>
* - It does not recognise/support user data in the
* *.lmts files.<br>
* - The TGAs generated by LMTools don't work in
* Irrlicht for some reason (the textures are upside
* down). Opening and resaving them in a graphics app
* will solve the problem.</TD>
* </TR>
* <TR>
* <TD>Quake 3 levels (.bsp)</TD>
* <TD>Quake 3 is a popular game by IDSoftware, and .pk3
* files contain .bsp files and textures/lightmaps
* describing huge prelighted levels. Irrlicht can read
* .pk3 and .bsp files directly and thus render Quake 3
* levels directly. Written by Nikolaus Gebhardt
* enhanced by Dean P. Macri with the curved surfaces
* feature. </TD>
* </TR>
* <TR>
* <TD>Quake 2 models (.md2)</TD>
* <TD>Quake 2 models are characters with morph target
* animation. Irrlicht can read, display and animate
* them directly with this importer. </TD>
* </TR>
* </TABLE>
*
* To load and display a mesh quickly, just do this:
* \code
* SceneManager->addAnimatedMeshSceneNode(
* To load and display a mesh quickly, just do this:
* \code
* SceneManager->addAnimatedMeshSceneNode(
* SceneManager->getMesh("yourmesh.3ds"));
* \endcode
* If you would like to implement and add your own file format loader to Irrlicht,
@ -333,13 +339,13 @@ namespace scene
* \return Null if failed, otherwise pointer to the mesh.
* This pointer should not be dropped. See IReferenceCounted::drop() for more information.
**/
virtual IAnimatedMesh* getMesh(const c8* filename) = 0;
virtual IAnimatedMesh* getMesh(const core::string<c16>& filename) = 0;
//! Get pointer to an animateable mesh. Loads the file if not loaded already.
/** Works just as getMesh(const char* filename). If you want to
remove a loaded mesh from the cache again, use removeMesh().
\param file File handle of the mesh to load.
\return 0 if failed and pointer to the mesh if successful.
\return NULL if failed and pointer to the mesh if successful.
This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0;
@ -364,8 +370,8 @@ namespace scene
/** Example Usage:
scene::IVolumeLightSceneNode * n = smgr->addVolumeLightSceneNode(NULL, -1,
32, 32, //Subdivide U/V
video::SColor(0, 180, 180, 180), //foot color
video::SColor(0, 0, 0, 0) //tail color
video::SColor(0, 180, 180, 180), //foot color
video::SColor(0, 0, 0, 0) //tail color
);
if (n)
{
@ -529,52 +535,49 @@ namespace scene
const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1) = 0;
//! Adds a maya style user controlled camera scene node to the scene graph.
/** This is a standard camera with an animator that provides
mouse control similar to camera in the 3D Software Maya.
\param parent: Parent scene node of the camera. Can be null.
\param rotateSpeed: Rotation speed of the camera.
\param zoomSpeed: Zoom speed of the camera.
\param translationSpeed: Translation speed of the camera.
\param id: id of the camera. This id can be used to identify the camera.
\return Pointer to the interface of the camera if successful, otherwise 0.
This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
/** This is a standard camera with an animator that provides mouse control similar
to camera in the 3D Software Maya by Alias Wavefront.
\param parent: Parent scene node of the camera. Can be null.
\param rotateSpeed: Rotation speed of the camera.
\param zoomSpeed: Zoom speed of the camera.
\param translationSpeed: TranslationSpeed of the camera.
\param id: id of the camera. This id can be used to identify the camera.
\return Returns a pointer to the interface of the camera if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f,
f32 translationSpeed = 1500.0f, s32 id=-1) = 0;
//! Adds a camera scene node with an animator which provides mouse and keyboard control appropriate for first person shooters (FPS).
/** This FPS camera is intended to provide a demonstration of a
camera that behaves like a typical First Person Shooter. It is
useful for simple demos and prototyping but is not intended to
provide a full solution for a production quality game. It binds
the camera scene node rotation to the look-at target; @see
ICameraSceneNode::bindTargetAndRotation(). With this camera,
you look with the mouse, and move with cursor keys. If you want
to change the key layout, you can specify your own keymap. For
example to make the camera be controlled by the cursor keys AND
the keys W,A,S, and D, do something like this:
\code
SKeyMap keyMap[8];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_FORWARD;
keyMap[1].KeyCode = KEY_KEY_W;
/** This FPS camera is intended to provide a demonstration of a camera that behaves
like a typical First Person Shooter. It is useful for simple demos and prototyping but is not
intended to provide a full solution for a production quality game. It binds the camera scene node
rotation to the look-at target; @see ICameraSceneNode::bindTargetAndRotation().
With this camera, you look with the mouse, and move with cursor keys. If you want to
change the key layout, you can specify your own keymap. For example to make the camera
be controlled by the cursor keys AND the keys W,A,S, and D, do something
like this:
\code
SKeyMap keyMap[8];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_FORWARD;
keyMap[1].KeyCode = KEY_KEY_W;
keyMap[2].Action = EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = KEY_DOWN;
keyMap[3].Action = EKA_MOVE_BACKWARD;
keyMap[3].KeyCode = KEY_KEY_S;
keyMap[2].Action = EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = KEY_DOWN;
keyMap[3].Action = EKA_MOVE_BACKWARD;
keyMap[3].KeyCode = KEY_KEY_S;
keyMap[4].Action = EKA_STRAFE_LEFT;
keyMap[4].KeyCode = KEY_LEFT;
keyMap[5].Action = EKA_STRAFE_LEFT;
keyMap[5].KeyCode = KEY_KEY_A;
keyMap[4].Action = EKA_STRAFE_LEFT;
keyMap[4].KeyCode = KEY_LEFT;
keyMap[5].Action = EKA_STRAFE_LEFT;
keyMap[5].KeyCode = KEY_KEY_A;
keyMap[6].Action = EKA_STRAFE_RIGHT;
keyMap[6].KeyCode = KEY_RIGHT;
keyMap[7].Action = EKA_STRAFE_RIGHT;
keyMap[7].KeyCode = KEY_KEY_D;
keyMap[6].Action = EKA_STRAFE_RIGHT;
keyMap[6].KeyCode = KEY_RIGHT;
keyMap[7].Action = EKA_STRAFE_RIGHT;
keyMap[7].KeyCode = KEY_KEY_D;
camera = sceneManager->addCameraSceneNodeFPS(0, 100, 500, -1, keyMap, 8);
\endcode
@ -602,7 +605,7 @@ namespace scene
This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, s32 id=-1,
f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
f32 jumpSpeed = 0.f, bool invertMouse=false) = 0;
@ -682,7 +685,7 @@ namespace scene
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
u32 horiRes=16, u32 vertRes=8,
f64 texturePercentage=0.9, f64 spherePercentage=2.0,
f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f,
ISceneNode* parent=0, s32 id=-1) = 0;
//! Adds a particle system scene node to the scene graph.
@ -761,7 +764,7 @@ namespace scene
not be dropped. See IReferenceCounted::drop() for more
information. */
virtual ITerrainSceneNode* addTerrainSceneNode(
const c8* heightMapFileName,
const core::string<c16>& heightMapFileName,
ISceneNode* parent=0, s32 id=-1,
const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
@ -812,7 +815,7 @@ namespace scene
/** A Quake3 Scene renders multiple meshes for a specific HighLanguage Shader (Quake3 Style )
\return Pointer to the quake3 scene node if successful, otherwise NULL.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::SShader * shader,
virtual IMeshSceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::IShader * shader,
ISceneNode* parent=0, s32 id=-1
) = 0;
@ -840,11 +843,11 @@ namespace scene
ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0),
s32 id=-1) = 0;
//! Adds a text scene node, which uses billboards. The node, and the text on it, will scale with distance.
//! Adds a text scene node, which uses billboards. The node, and the text on it, will scale with distance.
/**
\param font The font to use on the billboard. Pass 0 to use the GUI environment's default font.
\param text The text to display on the billboard.
\param parent The billboard's parent. Pass 0 to use the root scene node.
\param parent The billboard's parent. Pass 0 to use the root scene node.
\param size The billboard's width and height.
\param position The billboards position relative to its parent.
\param id: An id of the node. This id can be used to identify the node.
@ -885,7 +888,7 @@ namespace scene
specified some invalid parameters or that a mesh with that name already
exists. If successful, a pointer to the mesh is returned.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh* addHillPlaneMesh(const c8* name,
virtual IAnimatedMesh* addHillPlaneMesh(const core::string<c16>& name,
const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
video::SMaterial* material = 0, f32 hillHeight = 0.0f,
const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f),
@ -914,7 +917,7 @@ namespace scene
specified some invalid parameters, that a mesh with that name already
exists, or that a texture could not be found. If successful, a pointer to the mesh is returned.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh* addTerrainMesh(const c8* meshname,
virtual IAnimatedMesh* addTerrainMesh(const core::string<c16>& meshname,
video::IImage* texture, video::IImage* heightmap,
const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f),
f32 maxHeight=200.0f,
@ -932,7 +935,7 @@ namespace scene
\param width1 Diameter of the cone's base, should be not smaller than the cylinder's diameter
\return Pointer to the arrow mesh if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh* addArrowMesh(const c8* name,
virtual IAnimatedMesh* addArrowMesh(const core::string<c16>& name,
video::SColor vtxColor0=0xFFFFFFFF,
video::SColor vtxColor1=0xFFFFFFFF,
u32 tesselationCylinder=4, u32 tesselationCone=8,
@ -946,7 +949,7 @@ namespace scene
\param polyCountY Number of quads used for the vertical tiling
\return Pointer to the sphere mesh if successful, otherwise 0.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IAnimatedMesh* addSphereMesh(const c8* name,
virtual IAnimatedMesh* addSphereMesh(const c16* name,
f32 radius=5.f, u32 polyCountX = 16,
u32 polyCountY = 16) = 0;
@ -1354,7 +1357,7 @@ namespace scene
file, implement the ISceneUserDataSerializer interface and provide it as parameter here.
Otherwise, simply specify 0 as this parameter.
\return True if successful. */
virtual bool saveScene(const c8* filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
virtual bool saveScene(const core::string<c16>& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
//! Saves the current scene into a file.
/** Scene nodes with the option isDebugObject set to true are not being saved.
@ -1379,7 +1382,7 @@ namespace scene
as parameter here. Otherwise, simply specify 0 as this
parameter.
\return True if successful. */
virtual bool loadScene(const c8* filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
virtual bool loadScene(const core::string<c16>& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
//! Loads a scene. Note that the current scene is not cleared before.
/** The scene is usually load from an .irr file, an xml based format. .irr files can

View File

@ -188,19 +188,7 @@ namespace video
\return Pointer to the texture, or 0 if the texture
could not be loaded. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual ITexture* getTexture(const c8* filename) =0;
//! Get access to a named texture.
/** Loads the texture from disk if it is not
already loaded and generates mipmap levels if desired.
Texture loading can be influenced using the
setTextureCreationFlag() method. The texture can be in several
imageformats, such as BMP, JPG, TGA, PCX, PNG, and PSD.
\param filename Filename of the texture to be loaded.
\return Pointer to the texture, or 0 if the texture
could not be loaded. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual ITexture* getTexture(const core::stringc& filename) =0;
virtual ITexture* getTexture(const core::string<c16>& filename) = 0;
//! Get access to a named texture.
/** Loads the texture from disk if it is not
@ -230,7 +218,7 @@ namespace video
//! Renames a texture
/** \param texture Pointer to the texture to rename.
\param newName New name for the texture. This should be a unique name. */
virtual void renameTexture(ITexture* texture, const c8* newName) =0;
virtual void renameTexture(ITexture* texture, const core::string<c16>& newName) = 0;
//! Creates an empty texture of specified size.
/** \param size: Size of the texture.
@ -243,7 +231,7 @@ namespace video
should not be dropped. See IReferenceCounted::drop() for more
information. */
virtual ITexture* addTexture(const core::dimension2d<u32>& size,
const c8* name, ECOLOR_FORMAT format = ECF_A8R8G8B8) =0;
const core::string<c16>& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;
//! Creates a texture from an IImage.
/** \param name A name for the texture. Later calls of
@ -252,7 +240,7 @@ namespace video
\return Pointer to the newly created texture. This pointer
should not be dropped. See IReferenceCounted::drop() for more
information. */
virtual ITexture* addTexture(const c8* name, IImage* image) =0;
virtual ITexture* addTexture(const core::string<c16>& name, IImage* image) = 0;
//! Adds a new render target texture to the texture cache.
/** \param size Size of the texture, in pixels. Width and
@ -264,12 +252,7 @@ namespace video
could not be created. This pointer should not be dropped. See
IReferenceCounted::drop() for more information. */
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
const c8* name=0) =0;
//! Adds a new render target texture
/** \deprecated use addRenderTargetTexture instead. */
virtual ITexture* createRenderTargetTexture(const core::dimension2d<u32>& size,
const c8* name=0) =0;
const core::string<c16>& name = "rt" ) =0;
//! Removes a texture from the texture cache and deletes it.
/** This method can free a lot of memory!
@ -349,7 +332,7 @@ namespace video
way:
\code
// create render target
ITexture* target = driver->addRenderTargetTexture(core::dimension2d<s32>(128,128), "rtt1");
ITexture* target = driver->addRenderTargetTexture(core::dimension2d<u32>(128,128), "rtt1");
// ...
@ -854,7 +837,7 @@ namespace video
\return The created image.
If you no longer need the image, you should call IImage::drop().
See IReferenceCounted::drop() for more information. */
virtual IImage* createImageFromFile(const c8* filename) =0;
virtual IImage* createImageFromFile(const core::string<c16>& filename) = 0;
//! Creates a software image from a file.
/** No hardware texture will be created for this image. This
@ -874,7 +857,7 @@ namespace video
\param param Control parameter for the backend (e.g. compression
level).
\return True on successful write. */
virtual bool writeImageToFile(IImage* image, const c8* filename, u32 param =0) =0;
virtual bool writeImageToFile(IImage* image, const core::string<c16>& filename, u32 param = 0) = 0;
//! Writes the provided image to a file.
/** Requires that there is a suitable image writer registered
@ -1052,7 +1035,7 @@ namespace video
if it is not currently loaded.
\param filename Name of the texture.
\return Pointer to loaded texture, or 0 if not found. */
virtual video::ITexture* findTexture(const c8* filename) =0;
virtual video::ITexture* findTexture(const core::string<c16>& filename) = 0;
//! Set or unset a clipping plane.
/** There are at least 6 clipping planes available for the user

BIN
media/irrlichtlogo3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
media/skydome2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
media/smoke2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
media/smoke3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB