How to use slight.h
-
mesklinite
- Posts: 11
- Joined: Wed Jan 25, 2006 12:45 am
How to use slight.h
I've looked for tutorials and I have yet to find one that explains how to create a directional or omin light through the use of slight.h I wuld greatly appreciate any link or help on this subject. Thanks.
-
mesklinite
- Posts: 11
- Joined: Wed Jan 25, 2006 12:45 am
Here is what I've tried so far
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* node = 0;
scene::ILightSceneNode* light = smgr->addLightSceneNode();
light->setMaterialType(video::E_LIGHT_TYPE::ELT_DIRECTIONAL);
I get an error trying this.
error C2039: 'ELT_DIRECTIONAL' : is not a member of 'irr::video::E_LIGHT_TYPE'
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* node = 0;
scene::ILightSceneNode* light = smgr->addLightSceneNode();
light->setMaterialType(video::E_LIGHT_TYPE::ELT_DIRECTIONAL);
I get an error trying this.
error C2039: 'ELT_DIRECTIONAL' : is not a member of 'irr::video::E_LIGHT_TYPE'
The error is because you are passing a video::E_LIGHT_TYPE where the compiler expects a video::E_MATERIAL_TYPE. You don't want to change the light material, you want to change the light data...
Code: Select all
scene::ILightSceneNode* light = smgr->addLightSceneNode();
light->getLightData().Type = video::ELT_DIRECTIONAL;
-
mesklinite
- Posts: 11
- Joined: Wed Jan 25, 2006 12:45 am
That does make sense. Do you have to turn the light on in any way?
I haven't been able to get the light to appear as of yet. Thanks again for any help!
I haven't been able to get the light to appear as of yet. Thanks again for any help!
Code: Select all
scene::IAnimatedMesh* mesh = smgr->getMesh("first_level.bsp");
scene::ISceneNodeAnimator* anim = 0;
core::vector3df coord(-1300, -144, -1249);
scene::ISceneNode* node = 0;
scene::ILightSceneNode* light = smgr->addLightSceneNode();
light->getLightData().Type = video::ELT_DIRECTIONAL;
light->setPosition(lightOne);
//light->isVisible();
//light->setPosition(coord);
light = device->getSceneManager()->addLightSceneNode(0, core::vector3df(-736,464,-1818), video::SColorf(1.0f, 0.5f, 0.5f, 1.0f), 1500);
anim = device->getSceneManager()->createFlyCircleAnimator(core::vector3df(-736,464,-1818), 80.0f, 0.0005f);
light->addAnimator(anim);I haven't used directional lights at all. It looks like you are already doing this, but if you aren't you might try tweaking the SpecialFX example just to test the functionality that you want is there.
If you just leave the light type as-is, you will have an omnidirectional light. If you set the light type to directional, it will be a directional light, which means it has no position. Directional is not the same as a flashlight type light.
Travis
If you just leave the light type as-is, you will have an omnidirectional light. If you set the light type to directional, it will be a directional light, which means it has no position. Directional is not the same as a flashlight type light.
Travis
-
mesklinite
- Posts: 11
- Joined: Wed Jan 25, 2006 12:45 am