And here's the part of my code where I include the goblin model and the light:
Code: Select all
// Add the goblin model:
scene::IAnimatedMesh* goblinMesh = smgr->getMesh("../../../media/models/goblin.3ds");
if (goblinMesh) {
scene::IMesh* tangentMesh = smgr->getMeshManipulator()->createMeshWithTangents(goblinMesh->getMesh(0));
scene::ISceneNode* goblin = smgr->addMeshSceneNode(tangentMesh);
goblin->setScale(core::vector3df(20, 20, 20));
goblin->setMaterialTexture(0, driver->getTexture("../../../media/textures/goblin.bmp"));
goblin->setRotation(core::vector3df(0, 90, 0));
goblin->getMaterial(0).EmissiveColor.set(10, 10, 10, 0);
tangentMesh->drop();
}
// Add the light:
scene::ISceneNode* light = smgr->addLightSceneNode(0, core::vector3df(0, 10, 0),
video::SColor(255, 255, 255, 0), 2200.0f);
if (light) {
// Position the light above the model:
light->setPosition(core::vector3df(0, 130, 0));
// Attach a billboard:
scene::ISceneNode* bill = smgr->addBillboardSceneNode(light, core::dimension2d<f32>(60, 60));
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
bill->setMaterialTexture(0, driver->getTexture("../../../media/textures/particlered.bmp"));
// Make it go in a circle around the model:
scene::ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator(core::vector3df(0, 0, 0), 130, 0.003f);
light->addAnimator(anim);
anim->drop();
}