Fixed bug that was causing all stars to look like glowing asteroids. Oops. Added methods to getting/setting star orbits.

ver1_5_1
Chris Laurel 2004-09-23 06:54:28 +00:00
parent 292d8477d8
commit 1908286da1
3 changed files with 50 additions and 12 deletions

View File

@ -4961,7 +4961,6 @@ void Renderer::renderStar(const Star& star,
if (discSizeInPixels > 1)
{
Surface surface;
Atmosphere atmosphere;
RenderProperties rp;
surface.color = color;
@ -5010,18 +5009,22 @@ void Renderer::renderStar(const Star& star,
surface.appearanceFlags |= Surface::ApplyBaseTexture;
surface.appearanceFlags |= Surface::Emissive;
atmosphere.height = radius * CoronaHeight;
atmosphere.lowerColor = color;
atmosphere.upperColor = color;
atmosphere.skyColor = color;
rp.surface = &surface;
rp.atmosphere = &atmosphere;
rp.rings = NULL;
rp.radius = star.getRadius();
rp.oblateness = 0.0f;
rp.model = star.getModel();
Atmosphere atmosphere;
atmosphere.height = radius * CoronaHeight;
atmosphere.lowerColor = color;
atmosphere.upperColor = color;
atmosphere.skyColor = color;
if (rp.model == InvalidResource)
rp.atmosphere = &atmosphere;
else
rp.atmosphere = NULL;
double rotation = 0.0;
// Watch out for the precision limits of floats when computing
// rotation . . .
@ -5533,7 +5536,6 @@ void StarRenderer::process(const Star& star, float distance, float appMag)
if (relPos * viewNormal > 0 || relPos.x * relPos.x < 0.1f)
{
//Color starColor = star.getStellarClass().getApparentColor();
Color starColor = colorTemp->lookupColor(star.getTemperature());
float renderDistance = distance;
float s = renderDistance * size;

View File

@ -619,7 +619,10 @@ StarDetails::StarDetails() :
temperature(0.0f),
bolometricCorrection(0.0f),
rotationPeriod(1.0f),
knowledge(0u)
knowledge(0u),
model(InvalidResource),
orbit(NULL),
orbitalRadius(0.0f)
{
spectralType[0] = '\0';
}
@ -689,6 +692,13 @@ StarDetails::setModel(ResourceHandle rh)
}
void
StarDetails::setOrbit(Orbit* o)
{
orbit = o;
}
// Return the radius of the star in kilometers
float Star::getRadius() const
{

View File

@ -31,7 +31,8 @@ class StarDetails
inline Vec3f getSemiAxes() const;
inline ResourceHandle getModel() const;
inline MultiResTexture getTexture() const;
inline const Orbit* getOrbit() const;
inline Orbit* getOrbit() const;
inline float getOrbitalRadius() const;
inline uint32 getKnowledge() const;
inline bool getKnowledge(uint32) const;
inline const char* getSpectralType() const;
@ -46,6 +47,7 @@ class StarDetails
void setBolometricCorrection(float);
void setTexture(const MultiResTexture&);
void setModel(ResourceHandle);
void setOrbit(Orbit*);
enum
{
@ -65,6 +67,9 @@ class StarDetails
MultiResTexture texture;
ResourceHandle model;
Orbit* orbit;
float orbitalRadius;
public:
static StarDetails* GetStarDetails(const StellarClass&);
static StarDetails* CreateStandardStarType(const std::string& _specType,
@ -117,10 +122,16 @@ StarDetails::getTexture() const
return texture;
}
const Orbit*
Orbit*
StarDetails::getOrbit() const
{
return NULL;
return orbit;
}
float
StarDetails::getOrbitalRadius() const
{
return 0.0f;
}
uint32
@ -176,6 +187,9 @@ public:
inline float getBolometricMagnitude() const;
MultiResTexture getTexture() const;
ResourceHandle getModel() const;
inline Orbit* getOrbit() const;
inline float getOrbitalRadius() const;
inline uint32 getKnowledge() const;
enum {
InvalidCatalogNumber = 0xffffffff
@ -239,4 +253,16 @@ Star::getBolometricMagnitude() const
return absMag + details->getBolometricCorrection();
}
Orbit*
Star::getOrbit() const
{
return details->getOrbit();
}
float
Star::getOrbitalRadius() const
{
return details->getOrbitalRadius();
}
#endif // _STAR_H_