2009-01-14 04:37:51 -08:00
|
|
|
// Copyright (C) 2002-2009 Nikolaus Gebhardt
|
2007-05-20 11:03:49 -07:00
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
|
|
|
#include "CNullDriver.h"
|
|
|
|
#include "os.h"
|
|
|
|
#include "CImage.h"
|
|
|
|
#include "CAttributes.h"
|
|
|
|
#include "IReadFile.h"
|
|
|
|
#include "IWriteFile.h"
|
|
|
|
#include "IImageLoader.h"
|
|
|
|
#include "IImageWriter.h"
|
|
|
|
#include "IMaterialRenderer.h"
|
2008-08-13 16:48:33 -07:00
|
|
|
#include "CMeshManipulator.h"
|
2009-07-25 07:13:43 -07:00
|
|
|
#include "CColorConverter.h"
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace video
|
|
|
|
{
|
|
|
|
|
|
|
|
//! creates a loader which is able to load windows bitmaps
|
|
|
|
IImageLoader* createImageLoaderBMP();
|
|
|
|
|
|
|
|
//! creates a loader which is able to load jpeg images
|
|
|
|
IImageLoader* createImageLoaderJPG();
|
|
|
|
|
|
|
|
//! creates a loader which is able to load targa images
|
|
|
|
IImageLoader* createImageLoaderTGA();
|
|
|
|
|
|
|
|
//! creates a loader which is able to load psd images
|
|
|
|
IImageLoader* createImageLoaderPSD();
|
|
|
|
|
|
|
|
//! creates a loader which is able to load pcx images
|
|
|
|
IImageLoader* createImageLoaderPCX();
|
|
|
|
|
|
|
|
//! creates a loader which is able to load png images
|
|
|
|
IImageLoader* createImageLoaderPNG();
|
|
|
|
|
2007-11-21 15:27:21 -08:00
|
|
|
//! creates a loader which is able to load WAL images
|
|
|
|
IImageLoader* createImageLoaderWAL();
|
|
|
|
|
2007-09-21 11:11:00 -07:00
|
|
|
//! creates a loader which is able to load ppm/pgm/pbm images
|
|
|
|
IImageLoader* createImageLoaderPPM();
|
|
|
|
|
2009-03-09 15:15:34 -07:00
|
|
|
//! creates a loader which is able to load rgb images
|
|
|
|
IImageLoader* createImageLoaderRGB();
|
|
|
|
|
|
|
|
|
|
|
|
//! creates a writer which is able to save bmp images
|
2007-05-20 11:03:49 -07:00
|
|
|
IImageWriter* createImageWriterBMP();
|
|
|
|
|
2009-03-09 15:15:34 -07:00
|
|
|
//! creates a writer which is able to save jpg images
|
2007-05-20 11:03:49 -07:00
|
|
|
IImageWriter* createImageWriterJPG();
|
|
|
|
|
2009-03-09 15:15:34 -07:00
|
|
|
//! creates a writer which is able to save tga images
|
2007-05-20 11:03:49 -07:00
|
|
|
IImageWriter* createImageWriterTGA();
|
|
|
|
|
2009-03-09 15:15:34 -07:00
|
|
|
//! creates a writer which is able to save psd images
|
2007-05-20 11:03:49 -07:00
|
|
|
IImageWriter* createImageWriterPSD();
|
|
|
|
|
2009-03-09 15:15:34 -07:00
|
|
|
//! creates a writer which is able to save pcx images
|
2007-05-20 11:03:49 -07:00
|
|
|
IImageWriter* createImageWriterPCX();
|
|
|
|
|
2009-03-09 15:15:34 -07:00
|
|
|
//! creates a writer which is able to save png images
|
2007-05-20 11:03:49 -07:00
|
|
|
IImageWriter* createImageWriterPNG();
|
|
|
|
|
2009-03-09 15:15:34 -07:00
|
|
|
//! creates a writer which is able to save ppm images
|
2007-05-20 11:03:49 -07:00
|
|
|
IImageWriter* createImageWriterPPM();
|
|
|
|
|
|
|
|
|
|
|
|
//! constructor
|
2009-01-19 05:48:22 -08:00
|
|
|
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize)
|
2008-08-13 16:48:33 -07:00
|
|
|
: FileSystem(io), MeshManipulator(0), ViewPort(0,0,0,0), ScreenSize(screenSize),
|
2009-01-23 08:43:04 -08:00
|
|
|
PrimitivesDrawn(0), MinVertexCountForVBO(500), TextureCreationFlags(0),
|
2009-12-07 16:42:45 -08:00
|
|
|
InitMaterial2DEnabled(false), AllowZWriteOnTransparent(false)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
|
|
setDebugName("CNullDriver");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
setFog();
|
|
|
|
|
|
|
|
setTextureCreationFlag(ETCF_ALWAYS_32_BIT, true);
|
|
|
|
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, true);
|
|
|
|
|
2009-01-19 05:48:22 -08:00
|
|
|
ViewPort = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(screenSize));
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2008-08-13 16:48:33 -07:00
|
|
|
// create manipulator
|
|
|
|
MeshManipulator = new scene::CMeshManipulator();
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
if (FileSystem)
|
|
|
|
FileSystem->grab();
|
|
|
|
|
|
|
|
// create surface loader
|
|
|
|
|
2007-09-21 17:10:21 -07:00
|
|
|
#ifdef _IRR_COMPILE_WITH_BMP_LOADER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceLoader.push_back(video::createImageLoaderBMP());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_JPG_LOADER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceLoader.push_back(video::createImageLoaderJPG());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_TGA_LOADER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceLoader.push_back(video::createImageLoaderTGA());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PSD_LOADER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceLoader.push_back(video::createImageLoaderPSD());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PCX_LOADER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceLoader.push_back(video::createImageLoaderPCX());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PNG_LOADER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceLoader.push_back(video::createImageLoaderPNG());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
2007-11-21 15:27:21 -08:00
|
|
|
#ifdef _IRR_COMPILE_WITH_WAL_LOADER_
|
|
|
|
SurfaceLoader.push_back(video::createImageLoaderWAL());
|
|
|
|
#endif
|
2007-09-21 17:10:21 -07:00
|
|
|
#ifdef _IRR_COMPILE_WITH_PPM_LOADER_
|
2007-09-21 11:11:00 -07:00
|
|
|
SurfaceLoader.push_back(video::createImageLoaderPPM());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
2009-03-09 15:15:34 -07:00
|
|
|
#ifdef _IRR_COMPILE_WITH_RGB_LOADER_
|
|
|
|
SurfaceLoader.push_back(video::createImageLoaderRGB());
|
|
|
|
#endif
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2007-09-21 17:10:21 -07:00
|
|
|
#ifdef _IRR_COMPILE_WITH_BMP_WRITER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceWriter.push_back(video::createImageWriterBMP());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_JPG_WRITER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceWriter.push_back(video::createImageWriterJPG());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_TGA_WRITER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceWriter.push_back(video::createImageWriterTGA());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PSD_WRITER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceWriter.push_back(video::createImageWriterPSD());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PCX_WRITER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceWriter.push_back(video::createImageWriterPCX());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PNG_WRITER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceWriter.push_back(video::createImageWriterPNG());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
|
|
|
#ifdef _IRR_COMPILE_WITH_PPM_WRITER_
|
2007-05-20 11:03:49 -07:00
|
|
|
SurfaceWriter.push_back(video::createImageWriterPPM());
|
2007-09-21 17:10:21 -07:00
|
|
|
#endif
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
// set ExposedData to 0
|
|
|
|
memset(&ExposedData, 0, sizeof(ExposedData));
|
2008-09-26 13:29:45 -07:00
|
|
|
for (u32 i=0; i<video::EVDF_COUNT; ++i)
|
|
|
|
FeatureEnabled[i]=true;
|
2009-12-07 16:42:45 -08:00
|
|
|
|
|
|
|
InitMaterial2D.AntiAliasing=video::EAAM_OFF;
|
|
|
|
InitMaterial2D.Lighting=false;
|
|
|
|
InitMaterial2D.ZWriteEnable=false;
|
|
|
|
InitMaterial2D.ZBuffer=video::ECFN_NEVER;
|
|
|
|
for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i)
|
|
|
|
{
|
|
|
|
InitMaterial2D.TextureLayer[i].BilinearFilter=false;
|
|
|
|
InitMaterial2D.TextureLayer[i].TextureWrapU=video::ETC_REPEAT;
|
|
|
|
InitMaterial2D.TextureLayer[i].TextureWrapV=video::ETC_REPEAT;
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! destructor
|
|
|
|
CNullDriver::~CNullDriver()
|
|
|
|
{
|
|
|
|
if (FileSystem)
|
|
|
|
FileSystem->drop();
|
|
|
|
|
2008-08-13 16:48:33 -07:00
|
|
|
if (MeshManipulator)
|
|
|
|
MeshManipulator->drop();
|
2007-05-20 11:03:49 -07:00
|
|
|
deleteAllTextures();
|
|
|
|
|
|
|
|
u32 i;
|
|
|
|
for (i=0; i<SurfaceLoader.size(); ++i)
|
|
|
|
SurfaceLoader[i]->drop();
|
|
|
|
|
|
|
|
for (i=0; i<SurfaceWriter.size(); ++i)
|
|
|
|
SurfaceWriter[i]->drop();
|
|
|
|
|
2008-01-13 20:58:32 -08:00
|
|
|
// delete material renderers
|
2007-05-20 11:03:49 -07:00
|
|
|
deleteMaterialRenders();
|
2008-01-13 20:58:32 -08:00
|
|
|
|
|
|
|
// delete hardware mesh buffers
|
|
|
|
removeAllHardwareBuffers();
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Adds an external surface loader to the engine.
|
|
|
|
void CNullDriver::addExternalImageLoader(IImageLoader* loader)
|
|
|
|
{
|
|
|
|
if (!loader)
|
|
|
|
return;
|
|
|
|
|
|
|
|
loader->grab();
|
|
|
|
SurfaceLoader.push_back(loader);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Adds an external surface writer to the engine.
|
|
|
|
void CNullDriver::addExternalImageWriter(IImageWriter* writer)
|
|
|
|
{
|
|
|
|
if (!writer)
|
|
|
|
return;
|
|
|
|
|
|
|
|
writer->grab();
|
|
|
|
SurfaceWriter.push_back(writer);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-31 09:01:45 -08:00
|
|
|
//! Retrieve the number of image loaders
|
|
|
|
u32 CNullDriver::getImageLoaderCount() const
|
|
|
|
{
|
|
|
|
return SurfaceLoader.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Retrieve the given image loader
|
|
|
|
IImageLoader* CNullDriver::getImageLoader(u32 n)
|
|
|
|
{
|
|
|
|
if(n < SurfaceLoader.size())
|
|
|
|
return SurfaceLoader[n];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Retrieve the number of image writers
|
|
|
|
u32 CNullDriver::getImageWriterCount() const
|
|
|
|
{
|
|
|
|
return SurfaceWriter.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Retrieve the given image writer
|
|
|
|
IImageWriter* CNullDriver::getImageWriter(u32 n)
|
|
|
|
{
|
|
|
|
if(n < SurfaceWriter.size())
|
|
|
|
return SurfaceWriter[n];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! deletes all textures
|
|
|
|
void CNullDriver::deleteAllTextures()
|
|
|
|
{
|
2009-03-17 10:42:34 -07:00
|
|
|
// we need to remove previously set textures which might otherwise be kept in the
|
|
|
|
// last set material member. Could be optimized to reduce state changes.
|
|
|
|
setMaterial(SMaterial());
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
for (u32 i=0; i<Textures.size(); ++i)
|
|
|
|
Textures[i].Surface->drop();
|
|
|
|
|
|
|
|
Textures.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! applications must call this method before performing any rendering. returns false if failed.
|
2008-09-27 06:19:29 -07:00
|
|
|
bool CNullDriver::beginScene(bool backBuffer, bool zBuffer, SColor color,
|
2009-12-06 14:17:52 -08:00
|
|
|
const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2008-09-27 06:19:29 -07:00
|
|
|
core::clearFPUException();
|
2007-05-20 11:03:49 -07:00
|
|
|
PrimitivesDrawn = 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! applications must call this method after performing any rendering. returns false if failed.
|
2008-09-27 06:19:29 -07:00
|
|
|
bool CNullDriver::endScene()
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
FPSCounter.registerFrame(os::Timer::getRealTime(), PrimitivesDrawn);
|
2007-12-05 06:10:28 -08:00
|
|
|
updateAllHardwareBuffers();
|
2007-05-20 11:03:49 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-26 13:29:45 -07:00
|
|
|
//! Disable a feature of the driver.
|
|
|
|
void CNullDriver::disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag)
|
|
|
|
{
|
|
|
|
FeatureEnabled[feature]=!flag;
|
|
|
|
}
|
2009-01-02 05:02:05 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! queries the features of the driver, returns true if feature is available
|
2007-09-17 09:09:50 -07:00
|
|
|
bool CNullDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! sets transformation
|
|
|
|
void CNullDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns the transformation set by setTransform
|
2007-09-17 09:09:50 -07:00
|
|
|
const core::matrix4& CNullDriver::getTransform(E_TRANSFORMATION_STATE state) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return TransformationMatrix;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! sets a material
|
|
|
|
void CNullDriver::setMaterial(const SMaterial& material)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Removes a texture from the texture cache and deletes it, freeing lot of
|
|
|
|
//! memory.
|
|
|
|
void CNullDriver::removeTexture(ITexture* texture)
|
|
|
|
{
|
2007-09-12 10:45:29 -07:00
|
|
|
if (!texture)
|
|
|
|
return;
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
for (u32 i=0; i<Textures.size(); ++i)
|
2008-07-25 09:52:43 -07:00
|
|
|
{
|
2007-05-20 11:03:49 -07:00
|
|
|
if (Textures[i].Surface == texture)
|
|
|
|
{
|
|
|
|
texture->drop();
|
|
|
|
Textures.erase(i);
|
|
|
|
}
|
2008-07-25 09:52:43 -07:00
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Removes all texture from the texture cache and deletes them, freeing lot of
|
|
|
|
//! memory.
|
|
|
|
void CNullDriver::removeAllTextures()
|
|
|
|
{
|
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-e03cc46cb475
2009-01-27 07:53:53 -08:00
|
|
|
setMaterial ( SMaterial() );
|
2007-05-20 11:03:49 -07:00
|
|
|
deleteAllTextures();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns a texture by index
|
|
|
|
ITexture* CNullDriver::getTextureByIndex(u32 i)
|
|
|
|
{
|
|
|
|
if ( i < Textures.size() )
|
|
|
|
return Textures[i].Surface;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns amount of textures currently loaded
|
2007-09-17 09:09:50 -07:00
|
|
|
u32 CNullDriver::getTextureCount() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return Textures.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Renames a texture
|
2009-08-24 02:12:27 -07:00
|
|
|
void CNullDriver::renameTexture(ITexture* texture, const io::path& newName)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
// we can do a const_cast here safely, the name of the ITexture interface
|
2007-09-12 10:45:29 -07:00
|
|
|
// is just readonly to prevent the user changing the texture name without invoking
|
|
|
|
// this method, because the textures will need resorting afterwards
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-12-05 20:52:15 -08:00
|
|
|
io::SNamedPath& name = const_cast<io::SNamedPath&>(texture->getName());
|
2009-12-07 14:45:39 -08:00
|
|
|
name.setPath(newName);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
Textures.sort();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! loads a Texture
|
2009-08-24 02:12:27 -07:00
|
|
|
ITexture* CNullDriver::getTexture(const io::path& filename)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2008-11-04 03:41:36 -08:00
|
|
|
// Identify textures by their absolute filenames if possible.
|
2009-08-24 02:12:27 -07:00
|
|
|
const io::path absolutePath = FileSystem->getAbsolutePath(filename);
|
2008-11-03 06:51:55 -08:00
|
|
|
|
2009-01-28 15:23:30 -08:00
|
|
|
ITexture* texture = findTexture(absolutePath);
|
2008-11-04 03:41:36 -08:00
|
|
|
if (texture)
|
|
|
|
return texture;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2008-11-04 03:41:36 -08:00
|
|
|
// Then try the raw filename, which might be in an Archive
|
|
|
|
texture = findTexture(filename);
|
2007-05-20 11:03:49 -07:00
|
|
|
if (texture)
|
|
|
|
return texture;
|
|
|
|
|
2008-11-04 03:41:36 -08:00
|
|
|
// Now try to open the file using the complete path.
|
2009-01-28 15:23:30 -08:00
|
|
|
io::IReadFile* file = FileSystem->createAndOpenFile(absolutePath);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2008-11-04 03:41:36 -08:00
|
|
|
if(!file)
|
|
|
|
{
|
|
|
|
// Try to open it using the raw filename.
|
|
|
|
file = FileSystem->createAndOpenFile(filename);
|
|
|
|
}
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
if (file)
|
|
|
|
{
|
2008-11-04 03:41:36 -08:00
|
|
|
texture = loadTextureFromFile(file);
|
2007-05-20 11:03:49 -07:00
|
|
|
file->drop();
|
|
|
|
|
|
|
|
if (texture)
|
|
|
|
{
|
|
|
|
addTexture(texture);
|
2007-09-08 15:37:57 -07:00
|
|
|
texture->drop(); // drop it because we created it, one grab too much
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
2008-01-29 16:07:52 -08:00
|
|
|
else
|
|
|
|
os::Printer::log("Could not load texture", filename, ELL_ERROR);
|
|
|
|
return texture;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-11-21 15:27:21 -08:00
|
|
|
os::Printer::log("Could not open file of texture", filename, ELL_WARNING);
|
2008-01-29 16:07:52 -08:00
|
|
|
return 0;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! loads a Texture
|
|
|
|
ITexture* CNullDriver::getTexture(io::IReadFile* file)
|
|
|
|
{
|
|
|
|
ITexture* texture = 0;
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
{
|
|
|
|
texture = findTexture(file->getFileName());
|
|
|
|
|
|
|
|
if (texture)
|
|
|
|
return texture;
|
|
|
|
|
2007-07-07 13:12:48 -07:00
|
|
|
texture = loadTextureFromFile(file);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
if (texture)
|
|
|
|
{
|
|
|
|
addTexture(texture);
|
|
|
|
texture->drop(); // drop it because we created it, one grab too much
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!texture)
|
2007-11-21 15:27:21 -08:00
|
|
|
os::Printer::log("Could not load texture", file->getFileName(), ELL_WARNING);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
return texture;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! opens the file and loads it into the surface
|
2009-08-24 02:12:27 -07:00
|
|
|
video::ITexture* CNullDriver::loadTextureFromFile(io::IReadFile* file, const io::path& hashName )
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
ITexture* texture = 0;
|
|
|
|
IImage* image = createImageFromFile(file);
|
|
|
|
|
|
|
|
if (image)
|
|
|
|
{
|
|
|
|
// create texture from surface
|
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-e03cc46cb475
2009-01-27 07:53:53 -08:00
|
|
|
texture = createDeviceDependentTexture(image, hashName.size() ? hashName : file->getFileName() );
|
2007-05-20 11:03:49 -07:00
|
|
|
os::Printer::log("Loaded texture", file->getFileName());
|
|
|
|
image->drop();
|
|
|
|
}
|
|
|
|
|
|
|
|
return texture;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! adds a surface, not loaded or created by the Irrlicht Engine
|
|
|
|
void CNullDriver::addTexture(video::ITexture* texture)
|
|
|
|
{
|
|
|
|
if (texture)
|
|
|
|
{
|
|
|
|
SSurface s;
|
|
|
|
s.Surface = texture;
|
|
|
|
texture->grab();
|
|
|
|
|
|
|
|
Textures.push_back(s);
|
|
|
|
|
|
|
|
// the new texture is now at the end of the texture list. when searching for
|
|
|
|
// the next new texture, the texture array will be sorted and the index of this texture
|
|
|
|
// will be changed. to let the order be more consistent to the user, sort
|
|
|
|
// the textures now already although this isn't necessary:
|
|
|
|
|
|
|
|
Textures.sort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! looks if the image is already loaded
|
2009-08-24 02:12:27 -07:00
|
|
|
video::ITexture* CNullDriver::findTexture(const io::path& filename)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
SSurface s;
|
|
|
|
SDummyTexture dummy(filename);
|
|
|
|
s.Surface = &dummy;
|
|
|
|
|
|
|
|
s32 index = Textures.binary_search(s);
|
|
|
|
if (index != -1)
|
|
|
|
return Textures[index].Surface;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Creates a texture from a loaded IImage.
|
2009-11-21 15:24:31 -08:00
|
|
|
ITexture* CNullDriver::addTexture(const io::path& name, IImage* image, void* mipmapData)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
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-e03cc46cb475
2009-01-27 07:53:53 -08:00
|
|
|
if ( 0 == name.size() || !image)
|
2007-05-20 11:03:49 -07:00
|
|
|
return 0;
|
|
|
|
|
2009-11-21 15:24:31 -08:00
|
|
|
ITexture* t = createDeviceDependentTexture(image, name, mipmapData);
|
2007-05-20 11:03:49 -07:00
|
|
|
if (t)
|
|
|
|
{
|
|
|
|
addTexture(t);
|
|
|
|
t->drop();
|
|
|
|
}
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! creates a Texture
|
2009-01-19 05:48:22 -08:00
|
|
|
ITexture* CNullDriver::addTexture(const core::dimension2d<u32>& size,
|
2009-08-24 02:12:27 -07:00
|
|
|
const io::path& name, ECOLOR_FORMAT format)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-08-03 15:01:23 -07:00
|
|
|
if(IImage::isRenderTargetOnlyFormat(format))
|
2009-05-24 02:35:39 -07:00
|
|
|
{
|
|
|
|
os::Printer::log("Could not create ITexture, format only supported for render target textures.", ELL_WARNING);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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-e03cc46cb475
2009-01-27 07:53:53 -08:00
|
|
|
if ( 0 == name.size () )
|
2007-05-20 11:03:49 -07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
IImage* image = new CImage(format, size);
|
|
|
|
ITexture* t = createDeviceDependentTexture(image, name);
|
|
|
|
image->drop();
|
|
|
|
addTexture(t);
|
|
|
|
|
|
|
|
if (t)
|
|
|
|
t->drop();
|
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! returns a device dependent texture from a software surface (IImage)
|
|
|
|
//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES
|
2009-11-21 15:24:31 -08:00
|
|
|
ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-05-17 16:37:02 -07:00
|
|
|
return new SDummyTexture(name);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-20 01:00:08 -08:00
|
|
|
//! set or reset special render targets
|
|
|
|
bool CNullDriver::setRenderTarget(video::E_RENDER_TARGET target, bool clearTarget,
|
|
|
|
bool clearZBuffer, SColor color)
|
|
|
|
{
|
|
|
|
if (ERT_FRAME_BUFFER==target)
|
|
|
|
return setRenderTarget(0,clearTarget, clearZBuffer, color);
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! sets a render target
|
|
|
|
bool CNullDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer,
|
2007-08-02 07:39:14 -07:00
|
|
|
bool clearZBuffer, SColor color)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-06 08:53:35 -08:00
|
|
|
//! Sets multiple render targets
|
|
|
|
bool CNullDriver::setRenderTarget(const core::array<video::IRenderTarget>& texture,
|
|
|
|
bool clearBackBuffer, bool clearZBuffer, SColor color)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! sets a viewport
|
|
|
|
void CNullDriver::setViewPort(const core::rect<s32>& area)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! gets the area of the current viewport
|
|
|
|
const core::rect<s32>& CNullDriver::getViewPort() const
|
|
|
|
{
|
|
|
|
return ViewPort;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! draws a vertex primitive list
|
2008-08-27 21:00:22 -07:00
|
|
|
void CNullDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const void* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-02-03 15:53:08 -08:00
|
|
|
if ((iType==EIT_16BIT) && (vertexCount>65536))
|
|
|
|
os::Printer::log("Too many vertices for 16bit index type, render artifacts may occur.");
|
2007-05-20 11:03:49 -07:00
|
|
|
PrimitivesDrawn += primitiveCount;
|
2009-08-10 14:58:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! draws a vertex primitive list in 2d
|
|
|
|
void CNullDriver::draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount, const void* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType)
|
|
|
|
{
|
|
|
|
if ((iType==EIT_16BIT) && (vertexCount>65536))
|
|
|
|
os::Printer::log("Too many vertices for 16bit index type, render artifacts may occur.");
|
|
|
|
PrimitivesDrawn += primitiveCount;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Draws a 3d line.
|
|
|
|
void CNullDriver::draw3DLine(const core::vector3df& start,
|
|
|
|
const core::vector3df& end, SColor color)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Draws a 3d triangle.
|
|
|
|
void CNullDriver::draw3DTriangle(const core::triangle3df& triangle, SColor color)
|
|
|
|
{
|
2009-10-17 13:34:33 -07:00
|
|
|
S3DVertex vertices[3];
|
|
|
|
vertices[0].Pos=triangle.pointA;
|
|
|
|
vertices[0].Color=color;
|
|
|
|
vertices[0].Normal=triangle.getNormal().normalize();
|
|
|
|
vertices[0].TCoords.set(0.f,0.f);
|
|
|
|
vertices[1].Pos=triangle.pointB;
|
|
|
|
vertices[1].Color=color;
|
|
|
|
vertices[1].Normal=vertices[0].Normal;
|
|
|
|
vertices[1].TCoords.set(0.5f,1.f);
|
|
|
|
vertices[2].Pos=triangle.pointC;
|
|
|
|
vertices[2].Color=color;
|
|
|
|
vertices[2].Normal=vertices[0].Normal;
|
|
|
|
vertices[2].TCoords.set(1.f,0.f);
|
|
|
|
const u16 indexList[] = {0,1,2};
|
|
|
|
drawVertexPrimitiveList(vertices, 3, indexList, 1, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Draws a 3d axis aligned box.
|
|
|
|
void CNullDriver::draw3DBox(const core::aabbox3d<f32>& box, SColor color)
|
|
|
|
{
|
|
|
|
core::vector3df edges[8];
|
|
|
|
box.getEdges(edges);
|
|
|
|
|
|
|
|
// TODO: optimize into one big drawIndexPrimitive call.
|
|
|
|
|
|
|
|
draw3DLine(edges[5], edges[1], color);
|
|
|
|
draw3DLine(edges[1], edges[3], color);
|
|
|
|
draw3DLine(edges[3], edges[7], color);
|
|
|
|
draw3DLine(edges[7], edges[5], color);
|
|
|
|
draw3DLine(edges[0], edges[2], color);
|
|
|
|
draw3DLine(edges[2], edges[6], color);
|
|
|
|
draw3DLine(edges[6], edges[4], color);
|
|
|
|
draw3DLine(edges[4], edges[0], color);
|
|
|
|
draw3DLine(edges[1], edges[0], color);
|
|
|
|
draw3DLine(edges[3], edges[2], color);
|
|
|
|
draw3DLine(edges[7], edges[6], color);
|
|
|
|
draw3DLine(edges[5], edges[4], color);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! draws an 2d image
|
2007-09-15 17:18:13 -07:00
|
|
|
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
if (!texture)
|
|
|
|
return;
|
|
|
|
|
2009-01-19 05:48:22 -08:00
|
|
|
draw2DImage(texture,destPos, core::rect<s32>(core::position2d<s32>(0,0),
|
|
|
|
core::dimension2di(texture->getOriginalSize())));
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! draws a set of 2d images, using a color and the alpha channel of the
|
|
|
|
//! texture if desired. The images are drawn beginning at pos and concatenated
|
|
|
|
//! in one line. All drawings are clipped against clipRect (if != 0).
|
|
|
|
//! The subtextures are defined by the array of sourceRects and are chosen
|
|
|
|
//! by the indices given.
|
2009-08-01 21:55:56 -07:00
|
|
|
void CNullDriver::draw2DImageBatch(const video::ITexture* texture,
|
2007-05-20 11:03:49 -07:00
|
|
|
const core::position2d<s32>& pos,
|
|
|
|
const core::array<core::rect<s32> >& sourceRects,
|
|
|
|
const core::array<s32>& indices,
|
|
|
|
s32 kerningWidth,
|
|
|
|
const core::rect<s32>* clipRect, SColor color,
|
|
|
|
bool useAlphaChannelOfTexture)
|
|
|
|
{
|
|
|
|
core::position2d<s32> target(pos);
|
2007-08-02 07:39:14 -07:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
for (u32 i=0; i<indices.size(); ++i)
|
|
|
|
{
|
|
|
|
draw2DImage(texture, target, sourceRects[indices[i]],
|
|
|
|
clipRect, color, useAlphaChannelOfTexture);
|
|
|
|
target.X += sourceRects[indices[i]].getWidth();
|
|
|
|
target.X += kerningWidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-01 21:55:56 -07:00
|
|
|
//! draws a set of 2d images, using a color and the alpha channel of the
|
|
|
|
//! texture if desired.
|
|
|
|
void CNullDriver::draw2DImageBatch(const video::ITexture* texture,
|
|
|
|
const core::array<core::position2d<s32> >& positions,
|
|
|
|
const core::array<core::rect<s32> >& sourceRects,
|
|
|
|
const core::rect<s32>* clipRect,
|
|
|
|
SColor color,
|
|
|
|
bool useAlphaChannelOfTexture)
|
|
|
|
{
|
|
|
|
const irr::u32 drawCount = core::min_<u32>(positions.size(), sourceRects.size());
|
|
|
|
|
|
|
|
for (u32 i=0; i<drawCount; ++i)
|
|
|
|
{
|
|
|
|
draw2DImage(texture, positions[i], sourceRects[i],
|
|
|
|
clipRect, color, useAlphaChannelOfTexture);
|
|
|
|
}
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
//! Draws a part of the texture into the rectangle.
|
2007-09-15 17:18:13 -07:00
|
|
|
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
|
2007-05-20 11:03:49 -07:00
|
|
|
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
|
2008-08-15 01:46:57 -07:00
|
|
|
const video::SColor* const colors, bool useAlphaChannelOfTexture)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-11-04 03:52:18 -08:00
|
|
|
draw2DImage(texture, core::position2d<s32>(destRect.UpperLeftCorner),
|
|
|
|
sourceRect, clipRect, colors?colors[0]:0xffffffff,
|
|
|
|
useAlphaChannelOfTexture);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-14 04:37:51 -08:00
|
|
|
//! Draws a 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
|
2007-09-15 17:18:13 -07:00
|
|
|
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
|
2007-08-02 07:39:14 -07:00
|
|
|
const core::rect<s32>& sourceRect,
|
|
|
|
const core::rect<s32>* clipRect, SColor color,
|
|
|
|
bool useAlphaChannelOfTexture)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-14 04:37:51 -08:00
|
|
|
//! Draws the outline of a 2d rectangle
|
|
|
|
void CNullDriver::draw2DRectangleOutline(const core::recti& pos, SColor color)
|
|
|
|
{
|
|
|
|
draw2DLine(pos.UpperLeftCorner, core::position2di(pos.LowerRightCorner.X, pos.UpperLeftCorner.Y), color);
|
|
|
|
draw2DLine(core::position2di(pos.LowerRightCorner.X, pos.UpperLeftCorner.Y), pos.LowerRightCorner, color);
|
|
|
|
draw2DLine(pos.LowerRightCorner, core::position2di(pos.UpperLeftCorner.X, pos.LowerRightCorner.Y), color);
|
|
|
|
draw2DLine(core::position2di(pos.UpperLeftCorner.X, pos.LowerRightCorner.Y), pos.UpperLeftCorner, color);
|
|
|
|
}
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-01-14 04:37:51 -08:00
|
|
|
//! Draw a 2d rectangle
|
2007-05-20 11:03:49 -07:00
|
|
|
void CNullDriver::draw2DRectangle(SColor color, const core::rect<s32>& pos, const core::rect<s32>* clip)
|
|
|
|
{
|
|
|
|
draw2DRectangle(pos, color, color, color, color, clip);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-14 04:37:51 -08:00
|
|
|
//! Draws a 2d rectangle with a gradient.
|
2007-05-20 11:03:49 -07:00
|
|
|
void CNullDriver::draw2DRectangle(const core::rect<s32>& pos,
|
|
|
|
SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown,
|
|
|
|
const core::rect<s32>* clip)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! Draws a 2d line.
|
|
|
|
void CNullDriver::draw2DLine(const core::position2d<s32>& start,
|
|
|
|
const core::position2d<s32>& end, SColor color)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-10-24 06:45:47 -07:00
|
|
|
//! Draws a pixel
|
|
|
|
void CNullDriver::drawPixel(u32 x, u32 y, const SColor & color)
|
|
|
|
{
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
//! Draws a non filled concyclic regular 2d polyon.
|
|
|
|
void CNullDriver::draw2DPolygon(core::position2d<s32> center,
|
|
|
|
f32 radius, video::SColor color, s32 count)
|
|
|
|
{
|
|
|
|
if (count < 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
core::position2d<s32> first;
|
|
|
|
core::position2d<s32> a,b;
|
|
|
|
|
|
|
|
for (s32 j=0; j<count; ++j)
|
|
|
|
{
|
|
|
|
b = a;
|
|
|
|
|
|
|
|
f32 p = j / (f32)count * (core::PI*2);
|
|
|
|
a = center + core::position2d<s32>((s32)(sin(p)*radius), (s32)(cos(p)*radius));
|
|
|
|
|
|
|
|
if (j==0)
|
|
|
|
first = a;
|
|
|
|
else
|
|
|
|
draw2DLine(a, b, color);
|
|
|
|
}
|
|
|
|
|
|
|
|
draw2DLine(a, first, color);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-16 03:06:04 -07:00
|
|
|
//! returns color format
|
|
|
|
ECOLOR_FORMAT CNullDriver::getColorFormat() const
|
|
|
|
{
|
|
|
|
return ECF_R5G6B5;
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
//! returns screen size
|
2009-01-19 05:48:22 -08:00
|
|
|
const core::dimension2d<u32>& CNullDriver::getScreenSize() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return ScreenSize;
|
|
|
|
}
|
|
|
|
|
2008-06-16 03:06:04 -07:00
|
|
|
|
2007-08-02 07:39:14 -07:00
|
|
|
//! returns the current render target size,
|
2007-05-20 11:03:49 -07:00
|
|
|
//! or the screen size if render targets are not implemented
|
2009-01-19 05:48:22 -08:00
|
|
|
const core::dimension2d<u32>& CNullDriver::getCurrentRenderTargetSize() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return ScreenSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// returns current frames per second value
|
2007-09-17 09:09:50 -07:00
|
|
|
s32 CNullDriver::getFPS() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return FPSCounter.getFPS();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! returns amount of primitives (mostly triangles) were drawn in the last frame.
|
|
|
|
//! very useful method for statistics.
|
2007-09-17 09:09:50 -07:00
|
|
|
u32 CNullDriver::getPrimitiveCountDrawn( u32 param ) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return (0 == param) ? FPSCounter.getPrimitive() : (1 == param) ? FPSCounter.getPrimitiveAverage() : FPSCounter.getPrimitiveTotal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! Sets the dynamic ambient light color. The default color is
|
|
|
|
//! (0,0,0,0) which means it is dark.
|
|
|
|
//! \param color: New color of the ambient light.
|
|
|
|
void CNullDriver::setAmbientLight(const SColorf& color)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
|
|
|
|
//! driver, it would return "Direct3D8".
|
2007-09-17 09:09:50 -07:00
|
|
|
const wchar_t* CNullDriver::getName() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return L"Irrlicht NullDevice";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do
|
|
|
|
//! this: Frist, draw all geometry. Then use this method, to draw the shadow
|
|
|
|
//! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow.
|
|
|
|
void CNullDriver::drawStencilShadowVolume(const core::vector3df* triangles, s32 count, bool zfail)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Fills the stencil shadow with color. After the shadow volume has been drawn
|
|
|
|
//! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this
|
|
|
|
//! to draw the color of the shadow.
|
2007-08-02 07:39:14 -07:00
|
|
|
void CNullDriver::drawStencilShadow(bool clearStencilBuffer,
|
|
|
|
video::SColor leftUpEdge, video::SColor rightUpEdge,
|
|
|
|
video::SColor leftDownEdge, video::SColor rightDownEdge)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! deletes all dynamic lights there are
|
|
|
|
void CNullDriver::deleteAllDynamicLights()
|
|
|
|
{
|
|
|
|
Lights.set_used(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! adds a dynamic light
|
2009-01-12 02:55:39 -08:00
|
|
|
s32 CNullDriver::addDynamicLight(const SLight& light)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
Lights.push_back(light);
|
2009-01-12 02:55:39 -08:00
|
|
|
return Lights.size() - 1;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
2009-01-12 02:55:39 -08:00
|
|
|
//! Turns a dynamic light on or off
|
|
|
|
//! \param lightIndex: the index returned by addDynamicLight
|
|
|
|
//! \param turnOn: true to turn the light on, false to turn it off
|
|
|
|
void CNullDriver::turnLightOn(s32 lightIndex, bool turnOn)
|
|
|
|
{
|
|
|
|
// Do nothing
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
|
|
|
|
//! returns the maximal amount of dynamic lights the device can handle
|
2007-09-17 09:09:50 -07:00
|
|
|
u32 CNullDriver::getMaximalDynamicLightAmount() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-08-02 07:39:14 -07:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Returns current amount of dynamic lights set
|
|
|
|
//! \return Current amount of dynamic lights set
|
2007-09-17 09:09:50 -07:00
|
|
|
u32 CNullDriver::getDynamicLightCount() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return Lights.size();
|
|
|
|
}
|
|
|
|
|
2007-08-02 07:39:14 -07:00
|
|
|
|
|
|
|
//! Returns light data which was previously set by IVideoDriver::addDynamicLight().
|
2007-05-20 11:03:49 -07:00
|
|
|
//! \param idx: Zero based index of the light. Must be greater than 0 and smaller
|
|
|
|
//! than IVideoDriver()::getDynamicLightCount.
|
|
|
|
//! \return Light data.
|
2007-09-17 09:09:50 -07:00
|
|
|
const SLight& CNullDriver::getDynamicLight(u32 idx) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
if ( idx < Lights.size() )
|
2007-08-02 07:39:14 -07:00
|
|
|
return Lights[idx];
|
|
|
|
else
|
|
|
|
return *((SLight*)0);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-02 05:02:05 -08:00
|
|
|
//! Creates a boolean alpha channel of the texture based of an color key.
|
|
|
|
void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
|
|
|
video::SColor color,
|
|
|
|
bool zeroTexels) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
if (!texture)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (texture->getColorFormat() != ECF_A1R5G5B5 &&
|
|
|
|
texture->getColorFormat() != ECF_A8R8G8B8 )
|
|
|
|
{
|
|
|
|
os::Printer::log("Error: Unsupported texture color format for making color key channel.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (texture->getColorFormat() == ECF_A1R5G5B5)
|
|
|
|
{
|
2009-02-10 07:08:23 -08:00
|
|
|
u16 *p = (u16*)texture->lock();
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-19 05:48:22 -08:00
|
|
|
const core::dimension2d<u32> dim = texture->getSize();
|
2009-02-10 07:08:23 -08:00
|
|
|
const u32 pitch = texture->getPitch() / 2;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-01-02 05:02:05 -08:00
|
|
|
// color with alpha disabled (i.e. fully transparent)
|
2009-02-10 07:08:23 -08:00
|
|
|
const u16 refZeroAlpha = (0x7fff & color.toA1R5G5B5());
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-02-10 07:08:23 -08:00
|
|
|
const u32 pixels = pitch * dim.Height;
|
2009-01-02 05:02:05 -08:00
|
|
|
|
2009-02-10 07:08:23 -08:00
|
|
|
for (u32 pixel = 0; pixel < pixels; ++ pixel)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-01-02 05:02:05 -08:00
|
|
|
// If the colour matches the reference colour, ignoring alphas,
|
|
|
|
// set the alpha to zero.
|
|
|
|
if(((*p) & 0x7fff) == refZeroAlpha)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-01-02 05:02:05 -08:00
|
|
|
if(zeroTexels)
|
|
|
|
(*p) = 0;
|
|
|
|
else
|
|
|
|
(*p) = refZeroAlpha;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
2009-01-02 05:02:05 -08:00
|
|
|
|
|
|
|
++p;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
texture->unlock();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-10 07:08:23 -08:00
|
|
|
u32 *p = (u32*)texture->lock();
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-19 05:48:22 -08:00
|
|
|
core::dimension2d<u32> dim = texture->getSize();
|
2009-02-10 07:08:23 -08:00
|
|
|
u32 pitch = texture->getPitch() / 4;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-01-02 05:02:05 -08:00
|
|
|
// color with alpha disabled (fully transparent)
|
2009-02-10 07:08:23 -08:00
|
|
|
const u32 refZeroAlpha = 0x00ffffff & color.color;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-02-10 07:08:23 -08:00
|
|
|
const u32 pixels = pitch * dim.Height;
|
|
|
|
for (u32 pixel = 0; pixel < pixels; ++ pixel)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-01-02 05:02:05 -08:00
|
|
|
// If the colour matches the reference colour, ignoring alphas,
|
|
|
|
// set the alpha to zero.
|
|
|
|
if(((*p) & 0x00ffffff) == refZeroAlpha)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-01-02 05:02:05 -08:00
|
|
|
if(zeroTexels)
|
|
|
|
(*p) = 0;
|
|
|
|
else
|
|
|
|
(*p) = refZeroAlpha;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
2009-01-02 05:02:05 -08:00
|
|
|
|
|
|
|
++p;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
texture->unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-02 05:02:05 -08:00
|
|
|
//! Creates an boolean alpha channel of the texture based of an color key position.
|
2007-05-20 11:03:49 -07:00
|
|
|
void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
2009-01-02 05:02:05 -08:00
|
|
|
core::position2d<s32> colorKeyPixelPos,
|
|
|
|
bool zeroTexels) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
if (!texture)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (texture->getColorFormat() != ECF_A1R5G5B5 &&
|
|
|
|
texture->getColorFormat() != ECF_A8R8G8B8 )
|
|
|
|
{
|
|
|
|
os::Printer::log("Error: Unsupported texture color format for making color key channel.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-02 05:02:05 -08:00
|
|
|
SColor colorKey;
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
if (texture->getColorFormat() == ECF_A1R5G5B5)
|
|
|
|
{
|
2009-05-08 00:20:51 -07:00
|
|
|
u16 *p = (u16*)texture->lock(true);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-02-10 07:08:23 -08:00
|
|
|
u32 pitch = texture->getPitch() / 2;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-02-10 07:08:23 -08:00
|
|
|
const u16 key16Bit = 0x7fff & p[colorKeyPixelPos.Y*pitch + colorKeyPixelPos.X];
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-01-02 05:02:05 -08:00
|
|
|
colorKey = video::A1R5G5B5toA8R8G8B8(key16Bit);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-08 00:20:51 -07:00
|
|
|
u32 *p = (u32*)texture->lock(true);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-02-10 07:08:23 -08:00
|
|
|
u32 pitch = texture->getPitch() / 4;
|
2009-01-02 05:02:05 -08:00
|
|
|
colorKey = 0x00ffffff & p[colorKeyPixelPos.Y*pitch + colorKeyPixelPos.X];
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
2009-01-02 05:02:05 -08:00
|
|
|
|
|
|
|
texture->unlock();
|
|
|
|
makeColorKeyTexture(texture, colorKey, zeroTexels);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! Creates a normal map from a height map texture.
|
|
|
|
//! \param amplitude: Constant value by which the height information is multiplied.
|
2007-09-17 09:09:50 -07:00
|
|
|
void CNullDriver::makeNormalMapTexture(video::ITexture* texture, f32 amplitude) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
if (!texture)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (texture->getColorFormat() != ECF_A1R5G5B5 &&
|
|
|
|
texture->getColorFormat() != ECF_A8R8G8B8 )
|
|
|
|
{
|
|
|
|
os::Printer::log("Error: Unsupported texture color format for making normal map.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-19 05:48:22 -08:00
|
|
|
core::dimension2d<u32> dim = texture->getSize();
|
2007-05-20 11:03:49 -07:00
|
|
|
amplitude = amplitude / 255.0f;
|
|
|
|
f32 vh = dim.Height / (f32)dim.Width;
|
|
|
|
f32 hh = dim.Width / (f32)dim.Height;
|
|
|
|
|
|
|
|
if (texture->getColorFormat() == ECF_A8R8G8B8)
|
|
|
|
{
|
|
|
|
// ECF_A8R8G8B8 version
|
|
|
|
|
|
|
|
s32 *p = (s32*)texture->lock();
|
|
|
|
|
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not lock texture for making normal map.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// copy texture
|
|
|
|
|
2009-01-19 05:48:22 -08:00
|
|
|
u32 pitch = texture->getPitch() / 4;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
s32* in = new s32[dim.Height * pitch];
|
|
|
|
memcpy(in, p, dim.Height * pitch * 4);
|
|
|
|
|
2009-07-06 02:43:21 -07:00
|
|
|
for (s32 x=0; x < s32(pitch); ++x)
|
|
|
|
for (s32 y=0; y < s32(dim.Height); ++y)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
// TODO: this could be optimized really a lot
|
|
|
|
|
|
|
|
core::vector3df h1((x-1)*hh, nml32(x-1, y, pitch, dim.Height, in)*amplitude, y*vh);
|
|
|
|
core::vector3df h2((x+1)*hh, nml32(x+1, y, pitch, dim.Height, in)*amplitude, y*vh);
|
|
|
|
//core::vector3df v1(x*hh, nml32(x, y-1, pitch, dim.Height, in)*amplitude, (y-1)*vh);
|
|
|
|
//core::vector3df v2(x*hh, nml32(x, y+1, pitch, dim.Height, in)*amplitude, (y+1)*vh);
|
|
|
|
core::vector3df v1(x*hh, nml32(x, y+1, pitch, dim.Height, in)*amplitude, (y-1)*vh);
|
|
|
|
core::vector3df v2(x*hh, nml32(x, y-1, pitch, dim.Height, in)*amplitude, (y+1)*vh);
|
|
|
|
|
|
|
|
core::vector3df v = v1-v2;
|
|
|
|
core::vector3df h = h1-h2;
|
|
|
|
|
|
|
|
core::vector3df n = v.crossProduct(h);
|
|
|
|
n.normalize();
|
|
|
|
n *= 0.5f;
|
|
|
|
n += core::vector3df(0.5f,0.5f,0.5f); // now between 0 and 1
|
|
|
|
n *= 255.0f;
|
|
|
|
|
|
|
|
s32 height = (s32)nml32(x, y, pitch, dim.Height, in);
|
|
|
|
p[y*pitch + x] = video::SColor(
|
|
|
|
height, // store height in alpha
|
|
|
|
(s32)n.X, (s32)n.Z, (s32)n.Y).color;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete [] in;
|
|
|
|
texture->unlock();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// ECF_A1R5G5B5 version
|
|
|
|
|
|
|
|
s16 *p = (s16*)texture->lock();
|
|
|
|
|
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not lock texture for making normal map.", ELL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-19 05:48:22 -08:00
|
|
|
u32 pitch = texture->getPitch() / 2;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
// copy texture
|
|
|
|
|
|
|
|
s16* in = new s16[dim.Height * pitch];
|
|
|
|
memcpy(in, p, dim.Height * pitch * 2);
|
|
|
|
|
2009-07-06 02:43:21 -07:00
|
|
|
for (s32 x=0; x < s32(pitch); ++x)
|
|
|
|
for (s32 y=0; y < s32(dim.Height); ++y)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
// TODO: this could be optimized really a lot
|
|
|
|
|
|
|
|
core::vector3df h1((x-1)*hh, nml16(x-1, y, pitch, dim.Height, in)*amplitude, y*vh);
|
|
|
|
core::vector3df h2((x+1)*hh, nml16(x+1, y, pitch, dim.Height, in)*amplitude, y*vh);
|
|
|
|
core::vector3df v1(x*hh, nml16(x, y-1, pitch, dim.Height, in)*amplitude, (y-1)*vh);
|
|
|
|
core::vector3df v2(x*hh, nml16(x, y+1, pitch, dim.Height, in)*amplitude, (y+1)*vh);
|
|
|
|
|
|
|
|
core::vector3df v = v1-v2;
|
|
|
|
core::vector3df h = h1-h2;
|
|
|
|
|
|
|
|
core::vector3df n = v.crossProduct(h);
|
|
|
|
n.normalize();
|
|
|
|
n *= 0.5f;
|
|
|
|
n += core::vector3df(0.5f,0.5f,0.5f); // now between 0 and 1
|
|
|
|
n *= 255.0f;
|
|
|
|
|
2009-07-27 09:46:55 -07:00
|
|
|
p[y*pitch + x] = video::RGBA16((u32)n.X, (u32)n.Z, (u32)n.Y);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
delete [] in;
|
|
|
|
texture->unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
texture->regenerateMipMapLevels();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns the maximum amount of primitives (mostly vertices) which
|
|
|
|
//! the device is able to render with one drawIndexedTriangleList
|
|
|
|
//! call.
|
2007-09-17 09:09:50 -07:00
|
|
|
u32 CNullDriver::getMaximalPrimitiveCount() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return 0xFFFFFFFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! checks triangle count and print warning if wrong
|
2007-09-17 09:09:50 -07:00
|
|
|
bool CNullDriver::checkPrimitiveCount(u32 prmCount) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2007-09-17 09:09:50 -07:00
|
|
|
const u32 m = getMaximalPrimitiveCount();
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2007-07-17 14:57:10 -07:00
|
|
|
if (prmCount > m)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
char tmp[1024];
|
2007-07-17 14:57:10 -07:00
|
|
|
sprintf(tmp,"Could not draw triangles, too many primitives(%u), maxium is %u.", prmCount, m);
|
2007-05-20 11:03:49 -07:00
|
|
|
os::Printer::log(tmp, ELL_ERROR);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Enables or disables a texture creation flag.
|
|
|
|
void CNullDriver::setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled)
|
|
|
|
{
|
|
|
|
if (enabled && ((flag == ETCF_ALWAYS_16_BIT) || (flag == ETCF_ALWAYS_32_BIT)
|
|
|
|
|| (flag == ETCF_OPTIMIZED_FOR_QUALITY) || (flag == ETCF_OPTIMIZED_FOR_SPEED)))
|
|
|
|
{
|
|
|
|
// disable other formats
|
|
|
|
setTextureCreationFlag(ETCF_ALWAYS_16_BIT, false);
|
|
|
|
setTextureCreationFlag(ETCF_ALWAYS_32_BIT, false);
|
|
|
|
setTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY, false);
|
|
|
|
setTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// set flag
|
|
|
|
TextureCreationFlags = (TextureCreationFlags & (~flag)) |
|
|
|
|
((((u32)!enabled)-1) & flag);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns if a texture creation flag is enabled or disabled.
|
2007-09-17 09:09:50 -07:00
|
|
|
bool CNullDriver::getTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return (TextureCreationFlags & flag)!=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Creates a software image from a file.
|
2009-08-24 02:12:27 -07:00
|
|
|
IImage* CNullDriver::createImageFromFile(const io::path& filename)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
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-e03cc46cb475
2009-01-27 07:53:53 -08:00
|
|
|
if (!filename.size())
|
2007-05-20 11:03:49 -07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
IImage* image = 0;
|
|
|
|
io::IReadFile* file = FileSystem->createAndOpenFile(filename);
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
{
|
|
|
|
image = createImageFromFile(file);
|
|
|
|
file->drop();
|
|
|
|
}
|
|
|
|
else
|
2007-11-21 15:27:21 -08:00
|
|
|
os::Printer::log("Could not open file of image", filename, ELL_WARNING);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Creates a software image from a file.
|
|
|
|
IImage* CNullDriver::createImageFromFile(io::IReadFile* file)
|
|
|
|
{
|
|
|
|
if (!file)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
IImage* image = 0;
|
|
|
|
|
|
|
|
u32 i;
|
|
|
|
|
|
|
|
// try to load file based on file extension
|
|
|
|
for (i=0; i<SurfaceLoader.size(); ++i)
|
|
|
|
{
|
|
|
|
if (SurfaceLoader[i]->isALoadableFileExtension(file->getFileName()))
|
|
|
|
{
|
|
|
|
// reset file position which might have changed due to previous loadImage calls
|
|
|
|
file->seek(0);
|
|
|
|
image = SurfaceLoader[i]->loadImage(file);
|
|
|
|
if (image)
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// try to load file based on what is in it
|
|
|
|
for (i=0; i<SurfaceLoader.size(); ++i)
|
|
|
|
{
|
|
|
|
// dito
|
|
|
|
file->seek(0);
|
|
|
|
if (SurfaceLoader[i]->isALoadableFileFormat(file))
|
|
|
|
{
|
|
|
|
file->seek(0);
|
|
|
|
image = SurfaceLoader[i]->loadImage(file);
|
|
|
|
if (image)
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0; // failed to load
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Writes the provided image to disk file
|
2009-08-24 02:12:27 -07:00
|
|
|
bool CNullDriver::writeImageToFile(IImage* image, const io::path& filename,u32 param)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-01-16 06:19:38 -08:00
|
|
|
io::IWriteFile* file = FileSystem->createAndWriteFile(filename);
|
|
|
|
if(!file)
|
|
|
|
return false;
|
2009-01-19 05:48:22 -08:00
|
|
|
|
2009-01-16 07:35:22 -08:00
|
|
|
bool result = writeImageToFile(image, file, param);
|
2009-01-16 06:19:38 -08:00
|
|
|
file->drop();
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Writes the provided image to a file.
|
2009-01-16 07:35:22 -08:00
|
|
|
bool CNullDriver::writeImageToFile(IImage* image, io::IWriteFile * file, u32 param)
|
2009-01-16 06:19:38 -08:00
|
|
|
{
|
|
|
|
if(!file)
|
|
|
|
return false;
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
for (u32 i=0; i<SurfaceWriter.size(); ++i)
|
|
|
|
{
|
2009-01-16 07:35:22 -08:00
|
|
|
if (SurfaceWriter[i]->isAWriteableFileExtension(file->getFileName()))
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-01-16 06:19:38 -08:00
|
|
|
bool written = SurfaceWriter[i]->writeImage(file, image, param);
|
|
|
|
if (written)
|
|
|
|
return true;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return false; // failed to write
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Creates a software image from a byte array.
|
|
|
|
IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format,
|
2009-01-19 05:48:22 -08:00
|
|
|
const core::dimension2d<u32>& size,
|
2007-07-07 13:12:48 -07:00
|
|
|
void *data, bool ownForeignMemory,
|
|
|
|
bool deleteMemory)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-08-03 15:01:23 -07:00
|
|
|
if(IImage::isRenderTargetOnlyFormat(format))
|
2009-05-24 02:35:39 -07:00
|
|
|
{
|
|
|
|
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
return new CImage(format, size, data, ownForeignMemory, deleteMemory);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-08-13 16:48:33 -07:00
|
|
|
//! Creates an empty software image.
|
2009-01-19 05:48:22 -08:00
|
|
|
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
|
2008-08-13 16:48:33 -07:00
|
|
|
{
|
2009-08-03 15:01:23 -07:00
|
|
|
if(IImage::isRenderTargetOnlyFormat(format))
|
2009-05-24 02:35:39 -07:00
|
|
|
{
|
|
|
|
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new CImage(format, size);
|
2008-08-13 16:48:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Creates a software image from another image.
|
|
|
|
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, IImage *imageToCopy)
|
|
|
|
{
|
2009-11-20 09:24:26 -08:00
|
|
|
os::Printer::log("Deprecated method, please create an empty image instead and use copyTo().", ELL_WARNING);
|
2009-08-03 15:01:23 -07:00
|
|
|
if(IImage::isRenderTargetOnlyFormat(format))
|
2009-05-24 02:35:39 -07:00
|
|
|
{
|
|
|
|
os::Printer::log("Could not create IImage, format only supported for render target textures.", ELL_WARNING);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-11-20 09:24:26 -08:00
|
|
|
CImage* tmp = new CImage(format, imageToCopy->getDimension());
|
|
|
|
imageToCopy->copyTo(tmp);
|
|
|
|
return tmp;
|
2008-08-13 16:48:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Creates a software image from part of another image.
|
2009-01-19 05:48:22 -08:00
|
|
|
IImage* CNullDriver::createImage(IImage* imageToCopy, const core::position2d<s32>& pos, const core::dimension2d<u32>& size)
|
2008-08-13 16:48:33 -07:00
|
|
|
{
|
2009-11-20 09:24:26 -08:00
|
|
|
os::Printer::log("Deprecated method, please create an empty image instead and use copyTo().", ELL_WARNING);
|
|
|
|
CImage* tmp = new CImage(imageToCopy->getColorFormat(), imageToCopy->getDimension());
|
|
|
|
imageToCopy->copyTo(tmp, core::position2di(0,0), core::recti(pos,size));
|
|
|
|
return tmp;
|
2008-08-13 16:48:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-25 07:13:43 -07:00
|
|
|
//! Creates a software image from part of a texture.
|
|
|
|
IImage* CNullDriver::createImage(ITexture* texture, const core::position2d<s32>& pos, const core::dimension2d<u32>& size)
|
|
|
|
{
|
|
|
|
if (pos==core::position2di(0,0) && size == texture->getSize())
|
|
|
|
{
|
|
|
|
IImage* image = new CImage(texture->getColorFormat(), size, texture->lock(true), false);
|
|
|
|
texture->unlock();
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// make sure to avoid buffer overruns
|
2009-07-27 05:06:49 -07:00
|
|
|
// make the vector a separate variable for g++ 3.x
|
|
|
|
const core::vector2d<u32> leftUpper(core::clamp(static_cast<u32>(pos.X), 0u, texture->getSize().Width),
|
|
|
|
core::clamp(static_cast<u32>(pos.Y), 0u, texture->getSize().Height));
|
|
|
|
const core::rect<u32> clamped(leftUpper,
|
2009-07-25 07:13:43 -07:00
|
|
|
core::dimension2du(core::clamp(static_cast<u32>(size.Width), 0u, texture->getSize().Width),
|
|
|
|
core::clamp(static_cast<u32>(size.Height), 0u, texture->getSize().Height)));
|
|
|
|
if (!clamped.isValid())
|
|
|
|
return 0;
|
|
|
|
void* src = texture->lock(true);
|
2009-07-27 05:06:49 -07:00
|
|
|
if (!src)
|
|
|
|
return 0;
|
|
|
|
IImage* image = new CImage(texture->getColorFormat(), clamped.getSize());
|
2009-07-25 07:13:43 -07:00
|
|
|
void* dst = image->lock();
|
|
|
|
for (u32 i=clamped.UpperLeftCorner.X; i<clamped.getHeight(); ++i)
|
|
|
|
{
|
|
|
|
video::CColorConverter::convert_viaFormat(src, texture->getColorFormat(), clamped.getWidth(), dst, image->getColorFormat());
|
|
|
|
}
|
|
|
|
image->unlock();
|
|
|
|
texture->unlock();
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Sets the fog mode.
|
2009-07-15 14:39:25 -07:00
|
|
|
void CNullDriver::setFog(SColor color, E_FOG_TYPE fogType, f32 start, f32 end,
|
2008-08-13 16:48:33 -07:00
|
|
|
f32 density, bool pixelFog, bool rangeFog)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
FogColor = color;
|
2009-07-15 14:39:25 -07:00
|
|
|
FogType = fogType;
|
2007-05-20 11:03:49 -07:00
|
|
|
FogStart = start;
|
|
|
|
FogEnd = end;
|
|
|
|
FogDensity = density;
|
|
|
|
PixelFog = pixelFog;
|
|
|
|
RangeFog = rangeFog;
|
|
|
|
}
|
|
|
|
|
2009-10-30 09:21:19 -07:00
|
|
|
//! Gets the fog mode.
|
|
|
|
void CNullDriver::getFog(SColor& color, E_FOG_TYPE& fogType, f32& start, f32& end,
|
|
|
|
f32& density, bool& pixelFog, bool& rangeFog)
|
|
|
|
{
|
|
|
|
color = FogColor;
|
|
|
|
fogType = FogType;
|
|
|
|
start = FogStart;
|
|
|
|
end = FogEnd;
|
|
|
|
density = FogDensity;
|
|
|
|
pixelFog = PixelFog;
|
|
|
|
rangeFog = RangeFog;
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Draws a mesh buffer
|
2007-07-30 04:01:04 -07:00
|
|
|
void CNullDriver::drawMeshBuffer(const scene::IMeshBuffer* mb)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
if (!mb)
|
|
|
|
return;
|
|
|
|
|
2007-12-05 06:10:28 -08:00
|
|
|
//IVertexBuffer and IIndexBuffer later
|
|
|
|
SHWBufferLink *HWBuffer=getBufferLink(mb);
|
|
|
|
|
|
|
|
if (HWBuffer)
|
|
|
|
drawHardwareBuffer(HWBuffer);
|
|
|
|
else
|
2008-08-27 21:00:22 -07:00
|
|
|
drawVertexPrimitiveList(mb->getVertices(), mb->getVertexCount(), mb->getIndices(), mb->getIndexCount()/3, mb->getVertexType(), scene::EPT_TRIANGLES, mb->getIndexType());
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-12-05 06:10:28 -08:00
|
|
|
CNullDriver::SHWBufferLink *CNullDriver::getBufferLink(const scene::IMeshBuffer* mb)
|
|
|
|
{
|
2007-12-21 07:39:23 -08:00
|
|
|
if (!mb || !isHardwareBufferRecommend(mb))
|
2007-12-05 06:10:28 -08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
//search for hardware links
|
2008-01-03 05:52:06 -08:00
|
|
|
core::map< const scene::IMeshBuffer*,SHWBufferLink* >::Node* node = HWBufferMap.find(mb);
|
2009-01-05 07:34:22 -08:00
|
|
|
if (node)
|
|
|
|
return node->getValue();
|
2007-12-05 06:10:28 -08:00
|
|
|
|
|
|
|
return createHardwareBuffer(mb); //no hardware links, and mesh wants one, create it
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-12-05 06:10:28 -08:00
|
|
|
//! Update all hardware buffers, remove unused ones
|
|
|
|
void CNullDriver::updateAllHardwareBuffers()
|
|
|
|
{
|
2008-01-03 05:52:06 -08:00
|
|
|
core::map<const scene::IMeshBuffer*,SHWBufferLink*>::ParentFirstIterator Iterator=HWBufferMap.getParentFirstIterator();
|
|
|
|
|
|
|
|
for (;!Iterator.atEnd();Iterator++)
|
2007-12-05 06:10:28 -08:00
|
|
|
{
|
2008-01-03 05:52:06 -08:00
|
|
|
SHWBufferLink *Link=Iterator.getNode()->getValue();
|
2007-12-05 06:10:28 -08:00
|
|
|
|
|
|
|
Link->LastUsed++;
|
2007-12-09 05:19:31 -08:00
|
|
|
if (Link->LastUsed>20000)
|
2007-12-05 06:10:28 -08:00
|
|
|
{
|
|
|
|
deleteHardwareBuffer(Link);
|
2008-06-11 20:15:59 -07:00
|
|
|
|
|
|
|
// todo: needs better fix
|
|
|
|
Iterator = HWBufferMap.getParentFirstIterator();
|
2007-12-05 06:10:28 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-09 05:19:31 -08:00
|
|
|
|
|
|
|
void CNullDriver::deleteHardwareBuffer(SHWBufferLink *HWBuffer)
|
|
|
|
{
|
2009-01-05 07:34:22 -08:00
|
|
|
if (!HWBuffer)
|
|
|
|
return;
|
|
|
|
HWBufferMap.remove(HWBuffer->MeshBuffer);
|
2007-12-09 05:19:31 -08:00
|
|
|
delete HWBuffer;
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-12-09 05:19:31 -08:00
|
|
|
//! Remove hardware buffer
|
|
|
|
void CNullDriver::removeHardwareBuffer(const scene::IMeshBuffer* mb)
|
2007-12-05 06:10:28 -08:00
|
|
|
{
|
2008-01-03 05:52:06 -08:00
|
|
|
core::map<const scene::IMeshBuffer*,SHWBufferLink*>::Node* node = HWBufferMap.find(mb);
|
2009-01-05 07:34:22 -08:00
|
|
|
if (node)
|
|
|
|
deleteHardwareBuffer(node->getValue());
|
2007-12-09 05:19:31 -08:00
|
|
|
}
|
2007-12-05 06:10:28 -08:00
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-12-09 05:19:31 -08:00
|
|
|
//! Remove all hardware buffers
|
|
|
|
void CNullDriver::removeAllHardwareBuffers()
|
|
|
|
{
|
2008-01-13 20:58:32 -08:00
|
|
|
while (HWBufferMap.size())
|
|
|
|
deleteHardwareBuffer(HWBufferMap.getRoot()->getValue());
|
2008-01-03 05:52:06 -08:00
|
|
|
}
|
2007-12-09 05:19:31 -08:00
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-12-05 06:10:28 -08:00
|
|
|
bool CNullDriver::isHardwareBufferRecommend(const scene::IMeshBuffer* mb)
|
|
|
|
{
|
2008-08-27 21:00:22 -07:00
|
|
|
if (!mb || (mb->getHardwareMappingHint_Index()==scene::EHM_NEVER && mb->getHardwareMappingHint_Vertex()==scene::EHM_NEVER))
|
2007-12-05 06:10:28 -08:00
|
|
|
return false;
|
|
|
|
|
2009-01-23 08:43:04 -08:00
|
|
|
if (mb->getVertexCount()<MinVertexCountForVBO)
|
2007-12-05 06:10:28 -08:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Only used by the internal engine. Used to notify the driver that
|
|
|
|
//! the window was resized.
|
2009-01-19 05:48:22 -08:00
|
|
|
void CNullDriver::OnResize(const core::dimension2d<u32>& size)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-01-19 05:48:22 -08:00
|
|
|
if (ViewPort.getWidth() == (s32)ScreenSize.Width &&
|
|
|
|
ViewPort.getHeight() == (s32)ScreenSize.Height)
|
|
|
|
ViewPort = core::rect<s32>(core::position2d<s32>(0,0),
|
|
|
|
core::dimension2di(size));
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
ScreenSize = size;
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
// adds a material renderer and drops it afterwards. To be used for internal creation
|
|
|
|
s32 CNullDriver::addAndDropMaterialRenderer(IMaterialRenderer* m)
|
|
|
|
{
|
|
|
|
s32 i = addMaterialRenderer(m);
|
|
|
|
|
|
|
|
if (m)
|
|
|
|
m->drop();
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Adds a new material renderer to the video device.
|
|
|
|
s32 CNullDriver::addMaterialRenderer(IMaterialRenderer* renderer, const char* name)
|
|
|
|
{
|
|
|
|
if (!renderer)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
SMaterialRenderer r;
|
|
|
|
r.Renderer = renderer;
|
|
|
|
r.Name = name;
|
|
|
|
|
2007-07-15 15:34:42 -07:00
|
|
|
if (name == 0 && (MaterialRenderers.size() < (sizeof(sBuiltInMaterialTypeNames) / sizeof(char*))-1 ))
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
// set name of built in renderer so that we don't have to implement name
|
2007-07-15 15:34:42 -07:00
|
|
|
// setting in all available renderers.
|
2007-05-20 11:03:49 -07:00
|
|
|
r.Name = sBuiltInMaterialTypeNames[MaterialRenderers.size()];
|
|
|
|
}
|
|
|
|
|
|
|
|
MaterialRenderers.push_back(r);
|
|
|
|
renderer->grab();
|
|
|
|
|
|
|
|
return MaterialRenderers.size()-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Sets the name of a material renderer.
|
|
|
|
void CNullDriver::setMaterialRendererName(s32 idx, const char* name)
|
|
|
|
{
|
2007-07-15 15:34:42 -07:00
|
|
|
if (idx < s32(sizeof(sBuiltInMaterialTypeNames) / sizeof(char*))-1 ||
|
2007-05-20 11:03:49 -07:00
|
|
|
idx >= (s32)MaterialRenderers.size())
|
|
|
|
return;
|
|
|
|
|
|
|
|
MaterialRenderers[idx].Name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Creates material attributes list from a material, usable for serialization and more.
|
|
|
|
io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMaterial& material)
|
|
|
|
{
|
|
|
|
io::CAttributes* attr = new io::CAttributes(this);
|
|
|
|
|
2007-07-15 15:34:42 -07:00
|
|
|
attr->addEnum("Type", material.MaterialType, sBuiltInMaterialTypeNames);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2007-07-11 01:07:06 -07:00
|
|
|
attr->addColor("Ambient", material.AmbientColor);
|
|
|
|
attr->addColor("Diffuse", material.DiffuseColor);
|
|
|
|
attr->addColor("Emissive", material.EmissiveColor);
|
|
|
|
attr->addColor("Specular", material.SpecularColor);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
attr->addFloat("Shininess", material.Shininess);
|
|
|
|
attr->addFloat("Param1", material.MaterialTypeParam);
|
|
|
|
attr->addFloat("Param2", material.MaterialTypeParam2);
|
|
|
|
|
2007-06-25 14:26:16 -07:00
|
|
|
core::stringc prefix="Texture";
|
2007-07-15 15:34:42 -07:00
|
|
|
u32 i;
|
2007-06-25 14:26:16 -07:00
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2008-09-04 06:18:58 -07:00
|
|
|
attr->addTexture((prefix+core::stringc(i+1)).c_str(), material.getTexture(i));
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
attr->addBool("Wireframe", material.Wireframe);
|
|
|
|
attr->addBool("GouraudShading", material.GouraudShading);
|
|
|
|
attr->addBool("Lighting", material.Lighting);
|
|
|
|
attr->addBool("ZWriteEnable", material.ZWriteEnable);
|
2007-06-25 14:26:16 -07:00
|
|
|
attr->addInt("ZBuffer", material.ZBuffer);
|
2007-05-20 11:03:49 -07:00
|
|
|
attr->addBool("BackfaceCulling", material.BackfaceCulling);
|
2008-04-04 01:48:22 -07:00
|
|
|
attr->addBool("FrontfaceCulling", material.FrontfaceCulling);
|
2007-05-20 11:03:49 -07:00
|
|
|
attr->addBool("FogEnable", material.FogEnable);
|
|
|
|
attr->addBool("NormalizeNormals", material.NormalizeNormals);
|
2009-01-28 15:45:59 -08:00
|
|
|
attr->addInt("AntiAliasing", material.AntiAliasing);
|
|
|
|
attr->addInt("ColorMask", material.ColorMask);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2007-06-25 14:26:16 -07:00
|
|
|
prefix = "BilinearFilter";
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2008-09-04 06:18:58 -07:00
|
|
|
attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].BilinearFilter);
|
2007-06-25 14:26:16 -07:00
|
|
|
prefix = "TrilinearFilter";
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2008-09-04 06:18:58 -07:00
|
|
|
attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter);
|
2007-06-25 14:26:16 -07:00
|
|
|
prefix = "AnisotropicFilter";
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2009-01-04 16:30:11 -08:00
|
|
|
attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter);
|
2009-11-16 07:58:54 -08:00
|
|
|
prefix="TextureWrapU";
|
2007-06-25 14:26:16 -07:00
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2009-11-16 07:58:54 -08:00
|
|
|
attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapU, aTextureClampNames);
|
|
|
|
prefix="TextureWrapV";
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
|
|
|
attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapV, aTextureClampNames);
|
2009-01-28 15:45:59 -08:00
|
|
|
prefix="LODBias";
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
|
|
|
attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].LODBias);
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
return attr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Fills an SMaterial structure from attributes.
|
|
|
|
void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attr)
|
|
|
|
{
|
|
|
|
outMaterial.MaterialType = video::EMT_SOLID;
|
|
|
|
|
|
|
|
core::stringc name = attr->getAttributeAsString("Type");
|
|
|
|
|
|
|
|
u32 i;
|
|
|
|
|
|
|
|
for ( i=0; i < MaterialRenderers.size(); ++i)
|
|
|
|
if ( name == MaterialRenderers[i].Name )
|
|
|
|
{
|
|
|
|
outMaterial.MaterialType = (video::E_MATERIAL_TYPE)i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
outMaterial.AmbientColor = attr->getAttributeAsColor("Ambient");
|
|
|
|
outMaterial.DiffuseColor = attr->getAttributeAsColor("Diffuse");
|
|
|
|
outMaterial.EmissiveColor = attr->getAttributeAsColor("Emissive");
|
|
|
|
outMaterial.SpecularColor = attr->getAttributeAsColor("Specular");
|
|
|
|
|
|
|
|
outMaterial.Shininess = attr->getAttributeAsFloat("Shininess");
|
|
|
|
outMaterial.MaterialTypeParam = attr->getAttributeAsFloat("Param1");
|
|
|
|
outMaterial.MaterialTypeParam2 = attr->getAttributeAsFloat("Param2");
|
|
|
|
|
2007-06-25 14:26:16 -07:00
|
|
|
core::stringc prefix="Texture";
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2008-09-04 06:18:58 -07:00
|
|
|
outMaterial.setTexture(i, attr->getAttributeAsTexture((prefix+core::stringc(i+1)).c_str()));
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
outMaterial.Wireframe = attr->getAttributeAsBool("Wireframe");
|
|
|
|
outMaterial.GouraudShading = attr->getAttributeAsBool("GouraudShading");
|
|
|
|
outMaterial.Lighting = attr->getAttributeAsBool("Lighting");
|
|
|
|
outMaterial.ZWriteEnable = attr->getAttributeAsBool("ZWriteEnable");
|
2009-01-22 14:39:40 -08:00
|
|
|
outMaterial.ZBuffer = (u8)attr->getAttributeAsInt("ZBuffer");
|
2007-05-20 11:03:49 -07:00
|
|
|
outMaterial.BackfaceCulling = attr->getAttributeAsBool("BackfaceCulling");
|
2008-04-04 01:48:22 -07:00
|
|
|
outMaterial.FrontfaceCulling = attr->getAttributeAsBool("FrontfaceCulling");
|
2007-05-20 11:03:49 -07:00
|
|
|
outMaterial.FogEnable = attr->getAttributeAsBool("FogEnable");
|
|
|
|
outMaterial.NormalizeNormals = attr->getAttributeAsBool("NormalizeNormals");
|
2009-02-01 13:52:47 -08:00
|
|
|
// default 0 is ok
|
2009-01-28 15:45:59 -08:00
|
|
|
outMaterial.AntiAliasing = attr->getAttributeAsInt("AntiAliasing");
|
2009-02-01 13:52:47 -08:00
|
|
|
if (attr->existsAttribute("ColorMask"))
|
|
|
|
outMaterial.ColorMask = attr->getAttributeAsInt("ColorMask");
|
2007-06-25 14:26:16 -07:00
|
|
|
prefix = "BilinearFilter";
|
2007-07-13 06:34:05 -07:00
|
|
|
if (attr->existsAttribute(prefix.c_str())) // legacy
|
|
|
|
outMaterial.setFlag(EMF_BILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));
|
|
|
|
else
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2008-09-04 06:18:58 -07:00
|
|
|
outMaterial.TextureLayer[i].BilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str());
|
2007-07-13 06:34:05 -07:00
|
|
|
|
2007-06-25 14:26:16 -07:00
|
|
|
prefix = "TrilinearFilter";
|
2007-07-13 06:34:05 -07:00
|
|
|
if (attr->existsAttribute(prefix.c_str())) // legacy
|
|
|
|
outMaterial.setFlag(EMF_TRILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));
|
|
|
|
else
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2008-09-04 06:18:58 -07:00
|
|
|
outMaterial.TextureLayer[i].TrilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str());
|
2007-07-13 06:34:05 -07:00
|
|
|
|
2007-06-25 14:26:16 -07:00
|
|
|
prefix = "AnisotropicFilter";
|
2007-07-13 06:34:05 -07:00
|
|
|
if (attr->existsAttribute(prefix.c_str())) // legacy
|
|
|
|
outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str()));
|
|
|
|
else
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
2009-01-04 16:30:11 -08:00
|
|
|
outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str());
|
2007-07-13 06:34:05 -07:00
|
|
|
|
2007-06-25 14:26:16 -07:00
|
|
|
prefix = "TextureWrap";
|
2009-11-16 07:58:54 -08:00
|
|
|
if (attr->existsAttribute(prefix.c_str())) // legacy
|
|
|
|
{
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
|
|
|
{
|
|
|
|
outMaterial.TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+core::stringc(i+1)).c_str(), aTextureClampNames);
|
|
|
|
outMaterial.TextureLayer[i].TextureWrapV = outMaterial.TextureLayer[i].TextureWrapU;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
|
|
|
{
|
|
|
|
outMaterial.TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"U"+core::stringc(i+1)).c_str(), aTextureClampNames);
|
|
|
|
outMaterial.TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"V"+core::stringc(i+1)).c_str(), aTextureClampNames);
|
|
|
|
}
|
|
|
|
}
|
2009-01-28 15:45:59 -08:00
|
|
|
|
2009-02-01 13:52:47 -08:00
|
|
|
// default 0 is ok
|
2009-01-28 15:45:59 -08:00
|
|
|
prefix="LODBias";
|
|
|
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
|
|
|
outMaterial.TextureLayer[i].LODBias = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str());
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns driver and operating system specific data about the IVideoDriver.
|
|
|
|
const SExposedVideoData& CNullDriver::getExposedVideoData()
|
|
|
|
{
|
|
|
|
return ExposedData;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns type of video driver
|
2007-09-15 17:18:13 -07:00
|
|
|
E_DRIVER_TYPE CNullDriver::getDriverType() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return EDT_NULL;
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! deletes all material renderers
|
|
|
|
void CNullDriver::deleteMaterialRenders()
|
|
|
|
{
|
|
|
|
// delete material renderers
|
2008-02-12 07:31:35 -08:00
|
|
|
for (u32 i=0; i<MaterialRenderers.size(); ++i)
|
2007-05-20 11:03:49 -07:00
|
|
|
if (MaterialRenderers[i].Renderer)
|
|
|
|
MaterialRenderers[i].Renderer->drop();
|
|
|
|
|
|
|
|
MaterialRenderers.clear();
|
|
|
|
}
|
|
|
|
|
2008-02-12 07:31:35 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Returns pointer to material renderer or null
|
|
|
|
IMaterialRenderer* CNullDriver::getMaterialRenderer(u32 idx)
|
|
|
|
{
|
|
|
|
if ( idx < MaterialRenderers.size() )
|
|
|
|
return MaterialRenderers[idx].Renderer;
|
2007-09-17 09:09:50 -07:00
|
|
|
else
|
|
|
|
return 0;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns amount of currently available material renderers.
|
2007-09-17 09:09:50 -07:00
|
|
|
u32 CNullDriver::getMaterialRendererCount() const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return MaterialRenderers.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns name of the material renderer
|
2007-09-17 09:09:50 -07:00
|
|
|
const char* CNullDriver::getMaterialRendererName(u32 idx) const
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
if ( idx < MaterialRenderers.size() )
|
|
|
|
return MaterialRenderers[idx].Name.c_str();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns pointer to the IGPUProgrammingServices interface.
|
|
|
|
IGPUProgrammingServices* CNullDriver::getGPUProgrammingServices()
|
|
|
|
{
|
2009-11-24 00:31:10 -08:00
|
|
|
return this;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2009-11-24 15:35:43 -08:00
|
|
|
//! Adds a new material renderer to the VideoDriver, based on a high level shading language.
|
2007-05-20 11:03:49 -07:00
|
|
|
s32 CNullDriver::addHighLevelShaderMaterial(
|
|
|
|
const c8* vertexShaderProgram,
|
|
|
|
const c8* vertexShaderEntryPointName,
|
|
|
|
E_VERTEX_SHADER_TYPE vsCompileTarget,
|
|
|
|
const c8* pixelShaderProgram,
|
|
|
|
const c8* pixelShaderEntryPointName,
|
|
|
|
E_PIXEL_SHADER_TYPE psCompileTarget,
|
2009-11-24 15:35:43 -08:00
|
|
|
const c8* geometryShaderProgram,
|
|
|
|
const c8* geometryShaderEntryPointName,
|
|
|
|
E_GEOMETRY_SHADER_TYPE gsCompileTarget,
|
2009-12-07 09:27:22 -08:00
|
|
|
scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
|
|
|
|
u32 verticesOut,
|
2007-05-20 11:03:49 -07:00
|
|
|
IShaderConstantSetCallBack* callback,
|
|
|
|
E_MATERIAL_TYPE baseMaterial,
|
|
|
|
s32 userData)
|
|
|
|
{
|
|
|
|
os::Printer::log("High level shader materials not available (yet) in this driver, sorry");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
|
|
|
|
//! but tries to load the programs from files.
|
|
|
|
s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
|
2009-11-24 15:35:43 -08:00
|
|
|
const io::path& vertexShaderProgramFileName,
|
|
|
|
const c8* vertexShaderEntryPointName,
|
|
|
|
E_VERTEX_SHADER_TYPE vsCompileTarget,
|
|
|
|
const io::path& pixelShaderProgramFileName,
|
|
|
|
const c8* pixelShaderEntryPointName,
|
|
|
|
E_PIXEL_SHADER_TYPE psCompileTarget,
|
|
|
|
const io::path& geometryShaderProgramFileName,
|
|
|
|
const c8* geometryShaderEntryPointName,
|
|
|
|
E_GEOMETRY_SHADER_TYPE gsCompileTarget,
|
2009-12-07 09:27:22 -08:00
|
|
|
scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
|
|
|
|
u32 verticesOut,
|
2009-11-24 15:35:43 -08:00
|
|
|
IShaderConstantSetCallBack* callback,
|
|
|
|
E_MATERIAL_TYPE baseMaterial,
|
|
|
|
s32 userData)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
io::IReadFile* vsfile = 0;
|
|
|
|
io::IReadFile* psfile = 0;
|
2009-11-24 15:35:43 -08:00
|
|
|
io::IReadFile* gsfile = 0;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
2009-11-24 15:35:43 -08:00
|
|
|
if (vertexShaderProgramFileName.size() )
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-11-24 15:35:43 -08:00
|
|
|
vsfile = FileSystem->createAndOpenFile(vertexShaderProgramFileName);
|
2007-05-20 11:03:49 -07:00
|
|
|
if (!vsfile)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not open vertex shader program file",
|
2009-11-24 15:35:43 -08:00
|
|
|
vertexShaderProgramFileName, ELL_WARNING);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 15:35:43 -08:00
|
|
|
if (pixelShaderProgramFileName.size() )
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2009-11-24 15:35:43 -08:00
|
|
|
psfile = FileSystem->createAndOpenFile(pixelShaderProgramFileName);
|
2007-05-20 11:03:49 -07:00
|
|
|
if (!psfile)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not open pixel shader program file",
|
2009-11-24 15:35:43 -08:00
|
|
|
pixelShaderProgramFileName, ELL_WARNING);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (geometryShaderProgramFileName.size() )
|
|
|
|
{
|
|
|
|
gsfile = FileSystem->createAndOpenFile(geometryShaderProgramFileName);
|
|
|
|
if (!gsfile)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not open geometry shader program file",
|
|
|
|
geometryShaderProgramFileName, ELL_WARNING);
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 result = addHighLevelShaderMaterialFromFiles(
|
|
|
|
vsfile, vertexShaderEntryPointName, vsCompileTarget,
|
|
|
|
psfile, pixelShaderEntryPointName, psCompileTarget,
|
2009-11-24 15:35:43 -08:00
|
|
|
gsfile, geometryShaderEntryPointName, gsCompileTarget,
|
2009-12-07 09:27:22 -08:00
|
|
|
inType, outType, verticesOut,
|
2007-05-20 11:03:49 -07:00
|
|
|
callback, baseMaterial, userData);
|
|
|
|
|
|
|
|
if (psfile)
|
|
|
|
psfile->drop();
|
|
|
|
|
|
|
|
if (vsfile)
|
|
|
|
vsfile->drop();
|
|
|
|
|
2009-11-24 15:35:43 -08:00
|
|
|
if (gsfile)
|
|
|
|
gsfile->drop();
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
|
|
|
|
//! but tries to load the programs from files.
|
|
|
|
s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
|
2009-11-24 15:35:43 -08:00
|
|
|
io::IReadFile* vertexShaderProgram,
|
|
|
|
const c8* vertexShaderEntryPointName,
|
|
|
|
E_VERTEX_SHADER_TYPE vsCompileTarget,
|
|
|
|
io::IReadFile* pixelShaderProgram,
|
|
|
|
const c8* pixelShaderEntryPointName,
|
|
|
|
E_PIXEL_SHADER_TYPE psCompileTarget,
|
|
|
|
io::IReadFile* geometryShaderProgram,
|
|
|
|
const c8* geometryShaderEntryPointName,
|
|
|
|
E_GEOMETRY_SHADER_TYPE gsCompileTarget,
|
2009-12-07 09:27:22 -08:00
|
|
|
scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
|
|
|
|
u32 verticesOut,
|
2009-11-24 15:35:43 -08:00
|
|
|
IShaderConstantSetCallBack* callback,
|
|
|
|
E_MATERIAL_TYPE baseMaterial,
|
|
|
|
s32 userData)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
c8* vs = 0;
|
|
|
|
c8* ps = 0;
|
2009-11-24 15:35:43 -08:00
|
|
|
c8* gs = 0;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
if (vertexShaderProgram)
|
|
|
|
{
|
2007-09-14 02:07:11 -07:00
|
|
|
const long size = vertexShaderProgram->getSize();
|
2007-05-20 11:03:49 -07:00
|
|
|
if (size)
|
|
|
|
{
|
|
|
|
vs = new c8[size+1];
|
|
|
|
vertexShaderProgram->read(vs, size);
|
|
|
|
vs[size] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pixelShaderProgram)
|
|
|
|
{
|
2007-09-14 02:07:11 -07:00
|
|
|
const long size = pixelShaderProgram->getSize();
|
2007-05-20 11:03:49 -07:00
|
|
|
if (size)
|
|
|
|
{
|
2008-03-27 16:39:37 -07:00
|
|
|
// if both handles are the same we must reset the file
|
|
|
|
if (pixelShaderProgram==vertexShaderProgram)
|
|
|
|
pixelShaderProgram->seek(0);
|
2007-05-20 11:03:49 -07:00
|
|
|
ps = new c8[size+1];
|
|
|
|
pixelShaderProgram->read(ps, size);
|
|
|
|
ps[size] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-24 15:35:43 -08:00
|
|
|
if (geometryShaderProgram)
|
|
|
|
{
|
|
|
|
const long size = geometryShaderProgram->getSize();
|
|
|
|
if (size)
|
|
|
|
{
|
|
|
|
// if both handles are the same we must reset the file
|
|
|
|
if ((geometryShaderProgram==vertexShaderProgram) ||
|
|
|
|
(geometryShaderProgram==pixelShaderProgram))
|
|
|
|
geometryShaderProgram->seek(0);
|
|
|
|
gs = new c8[size+1];
|
|
|
|
geometryShaderProgram->read(gs, size);
|
|
|
|
gs[size] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
s32 result = this->addHighLevelShaderMaterial(
|
|
|
|
vs, vertexShaderEntryPointName, vsCompileTarget,
|
|
|
|
ps, pixelShaderEntryPointName, psCompileTarget,
|
2009-11-24 15:35:43 -08:00
|
|
|
gs, geometryShaderEntryPointName, gsCompileTarget,
|
2009-12-07 09:27:22 -08:00
|
|
|
inType, outType, verticesOut,
|
2007-05-20 11:03:49 -07:00
|
|
|
callback, baseMaterial, userData);
|
|
|
|
|
|
|
|
delete [] vs;
|
|
|
|
delete [] ps;
|
2009-11-24 15:35:43 -08:00
|
|
|
delete [] gs;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Adds a new material renderer to the VideoDriver, using pixel and/or
|
|
|
|
//! vertex shaders to render geometry.
|
|
|
|
s32 CNullDriver::addShaderMaterial(const c8* vertexShaderProgram,
|
|
|
|
const c8* pixelShaderProgram,
|
|
|
|
IShaderConstantSetCallBack* callback,
|
|
|
|
E_MATERIAL_TYPE baseMaterial,
|
|
|
|
s32 userData)
|
|
|
|
{
|
|
|
|
os::Printer::log("Shader materials not implemented yet in this driver, sorry.");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
|
|
|
|
//! programs from files.
|
|
|
|
s32 CNullDriver::addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram,
|
|
|
|
io::IReadFile* pixelShaderProgram,
|
|
|
|
IShaderConstantSetCallBack* callback,
|
|
|
|
E_MATERIAL_TYPE baseMaterial,
|
|
|
|
s32 userData)
|
|
|
|
{
|
|
|
|
c8* vs = 0;
|
|
|
|
c8* ps = 0;
|
|
|
|
|
|
|
|
if (vertexShaderProgram)
|
|
|
|
{
|
2007-09-14 02:07:11 -07:00
|
|
|
const long size = vertexShaderProgram->getSize();
|
2007-05-20 11:03:49 -07:00
|
|
|
if (size)
|
|
|
|
{
|
|
|
|
vs = new c8[size+1];
|
|
|
|
vertexShaderProgram->read(vs, size);
|
|
|
|
vs[size] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pixelShaderProgram)
|
|
|
|
{
|
2007-09-14 02:07:11 -07:00
|
|
|
const long size = pixelShaderProgram->getSize();
|
2007-05-20 11:03:49 -07:00
|
|
|
if (size)
|
|
|
|
{
|
|
|
|
ps = new c8[size+1];
|
|
|
|
pixelShaderProgram->read(ps, size);
|
|
|
|
ps[size] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 result = addShaderMaterial(vs, ps, callback, baseMaterial, userData);
|
|
|
|
|
|
|
|
delete [] vs;
|
|
|
|
delete [] ps;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
|
|
|
|
//! programs from files.
|
2009-08-24 02:12:27 -07:00
|
|
|
s32 CNullDriver::addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
|
|
|
|
const io::path& pixelShaderProgramFileName,
|
2007-05-20 11:03:49 -07:00
|
|
|
IShaderConstantSetCallBack* callback,
|
|
|
|
E_MATERIAL_TYPE baseMaterial,
|
|
|
|
s32 userData)
|
|
|
|
{
|
|
|
|
io::IReadFile* vsfile = 0;
|
|
|
|
io::IReadFile* psfile = 0;
|
|
|
|
|
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-e03cc46cb475
2009-01-27 07:53:53 -08:00
|
|
|
if (vertexShaderProgramFileName.size())
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
vsfile = FileSystem->createAndOpenFile(vertexShaderProgramFileName);
|
|
|
|
if (!vsfile)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not open vertex shader program file",
|
|
|
|
vertexShaderProgramFileName, ELL_WARNING);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-e03cc46cb475
2009-01-27 07:53:53 -08:00
|
|
|
if (pixelShaderProgramFileName.size())
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
psfile = FileSystem->createAndOpenFile(pixelShaderProgramFileName);
|
|
|
|
if (!psfile)
|
|
|
|
{
|
|
|
|
os::Printer::log("Could not open pixel shader program file",
|
|
|
|
pixelShaderProgramFileName, ELL_WARNING);
|
|
|
|
if (vsfile)
|
|
|
|
vsfile->drop();
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 result = addShaderMaterialFromFiles(vsfile, psfile, callback,
|
|
|
|
baseMaterial, userData);
|
|
|
|
|
|
|
|
if (psfile)
|
|
|
|
psfile->drop();
|
|
|
|
|
|
|
|
if (vsfile)
|
|
|
|
vsfile->drop();
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2008-10-09 01:13:34 -07:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Creates a render target texture.
|
2009-01-19 05:48:22 -08:00
|
|
|
ITexture* CNullDriver::addRenderTargetTexture(const core::dimension2d<u32>& size,
|
2009-08-24 02:12:27 -07:00
|
|
|
const io::path&name, const ECOLOR_FORMAT format)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-10-09 01:13:34 -07:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Clears the ZBuffer.
|
|
|
|
void CNullDriver::clearZBuffer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-08-13 16:48:33 -07:00
|
|
|
|
|
|
|
//! Returns a pointer to the mesh manipulator.
|
|
|
|
scene::IMeshManipulator* CNullDriver::getMeshManipulator()
|
|
|
|
{
|
|
|
|
return MeshManipulator;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
//! Returns an image created from the last rendered frame.
|
|
|
|
IImage* CNullDriver::createScreenShot()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-10-09 01:13:34 -07:00
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
// prints renderer version
|
|
|
|
void CNullDriver::printVersion()
|
|
|
|
{
|
|
|
|
core::stringw namePrint = L"Using renderer: ";
|
|
|
|
namePrint += getName();
|
|
|
|
os::Printer::log(namePrint.c_str(), ELL_INFORMATION);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! creates a video driver
|
2009-01-19 05:48:22 -08:00
|
|
|
IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize)
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
2008-01-30 16:17:44 -08:00
|
|
|
CNullDriver* nullDriver = new CNullDriver(io, screenSize);
|
|
|
|
|
|
|
|
// create empty material renderers
|
|
|
|
for(u32 i=0; sBuiltInMaterialTypeNames[i]; ++i)
|
|
|
|
{
|
|
|
|
IMaterialRenderer* imr = new IMaterialRenderer();
|
|
|
|
nullDriver->addMaterialRenderer(imr);
|
|
|
|
imr->drop();
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullDriver;
|
2007-05-20 11:03:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-10 06:06:52 -07:00
|
|
|
//! Set/unset a clipping plane.
|
|
|
|
//! There are at least 6 clipping planes available for the user to set at will.
|
|
|
|
//! \param index: The plane index. Must be between 0 and MaxUserClipPlanes.
|
|
|
|
//! \param plane: The plane itself.
|
|
|
|
//! \param enable: If true, enable the clipping plane else disable it.
|
|
|
|
bool CNullDriver::setClipPlane(u32 index, const core::plane3df& plane, bool enable)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-01-05 07:34:22 -08:00
|
|
|
|
2007-08-10 06:06:52 -07:00
|
|
|
//! Enable/disable a clipping plane.
|
|
|
|
void CNullDriver::enableClipPlane(u32 index, bool enable)
|
|
|
|
{
|
|
|
|
// not necessary
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-19 05:48:22 -08:00
|
|
|
ITexture* CNullDriver::createRenderTargetTexture(const core::dimension2d<u32>& size,
|
2008-10-09 01:13:34 -07:00
|
|
|
const c8* name)
|
|
|
|
{
|
2008-11-06 08:55:11 -08:00
|
|
|
os::Printer::log("createRenderTargetTexture is deprecated, use addRenderTargetTexture instead");
|
2008-10-09 01:13:34 -07:00
|
|
|
ITexture* tex = addRenderTargetTexture(size, name);
|
|
|
|
tex->grab();
|
|
|
|
return tex;
|
|
|
|
}
|
|
|
|
|
2009-01-23 08:43:04 -08:00
|
|
|
|
|
|
|
void CNullDriver::setMinHardwareBufferVertexCount(u32 count)
|
|
|
|
{
|
|
|
|
MinVertexCountForVBO = count;
|
|
|
|
}
|
|
|
|
|
2009-02-03 16:22:49 -08:00
|
|
|
|
|
|
|
SOverrideMaterial& CNullDriver::getOverrideMaterial()
|
|
|
|
{
|
|
|
|
return OverrideMaterial;
|
|
|
|
}
|
|
|
|
|
2009-10-23 08:44:31 -07:00
|
|
|
|
|
|
|
core::dimension2du CNullDriver::getMaxTextureSize() const
|
|
|
|
{
|
|
|
|
return core::dimension2du(0x10000,0x10000); // maybe large enough
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
} // end namespace
|
|
|
|
} // end namespace
|