git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1045 dfc29bdd-3216-0410-991c-e03cc46cb475
parent
b5436c6fe8
commit
95e75a6321
|
@ -10,6 +10,31 @@ to ask the user for a driver type using the console.
|
||||||
#include <irrlicht.h>
|
#include <irrlicht.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
/*
|
||||||
|
define which Quake3 Level should be loaded
|
||||||
|
*/
|
||||||
|
#define IRRLICHT_QUAKE3_ARENA
|
||||||
|
//#define ORIGINAL_QUAKE3_ARENA
|
||||||
|
//#define CUSTOM_QUAKE3_ARENA
|
||||||
|
//#define SHOW_SHADER_NAME
|
||||||
|
|
||||||
|
#ifdef ORIGINAL_QUAKE3_ARENA
|
||||||
|
#define QUAKE3_STORAGE_FORMAT addFolderFileArchive
|
||||||
|
#define QUAKE3_STORAGE_1 "/baseq3/"
|
||||||
|
#ifdef CUSTOM_QUAKE3_ARENA
|
||||||
|
#define QUAKE3_STORAGE_2 "/cf/"
|
||||||
|
#define QUAKE3_MAP_NAME "maps/cf.bsp"
|
||||||
|
#else
|
||||||
|
#define QUAKE3_MAP_NAME "maps/q3dm8.bsp"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IRRLICHT_QUAKE3_ARENA
|
||||||
|
#define QUAKE3_STORAGE_FORMAT addZipFileArchive
|
||||||
|
#define QUAKE3_STORAGE_1 "../../media/map-20kdm2.pk3"
|
||||||
|
#define QUAKE3_MAP_NAME "maps/20kdm2.bsp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
As already written in the HelloWorld example, in the Irrlicht
|
As already written in the HelloWorld example, in the Irrlicht
|
||||||
|
@ -50,6 +75,8 @@ public:
|
||||||
|
|
||||||
Filename.reserve ( 256 );
|
Filename.reserve ( 256 );
|
||||||
FilenameTemplate = templateName;
|
FilenameTemplate = templateName;
|
||||||
|
FilenameTemplate.replace ( '/', '_' );
|
||||||
|
FilenameTemplate.replace ( '\\', '_' );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OnEvent(const SEvent& event)
|
bool OnEvent(const SEvent& event)
|
||||||
|
@ -62,7 +89,7 @@ public:
|
||||||
video::IImage* image = Device->getVideoDriver()->createScreenShot();
|
video::IImage* image = Device->getVideoDriver()->createScreenShot();
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
sprintf ( (c8*) Filename.c_str() ,
|
snprintf ( (c8*) Filename.c_str() , 255,
|
||||||
"%s_shot%04d.jpg",
|
"%s_shot%04d.jpg",
|
||||||
FilenameTemplate.c_str (),
|
FilenameTemplate.c_str (),
|
||||||
Number++
|
Number++
|
||||||
|
@ -135,6 +162,12 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
*/
|
*/
|
||||||
video::IVideoDriver* driver = device->getVideoDriver();
|
video::IVideoDriver* driver = device->getVideoDriver();
|
||||||
scene::ISceneManager* smgr = device->getSceneManager();
|
scene::ISceneManager* smgr = device->getSceneManager();
|
||||||
|
gui::IGUIEnvironment* gui = device->getGUIEnvironment();
|
||||||
|
|
||||||
|
// create an event receiver for making screenshots
|
||||||
|
CScreenShotFactory screenshotFactory ( device, QUAKE3_MAP_NAME );
|
||||||
|
device->setEventReceiver ( &screenshotFactory );
|
||||||
|
|
||||||
|
|
||||||
//! add our private media directory to the file system
|
//! add our private media directory to the file system
|
||||||
device->getFileSystem()->addFolderFileArchive("../../media/");
|
device->getFileSystem()->addFolderFileArchive("../../media/");
|
||||||
|
@ -146,8 +179,12 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
we are able to read from the files in that archive as they would
|
we are able to read from the files in that archive as they would
|
||||||
directly be stored on disk.
|
directly be stored on disk.
|
||||||
*/
|
*/
|
||||||
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
|
device->getFileSystem()->QUAKE3_STORAGE_FORMAT ( QUAKE3_STORAGE_1 );
|
||||||
//device->getFileSystem()->addFolderFileArchive("/baseq3/");
|
#ifdef QUAKE3_STORAGE_2
|
||||||
|
device->getFileSystem()->QUAKE3_STORAGE_FORMAT ( QUAKE3_STORAGE_2 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Now we can load the mesh by calling getMesh(). We get a pointer returned
|
Now we can load the mesh by calling getMesh(). We get a pointer returned
|
||||||
|
@ -165,12 +202,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
IVideoDriver class). Note that this optimization with the Octree is only
|
IVideoDriver class). Note that this optimization with the Octree is only
|
||||||
useful when drawing huge meshes consisting of lots of geometry.
|
useful when drawing huge meshes consisting of lots of geometry.
|
||||||
*/
|
*/
|
||||||
scene::IQ3LevelMesh* mesh = (scene::IQ3LevelMesh*) smgr->getMesh("maps/20kdm2.bsp");
|
scene::IQ3LevelMesh* mesh = (scene::IQ3LevelMesh*) smgr->getMesh( QUAKE3_MAP_NAME );
|
||||||
//scene::IQ3LevelMesh* mesh = (scene::IQ3LevelMesh*) smgr->getMesh("maps/q3dm14.bsp");
|
|
||||||
|
|
||||||
// create an event receiver for making screenshots
|
|
||||||
CScreenShotFactory screenshotFactory ( device, "20kdm2" );
|
|
||||||
device->setEventReceiver ( &screenshotFactory );
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -195,6 +227,9 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
// the additional mesh can be quite huge and is unoptimized
|
// the additional mesh can be quite huge and is unoptimized
|
||||||
scene::IMesh * additional_mesh = mesh->getMesh ( quake3::E_Q3_MESH_ITEMS );
|
scene::IMesh * additional_mesh = mesh->getMesh ( quake3::E_Q3_MESH_ITEMS );
|
||||||
|
|
||||||
|
gui::IGUIFont *font = device->getGUIEnvironment()->getFont("../../media/fontlucida.png");
|
||||||
|
|
||||||
|
u32 count = 0;
|
||||||
for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i )
|
for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i )
|
||||||
{
|
{
|
||||||
IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i );
|
IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i );
|
||||||
|
@ -214,9 +249,36 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
// in a pretty printers way.. commented out, because the console would be full...
|
// in a pretty printers way.. commented out, because the console would be full...
|
||||||
// quake3::dumpShader ( Shader );
|
// quake3::dumpShader ( Shader );
|
||||||
|
|
||||||
// Now add the MeshBuffer(s) with the current Shader to the Manager
|
#ifndef SHOW_SHADER_NAME
|
||||||
smgr->addQuake3SceneNode ( meshBuffer, shader );
|
smgr->addQuake3SceneNode ( meshBuffer, shader );
|
||||||
|
#else
|
||||||
|
// Now add the MeshBuffer(s) with the current Shader to the Manager
|
||||||
|
#if 0
|
||||||
|
if ( shader->name != "textures/cf/window-decal"
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
if ( 0 == count )
|
||||||
|
{
|
||||||
|
core::stringc s;
|
||||||
|
//quake3::dumpShader ( s, shader );
|
||||||
|
printf ( s.c_str () );
|
||||||
}
|
}
|
||||||
|
count += 1;
|
||||||
|
|
||||||
|
node = smgr->addQuake3SceneNode ( meshBuffer, shader );
|
||||||
|
|
||||||
|
core::stringw name( node->getName() );
|
||||||
|
node = smgr->addBillboardTextSceneNode(
|
||||||
|
font,
|
||||||
|
name.c_str(),
|
||||||
|
node,
|
||||||
|
core::dimension2d<f32>(80.0f, 8.0f),
|
||||||
|
core::vector3df(0, 10, 0)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// original mesh is not needed anymore
|
// original mesh is not needed anymore
|
||||||
mesh->releaseMesh ( quake3::E_Q3_MESH_ITEMS );
|
mesh->releaseMesh ( quake3::E_Q3_MESH_ITEMS );
|
||||||
|
@ -270,11 +332,13 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
camera->setTarget ( pos + target );
|
camera->setTarget ( pos + target );
|
||||||
|
|
||||||
index += 1;
|
index += 1;
|
||||||
|
/*
|
||||||
notEndList = ( index < (s32) entityList.size () &&
|
notEndList = ( index < (s32) entityList.size () &&
|
||||||
entityList[index].name == search.name &&
|
entityList[index].name == search.name &&
|
||||||
(device->getTimer()->getRealTime() >> 3 ) & 1
|
(device->getTimer()->getRealTime() >> 3 ) & 1
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
notEndList = index == 2;
|
||||||
} while ( notEndList );
|
} while ( notEndList );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,8 +351,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
device->getCursorControl()->setVisible(false);
|
device->getCursorControl()->setVisible(false);
|
||||||
|
|
||||||
// load the engine logo
|
// load the engine logo
|
||||||
gui::IGUIEnvironment* env = device->getGUIEnvironment();
|
gui->addImage(driver->getTexture("irrlichtlogo2.png"),core::position2d<s32>(10, 10));
|
||||||
env->addImage(driver->getTexture("irrlichtlogo2.png"),core::position2d<s32>(10, 10));
|
|
||||||
|
|
||||||
// show the driver logo
|
// show the driver logo
|
||||||
core::position2di pos ( videoDim.Width - 128, videoDim.Height - 64 );
|
core::position2di pos ( videoDim.Width - 128, videoDim.Height - 64 );
|
||||||
|
@ -296,14 +359,14 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
switch ( driverType )
|
switch ( driverType )
|
||||||
{
|
{
|
||||||
case video::EDT_BURNINGSVIDEO:
|
case video::EDT_BURNINGSVIDEO:
|
||||||
env->addImage(driver->getTexture("burninglogo.png"),pos );
|
gui->addImage(driver->getTexture("burninglogo.png"),pos );
|
||||||
break;
|
break;
|
||||||
case video::EDT_OPENGL:
|
case video::EDT_OPENGL:
|
||||||
env->addImage(driver->getTexture("opengllogo.png"),pos );
|
gui->addImage(driver->getTexture("opengllogo.png"),pos );
|
||||||
break;
|
break;
|
||||||
case video::EDT_DIRECT3D8:
|
case video::EDT_DIRECT3D8:
|
||||||
case video::EDT_DIRECT3D9:
|
case video::EDT_DIRECT3D9:
|
||||||
env->addImage(driver->getTexture("directxlogo.png"),pos );
|
gui->addImage(driver->getTexture("directxlogo.png"),pos );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +384,7 @@ int IRRCALLCONV main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
driver->beginScene(true, true, video::SColor(255,20,20,40));
|
driver->beginScene(true, true, video::SColor(255,20,20,40));
|
||||||
smgr->drawAll();
|
smgr->drawAll();
|
||||||
env->drawAll();
|
gui->drawAll();
|
||||||
|
|
||||||
driver->endScene();
|
driver->endScene();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue