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
You need to sign in or sign up before continuing.
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.
...
@@ -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:
...
@@ -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:
...
@@ -62,7 +89,7 @@ public:
video
::
IImage
*
image
=
Device
->
getVideoDriver
()
->
createScreenShot
();
video
::
IImage
*
image
=
Device
->
getVideoDriver
()
->
createScreenShot
();
if
(
image
)
if
(
image
)
{
{
s
printf
(
(
c8
*
)
Filename
.
c_str
()
,
s
nprintf
(
(
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[])
...
@@ -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,9 +179,13 @@ int IRRCALLCONV main(int argc, char* argv[])
...
@@ -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
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
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
...
@@ -165,12 +202,7 @@ int IRRCALLCONV main(int argc, char* argv[])
...
@@ -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[])
...
@@ -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,10 +249,37 @@ int IRRCALLCONV main(int argc, char* argv[])
...
@@ -214,10 +249,37 @@ 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.0
f
,
8.0
f
),
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[])
...
@@ -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[])
...
@@ -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[])
...
@@ -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[])
...
@@ -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
();
...
...
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