- first implement for Moon Position

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4792 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 114ab50643a3583fb11984051b2d5e2edda7019b
Former-commit-id: d12849ebbf76d7c083a7197f4449eb6750f441c5
This commit is contained in:
torcs-ng 2012-07-08 17:17:32 +00:00
parent 6106da1bbf
commit 8d6f045391
3 changed files with 51 additions and 55 deletions

View file

@ -5,7 +5,7 @@ SET(SSGGRAPH_SOURCES CarSoundData.cpp CarSoundData.h
SoundInterface.cpp SoundInterface.h SoundInterface.cpp SoundInterface.h
PlibSoundInterface.cpp PlibSoundInterface.h PlibSoundInterface.cpp PlibSoundInterface.h
OpenalSoundInterface.cpp OpenalSoundInterface.h OpenalSoundInterface.cpp OpenalSoundInterface.h
#grCelestialBody.cpp grMoonPos.h grMoonPos.cpp
grMoon.cpp grSun.cpp grCloudLayer.cpp grSky.cpp grSky.h grMoon.cpp grSun.cpp grCloudLayer.cpp grSky.cpp grSky.h
grSkyDome.cpp grSphere.cpp grSphere.h grStars.cpp grSkyDome.cpp grSphere.cpp grSphere.h grStars.cpp
grboard.cpp grboard.h grcam.cpp grcam.h grcar.cpp grcar.h grboard.cpp grboard.h grcam.cpp grcam.h grcar.cpp grcar.h

View file

@ -32,7 +32,7 @@
#include "grutil.h" #include "grutil.h"
#include "grSky.h" #include "grSky.h"
#include "grbackground.h" #include "grbackground.h"
#include "grMoonPos.h"
// Some exported constants. // Some exported constants.
const tdble grSkyDomeNeutralFOVDistance = 20000.0f; // Not the smallest, a medium one. const tdble grSkyDomeNeutralFOVDistance = 20000.0f; // Not the smallest, a medium one.
@ -54,13 +54,8 @@ static const sgVec4 Black = { 0.0f, 0.0f, 0.0f, 1.0f } ;
static const sgVec4 White = { 1.0f, 1.0f, 1.0f, 1.0f } ; static const sgVec4 White = { 1.0f, 1.0f, 1.0f, 1.0f } ;
static const sgVec4 TranslucentWhite = { 1.0f, 1.0f, 1.0f, 0.8f } ; static const sgVec4 TranslucentWhite = { 1.0f, 1.0f, 1.0f, 0.8f } ;
//static const sgVec4 BaseSkyColor = { 0.39f, 0.50f, 0.74f, 1.0f } ;
static const sgVec4 BaseSkyColor = { 0.31f, 0.43f, 0.69f, 1.0f }; static const sgVec4 BaseSkyColor = { 0.31f, 0.43f, 0.69f, 1.0f };
static const sgVec4 BaseAmbiant = { 0.35f, 0.35f, 0.40f, 1.0f } ;
static const sgVec4 BaseDiffuse = { 0.80f, 0.80f, 0.80f, 1.0f } ;
static const sgVec4 BaseSpecular = { 0.33f, 0.33f, 0.30f, 1.0f } ;
static int NStars = 0; static int NStars = 0;
static int NPlanets = 0; static int NPlanets = 0;
static int cloudsTextureIndex = 0; static int cloudsTextureIndex = 0;
@ -97,7 +92,6 @@ static ssgBranch *SunAnchor = NULL;
static ssgRoot *TheBackground = NULL; static ssgRoot *TheBackground = NULL;
static ssgTransform *TheSun = NULL; static ssgTransform *TheSun = NULL;
//static cGrCelestialBody *TheCelestBodies[NMaxCelestianBodies] = { NULL, NULL };
static cGrSky *TheSky = NULL; static cGrSky *TheSky = NULL;
static sgdVec3 *AStarsData = NULL; static sgdVec3 *AStarsData = NULL;
@ -236,12 +230,14 @@ grInitBackground()
timeOfDay / 3600, (timeOfDay % 3600) / 60, timeOfDay % 60, timeOfDay / 3600, (timeOfDay % 3600) / 60, timeOfDay % 60,
grSunDeclination, RAD2DEG(sunAscension)); grSunDeclination, RAD2DEG(sunAscension));
if ( grSunDeclination > 180 ) /*if ( grSunDeclination > 180 )
grMoonDeclination = 3.0 + (rand() % 40); grMoonDeclination = 3.0 + (rand() % 40);
else else
grMoonDeclination = (rand() % 270); grMoonDeclination = (rand() % 270);*/
const float moonAscension = (float)(rand() % 360); grMoonDeclination = grUpdateMoonPos(timeOfDay);
const float moonAscension = grTrack->local.sunascension;
TheSky->setMD( DEG2RAD(grMoonDeclination) ); TheSky->setMD( DEG2RAD(grMoonDeclination) );
TheSky->setMRA( DEG2RAD(moonAscension) ); TheSky->setMRA( DEG2RAD(moonAscension) );