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, ~~
IVideoDriver::drawStencilShadowVolume and drawMeshBuffer
IVideoDriver::drawStencilShadowVolume and drawMeshBuffer
Last edited by uniqs on Wed Jan 06, 2010 10:16 am, edited 1 time in total.
Re: IVideoDriver::drawStencilShadowVolume and drawMeshBuffer
Oh my god! The drawMeshBuffer is successfully drew out, but the drawStencilShadowVolume with drawStencilShadow still does not work...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, ~~
Nobody has encounted this problem??
You mean the drawShadowVolumeSceneNode() function??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.
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()
#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~~~
reply
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
Re: reply
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~~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
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
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
link to the project page
http://irrlicht.sourceforge.net/phpBB2/ ... t=xeffects
download link
http://www.riara3d.com/misc/XEffectsR1.3.zip