MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / rrCreateMapLight

Method rrCreateMapLight

source/render/RenderManager.cpp:902–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900}
901
902void RenderManager::rrCreateMapLight(MapLight* curMapLight, bool displayVisual)
903{
904 // Create the light and attach it to the lightSceneNode.
905 std::string mapLightName = curMapLight->getOgreNamePrefix() + curMapLight->getName();
906 Ogre::Light* light = mSceneManager->createLight(mapLightName + "_light");
907 light->setDiffuseColour(curMapLight->getDiffuseColor());
908 light->setSpecularColour(curMapLight->getSpecularColor());
909 light->setAttenuation(curMapLight->getAttenuationRange(),
910 curMapLight->getAttenuationConstant(),
911 curMapLight->getAttenuationLinear(),
912 curMapLight->getAttenuationQuadratic());
913
914 // Create the base node that the "flicker_node" and the mesh attach to.
915 Ogre::SceneNode* mapLightNode = mLightSceneNode->createChildSceneNode(mapLightName + "_node");
916 curMapLight->setEntityNode(mapLightNode);
917 curMapLight->setParentSceneNode(mapLightNode->getParentSceneNode());
918 mapLightNode->setPosition(curMapLight->getPosition());
919
920 if (displayVisual)
921 {
922 // Create the MapLightIndicator mesh so the light can be drug around in the map editor.
923 Ogre::Entity* lightEntity = mSceneManager->createEntity(mapLightName, "Lamp.mesh");
924 mapLightNode->attachObject(lightEntity);
925 }
926
927 // Create the "flicker_node" which moves around randomly relative to
928 // the base node. This node carries the light itself.
929 Ogre::SceneNode* flickerNode = mapLightNode->createChildSceneNode(mapLightName + "_flicker_node");
930 flickerNode->attachObject(light);
931 curMapLight->setFlickerNode(flickerNode);
932}
933
934void RenderManager::rrDestroyMapLight(MapLight* curMapLight)
935{

Callers 1

createMeshLocalMethod · 0.80

Calls 10

getAttenuationRangeMethod · 0.80
getAttenuationLinearMethod · 0.80
setEntityNodeMethod · 0.80
setParentSceneNodeMethod · 0.80
getParentSceneNodeMethod · 0.80
setFlickerNodeMethod · 0.80
getOgreNamePrefixMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected