Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
deprecated-irrlicht-mac
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
deprecated-irrlicht-mac
Commits
95e75a63
Commit
95e75a63
authored
Nov 13, 2007
by
engineer_apple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
b5436c6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
18 deletions
+81
-18
examples/16.Quake3MapShader/main.cpp
examples/16.Quake3MapShader/main.cpp
+81
-18
No files found.
examples/16.Quake3MapShader/main.cpp
View file @
95e75a63
...
...
@@ -10,6 +10,31 @@ to ask the user for a driver type using the console.
#include <irrlicht.h>
#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
...
...
@@ -50,6 +75,8 @@ public:
Filename
.
reserve
(
256
);
FilenameTemplate
=
templateName
;
FilenameTemplate
.
replace
(
'/'
,
'_'
);
FilenameTemplate
.
replace
(
'\\'
,
'_'
);
}
bool
OnEvent
(
const
SEvent
&
event
)
...
...
@@ -62,7 +89,7 @@ public:
video
::
IImage
*
image
=
Device
->
getVideoDriver
()
->
createScreenShot
();
if
(
image
)
{
s
printf
(
(
c8
*
)
Filename
.
c_str
()
,
s
nprintf
(
(
c8
*
)
Filename
.
c_str
()
,
255
,
"%s_shot%04d.jpg"
,
FilenameTemplate
.
c_str
(),
Number
++
...
...
@@ -135,6 +162,12 @@ int IRRCALLCONV main(int argc, char* argv[])
*/
video
::
IVideoDriver
*
driver
=
device
->
getVideoDriver
();
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
device
->
getFileSystem
()
->
addFolderFileArchive
(
"../../media/"
);
...
...
@@ -146,9 +179,13 @@ int IRRCALLCONV main(int argc, char* argv[])
we are able to read from the files in that archive as they would
directly be stored on disk.
*/
device
->
getFileSystem
()
->
addZipFileArchive
(
"../../media/map-20kdm2.pk3"
);
//device->getFileSystem()->addFolderFileArchive("/baseq3/");
device
->
getFileSystem
()
->
QUAKE3_STORAGE_FORMAT
(
QUAKE3_STORAGE_1
);
#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
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
...
...
@@ -165,12 +202,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
*
)
smgr
->
getMesh
(
"maps/20kdm2.bsp"
);
//scene::IQ3LevelMesh* mesh = (scene::IQ3LevelMesh*) smgr->getMesh("maps/q3dm14.bsp");
// create an event receiver for making screenshots
CScreenShotFactory
screenshotFactory
(
device
,
"20kdm2"
);
device
->
setEventReceiver
(
&
screenshotFactory
);
scene
::
IQ3LevelMesh
*
mesh
=
(
scene
::
IQ3LevelMesh
*
)
smgr
->
getMesh
(
QUAKE3_MAP_NAME
);
/*
...
...
@@ -195,6 +227,9 @@ int IRRCALLCONV main(int argc, char* argv[])
// the additional mesh can be quite huge and is unoptimized
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
)
{
IMeshBuffer
*
meshBuffer
=
additional_mesh
->
getMeshBuffer
(
i
);
...
...
@@ -214,10 +249,37 @@ int IRRCALLCONV main(int argc, char* argv[])
// in a pretty printers way.. commented out, because the console would be full...
// quake3::dumpShader ( Shader );
// Now add the MeshBuffer(s) with the current Shader to the Manager
#ifndef SHOW_SHADER_NAME
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.0
f
,
8.0
f
),
core
::
vector3df
(
0
,
10
,
0
)
);
#endif
}
// original mesh is not needed anymore
mesh
->
releaseMesh
(
quake3
::
E_Q3_MESH_ITEMS
);
}
...
...
@@ -270,11 +332,13 @@ int IRRCALLCONV main(int argc, char* argv[])
camera
->
setTarget
(
pos
+
target
);
index
+=
1
;
/*
notEndList = ( index < (s32) entityList.size () &&
entityList[index].name == search.name &&
(device->getTimer()->getRealTime() >> 3 ) & 1
);
*/
notEndList
=
index
==
2
;
}
while
(
notEndList
);
}
...
...
@@ -287,8 +351,7 @@ int IRRCALLCONV main(int argc, char* argv[])
device
->
getCursorControl
()
->
setVisible
(
false
);
// load the engine logo
gui
::
IGUIEnvironment
*
env
=
device
->
getGUIEnvironment
();
env
->
addImage
(
driver
->
getTexture
(
"irrlichtlogo2.png"
),
core
::
position2d
<
s32
>
(
10
,
10
));
gui
->
addImage
(
driver
->
getTexture
(
"irrlichtlogo2.png"
),
core
::
position2d
<
s32
>
(
10
,
10
));
// show the driver logo
core
::
position2di
pos
(
videoDim
.
Width
-
128
,
videoDim
.
Height
-
64
);
...
...
@@ -296,14 +359,14 @@ int IRRCALLCONV main(int argc, char* argv[])
switch
(
driverType
)
{
case
video
:
:
EDT_BURNINGSVIDEO
:
env
->
addImage
(
driver
->
getTexture
(
"burninglogo.png"
),
pos
);
gui
->
addImage
(
driver
->
getTexture
(
"burninglogo.png"
),
pos
);
break
;
case
video
:
:
EDT_OPENGL
:
env
->
addImage
(
driver
->
getTexture
(
"opengllogo.png"
),
pos
);
gui
->
addImage
(
driver
->
getTexture
(
"opengllogo.png"
),
pos
);
break
;
case
video
:
:
EDT_DIRECT3D8
:
case
video
:
:
EDT_DIRECT3D9
:
env
->
addImage
(
driver
->
getTexture
(
"directxlogo.png"
),
pos
);
gui
->
addImage
(
driver
->
getTexture
(
"directxlogo.png"
),
pos
);
break
;
}
...
...
@@ -321,7 +384,7 @@ int IRRCALLCONV main(int argc, char* argv[])
{
driver
->
beginScene
(
true
,
true
,
video
::
SColor
(
255
,
20
,
20
,
40
));
smgr
->
drawAll
();
env
->
drawAll
();
gui
->
drawAll
();
driver
->
endScene
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment