Added EXP2 fog distribution.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2480 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
9896695873
commit
e6b44d8605
|
@ -1,5 +1,7 @@
|
|||
Changes in 1.6
|
||||
|
||||
- Added support for EXP2 fog distribution. This required a change in the setFog parameters where now an enum value instead of the bool linear is given.
|
||||
|
||||
- IFileSystem changes:
|
||||
|
||||
- Renamed the following functions-
|
||||
|
|
|
@ -222,7 +222,7 @@ int main()
|
|||
Please note that you will have to set the material flag EMF_FOG_ENABLE
|
||||
to 'true' in every scene node which should be affected by this fog.
|
||||
*/
|
||||
driver->setFog(video::SColor(0,138,125,81), true, 250, 1000, 0, true);
|
||||
driver->setFog(video::SColor(0,138,125,81), video::EFT_FOG_LINEAR, 250, 1000, .003f, true, false);
|
||||
|
||||
/*
|
||||
To be able to display something interesting, we load a mesh from a .3ds
|
||||
|
|
|
@ -82,6 +82,10 @@ namespace video
|
|||
ETS_COUNT
|
||||
};
|
||||
|
||||
//! enumeration for signalling ressources which were lost after the last render cycle
|
||||
/** These values can be signalled by the driver, telling the app that some ressources
|
||||
were lost and need to be recreated. Irrlicht will sometimes recreate the actual objects,
|
||||
but the content needs to be recreated by the application. */
|
||||
enum E_LOST_RESSOURCE
|
||||
{
|
||||
//! The whole device/driver is lost
|
||||
|
@ -94,6 +98,8 @@ namespace video
|
|||
ELR_HW_BUFFERS = 8
|
||||
};
|
||||
|
||||
//! Special render targets, which usually map to dedicated hardware
|
||||
/** These render targets (besides 0 and 1) need not be supported by gfx cards */
|
||||
enum E_RENDER_TARGET
|
||||
{
|
||||
//! Render target is the main color frame buffer
|
||||
|
@ -118,6 +124,14 @@ namespace video
|
|||
ERT_AUX_BUFFER4
|
||||
};
|
||||
|
||||
//! Enum for the types of fog distributions to choose from
|
||||
enum E_FOG_TYPE
|
||||
{
|
||||
EFT_FOG_EXP=0,
|
||||
EFT_FOG_LINEAR,
|
||||
EFT_FOG_EXP2
|
||||
};
|
||||
|
||||
struct SOverrideMaterial
|
||||
{
|
||||
//! The Material values
|
||||
|
@ -812,8 +826,8 @@ namespace video
|
|||
not the z-coordinate. This is better, but slower. This is only
|
||||
available with D3D and vertex fog. */
|
||||
virtual void setFog(SColor color=SColor(0,255,255,255),
|
||||
bool linearFog=true, f32 start=50.0f, f32 end=100.0f,
|
||||
f32 density=0.01f,
|
||||
E_FOG_TYPE fogType=EFT_FOG_LINEAR,
|
||||
f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
|
||||
bool pixelFog=false, bool rangeFog=false) =0;
|
||||
|
||||
//! Get the current color format of the color buffer
|
||||
|
|
|
@ -1964,28 +1964,25 @@ u32 CD3D8Driver::getMaximalPrimitiveCount() const
|
|||
|
||||
|
||||
//! Sets the fog mode.
|
||||
void CD3D8Driver::setFog(SColor color, bool linearFog, f32 start,
|
||||
void CD3D8Driver::setFog(SColor color, E_FOG_TYPE fogType, f32 start,
|
||||
f32 end, f32 density, bool pixelFog, bool rangeFog)
|
||||
{
|
||||
CNullDriver::setFog(color, linearFog, start, end, density, pixelFog, rangeFog);
|
||||
CNullDriver::setFog(color, fogType, start, end, density, pixelFog, rangeFog);
|
||||
|
||||
if (!pID3DDevice)
|
||||
return;
|
||||
|
||||
pID3DDevice->SetRenderState(D3DRS_FOGCOLOR, color.color);
|
||||
|
||||
pID3DDevice->SetRenderState(
|
||||
#if defined( _IRR_XBOX_PLATFORM_)
|
||||
pID3DDevice->SetRenderState(
|
||||
pixelFog ? D3DRS_FOGTABLEMODE : D3DRS_FOGTABLEMODE,
|
||||
linearFog ? D3DFOG_LINEAR : D3DFOG_EXP);
|
||||
|
||||
D3DRS_FOGTABLEMODE,
|
||||
#else
|
||||
pID3DDevice->SetRenderState(
|
||||
pixelFog ? D3DRS_FOGTABLEMODE : D3DRS_FOGVERTEXMODE,
|
||||
linearFog ? D3DFOG_LINEAR : D3DFOG_EXP);
|
||||
#endif
|
||||
(fogType==EFT_FOG_LINEAR)? D3DFOG_LINEAR : (fogType==EFT_FOG_EXP)?D3DFOG_EXP:D3DFOG_EXP2);
|
||||
|
||||
if(linearFog)
|
||||
if (fogType==EFT_FOG_LINEAR)
|
||||
{
|
||||
pID3DDevice->SetRenderState(D3DRS_FOGSTART, *(DWORD*)(&start));
|
||||
pID3DDevice->SetRenderState(D3DRS_FOGEND, *(DWORD*)(&end));
|
||||
|
@ -1994,7 +1991,7 @@ void CD3D8Driver::setFog(SColor color, bool linearFog, f32 start,
|
|||
pID3DDevice->SetRenderState(D3DRS_FOGDENSITY, *(DWORD*)(&density));
|
||||
|
||||
if(!pixelFog)
|
||||
pID3DDevice->SetRenderState (D3DRS_RANGEFOGENABLE, rangeFog);
|
||||
pID3DDevice->SetRenderState(D3DRS_RANGEFOGENABLE, rangeFog);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace video
|
|||
virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled);
|
||||
|
||||
//! Sets the fog mode.
|
||||
virtual void setFog(SColor color, bool linearFog, f32 start,
|
||||
virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start,
|
||||
f32 end, f32 density, bool pixelFog, bool rangeFog);
|
||||
|
||||
//! Only used by the internal engine. Used to notify the driver that
|
||||
|
|
|
@ -2315,10 +2315,10 @@ u32 CD3D9Driver::getMaximalPrimitiveCount() const
|
|||
|
||||
|
||||
//! Sets the fog mode.
|
||||
void CD3D9Driver::setFog(SColor color, bool linearFog, f32 start,
|
||||
void CD3D9Driver::setFog(SColor color, E_FOG_TYPE fogType, f32 start,
|
||||
f32 end, f32 density, bool pixelFog, bool rangeFog)
|
||||
{
|
||||
CNullDriver::setFog(color, linearFog, start, end, density, pixelFog, rangeFog);
|
||||
CNullDriver::setFog(color, fogType, start, end, density, pixelFog, rangeFog);
|
||||
|
||||
if (!pID3DDevice)
|
||||
return;
|
||||
|
@ -2327,9 +2327,9 @@ void CD3D9Driver::setFog(SColor color, bool linearFog, f32 start,
|
|||
|
||||
pID3DDevice->SetRenderState(
|
||||
pixelFog ? D3DRS_FOGTABLEMODE : D3DRS_FOGVERTEXMODE,
|
||||
linearFog ? D3DFOG_LINEAR : D3DFOG_EXP);
|
||||
(fogType==EFT_FOG_LINEAR)? D3DFOG_LINEAR : (fogType==EFT_FOG_EXP)?D3DFOG_EXP:D3DFOG_EXP2);
|
||||
|
||||
if(linearFog)
|
||||
if (fogType==EFT_FOG_LINEAR)
|
||||
{
|
||||
pID3DDevice->SetRenderState(D3DRS_FOGSTART, *(DWORD*)(&start));
|
||||
pID3DDevice->SetRenderState(D3DRS_FOGEND, *(DWORD*)(&end));
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace video
|
|||
virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled);
|
||||
|
||||
//! Sets the fog mode.
|
||||
virtual void setFog(SColor color, bool linearFog, f32 start,
|
||||
virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start,
|
||||
f32 end, f32 density, bool pixelFog, bool rangeFog);
|
||||
|
||||
//! Only used by the internal engine. Used to notify the driver that
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
// doesn't actually seem to be necessary except to pull in sys/ioctl.h.
|
||||
#define _INPUT_H
|
||||
#include <sys/ioctl.h> // Would normally be included in linux/input.h
|
||||
#define BITS_PER_LONG 32
|
||||
#include <linux/joystick.h>
|
||||
#undef _INPUT_H
|
||||
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
|
|
|
@ -1371,11 +1371,11 @@ IImage* CNullDriver::createImage(IImage* imageToCopy, const core::position2d<s32
|
|||
|
||||
|
||||
//! Sets the fog mode.
|
||||
void CNullDriver::setFog(SColor color, bool linearFog, f32 start, f32 end,
|
||||
void CNullDriver::setFog(SColor color, E_FOG_TYPE fogType, f32 start, f32 end,
|
||||
f32 density, bool pixelFog, bool rangeFog)
|
||||
{
|
||||
FogColor = color;
|
||||
LinearFog = linearFog;
|
||||
FogType = fogType;
|
||||
FogStart = start;
|
||||
FogEnd = end;
|
||||
FogDensity = density;
|
||||
|
|
|
@ -208,9 +208,10 @@ namespace video
|
|||
virtual void draw2DPolygon(core::position2d<s32> center,
|
||||
f32 radius, video::SColor Color, s32 vertexCount);
|
||||
|
||||
virtual void setFog(SColor color=SColor(0,255,255,255), bool linearFog=true,
|
||||
f32 start=50.0f, f32 end=100.0f,
|
||||
f32 density=0.01f, bool pixelFog=false, bool rangeFog=false);
|
||||
virtual void setFog(SColor color=SColor(0,255,255,255),
|
||||
E_FOG_TYPE fogType=EFT_FOG_LINEAR,
|
||||
f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
|
||||
bool pixelFog=false, bool rangeFog=false);
|
||||
|
||||
//! get color format of the current color buffer
|
||||
virtual ECOLOR_FORMAT getColorFormat() const;
|
||||
|
@ -680,7 +681,7 @@ namespace video
|
|||
|
||||
SOverrideMaterial OverrideMaterial;
|
||||
|
||||
bool LinearFog;
|
||||
E_FOG_TYPE FogType;
|
||||
bool PixelFog;
|
||||
bool RangeFog;
|
||||
bool AllowZWriteOnTransparent;
|
||||
|
|
|
@ -550,7 +550,7 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
|||
glAlphaFunc(GL_GREATER, 0.f);
|
||||
|
||||
// set fog mode
|
||||
setFog(FogColor, LinearFog, FogStart, FogEnd, FogDensity, PixelFog, RangeFog);
|
||||
setFog(FogColor, FogType, FogStart, FogEnd, FogDensity, PixelFog, RangeFog);
|
||||
|
||||
// create matrix for flipping textures
|
||||
TextureFlipMatrix.buildTextureTransform(0.0f, core::vector2df(0,0), core::vector2df(0,1.0f), core::vector2df(1.0f,-1.0f));
|
||||
|
@ -2782,18 +2782,18 @@ void COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor lef
|
|||
|
||||
|
||||
//! Sets the fog mode.
|
||||
void COpenGLDriver::setFog(SColor c, bool linearFog, f32 start,
|
||||
void COpenGLDriver::setFog(SColor c, E_FOG_TYPE fogType, f32 start,
|
||||
f32 end, f32 density, bool pixelFog, bool rangeFog)
|
||||
{
|
||||
CNullDriver::setFog(c, linearFog, start, end, density, pixelFog, rangeFog);
|
||||
CNullDriver::setFog(c, fogType, start, end, density, pixelFog, rangeFog);
|
||||
|
||||
glFogf(GL_FOG_MODE, GLfloat(linearFog ? GL_LINEAR : GL_EXP));
|
||||
glFogf(GL_FOG_MODE, GLfloat((fogType==EFT_FOG_LINEAR)? GL_LINEAR : (fogType==EFT_FOG_EXP)?GL_EXP:GL_EXP2));
|
||||
#ifdef GL_EXT_fog_coord
|
||||
if (FeatureAvailable[IRR_EXT_fog_coord])
|
||||
glFogi(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH);
|
||||
#endif
|
||||
|
||||
if (linearFog)
|
||||
if (fogType==EFT_FOG_LINEAR)
|
||||
{
|
||||
glFogf(GL_FOG_START, start);
|
||||
glFogf(GL_FOG_END, end);
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace video
|
|||
virtual void setViewPort(const core::rect<s32>& area);
|
||||
|
||||
//! Sets the fog mode.
|
||||
virtual void setFog(SColor color, bool linearFog, f32 start,
|
||||
virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start,
|
||||
f32 end, f32 density, bool pixelFog, bool rangeFog);
|
||||
|
||||
//! Only used by the internal engine. Used to notify the driver that
|
||||
|
|
|
@ -1494,10 +1494,10 @@ void CBurningVideoDriver::setMaterial(const SMaterial& material)
|
|||
#ifdef SOFTWARE_DRIVER_2_LIGHTING
|
||||
|
||||
//! Sets the fog mode.
|
||||
void CBurningVideoDriver::setFog(SColor color, bool linearFog, f32 start,
|
||||
void CBurningVideoDriver::setFog(SColor color, E_FOG_TYPE fogType, f32 start,
|
||||
f32 end, f32 density, bool pixelFog, bool rangeFog)
|
||||
{
|
||||
CNullDriver::setFog(color, linearFog, start, end, density, pixelFog, rangeFog);
|
||||
CNullDriver::setFog(color, fogType, start, end, density, pixelFog, rangeFog);
|
||||
LightSpace.FogColor.setA8R8G8B8 ( color.color );
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ namespace video
|
|||
|
||||
void lightVertex ( s4DVertex *dest, u32 vertexargb );
|
||||
//! Sets the fog mode.
|
||||
virtual void setFog(SColor color, bool linearFog, f32 start,
|
||||
virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start,
|
||||
f32 end, f32 density, bool pixelFog, bool rangeFog);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue