Commit 386a18b5 authored by hybrid's avatar hybrid

Merged revisions 1652:1682 from the 1.4 branch: Code layout changes in the...

Merged revisions 1652:1682 from the 1.4 branch: Code layout changes in the examples and SMaterial checks for self-assignment.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1683 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f222720d
......@@ -71,10 +71,14 @@ public:
Material.Wireframe = false;
Material.Lighting = false;
Vertices[0] = video::S3DVertex(0,0,10, 1,1,0, video::SColor(255,0,255,255), 0, 1);
Vertices[1] = video::S3DVertex(10,0,-10, 1,0,0, video::SColor(255,255,0,255), 1, 1);
Vertices[2] = video::S3DVertex(0,20,0, 0,1,1, video::SColor(255,255,255,0), 1, 0);
Vertices[3] = video::S3DVertex(-10,0,-10, 0,0,1, video::SColor(255,0,255,0), 0, 0);
Vertices[0] = video::S3DVertex(0,0,10, 1,1,0,
video::SColor(255,0,255,255), 0, 1);
Vertices[1] = video::S3DVertex(10,0,-10, 1,0,0,
video::SColor(255,255,0,255), 1, 1);
Vertices[2] = video::S3DVertex(0,20,0, 0,1,1,
video::SColor(255,255,255,0), 1, 0);
Vertices[3] = video::S3DVertex(-10,0,-10, 0,0,1,
video::SColor(255,0,255,0), 0, 0);
/*
The Irrlicht Engine needs to know the bounding box of a scene node.
......@@ -187,8 +191,8 @@ int main()
// create device
IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<s32>(640, 480), 16, false);
IrrlichtDevice *device = createDevice(driverType,
core::dimension2d<s32>(640, 480), 16, false);
if (device == 0)
return 1; // could not create selected driver.
......
......@@ -90,8 +90,8 @@ int main()
// create device
MyEventReceiver receiver;
IrrlichtDevice* device = createDevice( driverType, core::dimension2d<s32>(640, 480),
16, false, false, false, &receiver);
IrrlichtDevice* device = createDevice(driverType,
core::dimension2d<s32>(640, 480), 16, false, false, false, &receiver);
if (device == 0)
return 1; // could not create selected driver.
......@@ -142,7 +142,8 @@ int main()
The last scene node we add to show possibilities of scene node animators is
a md2 model, which uses a 'fly straight' animator to run between to points.
*/
scene::IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/sydney.md2"));
scene::IAnimatedMeshSceneNode* anms =
smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/sydney.md2"));
if (anms)
{
......
......@@ -202,9 +202,12 @@ int main()
the button in the event receiver.
*/
env->addButton(rect<s32>(10,240,110,240 + 32), 0, 101, L"Quit", L"Exits Program");
env->addButton(rect<s32>(10,280,110,280 + 32), 0, 102, L"New Window", L"Launches a new Window");
env->addButton(rect<s32>(10,320,110,320 + 32), 0, 103, L"File Open", L"Opens a file");
env->addButton(rect<s32>(10,240,110,240 + 32), 0, 101,
L"Quit", L"Exits Program");
env->addButton(rect<s32>(10,280,110,280 + 32), 0, 102,
L"New Window", L"Launches a new Window");
env->addButton(rect<s32>(10,320,110,320 + 32), 0, 103,
L"File Open", L"Opens a file");
/*
Now, we add a static text and a scrollbar, which modifies the
......@@ -215,7 +218,8 @@ int main()
*/
env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true);
IGUIScrollBar* scrollbar = env->addScrollBar(true, rect<s32>(150, 45, 350, 60), 0, 104);
IGUIScrollBar* scrollbar = env->addScrollBar(true,
rect<s32>(150, 45, 350, 60), 0, 104);
scrollbar->setMax(255);
// set scrollbar position to alpha value of an arbitrary element
......
......@@ -83,7 +83,8 @@ int main()
creatures) in the texture.
*/
gui::IGUIFont* font = device->getGUIEnvironment()->getBuiltInFont();
gui::IGUIFont* font2 = device->getGUIEnvironment()->getFont("../../media/fonthaettenschweiler.bmp");
gui::IGUIFont* font2 =
device->getGUIEnvironment()->getFont("../../media/fonthaettenschweiler.bmp");
core::rect<s32> imp1(349,15,385,78);
core::rect<s32> imp2(387,15,423,78);
......
......@@ -85,7 +85,8 @@ int main()
{
q3node->setPosition(core::vector3df(-1350,-130,-1400));
selector = smgr->createOctTreeTriangleSelector(q3levelmesh->getMesh(0), q3node, 128);
selector = smgr->createOctTreeTriangleSelector(
q3levelmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(selector);
}
......@@ -259,7 +260,8 @@ int main()
it is not the billboard or the quake 3 level.
*/
selectedSceneNode = smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera);
selectedSceneNode =
smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera);
if (lastSelectedSceneNode)
lastSelectedSceneNode->setMaterialFlag(video::EMF_LIGHTING, true);
......
......@@ -91,7 +91,8 @@ void loadModel(const c8* fn)
extension == ".bmp"
)
{
video::ITexture * texture = Device->getVideoDriver()->getTexture( filename.c_str() );
video::ITexture * texture =
Device->getVideoDriver()->getTexture( filename.c_str() );
if ( texture && Model )
{
// always reload texture
......@@ -173,11 +174,14 @@ void createToolBox()
env->addButton(core::rect<s32>(10,150,100,190), t1, 1101, L"set");
// add senseless checkbox
env->addCheckBox(true, core::rect<s32>(10,220,200,240), t1, -1, L"Senseless Checkbox");
env->addCheckBox(true, core::rect<s32>(10,220,200,240), t1, -1,
L"Senseless Checkbox");
// add undocumented transparent control
env->addStaticText(L"Transparent Control:", core::rect<s32>(10,240,150,260), true, false, t1);
IGUIScrollBar* scrollbar = env->addScrollBar(true, core::rect<s32>(10,260,150,275), t1, 104);
env->addStaticText(L"Transparent Control:",
core::rect<s32>(10,240,150,260), true, false, t1);
IGUIScrollBar* scrollbar = env->addScrollBar(true,
core::rect<s32>(10,260,150,275), t1, 104);
scrollbar->setMax(255);
scrollbar->setPos(255);
......@@ -205,7 +209,8 @@ public:
{
if ( Device )
{
scene::ICameraSceneNode * camera = Device->getSceneManager()->getActiveCamera ();
scene::ICameraSceneNode * camera =
Device->getSceneManager()->getActiveCamera();
if ( camera )
{
camera->setInputReceiverEnabled ( !camera->isInputReceiverEnabled() );
......@@ -471,7 +476,8 @@ int main(int argc, char* argv[])
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
smgr->addLightSceneNode();
smgr->addLightSceneNode(0, core::vector3df(50,-50,100), video::SColorf(1.0f,1.0f,1.0f),20000);
smgr->addLightSceneNode(0, core::vector3df(50,-50,100),
video::SColorf(1.0f,1.0f,1.0f),20000);
// add our media directory as "search path"
Device->getFileSystem()->addFolderFileArchive ( "../../media/" );
......@@ -636,7 +642,8 @@ int main(int argc, char* argv[])
// create fps text
IGUIStaticText* fpstext = env->addStaticText(L"", core::rect<s32>(400,4,570,23), true, false, bar);
IGUIStaticText* fpstext = env->addStaticText(L"",
core::rect<s32>(400,4,570,23), true, false, bar);
// set window caption
......@@ -682,7 +689,8 @@ int main(int argc, char* argv[])
core::position2d<s32>(10, driver->getScreenSize().Height - 128));
// lock the logo's edges to the bottom left corner of the screen
img->setAlignment(EGUIA_UPPERLEFT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
img->setAlignment(EGUIA_UPPERLEFT, EGUIA_UPPERLEFT,
EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
// draw everything
......
......@@ -46,7 +46,8 @@ class MyShaderCallBack : public video::IShaderConstantSetCallBack
{
public:
virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
virtual void OnSetConstants(video::IMaterialRendererServices* services,
s32 userData)
{
video::IVideoDriver* driver = services->getVideoDriver();
......@@ -89,7 +90,8 @@ public:
video::SColorf col(0.0f,1.0f,1.0f,0.0f);
if (UseHighLevelShaders)
services->setVertexShaderConstant("mLightColor", reinterpret_cast<f32*>(&col), 4);
services->setVertexShaderConstant("mLightColor",
reinterpret_cast<f32*>(&col), 4);
else
services->setVertexShaderConstant(reinterpret_cast<f32*>(&col), 9, 1);
......@@ -416,5 +418,6 @@ int main()
}
/*
Compile and run this, and I hope you have fun with your new little shader writing tool :).
Compile and run this, and I hope you have fun with your new little shader
writing tool :).
**/
......@@ -177,7 +177,8 @@ int main()
// create device
IrrlichtDevice* device = createDevice(driverType, core::dimension2d<s32>(640, 480));
IrrlichtDevice* device = createDevice(driverType,
core::dimension2d<s32>(640, 480));
if (device == 0)
return 1; // could not create selected driver.
......@@ -256,8 +257,10 @@ int main()
to a bigger value, the map will look more rocky.
*/
video::ITexture* colorMap = driver->getTexture("../../media/rockwall.bmp");
video::ITexture* normalMap = driver->getTexture("../../media/rockwall_height.bmp");
video::ITexture* colorMap =
driver->getTexture("../../media/rockwall.bmp");
video::ITexture* normalMap =
driver->getTexture("../../media/rockwall_height.bmp");
driver->makeNormalMapTexture(normalMap, 9.0f);
......@@ -285,7 +288,8 @@ int main()
room->setMaterialFlag(video::EMF_FOG_ENABLE, true);
room->setMaterialType(video::EMT_PARALLAX_MAP_SOLID);
room->getMaterial(0).MaterialTypeParam = 0.035f; // adjust height for parallax effect
// adjust height for parallax effect
room->getMaterial(0).MaterialTypeParam = 0.035f;
// drop mesh because we created it with a create.. call.
tangentMesh->drop();
......@@ -392,7 +396,8 @@ int main()
video::SColorf(1.0f, 0.2f, 0.2f, 0.0f), 800.0f);
// add fly circle animator to light 2
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),200.0f, 0.001f, core::vector3df ( 0.2f, 0.9f, 0.f ));
anim = smgr->createFlyCircleAnimator(core::vector3df(0,150,0), 200.0f,
0.001f, core::vector3df(0.2f, 0.9f, 0.f));
light2->addAnimator(anim);
anim->drop();
......
......@@ -40,11 +40,13 @@ public:
switch (event.KeyInput.Key)
{
case irr::KEY_KEY_W: // switch wire frame mode
Terrain->setMaterialFlag(video::EMF_WIREFRAME, !Terrain->getMaterial(0).Wireframe);
Terrain->setMaterialFlag(video::EMF_WIREFRAME,
!Terrain->getMaterial(0).Wireframe);
Terrain->setMaterialFlag(video::EMF_POINTCLOUD, false);
return true;
case irr::KEY_KEY_P: // switch wire frame mode
Terrain->setMaterialFlag(video::EMF_POINTCLOUD, !Terrain->getMaterial(0).PointCloud);
Terrain->setMaterialFlag(video::EMF_POINTCLOUD,
!Terrain->getMaterial(0).PointCloud);
Terrain->setMaterialFlag(video::EMF_WIREFRAME, false);
return true;
case irr::KEY_KEY_D: // toggle detail map
......@@ -94,7 +96,8 @@ int main()
// create device
IrrlichtDevice* device = createDevice(driverType, core::dimension2d<s32>(640, 480));
IrrlichtDevice* device = createDevice(driverType,
core::dimension2d<s32>(640, 480));
if (device == 0)
return 1; // could not create selected driver.
......@@ -168,8 +171,10 @@ int main()
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
terrain->setMaterialTexture(0, driver->getTexture("../../media/terrain-texture.jpg"));
terrain->setMaterialTexture(1, driver->getTexture("../../media/detailmap3.jpg"));
terrain->setMaterialTexture(0,
driver->getTexture("../../media/terrain-texture.jpg"));
terrain->setMaterialTexture(1,
driver->getTexture("../../media/detailmap3.jpg"));
terrain->setMaterialType(video::EMT_DETAIL_MAP);
......@@ -251,7 +256,8 @@ int main()
// Also print terrain height of current camera position
// We can use camera position because terrain is located at coordinate origin
str += " Height: ";
str += terrain->getHeight(camera->getAbsolutePosition().X, camera->getAbsolutePosition().Z);
str += terrain->getHeight(camera->getAbsolutePosition().X,
camera->getAbsolutePosition().Z);
device->setWindowCaption(str.c_str());
lastFPS = fps;
......
......@@ -68,7 +68,8 @@ int main()
if (fairy)
{
fairy->setMaterialTexture(0, driver->getTexture("../../media/faerie2.bmp")); // set diffuse texture
fairy->setMaterialTexture(0,
driver->getTexture("../../media/faerie2.bmp")); // set diffuse texture
fairy->setMaterialFlag(video::EMF_LIGHTING, true); // enable dynamic lighting
fairy->getMaterial(0).Shininess = 20.0f; // set size of specular highlights
fairy->setPosition(core::vector3df(-10,0,-100));
......
......@@ -22,7 +22,8 @@ using namespace irr;
HWND hOKButton;
HWND hWnd;
static LRESULT CALLBACK CustomWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK CustomWndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch (message)
{
......@@ -101,7 +102,8 @@ int main()
// create window to put irrlicht in
HWND hIrrlichtWindow = CreateWindow("BUTTON", "", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
HWND hIrrlichtWindow = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
50, 80, 320, 220, hWnd, NULL, hInstance, NULL);
/*
......@@ -126,7 +128,8 @@ int main()
scene::ICameraSceneNode* cam = smgr->addCameraSceneNode();
cam->setTarget(core::vector3df(0,0,0));
scene::ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator(core::vector3df(0,15,0), 30.0f);
scene::ISceneNodeAnimator* anim =
smgr->createFlyCircleAnimator(core::vector3df(0,15,0), 30.0f);
cam->addAnimator(anim);
anim->drop();
......
......@@ -205,7 +205,8 @@ 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(mapname);
scene::IQ3LevelMesh* mesh =
(scene::IQ3LevelMesh*) smgr->getMesh(mapname);
/*
add the geometry mesh to the Scene ( polygon & patches )
......@@ -252,8 +253,10 @@ int IRRCALLCONV main(int argc, char* argv[])
continue;
}
// we can dump the shader to the console in it's original but already parsed layout
// in a pretty printers way.. commented out, because the console would be full...
// we can dump the shader to the console in it's
// original but already parsed layout in a pretty
// printers way.. commented out, because the console
// would be full...
// quake3::dumpShader ( Shader );
#ifndef SHOW_SHADER_NAME
......@@ -306,7 +309,8 @@ int IRRCALLCONV main(int argc, char* argv[])
/*
so we need a good starting Position in the level.
we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch"
we can ask the Quake3 Loader for all entities with class_name
"info_player_deathmatch"
we choose a random launch
*/
......@@ -327,7 +331,8 @@ int IRRCALLCONV main(int argc, char* argv[])
group = entityList[ index ].getGroup(1);
u32 parsepos = 0;
core::vector3df pos = quake3::getAsVector3df ( group->get ( "origin" ), parsepos );
core::vector3df pos =
quake3::getAsVector3df ( group->get ( "origin" ), parsepos );
parsepos = 0;
f32 angle = quake3::getAsFloat ( group->get ( "angle"), parsepos );
......@@ -358,7 +363,8 @@ int IRRCALLCONV main(int argc, char* argv[])
device->getCursorControl()->setVisible(false);
// load the engine logo
gui->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 );
......@@ -366,14 +372,14 @@ int IRRCALLCONV main(int argc, char* argv[])
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;
}
......
......@@ -80,8 +80,9 @@ int main()
MyEventReceiver receiver;
//Initialise the engine
IrrlichtDevice *device = createDevice(
EDT_OPENGL, dimension2d<s32>(ResX,ResY), 32, fullScreen, false, false, &receiver);
IrrlichtDevice *device = createDevice(EDT_OPENGL,
dimension2d<s32>(ResX,ResY), 32, fullScreen,
false, false, &receiver);
ISceneManager *smgr = device->getSceneManager();
IVideoDriver *driver = device->getVideoDriver();
......
/*
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.
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>
......@@ -85,38 +84,45 @@ int main()
{
q3node->setPosition(core::vector3df(-1350,-130,-1400));
selector = smgr->createOctTreeTriangleSelector(q3levelmesh->getMesh(0), q3node, 128);
selector = smgr->createOctTreeTriangleSelector(
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.
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 =
......@@ -210,14 +216,16 @@ int main()
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.
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;
......@@ -247,7 +255,8 @@ int main()
billboard or the quake 3 level.
*/
selectedSceneNode = smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera);
selectedSceneNode =
smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera);
if (lastSelectedSceneNode)
lastSelectedSceneNode->setMaterialFlag(video::EMF_LIGHTING, true);
......@@ -271,7 +280,8 @@ int main()
if (lastFPS != fps)
{
core::stringw str = L"Collision detection example - Irrlicht Engine [";
core::stringw str =
L"Collision detection example - Irrlicht Engine [";
str += driver->getName();
str += "] FPS:";
str += fps;
......
......@@ -89,6 +89,10 @@ namespace video
/** \param other Material to copy from. */
SMaterial& operator=(const SMaterial& other)
{
// Check for self-assignment!
if (this == &other)
return *this;
MaterialType = other.MaterialType;
AmbientColor = other.AmbientColor;
......
......@@ -69,6 +69,10 @@ namespace video
\return This material layer, updated. */
SMaterialLayer& operator=(const SMaterialLayer& other)
{
// Check for self-assignment!
if (this == &other)
return *this;
Texture = other.Texture;
if (TextureMatrix)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment