I'm currently trying to render a Solar System in which the player can walk on the planets and fly around in space.
I like to always draw the Sun in my scene regardless of its distance.
I already tried to set the Sun nodes Automatic culling to off but did not work.
here is the code:
Code: Select all
IMesh *mesh = smgr->addSphereMesh("Sun", 100000.0f, 64, 64);
IMeshSceneNode *node = smgr->addMeshSceneNode(mesh);
node->setMaterialTexture(0, driver->getTexture("sunmap2.jpg"));
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialFlag(EMF_TRILINEAR_FILTER, true);
node->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
node->setAutomaticCulling(EAC_OFF);
video::SMaterial &matPlanet = node->getMaterial(0);
matPlanet.AmbientColor = video::SColor(255, 0, 0, 0);
matPlanet.DiffuseColor = video::SColor(0, 0, 0, 0);
matPlanet.EmissiveColor = video::SColor(255, 255, 186, 21);
matPlanet.MaterialTypeParam = 0.0035f;
matPlanet.Lighting = true;
matPlanet.NormalizeNormals = true;