IVideoDriver::drawStencilShadowVolume and drawMeshBuffer

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
uniqs
Posts: 7
Joined: Wed Jan 06, 2010 4:05 am

IVideoDriver::drawStencilShadowVolume and drawMeshBuffer

Post by uniqs »

Hello everyone!
I am now using the IVideoDriver interface to draw a shadow,just using the three steps:draw geometry,drawStencilShadowVolume and drawStencilShadow().can someone give me a very simple sample??Only this three functions,not using the addShadowVolumeSceneNode function.
The other problem is using the drawMeshBuffer function only to draw a mesh,not using the IAnimatedMeshSceneNode's implemention.
Great thanks for your patient.
Not knowing whether my question is suitable here, :D ~~
Last edited by uniqs on Wed Jan 06, 2010 10:16 am, edited 1 time in total.
uniqs
Posts: 7
Joined: Wed Jan 06, 2010 4:05 am

Re: IVideoDriver::drawStencilShadowVolume and drawMeshBuffer

Post by uniqs »

uniqs wrote:Hello everyone!
I am now using the IVideoDriver interface to draw a shadow,just using the three steps:draw geometry,drawStencilShadowVolume and drawStencilShadow().can someone give me a very simple sample??Only this three functions,not using the addShadowVolumeSceneNode function.
The other problem is using the drawMeshBuffer function only to draw a mesh,not using the IAnimatedMeshSceneNode's implemention.
Great thanks for your pations.
Not knowing whether my question is suitable here, :D ~~
Oh my god! The drawMeshBuffer is successfully drew out, but the drawStencilShadowVolume with drawStencilShadow still does not work...
Nobody has encounted this problem??
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You should definitely use the addShadowVolume method, I'm not even sure if all the necessary methods are publicly available in some interface.
uniqs
Posts: 7
Joined: Wed Jan 06, 2010 4:05 am

Post by uniqs »

hybrid wrote:You should definitely use the addShadowVolume method, I'm not even sure if all the necessary methods are publicly available in some interface.
You mean the drawShadowVolumeSceneNode() function??
This is the simplest sample changed from the sample 08.SpecialFX_vc8 using this function(^_^Sorry for my coding habits).What I need is to realize all this in my code,but it seemed so stupid to write something already written by other guys..But my destination is to test the changes made by my partners to the engine.Stupid again because all the use of our code is in the way using drawShadowVolumeSceneNode() :lol:
#include <irrlicht.h>
#include <iostream>

using namespace irr;

#pragma comment(lib, "Irrlicht.lib")

int main()
{
bool shadows = true;
video::E_DRIVER_TYPE driverType;
driverType = video::EDT_DIRECT3D9;

IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<s32>(640, 480),
16, false, shadows);

if (device == 0)
return 1; // could not create selected driver.

video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();

scene::IAnimatedMesh* mesh = smgr->getMesh(
"../../media/room.3ds");

smgr->getMeshManipulator()->makePlanarTextureMapping(
mesh->getMesh(0), 0.004f);

scene::ISceneNode* node = 0;

node = smgr->addAnimatedMeshSceneNode(mesh);
node->setMaterialTexture(0, driver->getTexture("../../media/wall.jpg"));
node->getMaterial(0).SpecularColor.set(0,0,0,0);

node = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f);
scene::ISceneNodeAnimator* anim = 0;
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
node->addAnimator(anim);
anim->drop();

// add animated character

mesh = smgr->getMesh("../../media/dwarf.x");
scene::IAnimatedMeshSceneNode* anode = 0;

anode = smgr->addAnimatedMeshSceneNode(mesh);
anode->setPosition(core::vector3df(-50,20,-60));
anode->setAnimationSpeed(15);

// add shadow
anode->addShadowVolumeSceneNode();
smgr->setShadowColor(video::SColor(150,0,0,0));


scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(core::vector3df(-50,50,-150));

// disable mouse cursor
device->getCursorControl()->setVisible(false);


int lastFPS = -1;

while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);

smgr->drawAll();

driver->endScene();

int fps = driver->getFPS();

if (lastFPS != fps)
{
core::stringw str = L"Irrlicht Engine - SpecialFX example [";
str += driver->getName();
str += "] FPS:";
str += fps;

device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}

device->drop();

return 0;
}
Thank you anyway,I give up,just using this two lines~~~
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

yea it draws some nice shadows with that method, but it is a little bugged, i recommend you to use XEffects for the shadows :) they are really nice and simple to implement :)
uniqs
Posts: 7
Joined: Wed Jan 06, 2010 4:05 am

Re: reply

Post by uniqs »

m3ltd0wn wrote:yea it draws some nice shadows with that method, but it is a little bugged, i recommend you to use XEffects for the shadows :) they are really nice and simple to implement :)
Oh so sorry for my knownless,the only thing I got known about the XEffects is from this formum today..Can you give me some introduction or show me some link??Sorry for my poor English~~
I baidued it and googled it but it seemed the XEffects project has closed^_^ So can you please show me some link??And now I had to go back home otherwise I will not catch the last subway~~
See you tomorrow :lol: :lol: :lol:
rootroot1
Posts: 44
Joined: Wed Nov 25, 2009 6:42 pm
Location: Odessa, Ukraine

Post by rootroot1 »

XEffects project is currently fine

link to the project page

http://irrlicht.sourceforge.net/phpBB2/ ... t=xeffects

download link

http://www.riara3d.com/misc/XEffectsR1.3.zip
Post Reply