- PixelBlend16 and PixelBlend16_simd are working for the new rules. - bugfix. CLightSceneNode didn't correctly update it's attributes Lighting Linear Attenuation. = 1.f / radius The Example loadirr files set the lightscene radius to 1000.f but stays on the previous default attentuation with the older radius 100 -> 1.f / 100 so the examples looks golden-brown. Now the radius is correctly!! set to the attenuation of 1.f/1000.f because the file doesn't have special attenuation. and now it looks more yellow. can anybody show me a correct screenshot for this file;-)? Niko? Or is this behavior the default lighting?. then it would be a fixed constant linear attenuation of 0.01f;-). Please clearify For now i didn't fixed it I encountered this behavior because i ( burning video ) used the original radius for calculations and so i've found that radius != 1.f / linearAttenuation but in the LightSceneNode this formula was used.. confused;-) - vector template and equals tests as working with the test suits i cleaned the template behavior (mixed types are used in the templates) and added all missing special math function with their coressponding type I also set the equal test for s32 to behave like the f32 routine. The function equals always implements a weak test. that means a tolerance MUST always be used if you use the equal function. default is 1. you can set it to zero a==b-> equals ( a, b, 0 ) but do it explicit like you have to for floating compare. This is important when irrlicht is going to use special hardware math acceleration on a per function base, like sse2, or the other way round fixpoint. - VideoDriver drawPixel The HW renderes are using the alpha components for blending. The Software Renderes and image loaders are using CImage::setPixel copy. so setPixel is engaged to either blends or copy the pixel default: false - Burningvideo added RenderMaterial EMT_SPHERE_MAP pushed burningsvideo to 0.43 added RenderMaterial EMT_REFLECTION_2_LAYER pushed burningsvideo to 0.44 set EMT_TRANSPARENT_ALPHA_CHANNEL_REF to use AlphaRef 0.5 like Direct3D One Note: in OpenGL there is know difference between sphere_map and reflection layer both using GL_TEXTURE_GEN_MODE GL_SPHERE_MAP, whereas in d3d one time using camera_normal on sphere and reflection on refletcion_layer. The visual difference is that on sphere map the "image is not moving" when you rotate the viewer. For Buring i took the opengl visual. always moving - rename quake3 SEntity to IEntity to be confom with IShader even IShader and IEntity are none pure virtual interfaces like most irrlicht objects git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2207 dfc29bdd-3216-0410-991c-e03cc46cb475
133 lines
3.2 KiB
C++
133 lines
3.2 KiB
C++
// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
|
|
// This file is part of the "Irrlicht Engine".
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
#include "IrrCompileConfig.h"
|
|
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
|
|
|
#include "SoftwareDriver2_compile_config.h"
|
|
#include "SoftwareDriver2_helper.h"
|
|
#include "CSoftwareTexture2.h"
|
|
#include "os.h"
|
|
|
|
namespace irr
|
|
{
|
|
namespace video
|
|
{
|
|
|
|
//! constructor
|
|
CSoftwareTexture2::CSoftwareTexture2(IImage* image, const core::string<c16>& name, u32 flags )
|
|
: ITexture(name), MipMapLOD(0), Flags ( flags )
|
|
{
|
|
#ifdef _DEBUG
|
|
setDebugName("CSoftwareTexture2");
|
|
#endif
|
|
|
|
#ifndef SOFTWARE_DRIVER_2_MIPMAPPING
|
|
Flags &= ~GEN_MIPMAP;
|
|
#endif
|
|
|
|
memset32 ( MipMap, 0, sizeof ( MipMap ) );
|
|
|
|
if (image)
|
|
{
|
|
OrigSize = image->getDimension();
|
|
|
|
core::setbit_cond ( Flags,
|
|
image->getColorFormat () == video::ECF_A8R8G8B8 ||
|
|
image->getColorFormat () == video::ECF_A1R5G5B5,
|
|
HAS_ALPHA
|
|
);
|
|
|
|
core::dimension2d<u32> optSize(
|
|
OrigSize.getOptimalSize( 0 != ( Flags & NP2_SIZE ),
|
|
false, false,
|
|
( Flags & NP2_SIZE ) ? SOFTWARE_DRIVER_2_TEXTURE_MAXSIZE : 0)
|
|
);
|
|
|
|
if ( OrigSize == optSize )
|
|
{
|
|
MipMap[0] = new CImage(BURNINGSHADER_COLOR_FORMAT, image);
|
|
}
|
|
else
|
|
{
|
|
char buf[256];
|
|
core::stringw showName ( name );
|
|
snprintf ( buf, 256, "Burningvideo: Warning Texture %ls reformat %dx%d -> %dx%d,%d",
|
|
showName.c_str(),
|
|
OrigSize.Width, OrigSize.Height, optSize.Width, optSize.Height,
|
|
BURNINGSHADER_COLOR_FORMAT
|
|
);
|
|
|
|
OrigSize = optSize;
|
|
os::Printer::log ( buf, ELL_WARNING );
|
|
MipMap[0] = new CImage(BURNINGSHADER_COLOR_FORMAT, optSize);
|
|
MipMap[0]->fill ( 0 );
|
|
|
|
|
|
// temporary CImage needed
|
|
CImage * temp = new CImage ( BURNINGSHADER_COLOR_FORMAT, image );
|
|
temp->copyToScalingBoxFilter ( MipMap[0],0, false );
|
|
//temp->copyToScaling(MipMap[0]);
|
|
temp->drop ();
|
|
}
|
|
}
|
|
|
|
regenerateMipMapLevels();
|
|
setCurrentMipMapLOD(0);
|
|
}
|
|
|
|
|
|
//! destructor
|
|
CSoftwareTexture2::~CSoftwareTexture2()
|
|
{
|
|
for ( s32 i = 0; i!= SOFTWARE_DRIVER_2_MIPMAPPING_MAX; ++i )
|
|
{
|
|
if ( MipMap[i] )
|
|
MipMap[i]->drop();
|
|
}
|
|
}
|
|
|
|
|
|
//! Regenerates the mip map levels of the texture. Useful after locking and
|
|
//! modifying the texture
|
|
void CSoftwareTexture2::regenerateMipMapLevels()
|
|
{
|
|
if ( !hasMipMaps () )
|
|
return;
|
|
|
|
s32 i;
|
|
|
|
// release
|
|
for ( i = 1; i < SOFTWARE_DRIVER_2_MIPMAPPING_MAX; ++i )
|
|
{
|
|
if ( MipMap[i] )
|
|
MipMap[i]->drop();
|
|
}
|
|
|
|
core::dimension2d<u32> newSize;
|
|
core::dimension2d<u32> currentSize;
|
|
|
|
i = 1;
|
|
CImage * c = MipMap[0];
|
|
while ( i < SOFTWARE_DRIVER_2_MIPMAPPING_MAX )
|
|
{
|
|
currentSize = c->getDimension();
|
|
newSize.Width = core::s32_max ( 1, currentSize.Width >> SOFTWARE_DRIVER_2_MIPMAPPING_SCALE );
|
|
newSize.Height = core::s32_max ( 1, currentSize.Height >> SOFTWARE_DRIVER_2_MIPMAPPING_SCALE );
|
|
|
|
MipMap[i] = new CImage(BURNINGSHADER_COLOR_FORMAT, newSize);
|
|
MipMap[i]->fill ( 0 );
|
|
MipMap[0]->copyToScalingBoxFilter( MipMap[i], 0, false );
|
|
c = MipMap[i];
|
|
++i;
|
|
}
|
|
}
|
|
|
|
|
|
} // end namespace video
|
|
} // end namespace irr
|
|
|
|
#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
|
|