Changes in 1.6 TA
- 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-e03cc46cb475master
63
changes.txt
|
@ -1,3 +1,64 @@
|
||||||
|
Changes in 1.6 TA
|
||||||
|
- 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
|
||||||
|
--------------------------------------------------------------
|
||||||
|
|
||||||
Changes in 1.6 TA
|
Changes in 1.6 TA
|
||||||
- fixed createMeshWith2TCoords
|
- fixed createMeshWith2TCoords
|
||||||
normals were missing during copy.
|
normals were missing during copy.
|
||||||
|
@ -1533,7 +1594,7 @@ Font improvements:
|
||||||
Texture scaling bugfix, support for alpha blending, new option to normalise weights,
|
Texture scaling bugfix, support for alpha blending, new option to normalise weights,
|
||||||
animation code optimization, fixed memory leak
|
animation code optimization, fixed memory leak
|
||||||
|
|
||||||
- ROUNDING_ERROR is now ROUNDING_ERROR_32 or ROUNDING_ERROR_64
|
- ROUNDING_ERROR is now ROUNDING_ERROR_f32 or ROUNDING_ERROR_f64
|
||||||
|
|
||||||
- Material ZBuffer flag changed to a u32 value
|
- Material ZBuffer flag changed to a u32 value
|
||||||
Reason: change ( off or on ) to , off, lequal, equal
|
Reason: change ( off or on ) to , off, lequal, equal
|
||||||
|
|
|
@ -311,7 +311,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
quake3::tQ3EntityList &entityList = mesh->getEntityList ();
|
quake3::tQ3EntityList &entityList = mesh->getEntityList ();
|
||||||
|
|
||||||
quake3::SEntity search;
|
quake3::IEntity search;
|
||||||
search.name = "info_player_deathmatch";
|
search.name = "info_player_deathmatch";
|
||||||
|
|
||||||
s32 index = entityList.binary_search ( search );
|
s32 index = entityList.binary_search ( search );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="8,00"
|
Version="8,00"
|
||||||
Name="17. HelloWorld for Windows Mobile on PC"
|
Name="17.HelloWorld for Windows Mobile on PC"
|
||||||
ProjectGUID="{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}"
|
ProjectGUID="{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}"
|
||||||
RootNamespace="My17HelloWorldforWindowsMobileonPC"
|
RootNamespace="My17HelloWorldforWindowsMobileonPC"
|
||||||
Keyword="Win32Proj"
|
Keyword="Win32Proj"
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
CMyLightManager(ISceneManager* sceneManager)
|
CMyLightManager(ISceneManager* sceneManager)
|
||||||
: Mode(NO_MANAGEMENT), RequestedMode(NO_MANAGEMENT),
|
: Mode(NO_MANAGEMENT), RequestedMode(NO_MANAGEMENT),
|
||||||
SceneManager(sceneManager), SceneLightList(0),
|
SceneManager(sceneManager), SceneLightList(0),
|
||||||
CurrentRenderPass(0), CurrentSceneNode(0)
|
CurrentRenderPass(ESNRP_NONE), CurrentSceneNode(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual ~CMyLightManager(void) { }
|
virtual ~CMyLightManager(void) { }
|
||||||
|
|
|
@ -30,8 +30,8 @@ struct GameData
|
||||||
{
|
{
|
||||||
GameData ( const string<c16> &startupDir);
|
GameData ( const string<c16> &startupDir);
|
||||||
void setDefault ();
|
void setDefault ();
|
||||||
s32 save ( const string<c16> filename );
|
s32 save ( const string<c16> &filename );
|
||||||
s32 load ( const string<c16> filename );
|
s32 load ( const string<c16> &filename );
|
||||||
|
|
||||||
s32 debugState;
|
s32 debugState;
|
||||||
s32 gravityState;
|
s32 gravityState;
|
||||||
|
@ -50,6 +50,8 @@ struct GameData
|
||||||
vector3df PlayerPosition;
|
vector3df PlayerPosition;
|
||||||
vector3df PlayerRotation;
|
vector3df PlayerRotation;
|
||||||
|
|
||||||
|
tQ3EntityList Variable;
|
||||||
|
|
||||||
Q3LevelLoadParameter loadParam;
|
Q3LevelLoadParameter loadParam;
|
||||||
SIrrlichtCreationParameters deviceParam;
|
SIrrlichtCreationParameters deviceParam;
|
||||||
funcptr_createDeviceEx createExDevice;
|
funcptr_createDeviceEx createExDevice;
|
||||||
|
@ -81,7 +83,11 @@ void GameData::setDefault ()
|
||||||
GammaValue = 1.f;
|
GammaValue = 1.f;
|
||||||
|
|
||||||
// default deviceParam;
|
// default deviceParam;
|
||||||
|
#if defined ( _IRR_WINDOWS_ )
|
||||||
deviceParam.DriverType = EDT_DIRECT3D9;
|
deviceParam.DriverType = EDT_DIRECT3D9;
|
||||||
|
#else
|
||||||
|
deviceParam.DriverType = EDT_OPENGL;
|
||||||
|
#endif
|
||||||
deviceParam.WindowSize.Width = 800;
|
deviceParam.WindowSize.Width = 800;
|
||||||
deviceParam.WindowSize.Height = 600;
|
deviceParam.WindowSize.Height = 600;
|
||||||
deviceParam.Fullscreen = false;
|
deviceParam.Fullscreen = false;
|
||||||
|
@ -93,6 +99,7 @@ void GameData::setDefault ()
|
||||||
// default Quake3 loadParam
|
// default Quake3 loadParam
|
||||||
loadParam.defaultLightMapMaterial = EMT_LIGHTMAP;
|
loadParam.defaultLightMapMaterial = EMT_LIGHTMAP;
|
||||||
loadParam.defaultModulate = EMFN_MODULATE_1X;
|
loadParam.defaultModulate = EMFN_MODULATE_1X;
|
||||||
|
loadParam.defaultFilter = EMF_ANISOTROPIC_FILTER;
|
||||||
loadParam.verbose = 1;
|
loadParam.verbose = 1;
|
||||||
loadParam.mergeShaderBuffer = 1; // merge meshbuffers with same material
|
loadParam.mergeShaderBuffer = 1; // merge meshbuffers with same material
|
||||||
loadParam.cleanUnResolvedMeshes = 1; // should unresolved meshes be cleaned. otherwise blue texture
|
loadParam.cleanUnResolvedMeshes = 1; // should unresolved meshes be cleaned. otherwise blue texture
|
||||||
|
@ -111,27 +118,62 @@ void GameData::setDefault ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Load the current game State
|
Load the current game State from a typical quake3 cfg file
|
||||||
*/
|
*/
|
||||||
s32 GameData::load ( const string<c16> filename )
|
s32 GameData::load ( const string<c16> &filename )
|
||||||
{
|
{
|
||||||
if ( 0 == Device )
|
if ( 0 == Device )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
//! the quake3 mesh loader can also handle *.shader and *.cfg file
|
//! the quake3 mesh loader can also handle *.shader and *.cfg file
|
||||||
IQ3LevelMesh* mesh = (IQ3LevelMesh*) Device->getSceneManager()->getMesh ( filename );
|
IQ3LevelMesh* mesh = (IQ3LevelMesh*) Device->getSceneManager()->getMesh ( filename );
|
||||||
|
if ( 0 == mesh )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
tQ3EntityList &entityList = mesh->getEntityList ();
|
||||||
|
|
||||||
|
stringc s;
|
||||||
|
u32 pos;
|
||||||
|
|
||||||
|
for ( u32 e = 0; e != entityList.size (); ++e )
|
||||||
|
{
|
||||||
|
//dumpShader ( s, &entityList[e], false );
|
||||||
|
//printf ( s.c_str () );
|
||||||
|
|
||||||
|
for ( u32 g = 0; g != entityList[e].getGroupSize (); ++g )
|
||||||
|
{
|
||||||
|
const SVarGroup *group = entityList[e].getGroup ( g );
|
||||||
|
|
||||||
|
for ( u32 index = 0; index < group->Variable.size (); ++index )
|
||||||
|
{
|
||||||
|
const SVariable &v = group->Variable[index];
|
||||||
|
pos = 0;
|
||||||
|
if ( v.name == "playerposition" )
|
||||||
|
{
|
||||||
|
PlayerPosition = getAsVector3df ( v.content, pos );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ( v.name == "playerrotation" )
|
||||||
|
{
|
||||||
|
PlayerRotation = getAsVector3df ( v.content, pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Store the current game State
|
Store the current game State in a quake3 configuration file
|
||||||
*/
|
*/
|
||||||
s32 GameData::save ( const string<c16> filename )
|
s32 GameData::save ( const string<c16> &filename )
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
if ( 0 == Device )
|
if ( 0 == Device )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
c8 buf[128];
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
// Store current Archive for restart
|
// Store current Archive for restart
|
||||||
|
@ -142,7 +184,7 @@ s32 GameData::save ( const string<c16> filename )
|
||||||
CurrentArchiveList.push_back ( fs->getFileArchive ( i )->getArchiveName() );
|
CurrentArchiveList.push_back ( fs->getFileArchive ( i )->getArchiveName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store Player Position
|
// Store Player Position and Rotation
|
||||||
ICameraSceneNode * camera = Device->getSceneManager()->getActiveCamera ();
|
ICameraSceneNode * camera = Device->getSceneManager()->getActiveCamera ();
|
||||||
if ( camera )
|
if ( camera )
|
||||||
{
|
{
|
||||||
|
@ -154,11 +196,16 @@ s32 GameData::save ( const string<c16> filename )
|
||||||
if ( 0 == file )
|
if ( 0 == file )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
c8 buf[128];
|
|
||||||
snprintf ( buf, 128, "playerposition %.f %.f %.f\nplayerrotation %.f %.f %.f\n",
|
snprintf ( buf, 128, "playerposition %.f %.f %.f\nplayerrotation %.f %.f %.f\n",
|
||||||
PlayerPosition.X, PlayerPosition.Y, PlayerPosition.Z,
|
PlayerPosition.X, PlayerPosition.Z, PlayerPosition.Y,
|
||||||
PlayerRotation.X, PlayerRotation.Y, PlayerRotation.Z);
|
PlayerRotation.X, PlayerRotation.Z, PlayerRotation.Y);
|
||||||
file->write ( buf, (s32) strlen ( buf ) );
|
file->write ( buf, (s32) strlen ( buf ) );
|
||||||
|
for ( i = 0; i != fs->getFileArchiveCount(); ++i )
|
||||||
|
{
|
||||||
|
snprintf ( buf, 128, "archive %s\n",stringc ( fs->getFileArchive ( i )->getArchiveName() ).c_str () );
|
||||||
|
file->write ( buf, (s32) strlen ( buf ) );
|
||||||
|
}
|
||||||
|
|
||||||
file->drop ();
|
file->drop ();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1092,7 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
|
||||||
/*
|
/*
|
||||||
Now construct Models from Entity List
|
Now construct Models from Entity List
|
||||||
*/
|
*/
|
||||||
Q3ModelFactory ( Game->loadParam, Game->Device, Mesh, ItemParent );
|
Q3ModelFactory ( Game->loadParam, Game->Device, Mesh, ItemParent, false );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -504,7 +504,8 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
IrrlichtDevice *device,
|
IrrlichtDevice *device,
|
||||||
IQ3LevelMesh* masterMesh,
|
IQ3LevelMesh* masterMesh,
|
||||||
ISceneNode *parent
|
ISceneNode *parent,
|
||||||
|
bool showShaderName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( 0 == masterMesh )
|
if ( 0 == masterMesh )
|
||||||
|
@ -516,7 +517,7 @@ void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
|
|
||||||
char buf[128];
|
char buf[128];
|
||||||
const SVarGroup *group;
|
const SVarGroup *group;
|
||||||
SEntity search;
|
IEntity search;
|
||||||
s32 index;
|
s32 index;
|
||||||
s32 lastIndex;
|
s32 lastIndex;
|
||||||
|
|
||||||
|
@ -526,7 +527,7 @@ void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
f = fopen ( "entity.txt", "wb" );
|
f = fopen ( "entity.txt", "wb" );
|
||||||
for ( index = 0; (u32) index < entityList.size (); ++index )
|
for ( index = 0; (u32) index < entityList.size (); ++index )
|
||||||
{
|
{
|
||||||
const SEntity *entity = &entityList[ index ];
|
const IEntity *entity = &entityList[ index ];
|
||||||
s = entity->name;
|
s = entity->name;
|
||||||
dumpShader ( s, entity );
|
dumpShader ( s, entity );
|
||||||
fwrite ( s.c_str(), 1, s.size(), f );
|
fwrite ( s.c_str(), 1, s.size(), f );
|
||||||
|
@ -544,7 +545,6 @@ void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
u32 nodeCount = 0;
|
u32 nodeCount = 0;
|
||||||
tTexArray textureArray;
|
tTexArray textureArray;
|
||||||
|
|
||||||
bool showShaderName = true;
|
|
||||||
IGUIFont *font = 0;
|
IGUIFont *font = 0;
|
||||||
if ( showShaderName )
|
if ( showShaderName )
|
||||||
font = device->getGUIEnvironment()->getFont("fontlucida.png");
|
font = device->getGUIEnvironment()->getFont("fontlucida.png");
|
||||||
|
@ -562,7 +562,6 @@ void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
p = getAsVector3df ( entity[index].getGroup(1)->get ( "origin" ), pos );
|
p = getAsVector3df ( entity[index].getGroup(1)->get ( "origin" ), pos );
|
||||||
|
|
||||||
nodeCount += 1;
|
nodeCount += 1;
|
||||||
showShaderName = true;
|
|
||||||
for ( u32 g = 0; g < 2; ++g )
|
for ( u32 g = 0; g < 2; ++g )
|
||||||
{
|
{
|
||||||
if ( 0 == itemElement->model[g] || itemElement->model[g][0] == 0 )
|
if ( 0 == itemElement->model[g] || itemElement->model[g][0] == 0 )
|
||||||
|
@ -618,7 +617,7 @@ void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
node->addAnimator ( anim );
|
node->addAnimator ( anim );
|
||||||
anim->drop ();
|
anim->drop ();
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
if ( itemElement->special & SPECIAL_SFX_BOUNCE )
|
if ( itemElement->special & SPECIAL_SFX_BOUNCE )
|
||||||
{
|
{
|
||||||
//anim = smgr->createFlyStraightAnimator (
|
//anim = smgr->createFlyStraightAnimator (
|
||||||
|
@ -693,7 +692,7 @@ s32 Q3StartPosition ( IQ3LevelMesh* mesh,
|
||||||
|
|
||||||
tQ3EntityList &entityList = mesh->getEntityList ();
|
tQ3EntityList &entityList = mesh->getEntityList ();
|
||||||
|
|
||||||
SEntity search;
|
IEntity search;
|
||||||
search.name = "info_player_start"; // "info_player_deathmatch";
|
search.name = "info_player_start"; // "info_player_deathmatch";
|
||||||
|
|
||||||
// find all entities in the multi-list
|
// find all entities in the multi-list
|
||||||
|
|
|
@ -96,7 +96,8 @@ void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
|
||||||
IrrlichtDevice *device,
|
IrrlichtDevice *device,
|
||||||
IQ3LevelMesh* masterMesh,
|
IQ3LevelMesh* masterMesh,
|
||||||
ISceneNode *parent
|
ISceneNode *parent,
|
||||||
|
bool showShaderName
|
||||||
);
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -64,7 +64,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "21.Quake3Explorer_vc8", "21
|
||||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "17. HelloWorld for Windows Mobile on PC", "17.HelloWorld_Mobile\17. HelloWorld for Windows Mobile on PC_v8.vcproj", "{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "17.HelloWorld for Windows Mobile on PC", "17.HelloWorld_Mobile\17. HelloWorld for Windows Mobile on PC_v8.vcproj", "{2A29B6B1-AFC4-46C7-9944-7052AAE66F7B}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
@ -63,7 +63,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
|
||||||
box->addItem(L"OpenGL 1.5");
|
box->addItem(L"OpenGL 1.5");
|
||||||
box->addItem(L"Direct3D 8.1");
|
box->addItem(L"Direct3D 8.1");
|
||||||
box->addItem(L"Direct3D 9.0c");
|
box->addItem(L"Direct3D 9.0c");
|
||||||
box->addItem(L"Burning's Video 0.42");
|
box->addItem(L"Burning's Video 0.44");
|
||||||
box->addItem(L"Irrlicht Software Renderer 1.0");
|
box->addItem(L"Irrlicht Software Renderer 1.0");
|
||||||
box->setSelected(selected);
|
box->setSelected(selected);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
|
||||||
modelNode->setMaterialTexture(0, driver->getTexture("../../media/faerie2.bmp"));
|
modelNode->setMaterialTexture(0, driver->getTexture("../../media/faerie2.bmp"));
|
||||||
modelNode->setMaterialFlag(video::EMF_LIGHTING, true);
|
modelNode->setMaterialFlag(video::EMF_LIGHTING, true);
|
||||||
modelNode->getMaterial(0).Shininess = 50.f;
|
modelNode->getMaterial(0).Shininess = 50.f;
|
||||||
//modelNode->getMaterial(0).NormalizeNormals = true;
|
modelNode->getMaterial(0).NormalizeNormals = true;
|
||||||
modelNode->setMD2Animation(scene::EMAT_STAND);
|
modelNode->setMD2Animation(scene::EMAT_STAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
virtual SColor getPixel(u32 x, u32 y) const = 0;
|
virtual SColor getPixel(u32 x, u32 y) const = 0;
|
||||||
|
|
||||||
//! Sets a pixel
|
//! Sets a pixel
|
||||||
virtual void setPixel(u32 x, u32 y, const SColor &color ) = 0;
|
virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ) = 0;
|
||||||
|
|
||||||
//! Returns the color format
|
//! Returns the color format
|
||||||
virtual ECOLOR_FORMAT getColorFormat() const = 0;
|
virtual ECOLOR_FORMAT getColorFormat() const = 0;
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
const core::rect<s32>* clipRect = 0) =0;
|
const core::rect<s32>* clipRect = 0) =0;
|
||||||
|
|
||||||
//! copies this surface into another, scaling it to fit, appyling a box filter
|
//! copies this surface into another, scaling it to fit, appyling a box filter
|
||||||
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0) = 0;
|
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false) = 0;
|
||||||
|
|
||||||
//! fills the surface with black or white
|
//! fills the surface with black or white
|
||||||
virtual void fill(const SColor &color) =0;
|
virtual void fill(const SColor &color) =0;
|
||||||
|
|
|
@ -184,7 +184,7 @@ namespace scene
|
||||||
\return Mesh without redundant vertices. If you no longer need
|
\return Mesh without redundant vertices. If you no longer need
|
||||||
the cloned mesh, you should call IMesh::drop(). See
|
the cloned mesh, you should call IMesh::drop(). See
|
||||||
IReferenceCounted::drop() for more information. */
|
IReferenceCounted::drop() for more information. */
|
||||||
virtual IMesh* createMeshWelded(IMesh* mesh, f32 tolerance=core::ROUNDING_ERROR_32) const = 0;
|
virtual IMesh* createMeshWelded(IMesh* mesh, f32 tolerance=core::ROUNDING_ERROR_f32) const = 0;
|
||||||
|
|
||||||
//! Get amount of polygons in mesh.
|
//! Get amount of polygons in mesh.
|
||||||
/** \param mesh Input mesh
|
/** \param mesh Input mesh
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace quake3
|
||||||
Q3LevelLoadParameter ()
|
Q3LevelLoadParameter ()
|
||||||
:defaultLightMapMaterial ( video::EMT_LIGHTMAP_M4 ),
|
:defaultLightMapMaterial ( video::EMT_LIGHTMAP_M4 ),
|
||||||
defaultModulate ( video::EMFN_MODULATE_4X ),
|
defaultModulate ( video::EMFN_MODULATE_4X ),
|
||||||
|
defaultFilter ( video::EMF_BILINEAR_FILTER ),
|
||||||
patchTesselation ( 8 ),
|
patchTesselation ( 8 ),
|
||||||
verbose ( 0 ),
|
verbose ( 0 ),
|
||||||
startTime ( 0 ), endTime ( 0 ),
|
startTime ( 0 ), endTime ( 0 ),
|
||||||
|
@ -59,6 +60,7 @@ namespace quake3
|
||||||
|
|
||||||
video::E_MATERIAL_TYPE defaultLightMapMaterial;
|
video::E_MATERIAL_TYPE defaultLightMapMaterial;
|
||||||
video::E_MODULATE_FUNC defaultModulate;
|
video::E_MODULATE_FUNC defaultModulate;
|
||||||
|
video::E_MATERIAL_FLAG defaultFilter;
|
||||||
s32 patchTesselation;
|
s32 patchTesselation;
|
||||||
s32 verbose;
|
s32 verbose;
|
||||||
u32 startTime;
|
u32 startTime;
|
||||||
|
@ -121,6 +123,7 @@ namespace quake3
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
extract substrings
|
extract substrings
|
||||||
*/
|
*/
|
||||||
|
@ -570,7 +573,7 @@ namespace quake3
|
||||||
// string database. "a" = "Hello", "b" = "1234.6"
|
// string database. "a" = "Hello", "b" = "1234.6"
|
||||||
struct SVarGroup
|
struct SVarGroup
|
||||||
{
|
{
|
||||||
SVarGroup () {}
|
SVarGroup () { Variable.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE ); }
|
||||||
virtual ~SVarGroup () {}
|
virtual ~SVarGroup () {}
|
||||||
|
|
||||||
u32 isDefined ( const c8 * name, const c8 * content = 0 ) const
|
u32 isDefined ( const c8 * name, const c8 * content = 0 ) const
|
||||||
|
@ -656,6 +659,13 @@ namespace quake3
|
||||||
//return name < other.name;
|
//return name < other.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const u32 getGroupSize () const
|
||||||
|
{
|
||||||
|
if ( 0 == VarGroup )
|
||||||
|
return 0;
|
||||||
|
return VarGroup->VariableGroup.size ();
|
||||||
|
}
|
||||||
|
|
||||||
const SVarGroup * getGroup ( u32 stage ) const
|
const SVarGroup * getGroup ( u32 stage ) const
|
||||||
{
|
{
|
||||||
if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
|
if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
|
||||||
|
@ -673,9 +683,9 @@ namespace quake3
|
||||||
core::stringc name;
|
core::stringc name;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef IShader SEntity;
|
typedef IShader IEntity;
|
||||||
|
|
||||||
typedef core::array < SEntity > tQ3EntityList;
|
typedef core::array < IEntity > tQ3EntityList;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
dump shader like original layout, regardless of internal data holding
|
dump shader like original layout, regardless of internal data holding
|
||||||
|
@ -722,7 +732,10 @@ namespace quake3
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline core::stringc & dumpShader ( core::stringc &dest, const IShader * shader )
|
/*!
|
||||||
|
dump a Shader or an Entity
|
||||||
|
*/
|
||||||
|
inline core::stringc & dumpShader ( core::stringc &dest, const IShader * shader, bool entity = false )
|
||||||
{
|
{
|
||||||
if ( 0 == shader )
|
if ( 0 == shader )
|
||||||
return dest;
|
return dest;
|
||||||
|
@ -736,17 +749,18 @@ namespace quake3
|
||||||
dumpVarGroup ( dest, group, core::clamp( (int)i, 0, 2 ) );
|
dumpVarGroup ( dest, group, core::clamp( (int)i, 0, 2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( size <= 1 )
|
if ( !entity )
|
||||||
{
|
{
|
||||||
dest.append ( "{\n" );
|
if ( size <= 1 )
|
||||||
|
{
|
||||||
|
dest.append ( "{\n" );
|
||||||
|
}
|
||||||
|
dest.append ( "}\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
dest.append ( "}\n" );
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
quake3 doesn't care much about tga & jpg
|
quake3 doesn't care much about tga & jpg
|
||||||
load one or multiple files stored in name started at startPos to the texture array textures
|
load one or multiple files stored in name started at startPos to the texture array textures
|
||||||
|
|
|
@ -32,8 +32,9 @@ namespace core
|
||||||
|
|
||||||
//! Rounding error constant often used when comparing f32 values.
|
//! Rounding error constant often used when comparing f32 values.
|
||||||
|
|
||||||
const f32 ROUNDING_ERROR_32 = 0.000001f;
|
const s32 ROUNDING_ERROR_S32 = 1;
|
||||||
const f64 ROUNDING_ERROR_64 = 0.00000001;
|
const f32 ROUNDING_ERROR_f32 = 0.000001f;
|
||||||
|
const f64 ROUNDING_ERROR_f64 = 0.00000001;
|
||||||
|
|
||||||
#ifdef PI // make sure we don't collide with a define
|
#ifdef PI // make sure we don't collide with a define
|
||||||
#undef PI
|
#undef PI
|
||||||
|
@ -155,17 +156,17 @@ namespace core
|
||||||
}
|
}
|
||||||
|
|
||||||
//! returns if a equals b, taking possible rounding errors into account
|
//! returns if a equals b, taking possible rounding errors into account
|
||||||
inline bool equals(const f64 a, const f64 b, const f64 tolerance = ROUNDING_ERROR_64)
|
inline bool equals(const f64 a, const f64 b, const f64 tolerance = ROUNDING_ERROR_f64)
|
||||||
{
|
{
|
||||||
return (a + tolerance >= b) && (a - tolerance <= b);
|
return (a + tolerance >= b) && (a - tolerance <= b);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! returns if a equals b, taking possible rounding errors into account
|
//! returns if a equals b, taking possible rounding errors into account
|
||||||
inline bool equals(const f32 a, const f32 b, const f32 tolerance = ROUNDING_ERROR_32)
|
inline bool equals(const f32 a, const f32 b, const f32 tolerance = ROUNDING_ERROR_f32)
|
||||||
{
|
{
|
||||||
return (a + tolerance >= b) && (a - tolerance <= b);
|
return (a + tolerance >= b) && (a - tolerance <= b);
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
//! returns if a equals b, not using any rounding tolerance
|
//! returns if a equals b, not using any rounding tolerance
|
||||||
inline bool equals(const s32 a, const s32 b)
|
inline bool equals(const s32 a, const s32 b)
|
||||||
{
|
{
|
||||||
|
@ -177,34 +178,34 @@ namespace core
|
||||||
{
|
{
|
||||||
return (a == b);
|
return (a == b);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
//! returns if a equals b, taking an explicit rounding tolerance into account
|
//! returns if a equals b, taking an explicit rounding tolerance into account
|
||||||
inline bool equals(const s32 a, const s32 b, const s32 tolerance)
|
inline bool equals(const s32 a, const s32 b, const s32 tolerance = ROUNDING_ERROR_S32)
|
||||||
{
|
{
|
||||||
return (a + tolerance >= b) && (a - tolerance <= b);
|
return (a + tolerance >= b) && (a - tolerance <= b);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! returns if a equals b, taking an explicit rounding tolerance into account
|
//! returns if a equals b, taking an explicit rounding tolerance into account
|
||||||
inline bool equals(const u32 a, const u32 b, const u32 tolerance)
|
inline bool equals(const u32 a, const u32 b, const s32 tolerance = ROUNDING_ERROR_S32)
|
||||||
{
|
{
|
||||||
return (a + tolerance >= b) && (a - tolerance <= b);
|
return (a + tolerance >= b) && (a - tolerance <= b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! returns if a equals zero, taking rounding errors into account
|
//! returns if a equals zero, taking rounding errors into account
|
||||||
inline bool iszero(const f64 a, const f64 tolerance = ROUNDING_ERROR_64)
|
inline bool iszero(const f64 a, const f64 tolerance = ROUNDING_ERROR_f64)
|
||||||
{
|
{
|
||||||
return fabs(a) <= tolerance;
|
return fabs(a) <= tolerance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! returns if a equals zero, taking rounding errors into account
|
//! returns if a equals zero, taking rounding errors into account
|
||||||
inline bool iszero(const f32 a, const f32 tolerance = ROUNDING_ERROR_32)
|
inline bool iszero(const f32 a, const f32 tolerance = ROUNDING_ERROR_f32)
|
||||||
{
|
{
|
||||||
return fabsf(a) <= tolerance;
|
return fabsf(a) <= tolerance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! returns if a equals not zero, taking rounding errors into account
|
//! returns if a equals not zero, taking rounding errors into account
|
||||||
inline bool isnotzero(const f32 a, const f32 tolerance = ROUNDING_ERROR_32)
|
inline bool isnotzero(const f32 a, const f32 tolerance = ROUNDING_ERROR_f32)
|
||||||
{
|
{
|
||||||
return fabsf(a) > tolerance;
|
return fabsf(a) > tolerance;
|
||||||
}
|
}
|
||||||
|
@ -325,7 +326,7 @@ namespace core
|
||||||
}
|
}
|
||||||
|
|
||||||
//! conditional set based on mask and arithmetic shift
|
//! conditional set based on mask and arithmetic shift
|
||||||
REALINLINE u16 if_c_a_else_b ( const s16 condition, const s16 a, const s16 b )
|
REALINLINE u16 if_c_a_else_b ( const s16 condition, const u16 a, const u16 b )
|
||||||
{
|
{
|
||||||
return ( ( -condition >> 15 ) & ( a ^ b ) ) ^ b;
|
return ( ( -condition >> 15 ) & ( a ^ b ) ) ^ b;
|
||||||
}
|
}
|
||||||
|
@ -379,6 +380,12 @@ namespace core
|
||||||
return sqrt ( f );
|
return sqrt ( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate: sqrt ( x )
|
||||||
|
REALINLINE s32 squareroot(const s32 f)
|
||||||
|
{
|
||||||
|
return (s32) sqrt ( (f32) f );
|
||||||
|
}
|
||||||
|
|
||||||
// calculate: 1 / sqrt ( x )
|
// calculate: 1 / sqrt ( x )
|
||||||
REALINLINE f64 reciprocal_squareroot(const f64 x)
|
REALINLINE f64 reciprocal_squareroot(const f64 x)
|
||||||
{
|
{
|
||||||
|
@ -411,6 +418,12 @@ namespace core
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate: 1 / sqrt ( x )
|
||||||
|
REALINLINE s32 reciprocal_squareroot(const s32 s)
|
||||||
|
{
|
||||||
|
return (s32) ( 1.f / sqrtf ( (f32) s ) );
|
||||||
|
}
|
||||||
|
|
||||||
// calculate: 1 / x
|
// calculate: 1 / x
|
||||||
REALINLINE f32 reciprocal ( const f32 f )
|
REALINLINE f32 reciprocal ( const f32 f )
|
||||||
{
|
{
|
||||||
|
@ -444,6 +457,12 @@ namespace core
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate: 1 / x
|
||||||
|
REALINLINE f64 reciprocal ( const f64 f )
|
||||||
|
{
|
||||||
|
return 1.0 / f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// calculate: 1 / x, low precision allowed
|
// calculate: 1 / x, low precision allowed
|
||||||
REALINLINE f32 reciprocal_approxim ( const f32 f )
|
REALINLINE f32 reciprocal_approxim ( const f32 f )
|
||||||
|
|
|
@ -848,7 +848,7 @@ namespace core
|
||||||
|
|
||||||
f64 rotx, roty, X, Z;
|
f64 rotx, roty, X, Z;
|
||||||
|
|
||||||
if (fabs(C)>ROUNDING_ERROR_64)
|
if (fabs(C)>ROUNDING_ERROR_f64)
|
||||||
{
|
{
|
||||||
const T invC = (T)(1.0/C);
|
const T invC = (T)(1.0/C);
|
||||||
rotx = mat(2,2) * invC;
|
rotx = mat(2,2) * invC;
|
||||||
|
|
|
@ -131,10 +131,10 @@ class plane3d
|
||||||
{
|
{
|
||||||
const T d = Normal.dotProduct(point) + D;
|
const T d = Normal.dotProduct(point) + D;
|
||||||
|
|
||||||
if (d < -ROUNDING_ERROR_32)
|
if (d < -ROUNDING_ERROR_f32)
|
||||||
return ISREL3D_BACK;
|
return ISREL3D_BACK;
|
||||||
|
|
||||||
if (d > ROUNDING_ERROR_32)
|
if (d > ROUNDING_ERROR_f32)
|
||||||
return ISREL3D_FRONT;
|
return ISREL3D_FRONT;
|
||||||
|
|
||||||
return ISREL3D_PLANAR;
|
return ISREL3D_PLANAR;
|
||||||
|
@ -157,7 +157,7 @@ class plane3d
|
||||||
bool existsIntersection(const plane3d<T>& other) const
|
bool existsIntersection(const plane3d<T>& other) const
|
||||||
{
|
{
|
||||||
vector3d<T> cross = other.Normal.crossProduct(Normal);
|
vector3d<T> cross = other.Normal.crossProduct(Normal);
|
||||||
return cross.getLength() > core::ROUNDING_ERROR_32;
|
return cross.getLength() > core::ROUNDING_ERROR_f32;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Intersects this plane with another.
|
//! Intersects this plane with another.
|
||||||
|
@ -174,7 +174,7 @@ class plane3d
|
||||||
const T fn11 = other.Normal.getLength();
|
const T fn11 = other.Normal.getLength();
|
||||||
const f64 det = fn00*fn11 - fn01*fn01;
|
const f64 det = fn00*fn11 - fn01*fn01;
|
||||||
|
|
||||||
if (fabs(det) < ROUNDING_ERROR_64 )
|
if (fabs(det) < ROUNDING_ERROR_f64 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const f64 invdet = 1.0 / det;
|
const f64 invdet = 1.0 / det;
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace core
|
||||||
// functions
|
// functions
|
||||||
|
|
||||||
//! returns if this vector equals the other one, taking floating point rounding errors into account
|
//! returns if this vector equals the other one, taking floating point rounding errors into account
|
||||||
bool equals(const vector3d<T>& other, const T tolerance = (T)ROUNDING_ERROR_32 ) const
|
bool equals(const vector3d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
|
||||||
{
|
{
|
||||||
return core::equals(X, other.X, tolerance) &&
|
return core::equals(X, other.X, tolerance) &&
|
||||||
core::equals(Y, other.Y, tolerance) &&
|
core::equals(Y, other.Y, tolerance) &&
|
||||||
|
@ -140,14 +140,7 @@ namespace core
|
||||||
\return Reference to this vector after normalization. */
|
\return Reference to this vector after normalization. */
|
||||||
vector3d<T>& normalize()
|
vector3d<T>& normalize()
|
||||||
{
|
{
|
||||||
#if 0
|
const f64 length = core::reciprocal_squareroot ( (f64) (X*X + Y*Y + Z*Z) );
|
||||||
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 ( (T) (X*X + Y*Y + Z*Z) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
X = (T)(X * length);
|
X = (T)(X * length);
|
||||||
Y = (T)(Y * length);
|
Y = (T)(Y * length);
|
||||||
|
|
|
@ -297,7 +297,7 @@ void CGUIColorSelectDialog::buildColorRing( const core::dimension2d<u32> & dim,
|
||||||
if ( supersample > 1 )
|
if ( supersample > 1 )
|
||||||
{
|
{
|
||||||
video::CImage * filter = new video::CImage(video::ECF_A8R8G8B8, dim );
|
video::CImage * filter = new video::CImage(video::ECF_A8R8G8B8, dim );
|
||||||
RawTexture->copyToScalingBoxFilter(filter, 0);
|
RawTexture->copyToScalingBoxFilter(filter);
|
||||||
RawTexture->drop();
|
RawTexture->drop();
|
||||||
RawTexture = filter;
|
RawTexture = filter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1220,7 +1220,7 @@ u32 CImage::getBitsPerPixelFromFormat(ECOLOR_FORMAT format)
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sets a pixel
|
//! sets a pixel
|
||||||
void CImage::setPixel(u32 x, u32 y, const SColor &color )
|
void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend )
|
||||||
{
|
{
|
||||||
if (x >= (u32)Size.Width || y >= (u32)Size.Height)
|
if (x >= (u32)Size.Width || y >= (u32)Size.Height)
|
||||||
return;
|
return;
|
||||||
|
@ -1250,7 +1250,7 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color )
|
||||||
case ECF_A8R8G8B8:
|
case ECF_A8R8G8B8:
|
||||||
{
|
{
|
||||||
u32 * dest = (u32*) ((u8*) Data + ( y * Pitch ) + ( x << 2 ));
|
u32 * dest = (u32*) ((u8*) Data + ( y * Pitch ) + ( x << 2 ));
|
||||||
*dest = color.color;
|
*dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1437,7 +1437,7 @@ void CImage::copyToScaling(IImage* target)
|
||||||
}
|
}
|
||||||
|
|
||||||
//! copies this surface into another, scaling it to fit it.
|
//! copies this surface into another, scaling it to fit it.
|
||||||
void CImage::copyToScalingBoxFilter(IImage* target, s32 bias)
|
void CImage::copyToScalingBoxFilter(IImage* target, s32 bias, bool blend)
|
||||||
{
|
{
|
||||||
const core::dimension2d<u32> destSize = target->getDimension();
|
const core::dimension2d<u32> destSize = target->getDimension();
|
||||||
|
|
||||||
|
@ -1457,7 +1457,8 @@ void CImage::copyToScalingBoxFilter(IImage* target, s32 bias)
|
||||||
sx = 0.f;
|
sx = 0.f;
|
||||||
for ( u32 x = 0; x != destSize.Width; ++x )
|
for ( u32 x = 0; x != destSize.Width; ++x )
|
||||||
{
|
{
|
||||||
target->setPixel( x, y, getPixelBox( core::floor32(sx), core::floor32(sy), fx, fy, bias ) );
|
target->setPixel( x, y,
|
||||||
|
getPixelBox( core::floor32(sx), core::floor32(sy), fx, fy, bias ), blend );
|
||||||
sx += sourceXStep;
|
sx += sourceXStep;
|
||||||
}
|
}
|
||||||
sy += sourceYStep;
|
sy += sourceYStep;
|
||||||
|
@ -1504,13 +1505,16 @@ inline SColor CImage::getPixelBox( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) cons
|
||||||
{
|
{
|
||||||
for ( s32 dy = 0; dy != fy; ++dy )
|
for ( s32 dy = 0; dy != fy; ++dy )
|
||||||
{
|
{
|
||||||
c = getPixel( x + dx , y + dy );
|
c = getPixel( core::s32_min ( x + dx, Size.Width - 1 ) ,
|
||||||
|
core::s32_min ( y + dy, Size.Height - 1 )
|
||||||
|
);
|
||||||
|
|
||||||
a += c.getAlpha();
|
a += c.getAlpha();
|
||||||
r += c.getRed();
|
r += c.getRed();
|
||||||
g += c.getGreen();
|
g += c.getGreen();
|
||||||
b += c.getBlue();
|
b += c.getBlue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 sdiv = s32_log2_s32(fx * fy);
|
s32 sdiv = s32_log2_s32(fx * fy);
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
virtual SColor getPixel(u32 x, u32 y) const;
|
virtual SColor getPixel(u32 x, u32 y) const;
|
||||||
|
|
||||||
//! sets a pixel
|
//! sets a pixel
|
||||||
virtual void setPixel(u32 x, u32 y, const SColor &color );
|
virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false );
|
||||||
|
|
||||||
//! returns the color format
|
//! returns the color format
|
||||||
virtual ECOLOR_FORMAT getColorFormat() const;
|
virtual ECOLOR_FORMAT getColorFormat() const;
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
const core::rect<s32>* clipRect = 0);
|
const core::rect<s32>* clipRect = 0);
|
||||||
|
|
||||||
//! copies this surface into another, scaling it to fit, appyling a box filter
|
//! copies this surface into another, scaling it to fit, appyling a box filter
|
||||||
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0);
|
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false);
|
||||||
|
|
||||||
//! fills the surface with black or white
|
//! fills the surface with black or white
|
||||||
virtual void fill(const SColor &color);
|
virtual void fill(const SColor &color);
|
||||||
|
|
|
@ -28,7 +28,6 @@ CLightSceneNode::CLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
|
||||||
LightData.SpecularColor = color.getInterpolated(video::SColor(255,255,255,255),0.7f);
|
LightData.SpecularColor = color.getInterpolated(video::SColor(255,255,255,255),0.7f);
|
||||||
|
|
||||||
setRadius(radius);
|
setRadius(radius);
|
||||||
doLightRecalc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,6 +128,7 @@ void CLightSceneNode::setRadius(f32 radius)
|
||||||
{
|
{
|
||||||
LightData.Radius=radius;
|
LightData.Radius=radius;
|
||||||
LightData.Attenuation.set(0.f, 1.f/radius, 0.f);
|
LightData.Attenuation.set(0.f, 1.f/radius, 0.f);
|
||||||
|
doLightRecalc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +177,6 @@ bool CLightSceneNode::getCastShadow() const
|
||||||
|
|
||||||
void CLightSceneNode::doLightRecalc()
|
void CLightSceneNode::doLightRecalc()
|
||||||
{
|
{
|
||||||
//LightData.Type = video::ELT_DIRECTIONAL;
|
|
||||||
if ((LightData.Type == video::ELT_SPOT) || (LightData.Type == video::ELT_DIRECTIONAL))
|
if ((LightData.Type == video::ELT_SPOT) || (LightData.Type == video::ELT_DIRECTIONAL))
|
||||||
{
|
{
|
||||||
LightData.Direction = core::vector3df(.0f,.0f,1.0f);
|
LightData.Direction = core::vector3df(.0f,.0f,1.0f);
|
||||||
|
@ -223,18 +222,28 @@ void CLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeR
|
||||||
LightData.AmbientColor = in->getAttributeAsColorf("AmbientColor");
|
LightData.AmbientColor = in->getAttributeAsColorf("AmbientColor");
|
||||||
LightData.DiffuseColor = in->getAttributeAsColorf("DiffuseColor");
|
LightData.DiffuseColor = in->getAttributeAsColorf("DiffuseColor");
|
||||||
LightData.SpecularColor = in->getAttributeAsColorf("SpecularColor");
|
LightData.SpecularColor = in->getAttributeAsColorf("SpecularColor");
|
||||||
|
|
||||||
|
//TODO: clearify Radius and Linear Attenuation
|
||||||
|
#if 0
|
||||||
|
setRadius ( in->getAttributeAsFloat("Radius") );
|
||||||
|
#else
|
||||||
|
LightData.Radius = in->getAttributeAsFloat("Radius");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (in->existsAttribute("Attenuation")) // might not exist in older files
|
if (in->existsAttribute("Attenuation")) // might not exist in older files
|
||||||
LightData.Attenuation = in->getAttributeAsVector3d("Attenuation");
|
LightData.Attenuation = in->getAttributeAsVector3d("Attenuation");
|
||||||
|
|
||||||
if (in->existsAttribute("OuterCone")) // might not exist in older files
|
if (in->existsAttribute("OuterCone")) // might not exist in older files
|
||||||
LightData.OuterCone = in->getAttributeAsFloat("OuterCone");
|
LightData.OuterCone = in->getAttributeAsFloat("OuterCone");
|
||||||
if (in->existsAttribute("InnerCone")) // might not exist in older files
|
if (in->existsAttribute("InnerCone")) // might not exist in older files
|
||||||
LightData.InnerCone = in->getAttributeAsFloat("InnerCone");
|
LightData.InnerCone = in->getAttributeAsFloat("InnerCone");
|
||||||
if (in->existsAttribute("Falloff")) // might not exist in older files
|
if (in->existsAttribute("Falloff")) // might not exist in older files
|
||||||
LightData.Falloff = in->getAttributeAsFloat("Falloff");
|
LightData.Falloff = in->getAttributeAsFloat("Falloff");
|
||||||
LightData.Radius = in->getAttributeAsFloat("Radius");
|
|
||||||
LightData.CastShadows = in->getAttributeAsBool("CastShadows");
|
LightData.CastShadows = in->getAttributeAsBool("CastShadows");
|
||||||
LightData.Type = (video::E_LIGHT_TYPE)in->getAttributeAsEnumeration("LightType", video::LightTypeNames);
|
LightData.Type = (video::E_LIGHT_TYPE)in->getAttributeAsEnumeration("LightType", video::LightTypeNames);
|
||||||
|
|
||||||
|
doLightRecalc ();
|
||||||
|
|
||||||
ILightSceneNode::deserializeAttributes(in, options);
|
ILightSceneNode::deserializeAttributes(in, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ public:
|
||||||
virtual IMesh* createMeshUniquePrimitives(IMesh* mesh) const;
|
virtual IMesh* createMeshUniquePrimitives(IMesh* mesh) const;
|
||||||
|
|
||||||
//! Creates a copy of the mesh, which will have all duplicated vertices removed, i.e. maximal amount of vertices are shared via indexing.
|
//! Creates a copy of the mesh, which will have all duplicated vertices removed, i.e. maximal amount of vertices are shared via indexing.
|
||||||
virtual IMesh* createMeshWelded(IMesh *mesh, f32 tolerance=core::ROUNDING_ERROR_32) const;
|
virtual IMesh* createMeshWelded(IMesh *mesh, f32 tolerance=core::ROUNDING_ERROR_f32) const;
|
||||||
|
|
||||||
//! Returns amount of polygons in mesh.
|
//! Returns amount of polygons in mesh.
|
||||||
virtual s32 getPolyCount(scene::IMesh* mesh) const;
|
virtual s32 getPolyCount(scene::IMesh* mesh) const;
|
||||||
|
|
|
@ -923,7 +923,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
||||||
|
|
||||||
if (texture->getColorFormat() == ECF_A1R5G5B5)
|
if (texture->getColorFormat() == ECF_A1R5G5B5)
|
||||||
{
|
{
|
||||||
s16 *p = (s16*)texture->lock();
|
u16 *p = (u16*)texture->lock();
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
{
|
||||||
|
@ -932,14 +932,14 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
||||||
}
|
}
|
||||||
|
|
||||||
const core::dimension2d<u32> dim = texture->getSize();
|
const core::dimension2d<u32> dim = texture->getSize();
|
||||||
const s32 pitch = texture->getPitch() / 2;
|
const u32 pitch = texture->getPitch() / 2;
|
||||||
|
|
||||||
// color with alpha disabled (i.e. fully transparent)
|
// color with alpha disabled (i.e. fully transparent)
|
||||||
const s16 refZeroAlpha = (0x7fff & color.toA1R5G5B5());
|
const u16 refZeroAlpha = (0x7fff & color.toA1R5G5B5());
|
||||||
|
|
||||||
const s32 pixels = pitch * dim.Height;
|
const u32 pixels = pitch * dim.Height;
|
||||||
|
|
||||||
for (s32 pixel = 0; pixel < pixels; ++ pixel)
|
for (u32 pixel = 0; pixel < pixels; ++ pixel)
|
||||||
{
|
{
|
||||||
// If the colour matches the reference colour, ignoring alphas,
|
// If the colour matches the reference colour, ignoring alphas,
|
||||||
// set the alpha to zero.
|
// set the alpha to zero.
|
||||||
|
@ -958,7 +958,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s32 *p = (s32*)texture->lock();
|
u32 *p = (u32*)texture->lock();
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
{
|
||||||
|
@ -967,13 +967,13 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
||||||
}
|
}
|
||||||
|
|
||||||
core::dimension2d<u32> dim = texture->getSize();
|
core::dimension2d<u32> dim = texture->getSize();
|
||||||
s32 pitch = texture->getPitch() / 4;
|
u32 pitch = texture->getPitch() / 4;
|
||||||
|
|
||||||
// color with alpha disabled (fully transparent)
|
// color with alpha disabled (fully transparent)
|
||||||
const s32 refZeroAlpha = 0x00ffffff & color.color;
|
const u32 refZeroAlpha = 0x00ffffff & color.color;
|
||||||
|
|
||||||
const s32 pixels = pitch * dim.Height;
|
const u32 pixels = pitch * dim.Height;
|
||||||
for (s32 pixel = 0; pixel < pixels; ++ pixel)
|
for (u32 pixel = 0; pixel < pixels; ++ pixel)
|
||||||
{
|
{
|
||||||
// If the colour matches the reference colour, ignoring alphas,
|
// If the colour matches the reference colour, ignoring alphas,
|
||||||
// set the alpha to zero.
|
// set the alpha to zero.
|
||||||
|
@ -1013,7 +1013,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
||||||
|
|
||||||
if (texture->getColorFormat() == ECF_A1R5G5B5)
|
if (texture->getColorFormat() == ECF_A1R5G5B5)
|
||||||
{
|
{
|
||||||
s16 *p = (s16*)texture->lock();
|
u16 *p = (u16*)texture->lock();
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
{
|
||||||
|
@ -1021,15 +1021,15 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 pitch = texture->getPitch() / 2;
|
u32 pitch = texture->getPitch() / 2;
|
||||||
|
|
||||||
const s16 key16Bit = 0x7fff & p[colorKeyPixelPos.Y*pitch + colorKeyPixelPos.X];
|
const u16 key16Bit = 0x7fff & p[colorKeyPixelPos.Y*pitch + colorKeyPixelPos.X];
|
||||||
|
|
||||||
colorKey = video::A1R5G5B5toA8R8G8B8(key16Bit);
|
colorKey = video::A1R5G5B5toA8R8G8B8(key16Bit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s32 *p = (s32*)texture->lock();
|
u32 *p = (u32*)texture->lock();
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
{
|
||||||
|
@ -1037,7 +1037,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 pitch = texture->getPitch() / 4;
|
u32 pitch = texture->getPitch() / 4;
|
||||||
colorKey = 0x00ffffff & p[colorKeyPixelPos.Y*pitch + colorKeyPixelPos.X];
|
colorKey = 0x00ffffff & p[colorKeyPixelPos.Y*pitch + colorKeyPixelPos.X];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1386,22 +1386,6 @@ void CQ3LevelMesh::getConfiguration( io::IReadFile* file )
|
||||||
Entity.getLast().name = file->getFileName();
|
Entity.getLast().name = file->getFileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// entity only has only one valid level.. and no assoziative name..
|
|
||||||
void CQ3LevelMesh::scriptcallback_config( SVarGroupList *& grouplist, eToken token )
|
|
||||||
{
|
|
||||||
if ( token == Q3_TOKEN_END_LIST || 0 == grouplist->VariableGroup[0].Variable.size () )
|
|
||||||
return;
|
|
||||||
|
|
||||||
grouplist->grab();
|
|
||||||
|
|
||||||
SEntity element;
|
|
||||||
element.VarGroup = grouplist;
|
|
||||||
element.id = Entity.size();
|
|
||||||
element.name = "configuration";
|
|
||||||
|
|
||||||
Entity.push_back( element );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! get's an interface to the entities
|
//! get's an interface to the entities
|
||||||
tQ3EntityList & CQ3LevelMesh::getEntityList()
|
tQ3EntityList & CQ3LevelMesh::getEntityList()
|
||||||
|
@ -1620,6 +1604,33 @@ void CQ3LevelMesh::ReleaseEntity()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// config in simple (quake3) and advanced style
|
||||||
|
void CQ3LevelMesh::scriptcallback_config( SVarGroupList *& grouplist, eToken token )
|
||||||
|
{
|
||||||
|
IShader element;
|
||||||
|
|
||||||
|
if ( token == Q3_TOKEN_END_LIST )
|
||||||
|
{
|
||||||
|
if ( 0 == grouplist->VariableGroup[0].Variable.size() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
element.name = grouplist->VariableGroup[0].Variable[0].name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( grouplist->VariableGroup.size() != 2 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
element.name = "configuration";
|
||||||
|
}
|
||||||
|
|
||||||
|
grouplist->grab();
|
||||||
|
element.VarGroup = grouplist;
|
||||||
|
element.id = Entity.size();
|
||||||
|
Entity.push_back( element );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// entity only has only one valid level.. and no assoziative name..
|
// entity only has only one valid level.. and no assoziative name..
|
||||||
void CQ3LevelMesh::scriptcallback_entity( SVarGroupList *& grouplist, eToken token )
|
void CQ3LevelMesh::scriptcallback_entity( SVarGroupList *& grouplist, eToken token )
|
||||||
{
|
{
|
||||||
|
@ -1628,7 +1639,7 @@ void CQ3LevelMesh::scriptcallback_entity( SVarGroupList *& grouplist, eToken tok
|
||||||
|
|
||||||
grouplist->grab();
|
grouplist->grab();
|
||||||
|
|
||||||
SEntity element;
|
IEntity element;
|
||||||
element.VarGroup = grouplist;
|
element.VarGroup = grouplist;
|
||||||
element.id = Entity.size();
|
element.id = Entity.size();
|
||||||
element.name = grouplist->VariableGroup[1].get( "classname" );
|
element.name = grouplist->VariableGroup[1].get( "classname" );
|
||||||
|
@ -1641,13 +1652,9 @@ void CQ3LevelMesh::scriptcallback_entity( SVarGroupList *& grouplist, eToken tok
|
||||||
//!. script callback for shaders
|
//!. script callback for shaders
|
||||||
void CQ3LevelMesh::scriptcallback_shader( SVarGroupList *& grouplist,eToken token )
|
void CQ3LevelMesh::scriptcallback_shader( SVarGroupList *& grouplist,eToken token )
|
||||||
{
|
{
|
||||||
if ( token != Q3_TOKEN_END_LIST )
|
if ( token != Q3_TOKEN_END_LIST || grouplist->VariableGroup[0].Variable.size()==0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: There might be something wrong with this fix, but it avoids a core dump...
|
|
||||||
if (grouplist->VariableGroup[0].Variable.size()==0)
|
|
||||||
return;
|
|
||||||
// end fix
|
|
||||||
|
|
||||||
IShader element;
|
IShader element;
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ namespace scene
|
||||||
u32 sourcesize;
|
u32 sourcesize;
|
||||||
u32 index;
|
u32 index;
|
||||||
core::stringc token;
|
core::stringc token;
|
||||||
u32 tokenresult;
|
eToken tokenresult;
|
||||||
};
|
};
|
||||||
SQ3Parser Parser;
|
SQ3Parser Parser;
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,8 @@ void CQuake3ShaderSceneNode::render()
|
||||||
material.MaterialTypeParam = blendfunc.param0;
|
material.MaterialTypeParam = blendfunc.param0;
|
||||||
|
|
||||||
material.TextureLayer[0].TextureWrap = q.TextureAddressMode;
|
material.TextureLayer[0].TextureWrap = q.TextureAddressMode;
|
||||||
|
//material.TextureLayer[0].TrilinearFilter = 1;
|
||||||
|
//material.TextureLayer[0].AnisotropicFilter = 0xFF;
|
||||||
material.setTextureMatrix( 0, textureMatrix );
|
material.setTextureMatrix( 0, textureMatrix );
|
||||||
|
|
||||||
driver->setMaterial( material );
|
driver->setMaterial( material );
|
||||||
|
|
|
@ -815,7 +815,7 @@ void CSoftwareDriver::draw2DLine(const core::position2d<s32>& start,
|
||||||
//! Draws a pixel
|
//! Draws a pixel
|
||||||
void CSoftwareDriver::drawPixel(u32 x, u32 y, const SColor & color)
|
void CSoftwareDriver::drawPixel(u32 x, u32 y, const SColor & color)
|
||||||
{
|
{
|
||||||
((CImage*)BackBuffer)->setPixel(x, y, color);
|
((CImage*)BackBuffer)->setPixel(x, y, color, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,9 @@ void CBurningVideoDriver::setCurrentShader()
|
||||||
|
|
||||||
EBurningFFShader shader = zMaterialTest ? ETR_TEXTURE_GOURAUD : ETR_TEXTURE_GOURAUD_NOZ;
|
EBurningFFShader shader = zMaterialTest ? ETR_TEXTURE_GOURAUD : ETR_TEXTURE_GOURAUD_NOZ;
|
||||||
|
|
||||||
|
TransformationFlag[ ETS_TEXTURE_0] &= ~(ETF_TEXGEN_CAMERA_NORMAL|ETF_TEXGEN_CAMERA_REFLECTION);
|
||||||
|
LightSpace.Flags &= ~VERTEXTRANSFORM;
|
||||||
|
|
||||||
switch ( Material.org.MaterialType )
|
switch ( Material.org.MaterialType )
|
||||||
{
|
{
|
||||||
case EMT_ONETEXTURE_BLEND:
|
case EMT_ONETEXTURE_BLEND:
|
||||||
|
@ -170,6 +173,8 @@ void CBurningVideoDriver::setCurrentShader()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
|
case EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
|
||||||
|
Material.org.MaterialTypeParam = 0.5f;
|
||||||
|
// fall through
|
||||||
case EMT_TRANSPARENT_ALPHA_CHANNEL:
|
case EMT_TRANSPARENT_ALPHA_CHANNEL:
|
||||||
if ( texture0 && texture0->hasAlpha () )
|
if ( texture0 && texture0->hasAlpha () )
|
||||||
{
|
{
|
||||||
|
@ -214,8 +219,14 @@ void CBurningVideoDriver::setCurrentShader()
|
||||||
shader = ETR_TEXTURE_GOURAUD_DETAIL_MAP;
|
shader = ETR_TEXTURE_GOURAUD_DETAIL_MAP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EMT_SPHERE_MAP:
|
||||||
|
TransformationFlag[ ETS_TEXTURE_0] |= ETF_TEXGEN_CAMERA_REFLECTION; // ETF_TEXGEN_CAMERA_NORMAL;
|
||||||
|
LightSpace.Flags |= VERTEXTRANSFORM;
|
||||||
|
break;
|
||||||
case EMT_REFLECTION_2_LAYER:
|
case EMT_REFLECTION_2_LAYER:
|
||||||
shader = ETR_INVALID;
|
shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_M1;
|
||||||
|
TransformationFlag[ ETS_TEXTURE_1] |= ETF_TEXGEN_CAMERA_REFLECTION;
|
||||||
|
LightSpace.Flags |= VERTEXTRANSFORM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -292,7 +303,7 @@ bool CBurningVideoDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
||||||
void CBurningVideoDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat)
|
void CBurningVideoDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat)
|
||||||
{
|
{
|
||||||
Transformation[state] = mat;
|
Transformation[state] = mat;
|
||||||
TransformationFlag[state] = mat.isIdentity();
|
core::setbit_cond ( TransformationFlag[state], mat.isIdentity(), ETF_IDENTITY );
|
||||||
|
|
||||||
switch ( state )
|
switch ( state )
|
||||||
{
|
{
|
||||||
|
@ -301,11 +312,11 @@ void CBurningVideoDriver::setTransform(E_TRANSFORMATION_STATE state, const core:
|
||||||
Transformation[ETS_PROJECTION],
|
Transformation[ETS_PROJECTION],
|
||||||
Transformation[ETS_VIEW]
|
Transformation[ETS_VIEW]
|
||||||
);
|
);
|
||||||
TransformationFlag [ ETS_VIEW_INVERSE ] = 0;
|
getCameraPosWorldSpace ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ETS_WORLD:
|
case ETS_WORLD:
|
||||||
if ( TransformationFlag[state] )
|
if ( TransformationFlag[state] & ETF_IDENTITY )
|
||||||
{
|
{
|
||||||
Transformation[ETS_CURRENT] = Transformation[ETS_VIEW_PROJECTION];
|
Transformation[ETS_CURRENT] = Transformation[ETS_VIEW_PROJECTION];
|
||||||
}
|
}
|
||||||
|
@ -318,6 +329,12 @@ void CBurningVideoDriver::setTransform(E_TRANSFORMATION_STATE state, const core:
|
||||||
}
|
}
|
||||||
TransformationFlag[ETS_CURRENT] = 0;
|
TransformationFlag[ETS_CURRENT] = 0;
|
||||||
break;
|
break;
|
||||||
|
case ETS_TEXTURE_0:
|
||||||
|
case ETS_TEXTURE_1:
|
||||||
|
case ETS_TEXTURE_2:
|
||||||
|
case ETS_TEXTURE_3:
|
||||||
|
if ( 0 == (TransformationFlag[state] & ETF_IDENTITY ) )
|
||||||
|
LightSpace.Flags |= VERTEXTRANSFORM;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -335,9 +352,10 @@ bool CBurningVideoDriver::beginScene(bool backBuffer, bool zBuffer,
|
||||||
if (backBuffer && BackBuffer)
|
if (backBuffer && BackBuffer)
|
||||||
BackBuffer->fill(color);
|
BackBuffer->fill(color);
|
||||||
|
|
||||||
if (DepthBuffer && zBuffer)
|
if (zBuffer && DepthBuffer)
|
||||||
DepthBuffer->clear();
|
DepthBuffer->clear();
|
||||||
|
|
||||||
|
memset ( TransformationFlag, 0, sizeof ( TransformationFlag ) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,12 +762,12 @@ inline f32 CBurningVideoDriver::texelarea2 ( const s4DVertex **v, s32 tex ) cons
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*/
|
*/
|
||||||
inline void CBurningVideoDriver::select_polygon_mipmap ( s4DVertex *v, u32 vIn, s32 tex )
|
inline void CBurningVideoDriver::select_polygon_mipmap ( s4DVertex *v, u32 vIn, u32 tex, const core::dimension2du& texSize )
|
||||||
{
|
{
|
||||||
f32 f[2];
|
f32 f[2];
|
||||||
|
|
||||||
f[0] = (f32) MAT_TEXTURE ( tex )->getSize().Width;
|
f[0] = (f32) texSize.Width - 0.25f;
|
||||||
f[1] = (f32) MAT_TEXTURE ( tex )->getSize().Height;
|
f[1] = (f32) texSize.Height - 0.25f;
|
||||||
|
|
||||||
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
||||||
for ( u32 g = 0; g != vIn; g += 2 )
|
for ( u32 g = 0; g != vIn; g += 2 )
|
||||||
|
@ -766,12 +784,12 @@ inline void CBurningVideoDriver::select_polygon_mipmap ( s4DVertex *v, u32 vIn,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CBurningVideoDriver::select_polygon_mipmap2 ( s4DVertex **v, s32 tex ) const
|
inline void CBurningVideoDriver::select_polygon_mipmap2 ( s4DVertex **v, u32 tex, const core::dimension2du& texSize ) const
|
||||||
{
|
{
|
||||||
f32 f[2];
|
f32 f[2];
|
||||||
|
|
||||||
f[0] = (f32) MAT_TEXTURE ( tex )->getSize().Width;
|
f[0] = (f32) texSize.Width - 0.25f;
|
||||||
f[1] = (f32) MAT_TEXTURE ( tex )->getSize().Height;
|
f[1] = (f32) texSize.Height - 0.25f;
|
||||||
|
|
||||||
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
|
||||||
(v[0] + 1 )->Tex[tex].x = v[0]->Tex[tex].x * ( v[0] + 1 )->Pos.w * f[0];
|
(v[0] + 1 )->Tex[tex].x = v[0]->Tex[tex].x * ( v[0] + 1 )->Pos.w * f[0];
|
||||||
|
@ -800,7 +818,8 @@ const SVSize CBurningVideoDriver::vSize[] =
|
||||||
{
|
{
|
||||||
{ VERTEX4D_FORMAT_TEXTURE_1 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex), 1 },
|
{ VERTEX4D_FORMAT_TEXTURE_1 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex), 1 },
|
||||||
{ VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex2TCoords),2 },
|
{ VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex2TCoords),2 },
|
||||||
{ VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertexTangents),2 }
|
{ VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertexTangents),2 },
|
||||||
|
{ VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex), 2 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -828,24 +847,61 @@ void CBurningVideoDriver::VertexCache_fill(const u32 sourceIndex,
|
||||||
dest = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( destIndex << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) );
|
dest = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( destIndex << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) );
|
||||||
|
|
||||||
// transform Model * World * Camera * Projection * NDCSpace matrix
|
// transform Model * World * Camera * Projection * NDCSpace matrix
|
||||||
Transformation [ ETS_CURRENT].transformVect ( &dest->Pos.x, ((S3DVertex*) source )->Pos );
|
const S3DVertex *base = ((S3DVertex*) source );
|
||||||
|
Transformation [ ETS_CURRENT].transformVect ( &dest->Pos.x, base->Pos );
|
||||||
|
|
||||||
#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR
|
|
||||||
// light Vertex
|
#if defined (SOFTWARE_DRIVER_2_LIGHTING) || defined ( SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM )
|
||||||
#ifdef SOFTWARE_DRIVER_2_LIGHTING
|
|
||||||
lightVertex ( dest, ((S3DVertex*) source ) );
|
// vertex normal in light space
|
||||||
|
if ( Material.org.Lighting || (LightSpace.Flags & VERTEXTRANSFORM) )
|
||||||
|
{
|
||||||
|
if ( TransformationFlag[ETS_WORLD] & ETF_IDENTITY )
|
||||||
|
{
|
||||||
|
LightSpace.normal.set ( base->Normal.X, base->Normal.Y, base->Normal.Z, 1.f );
|
||||||
|
LightSpace.vertex.set ( base->Pos.X, base->Pos.Y, base->Pos.Z, 1.f );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Transformation[ETS_WORLD].rotateVect ( &LightSpace.normal.x, base->Normal );
|
||||||
|
if ( LightSpace.Flags & NORMALIZE )
|
||||||
|
LightSpace.normal.normalize_xyz();
|
||||||
|
|
||||||
|
// vertex in light space
|
||||||
|
if ( LightSpace.Flags & ( POINTLIGHT | FOG | SPECULAR | VERTEXTRANSFORM) )
|
||||||
|
Transformation[ETS_WORLD].transformVect ( &LightSpace.vertex.x, base->Pos );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined ( SOFTWARE_DRIVER_2_USE_VERTEX_COLOR )
|
||||||
|
// apply lighting model
|
||||||
|
#if defined (SOFTWARE_DRIVER_2_LIGHTING)
|
||||||
|
if ( Material.org.Lighting )
|
||||||
|
{
|
||||||
|
lightVertex ( dest, base->Color.color );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dest->Color[0].setA8R8G8B8 ( base->Color.color );
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
dest->Color[0].setA8R8G8B8 ( ((S3DVertex*) source )->Color.color );
|
dest->Color[0].setA8R8G8B8 ( base->Color.color );
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// transfer texture coordinates
|
// Texture Transform
|
||||||
const core::vector2d<f32> *srcT = &((S3DVertex*) source )->TCoords;
|
#if !defined ( SOFTWARE_DRIVER_2_TEXTURE_TRANSFORM )
|
||||||
|
irr::memcpy32_small ( &dest->Tex[0],&base->TCoords,
|
||||||
|
vSize[VertexCache.vType].TexSize << 3 // * ( sizeof ( f32 ) * 2 )
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
|
||||||
if ( TransformationFlag [ ETS_TEXTURE_0 ] && TransformationFlag [ ETS_TEXTURE_1 ] )
|
if ( 0 == (LightSpace.Flags & VERTEXTRANSFORM) )
|
||||||
{
|
{
|
||||||
irr::memcpy32_small ( &dest->Tex[0],srcT,
|
irr::memcpy32_small ( &dest->Tex[0],&base->TCoords,
|
||||||
vSize[VertexCache.vType].TexSize * ( sizeof ( f32 ) * 2 )
|
vSize[VertexCache.vType].TexSize << 3 // * ( sizeof ( f32 ) * 2 )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -862,33 +918,61 @@ void CBurningVideoDriver::VertexCache_fill(const u32 sourceIndex,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u32 t;
|
u32 t;
|
||||||
f32 tx1, ty1;
|
sVec4 n;
|
||||||
|
sVec2 srcT;
|
||||||
|
|
||||||
for ( t = 0; t != vSize[VertexCache.vType].TexSize; ++t )
|
for ( t = 0; t != vSize[VertexCache.vType].TexSize; ++t )
|
||||||
{
|
{
|
||||||
const core::matrix4& M = Transformation [ ETS_TEXTURE_0 + t ];
|
const core::matrix4& M = Transformation [ ETS_TEXTURE_0 + t ];
|
||||||
|
|
||||||
|
// texgen
|
||||||
|
if ( TransformationFlag [ ETS_TEXTURE_0 + t ] & (ETF_TEXGEN_CAMERA_NORMAL|ETF_TEXGEN_CAMERA_REFLECTION) )
|
||||||
|
{
|
||||||
|
n.x = LightSpace.campos.x - LightSpace.vertex.x;
|
||||||
|
n.y = LightSpace.campos.x - LightSpace.vertex.y;
|
||||||
|
n.z = LightSpace.campos.x - LightSpace.vertex.z;
|
||||||
|
n.normalize_xyz();
|
||||||
|
n.x += LightSpace.normal.x;
|
||||||
|
n.y += LightSpace.normal.y;
|
||||||
|
n.z += LightSpace.normal.z;
|
||||||
|
n.normalize_xyz();
|
||||||
|
|
||||||
|
const f32 *view = Transformation[ETS_VIEW].pointer();
|
||||||
|
|
||||||
|
if ( TransformationFlag [ ETS_TEXTURE_0 + t ] & ETF_TEXGEN_CAMERA_REFLECTION )
|
||||||
|
{
|
||||||
|
srcT.x = 0.5f * ( 1.f + (n.x * view[0] + n.y * view[4] + n.z * view[8] ));
|
||||||
|
srcT.y = 0.5f * ( 1.f + (n.x * view[1] + n.y * view[5] + n.z * view[9] ));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
srcT.x = 0.5f * ( 1.f + (n.x * view[0] + n.y * view[1] + n.z * view[2] ));
|
||||||
|
srcT.y = 0.5f * ( 1.f + (n.x * view[4] + n.y * view[5] + n.z * view[6] ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
irr::memcpy32_small ( &srcT,(&base->TCoords) + t,
|
||||||
|
sizeof ( f32 ) * 2 );
|
||||||
|
}
|
||||||
|
|
||||||
switch ( Material.org.TextureLayer[t].TextureWrap )
|
switch ( Material.org.TextureLayer[t].TextureWrap )
|
||||||
{
|
{
|
||||||
case ETC_REPEAT:
|
case ETC_REPEAT:
|
||||||
default:
|
default:
|
||||||
dest->Tex[t].x = M[0] * srcT[t].X + M[4] * srcT[t].Y + M[8];
|
dest->Tex[t].x = M[0] * srcT.x + M[4] * srcT.y + M[8];
|
||||||
dest->Tex[t].y = M[1] * srcT[t].X + M[5] * srcT[t].Y + M[9];
|
dest->Tex[t].y = M[1] * srcT.x + M[5] * srcT.y + M[9];
|
||||||
break;
|
break;
|
||||||
case ETC_CLAMP:
|
case ETC_CLAMP:
|
||||||
case ETC_CLAMP_TO_EDGE:
|
case ETC_CLAMP_TO_EDGE:
|
||||||
tx1 = M[0] * srcT[t].X + M[4] * srcT[t].Y + M[8];
|
dest->Tex[t].x = core::clamp ( (f32) ( M[0] * srcT.x + M[4] * srcT.y + M[8] ), 0.f, 1.f );
|
||||||
ty1 = M[1] * srcT[t].X + M[5] * srcT[t].Y + M[9];
|
dest->Tex[t].y = core::clamp ( (f32) ( M[1] * srcT.x + M[5] * srcT.y + M[9] ), 0.f, 1.f );
|
||||||
|
|
||||||
dest->Tex[t].x = tx1 <= 0.f ? 0.f : tx1 >= 1.f ? 1.f : tx1;
|
|
||||||
dest->Tex[t].y = ty1 <= 0.f ? 0.f : ty1 >= 1.f ? 1.f : ty1;
|
|
||||||
//dest->Tex[t].x = core::clamp ( M[0] * src[t].X + M[4] * src[t].Y + M[8], 0.f, 1.f );
|
|
||||||
//dest->Tex[t].y = core::clamp ( M[1] * src[t].X + M[5] * src[t].Y + M[9], 0.f, 1.f );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
dest[0].flag = dest[1].flag = vSize[VertexCache.vType].Format;
|
dest[0].flag = dest[1].flag = vSize[VertexCache.vType].Format;
|
||||||
|
|
||||||
|
@ -1033,7 +1117,7 @@ REALINLINE void CBurningVideoDriver::VertexCache_get ( s4DVertex ** face )
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*/
|
*/
|
||||||
REALINLINE void CBurningVideoDriver::VertexCache_get2 ( s4DVertex ** face )
|
REALINLINE void CBurningVideoDriver::VertexCache_getbypass ( s4DVertex ** face )
|
||||||
{
|
{
|
||||||
const u32 i0 = core::if_c_a_else_0 ( VertexCache.pType != scene::EPT_TRIANGLE_FAN, VertexCache.indicesRun );
|
const u32 i0 = core::if_c_a_else_0 ( VertexCache.pType != scene::EPT_TRIANGLE_FAN, VertexCache.indicesRun );
|
||||||
|
|
||||||
|
@ -1074,7 +1158,10 @@ void CBurningVideoDriver::VertexCache_reset ( const void* vertices, u32 vertexCo
|
||||||
VertexCache.indicesIndex = 0;
|
VertexCache.indicesIndex = 0;
|
||||||
VertexCache.indicesRun = 0;
|
VertexCache.indicesRun = 0;
|
||||||
|
|
||||||
VertexCache.vType = vType;
|
if ( Material.org.MaterialType == video::EMT_REFLECTION_2_LAYER )
|
||||||
|
VertexCache.vType = 3;
|
||||||
|
else
|
||||||
|
VertexCache.vType = vType;
|
||||||
VertexCache.pType = pType;
|
VertexCache.pType = pType;
|
||||||
VertexCache.iType = iType == EIT_16BIT ? 1 : 2;
|
VertexCache.iType = iType == EIT_16BIT ? 1 : 2;
|
||||||
|
|
||||||
|
@ -1116,6 +1203,7 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
|
||||||
s32 lodLevel;
|
s32 lodLevel;
|
||||||
u32 i;
|
u32 i;
|
||||||
u32 g;
|
u32 g;
|
||||||
|
video::CSoftwareTexture2* tex;
|
||||||
|
|
||||||
for ( i = 0; i < (u32) primitiveCount; ++i )
|
for ( i = 0; i < (u32) primitiveCount; ++i )
|
||||||
{
|
{
|
||||||
|
@ -1143,15 +1231,15 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
|
||||||
for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g )
|
for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g )
|
||||||
//for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g )
|
//for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g )
|
||||||
{
|
{
|
||||||
if ( 0 == MAT_TEXTURE ( g ) )
|
if ( 0 == (tex = MAT_TEXTURE ( g )) )
|
||||||
{
|
{
|
||||||
CurrentShader->setTextureParam(g, 0, 0);
|
CurrentShader->setTextureParam(g, 0, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lodLevel = s32_log2_f32 ( texelarea2 ( face, g ) * dc_area );
|
lodLevel = s32_log2_f32 ( texelarea2 ( face, g ) * dc_area );
|
||||||
CurrentShader->setTextureParam(g, MAT_TEXTURE ( g ), lodLevel);
|
CurrentShader->setTextureParam(g, tex, lodLevel);
|
||||||
select_polygon_mipmap2 ( (s4DVertex**) face, g );
|
select_polygon_mipmap2 ( (s4DVertex**) face, g, tex->getSize() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1261,16 +1349,15 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
|
||||||
//for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g )
|
//for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g )
|
||||||
for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g )
|
for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g )
|
||||||
{
|
{
|
||||||
if ( 0 == MAT_TEXTURE ( g ) )
|
if ( 0 == (tex = MAT_TEXTURE ( g )) )
|
||||||
{
|
{
|
||||||
CurrentShader->setTextureParam(g, 0, 0);
|
CurrentShader->setTextureParam(g, 0, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lodLevel = s32_log2_f32 ( texelarea ( CurrentOut.data, g ) / dc_area );
|
lodLevel = s32_log2_f32 ( texelarea ( CurrentOut.data, g ) / dc_area );
|
||||||
|
CurrentShader->setTextureParam(g, tex, lodLevel);
|
||||||
CurrentShader->setTextureParam(g, MAT_TEXTURE ( g ), lodLevel);
|
select_polygon_mipmap ( CurrentOut.data, vOut, g, tex->getSize() );
|
||||||
select_polygon_mipmap ( CurrentOut.data, vOut, g );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-tesselate ( triangle-fan, 0-1-2,0-2-3.. )
|
// re-tesselate ( triangle-fan, 0-1-2,0-2-3.. )
|
||||||
|
@ -1309,37 +1396,47 @@ void CBurningVideoDriver::setAmbientLight(const SColorf& color)
|
||||||
//! adds a dynamic light
|
//! adds a dynamic light
|
||||||
s32 CBurningVideoDriver::addDynamicLight(const SLight& dl)
|
s32 CBurningVideoDriver::addDynamicLight(const SLight& dl)
|
||||||
{
|
{
|
||||||
|
(void) CNullDriver::addDynamicLight( dl );
|
||||||
|
|
||||||
SBurningShaderLight l;
|
SBurningShaderLight l;
|
||||||
l.org = dl;
|
// l.org = dl;
|
||||||
|
l.Type = dl.Type;
|
||||||
l.LightIsOn = true;
|
l.LightIsOn = true;
|
||||||
|
|
||||||
l.AmbientColor.setColorf ( l.org.AmbientColor );
|
l.AmbientColor.setColorf ( dl.AmbientColor );
|
||||||
l.DiffuseColor.setColorf ( l.org.DiffuseColor );
|
l.DiffuseColor.setColorf ( dl.DiffuseColor );
|
||||||
l.SpecularColor.setColorf ( l.org.SpecularColor );
|
l.SpecularColor.setColorf ( dl.SpecularColor );
|
||||||
|
|
||||||
switch ( dl.Type )
|
switch ( dl.Type )
|
||||||
{
|
{
|
||||||
case video::ELT_DIRECTIONAL:
|
case video::ELT_DIRECTIONAL:
|
||||||
l.posLightSpace.x = -l.org.Direction.X;
|
l.pos.x = -dl.Direction.X;
|
||||||
l.posLightSpace.y = -l.org.Direction.Y;
|
l.pos.y = -dl.Direction.Y;
|
||||||
l.posLightSpace.z = -l.org.Direction.Z;
|
l.pos.z = -dl.Direction.Z;
|
||||||
l.posLightSpace.w = 1.f;
|
l.pos.w = 1.f;
|
||||||
break;
|
break;
|
||||||
case ELT_POINT:
|
case ELT_POINT:
|
||||||
case ELT_SPOT:
|
case ELT_SPOT:
|
||||||
LightSpace.Flags |= POINTLIGHT;
|
LightSpace.Flags |= POINTLIGHT;
|
||||||
l.posLightSpace.x = l.org.Position.X;
|
l.pos.x = dl.Position.X;
|
||||||
l.posLightSpace.y = l.org.Position.Y;
|
l.pos.y = dl.Position.Y;
|
||||||
l.posLightSpace.z = l.org.Position.Z;
|
l.pos.z = dl.Position.Z;
|
||||||
l.posLightSpace.w = 1.f;
|
l.pos.w = 1.f;
|
||||||
l.constantAttenuation = l.org.Attenuation.X;
|
/*
|
||||||
l.linearAttenuation = l.org.Attenuation.Y;
|
l.radius = (1.f / dl.Attenuation.Y) * (1.f / dl.Attenuation.Y);
|
||||||
l.quadraticAttenuation = l.org.Attenuation.Z;
|
l.constantAttenuation = dl.Attenuation.X;
|
||||||
|
l.linearAttenuation = dl.Attenuation.Y;
|
||||||
|
l.quadraticAttenuation = dl.Attenuation.Z;
|
||||||
|
*/
|
||||||
|
l.radius = dl.Radius * dl.Radius;
|
||||||
|
l.constantAttenuation = dl.Attenuation.X;
|
||||||
|
l.linearAttenuation = 1.f / dl.Radius;
|
||||||
|
l.quadraticAttenuation = dl.Attenuation.Z;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LightSpace.Light.push_back ( l );
|
LightSpace.Light.push_back ( l );
|
||||||
(void) CNullDriver::addDynamicLight( l.org );
|
|
||||||
return LightSpace.Light.size() - 1;
|
return LightSpace.Light.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1379,10 +1476,10 @@ void CBurningVideoDriver::setMaterial(const SMaterial& material)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SOFTWARE_DRIVER_2_LIGHTING
|
#ifdef SOFTWARE_DRIVER_2_LIGHTING
|
||||||
Material.AmbientColor.setA8R8G8B8 ( Material.org.AmbientColor.color );
|
Material.AmbientColor.setR8G8B8 ( Material.org.AmbientColor.color );
|
||||||
Material.DiffuseColor.setA8R8G8B8 ( Material.org.DiffuseColor.color );
|
Material.DiffuseColor.setR8G8B8 ( Material.org.DiffuseColor.color );
|
||||||
Material.EmissiveColor.setA8R8G8B8 ( Material.org.EmissiveColor.color );
|
Material.EmissiveColor.setR8G8B8 ( Material.org.EmissiveColor.color );
|
||||||
Material.SpecularColor.setA8R8G8B8 ( Material.org.SpecularColor.color );
|
Material.SpecularColor.setR8G8B8 ( Material.org.SpecularColor.color );
|
||||||
|
|
||||||
core::setbit_cond ( LightSpace.Flags, Material.org.Shininess != 0.f, SPECULAR );
|
core::setbit_cond ( LightSpace.Flags, Material.org.Shininess != 0.f, SPECULAR );
|
||||||
core::setbit_cond ( LightSpace.Flags, Material.org.FogEnable, FOG );
|
core::setbit_cond ( LightSpace.Flags, Material.org.FogEnable, FOG );
|
||||||
|
@ -1404,76 +1501,54 @@ void CBurningVideoDriver::setFog(SColor color, bool linearFog, f32 start,
|
||||||
LightSpace.FogColor.setA8R8G8B8 ( color.color );
|
LightSpace.FogColor.setA8R8G8B8 ( color.color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Camera Position in World Space
|
||||||
|
*/
|
||||||
|
void CBurningVideoDriver::getCameraPosWorldSpace ()
|
||||||
|
{
|
||||||
|
Transformation[ETS_VIEW_INVERSE] = Transformation[ ETS_VIEW ];
|
||||||
|
Transformation[ETS_VIEW_INVERSE].makeInverse ();
|
||||||
|
TransformationFlag[ETS_VIEW_INVERSE] = 0;
|
||||||
|
|
||||||
|
const f32 *M = Transformation[ETS_VIEW_INVERSE].pointer ();
|
||||||
|
|
||||||
|
/* The viewpoint is at (0., 0., 0.) in eye space.
|
||||||
|
Turning this into a vector [0 0 0 1] and multiply it by
|
||||||
|
the inverse of the view matrix, the resulting vector is the
|
||||||
|
object space location of the camera.
|
||||||
|
*/
|
||||||
|
|
||||||
|
LightSpace.campos.x = M[12];
|
||||||
|
LightSpace.campos.y = M[13];
|
||||||
|
LightSpace.campos.z = M[14];
|
||||||
|
LightSpace.campos.w = 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
applies lighting model
|
||||||
*/
|
*/
|
||||||
void CBurningVideoDriver::lightVertex ( s4DVertex *dest, const S3DVertex *source )
|
void CBurningVideoDriver::lightVertex ( s4DVertex *dest, u32 vertexargb )
|
||||||
{
|
{
|
||||||
// apply lighting model
|
sVec3 dColor;
|
||||||
if ( !Material.org.Lighting )
|
|
||||||
{
|
|
||||||
// should use the DiffuseColor but using pre-lit vertex color
|
|
||||||
dest->Color[0].setA8R8G8B8 ( source->Color.color );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sVec4 dColor;
|
|
||||||
|
|
||||||
dColor = LightSpace.Global_AmbientLight;
|
dColor = LightSpace.Global_AmbientLight;
|
||||||
dColor += Material.EmissiveColor;
|
dColor.add ( Material.EmissiveColor );
|
||||||
|
|
||||||
if ( Lights.size () == 0 )
|
if ( Lights.size () == 0 )
|
||||||
{
|
{
|
||||||
dColor.saturate();
|
dColor.saturate( dest->Color[0], vertexargb);
|
||||||
dest->Color[0] = dColor;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sVec4 vertexLightSpace;
|
sVec3 ambient;
|
||||||
sVec4 normalLightSpace;
|
sVec3 diffuse;
|
||||||
sVec4 eyeLightSpace;
|
sVec3 specular;
|
||||||
|
|
||||||
// vertex normal in light space
|
|
||||||
Transformation[ETS_WORLD].rotateVect ( &normalLightSpace.x, source->Normal );
|
|
||||||
if ( LightSpace.Flags & NORMALIZE )
|
|
||||||
normalLightSpace.normalize_xyz();
|
|
||||||
|
|
||||||
// vertex in light space
|
|
||||||
if ( LightSpace.Flags & ( POINTLIGHT | FOG | SPECULAR ) )
|
|
||||||
Transformation[ETS_WORLD].transformVect ( &vertexLightSpace.x, source->Pos );
|
|
||||||
|
|
||||||
// eye in in light space
|
|
||||||
if ( LightSpace.Flags & ( FOG | SPECULAR ) )
|
|
||||||
{
|
|
||||||
if ( !TransformationFlag [ETS_VIEW_INVERSE] )
|
|
||||||
{
|
|
||||||
Transformation[ETS_VIEW_INVERSE] = Transformation[ ETS_VIEW ];
|
|
||||||
Transformation[ETS_VIEW_INVERSE].makeInverse ();
|
|
||||||
TransformationFlag[ETS_VIEW_INVERSE] = 1;
|
|
||||||
}
|
|
||||||
const f32 *M = Transformation[ETS_VIEW_INVERSE].pointer ();
|
|
||||||
|
|
||||||
/* The viewpoint is at (0., 0., 0.) in eye space.
|
|
||||||
Turning this into a vector [0 0 0 1] and multiply it by
|
|
||||||
the inverse of the view matrix, the resulting vector is the
|
|
||||||
object space location of the camera.
|
|
||||||
*/
|
|
||||||
|
|
||||||
eyeLightSpace.x = M[12];
|
|
||||||
eyeLightSpace.y = M[13];
|
|
||||||
eyeLightSpace.z = M[14];
|
|
||||||
eyeLightSpace.w = 1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
sVec4 ambient;
|
|
||||||
sVec4 diffuse;
|
|
||||||
sVec4 specular;
|
|
||||||
|
|
||||||
|
|
||||||
// the universe started in darkness..
|
// the universe started in darkness..
|
||||||
ambient.set ( 0.f, 0.f, 0.f, 0.f );
|
ambient.set ( 0.f, 0.f, 0.f );
|
||||||
diffuse.set ( 0.f, 0.f, 0.f, 0.f );
|
diffuse.set ( 0.f, 0.f, 0.f );
|
||||||
specular.set ( 0.f, 0.f, 0.f, 0.f );
|
specular.set ( 0.f, 0.f, 0.f );
|
||||||
|
|
||||||
|
|
||||||
u32 i;
|
u32 i;
|
||||||
|
@ -1487,90 +1562,78 @@ void CBurningVideoDriver::lightVertex ( s4DVertex *dest, const S3DVertex *source
|
||||||
{
|
{
|
||||||
const SBurningShaderLight &light = LightSpace.Light[i];
|
const SBurningShaderLight &light = LightSpace.Light[i];
|
||||||
|
|
||||||
switch ( light.org.Type )
|
// accumulate ambient
|
||||||
|
ambient.add ( light.AmbientColor );
|
||||||
|
|
||||||
|
switch ( light.Type )
|
||||||
{
|
{
|
||||||
case video::ELT_SPOT:
|
case video::ELT_SPOT:
|
||||||
case video::ELT_POINT:
|
case video::ELT_POINT:
|
||||||
// surface to light
|
// surface to light
|
||||||
vp.x = light.posLightSpace.x - vertexLightSpace.x;
|
vp.x = light.pos.x - LightSpace.vertex.x;
|
||||||
vp.y = light.posLightSpace.y - vertexLightSpace.y;
|
vp.y = light.pos.y - LightSpace.vertex.y;
|
||||||
vp.z = light.posLightSpace.z - vertexLightSpace.z;
|
vp.z = light.pos.z - LightSpace.vertex.z;
|
||||||
|
|
||||||
len = vp.get_length_xyz_square();
|
len = vp.get_length_xyz_square();
|
||||||
if ( light.org.Radius * light.org.Radius < len )
|
if ( light.radius < len )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
len = core::squareroot ( len );
|
len = core::squareroot ( len );
|
||||||
attenuation = light.constantAttenuation +
|
|
||||||
( 1.f - (len * light.linearAttenuation) );
|
|
||||||
|
|
||||||
/*
|
|
||||||
attenuation = light.constantAttenuation +
|
|
||||||
light.linearAttenuation * attenuation +
|
|
||||||
light.quadraticAttenuation * attenuation * attenuation;
|
|
||||||
*/
|
|
||||||
// accumulate ambient
|
|
||||||
ambient += light.AmbientColor * attenuation;
|
|
||||||
|
|
||||||
|
attenuation = light.constantAttenuation + ( 1.f - ( len * light.linearAttenuation ) );
|
||||||
|
|
||||||
// build diffuse reflection
|
// build diffuse reflection
|
||||||
|
|
||||||
//angle between normal and light vector
|
//angle between normal and light vector
|
||||||
vp *= core::reciprocal ( len );
|
vp.mulReciprocal ( len );
|
||||||
dot = normalLightSpace.dot_xyz ( vp );
|
dot = LightSpace.normal.dot_xyz ( vp );
|
||||||
if ( dot < 0.f )
|
if ( dot < 0.f )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// diffuse component
|
// diffuse component
|
||||||
diffuse += light.DiffuseColor * ( dot * attenuation );
|
diffuse.mulAdd ( light.DiffuseColor, dot * attenuation );
|
||||||
|
|
||||||
if ( !(LightSpace.Flags & SPECULAR) )
|
if ( !(LightSpace.Flags & SPECULAR) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// build specular
|
// build specular
|
||||||
// surface to view
|
// surface to view
|
||||||
lightHalf.x = eyeLightSpace.x - vertexLightSpace.x;
|
lightHalf.x = LightSpace.campos.x - LightSpace.vertex.x;
|
||||||
lightHalf.y = eyeLightSpace.y - vertexLightSpace.y;
|
lightHalf.y = LightSpace.campos.y - LightSpace.vertex.y;
|
||||||
lightHalf.z = eyeLightSpace.z - vertexLightSpace.z;
|
lightHalf.z = LightSpace.campos.z - LightSpace.vertex.z;
|
||||||
lightHalf.normalize_xyz();
|
lightHalf.normalize_xyz();
|
||||||
lightHalf += vp;
|
lightHalf += vp;
|
||||||
lightHalf.normalize_xyz();
|
lightHalf.normalize_xyz();
|
||||||
|
|
||||||
// specular
|
// specular
|
||||||
dot = normalLightSpace.dot_xyz ( lightHalf );
|
dot = LightSpace.normal.dot_xyz ( lightHalf );
|
||||||
if ( dot < 0.f )
|
if ( dot < 0.f )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//specular += light.SpecularColor * ( powf ( Material.org.Shininess ,dot ) * attenuation );
|
//specular += light.SpecularColor * ( powf ( Material.org.Shininess ,dot ) * attenuation );
|
||||||
specular += light.SpecularColor * ( dot * attenuation );
|
specular.mulAdd ( light.SpecularColor, dot * attenuation );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case video::ELT_DIRECTIONAL:
|
case video::ELT_DIRECTIONAL:
|
||||||
|
|
||||||
// accumulate ambient
|
|
||||||
ambient += light.AmbientColor;
|
|
||||||
|
|
||||||
//angle between normal and light vector
|
//angle between normal and light vector
|
||||||
dot = normalLightSpace.dot_xyz ( light.posLightSpace );
|
dot = LightSpace.normal.dot_xyz ( light.pos );
|
||||||
if ( dot < 0.f )
|
if ( dot < 0.f )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// diffuse component
|
// diffuse component
|
||||||
diffuse += light.DiffuseColor * dot;
|
diffuse.mulAdd ( light.DiffuseColor, dot );
|
||||||
if ( !(LightSpace.Flags & SPECULAR) )
|
|
||||||
continue;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sum up lights
|
// sum up lights
|
||||||
dColor += ambient * Material.AmbientColor;
|
dColor.mulAdd (ambient, Material.AmbientColor );
|
||||||
dColor += diffuse * Material.DiffuseColor;
|
dColor.mulAdd (diffuse, Material.DiffuseColor);
|
||||||
dColor += specular * Material.SpecularColor;
|
dColor.mulAdd (specular, Material.SpecularColor);
|
||||||
dColor.saturate();
|
|
||||||
|
|
||||||
dest->Color[0] = dColor;
|
dColor.saturate ( dest->Color[0], vertexargb );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1612,7 +1675,7 @@ void CBurningVideoDriver::draw2DLine(const core::position2d<s32>& start,
|
||||||
//! Draws a pixel
|
//! Draws a pixel
|
||||||
void CBurningVideoDriver::drawPixel(u32 x, u32 y, const SColor & color)
|
void CBurningVideoDriver::drawPixel(u32 x, u32 y, const SColor & color)
|
||||||
{
|
{
|
||||||
((CImage*)BackBuffer)->setPixel(x, y, color);
|
((CImage*)BackBuffer)->setPixel(x, y, color, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! draw an 2d rectangle
|
//! draw an 2d rectangle
|
||||||
|
@ -1851,16 +1914,22 @@ void CBurningVideoDriver::draw3DLine(const core::vector3df& start,
|
||||||
const wchar_t* CBurningVideoDriver::getName() const
|
const wchar_t* CBurningVideoDriver::getName() const
|
||||||
{
|
{
|
||||||
#ifdef BURNINGVIDEO_RENDERER_BEAUTIFUL
|
#ifdef BURNINGVIDEO_RENDERER_BEAUTIFUL
|
||||||
return L"Burning's Video 0.42 beautiful";
|
return L"Burning's Video 0.44 beautiful";
|
||||||
#elif defined ( BURNINGVIDEO_RENDERER_ULTRA_FAST )
|
#elif defined ( BURNINGVIDEO_RENDERER_ULTRA_FAST )
|
||||||
return L"Burning's Video 0.42 ultra fast";
|
return L"Burning's Video 0.44 ultra fast";
|
||||||
#elif defined ( BURNINGVIDEO_RENDERER_FAST )
|
#elif defined ( BURNINGVIDEO_RENDERER_FAST )
|
||||||
return L"Burning's Video 0.42 fast";
|
return L"Burning's Video 0.44 fast";
|
||||||
#else
|
#else
|
||||||
return L"Burning's Video 0.42";
|
return L"Burning's Video 0.44";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Returns the graphics card vendor name.
|
||||||
|
core::stringc CBurningVideoDriver::getVendorInfo()
|
||||||
|
{
|
||||||
|
return "Burning's Video: Ing. Thomas Alten (c) 2006-2009";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Returns type of video driver
|
//! Returns type of video driver
|
||||||
E_DRIVER_TYPE CBurningVideoDriver::getDriverType() const
|
E_DRIVER_TYPE CBurningVideoDriver::getDriverType() const
|
||||||
|
@ -1936,12 +2005,6 @@ u32 CBurningVideoDriver::getMaximalPrimitiveCount() const
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the graphics card vendor name.
|
|
||||||
core::stringc CBurningVideoDriver::getVendorInfo()
|
|
||||||
{
|
|
||||||
return "Burningsvideo: Ing. Thomas Alten (c) 2006-2009";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do
|
//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do
|
||||||
//! this: First, draw all geometry. Then use this method, to draw the shadow
|
//! this: First, draw all geometry. Then use this method, to draw the shadow
|
||||||
|
|
|
@ -201,8 +201,17 @@ namespace video
|
||||||
ETS_COUNT_BURNING
|
ETS_COUNT_BURNING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum E_TRANSFORMATION_FLAG
|
||||||
|
{
|
||||||
|
ETF_IDENTITY = 1,
|
||||||
|
ETF_TEXGEN_CAMERA_NORMAL = 2,
|
||||||
|
ETF_TEXGEN_CAMERA_REFLECTION = 4,
|
||||||
|
};
|
||||||
u32 TransformationFlag[ETS_COUNT_BURNING];
|
u32 TransformationFlag[ETS_COUNT_BURNING];
|
||||||
core::matrix4 Transformation[ETS_COUNT_BURNING];
|
core::matrix4 Transformation[ETS_COUNT_BURNING];
|
||||||
|
|
||||||
|
void getCameraPosWorldSpace ();
|
||||||
|
|
||||||
|
|
||||||
// Vertex Cache
|
// Vertex Cache
|
||||||
static const SVSize vSize[];
|
static const SVSize vSize[];
|
||||||
|
@ -214,7 +223,7 @@ namespace video
|
||||||
E_VERTEX_TYPE vType,scene::E_PRIMITIVE_TYPE pType,
|
E_VERTEX_TYPE vType,scene::E_PRIMITIVE_TYPE pType,
|
||||||
E_INDEX_TYPE iType);
|
E_INDEX_TYPE iType);
|
||||||
void VertexCache_get ( s4DVertex ** face );
|
void VertexCache_get ( s4DVertex ** face );
|
||||||
void VertexCache_get2 ( s4DVertex ** face );
|
void VertexCache_getbypass ( s4DVertex ** face );
|
||||||
|
|
||||||
void VertexCache_fill ( const u32 sourceIndex,const u32 destIndex );
|
void VertexCache_fill ( const u32 sourceIndex,const u32 destIndex );
|
||||||
s4DVertex * VertexCache_getVertex ( const u32 sourceIndex );
|
s4DVertex * VertexCache_getVertex ( const u32 sourceIndex );
|
||||||
|
@ -227,7 +236,8 @@ namespace video
|
||||||
|
|
||||||
|
|
||||||
#ifdef SOFTWARE_DRIVER_2_LIGHTING
|
#ifdef SOFTWARE_DRIVER_2_LIGHTING
|
||||||
void lightVertex ( s4DVertex *dest, const S3DVertex *source );
|
|
||||||
|
void lightVertex ( s4DVertex *dest, u32 vertexargb );
|
||||||
//! Sets the fog mode.
|
//! Sets the fog mode.
|
||||||
virtual void setFog(SColor color, bool linearFog, f32 start,
|
virtual void setFog(SColor color, bool linearFog, f32 start,
|
||||||
f32 end, f32 density, bool pixelFog, bool rangeFog);
|
f32 end, f32 density, bool pixelFog, bool rangeFog);
|
||||||
|
@ -240,14 +250,14 @@ namespace video
|
||||||
|
|
||||||
void ndc_2_dc_and_project ( s4DVertex *dest,s4DVertex *source, u32 vIn ) const;
|
void ndc_2_dc_and_project ( s4DVertex *dest,s4DVertex *source, u32 vIn ) const;
|
||||||
f32 screenarea ( const s4DVertex *v0 ) const;
|
f32 screenarea ( const s4DVertex *v0 ) const;
|
||||||
void select_polygon_mipmap ( s4DVertex *source, u32 vIn, s32 tex );
|
void select_polygon_mipmap ( s4DVertex *source, u32 vIn, u32 tex, const core::dimension2du& texSize );
|
||||||
f32 texelarea ( const s4DVertex *v0, int tex ) const;
|
f32 texelarea ( const s4DVertex *v0, int tex ) const;
|
||||||
|
|
||||||
|
|
||||||
void ndc_2_dc_and_project2 ( const s4DVertex **v, const u32 size ) const;
|
void ndc_2_dc_and_project2 ( const s4DVertex **v, const u32 size ) const;
|
||||||
f32 screenarea2 ( const s4DVertex **v ) const;
|
f32 screenarea2 ( const s4DVertex **v ) const;
|
||||||
f32 texelarea2 ( const s4DVertex **v, int tex ) const;
|
f32 texelarea2 ( const s4DVertex **v, int tex ) const;
|
||||||
void select_polygon_mipmap2 ( s4DVertex **source, s32 tex ) const;
|
void select_polygon_mipmap2 ( s4DVertex **source, u32 tex, const core::dimension2du& texSize ) const;
|
||||||
|
|
||||||
|
|
||||||
SBurningShaderLightSpace LightSpace;
|
SBurningShaderLightSpace LightSpace;
|
||||||
|
|
|
@ -62,10 +62,12 @@ CSoftwareTexture2::CSoftwareTexture2(IImage* image, const core::string<c16>& nam
|
||||||
OrigSize = optSize;
|
OrigSize = optSize;
|
||||||
os::Printer::log ( buf, ELL_WARNING );
|
os::Printer::log ( buf, ELL_WARNING );
|
||||||
MipMap[0] = new CImage(BURNINGSHADER_COLOR_FORMAT, optSize);
|
MipMap[0] = new CImage(BURNINGSHADER_COLOR_FORMAT, optSize);
|
||||||
|
MipMap[0]->fill ( 0 );
|
||||||
|
|
||||||
|
|
||||||
// temporary CImage needed
|
// temporary CImage needed
|
||||||
CImage * temp = new CImage ( BURNINGSHADER_COLOR_FORMAT, image );
|
CImage * temp = new CImage ( BURNINGSHADER_COLOR_FORMAT, image );
|
||||||
temp->copyToScalingBoxFilter ( MipMap[0], 0 );
|
temp->copyToScalingBoxFilter ( MipMap[0],0, false );
|
||||||
//temp->copyToScaling(MipMap[0]);
|
//temp->copyToScaling(MipMap[0]);
|
||||||
temp->drop ();
|
temp->drop ();
|
||||||
}
|
}
|
||||||
|
@ -97,7 +99,7 @@ void CSoftwareTexture2::regenerateMipMapLevels()
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
// release
|
// release
|
||||||
for ( i = 1; i!= SOFTWARE_DRIVER_2_MIPMAPPING_MAX; ++i )
|
for ( i = 1; i < SOFTWARE_DRIVER_2_MIPMAPPING_MAX; ++i )
|
||||||
{
|
{
|
||||||
if ( MipMap[i] )
|
if ( MipMap[i] )
|
||||||
MipMap[i]->drop();
|
MipMap[i]->drop();
|
||||||
|
@ -115,7 +117,8 @@ void CSoftwareTexture2::regenerateMipMapLevels()
|
||||||
newSize.Height = core::s32_max ( 1, currentSize.Height >> 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] = new CImage(BURNINGSHADER_COLOR_FORMAT, newSize);
|
||||||
MipMap[0]->copyToScalingBoxFilter( MipMap[i], 0 );
|
MipMap[i]->fill ( 0 );
|
||||||
|
MipMap[0]->copyToScalingBoxFilter( MipMap[i], 0, false );
|
||||||
c = MipMap[i];
|
c = MipMap[i];
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,14 +319,6 @@ void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4D
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -622,19 +614,6 @@ void CTRGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,13 +330,6 @@ void CTRGouraudAlpha2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,cons
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
|
@ -633,20 +626,6 @@ void CTRGouraudAlpha2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
|
|
@ -332,14 +332,6 @@ void CTRGouraudAlphaNoZ2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,c
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -635,20 +627,6 @@ void CTRGouraudAlphaNoZ2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
|
|
@ -2057,14 +2057,6 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -2360,20 +2352,6 @@ void CTRTextureBlend::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -335,14 +335,6 @@ void CTRTextureDetailMap2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -638,20 +630,6 @@ void CTRTextureDetailMap2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
|
|
@ -348,14 +348,6 @@ void CTRTextureGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,co
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -651,20 +643,6 @@ void CTRTextureGouraud2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
|
|
@ -352,14 +352,6 @@ void CTRTextureGouraudAdd2::drawTriangle ( const s4DVertex *a,const s4DVertex *b
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
||||||
{
|
{
|
||||||
|
@ -655,20 +647,6 @@ void CTRTextureGouraudAdd2::drawTriangle ( const s4DVertex *a,const s4DVertex *b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -323,14 +323,6 @@ void CTRTextureGouraudAddNoZ2::drawTriangle ( const s4DVertex *a,const s4DVertex
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -626,20 +618,6 @@ void CTRTextureGouraudAddNoZ2::drawTriangle ( const s4DVertex *a,const s4DVertex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
|
|
@ -417,14 +417,6 @@ void CTRTextureGouraudAlpha2::drawTriangle ( const s4DVertex *a,const s4DVertex
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -720,20 +712,6 @@ void CTRTextureGouraudAlpha2::drawTriangle ( const s4DVertex *a,const s4DVertex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -417,14 +417,6 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -720,19 +712,6 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle ( const s4DVertex *a,const s4DVerte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,14 +320,6 @@ void CTRTextureGouraudNoZ2::drawTriangle ( const s4DVertex *a,const s4DVertex *b
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -623,20 +615,6 @@ void CTRTextureGouraudNoZ2::drawTriangle ( const s4DVertex *a,const s4DVertex *b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -363,14 +363,6 @@ void CTRTextureVertexAlpha2::drawTriangle ( const s4DVertex *a,const s4DVertex *
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -666,20 +658,6 @@ void CTRTextureVertexAlpha2::drawTriangle ( const s4DVertex *a,const s4DVertex *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -344,18 +344,6 @@ void CTRTextureLightMap2_Add::drawTriangle ( const s4DVertex *a,const s4DVertex
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// query access to TexMaps
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
{
|
{
|
||||||
|
@ -651,19 +639,6 @@ void CTRTextureLightMap2_Add::drawTriangle ( const s4DVertex *a,const s4DVertex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,17 +314,6 @@ void CTRTextureLightMap2_M1::drawTriangle ( const s4DVertex *a,const s4DVertex *
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// query access to TexMaps
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
||||||
{
|
{
|
||||||
|
@ -621,20 +610,6 @@ void CTRTextureLightMap2_M1::drawTriangle ( const s4DVertex *a,const s4DVertex *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -314,17 +314,6 @@ void CTRTextureLightMap2_M2::drawTriangle ( const s4DVertex *a,const s4DVertex *
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// query access to TexMaps
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
||||||
{
|
{
|
||||||
|
@ -621,20 +610,6 @@ void CTRTextureLightMap2_M2::drawTriangle ( const s4DVertex *a,const s4DVertex *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -642,17 +642,6 @@ void CTRTextureLightMap2_M4::drawTriangle_Min ( const s4DVertex *a,const s4DVert
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// query access to TexMaps
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
||||||
{
|
{
|
||||||
|
@ -949,20 +938,6 @@ void CTRTextureLightMap2_M4::drawTriangle_Min ( const s4DVertex *a,const s4DVert
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTRTextureLightMap2_M4::drawTriangle_Mag ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c )
|
void CTRTextureLightMap2_M4::drawTriangle_Mag ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c )
|
||||||
|
@ -1039,16 +1014,6 @@ void CTRTextureLightMap2_M4::drawTriangle ( const s4DVertex *a,const s4DVertex *
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// query access to TexMaps
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
if ( F32_GREATER_0 ( scan.invDeltaY[1] ) )
|
||||||
|
@ -1346,20 +1311,6 @@ void CTRTextureLightMap2_M4::drawTriangle ( const s4DVertex *a,const s4DVertex *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
|
|
@ -359,17 +359,6 @@ void CTRGTextureLightMap2_M4::drawTriangle ( const s4DVertex *a,const s4DVertex
|
||||||
f32 subPixel;
|
f32 subPixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// query access to TexMaps
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].data = (tVideoSample*)IT[0].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].data = (tVideoSample*)IT[1].Texture->lock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// rasterize upper sub-triangle
|
// rasterize upper sub-triangle
|
||||||
//if ( (f32) 0.0 != scan.invDeltaY[1] )
|
//if ( (f32) 0.0 != scan.invDeltaY[1] )
|
||||||
|
@ -669,20 +658,6 @@ void CTRGTextureLightMap2_M4::drawTriangle ( const s4DVertex *a,const s4DVertex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T0
|
|
||||||
IT[0].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPOL_T1
|
|
||||||
IT[1].Texture->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -254,12 +254,6 @@ void CTRTextureWire2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const
|
||||||
renderLine ( b, c );
|
renderLine ( b, c );
|
||||||
renderLine ( a, c );
|
renderLine ( a, c );
|
||||||
|
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,11 +266,6 @@ void CTRTextureWire2::drawLine ( const s4DVertex *a,const s4DVertex *b)
|
||||||
if ( a->Pos.y > b->Pos.y ) swapVertexPointer(&a, &b);
|
if ( a->Pos.y > b->Pos.y ) swapVertexPointer(&a, &b);
|
||||||
|
|
||||||
renderLine ( a, b );
|
renderLine ( a, b );
|
||||||
RenderTarget->unlock();
|
|
||||||
|
|
||||||
#ifdef USE_ZBUFFER
|
|
||||||
DepthBuffer->unlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace scene
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void animateWaterSurface();
|
void animateWaterSurface();
|
||||||
void addWave(core::vector3df& dest, const core::vector3df source, f32 time)
|
void addWave(core::vector3df& dest, const core::vector3df &source, f32 time) const
|
||||||
{
|
{
|
||||||
dest.Y = source.Y +
|
dest.Y = source.Y +
|
||||||
(sinf(((source.X/WaveLength) + time)) * WaveHeight) +
|
(sinf(((source.X/WaveLength) + time)) * WaveHeight) +
|
||||||
|
|
|
@ -99,6 +99,7 @@ CZipReader::CZipReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
|
||||||
File->grab();
|
File->grab();
|
||||||
|
|
||||||
Base = File->getFileName();
|
Base = File->getFileName();
|
||||||
|
Base.replace ( '\\', '/' );
|
||||||
|
|
||||||
// scan local headers
|
// scan local headers
|
||||||
while (scanLocalHeader());
|
while (scanLocalHeader());
|
||||||
|
@ -582,6 +583,7 @@ CMountPointReader::CMountPointReader( IFileSystem * parent, const core::string<c
|
||||||
:CZipReader ( 0, ignoreCase, ignorePaths ), Parent ( parent )
|
:CZipReader ( 0, ignoreCase, ignorePaths ), Parent ( parent )
|
||||||
{
|
{
|
||||||
Base = basename;
|
Base = basename;
|
||||||
|
Base.replace ( '\\', '/' );
|
||||||
if ( core::lastChar ( Base ) != '/' )
|
if ( core::lastChar ( Base ) != '/' )
|
||||||
Base.append ( '/' );
|
Base.append ( '/' );
|
||||||
Type = "mount";
|
Type = "mount";
|
||||||
|
|
|
@ -27,19 +27,19 @@ namespace video
|
||||||
|
|
||||||
struct SBurningShaderLight
|
struct SBurningShaderLight
|
||||||
{
|
{
|
||||||
SLight org;
|
//SLight org;
|
||||||
bool LightIsOn;
|
bool LightIsOn;
|
||||||
|
|
||||||
E_LIGHT_TYPE type;
|
E_LIGHT_TYPE Type;
|
||||||
sVec4 posLightSpace;
|
f32 radius;
|
||||||
|
|
||||||
f32 constantAttenuation;
|
|
||||||
f32 linearAttenuation;
|
f32 linearAttenuation;
|
||||||
|
f32 constantAttenuation;
|
||||||
f32 quadraticAttenuation;
|
f32 quadraticAttenuation;
|
||||||
|
sVec4 pos;
|
||||||
|
|
||||||
sVec4 AmbientColor;
|
sVec3 AmbientColor;
|
||||||
sVec4 DiffuseColor;
|
sVec3 DiffuseColor;
|
||||||
sVec4 SpecularColor;
|
sVec3 SpecularColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eLightFlags
|
enum eLightFlags
|
||||||
|
@ -49,6 +49,7 @@ namespace video
|
||||||
SPECULAR = 0x04,
|
SPECULAR = 0x04,
|
||||||
FOG = 0x08,
|
FOG = 0x08,
|
||||||
NORMALIZE = 0x10,
|
NORMALIZE = 0x10,
|
||||||
|
VERTEXTRANSFORM = 0x20,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SBurningShaderLightSpace
|
struct SBurningShaderLightSpace
|
||||||
|
@ -56,12 +57,15 @@ namespace video
|
||||||
void reset ()
|
void reset ()
|
||||||
{
|
{
|
||||||
Light.set_used ( 0 );
|
Light.set_used ( 0 );
|
||||||
Global_AmbientLight.set ( 0.f, 0.f, 0.f, 0.f );
|
Global_AmbientLight.set ( 0.f, 0.f, 0.f );
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
}
|
}
|
||||||
core::array<SBurningShaderLight> Light;
|
core::array<SBurningShaderLight> Light;
|
||||||
sVec4 Global_AmbientLight;
|
sVec3 Global_AmbientLight;
|
||||||
sVec4 FogColor;
|
sVec4 FogColor;
|
||||||
|
sVec4 campos;
|
||||||
|
sVec4 vertex;
|
||||||
|
sVec4 normal;
|
||||||
u32 Flags;
|
u32 Flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,10 +73,10 @@ namespace video
|
||||||
{
|
{
|
||||||
SMaterial org;
|
SMaterial org;
|
||||||
|
|
||||||
sVec4 AmbientColor;
|
sVec3 AmbientColor;
|
||||||
sVec4 DiffuseColor;
|
sVec3 DiffuseColor;
|
||||||
sVec4 SpecularColor;
|
sVec3 SpecularColor;
|
||||||
sVec4 EmissiveColor;
|
sVec3 EmissiveColor;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -881,6 +881,10 @@
|
||||||
RelativePath=".\..\..\include\IDummyTransformationSceneNode.h"
|
RelativePath=".\..\..\include\IDummyTransformationSceneNode.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\IGeometryCreator.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\ILightManager.h"
|
RelativePath="..\..\include\ILightManager.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -139,19 +139,6 @@ struct sVec4
|
||||||
w = color.b;
|
w = color.b;
|
||||||
}
|
}
|
||||||
|
|
||||||
void saturate ()
|
|
||||||
{
|
|
||||||
x = core::min_ ( x, 1.f );
|
|
||||||
y = core::min_ ( y, 1.f );
|
|
||||||
z = core::min_ ( z, 1.f );
|
|
||||||
w = core::min_ ( w, 1.f );
|
|
||||||
/*
|
|
||||||
x = core::clamp ( x, 0.f, 1.f );
|
|
||||||
y = core::clamp ( y, 0.f, 1.f );
|
|
||||||
z = core::clamp ( z, 0.f, 1.f );
|
|
||||||
w = core::clamp ( w, 0.f, 1.f );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// f = a * t + b * ( 1 - t )
|
// f = a * t + b * ( 1 - t )
|
||||||
void interpolate(const sVec4& a, const sVec4& b, const f32 t)
|
void interpolate(const sVec4& a, const sVec4& b, const f32 t)
|
||||||
|
@ -183,12 +170,6 @@ struct sVec4
|
||||||
return core::squareroot ( x * x + y * y + z * z );
|
return core::squareroot ( x * x + y * y + z * z );
|
||||||
}
|
}
|
||||||
|
|
||||||
f32 get_inverse_length_xyz () const
|
|
||||||
{
|
|
||||||
return core::reciprocal_squareroot ( x * x + y * y + z * z );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void normalize_xyz ()
|
void normalize_xyz ()
|
||||||
{
|
{
|
||||||
const f32 l = core::reciprocal_squareroot ( x * x + y * y + z * z );
|
const f32 l = core::reciprocal_squareroot ( x * x + y * y + z * z );
|
||||||
|
@ -234,6 +215,15 @@ struct sVec4
|
||||||
return sVec4(x * other.x , y * other.y, z * other.z,w * other.w);
|
return sVec4(x * other.x , y * other.y, z * other.z,w * other.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mulReciprocal ( f32 s )
|
||||||
|
{
|
||||||
|
const f32 i = core::reciprocal ( s );
|
||||||
|
x = (f32) ( x * i );
|
||||||
|
y = (f32) ( y * i );
|
||||||
|
z = (f32) ( z * i );
|
||||||
|
w = (f32) ( w * i );
|
||||||
|
}
|
||||||
|
/*
|
||||||
void operator*=(f32 s)
|
void operator*=(f32 s)
|
||||||
{
|
{
|
||||||
x *= s;
|
x *= s;
|
||||||
|
@ -241,7 +231,7 @@ struct sVec4
|
||||||
z *= s;
|
z *= s;
|
||||||
w *= s;
|
w *= s;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
void operator*=(const sVec4 &other)
|
void operator*=(const sVec4 &other)
|
||||||
{
|
{
|
||||||
x *= other.x;
|
x *= other.x;
|
||||||
|
@ -259,6 +249,64 @@ struct sVec4
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct sVec3
|
||||||
|
{
|
||||||
|
f32 r, g, b;
|
||||||
|
|
||||||
|
void set ( f32 _r, f32 _g, f32 _b )
|
||||||
|
{
|
||||||
|
r = _r;
|
||||||
|
g = _g;
|
||||||
|
b = _b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setR8G8B8 ( u32 argb )
|
||||||
|
{
|
||||||
|
r = ( ( argb & 0x00FF0000 ) >> 16 ) * ( 1.f / 255.f );
|
||||||
|
g = ( ( argb & 0x0000FF00 ) >> 8 ) * ( 1.f / 255.f );
|
||||||
|
b = ( ( argb & 0x000000FF ) ) * ( 1.f / 255.f );
|
||||||
|
}
|
||||||
|
|
||||||
|
void setColorf ( const video::SColorf & color )
|
||||||
|
{
|
||||||
|
r = color.r;
|
||||||
|
g = color.g;
|
||||||
|
b = color.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void add (const sVec3& other)
|
||||||
|
{
|
||||||
|
r += other.r;
|
||||||
|
g += other.g;
|
||||||
|
b += other.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mulAdd(const sVec3& other, const f32 v)
|
||||||
|
{
|
||||||
|
r += other.r * v;
|
||||||
|
g += other.g * v;
|
||||||
|
b += other.b * v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mulAdd(const sVec3& v0, const sVec3& v1)
|
||||||
|
{
|
||||||
|
r += v0.r * v1.r;
|
||||||
|
g += v0.g * v1.g;
|
||||||
|
b += v0.b * v1.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void saturate ( sVec4 &dest, u32 argb )
|
||||||
|
{
|
||||||
|
dest.x = ( ( argb & 0xFF000000 ) >> 24 ) * ( 1.f / 255.f );
|
||||||
|
dest.y = core::min_ ( r, 1.f );
|
||||||
|
dest.z = core::min_ ( g, 1.f );
|
||||||
|
dest.w = core::min_ ( b, 1.f );
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline void sCompressedVec4::setVec4 ( const sVec4 & v )
|
inline void sCompressedVec4::setVec4 ( const sVec4 & v )
|
||||||
{
|
{
|
||||||
argb = core::floor32 ( v.x * 255.f ) << 24 |
|
argb = core::floor32 ( v.x * 255.f ) << 24 |
|
||||||
|
|
|
@ -295,7 +295,7 @@ REALINLINE u32 PixelAdd32 ( const u32 c2, const u32 c1)
|
||||||
return modulo | clamp;
|
return modulo | clamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
|
|
||||||
// 1 - Bit Alpha Blending
|
// 1 - Bit Alpha Blending
|
||||||
inline u16 PixelBlend16 ( const u16 destination, const u16 source )
|
inline u16 PixelBlend16 ( const u16 destination, const u16 source )
|
||||||
|
@ -329,30 +329,15 @@ inline u32 PixelBlend16_simd ( const u32 destination, const u32 source )
|
||||||
// 1 - Bit Alpha Blending
|
// 1 - Bit Alpha Blending
|
||||||
inline u16 PixelBlend16 ( const u16 c2, const u16 c1 )
|
inline u16 PixelBlend16 ( const u16 c2, const u16 c1 )
|
||||||
{
|
{
|
||||||
return core::if_c_a_else_b ( c1 & 0x8000, c1, c2 );
|
u16 mask = ((c1 & 0x8000) >> 15 ) + 0x7fff;
|
||||||
/*
|
return (c2 & mask ) | ( c1 & ~mask );
|
||||||
u16 c = c1 & 0x8000;
|
|
||||||
|
|
||||||
c >>= 15;
|
|
||||||
c += 0x7fff;
|
|
||||||
|
|
||||||
return (c & c2 ) | c1;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 - Bit Alpha Blending 16Bit SIMD
|
// 1 - Bit Alpha Blending 16Bit SIMD
|
||||||
inline u32 PixelBlend16_simd ( const u32 c2, const u32 c1 )
|
inline u32 PixelBlend16_simd ( const u32 c2, const u32 c1 )
|
||||||
{
|
{
|
||||||
return core::if_c_a_else_b ( c1 & 0x80008000, c1, c2 );
|
u32 mask = ((c1 & 0x80008000) >> 15 ) + 0x7fff7fff;
|
||||||
|
return (c2 & mask ) | ( c1 & ~mask );
|
||||||
/*
|
|
||||||
u32 c = c1 & 0x80008000;
|
|
||||||
|
|
||||||
c >>= 15;
|
|
||||||
c += 0x7fff7fff;
|
|
||||||
|
|
||||||
return (c & c2 ) | c1;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,12 +46,6 @@ bool irrCoreEquals(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(irr::core::equals(99, 98))
|
|
||||||
{
|
|
||||||
logTestString("irr::core::equals(s32, s32 (,default)) failed.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(irr::core::equals(99, 98, 0))
|
if(irr::core::equals(99, 98, 0))
|
||||||
{
|
{
|
||||||
logTestString("irr::core::equals(s32, s32, 0) failed.\n");
|
logTestString("irr::core::equals(s32, s32, 0) failed.\n");
|
||||||
|
@ -70,12 +64,6 @@ bool irrCoreEquals(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(irr::core::equals(-99, -98))
|
|
||||||
{
|
|
||||||
logTestString("irr::core::equals(s32, s32 (,default)) failed.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(irr::core::equals(-99, -98, 0))
|
if(irr::core::equals(-99, -98, 0))
|
||||||
{
|
{
|
||||||
logTestString("irr::core::equals(s32, s32, 0) failed.\n");
|
logTestString("irr::core::equals(s32, s32, 0) failed.\n");
|
||||||
|
|
|
@ -55,8 +55,11 @@ int main(int argumentCount, char * arguments[])
|
||||||
// Note that to interactively debug a test, you will generally want to move it
|
// Note that to interactively debug a test, you will generally want to move it
|
||||||
// (temporarily) to the beginning of the list, since each test runs in its own
|
// (temporarily) to the beginning of the list, since each test runs in its own
|
||||||
// process.
|
// process.
|
||||||
|
|
||||||
TEST(disambiguateTextures); // Normally you should run this first, since it validates the working directory.
|
TEST(disambiguateTextures); // Normally you should run this first, since it validates the working directory.
|
||||||
TEST(exports);
|
TEST(exports);
|
||||||
|
|
||||||
|
#if 1
|
||||||
TEST(sceneCollisionManager);
|
TEST(sceneCollisionManager);
|
||||||
TEST(testVector3d);
|
TEST(testVector3d);
|
||||||
TEST(testVector2d);
|
TEST(testVector2d);
|
||||||
|
@ -72,7 +75,6 @@ int main(int argumentCount, char * arguments[])
|
||||||
TEST(textureRenderStates);
|
TEST(textureRenderStates);
|
||||||
TEST(terrainSceneNode);
|
TEST(terrainSceneNode);
|
||||||
TEST(burningsVideo);
|
TEST(burningsVideo);
|
||||||
TEST(makeColorKeyTexture);
|
|
||||||
TEST(cursorSetVisible);
|
TEST(cursorSetVisible);
|
||||||
TEST(transparentAlphaChannelRef);
|
TEST(transparentAlphaChannelRef);
|
||||||
TEST(drawRectOutline);
|
TEST(drawRectOutline);
|
||||||
|
@ -86,8 +88,13 @@ int main(int argumentCount, char * arguments[])
|
||||||
TEST(vectorPositionDimension2d);
|
TEST(vectorPositionDimension2d);
|
||||||
TEST(writeImageToFile);
|
TEST(writeImageToFile);
|
||||||
TEST(flyCircleAnimator);
|
TEST(flyCircleAnimator);
|
||||||
TEST(enumerateImageManipulators);
|
//TEST(enumerateImageManipulators);
|
||||||
TEST(testGeometryCreator);
|
//TEST(testGeometryCreator);
|
||||||
|
|
||||||
|
#else
|
||||||
|
TEST(makeColorKeyTexture);
|
||||||
|
tests[2].testSignature();
|
||||||
|
#endif
|
||||||
|
|
||||||
const unsigned int numberOfTests = tests.size();
|
const unsigned int numberOfTests = tests.size();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ static bool doTestWith(E_DRIVER_TYPE driverType,
|
||||||
device->getVideoDriver()->makeColorKeyTexture(Texture,
|
device->getVideoDriver()->makeColorKeyTexture(Texture,
|
||||||
position2d<s32>(64,64),
|
position2d<s32>(64,64),
|
||||||
zeroTexels);
|
zeroTexels);
|
||||||
|
|
||||||
(void)smgr->addCameraSceneNode();
|
(void)smgr->addCameraSceneNode();
|
||||||
|
|
||||||
driver->beginScene(true, true, SColor(255,100,101,140));
|
driver->beginScene(true, true, SColor(255,100,101,140));
|
||||||
|
@ -63,10 +62,23 @@ static bool doTestWith(E_DRIVER_TYPE driverType,
|
||||||
|
|
||||||
bool makeColorKeyTexture(void)
|
bool makeColorKeyTexture(void)
|
||||||
{
|
{
|
||||||
|
bool result = true;
|
||||||
|
|
||||||
|
//result &= doTestWith(EDT_DIRECT3D9, false);
|
||||||
|
//result &= doTestWith(EDT_BURNINGSVIDEO, false);
|
||||||
|
result &= doTestWith(EDT_SOFTWARE, false);
|
||||||
|
//result &= doTestWith(EDT_OPENGL, false);
|
||||||
|
|
||||||
|
//result &= doTestWith(EDT_DIRECT3D9, true);
|
||||||
|
//result &= doTestWith(EDT_BURNINGSVIDEO, true);
|
||||||
|
result &= doTestWith(EDT_SOFTWARE, true);
|
||||||
|
//result &= doTestWith(EDT_OPENGL, true);
|
||||||
|
|
||||||
|
/*
|
||||||
bool result = doTestWith(EDT_SOFTWARE, false);
|
bool result = doTestWith(EDT_SOFTWARE, false);
|
||||||
result &= doTestWith(EDT_BURNINGSVIDEO, false);
|
result &= doTestWith(EDT_BURNINGSVIDEO, false);
|
||||||
result &= doTestWith(EDT_SOFTWARE, true);
|
result &= doTestWith(EDT_SOFTWARE, true);
|
||||||
result &= doTestWith(EDT_BURNINGSVIDEO, true);
|
result &= doTestWith(EDT_BURNINGSVIDEO, true);
|
||||||
|
*/
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
@ -178,6 +178,8 @@ bool takeScreenshotAndCompareAgainstReference(irr::video::IVideoDriver * driver,
|
||||||
irr::core::stringc driverName = driver->getName();
|
irr::core::stringc driverName = driver->getName();
|
||||||
|
|
||||||
// For OpenGL and Burning, chop the version number out. Other drivers have more stable version numbers.
|
// For OpenGL and Burning, chop the version number out. Other drivers have more stable version numbers.
|
||||||
|
// TA: Sorry Rogerborg. burnings video also has the version number inside;-)
|
||||||
|
// maybe you sould take the getDriverType Info for this
|
||||||
if(driverName.find("OpenGL") > -1)
|
if(driverName.find("OpenGL") > -1)
|
||||||
driverName = "OpenGL";
|
driverName = "OpenGL";
|
||||||
else if(driverName.find("Burning's Video") > -1)
|
else if(driverName.find("Burning's Video") > -1)
|
||||||
|
|
|
@ -123,7 +123,7 @@ bool testVector2d(void)
|
||||||
else
|
else
|
||||||
logTestString("\n*** vector2d<f64> tests failed ***\n\n");
|
logTestString("\n*** vector2d<f64> tests failed ***\n\n");
|
||||||
|
|
||||||
bool s32Success = true; // doTests<s32>(); Currently broken: see vector3d<T>& normalize() and const T length = core::reciprocal_squareroot ( (T) (X*X + Y*Y + Z*Z) );
|
bool s32Success = doTests<s32>();
|
||||||
if(s32Success)
|
if(s32Success)
|
||||||
logTestString("vector2di tests passed\n\n");
|
logTestString("vector2di tests passed\n\n");
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
Test suite pass at GMT Mon Feb 09 20:04:31 2009
|
Test suite pass at GMT Tue Feb 10 14:54:11 2009
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
# Visual Studio 2005
|
# Visual Studio 2005
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests_vc8.vcproj", "{2A1DE18B-F678-4A94-A996-E848E20B2983}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests_vc8.vcproj", "{2A1DE18B-F678-4A94-A996-E848E20B2983}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "..\source\Irrlicht\Irrlicht8.0.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "..\source\Irrlicht\Irrlicht8.0.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="8.00"
|
Version="8,00"
|
||||||
Name="tests"
|
Name="tests"
|
||||||
ProjectGUID="{2A1DE18B-F678-4A94-A996-E848E20B2983}"
|
ProjectGUID="{2A1DE18B-F678-4A94-A996-E848E20B2983}"
|
||||||
RootNamespace="tests"
|
RootNamespace="tests"
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
AdditionalIncludeDirectories="..\include"
|
AdditionalIncludeDirectories="..\include"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="1"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="4"
|
DebugInformationFormat="4"
|
||||||
/>
|
/>
|
||||||
|
@ -58,6 +58,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="..\bin\Win32-VisualStudio\$(ProjectName).exe"
|
OutputFile="..\bin\Win32-VisualStudio\$(ProjectName).exe"
|
||||||
|
AdditionalLibraryDirectories="..\lib\Win32-visualstudio"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
TargetMachine="1"
|
TargetMachine="1"
|
||||||
/>
|
/>
|
||||||
|
@ -113,7 +114,8 @@
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
RuntimeLibrary="2"
|
AdditionalIncludeDirectories="..\include"
|
||||||
|
RuntimeLibrary="0"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="true"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
|
@ -130,6 +132,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="..\bin\Win32-VisualStudio\$(ProjectName).exe"
|
OutputFile="..\bin\Win32-VisualStudio\$(ProjectName).exe"
|
||||||
|
AdditionalLibraryDirectories="..\lib\Win32-visualstudio"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
EnableCOMDATFolding="2"
|
EnableCOMDATFolding="2"
|
||||||
|
@ -197,10 +200,6 @@
|
||||||
RelativePath=".\drawRectOutline.cpp"
|
RelativePath=".\drawRectOutline.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\enumerateImageManipulators.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\exports.cpp"
|
RelativePath=".\exports.cpp"
|
||||||
>
|
>
|
||||||
|
@ -245,10 +244,6 @@
|
||||||
RelativePath=".\planeMatrix.cpp"
|
RelativePath=".\planeMatrix.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\relativeTransformations.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\sceneCollisionManager.cpp"
|
RelativePath=".\sceneCollisionManager.cpp"
|
||||||
>
|
>
|
||||||
|
@ -269,10 +264,6 @@
|
||||||
RelativePath=".\testDimension2d.cpp"
|
RelativePath=".\testDimension2d.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\testGeometryCreator.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\testUtils.cpp"
|
RelativePath=".\testUtils.cpp"
|
||||||
>
|
>
|
||||||
|
|