| 900 | } |
| 901 | |
| 902 | void 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 | |
| 934 | void RenderManager::rrDestroyMapLight(MapLight* curMapLight) |
| 935 | { |
no test coverage detected