bool SceneLights::HardcodedLights() { // if a lights.cfg file doesn't exist, then this function // creates some defaults and creates the cfg file for future // use. using namespace std; using AntiMatter::g_Pi; bool bRet = false; // ensure lights list is empty Clear(); glm::vec3 vNone(0.0, 0.0, 0.0); glm::vec3 vFull(1.0, 1.0, 1.0); float rMultiplier = 6.0f; for( unsigned int n = 0; n < 4; ++ n ) { std::stringstream ss; std::string sName; ss << "light" << n; sName = ss.str(); float rRadius = 650.0f; float rSlices = 4.0f; float rTheta = ((2.0f * g_Pi) / rSlices); float x = rRadius * -cosf((float)n * rTheta); float z = rRadius * sinf((float)n * rTheta); glm::vec3 vColour = glm::vec3(Colours::g_ColourList[n]); SceneGraph* pGraph = this->Graph(); AddLight( new Light( pGraph, pGraph->Root(), sName, glm::vec4(x, rRadius, z, 1), vNone, vColour, vColour * rMultiplier, Light::LightType::SpotLight, glm::vec3(0, -1, 0), 1.0f, 15.0f ) ); } // sun light AddLight( new Light( this->Graph(), this->Graph()->Root(), std::string("sun"), glm::vec4(0.0, 500.0, 0.0, 1.0), vNone, vFull, vFull * rMultiplier ) ); bRet = true; // write lights out to disk ofstream out; out.open( m_sConfigFile.c_str(), ios::out ); if( out.good() ) out << *this; return bRet; }