Merge revisions 3139:3171 from 1.7 branch. Many new tests and bug fixes.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3172 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
934b4cfd22
commit
675fd7637e
|
@ -1,5 +1,9 @@
|
|||
Changes in 1.7
|
||||
|
||||
- Define sorting order for vector2d and vector3d in operators <, <=, > and >= to fix bugs 2783509 and 2783510. Operators order now by X,Y,Z and use float tolerances.
|
||||
|
||||
- Fix tooltips for gui-elements with sub-element like IGUISpinBox (id: 2927079, found by ArakisTheKitsune)
|
||||
|
||||
- ITimer no longer stops when started twice
|
||||
|
||||
- Add hasType to IGUIElement as a dynamic_cast substitute.
|
||||
|
|
|
@ -208,6 +208,16 @@ void loadModel(const c8* fn)
|
|||
|
||||
Model = 0;
|
||||
|
||||
if (extension==".irr")
|
||||
{
|
||||
core::array<scene::ISceneNode*> outNodes;
|
||||
Device->getSceneManager()->loadScene(filename);
|
||||
Device->getSceneManager()->getSceneNodesFromType(scene::ESNT_ANIMATED_MESH, outNodes);
|
||||
if (outNodes.size())
|
||||
Model = outNodes[0];
|
||||
return;
|
||||
}
|
||||
|
||||
scene::IAnimatedMesh* m = Device->getSceneManager()->getMesh( filename.c_str() );
|
||||
|
||||
if (!m)
|
||||
|
@ -679,9 +689,9 @@ int main(int argc, char* argv[])
|
|||
|
||||
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
|
||||
|
||||
smgr->addLightSceneNode();
|
||||
smgr->addLightSceneNode(0, core::vector3df(200,200,200),
|
||||
video::SColorf(1.0f,1.0f,1.0f),2000);
|
||||
smgr->setAmbientLight(video::SColorf(0.3f,0.3f,0.3f));
|
||||
// add our media directory as "search path"
|
||||
Device->getFileSystem()->addFolderFileArchive("../../media/");
|
||||
|
||||
|
|
|
@ -97,7 +97,10 @@ public:
|
|||
else
|
||||
if (event.KeyInput.Key == KEY_F8)
|
||||
{
|
||||
Node->setDebugDataVisible(scene::EDS_BBOX_ALL);
|
||||
if (Node->isDebugDataVisible())
|
||||
Node->setDebugDataVisible(scene::EDS_OFF);
|
||||
else
|
||||
Node->setDebugDataVisible(scene::EDS_BBOX_ALL);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -149,7 +152,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
// create device and exit if creation failed
|
||||
const core::dimension2du videoDim ( 800,600 );
|
||||
const core::dimension2du videoDim(800,600);
|
||||
|
||||
IrrlichtDevice *device = createDevice(driverType, videoDim, 32, false );
|
||||
|
||||
|
@ -182,15 +185,13 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
directly be stored on disk.
|
||||
*/
|
||||
if (argc>2)
|
||||
device->getFileSystem()->QUAKE3_STORAGE_FORMAT (argv[1]);
|
||||
device->getFileSystem()->QUAKE3_STORAGE_FORMAT(argv[1]);
|
||||
else
|
||||
device->getFileSystem()->QUAKE3_STORAGE_FORMAT ( QUAKE3_STORAGE_1 );
|
||||
device->getFileSystem()->QUAKE3_STORAGE_FORMAT(QUAKE3_STORAGE_1);
|
||||
#ifdef QUAKE3_STORAGE_2
|
||||
device->getFileSystem()->QUAKE3_STORAGE_FORMAT ( QUAKE3_STORAGE_2 );
|
||||
device->getFileSystem()->QUAKE3_STORAGE_FORMAT(QUAKE3_STORAGE_2);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Quake3 Shader controls Z-Writing
|
||||
smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
|
||||
|
||||
|
@ -210,7 +211,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
IVideoDriver class). Note that this optimization with the Octree is only
|
||||
useful when drawing huge meshes consisting of lots of geometry.
|
||||
*/
|
||||
scene::IQ3LevelMesh* mesh =
|
||||
scene::IQ3LevelMesh* const mesh =
|
||||
(scene::IQ3LevelMesh*) smgr->getMesh(mapname);
|
||||
|
||||
/*
|
||||
|
@ -218,16 +219,15 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
The Geometry mesh is optimised for faster drawing
|
||||
*/
|
||||
scene::ISceneNode* node = 0;
|
||||
if ( mesh )
|
||||
if (mesh)
|
||||
{
|
||||
scene::IMesh *geometry = mesh->getMesh(quake3::E_Q3_MESH_GEOMETRY);
|
||||
// node = smgr->addMeshSceneNode ( geometry );
|
||||
scene::IMesh * const geometry = mesh->getMesh(quake3::E_Q3_MESH_GEOMETRY);
|
||||
node = smgr->addOctreeSceneNode(geometry, 0, -1, 1024);
|
||||
}
|
||||
|
||||
// create an event receiver for making screenshots
|
||||
CScreenShotFactory screenshotFactory ( device, mapname, node );
|
||||
device->setEventReceiver ( &screenshotFactory );
|
||||
CScreenShotFactory screenshotFactory(device, mapname, node);
|
||||
device->setEventReceiver(&screenshotFactory);
|
||||
|
||||
/*
|
||||
now construct SceneNodes for each Shader
|
||||
|
@ -238,24 +238,24 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
if ( mesh )
|
||||
{
|
||||
// the additional mesh can be quite huge and is unoptimized
|
||||
scene::IMesh * additional_mesh = mesh->getMesh ( quake3::E_Q3_MESH_ITEMS );
|
||||
const scene::IMesh * const additional_mesh = mesh->getMesh(quake3::E_Q3_MESH_ITEMS);
|
||||
|
||||
#ifdef SHOW_SHADER_NAME
|
||||
gui::IGUIFont *font = device->getGUIEnvironment()->getFont("../../media/fontlucida.png");
|
||||
u32 count = 0;
|
||||
#endif
|
||||
|
||||
for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i )
|
||||
for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount(); ++i )
|
||||
{
|
||||
IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i );
|
||||
const video::SMaterial &material = meshBuffer->getMaterial();
|
||||
const IMeshBuffer* meshBuffer = additional_mesh->getMeshBuffer(i);
|
||||
const video::SMaterial& material = meshBuffer->getMaterial();
|
||||
|
||||
//! The ShaderIndex is stored in the material parameter
|
||||
s32 shaderIndex = (s32) material.MaterialTypeParam2;
|
||||
// The ShaderIndex is stored in the material parameter
|
||||
const s32 shaderIndex = (s32) material.MaterialTypeParam2;
|
||||
|
||||
// the meshbuffer can be rendered without additional support, or it has no shader
|
||||
const quake3::IShader *shader = mesh->getShader ( shaderIndex );
|
||||
if ( 0 == shader )
|
||||
const quake3::IShader *shader = mesh->getShader(shaderIndex);
|
||||
if (0 == shader)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -266,25 +266,17 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
// would be full...
|
||||
// quake3::dumpShader ( Shader );
|
||||
|
||||
#ifndef SHOW_SHADER_NAME
|
||||
smgr->addQuake3SceneNode ( meshBuffer, shader );
|
||||
#else
|
||||
node = smgr->addQuake3SceneNode(meshBuffer, shader);
|
||||
|
||||
#ifdef SHOW_SHADER_NAME
|
||||
count += 1;
|
||||
|
||||
node = smgr->addQuake3SceneNode ( meshBuffer, shader );
|
||||
|
||||
core::stringw name( node->getName() );
|
||||
node = smgr->addBillboardTextSceneNode(
|
||||
font,
|
||||
name.c_str(),
|
||||
node,
|
||||
font, name.c_str(), node,
|
||||
core::dimension2d<f32>(80.0f, 8.0f),
|
||||
core::vector3df(0, 10, 0)
|
||||
);
|
||||
core::vector3df(0, 10, 0));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -305,38 +297,36 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
we can ask the Quake3 Loader for all entities with class_name
|
||||
"info_player_deathmatch"
|
||||
we choose a random launch
|
||||
|
||||
*/
|
||||
if ( mesh )
|
||||
{
|
||||
quake3::tQ3EntityList &entityList = mesh->getEntityList ();
|
||||
quake3::tQ3EntityList &entityList = mesh->getEntityList();
|
||||
|
||||
quake3::IEntity search;
|
||||
search.name = "info_player_deathmatch";
|
||||
|
||||
s32 index = entityList.binary_search ( search );
|
||||
if ( index >= 0 )
|
||||
s32 index = entityList.binary_search(search);
|
||||
if (index >= 0)
|
||||
{
|
||||
const quake3::SVarGroup *group;
|
||||
s32 notEndList;
|
||||
do
|
||||
{
|
||||
group = entityList[ index ].getGroup(1);
|
||||
const quake3::SVarGroup *group = entityList[index].getGroup(1);
|
||||
|
||||
u32 parsepos = 0;
|
||||
core::vector3df pos =
|
||||
quake3::getAsVector3df ( group->get ( "origin" ), parsepos );
|
||||
const core::vector3df pos =
|
||||
quake3::getAsVector3df(group->get("origin"), parsepos);
|
||||
|
||||
parsepos = 0;
|
||||
f32 angle = quake3::getAsFloat ( group->get ( "angle"), parsepos );
|
||||
const f32 angle = quake3::getAsFloat(group->get("angle"), parsepos);
|
||||
|
||||
core::vector3df target ( 0.f, 0.f, 1.f );
|
||||
target.rotateXZBy ( angle, core::vector3df () );
|
||||
core::vector3df target(0.f, 0.f, 1.f);
|
||||
target.rotateXZBy(angle);
|
||||
|
||||
camera->setPosition ( pos );
|
||||
camera->setTarget ( pos + target );
|
||||
camera->setPosition(pos);
|
||||
camera->setTarget(pos + target);
|
||||
|
||||
index += 1;
|
||||
++index;
|
||||
/*
|
||||
notEndList = ( index < (s32) entityList.size () &&
|
||||
entityList[index].name == search.name &&
|
||||
|
@ -346,7 +336,6 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
notEndList = index == 2;
|
||||
} while ( notEndList );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -360,19 +349,19 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
core::position2d<s32>(10, 10));
|
||||
|
||||
// show the driver logo
|
||||
core::position2di pos ( videoDim.Width - 128, videoDim.Height - 64 );
|
||||
const core::position2di pos(videoDim.Width - 128, videoDim.Height - 64);
|
||||
|
||||
switch ( driverType )
|
||||
{
|
||||
case video::EDT_BURNINGSVIDEO:
|
||||
gui->addImage(driver->getTexture("burninglogo.png"),pos);
|
||||
gui->addImage(driver->getTexture("burninglogo.png"), pos);
|
||||
break;
|
||||
case video::EDT_OPENGL:
|
||||
gui->addImage(driver->getTexture("opengllogo.png"),pos);
|
||||
gui->addImage(driver->getTexture("opengllogo.png"), pos);
|
||||
break;
|
||||
case video::EDT_DIRECT3D8:
|
||||
case video::EDT_DIRECT3D9:
|
||||
gui->addImage(driver->getTexture("directxlogo.png"),pos);
|
||||
gui->addImage(driver->getTexture("directxlogo.png"), pos);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -391,32 +380,26 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
driver->beginScene(true, true, video::SColor(255,20,20,40));
|
||||
smgr->drawAll();
|
||||
gui->drawAll();
|
||||
|
||||
driver->endScene();
|
||||
|
||||
int fps = driver->getFPS();
|
||||
|
||||
//if (lastFPS != fps)
|
||||
{
|
||||
io::IAttributes * attr = smgr->getParameters();
|
||||
|
||||
s32 calls = attr->getAttributeAsInt ( "calls" );
|
||||
s32 culled = attr->getAttributeAsInt ( "culled" );
|
||||
|
||||
io::IAttributes * const attr = smgr->getParameters();
|
||||
core::stringw str = L"Q3 [";
|
||||
str += driver->getName();
|
||||
str += "] FPS:";
|
||||
str += fps;
|
||||
str += " Cull:";
|
||||
str += calls;
|
||||
str += attr->getAttributeAsInt("calls");
|
||||
str += "/";
|
||||
str += culled;
|
||||
str += attr->getAttributeAsInt("culled");
|
||||
str += " Draw: ";
|
||||
str += attr->getAttributeAsInt ( "drawn_solid" );
|
||||
str += attr->getAttributeAsInt("drawn_solid");
|
||||
str += "/";
|
||||
str += attr->getAttributeAsInt ( "drawn_transparent" );
|
||||
str += attr->getAttributeAsInt("drawn_transparent");
|
||||
str += "/";
|
||||
str += attr->getAttributeAsInt ( "drawn_transparent_effect" );
|
||||
str += attr->getAttributeAsInt("drawn_transparent_effect");
|
||||
|
||||
device->setWindowCaption(str.c_str());
|
||||
lastFPS = fps;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{830FD174-FABE-4667-B9FC-F7F8B8378EE7}") = "19.Quake3MapExplorer", "Quake3MapShader.vcproj", "{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}"
|
||||
Project("{830FD174-FABE-4667-B9FC-F7F8B8378EE7}") = "21.Quake3MapExplorer", "Quake3MapShader.vcproj", "{CDC4AAA9-72E1-4ffa-A04D-7EF59D8B97CD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
|
@ -89,7 +89,7 @@
|
|||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\19.Quake3MapExplorer.exe"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Version="9,00"
|
||||
Name="21.Quake3Explorer_vc9"
|
||||
ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
|
||||
RootNamespace="19.Quake3Explorer_vc9"
|
||||
RootNamespace="21.Quake3Explorer_vc9"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
|
|
|
@ -85,7 +85,7 @@ void GameData::setDefault ()
|
|||
deviceParam.WindowSize.Width = 800;
|
||||
deviceParam.WindowSize.Height = 600;
|
||||
deviceParam.Fullscreen = false;
|
||||
deviceParam.Bits = 32;
|
||||
deviceParam.Bits = 24;
|
||||
deviceParam.ZBufferBits = 16;
|
||||
deviceParam.Vsync = false;
|
||||
deviceParam.AntiAlias = false;
|
||||
|
@ -1040,12 +1040,14 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
|
|||
IFileSystem *fs = Game->Device->getFileSystem();
|
||||
ISceneManager *smgr = Game->Device->getSceneManager ();
|
||||
|
||||
IReadFile* file = fs->createMemoryReadFile ( &Game->loadParam, sizeof ( Game->loadParam ),
|
||||
L"levelparameter.cfg", false);
|
||||
IReadFile* file = fs->createMemoryReadFile(&Game->loadParam,
|
||||
sizeof(Game->loadParam), L"levelparameter.cfg", false);
|
||||
|
||||
// load cfg file
|
||||
smgr->getMesh( file );
|
||||
file->drop ();
|
||||
|
||||
// load the actual map
|
||||
Mesh = (IQ3LevelMesh*) smgr->getMesh(mapName);
|
||||
if ( 0 == Mesh )
|
||||
return;
|
||||
|
@ -1072,8 +1074,7 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
|
|||
//s32 minimalNodes = b0 ? core::s32_max ( 2048, b0->getVertexCount() / 32 ) : 2048;
|
||||
s32 minimalNodes = 2048;
|
||||
|
||||
MapParent = smgr->addMeshSceneNode( geometry );
|
||||
//MapParent = smgr->addOctreeSceneNode(geometry, 0, -1, minimalNodes);
|
||||
MapParent = smgr->addOctreeSceneNode(geometry, 0, -1, minimalNodes);
|
||||
MapParent->setName ( mapName );
|
||||
if ( Meta )
|
||||
{
|
||||
|
@ -1105,7 +1106,6 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
|
|||
if ( BulletParent )
|
||||
BulletParent->setName ( "Bullet Container" );
|
||||
|
||||
|
||||
/*
|
||||
now construct SceneNodes for each Shader
|
||||
The Objects are stored in the quake mesh E_Q3_MESH_ITEMS
|
||||
|
@ -1116,12 +1116,10 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
|
|||
Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_FOG,FogParent, 0, false );
|
||||
Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_UNRESOLVED,UnresolvedParent, Meta, true );
|
||||
|
||||
|
||||
/*
|
||||
Now construct Models from Entity List
|
||||
*/
|
||||
Q3ModelFactory ( Game->loadParam, Game->Device, Mesh, ItemParent, false );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1193,7 +1191,6 @@ void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNod
|
|||
|
||||
addSceneTreeItem ( *it, node );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1203,6 +1200,7 @@ void CQuake3EventHandler::CreatePlayers()
|
|||
Player[0].create ( Game->Device, Mesh, MapParent, Meta );
|
||||
}
|
||||
|
||||
|
||||
// Adds a skydome to the scene
|
||||
void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
|
||||
{
|
||||
|
@ -1237,28 +1235,16 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
|
|||
{
|
||||
snprintf ( buf, 64, "%s.jpg", texture );
|
||||
SkyNode = smgr->addSkyDomeSceneNode(
|
||||
driver->getTexture( buf ),
|
||||
32,32,
|
||||
1.f,
|
||||
1.f,
|
||||
1000.f,
|
||||
0,
|
||||
11
|
||||
);
|
||||
driver->getTexture( buf ), 32,32,
|
||||
1.f, 1.f, 1000.f, 0, 11);
|
||||
}
|
||||
else
|
||||
if ( 2 == dome )
|
||||
{
|
||||
snprintf ( buf, 64, "%s.jpg", texture );
|
||||
SkyNode = smgr->addSkyDomeSceneNode(
|
||||
driver->getTexture( buf ),
|
||||
16,8,
|
||||
0.95f,
|
||||
2.f,
|
||||
1000.f,
|
||||
0,
|
||||
11
|
||||
);
|
||||
driver->getTexture( buf ), 16,8,
|
||||
0.95f, 2.f, 1000.f, 0, 11);
|
||||
}
|
||||
|
||||
if (SkyNode)
|
||||
|
@ -1266,7 +1252,6 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
|
|||
//SkyNode->getMaterial(0).ZBuffer = video::EMDF_DEPTH_LESS_EQUAL;
|
||||
|
||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1311,7 +1296,6 @@ void CQuake3EventHandler::SetGUIActive( s32 command)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Handle game input
|
||||
*/
|
||||
|
|
|
@ -60,13 +60,13 @@ void CDemo::run()
|
|||
return;
|
||||
|
||||
if (device->getFileSystem()->existFile("irrlicht.dat"))
|
||||
device->getFileSystem()->addZipFileArchive("irrlicht.dat");
|
||||
device->getFileSystem()->addFileArchive("irrlicht.dat");
|
||||
else
|
||||
device->getFileSystem()->addZipFileArchive("../../media/irrlicht.dat");
|
||||
device->getFileSystem()->addFileArchive("../../media/irrlicht.dat");
|
||||
if (device->getFileSystem()->existFile("map-20kdm2.pk3"))
|
||||
device->getFileSystem()->addZipFileArchive("map-20kdm2.pk3");
|
||||
device->getFileSystem()->addFileArchive("map-20kdm2.pk3");
|
||||
else
|
||||
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
|
||||
device->getFileSystem()->addFileArchive("../../media/map-20kdm2.pk3");
|
||||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();
|
||||
|
@ -77,12 +77,12 @@ void CDemo::run()
|
|||
// set ambient light
|
||||
smgr->setAmbientLight ( video::SColorf ( 0x00c0c0c0 ) );
|
||||
|
||||
|
||||
wchar_t tmp[255];
|
||||
|
||||
// draw everything
|
||||
|
||||
s32 now = 0;
|
||||
s32 lastfps = 0;
|
||||
sceneStartTime = device->getTimer()->getTime();
|
||||
while(device->run() && driver)
|
||||
{
|
||||
|
@ -106,23 +106,19 @@ void CDemo::run()
|
|||
|
||||
smgr->drawAll();
|
||||
guienv->drawAll();
|
||||
|
||||
driver->endScene();
|
||||
|
||||
// write statistics
|
||||
static s32 lastfps = 0;
|
||||
s32 nowfps = driver->getFPS();
|
||||
const s32 nowfps = driver->getFPS();
|
||||
|
||||
swprintf(tmp, 255, L"%ls fps:%3d triangles:%0.3f mio",
|
||||
driver->getName(),
|
||||
driver->getFPS(),
|
||||
(f32) driver->getPrimitiveCountDrawn( 1 ) * ( 1.f / 1000000.f )
|
||||
);
|
||||
swprintf(tmp, 255, L"%ls fps:%3d triangles:%0.3f mio/s",
|
||||
driver->getName(), driver->getFPS(),
|
||||
driver->getPrimitiveCountDrawn(1) * (1.f / 1000000.f));
|
||||
|
||||
statusText->setText(tmp);
|
||||
if ( nowfps != lastfps )
|
||||
{
|
||||
device->setWindowCaption ( tmp );
|
||||
device->setWindowCaption(tmp);
|
||||
lastfps = nowfps;
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +336,6 @@ void CDemo::switchToNextScene()
|
|||
}
|
||||
|
||||
sceneStartTime = device->getTimer()->getTime();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -362,16 +357,13 @@ void CDemo::loadSceneData()
|
|||
|
||||
//move all quake level meshes (non-realtime)
|
||||
core::matrix4 m;
|
||||
m.setTranslation ( core::vector3df(-1300,-70,-1249) );
|
||||
m.setTranslation(core::vector3df(-1300,-70,-1249));
|
||||
|
||||
for ( i = 0; i!= scene::quake3::E_Q3_MESH_SIZE; ++i )
|
||||
{
|
||||
sm->getMeshManipulator()->transformMesh ( quakeLevelMesh->getMesh(i), m );
|
||||
}
|
||||
sm->getMeshManipulator()->transform(quakeLevelMesh->getMesh(i), m);
|
||||
|
||||
quakeLevelNode = sm->addOctreeSceneNode(
|
||||
quakeLevelMesh->getMesh( scene::quake3::E_Q3_MESH_GEOMETRY)
|
||||
);
|
||||
quakeLevelMesh->getMesh( scene::quake3::E_Q3_MESH_GEOMETRY));
|
||||
if (quakeLevelNode)
|
||||
{
|
||||
//quakeLevelNode->setPosition(core::vector3df(-1300,-70,-1249));
|
||||
|
@ -410,7 +402,6 @@ void CDemo::loadSceneData()
|
|||
// Now add the MeshBuffer(s) with the current Shader to the Manager
|
||||
sm->addQuake3SceneNode ( meshBuffer, shader );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// load sydney model and create 2 instances
|
||||
|
@ -427,9 +418,9 @@ void CDemo::loadSceneData()
|
|||
model1->setScale(core::vector3df(2,2,2));
|
||||
model1->setMD2Animation(scene::EMAT_STAND);
|
||||
model1->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
model1->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
|
||||
model1->setMaterialType(video::EMT_SPHERE_MAP);
|
||||
model1->addShadowVolumeSceneNode();
|
||||
model1->setAutomaticCulling ( scene::EAC_BOX );
|
||||
}
|
||||
|
||||
model2 = sm->addAnimatedMeshSceneNode(mesh);
|
||||
|
@ -440,8 +431,8 @@ void CDemo::loadSceneData()
|
|||
model2->setMD2Animation(scene::EMAT_RUN);
|
||||
model2->setMaterialTexture(0, device->getVideoDriver()->getTexture("../../media/sydney.bmp"));
|
||||
model2->setMaterialFlag(video::EMF_LIGHTING, true);
|
||||
model1->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
|
||||
model2->addShadowVolumeSceneNode();
|
||||
model2->setAutomaticCulling ( scene::EAC_BOX );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,8 +449,6 @@ void CDemo::loadSceneData()
|
|||
driver->getTexture("../../media/irrlicht2_bk.jpg"));
|
||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
|
||||
|
||||
//driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
|
||||
|
||||
// create walk-between-portals animation
|
||||
|
||||
core::vector3df waypoint[2];
|
||||
|
@ -468,8 +457,8 @@ void CDemo::loadSceneData()
|
|||
|
||||
if (model2)
|
||||
{
|
||||
anim = device->getSceneManager()->createFlyStraightAnimator(waypoint[0],
|
||||
waypoint[1], 2000, true);
|
||||
anim = device->getSceneManager()->createFlyStraightAnimator(
|
||||
waypoint[0], waypoint[1], 2000, true);
|
||||
model2->addAnimator(anim);
|
||||
anim->drop();
|
||||
}
|
||||
|
@ -533,7 +522,6 @@ void CDemo::loadSceneData()
|
|||
campFire->setPosition(core::vector3df(100,120,600));
|
||||
campFire->setScale(core::vector3df(2,2,2));
|
||||
|
||||
|
||||
scene::IParticleEmitter* em = campFire->createBoxEmitter(
|
||||
core::aabbox3d<f32>(-7,0,-7,7,1,7),
|
||||
core::vector3df(0.0f,0.06f,0.0f),
|
||||
|
@ -563,11 +551,9 @@ void CDemo::loadSceneData()
|
|||
if (music)
|
||||
startSound();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CDemo::createLoadingScreen()
|
||||
{
|
||||
core::dimension2d<u32> size = device->getVideoDriver()->getScreenSize();
|
||||
|
@ -610,7 +596,6 @@ void CDemo::createLoadingScreen()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void CDemo::shoot()
|
||||
{
|
||||
scene::ISceneManager* sm = device->getSceneManager();
|
||||
|
@ -701,7 +686,6 @@ void CDemo::shoot()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void CDemo::createParticleImpacts()
|
||||
{
|
||||
u32 now = device->getTimer()->getTime();
|
||||
|
@ -765,7 +749,6 @@ void CDemo::createParticleImpacts()
|
|||
}
|
||||
|
||||
|
||||
|
||||
#ifdef USE_IRRKLANG
|
||||
void CDemo::startIrrKlang()
|
||||
{
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestProject", "TestProject.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "..\..\source\Irrlicht\Irrlicht7.1.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Relase - Fast FPU = Relase - Fast FPU
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug.ActiveCfg = Debug|Win32
|
||||
{853A396E-C031-4C26-A716-5B4E176BE11D}.Debug.Build.0 = Debug|Win32
|
||||
{853A396E-C031-4C26-A716-5B4E176BE11D}.Relase - Fast FPU.ActiveCfg = Release|Win32
|
||||
{853A396E-C031-4C26-A716-5B4E176BE11D}.Relase - Fast FPU.Build.0 = Release|Win32
|
||||
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release.ActiveCfg = Release|Win32
|
||||
{853A396E-C031-4C26-A716-5B4E176BE11D}.Release.Build.0 = Release|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug.ActiveCfg = Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug.Build.0 = Debug|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU.ActiveCfg = Relase - Fast FPU|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Relase - Fast FPU.Build.0 = Relase - Fast FPU|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release.ActiveCfg = Release|Win32
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,119 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="TestProject"
|
||||
ProjectGUID="{853A396E-C031-4C26-A716-5B4E176BE11D}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="../../bin/Win32-visualstudio/TestProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/TestProject.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="../../bin/Win32-visualstudio/TestProject.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\main.cpp">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,298 +0,0 @@
|
|||
/*
|
||||
In this tutorial, I will show how to collision detection with the Irrlicht
|
||||
Engine. I will describe 3 methods: Automatic collision detection for moving
|
||||
through 3d worlds with stair climbing and sliding, manual triangle picking and
|
||||
manual scene node picking.
|
||||
|
||||
To start, we take the program from tutorial 2, which loaded and displayed a
|
||||
quake 3 level. We will use the level to walk in it and to pick triangles from
|
||||
it. In addition we'll place 3 animated models into it for scene node picking.
|
||||
The following code starts up the engine and loads a quake 3 level. I will not
|
||||
explain it, because it should already be known from tutorial 2.
|
||||
*/
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
// let user select driver type
|
||||
|
||||
video::E_DRIVER_TYPE driverType;
|
||||
|
||||
printf("Please select the driver you want for this example:\n"\
|
||||
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
|
||||
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
|
||||
" (f) NullDevice\n (otherKey) exit\n\n");
|
||||
|
||||
char i;
|
||||
std::cin >> i;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
// create device
|
||||
|
||||
IrrlichtDevice *device =
|
||||
createDevice(driverType, core::dimension2d<s32>(640, 480), 16, false);
|
||||
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();
|
||||
|
||||
|
||||
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
|
||||
|
||||
|
||||
scene::IAnimatedMesh* q3levelmesh = smgr->getMesh("20kdm2.bsp");
|
||||
scene::ISceneNode* q3node = 0;
|
||||
|
||||
if (q3levelmesh)
|
||||
q3node = smgr->addOctreeSceneNode(q3levelmesh->getMesh(0));
|
||||
|
||||
/*
|
||||
So far so good, we've loaded the quake 3 level like in tutorial 2. Now, here
|
||||
comes something different: We create a triangle selector. A triangle selector
|
||||
is a class which can fetch the triangles from scene nodes for doing different
|
||||
things with them, for example collision detection. There are different triangle
|
||||
selectors, and all can be created with the ISceneManager. In this example,
|
||||
we create an OctreeTriangleSelector, which optimizes the triangle output a l
|
||||
little bit by reducing it like an octree. This is very useful for huge meshes
|
||||
like quake 3 levels.
|
||||
Afte we created the triangle selector, we attach it to the q3node. This is not
|
||||
necessary, but in this way, we do not need to care for the selector, for example
|
||||
dropping it after we do not need it anymore.
|
||||
*/
|
||||
|
||||
scene::ITriangleSelector* selector = 0;
|
||||
|
||||
if (q3node)
|
||||
{
|
||||
q3node->setPosition(core::vector3df(-1350,-130,-1400));
|
||||
|
||||
selector = smgr->createOctreeTriangleSelector(
|
||||
q3levelmesh->getMesh(0), q3node, 128);
|
||||
q3node->setTriangleSelector(selector);
|
||||
selector->drop();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
We add a first person shooter camera to the scene for being able to
|
||||
move in the quake 3 level like in tutorial 2. But this, time, we add a
|
||||
special animator to the camera: A Collision Response animator. This
|
||||
thing modifies the scene node to which it is attached to in that way,
|
||||
that it may no more move through walls and is affected by gravity. The
|
||||
only thing we have to tell the animator is how the world looks like,
|
||||
how big the scene node is, how gravity and so on. After the collision
|
||||
response animator is attached to the camera, we do not have to do
|
||||
anything more for collision detection, anything is done automaticly,
|
||||
all other collision detection code below is for picking. And please
|
||||
note another cool feature: The collsion response animator can be
|
||||
attached also to all other scene nodes, not only to cameras. And it can
|
||||
be mixed with other scene node animators. In this way, collision
|
||||
detection and response in the Irrlicht engine is really, really easy.
|
||||
Now we'll take a closer look on the parameters of
|
||||
createCollisionResponseAnimator().
|
||||
The first parameter is the TriangleSelector, which specifies how the
|
||||
world, against collision detection is done looks like. The second
|
||||
parameter is the scene node, which is the object, which is affected by
|
||||
collision detection, in our case it is the camera. The third defines
|
||||
how big the object is, it is the radius of an ellipsoid. Try it out and
|
||||
change the radius to smaller values, the camera will be able to move
|
||||
closer to walls after this. The next parameter is the direction and
|
||||
speed of gravity. You could set it to (0,0,0) to disable gravity. And
|
||||
the last value is just a translation: Without this, the ellipsoid with
|
||||
which collision detection is done would be around the camera, and the
|
||||
camera would be in the middle of the ellipsoid. But as human beings, we
|
||||
are used to have our eyes on top of the body, with which we collide
|
||||
with our world, not in the middle of it. So we place the scene node 50
|
||||
units over the center of the ellipsoid with this parameter. And that's
|
||||
it, collision detection works now.
|
||||
*/
|
||||
|
||||
scene::ICameraSceneNode* camera =
|
||||
smgr->addCameraSceneNodeFPS(0, 100.0f, 300.0f, -1, 0, 0, true);
|
||||
camera->setPosition(core::vector3df(-100,50,-150));
|
||||
|
||||
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
|
||||
selector, camera, core::vector3df(30,50,30),
|
||||
core::vector3df(0,-3,0),
|
||||
core::vector3df(0,50,0));
|
||||
camera->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
/*
|
||||
Because collision detection is no big deal in irrlicht, I'll describe how to
|
||||
do two different types of picking in the next section. But before this,
|
||||
I'll prepare the scene a little. I need three animated characters which we
|
||||
could pick later, a dynamic light for lighting them,
|
||||
a billboard for drawing where we found an intersection, and, yes, I need to
|
||||
get rid of this mouse cursor. :)
|
||||
*/
|
||||
|
||||
// disable mouse cursor
|
||||
|
||||
device->getCursorControl()->setVisible(false);
|
||||
|
||||
// add billboard
|
||||
|
||||
scene::IBillboardSceneNode * bill = smgr->addBillboardSceneNode();
|
||||
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR );
|
||||
bill->setMaterialTexture(0, driver->getTexture("../../media/particle.bmp"));
|
||||
bill->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
bill->setMaterialFlag(video::EMF_ZBUFFER, false);
|
||||
bill->setSize(core::dimension2d<f32>(20.0f, 20.0f));
|
||||
|
||||
// add 3 animated faeries.
|
||||
|
||||
video::SMaterial material;
|
||||
material.Textures[0] = driver->getTexture("../../media/faerie2.bmp");
|
||||
material.Lighting = true;
|
||||
|
||||
scene::IAnimatedMeshSceneNode* node = 0;
|
||||
scene::IAnimatedMesh* faerie = smgr->getMesh("../../media/faerie.md2");
|
||||
|
||||
if (faerie)
|
||||
{
|
||||
node = smgr->addAnimatedMeshSceneNode(faerie);
|
||||
node->setPosition(core::vector3df(-70,0,-90));
|
||||
node->setMD2Animation(scene::EMAT_RUN);
|
||||
node->getMaterial(0) = material;
|
||||
|
||||
node = smgr->addAnimatedMeshSceneNode(faerie);
|
||||
node->setPosition(core::vector3df(-70,0,-30));
|
||||
node->setMD2Animation(scene::EMAT_SALUTE);
|
||||
node->getMaterial(0) = material;
|
||||
|
||||
node = smgr->addAnimatedMeshSceneNode(faerie);
|
||||
node->setPosition(core::vector3df(-70,0,-60));
|
||||
node->setMD2Animation(scene::EMAT_JUMP);
|
||||
node->getMaterial(0) = material;
|
||||
}
|
||||
|
||||
material.Textures[0] = 0;
|
||||
material.Lighting = false;
|
||||
|
||||
// Add a light
|
||||
|
||||
smgr->addLightSceneNode(0, core::vector3df(-60,100,400),
|
||||
video::SColorf(1.0f,1.0f,1.0f,1.0f),
|
||||
600.0f);
|
||||
|
||||
|
||||
/*
|
||||
For not making it to complicated, I'm doing picking inside the drawing loop.
|
||||
We take two pointers for storing the current and the last selected scene node and
|
||||
start the loop.
|
||||
*/
|
||||
|
||||
|
||||
scene::ISceneNode* selectedSceneNode = 0;
|
||||
scene::ISceneNode* lastSelectedSceneNode = 0;
|
||||
|
||||
|
||||
int lastFPS = -1;
|
||||
|
||||
while(device->run())
|
||||
if (device->isWindowActive())
|
||||
{
|
||||
driver->beginScene(true, true, 0);
|
||||
|
||||
smgr->drawAll();
|
||||
|
||||
/*
|
||||
After we've drawn the whole scene whit smgr->drawAll(), we'll
|
||||
do the first picking: We want to know which triangle of the
|
||||
world we are looking at. In addition, we want the exact point
|
||||
of the quake 3 level we are looking at. For this, we create a
|
||||
3d line starting at the position of the camera and going
|
||||
through the lookAt-target of it. Then we ask the collision
|
||||
manager if this line collides with a triangle of the world
|
||||
stored in the triangle selector. If yes, we draw the 3d
|
||||
triangle and set the position of the billboard to the
|
||||
intersection point.
|
||||
*/
|
||||
|
||||
core::line3d<f32> line;
|
||||
line.start = camera->getPosition();
|
||||
line.end = line.start + (camera->getTarget() - line.start).normalize() * 1000.0f;
|
||||
|
||||
core::vector3df intersection;
|
||||
core::triangle3df tri;
|
||||
|
||||
if (smgr->getSceneCollisionManager()->getCollisionPoint(
|
||||
line, selector, intersection, tri))
|
||||
{
|
||||
bill->setPosition(intersection);
|
||||
|
||||
driver->setTransform(video::ETS_WORLD, core::matrix4());
|
||||
driver->setMaterial(material);
|
||||
driver->draw3DTriangle(tri, video::SColor(0,255,0,0));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Another type of picking supported by the Irrlicht Engine is scene node picking
|
||||
based on bouding boxes. Every scene node has got a bounding box, and because of
|
||||
that, it's very fast for example to get the scene node which the camera looks
|
||||
at. Again, we ask the collision manager for this, and if we've got a scene node,
|
||||
we highlight it by disabling Lighting in its material, if it is not the
|
||||
billboard or the quake 3 level.
|
||||
*/
|
||||
|
||||
selectedSceneNode =
|
||||
smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera);
|
||||
|
||||
if (lastSelectedSceneNode)
|
||||
lastSelectedSceneNode->setMaterialFlag(video::EMF_LIGHTING, true);
|
||||
|
||||
if (selectedSceneNode == q3node || selectedSceneNode == bill)
|
||||
selectedSceneNode = 0;
|
||||
|
||||
if (selectedSceneNode)
|
||||
selectedSceneNode->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
|
||||
lastSelectedSceneNode = selectedSceneNode;
|
||||
|
||||
|
||||
/*
|
||||
That's it, we just have to finish drawing.
|
||||
*/
|
||||
|
||||
driver->endScene();
|
||||
|
||||
int fps = driver->getFPS();
|
||||
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
core::stringw str =
|
||||
L"Collision detection example - Irrlicht Engine [";
|
||||
str += driver->getName();
|
||||
str += "] FPS:";
|
||||
str += fps;
|
||||
|
||||
device->setWindowCaption(str.c_str());
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
|
||||
device->drop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -147,9 +147,10 @@ public:
|
|||
//! Returns the archive at a given index.
|
||||
virtual IFileArchive* getFileArchive(u32 index) =0;
|
||||
|
||||
//! Adds a zip archive to the file system. Deprecated! This function is provided for compatibility
|
||||
/** with older versions of Irrlicht and may be removed in future versions, you should use
|
||||
addFileArchive instead.
|
||||
//! Adds a zip archive to the file system.
|
||||
/** \deprecated This function is provided for compatibility
|
||||
with older versions of Irrlicht and may be removed in future versions,
|
||||
you should use addFileArchive instead.
|
||||
After calling this, the Irrlicht Engine will search and open files directly from this archive too.
|
||||
This is useful for hiding data from the end user, speeding up file access and making it possible to
|
||||
access for example Quake3 .pk3 files, which are no different than .zip files.
|
||||
|
@ -165,8 +166,9 @@ public:
|
|||
}
|
||||
|
||||
//! Adds an unzipped archive (or basedirectory with subdirectories..) to the file system.
|
||||
/** Deprecated! This function is provided for compatibility with older versions of Irrlicht
|
||||
and may be removed in future versions, you should use addFileArchive instead.
|
||||
/** \deprecated This function is provided for compatibility
|
||||
with older versions of Irrlicht and may be removed in future versions,
|
||||
you should use addFileArchive instead.
|
||||
Useful for handling data which will be in a zip file
|
||||
\param filename: Filename of the unzipped zip archive base directory to add to the file system.
|
||||
\param ignoreCase: If set to true, files in the archive can be accessed without
|
||||
|
@ -180,8 +182,9 @@ public:
|
|||
}
|
||||
|
||||
//! Adds a pak archive to the file system.
|
||||
/** Deprecated! This function is provided for compatibility with older versions of Irrlicht
|
||||
and may be removed in future versions, you should use addFileArchive instead.
|
||||
/** \deprecated This function is provided for compatibility
|
||||
with older versions of Irrlicht and may be removed in future versions,
|
||||
you should use addFileArchive instead.
|
||||
After calling this, the Irrlicht Engine will search and open files directly from this archive too.
|
||||
This is useful for hiding data from the end user, speeding up file access and making it possible to
|
||||
access for example Quake2/KingPin/Hexen2 .pak files
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace gui
|
|||
\param hasSubMenu: Set this to true if there should be a submenu
|
||||
at this item. You can access this submenu via getSubMenu().
|
||||
\param checked: Specifies if the menu item should be initially checked.
|
||||
\param autoChecking: Specifies if the item should be checked by clicking
|
||||
\return Returns the index of the new item */
|
||||
virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
|
||||
bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
|
||||
|
@ -71,6 +72,7 @@ namespace gui
|
|||
\param hasSubMenu: Set this to true if there should be a submenu
|
||||
at this item. You can access this submenu via getSubMenu().
|
||||
\param checked: Specifies if the menu item should be initially checked.
|
||||
\param autoChecking: Specifies if the item should be checked by clicking
|
||||
\return Returns the index of the new item */
|
||||
virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId=-1, bool enabled=true,
|
||||
bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
const core::dimension2d<f32>& tileSize,
|
||||
const core::dimension2d<u32>& tileCount,
|
||||
video::SMaterial* material,
|
||||
const core::dimension2d<f32>& textureRepeatCount)
|
||||
const core::dimension2d<f32>& textureRepeatCount) const
|
||||
{
|
||||
return createHillPlaneMesh(tileSize, tileCount, material, 0.f, core::dimension2df(), textureRepeatCount);
|
||||
}
|
||||
|
|
|
@ -259,9 +259,9 @@ namespace scene
|
|||
if (boundingBoxUpdate)
|
||||
{
|
||||
if (0==i)
|
||||
bufferbox.reset(mesh->getBoundingBox());
|
||||
bufferbox.reset(mesh->getMeshBuffer(i)->getBoundingBox());
|
||||
else
|
||||
bufferbox.addInternalBox(mesh->getBoundingBox());
|
||||
bufferbox.addInternalBox(mesh->getMeshBuffer(i)->getBoundingBox());
|
||||
}
|
||||
}
|
||||
if (boundingBoxUpdate)
|
||||
|
|
|
@ -509,6 +509,14 @@ namespace scene
|
|||
virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
|
||||
s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0;
|
||||
|
||||
//! Adds a scene node for rendering using a octree to the scene graph.
|
||||
/** \deprecated Use addOctreeSceneNode instead. */
|
||||
_IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
|
||||
s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false)
|
||||
{
|
||||
return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero);
|
||||
}
|
||||
|
||||
//! Adds a scene node for rendering using a octree to the scene graph.
|
||||
/** This a good method for rendering scenes with lots of
|
||||
geometry. The Octree is built on the fly from the mesh, much
|
||||
|
@ -525,6 +533,14 @@ namespace scene
|
|||
virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
|
||||
s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
|
||||
|
||||
//! Adds a scene node for rendering using a octree to the scene graph.
|
||||
/** \deprecated Use addOctreeSceneNode instead. */
|
||||
_IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
|
||||
s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false)
|
||||
{
|
||||
return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero);
|
||||
}
|
||||
|
||||
//! Adds a camera scene node to the scene graph and sets it as active camera.
|
||||
/** This camera does not react on user input like for example the one created with
|
||||
addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the
|
||||
|
@ -841,7 +857,7 @@ namespace scene
|
|||
/** A Quake3 Scene renders multiple meshes for a specific HighLanguage Shader (Quake3 Style )
|
||||
\return Pointer to the quake3 scene node if successful, otherwise NULL.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
||||
virtual IMeshSceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::IShader * shader,
|
||||
virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
|
||||
ISceneNode* parent=0, s32 id=-1
|
||||
) = 0;
|
||||
|
||||
|
@ -981,6 +997,10 @@ namespace scene
|
|||
|
||||
//! Add a volume light mesh to the meshpool
|
||||
/** \param name Name of the mesh
|
||||
\param SubdivideU Horizontal subdivision count
|
||||
\param SubdivideV Vertical subdivision count
|
||||
\param FootColor Color of the bottom of the light
|
||||
\param TailColor Color of the top of the light
|
||||
\return Pointer to the volume light mesh if successful, otherwise 0.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information.
|
||||
*/
|
||||
|
@ -1257,6 +1277,14 @@ namespace scene
|
|||
virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh,
|
||||
ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
|
||||
|
||||
//! //! Creates a Triangle Selector, optimized by an octree.
|
||||
/** \deprecated Use createOctreeTriangleSelector instead. */
|
||||
_IRR_DEPRECATED_ ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
|
||||
ISceneNode* node, s32 minimalPolysPerNode=32)
|
||||
{
|
||||
return createOctreeTriangleSelector(mesh, node, minimalPolysPerNode);
|
||||
}
|
||||
|
||||
//! Creates a meta triangle selector.
|
||||
/** A meta triangle selector is nothing more than a
|
||||
collection of one or more triangle selectors providing together
|
||||
|
|
|
@ -97,6 +97,8 @@ public:
|
|||
number of previous locks.
|
||||
\param readOnly Specifies that no changes to the locked texture are
|
||||
made. Unspecified behavior will arise if still write access happens.
|
||||
\param mipmapLevel Number of the mipmapLevel to lock. 0 is main texture.
|
||||
Non-existing levels will silently fail and return 0.
|
||||
\return Returns a pointer to the pixel data. The format of the pixel can
|
||||
be determined by using getColorFormat(). 0 is returned, if
|
||||
the texture cannot be locked. */
|
||||
|
|
|
@ -249,9 +249,9 @@ namespace video
|
|||
be cleared. It is not nesesarry to do so if only 2d drawing is
|
||||
used.
|
||||
\param color The color used for back buffer clearing
|
||||
\param windowId Handle of another window, if you want the
|
||||
bitmap to be displayed on another window. If this is null,
|
||||
everything will be displayed in the default window.
|
||||
\param videoData Handle of another window, if you want the
|
||||
bitmap to be displayed on another window. If this is an empty
|
||||
element, everything will be displayed in the default window.
|
||||
Note: This feature is not fully implemented for all devices.
|
||||
\param sourceRect Pointer to a rectangle defining the source
|
||||
rectangle of the area to be presented. Set to null to present
|
||||
|
@ -382,9 +382,10 @@ namespace video
|
|||
/** \param name A name for the texture. Later calls of
|
||||
getTexture() with this name will return this texture
|
||||
\param image Image the texture is created from.
|
||||
\mipmapData Optional pointer to a set of images which build up the
|
||||
whole mipmap set. Must be images of the same color type as image. If
|
||||
this parameter is not given, the mipmaps are derived from image.
|
||||
\param mipmapData Optional pointer to a set of images which
|
||||
build up the whole mipmap set. Must be images of the same color
|
||||
type as image. If this parameter is not given, the mipmaps are
|
||||
derived from image.
|
||||
\return Pointer to the newly created texture. This pointer
|
||||
should not be dropped. See IReferenceCounted::drop() for more
|
||||
information. */
|
||||
|
@ -789,8 +790,8 @@ namespace video
|
|||
The subtextures are defined by the array of sourceRects and are
|
||||
positioned using the array of positions.
|
||||
\param texture Texture to be drawn.
|
||||
\param pos Array of upper left 2d destinations where the images
|
||||
will be drawn.
|
||||
\param positions Array of upper left 2d destinations where the
|
||||
images will be drawn.
|
||||
\param sourceRects Source rectangles of the image.
|
||||
\param clipRect Pointer to rectangle on the screen where the
|
||||
images are clipped to.
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#define IRRLICHT_VERSION_REVISION 0
|
||||
// This flag will be defined only in SVN, the official release code will have
|
||||
// it undefined
|
||||
#define IRRLICHT_VERSION_SVN -alpha
|
||||
#define IRRLICHT_SDK_VERSION "1.7.0-alpha"
|
||||
#define IRRLICHT_VERSION_SVN -beta
|
||||
#define IRRLICHT_SDK_VERSION "1.7.0-beta"
|
||||
|
||||
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
|
||||
|
||||
|
|
|
@ -90,21 +90,23 @@ inline io::path& deletePathFromPath(io::path& filename, s32 pathCount)
|
|||
s32 i = filename.size();
|
||||
|
||||
// search for path separator or beginning
|
||||
while ( i )
|
||||
while ( i>=0 )
|
||||
{
|
||||
if ( filename[i] == '/' || filename[i] == '\\' )
|
||||
{
|
||||
if ( --pathCount <= 0 )
|
||||
break;
|
||||
}
|
||||
i -= 1;
|
||||
--i;
|
||||
}
|
||||
|
||||
if ( i )
|
||||
if ( i>0 )
|
||||
{
|
||||
filename [ i + 1 ] = 0;
|
||||
filename.validate();
|
||||
}
|
||||
else
|
||||
filename="";
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
SKListNode* Current;
|
||||
|
||||
friend class list<T>;
|
||||
friend class ConstIterator;
|
||||
};
|
||||
|
||||
//! List iterator for const access.
|
||||
|
|
|
@ -64,11 +64,33 @@ public:
|
|||
vector2d<T> operator/(const T v) const { return vector2d<T>(X / v, Y / v); }
|
||||
vector2d<T>& operator/=(const T v) { X/=v; Y/=v; return *this; }
|
||||
|
||||
bool operator<=(const vector2d<T>&other) const { return X<=other.X && Y<=other.Y; }
|
||||
bool operator>=(const vector2d<T>&other) const { return X>=other.X && Y>=other.Y; }
|
||||
//! sort in order X, Y. Equality with rounding tolerance.
|
||||
bool operator<=(const vector2d<T>&other) const
|
||||
{
|
||||
return (X<other.X || core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y)));
|
||||
}
|
||||
|
||||
bool operator<(const vector2d<T>&other) const { return X<other.X && Y<other.Y; }
|
||||
bool operator>(const vector2d<T>&other) const { return X>other.X && Y>other.Y; }
|
||||
//! sort in order X, Y. Equality with rounding tolerance.
|
||||
bool operator>=(const vector2d<T>&other) const
|
||||
{
|
||||
return (X>other.X || core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y)));
|
||||
}
|
||||
|
||||
//! sort in order X, Y. Difference must be above rounding tolerance.
|
||||
bool operator<(const vector2d<T>&other) const
|
||||
{
|
||||
return (X<other.X && !core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y));
|
||||
}
|
||||
|
||||
//! sort in order X, Y. Difference must be above rounding tolerance.
|
||||
bool operator>(const vector2d<T>&other) const
|
||||
{
|
||||
return (X>other.X && !core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y));
|
||||
}
|
||||
|
||||
bool operator==(const vector2d<T>& other) const { return equals(other); }
|
||||
bool operator!=(const vector2d<T>& other) const { return !equals(other); }
|
||||
|
|
|
@ -57,10 +57,37 @@ namespace core
|
|||
vector3d<T> operator/(const T v) const { T i=(T)1.0/v; return vector3d<T>(X * i, Y * i, Z * i); }
|
||||
vector3d<T>& operator/=(const T v) { T i=(T)1.0/v; X*=i; Y*=i; Z*=i; return *this; }
|
||||
|
||||
bool operator<=(const vector3d<T>&other) const { return X<=other.X && Y<=other.Y && Z<=other.Z;}
|
||||
bool operator>=(const vector3d<T>&other) const { return X>=other.X && Y>=other.Y && Z>=other.Z;}
|
||||
bool operator<(const vector3d<T>&other) const { return X<other.X && Y<other.Y && Z<other.Z;}
|
||||
bool operator>(const vector3d<T>&other) const { return X>other.X && Y>other.Y && Z>other.Z;}
|
||||
//! sort in order X, Y, Z. Equality with rounding tolerance.
|
||||
bool operator<=(const vector3d<T>&other) const
|
||||
{
|
||||
return (X<other.X || core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y))) ||
|
||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && (Z<other.Z || core::equals(Z, other.Z)));
|
||||
}
|
||||
|
||||
//! sort in order X, Y, Z. Equality with rounding tolerance.
|
||||
bool operator>=(const vector3d<T>&other) const
|
||||
{
|
||||
return (X>other.X || core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y))) ||
|
||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && (Z>other.Z || core::equals(Z, other.Z)));
|
||||
}
|
||||
|
||||
//! sort in order X, Y, Z. Difference must be above rounding tolerance.
|
||||
bool operator<(const vector3d<T>&other) const
|
||||
{
|
||||
return (X<other.X && !core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y)) ||
|
||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && Z<other.Z && !core::equals(Z, other.Z));
|
||||
}
|
||||
|
||||
//! sort in order X, Y, Z. Difference must be above rounding tolerance.
|
||||
bool operator>(const vector3d<T>&other) const
|
||||
{
|
||||
return (X>other.X && !core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y)) ||
|
||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && Z>other.Z && !core::equals(Z, other.Z));
|
||||
}
|
||||
|
||||
//! use weak float compare
|
||||
bool operator==(const vector3d<T>& other) const
|
||||
|
|
Binary file not shown.
|
@ -647,7 +647,7 @@ HTML_ALIGN_MEMBERS = YES
|
|||
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
|
||||
# of the generated HTML documentation.
|
||||
|
||||
GENERATE_HTMLHELP = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
|
||||
# be used to specify the file name of the resulting .chm file. You
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<tr>
|
||||
<td width="0"> <div align="left"><small><a href="http://irrlicht.sourceforge.net" target="_blank"><img src="irrlicht.png" alt="The Irrlicht Engine" align="middle" border=0 width=88 height=31></a></small></div></td>
|
||||
<td> <div align="left"><small><em><font size="2">The <a href="http://irrlicht.sourceforge.net" target="_blank">Irrlicht
|
||||
Engine</a> Documentation © 2003-2009 by Nikolaus Gebhardt. Generated
|
||||
Engine</a> Documentation © 2003-2010 by Nikolaus Gebhardt. Generated
|
||||
on $datetime by <a href="http://www.doxygen.org" target="_blank">Doxygen</a>
|
||||
($doxygenversion)</font></em></small></div></td>
|
||||
</tr>
|
||||
|
|
|
@ -26,6 +26,8 @@ rem for /F %%i in ('dir ..\..\..\examples\[01]*\main.cpp') DO ..\sed.exe -f tuto
|
|||
..\sed.exe -f tutorials.sed ..\..\..\examples\19.MouseAndJoystick\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\20.ManagedLights\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\21.Quake3Explorer\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\22.MaterialViewer\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\23.SMeshHandling\main.cpp >>tut.txt
|
||||
|
||||
..\doxygen.exe doxygen.cfg
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
1,+18 d
|
||||
s/src="/src="images\/tutorials\//
|
||||
s/href="/href="docu\//g
|
||||
s/\(.*\) <hr.*$/\1/
|
||||
/<addr/,$ d
|
|
@ -0,0 +1,4 @@
|
|||
type tut_head.html >%2
|
||||
..\sed.exe -f maketut.sed %1 >>%2
|
||||
type tut_end.html >>%2
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
cat tut_head.html >$2
|
||||
sed -f maketut.sed $1 >>$2
|
||||
cat tut_end.html >>$2
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div align="right"><br />
|
||||
<a href="http://validator.w3.org/check?uri=referer" target="_blank"><img src="images/general/valid-xhtml10.png" alt="Valid XHTML 1.0!" width="88" height="31" border="0" /></a>
|
||||
<a href="http://jigsaw.w3.org/css-validator/" target="_blank"><img src="images/general/vcss.gif" alt="Valid CSS!" width="88" height="31" border="0" /></a></div>
|
||||
</div>
|
||||
<p class="copyrighttext"><br />
|
||||
Irrlicht Engine and Irrlicht Engine webpage © 2003-2010 by Nikolaus Gebhardt</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Irrlicht Engine - A free open source 3d engine</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" href="doxygen.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<!-- (c) 2005-2008 by N.Gebhardt -->
|
||||
</head>
|
||||
<body>
|
||||
<div align="center"><br/>
|
||||
<table cellspacing="0" class="main" >
|
||||
<tr>
|
||||
<td colspan="2" class="logobar" ><img alt="Irrlicht Engine logo" src="images/general/irrlichtlogo.gif" width="233" height="60" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="linkbar" ><a href="index.html">Home</a> | <a href="phpBB2/index.php">Forum</a>
|
||||
| <a href="docu/index.html" target="_blank">API</a> | <a href="http://www.google.com/custom?domains=irrlicht.sourceforge.net&sitesearch=irrlicht.sourceforge.net" target="_blank">Search</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="sidebar"> <div class="sidebarentry">
|
||||
<p class="sideBarTitle">Engine</p>
|
||||
<a href="index.html">News</a> <a href="features.html">Features</a> <a href="screenshots.html">Screenshots</a>
|
||||
<a href="downloads.html">Downloads</a>
|
||||
<a href="development.html">Development</a>
|
||||
<a href="toolset.html">Toolset</a>
|
||||
</div>
|
||||
<div class="sidebarentry">
|
||||
<p class="sideBarTitle">Documentation</p>
|
||||
<a href="faq.html">FAQ</a> <a href="docu/index.html" target="_blank">API</a>
|
||||
<a href="docu.net/index.html" target="_blank">API.NET</a> <a href="tutorials.html">Tutorials</a>
|
||||
<a href="license.html">License</a> <a href="newsarchive.html">News-Archive</a>
|
||||
<a href="http://www.irrlicht3d.org/wiki" target="_blank">Wiki</a> </div>
|
||||
<div class="sidebarentry">
|
||||
<p class="sideBarTitle">Sourceforge</p>
|
||||
<a href="http://sourceforge.net/projects/irrlicht/">Project Page</a>
|
||||
<a href="phpBB2/index.php">Forums</a>
|
||||
<a href="shirts.html">Shirts</a> </div>
|
||||
<div class="sidebarentry">
|
||||
<p class="sideBarTitle">Contact</p>
|
||||
<a href="links.html">Links</a> <a href="author.html">Author</a> <a href="impressum.html">Impressum</a> </div>
|
||||
<p><a href="http://irrlicht.sourceforge.net"><br />
|
||||
<img alt="Irrlicht Engine logo button" src="images/general/irrlicht.png" width="88" height="31" border="0" /></a></p>
|
||||
<p><a href="http://sourceforge.net"> <img src="http://sourceforge.net/sflogo.php?group_id=74339&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a></p>
|
||||
<p> <a href="http://opensource.org/" target="_blank"><img alt="OSI Certified logo" src="images/general/osi-certified-72x60-t.png" width="72" height="60" border="0" /></a>
|
||||
</p>
|
||||
<p> </p></td>
|
||||
<td class="mainframe" > <table class="newsbox" >
|
||||
<tr>
|
||||
<td class="newscontent">
|
|
@ -27,7 +27,7 @@ namespace scene
|
|||
//! Constructor
|
||||
CB3DMeshFileLoader::CB3DMeshFileLoader(scene::ISceneManager* smgr)
|
||||
: SceneManager(smgr), AnimatedMesh(0), B3DFile(0), NormalsInFile(false),
|
||||
ShowWarning(true)
|
||||
HasVertexColors(false), ShowWarning(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CB3DMeshFileLoader");
|
||||
|
@ -56,9 +56,6 @@ IAnimatedMesh* CB3DMeshFileLoader::createMesh(io::IReadFile* f)
|
|||
AnimatedMesh = new scene::CSkinnedMesh();
|
||||
ShowWarning = true; // If true a warning is issued if too many textures are used
|
||||
|
||||
Buffers = &AnimatedMesh->getMeshBuffers();
|
||||
AllJoints = &AnimatedMesh->getAllJoints();
|
||||
|
||||
if ( load() )
|
||||
{
|
||||
AnimatedMesh->finalize();
|
||||
|
@ -78,6 +75,7 @@ bool CB3DMeshFileLoader::load()
|
|||
B3dStack.clear();
|
||||
|
||||
NormalsInFile=false;
|
||||
HasVertexColors=false;
|
||||
|
||||
//------ Get header ------
|
||||
|
||||
|
@ -145,9 +143,6 @@ bool CB3DMeshFileLoader::load()
|
|||
Materials.clear();
|
||||
Textures.clear();
|
||||
|
||||
Buffers=0;
|
||||
AllJoints=0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -250,6 +245,7 @@ bool CB3DMeshFileLoader::readChunkMESH(CSkinnedMesh::SJoint *inJoint)
|
|||
#endif
|
||||
|
||||
NormalsInFile=false;
|
||||
HasVertexColors=false;
|
||||
|
||||
while((B3dStack.getLast().startposition + B3dStack.getLast().length) > B3DFile->getPos()) //this chunk repeats
|
||||
{
|
||||
|
@ -354,16 +350,22 @@ bool CB3DMeshFileLoader::readChunkVRTS(CSkinnedMesh::SJoint *inJoint)
|
|||
|
||||
//------ Allocate Memory, for speed -----------//
|
||||
|
||||
s32 NumberOfReads = 3;
|
||||
s32 numberOfReads = 3;
|
||||
|
||||
if (flags & 1)
|
||||
NumberOfReads += 3;
|
||||
{
|
||||
NormalsInFile = true;
|
||||
numberOfReads += 3;
|
||||
}
|
||||
if (flags & 2)
|
||||
NumberOfReads += 4;
|
||||
{
|
||||
numberOfReads += 4;
|
||||
HasVertexColors=true;
|
||||
}
|
||||
|
||||
NumberOfReads += tex_coord_sets*tex_coord_set_size;
|
||||
numberOfReads += tex_coord_sets*tex_coord_set_size;
|
||||
|
||||
const s32 memoryNeeded = (B3dStack.getLast().length / sizeof(f32)) / NumberOfReads;
|
||||
const s32 memoryNeeded = (B3dStack.getLast().length / sizeof(f32)) / numberOfReads;
|
||||
|
||||
BaseVertices.reallocate(memoryNeeded + BaseVertices.size() + 1);
|
||||
AnimatedVertices_VertexID.reallocate(memoryNeeded + AnimatedVertices_VertexID.size() + 1);
|
||||
|
@ -380,11 +382,7 @@ bool CB3DMeshFileLoader::readChunkVRTS(CSkinnedMesh::SJoint *inJoint)
|
|||
readFloats(position, 3);
|
||||
|
||||
if (flags & 1)
|
||||
{
|
||||
NormalsInFile = true;
|
||||
readFloats(normal, 3);
|
||||
}
|
||||
|
||||
if (flags & 2)
|
||||
readFloats(color, 4);
|
||||
|
||||
|
@ -510,7 +508,9 @@ bool CB3DMeshFileLoader::readChunkTRIS(scene::SSkinMeshBuffer *meshBuffer, u32 m
|
|||
// Apply Material/Color/etc...
|
||||
video::S3DVertex *Vertex=meshBuffer->getVertex(meshBuffer->getVertexCount()-1);
|
||||
|
||||
if (Vertex->Color.getAlpha() == 255)
|
||||
if (!HasVertexColors)
|
||||
Vertex->Color=B3dMaterial->Material.DiffuseColor;
|
||||
else if (Vertex->Color.getAlpha() == 255)
|
||||
Vertex->Color.setAlpha( (s32)(B3dMaterial->alpha * 255.0f) );
|
||||
|
||||
// Use texture's scale
|
||||
|
@ -810,7 +810,7 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||
core::stringc name;
|
||||
readString(name);
|
||||
#ifdef _B3D_READER_DEBUG
|
||||
os::Printer::log("read Material");
|
||||
os::Printer::log("read Material", name);
|
||||
#endif
|
||||
Materials.push_back(SB3dMaterial());
|
||||
SB3dMaterial& B3dMaterial=Materials.getLast();
|
||||
|
|
|
@ -119,14 +119,12 @@ private:
|
|||
|
||||
core::array<video::S3DVertex2TCoords> BaseVertices;
|
||||
|
||||
core::array<scene::SSkinMeshBuffer*> *Buffers;
|
||||
core::array<CSkinnedMesh::SJoint*> *AllJoints;
|
||||
|
||||
ISceneManager* SceneManager;
|
||||
CSkinnedMesh* AnimatedMesh;
|
||||
io::IReadFile* B3DFile;
|
||||
|
||||
bool NormalsInFile;
|
||||
bool HasVertexColors;
|
||||
bool ShowWarning;
|
||||
};
|
||||
|
||||
|
|
|
@ -61,9 +61,71 @@ void CCubeSceneNode::setSize()
|
|||
void CCubeSceneNode::render()
|
||||
{
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
driver->setMaterial(Mesh->getMeshBuffer(0)->getMaterial());
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
|
||||
// for debug purposes only:
|
||||
bool renderMeshes = true;
|
||||
video::SMaterial mat = Mesh->getMeshBuffer(0)->getMaterial();
|
||||
|
||||
// overwrite half transparency
|
||||
if (DebugDataVisible & scene::EDS_HALF_TRANSPARENCY)
|
||||
mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
|
||||
else
|
||||
driver->setMaterial(Mesh->getMeshBuffer(0)->getMaterial());
|
||||
driver->setMaterial(mat);
|
||||
driver->drawMeshBuffer(Mesh->getMeshBuffer(0));
|
||||
|
||||
// for debug purposes only:
|
||||
if (DebugDataVisible)
|
||||
{
|
||||
video::SMaterial m;
|
||||
m.Lighting = false;
|
||||
m.AntiAliasing=0;
|
||||
driver->setMaterial(m);
|
||||
|
||||
if (DebugDataVisible & scene::EDS_BBOX)
|
||||
{
|
||||
driver->draw3DBox(Mesh->getMeshBuffer(0)->getBoundingBox(), video::SColor(255,255,255,255));
|
||||
}
|
||||
if (DebugDataVisible & scene::EDS_BBOX_BUFFERS)
|
||||
{
|
||||
driver->draw3DBox(Mesh->getMeshBuffer(0)->getBoundingBox(),
|
||||
video::SColor(255,190,128,128));
|
||||
}
|
||||
if (DebugDataVisible & scene::EDS_NORMALS)
|
||||
{
|
||||
// draw normals
|
||||
core::vector3df normalizedNormal;
|
||||
const f32 DebugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH);
|
||||
const video::SColor DebugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR);
|
||||
|
||||
const scene::IMeshBuffer* mb = Mesh->getMeshBuffer(0);
|
||||
const u32 vSize = video::getVertexPitchFromType(mb->getVertexType());
|
||||
const video::S3DVertex* v = ( const video::S3DVertex*)mb->getVertices();
|
||||
const bool normalize = mb->getMaterial().NormalizeNormals;
|
||||
|
||||
for (u32 i=0; i != mb->getVertexCount(); ++i)
|
||||
{
|
||||
normalizedNormal = v->Normal;
|
||||
if (normalize)
|
||||
normalizedNormal.normalize();
|
||||
|
||||
driver->draw3DLine(v->Pos, v->Pos + (normalizedNormal * DebugNormalLength), DebugNormalColor);
|
||||
|
||||
v = (const video::S3DVertex*) ( (u8*) v+vSize );
|
||||
}
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
}
|
||||
|
||||
// show mesh
|
||||
if (DebugDataVisible & scene::EDS_MESH_WIRE_OVERLAY)
|
||||
{
|
||||
m.Wireframe = true;
|
||||
driver->setMaterial(m);
|
||||
|
||||
driver->drawMeshBuffer( Mesh->getMeshBuffer(0) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ CDefaultSceneNodeFactory::CDefaultSceneNodeFactory(ISceneManager* mgr)
|
|||
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SKY_DOME, "skyDome"));
|
||||
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SHADOW_VOLUME, "shadowVolume"));
|
||||
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_OCTREE, "octree"));
|
||||
// Legacy support
|
||||
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_OCTREE, "octTree"));
|
||||
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_MESH, "mesh"));
|
||||
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_LIGHT, "light"));
|
||||
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_EMPTY, "empty"));
|
||||
|
|
|
@ -476,7 +476,10 @@ io::path CFileSystem::getAbsolutePath(const io::path& filename) const
|
|||
else
|
||||
return io::path(fpath);
|
||||
}
|
||||
return io::path(p);
|
||||
if (filename[filename.size()-1]=='/')
|
||||
return io::path(p)+"/";
|
||||
else
|
||||
return io::path(p);
|
||||
#else
|
||||
return io::path(filename);
|
||||
#endif
|
||||
|
@ -552,10 +555,15 @@ io::path& CFileSystem::flattenFilename(io::path& directory, const io::path& root
|
|||
if (subdir == "../")
|
||||
{
|
||||
if (lastWasRealDir)
|
||||
{
|
||||
deletePathFromPath(dir, 2);
|
||||
lastWasRealDir=(dir.size()!=0);
|
||||
}
|
||||
else
|
||||
{
|
||||
dir.append(subdir);
|
||||
lastWasRealDir=false;
|
||||
lastWasRealDir=false;
|
||||
}
|
||||
}
|
||||
else if (subdir == "/")
|
||||
{
|
||||
|
|
|
@ -389,13 +389,18 @@ bool CGUIEnvironment::OnEvent(const SEvent& event)
|
|||
void CGUIEnvironment::OnPostRender( u32 time )
|
||||
{
|
||||
// check tooltip
|
||||
IGUIElement * hoveredNonSub = Hovered;
|
||||
while ( hoveredNonSub && hoveredNonSub->isSubElement() )
|
||||
{
|
||||
hoveredNonSub = hoveredNonSub->getParent();
|
||||
}
|
||||
|
||||
// launch tooltip
|
||||
if ( time - ToolTip.LastTime >= ToolTip.LaunchTime &&
|
||||
Hovered && Hovered != this &&
|
||||
hoveredNonSub && hoveredNonSub != this &&
|
||||
ToolTip.Element == 0 &&
|
||||
Hovered != ToolTip.Element &&
|
||||
Hovered->getToolTipText().size() &&
|
||||
hoveredNonSub != ToolTip.Element &&
|
||||
hoveredNonSub->getToolTipText().size() &&
|
||||
getSkin() &&
|
||||
getSkin()->getFont(EGDF_TOOLTIP)
|
||||
)
|
||||
|
@ -403,7 +408,7 @@ void CGUIEnvironment::OnPostRender( u32 time )
|
|||
core::rect<s32> pos;
|
||||
|
||||
pos.UpperLeftCorner = LastHoveredMousePos;
|
||||
core::dimension2du dim = getSkin()->getFont(EGDF_TOOLTIP)->getDimension(Hovered->getToolTipText().c_str());
|
||||
core::dimension2du dim = getSkin()->getFont(EGDF_TOOLTIP)->getDimension(hoveredNonSub->getToolTipText().c_str());
|
||||
dim.Width += getSkin()->getSize(EGDS_TEXT_DISTANCE_X)*2;
|
||||
dim.Height += getSkin()->getSize(EGDS_TEXT_DISTANCE_Y)*2;
|
||||
|
||||
|
@ -413,7 +418,7 @@ void CGUIEnvironment::OnPostRender( u32 time )
|
|||
|
||||
pos.constrainTo(getAbsolutePosition());
|
||||
|
||||
ToolTip.Element = addStaticText(Hovered->getToolTipText().c_str(), pos, true, true, this, -1, true);
|
||||
ToolTip.Element = addStaticText(hoveredNonSub->getToolTipText().c_str(), pos, true, true, this, -1, true);
|
||||
ToolTip.Element->setOverrideColor(getSkin()->getColor(EGDC_TOOLTIP));
|
||||
ToolTip.Element->setBackgroundColor(getSkin()->getColor(EGDC_TOOLTIP_BACKGROUND));
|
||||
ToolTip.Element->setOverrideFont(getSkin()->getFont(EGDF_TOOLTIP));
|
||||
|
|
|
@ -212,9 +212,7 @@ bool COgreMeshFileLoader::readObjectChunk(io::IReadFile* file, ChunkData& parent
|
|||
switch(data.header.id)
|
||||
{
|
||||
case COGRE_GEOMETRY:
|
||||
{
|
||||
readGeometry(file, data, mesh.Geometry);
|
||||
}
|
||||
break;
|
||||
case COGRE_SUBMESH:
|
||||
mesh.SubMeshes.push_back(OgreSubMesh());
|
||||
|
@ -252,7 +250,14 @@ bool COgreMeshFileLoader::readObjectChunk(io::IReadFile* file, ChunkData& parent
|
|||
case COGRE_MESH_LOD:
|
||||
case COGRE_MESH_SUBMESH_NAME_TABLE:
|
||||
case COGRE_MESH_EDGE_LISTS:
|
||||
// ignore chunk
|
||||
file->seek(data.header.length-data.read, true);
|
||||
data.read += data.header.length-data.read;
|
||||
break;
|
||||
default:
|
||||
#ifdef IRR_OGRE_LOADER_DEBUG
|
||||
os::Printer::log("Skipping", core::stringc(data.header.id));
|
||||
#endif
|
||||
// ignore chunk
|
||||
file->seek(data.header.length-data.read, true);
|
||||
data.read += data.header.length-data.read;
|
||||
|
@ -287,6 +292,9 @@ bool COgreMeshFileLoader::readGeometry(io::IReadFile* file, ChunkData& parent, O
|
|||
break;
|
||||
default:
|
||||
// ignore chunk
|
||||
#ifdef IRR_OGRE_LOADER_DEBUG
|
||||
os::Printer::log("Skipping", core::stringc(data.header.id));
|
||||
#endif
|
||||
file->seek(data.header.length-data.read, true);
|
||||
data.read += data.header.length-data.read;
|
||||
}
|
||||
|
@ -380,23 +388,13 @@ bool COgreMeshFileLoader::readSubMesh(io::IReadFile* file, ChunkData& parent, Og
|
|||
if (subMesh.Indices32Bit)
|
||||
readInt(file, parent, subMesh.Indices.pointer(), numIndices);
|
||||
else
|
||||
{
|
||||
for (s32 i=0; i<numIndices; ++i)
|
||||
{
|
||||
u16 num;
|
||||
readShort(file, parent, &num);
|
||||
subMesh.Indices[i]=num;
|
||||
}
|
||||
|
||||
if (!subMesh.SharedVertices)
|
||||
{
|
||||
ChunkData data;
|
||||
readChunkData(file, data);
|
||||
|
||||
if (data.header.id==COGRE_GEOMETRY)
|
||||
{
|
||||
readGeometry(file, data, subMesh.Geometry);
|
||||
}
|
||||
parent.read += data.read;
|
||||
}
|
||||
|
||||
while(parent.read < parent.header.length)
|
||||
|
@ -406,6 +404,9 @@ bool COgreMeshFileLoader::readSubMesh(io::IReadFile* file, ChunkData& parent, Og
|
|||
|
||||
switch(data.header.id)
|
||||
{
|
||||
case COGRE_GEOMETRY:
|
||||
readGeometry(file, data, subMesh.Geometry);
|
||||
break;
|
||||
case COGRE_SUBMESH_OPERATION:
|
||||
readShort(file, data, &subMesh.Operation);
|
||||
#ifdef IRR_OGRE_LOADER_DEBUG
|
||||
|
@ -434,6 +435,9 @@ bool COgreMeshFileLoader::readSubMesh(io::IReadFile* file, ChunkData& parent, Og
|
|||
}
|
||||
break;
|
||||
default:
|
||||
#ifdef IRR_OGRE_LOADER_DEBUG
|
||||
os::Printer::log("Skipping", core::stringc(data.header.id));
|
||||
#endif
|
||||
parent.read=parent.header.length;
|
||||
file->seek(-(long)sizeof(ChunkHeader), true);
|
||||
return true;
|
||||
|
@ -1474,7 +1478,7 @@ void COgreMeshFileLoader::readBool(io::IReadFile* file, ChunkData& data, bool& o
|
|||
void COgreMeshFileLoader::readInt(io::IReadFile* file, ChunkData& data, s32* out, u32 num)
|
||||
{
|
||||
// normal C type because we read a bit string
|
||||
file->read(out, sizeof(int));
|
||||
file->read(out, sizeof(int)*num);
|
||||
if (SwapEndian)
|
||||
{
|
||||
for (u32 i=0; i<num; ++i)
|
||||
|
|
|
@ -2871,9 +2871,18 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
if (FeatureAvailable[IRR_ARB_texture_env_combine])
|
||||
#if defined(GL_ARB_texture_env_combine) || defined(GL_EXT_texture_env_combine)
|
||||
if (FeatureAvailable[IRR_ARB_texture_env_combine]||FeatureAvailable[IRR_EXT_texture_env_combine])
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
|
||||
// rgb always modulates
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE);
|
||||
|
@ -2881,6 +2890,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -2891,9 +2901,18 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||
{
|
||||
if (alpha)
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
if (FeatureAvailable[IRR_ARB_texture_env_combine])
|
||||
#if defined(GL_ARB_texture_env_combine) || defined(GL_EXT_texture_env_combine)
|
||||
if (FeatureAvailable[IRR_ARB_texture_env_combine]||FeatureAvailable[IRR_EXT_texture_env_combine])
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
|
||||
// rgb always modulates
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PRIMARY_COLOR_EXT);
|
||||
|
@ -2901,6 +2920,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -10,49 +10,6 @@
|
|||
|
||||
#include "COpenGLDriver.h"
|
||||
#include "IMaterialRenderer.h"
|
||||
#if defined(_IRR_OSX_PLATFORM_)
|
||||
#define GL_COMBINE_EXT 0x8570
|
||||
#define GL_COMBINE_RGB_EXT 0x8571
|
||||
#define GL_COMBINE_ALPHA_EXT 0x8572
|
||||
#define GL_RGB_SCALE_EXT 0x8573
|
||||
#define GL_ADD_SIGNED_EXT 0x8574
|
||||
#define GL_INTERPOLATE_EXT 0x8575
|
||||
#define GL_CONSTANT_EXT 0x8576
|
||||
#define GL_PRIMARY_COLOR_EXT 0x8577
|
||||
#define GL_PREVIOUS_EXT 0x8578
|
||||
#define GL_SOURCE0_RGB_EXT 0x8580
|
||||
#define GL_SOURCE1_RGB_EXT 0x8581
|
||||
#define GL_SOURCE2_RGB_EXT 0x8582
|
||||
#define GL_SOURCE3_RGB_EXT 0x8583
|
||||
#define GL_SOURCE4_RGB_EXT 0x8584
|
||||
#define GL_SOURCE5_RGB_EXT 0x8585
|
||||
#define GL_SOURCE6_RGB_EXT 0x8586
|
||||
#define GL_SOURCE7_RGB_EXT 0x8587
|
||||
#define GL_SOURCE0_ALPHA_EXT 0x8588
|
||||
#define GL_SOURCE1_ALPHA_EXT 0x8589
|
||||
#define GL_SOURCE2_ALPHA_EXT 0x858A
|
||||
#define GL_SOURCE3_ALPHA_EXT 0x858B
|
||||
#define GL_SOURCE4_ALPHA_EXT 0x858C
|
||||
#define GL_SOURCE5_ALPHA_EXT 0x858D
|
||||
#define GL_SOURCE6_ALPHA_EXT 0x858E
|
||||
#define GL_SOURCE7_ALPHA_EXT 0x858F
|
||||
#define GL_OPERAND0_RGB_EXT 0x8590
|
||||
#define GL_OPERAND1_RGB_EXT 0x8591
|
||||
#define GL_OPERAND2_RGB_EXT 0x8592
|
||||
#define GL_OPERAND3_RGB_EXT 0x8593
|
||||
#define GL_OPERAND4_RGB_EXT 0x8594
|
||||
#define GL_OPERAND5_RGB_EXT 0x8595
|
||||
#define GL_OPERAND6_RGB_EXT 0x8596
|
||||
#define GL_OPERAND7_RGB_EXT 0x8597
|
||||
#define GL_OPERAND0_ALPHA_EXT 0x8598
|
||||
#define GL_OPERAND1_ALPHA_EXT 0x8599
|
||||
#define GL_OPERAND2_ALPHA_EXT 0x859A
|
||||
#define GL_OPERAND3_ALPHA_EXT 0x859B
|
||||
#define GL_OPERAND4_ALPHA_EXT 0x859C
|
||||
#define GL_OPERAND5_ALPHA_EXT 0x859D
|
||||
#define GL_OPERAND6_ALPHA_EXT 0x859E
|
||||
#define GL_OPERAND7_ALPHA_EXT 0x859F
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -122,12 +79,19 @@ public:
|
|||
u32 alphaSource;
|
||||
unpack_texureBlendFunc ( srcFact, dstFact, modulate, alphaSource, material.MaterialTypeParam );
|
||||
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, (f32) modulate );
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, (f32) modulate );
|
||||
#endif
|
||||
|
||||
glBlendFunc( getGLBlend(srcFact), getGLBlend(dstFact) );
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
|
@ -138,22 +102,42 @@ public:
|
|||
{
|
||||
if (alphaSource==EAS_VERTEX_COLOR)
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PRIMARY_COLOR_EXT);
|
||||
#endif
|
||||
}
|
||||
else if (alphaSource==EAS_TEXTURE)
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_PRIMARY_COLOR_EXT);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,9 +145,15 @@ public:
|
|||
virtual void OnUnsetMaterial()
|
||||
{
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.f );
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1.f );
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
#endif
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
@ -220,6 +210,16 @@ public:
|
|||
if (Driver->queryFeature(EVDF_MULTITEXTURE))
|
||||
{
|
||||
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PRIMARY_COLOR_EXT);
|
||||
|
@ -228,6 +228,7 @@ public:
|
|||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_PRIMARY_COLOR);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_ALPHA);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +239,11 @@ public:
|
|||
{
|
||||
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_COLOR);
|
||||
#endif
|
||||
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
|
||||
}
|
||||
}
|
||||
|
@ -296,15 +301,21 @@ public:
|
|||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PRIMARY_COLOR_EXT );
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
|
||||
|
||||
#endif
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
|
@ -314,8 +325,13 @@ public:
|
|||
{
|
||||
// default values
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE );
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE );
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE );
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE );
|
||||
#endif
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
|
@ -344,14 +360,21 @@ public:
|
|||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates
|
||||
|| material.MaterialTypeParam != lastMaterial.MaterialTypeParam )
|
||||
{
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE);
|
||||
|
||||
#endif
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
|
@ -363,7 +386,11 @@ public:
|
|||
virtual void OnUnsetMaterial()
|
||||
{
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE );
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE );
|
||||
#endif
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
@ -450,32 +477,58 @@ public:
|
|||
// lightmap
|
||||
|
||||
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
|
||||
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_ADD);
|
||||
else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PREVIOUS_ARB);
|
||||
#else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
|
||||
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
|
||||
else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PREVIOUS_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_PREVIOUS_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PREVIOUS_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_PREVIOUS_EXT);
|
||||
#endif
|
||||
|
||||
switch (material.MaterialType)
|
||||
{
|
||||
case EMT_LIGHTMAP_M4:
|
||||
case EMT_LIGHTMAP_LIGHTING_M4:
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 4.0f);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 4.0f);
|
||||
#endif
|
||||
break;
|
||||
case EMT_LIGHTMAP_M2:
|
||||
case EMT_LIGHTMAP_LIGHTING_M2:
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2.0f);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f);
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1.0f);
|
||||
#endif
|
||||
}
|
||||
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
@ -487,7 +540,11 @@ public:
|
|||
if (Driver->queryFeature(EVDF_MULTITEXTURE))
|
||||
{
|
||||
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.f );
|
||||
#else
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1.f );
|
||||
#endif
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
@ -519,10 +576,17 @@ public:
|
|||
if (Driver->queryFeature(EVDF_MULTITEXTURE))
|
||||
{
|
||||
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_ADD_SIGNED_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
|
||||
#else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD_SIGNED_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -594,10 +658,17 @@ public:
|
|||
if (Driver->queryFeature(EVDF_MULTITEXTURE))
|
||||
{
|
||||
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
|
||||
#else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
|
||||
#endif
|
||||
}
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
||||
|
@ -642,10 +713,17 @@ public:
|
|||
if (Driver->queryFeature(EVDF_MULTITEXTURE))
|
||||
{
|
||||
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
|
||||
#ifdef GL_ARB_texture_env_combine
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
|
||||
#else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
|
||||
#endif
|
||||
}
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
||||
|
|
|
@ -115,7 +115,6 @@ bool CQ3LevelMesh::loadFile(io::IReadFile* file)
|
|||
// now read lumps
|
||||
file->read(&Lumps[0], sizeof(tBSPLump)*kMaxLumps);
|
||||
|
||||
|
||||
s32 i;
|
||||
if ( LoadParam.swapHeader )
|
||||
{
|
||||
|
@ -151,14 +150,13 @@ bool CQ3LevelMesh::loadFile(io::IReadFile* file)
|
|||
loadLeafBrushes(&Lumps[kLeafBrushes], file); // load the brushes of the leaf
|
||||
loadFogs(&Lumps[kFogs], file ); // load the fogs
|
||||
|
||||
|
||||
loadTextures();
|
||||
constructMesh();
|
||||
solveTJunction ();
|
||||
solveTJunction();
|
||||
|
||||
cleanMeshes();
|
||||
calcBoundingBoxes();
|
||||
cleanLoader ();
|
||||
cleanLoader();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -178,8 +176,8 @@ void CQ3LevelMesh::cleanLoader ()
|
|||
delete [] MeshVerts; MeshVerts = 0;
|
||||
delete [] Brushes; Brushes = 0;
|
||||
|
||||
Lightmap.clear ();
|
||||
Tex.clear ();
|
||||
Lightmap.clear();
|
||||
Tex.clear();
|
||||
}
|
||||
|
||||
//! returns the amount of frames in milliseconds. If the amount is 1, it is a static (=non animated) mesh.
|
||||
|
@ -1026,9 +1024,6 @@ void CQ3LevelMesh::constructMesh()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CQ3LevelMesh::S3DVertex2TCoords_64::copy( video::S3DVertex2TCoords &dest ) const
|
||||
{
|
||||
#if defined (TJUNCTION_SOLVER_ROUND)
|
||||
|
@ -1198,7 +1193,6 @@ void CQ3LevelMesh::SBezier::tesselate( s32 level )
|
|||
Patch->Indices.push_back( inx + 0 );
|
||||
Patch->Indices.push_back( inx + (level + 1 ) + 1 );
|
||||
Patch->Indices.push_back( inx + 1 );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1764,9 +1758,7 @@ void CQ3LevelMesh::cleanMeshes()
|
|||
);
|
||||
os::Printer::log(buf, ELL_INFORMATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1786,7 +1778,6 @@ void CQ3LevelMesh::calcBoundingBoxes()
|
|||
);
|
||||
os::Printer::log(buf, ELL_INFORMATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// create bounding box
|
||||
|
@ -1798,6 +1789,9 @@ void CQ3LevelMesh::calcBoundingBoxes()
|
|||
}
|
||||
|
||||
Mesh[g]->recalculateBoundingBox();
|
||||
// Mesh[0] is the main bbox
|
||||
if (g!=0)
|
||||
Mesh[0]->BoundingBox.addInternalBox(Mesh[g]->getBoundingBox());
|
||||
}
|
||||
|
||||
if ( LoadParam.verbose > 0 )
|
||||
|
@ -1812,7 +1806,6 @@ void CQ3LevelMesh::calcBoundingBoxes()
|
|||
);
|
||||
os::Printer::log( buf, ELL_INFORMATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1835,7 +1828,6 @@ void CQ3LevelMesh::loadTextures()
|
|||
);
|
||||
os::Printer::log( buf, ELL_INFORMATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
c8 lightmapname[255];
|
||||
|
@ -1857,13 +1849,11 @@ void CQ3LevelMesh::loadTextures()
|
|||
|
||||
// lightmap is a CTexture::R8G8B8 format
|
||||
lmapImg = Driver->createImageFromData(
|
||||
video::ECF_R8G8B8,
|
||||
lmapsize,
|
||||
video::ECF_R8G8B8, lmapsize,
|
||||
LightMaps[t].imageBits, false, true );
|
||||
|
||||
Lightmap[t] = Driver->addTexture( lightmapname, lmapImg );
|
||||
lmapImg->drop();
|
||||
|
||||
}
|
||||
|
||||
// Driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
|
||||
|
@ -1940,20 +1930,19 @@ void CQ3LevelMesh::loadTextures()
|
|||
);
|
||||
os::Printer::log( buf, ELL_INFORMATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//! Returns an axis aligned bounding box of the mesh.
|
||||
//! \return A bounding box of this mesh is returned.
|
||||
const core::aabbox3d<f32>& CQ3LevelMesh::getBoundingBox() const
|
||||
{
|
||||
return Mesh[0]->getBoundingBox();
|
||||
}
|
||||
|
||||
void CQ3LevelMesh::setBoundingBox( const core::aabbox3df& box)
|
||||
|
||||
void CQ3LevelMesh::setBoundingBox(const core::aabbox3df& box)
|
||||
{
|
||||
Mesh[0]->setBoundingBox(box); //?
|
||||
Mesh[0]->setBoundingBox(box);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ using namespace quake3;
|
|||
*/
|
||||
CQuake3ShaderSceneNode::CQuake3ShaderSceneNode(
|
||||
scene::ISceneNode* parent, scene::ISceneManager* mgr,s32 id,
|
||||
io::IFileSystem *fileSystem, scene::IMeshBuffer *original,
|
||||
io::IFileSystem *fileSystem, const scene::IMeshBuffer *original,
|
||||
const IShader * shader)
|
||||
: scene::IMeshSceneNode(parent, mgr, id,
|
||||
core::vector3df(0.f, 0.f, 0.f),
|
||||
|
@ -53,21 +53,20 @@ CQuake3ShaderSceneNode::CQuake3ShaderSceneNode(
|
|||
MeshBuffer->drop ();
|
||||
|
||||
//Original = new SMeshBufferLightMap();
|
||||
Original = (scene::SMeshBufferLightMap*) original;
|
||||
Original = (const scene::SMeshBufferLightMap*) original;
|
||||
Original->grab();
|
||||
|
||||
// clone meshbuffer to modifiable buffer
|
||||
cloneBuffer( MeshBuffer, (scene::SMeshBufferLightMap*) original,
|
||||
original->getMaterial().ColorMask != 0
|
||||
);
|
||||
cloneBuffer(MeshBuffer, Original,
|
||||
Original->getMaterial().ColorMask != 0);
|
||||
|
||||
// load all Textures in all stages
|
||||
loadTextures( fileSystem );
|
||||
|
||||
setAutomaticCulling( scene::EAC_OFF );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
*/
|
||||
CQuake3ShaderSceneNode::~CQuake3ShaderSceneNode()
|
||||
|
@ -84,7 +83,7 @@ CQuake3ShaderSceneNode::~CQuake3ShaderSceneNode()
|
|||
/*
|
||||
create single copies
|
||||
*/
|
||||
void CQuake3ShaderSceneNode::cloneBuffer( scene::SMeshBuffer *dest, scene::SMeshBufferLightMap * buffer, bool translateCenter )
|
||||
void CQuake3ShaderSceneNode::cloneBuffer( scene::SMeshBuffer *dest, const scene::SMeshBufferLightMap * buffer, bool translateCenter )
|
||||
{
|
||||
dest->Material = buffer->Material;
|
||||
dest->Indices = buffer->Indices;
|
||||
|
@ -120,7 +119,6 @@ void CQuake3ShaderSceneNode::cloneBuffer( scene::SMeshBuffer *dest, scene::SMesh
|
|||
m.setTranslation( -MeshOffset );
|
||||
SceneManager->getMeshManipulator()->transform( dest, m );
|
||||
}
|
||||
|
||||
|
||||
// No Texture!. Use Shader-Pointer for sorting
|
||||
dest->Material.setTexture(0, (video::ITexture*) Shader);
|
||||
|
@ -719,7 +717,7 @@ void CQuake3ShaderSceneNode::deformvertexes_autosprite( f32 dt, SModifierFunctio
|
|||
const core::vector3df& camPos = SceneManager->getActiveCamera()->getPosition();
|
||||
|
||||
video::S3DVertex * dv = MeshBuffer->Vertices.pointer();
|
||||
const video::S3DVertex2TCoords * vin = Original->Vertices.pointer();
|
||||
const video::S3DVertex2TCoords * vin = Original->Vertices.const_pointer();
|
||||
|
||||
core::matrix4 lookat ( core::matrix4::EM4CONST_NOTHING );
|
||||
core::quaternion q;
|
||||
|
@ -769,7 +767,7 @@ void CQuake3ShaderSceneNode::deformvertexes_autosprite2( f32 dt, SModifierFuncti
|
|||
const core::vector3df camPos = SceneManager->getActiveCamera()->getAbsolutePosition();
|
||||
|
||||
video::S3DVertex * dv = MeshBuffer->Vertices.pointer();
|
||||
const video::S3DVertex2TCoords * vin = Original->Vertices.pointer();
|
||||
const video::S3DVertex2TCoords * vin = Original->Vertices.const_pointer();
|
||||
|
||||
core::matrix4 lookat ( core::matrix4::EM4CONST_NOTHING );
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ class CQuake3ShaderSceneNode : public scene::IMeshSceneNode
|
|||
public:
|
||||
|
||||
CQuake3ShaderSceneNode( ISceneNode* parent, ISceneManager* mgr, s32 id,
|
||||
io::IFileSystem *fileSystem,
|
||||
IMeshBuffer *original,
|
||||
const quake3::IShader * shader
|
||||
io::IFileSystem* fileSystem,
|
||||
const IMeshBuffer* original,
|
||||
const quake3::IShader* shader
|
||||
);
|
||||
|
||||
virtual ~CQuake3ShaderSceneNode();
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
private:
|
||||
const quake3::IShader* Shader;
|
||||
SMesh *Mesh;
|
||||
SMeshBufferLightMap* Original;
|
||||
const SMeshBufferLightMap* Original;
|
||||
SMeshBuffer* MeshBuffer;
|
||||
core::vector3df MeshOffset;
|
||||
|
||||
|
@ -75,7 +75,7 @@ private:
|
|||
|
||||
void loadTextures ( io::IFileSystem * fileSystem );
|
||||
void addBuffer ( scene::SMeshBufferLightMap * buffer );
|
||||
void cloneBuffer ( scene::SMeshBuffer *dest, scene::SMeshBufferLightMap * buffer, bool translateCenter );
|
||||
void cloneBuffer ( scene::SMeshBuffer *dest, const scene::SMeshBufferLightMap * buffer, bool translateCenter );
|
||||
|
||||
void deformvertexes_wave ( f32 dt, quake3::SModifierFunction &function );
|
||||
void deformvertexes_move ( f32 dt, quake3::SModifierFunction &function );
|
||||
|
|
|
@ -485,7 +485,7 @@ IBillboardTextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont*
|
|||
|
||||
|
||||
//! Adds a scene node, which can render a quake3 shader
|
||||
IMeshSceneNode* CSceneManager::addQuake3SceneNode(IMeshBuffer* meshBuffer,
|
||||
IMeshSceneNode* CSceneManager::addQuake3SceneNode(const IMeshBuffer* meshBuffer,
|
||||
const quake3::IShader * shader,
|
||||
ISceneNode* parent, s32 id )
|
||||
{
|
||||
|
@ -1190,11 +1190,11 @@ bool CSceneManager::isCulled(const ISceneNode* node) const
|
|||
|
||||
|
||||
//! registers a node for rendering it at a specific time.
|
||||
u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDER_PASS time)
|
||||
u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDER_PASS pass)
|
||||
{
|
||||
u32 taken = 0;
|
||||
|
||||
switch(time)
|
||||
switch(pass)
|
||||
{
|
||||
// take camera if it is not already registered
|
||||
case ESNRP_CAMERA:
|
||||
|
@ -1253,7 +1253,7 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDE
|
|||
case ESNRP_AUTOMATIC:
|
||||
if (!isCulled(node))
|
||||
{
|
||||
u32 count = node->getMaterialCount();
|
||||
const u32 count = node->getMaterialCount();
|
||||
|
||||
taken = 0;
|
||||
for (u32 i=0; i<count; ++i)
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace scene
|
|||
video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF);
|
||||
|
||||
//! Adds a scene node, which can render a quake3 shader
|
||||
virtual IMeshSceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::IShader * shader,
|
||||
virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
|
||||
ISceneNode* parent=0, s32 id=-1
|
||||
);
|
||||
|
||||
|
|
|
@ -470,6 +470,7 @@
|
|||
<Unit filename="../../include/IGUITable.h" />
|
||||
<Unit filename="../../include/IGUIToolbar.h" />
|
||||
<Unit filename="../../include/IGUIWindow.h" />
|
||||
<Unit filename="../../include/IGeometryCreator.h" />
|
||||
<Unit filename="../../include/IImage.h" />
|
||||
<Unit filename="../../include/IImageLoader.h" />
|
||||
<Unit filename="../../include/ILightSceneNode.h" />
|
||||
|
@ -1196,6 +1197,11 @@
|
|||
<Unit filename="libpng/pngwutil.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="lzma/LzmaDec.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="lzma/LzmaDec.h" />
|
||||
<Unit filename="lzma/Types.h" />
|
||||
<Unit filename="os.cpp" />
|
||||
<Unit filename="os.h" />
|
||||
<Unit filename="zlib/adler32.c">
|
||||
|
@ -1237,11 +1243,6 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="zlib/zutil.h" />
|
||||
<Unit filename="lzma/LzmaDec.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="lzma/LzmaDec.h" />
|
||||
<Unit filename="lzma/Types.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<debugger />
|
||||
|
|
|
@ -350,7 +350,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
|||
{
|
||||
firstLaunch = false;
|
||||
|
||||
if(!CreationParams.WindowId) //load menus if standalone application
|
||||
if(!CreationParams.WindowId) //load menus if standalone application
|
||||
{
|
||||
[[NSAutoreleasePool alloc] init];
|
||||
[NSApplication sharedApplication];
|
||||
|
@ -361,6 +361,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
|||
|
||||
path = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
|
||||
chdir([path fileSystemRepresentation]);
|
||||
[path release];
|
||||
}
|
||||
|
||||
uname(&name);
|
||||
|
@ -440,27 +441,25 @@ void CIrrDeviceMacOSX::closeDevice()
|
|||
bool CIrrDeviceMacOSX::createWindow()
|
||||
{
|
||||
CGDisplayErr error;
|
||||
bool result;
|
||||
CGDirectDisplayID display;
|
||||
bool result=false;
|
||||
CGDirectDisplayID display=CGMainDisplayID();
|
||||
CGLPixelFormatObj pixelFormat;
|
||||
CGRect displayRect;
|
||||
CFDictionaryRef displaymode, olddisplaymode;
|
||||
GLint numPixelFormats, newSwapInterval;
|
||||
int alphaSize = CreationParams.WithAlphaChannel?4:0, depthSize = CreationParams.ZBufferBits;
|
||||
|
||||
int alphaSize = CreationParams.WithAlphaChannel?4:0, depthSize = CreationParams.ZBufferBits;
|
||||
if (CreationParams.WithAlphaChannel && (CreationParams.Bits == 32))
|
||||
alphaSize = 8;
|
||||
|
||||
result = false;
|
||||
display = CGMainDisplayID();
|
||||
ScreenWidth = (int) CGDisplayPixelsWide(display);
|
||||
ScreenWidth = (int) CGDisplayPixelsWide(display);
|
||||
ScreenHeight = (int) CGDisplayPixelsHigh(display);
|
||||
|
||||
VideoModeList.setDesktop(CreationParams.Bits, core::dimension2d<u32>(ScreenWidth, ScreenHeight));
|
||||
|
||||
if (!CreationParams.Fullscreen)
|
||||
{
|
||||
if(!CreationParams.WindowId) //create another window when WindowId is null
|
||||
if(!CreationParams.WindowId) //create another window when WindowId is null
|
||||
{
|
||||
Window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height) styleMask:NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask backing:NSBackingStoreBuffered defer:FALSE];
|
||||
}
|
||||
|
@ -540,7 +539,7 @@ bool CIrrDeviceMacOSX::createWindow()
|
|||
else
|
||||
break;
|
||||
}
|
||||
CreationParams.AntiAlias = windowattribs[11];
|
||||
CreationParams.AntiAlias = windowattribs[11];
|
||||
CreationParams.Stencilbuffer=(windowattribs[13]==1);
|
||||
|
||||
if (format != NULL)
|
||||
|
@ -564,7 +563,7 @@ bool CIrrDeviceMacOSX::createWindow()
|
|||
[OGLContext setView:(NSView*)CreationParams.WindowId];
|
||||
|
||||
CGLContext = (CGLContextObj) [OGLContext CGLContextObj];
|
||||
DeviceWidth = CreationParams.WindowSize.Width;
|
||||
DeviceWidth = CreationParams.WindowSize.Width;
|
||||
DeviceHeight = CreationParams.WindowSize.Height;
|
||||
result = true;
|
||||
}
|
||||
|
@ -653,7 +652,7 @@ void CIrrDeviceMacOSX::setResize(int width, int height)
|
|||
}
|
||||
else
|
||||
getVideoDriver()->OnResize(core::dimension2d<u32>( (s32)width, (s32)height));
|
||||
if(CreationParams.WindowId && OGLContext)
|
||||
if (CreationParams.WindowId && OGLContext)
|
||||
[(NSOpenGLContext *)OGLContext update];
|
||||
}
|
||||
|
||||
|
@ -713,7 +712,7 @@ void CIrrDeviceMacOSX::flush()
|
|||
|
||||
bool CIrrDeviceMacOSX::run()
|
||||
{
|
||||
NSEvent *event;
|
||||
NSEvent *event;
|
||||
irr::SEvent ievent;
|
||||
|
||||
os::Timer::tick();
|
||||
|
@ -736,7 +735,7 @@ bool CIrrDeviceMacOSX::run()
|
|||
|
||||
case NSFlagsChanged:
|
||||
ievent.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||
ievent.KeyInput.Shift = ([(NSEvent *)event modifierFlags] & NSShiftKeyMask ) != 0;
|
||||
ievent.KeyInput.Shift = ([(NSEvent *)event modifierFlags] & NSShiftKeyMask) != 0;
|
||||
ievent.KeyInput.Control = ([(NSEvent *)event modifierFlags] & NSControlKeyMask) != 0;
|
||||
|
||||
if (IsShiftDown != ievent.KeyInput.Shift)
|
||||
|
@ -838,12 +837,14 @@ bool CIrrDeviceMacOSX::run()
|
|||
break;
|
||||
}
|
||||
}
|
||||
[event release];
|
||||
|
||||
pollJoysticks();
|
||||
|
||||
return (![[NSApp delegate] isQuit] && IsActive);
|
||||
}
|
||||
|
||||
|
||||
//! Pause the current process for the minimum time allowed only to allow other processes to execute
|
||||
void CIrrDeviceMacOSX::yield()
|
||||
{
|
||||
|
@ -852,6 +853,7 @@ void CIrrDeviceMacOSX::yield()
|
|||
nanosleep(&ts, NULL);
|
||||
}
|
||||
|
||||
|
||||
//! Pause execution and let other processes to run for a specified amount of time.
|
||||
void CIrrDeviceMacOSX::sleep(u32 timeMs, bool pauseTimer=false)
|
||||
{
|
||||
|
@ -872,16 +874,19 @@ void CIrrDeviceMacOSX::sleep(u32 timeMs, bool pauseTimer=false)
|
|||
Timer->start();
|
||||
}
|
||||
|
||||
|
||||
void CIrrDeviceMacOSX::setWindowCaption(const wchar_t* text)
|
||||
{
|
||||
size_t size;
|
||||
char title[1024];
|
||||
size_t size;
|
||||
char title[1024];
|
||||
|
||||
if (Window != NULL)
|
||||
{
|
||||
size = wcstombs(title,text,1024);
|
||||
title[1023] = 0;
|
||||
[Window setTitle:[NSString stringWithCString:title length:size]];
|
||||
NSString* name = [NSString stringWithCString:title length:size];
|
||||
[Window setTitle:name];
|
||||
[name release];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -910,14 +915,14 @@ bool CIrrDeviceMacOSX::isWindowMinimized() const
|
|||
|
||||
void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed)
|
||||
{
|
||||
NSString *str;
|
||||
std::map<int,int>::const_iterator iter;
|
||||
unsigned int result,c,mkey,mchar;
|
||||
const unsigned char *cStr;
|
||||
BOOL skipCommand;
|
||||
NSString *str;
|
||||
std::map<int,int>::const_iterator iter;
|
||||
unsigned int result,c,mkey,mchar;
|
||||
const unsigned char *cStr;
|
||||
BOOL skipCommand;
|
||||
|
||||
str = [(NSEvent *)event characters];
|
||||
if (str != nil && [str length] > 0)
|
||||
if ((str != nil) && ([str length] > 0))
|
||||
{
|
||||
mkey = mchar = 0;
|
||||
skipCommand = false;
|
||||
|
@ -967,8 +972,10 @@ void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed
|
|||
|
||||
postEventFromUser(ievent);
|
||||
}
|
||||
[str release];
|
||||
}
|
||||
|
||||
|
||||
void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent)
|
||||
{
|
||||
bool post = true;
|
||||
|
@ -993,6 +1000,7 @@ void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent)
|
|||
[NSApp sendEvent:(NSEvent *)event];
|
||||
}
|
||||
|
||||
|
||||
void CIrrDeviceMacOSX::storeMouseLocation()
|
||||
{
|
||||
NSPoint p;
|
||||
|
@ -1096,11 +1104,16 @@ void CIrrDeviceMacOSX::initKeycodes()
|
|||
}
|
||||
|
||||
|
||||
|
||||
//! Sets if the window should be resizable in windowed mode.
|
||||
void CIrrDeviceMacOSX::setResizable(bool resize)
|
||||
{
|
||||
IsResizable = resize;
|
||||
#if 0
|
||||
if (resize)
|
||||
[Window setStyleMask:NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask];
|
||||
else
|
||||
[Window setStyleMask:NSTitledWindowMask|NSClosableWindowMask];
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CIrrDeviceMacOSX::isResizable() const
|
||||
|
@ -1110,7 +1123,7 @@ bool CIrrDeviceMacOSX::isResizable() const
|
|||
|
||||
void CIrrDeviceMacOSX::minimizeWindow()
|
||||
{
|
||||
// todo: implement
|
||||
[Window miniaturize:[NSApp self]];
|
||||
}
|
||||
|
||||
//! Maximizes the window if possible.
|
||||
|
@ -1122,7 +1135,7 @@ void CIrrDeviceMacOSX::maximizeWindow()
|
|||
//! Restore the window to normal size if possible.
|
||||
void CIrrDeviceMacOSX::restoreWindow()
|
||||
{
|
||||
// todo: implement
|
||||
[Window deminiaturize:[NSApp self]];
|
||||
}
|
||||
|
||||
bool CIrrDeviceMacOSX::present(video::IImage* surface, void* windowId, core::rect<s32>* src )
|
||||
|
@ -1136,21 +1149,15 @@ bool CIrrDeviceMacOSX::present(video::IImage* surface, void* windowId, core::rec
|
|||
{
|
||||
// do we need to change the size?
|
||||
bool updateSize = !SoftwareDriverTarget ||
|
||||
s32([SoftwareDriverTarget size].width) != surface->getDimension().Width ||
|
||||
s32([SoftwareDriverTarget size].width) != surface->getDimension().Width ||
|
||||
s32([SoftwareDriverTarget size].height) != surface->getDimension().Height;
|
||||
|
||||
// release if necessary
|
||||
if (SoftwareDriverTarget && updateSize)
|
||||
[SoftwareDriverTarget release];
|
||||
|
||||
NSRect areaRect = NSMakeRect(0.0, 0.0, surface->getDimension().Width, surface->getDimension().Height);
|
||||
|
||||
// get pointer to image data
|
||||
unsigned char* imgData = (unsigned char*)surface->lock();
|
||||
|
||||
// create / update the target
|
||||
if (updateSize)
|
||||
{
|
||||
[SoftwareDriverTarget release];
|
||||
// allocate target for IImage
|
||||
SoftwareDriverTarget = [[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes: nil
|
||||
|
@ -1169,15 +1176,18 @@ bool CIrrDeviceMacOSX::present(video::IImage* surface, void* windowId, core::rec
|
|||
const u32 minWidth = core::min_(surface->getDimension().Width, destwidth);
|
||||
const u32 destPitch = (3 * areaRect.size.width);
|
||||
|
||||
// get pointer to image data
|
||||
unsigned char* imgData = (unsigned char*)surface->lock();
|
||||
|
||||
u8* srcdata = reinterpret_cast<u8*>(imgData);
|
||||
u8* destData = reinterpret_cast<u8*>([SoftwareDriverTarget bitmapData]);
|
||||
const u32 destheight = areaRect.size.height;
|
||||
const u32 destheight = areaRect.size.height;
|
||||
const u32 srcheight = core::min_(surface->getDimension().Height, destheight);
|
||||
const u32 srcPitch = surface->getPitch();
|
||||
for (u32 y=0; y!=srcheight; ++y)
|
||||
{
|
||||
video::CColorConverter::convert_viaFormat(srcdata, surface->getColorFormat(), minWidth, destData, video::ECF_R8G8B8);
|
||||
srcdata += srcPitch;
|
||||
srcdata += srcPitch;
|
||||
destData += destPitch;
|
||||
}
|
||||
|
||||
|
@ -1238,6 +1248,7 @@ bool CIrrDeviceMacOSX::activateJoysticks(core::array<SJoystickInfo> & joystickIn
|
|||
if (!hidIterator)
|
||||
return false;
|
||||
|
||||
u32 jindex = 0u;
|
||||
while ((hidObject = IOIteratorNext (hidIterator)))
|
||||
{
|
||||
JoystickInfo info;
|
||||
|
@ -1311,11 +1322,13 @@ bool CIrrDeviceMacOSX::activateJoysticks(core::array<SJoystickInfo> & joystickIn
|
|||
ActiveJoysticks.push_back(info);
|
||||
|
||||
SJoystickInfo returnInfo;
|
||||
returnInfo.Joystick = jindex;
|
||||
returnInfo.Axes = info.axes;
|
||||
//returnInfo.Hats = info.hats;
|
||||
returnInfo.Buttons = info.buttons;
|
||||
returnInfo.Name = info.joystickName;
|
||||
returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN;
|
||||
returnInfo.Name = info.joystickName;
|
||||
returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN;
|
||||
++ jindex;
|
||||
|
||||
//if (info.hatComp.size())
|
||||
// returnInfo.PovHat = SJoystickInfo::POV_HAT_PRESENT;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,13 +11,13 @@
|
|||
#include "irrArray.h"
|
||||
#include "CMeshBuffer.h"
|
||||
|
||||
/*!
|
||||
/**
|
||||
Flags for Octree
|
||||
*/
|
||||
//! use meshbuffer for drawing, enables VBO usage
|
||||
#define OCTREE_USE_HARDWARE false
|
||||
//! use visibility information together with VBOs
|
||||
#define OCTREE_USE_VISIBILITY false
|
||||
#define OCTREE_USE_VISIBILITY true
|
||||
//! use bounding box or frustum for calculate polys
|
||||
#define OCTREE_BOX_BASED true
|
||||
//! bypass full invisible/visible test
|
||||
|
|
|
@ -9,7 +9,7 @@ static bool testWithRenderTarget(video::E_DRIVER_TYPE driverType)
|
|||
IrrlichtDevice *device = createDevice(driverType, core::dimension2d<u32>(160,120));
|
||||
|
||||
if (device == 0)
|
||||
return false; // could not create selected driver.
|
||||
return true; // could not create selected driver.
|
||||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
|
||||
|
|
|
@ -70,6 +70,34 @@ static bool testFlattenFilename(io::IFileSystem* fs)
|
|||
logTestString("flattening destroys path.\n%s!=%s\n", tmpString.c_str(),refString.c_str());
|
||||
result = false;
|
||||
}
|
||||
|
||||
tmpString="this/tmp/next/../../my/fourth";
|
||||
refString="this/my/fourth/";
|
||||
fs->flattenFilename(tmpString);
|
||||
if (tmpString != refString)
|
||||
{
|
||||
logTestString("flattening destroys path.\n%s!=%s\n", tmpString.c_str(),refString.c_str());
|
||||
result = false;
|
||||
}
|
||||
|
||||
tmpString="this/is/../../../a/fifth/test/";
|
||||
refString="../a/fifth/test/";
|
||||
fs->flattenFilename(tmpString);
|
||||
if (tmpString != refString)
|
||||
{
|
||||
logTestString("flattening destroys path.\n%s!=%s\n", tmpString.c_str(),refString.c_str());
|
||||
result = false;
|
||||
}
|
||||
|
||||
tmpString="this/../is/../../a/sixth/test/";
|
||||
refString="../a/sixth/test/";
|
||||
fs->flattenFilename(tmpString);
|
||||
if (tmpString != refString)
|
||||
{
|
||||
logTestString("flattening destroys path.\n%s!=%s\n", tmpString.c_str(),refString.c_str());
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ int main(int argumentCount, char * arguments[])
|
|||
TEST(testDimension2d);
|
||||
TEST(testVector2d);
|
||||
TEST(testVector3d);
|
||||
TEST(testS3DVertex);
|
||||
TEST(testaabbox3d);
|
||||
// TODO: Needs to be fixed first
|
||||
// TEST(testTriangle3d);
|
||||
|
@ -92,6 +93,7 @@ int main(int argumentCount, char * arguments[])
|
|||
TEST(md2Animation);
|
||||
TEST(testGeometryCreator);
|
||||
TEST(writeImageToFile);
|
||||
TEST(meshTransform);
|
||||
// all driver checks
|
||||
TEST(drawPixel);
|
||||
TEST(guiDisabledMenu);
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -19,7 +19,6 @@ bool meshLoaders(void)
|
|||
if (!device)
|
||||
return false;
|
||||
|
||||
IVideoDriver* driver = device->getVideoDriver();
|
||||
ISceneManager * smgr = device->getSceneManager();
|
||||
|
||||
IAnimatedMesh* mesh = smgr->getMesh("../media/ninja.b3d");
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
// Copyright (C) 2009-2010 Christian Stehno
|
||||
// No rights reserved: this software is in the public domain.
|
||||
|
||||
#include "testUtils.h"
|
||||
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
// Tests mesh transformations via mesh manipulator.
|
||||
bool meshTransform(void)
|
||||
{
|
||||
// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
|
||||
IrrlichtDevice *device = createDevice(EDT_BURNINGSVIDEO, dimension2d<u32>(160, 120), 32);
|
||||
assert(device);
|
||||
if (!device)
|
||||
return false;
|
||||
|
||||
IVideoDriver* driver = device->getVideoDriver();
|
||||
ISceneManager * smgr = device->getSceneManager();
|
||||
|
||||
IMeshSceneNode* node1 = smgr->addCubeSceneNode(50);
|
||||
IAnimatedMesh* amesh = smgr->getMesh("../media/sydney.md2");
|
||||
IAnimatedMesh* smesh = smgr->getMesh("../media/ninja.b3d");
|
||||
assert(node1 && amesh && smesh);
|
||||
|
||||
bool result = false;
|
||||
if (!node1 || !amesh || !smesh)
|
||||
return false;
|
||||
|
||||
// node1->setPosition(core::vector3df(-60,0,150));
|
||||
node1->setDebugDataVisible(scene::EDS_BBOX_ALL);
|
||||
|
||||
IMeshSceneNode* node2 = smgr->addMeshSceneNode(amesh->getMesh(10));
|
||||
assert(node2);
|
||||
|
||||
if (!node2)
|
||||
return false;
|
||||
|
||||
// node2->setPosition(core::vector3df(30,10,150));
|
||||
node2->setDebugDataVisible(scene::EDS_BBOX_ALL);
|
||||
node2->setMaterialFlag(EMF_LIGHTING, false);
|
||||
|
||||
IMeshSceneNode* node3 = smgr->addMeshSceneNode(smesh->getMesh(10));
|
||||
assert(node3);
|
||||
|
||||
if (!node3)
|
||||
return false;
|
||||
|
||||
// node3->setPosition(core::vector3df(10,0,0));
|
||||
node3->setDebugDataVisible(scene::EDS_BBOX_ALL);
|
||||
node3->setMaterialFlag(EMF_LIGHTING, false);
|
||||
|
||||
smgr->addCameraSceneNode()->setPosition(core::vector3df(0,0,-20));
|
||||
|
||||
// Just jump to the last frame since that's all we're interested in.
|
||||
device->run();
|
||||
driver->beginScene(true, true, SColor(255, 60, 60, 60));
|
||||
smgr->drawAll();
|
||||
driver->endScene();
|
||||
|
||||
core::matrix4 mat;
|
||||
mat.setTranslation(core::vector3df(-60,0,150));
|
||||
driver->getMeshManipulator()->transform(node1->getMesh(), mat);
|
||||
|
||||
mat.setTranslation(core::vector3df(30,10,150));
|
||||
driver->getMeshManipulator()->transform(node2->getMesh(), mat);
|
||||
|
||||
mat.setTranslation(core::vector3df(10,0,0));
|
||||
driver->getMeshManipulator()->transform(node3->getMesh(), mat);
|
||||
|
||||
// Just jump to the last frame since that's all we're interested in.
|
||||
device->run();
|
||||
driver->beginScene(true, true, SColor(255, 60, 60, 60));
|
||||
smgr->drawAll();
|
||||
driver->endScene();
|
||||
|
||||
result = takeScreenshotAndCompareAgainstReference(driver, "-meshTransform.png");
|
||||
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
#include "testUtils.h"
|
||||
#include "irrlicht.h"
|
||||
#include <assert.h>
|
||||
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
using namespace video;
|
||||
|
||||
// S3DVertex has operators which are used sometimes in sorting for example on loading meshes
|
||||
bool testSorting()
|
||||
{
|
||||
// Some test-values which did fail in the past.
|
||||
// See http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=33391&highlight=
|
||||
core::map<video::S3DVertex, int> testmap;
|
||||
video::S3DVertex v;
|
||||
v.Pos = core::vector3df(1.000000f, -1.000000f, 1.000000f);
|
||||
v.Normal = core::vector3df(0.577350f, -0.577350f, 0.577350f);
|
||||
v.Color = SColor(255,204,204,204);
|
||||
v.TCoords = core::vector2d<f32>(0.f, 0.f);
|
||||
testmap.insert(v, 0);
|
||||
|
||||
v.Pos = core::vector3df(-1.000000f, -1.000000f, 1.000000f);
|
||||
v.Normal = core::vector3df(-0.577350f, -0.577350f, 0.577350f);
|
||||
v.Color = SColor(255,204,204,204);
|
||||
v.TCoords = core::vector2d<f32>(0.f, 0.f);
|
||||
testmap.insert(v, 1);
|
||||
|
||||
v.Pos = core::vector3df(1.000000f, 1.000000f, 1.000000f);
|
||||
v.Normal = core::vector3df(0.577350f, 0.577350f, 0.577350f);
|
||||
v.Color = SColor(255,204,204,204);
|
||||
v.TCoords = core::vector2d<f32>(0.f, 0.f);
|
||||
testmap.insert(v, 2);
|
||||
|
||||
v.Pos = core::vector3df(1.000000f, -1.000000f, 1.000000f);
|
||||
v.Normal = core::vector3df(0.577350f, -0.577350f, 0.577350f);
|
||||
v.Color = SColor(255,204,204,204);
|
||||
v.TCoords = core::vector2d<f32>(0.f, 0.f);
|
||||
|
||||
core::map<video::S3DVertex, int>::Node* n = testmap.find(v); // look for the vertex just inserted
|
||||
return n ? true : false;
|
||||
}
|
||||
|
||||
bool testS3DVertex(void)
|
||||
{
|
||||
bool result = true;
|
||||
result &= testSorting();
|
||||
return result;
|
||||
}
|
|
@ -11,12 +11,24 @@ using namespace core;
|
|||
#define EQUAL_VECTORS(compare, with)\
|
||||
if(!equalVectors(cmp_equal<core::vector3d<T> >(compare), with)) {assert(false); return false;}
|
||||
|
||||
#define LESS_VECTORS(compare, with)\
|
||||
if(!equalVectors(cmp_less<core::vector3d<T> >(compare), with)) return false;
|
||||
|
||||
#define LESS_EQUAL_VECTORS(compare, with)\
|
||||
if(!equalVectors(cmp_less_equal<core::vector3d<T> >(compare), with)) return false;
|
||||
|
||||
#define MORE_VECTORS(compare, with)\
|
||||
if(!equalVectors(cmp_more<core::vector3d<T> >(compare), with)) return false;
|
||||
|
||||
#define MORE_EQUAL_VECTORS(compare, with)\
|
||||
if(!equalVectors(cmp_more_equal<core::vector3d<T> >(compare), with)) return false;
|
||||
|
||||
// check if the vector contains a NAN (a==b is guaranteed to return false in this case)
|
||||
template<class T>
|
||||
static bool is_nan(const core::vector3d<T> &vec )
|
||||
{
|
||||
return ( !(vec.X == vec.X)
|
||||
|| !(vec.Y == vec.Y)
|
||||
return ( !(vec.X == vec.X)
|
||||
|| !(vec.Y == vec.Y)
|
||||
|| !(vec.Z == vec.Z) );
|
||||
}
|
||||
|
||||
|
@ -32,6 +44,42 @@ struct cmp_less
|
|||
const T val;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct cmp_less_equal
|
||||
{
|
||||
cmp_less_equal(const T& a) : val(a) {}
|
||||
bool operator()(const T& other) const
|
||||
{
|
||||
return val<=other;
|
||||
}
|
||||
const char* getName() const {return "<=";}
|
||||
const T val;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct cmp_more
|
||||
{
|
||||
cmp_more(const T& a) : val(a) {}
|
||||
bool operator()(const T& other) const
|
||||
{
|
||||
return val>other;
|
||||
}
|
||||
const char* getName() const {return ">";}
|
||||
const T val;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct cmp_more_equal
|
||||
{
|
||||
cmp_more_equal(const T& a) : val(a) {}
|
||||
bool operator()(const T& other) const
|
||||
{
|
||||
return val>=other;
|
||||
}
|
||||
const char* getName() const {return ">=";}
|
||||
const T val;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct cmp_equal
|
||||
{
|
||||
|
@ -203,22 +251,24 @@ static bool doTests()
|
|||
return false;
|
||||
}
|
||||
|
||||
//TODO: We need a proper order for vectors first
|
||||
#if 0
|
||||
#define LESS_VECTORS(compare, with)\
|
||||
if(!equalVectors(cmp_less<core::vector3d<T> >(compare), with)) return false;
|
||||
|
||||
vec.set(5, 5, 0);
|
||||
|
||||
otherVec.set(10, 20, 40);
|
||||
LESS_VECTORS(vec, otherVec);
|
||||
LESS_EQUAL_VECTORS(vec, otherVec);
|
||||
MORE_VECTORS(otherVec, vec);
|
||||
MORE_EQUAL_VECTORS(otherVec, vec);
|
||||
|
||||
vec.set(-1,-1,1);
|
||||
otherVec.set(1,-1,1);
|
||||
LESS_VECTORS(vec, otherVec);
|
||||
LESS_EQUAL_VECTORS(vec, otherVec);
|
||||
MORE_VECTORS(otherVec, vec);
|
||||
MORE_EQUAL_VECTORS(otherVec, vec);
|
||||
|
||||
LESS_EQUAL_VECTORS(vec, vec);
|
||||
MORE_EQUAL_VECTORS(vec, vec);
|
||||
|
||||
LESS_VECTORS(vec, vec);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Tests finished. 36 tests of 36 passed.
|
||||
Test suite pass at GMT Tue Dec 29 19:51:18 2009
|
||||
|
||||
Tests finished. 50 tests of 50 passed.
|
||||
Compiled as DEBUG
|
||||
Test suite pass at GMT Thu Jan 21 13:53:33 2010
|
||||
|
||||
|
|
|
@ -287,6 +287,10 @@
|
|||
RelativePath=".\meshLoaders.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meshTransform.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\planeMatrix.cpp"
|
||||
>
|
||||
|
@ -331,6 +335,10 @@
|
|||
RelativePath=".\testGeometryCreator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\testS3DVertex.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\testUtils.cpp"
|
||||
>
|
||||
|
|
|
@ -131,7 +131,7 @@ static bool testTextureMatrixInMixedScenes(video::E_DRIVER_TYPE driverType)
|
|||
gui->drawAll();
|
||||
driver->endScene();
|
||||
|
||||
bool result = takeScreenshotAndCompareAgainstReference(driver, "-textureMatrixInMixedScenes.png", 100);
|
||||
bool result = takeScreenshotAndCompareAgainstReference(driver, "-textureMatrixInMixedScenes.png", 99.8f);
|
||||
|
||||
device->drop();
|
||||
|
||||
|
|
Loading…
Reference in New Issue