fix whitespaces and indents

trailing spaces are removed
tabs are replaced with 4 spaces

# Conflicts:
#	src/celengine/cmdparser.cpp
#	src/celengine/command.cpp
#	src/celestia/celestiacore.cpp
#	src/celestia/celestiacore.h
#	src/celestia/qt/qtappwin.cpp
#	src/celestia/qt/qtglwidget.cpp
#	src/celestia/win32/winmain.cpp
pull/110/head
Hleb Valoshka 2018-03-11 16:12:58 +03:00
parent c1fdbcfc8d
commit 882e4ecf28
287 changed files with 9780 additions and 9798 deletions

View File

@ -1066,13 +1066,13 @@ void CompareTycho()
{
CheckStarRecord(tycDatabase);
if (++recs % 10000 == 0)
{
{
if (verbose>=0)
cout << recs << " records.\n";
else
cout << ".";
cout.flush();
}
cout.flush();
}
}
if (verbose<0)
cout << "\n";
@ -1137,13 +1137,13 @@ int main(int argc, char* argv[])
{
ReadStarRecord(mainDatabase);
if (stars.size() % 10000 == 0)
{
{
if (verbose>=0)
cout << stars.size() << " records.\n";
else
cout << ".";
cout.flush();
}
cout.flush();
}
}
if (verbose<0)
cout << "\n";

View File

@ -1,5 +1,5 @@
// 3dschunk.h
//
//
// Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
//
// This program is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
// 3dsmodel.cpp
//
//
// Copyright (C) 2000, Chris Laurel <claurel@shatters.net>
//
// This program is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
// 3dsmodel.h
//
//
// Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
//
// This program is free software; you can redistribute it and/or
@ -95,7 +95,7 @@ class M3DTriangleMesh
void addMeshMaterialGroup(M3DMeshMaterialGroup* matGroup);
M3DMeshMaterialGroup* getMeshMaterialGroup(uint32) const;
uint32 getMeshMaterialGroupCount() const;
private:
std::vector<Eigen::Vector3f> points;
std::vector<Eigen::Vector2f> texCoords;

View File

@ -1,5 +1,5 @@
// 3dsread.h
//
//
// Copyright (C) 2000, Chris Laurel <claurel@shatters.net>
//
// This program is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/*
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
constitutes acceptance of these terms. If you do not agree with these terms,
@ -37,7 +37,7 @@ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer
*/
// Note that this is modified Apple source code, and not in its entireity (some classes are, some aren't),
// Note that this is modified Apple source code, and not in its entireity (some classes are, some aren't),
// but we might as well leave it in here, even though it doesn't sound like we have to.
// -bob
@ -51,54 +51,54 @@ class CGFrame : public CGRect
{
public:
CGFrame(float x0, float y0, float w, float h)
{
*this = CGRectMake(x0,y0,w,h);
}
explicit CGFrame(float w = 0, float h = 0)
{
*this = CGRectMake(0,0,w,h);
}
CGFrame(const Rect& rect)
{
origin.x = rect.left, size.width = rect.right - rect.left;
origin.y = rect.top, size.height = rect.bottom - rect.top;
}
CGFrame(const CGRect& copy)
{
origin = copy.origin;
size = copy.size;
}
CGFrame(const CGSize& size)
{
origin.x = origin.y = 0;
this->size = size;
}
CGFrame(float x, float y, const CGSize& size)
{
*this = CGRectMake(x, y, size.width, size.height);
}
CGFrame(const CGPoint& pos, const CGSize& size)
{
*this = CGRectMake(pos.x, pos.y, size.width, size.height);
}
void Offset(float dx, float dy)
{
origin.x += dx, origin.y += dy;
}
void Inset(float dx, float dy)
{
origin.x += dx, origin.y += dy;
size.width -= dx*2, size.height -= dy*2;
}
CGFrame(float x0, float y0, float w, float h)
{
*this = CGRectMake(x0,y0,w,h);
}
explicit CGFrame(float w = 0, float h = 0)
{
*this = CGRectMake(0,0,w,h);
}
CGFrame(const Rect& rect)
{
origin.x = rect.left, size.width = rect.right - rect.left;
origin.y = rect.top, size.height = rect.bottom - rect.top;
}
CGFrame(const CGRect& copy)
{
origin = copy.origin;
size = copy.size;
}
CGFrame(const CGSize& size)
{
origin.x = origin.y = 0;
this->size = size;
}
CGFrame(float x, float y, const CGSize& size)
{
*this = CGRectMake(x, y, size.width, size.height);
}
CGFrame(const CGPoint& pos, const CGSize& size)
{
*this = CGRectMake(pos.x, pos.y, size.width, size.height);
}
void Offset(float dx, float dy)
{
origin.x += dx, origin.y += dy;
}
void Inset(float dx, float dy)
{
origin.x += dx, origin.y += dy;
size.width -= dx*2, size.height -= dy*2;
}
};
class MemoryBuffer
@ -146,8 +146,8 @@ class Datafile
{
int ref_count;
FILE* file;
public:
public:
MemoryBuffer* data_buffer;
unsigned long data_size;
@ -165,13 +165,13 @@ public:
++ref_count;
return this;
}
void Release()
{
if (--ref_count==0)
if (--ref_count==0)
delete this;
}
int Open(const char* path)
{
file = fopen(path,"r");
@ -191,7 +191,7 @@ public:
//DPRINTF(0,"Datafile::Open() - Successfully opened '%s' %d bytes\n", path, data_size);
return 1;
}
int Read()
{
if ((file == NULL) || (data_buffer == NULL) || (data_size == 0)) {
@ -199,18 +199,18 @@ public:
Reset();
return 0;
}
fseek(file, 0, SEEK_SET);
fseek(file, 0, SEEK_SET);
if (fread((void*)data_buffer->data, 1, data_size, file) != data_size) {
DPRINTF(0,"Datafile::Read() - Didn't read to finish?");
Reset();
return 0;
}
//DPRINTF(0,"Datafile::Read() - Successfully read all %d bytes into buffer\n",data_size);
return 1;
}
void Close()
{
if (file) {
@ -218,7 +218,7 @@ public:
file = NULL;
}
}
void Reset()
{
Close();
@ -231,176 +231,176 @@ public:
class CGBuffer
{
Datafile file;
CGImageRef image_ref;
CGContextRef context_ref;
Datafile file;
CGImageRef image_ref;
CGContextRef context_ref;
int ref_count;
int ref_count;
void Init()
{
ref_count = 1;
buffer = NULL;
image_ref = NULL;
context_ref = NULL;
image_finished = false;
}
void Init()
{
ref_count = 1;
buffer = NULL;
image_ref = NULL;
context_ref = NULL;
image_finished = false;
}
bool CreateCGContext()
{
if (context_ref)
{
CGContextRelease(context_ref);
context_ref = NULL;
}
bool CreateCGContext()
{
if (context_ref)
{
CGContextRelease(context_ref);
context_ref = NULL;
}
if (buffer)
{
buffer->Release();
buffer = NULL;
}
if (buffer)
{
buffer->Release();
buffer = NULL;
}
size_t buffer_rowbytes = (size_t)(image_size.width * ((image_depth == 8) ? 1 : 4)); //CGImageGetBytesPerRow(image_ref);
buffer = MemoryBuffer::Create(buffer_rowbytes * (size_t)image_size.height);
size_t buffer_rowbytes = (size_t)(image_size.width * ((image_depth == 8) ? 1 : 4)); //CGImageGetBytesPerRow(image_ref);
if (!buffer)
return false;
buffer = MemoryBuffer::Create(buffer_rowbytes * (size_t)image_size.height);
CGColorSpaceRef colorspace_ref = (image_depth == 8) ? CGColorSpaceCreateDeviceGray() : CGColorSpaceCreateDeviceRGB();
if (!colorspace_ref)
return false;
CGImageAlphaInfo alpha_info = (image_depth == 8) ? kCGImageAlphaNone : kCGImageAlphaPremultipliedLast; //kCGImageAlphaLast; //RGBA format
if (!buffer)
return false;
context_ref = CGBitmapContextCreate(buffer->data, (size_t)image_size.width, (size_t)image_size.height, 8, buffer_rowbytes, colorspace_ref, alpha_info);
CGColorSpaceRef colorspace_ref = (image_depth == 8) ? CGColorSpaceCreateDeviceGray() : CGColorSpaceCreateDeviceRGB();
if (context_ref)
{
CGContextSetFillColorSpace(context_ref, colorspace_ref);
CGContextSetStrokeColorSpace(context_ref, colorspace_ref);
// move down, and flip vertically
if (!colorspace_ref)
return false;
CGImageAlphaInfo alpha_info = (image_depth == 8) ? kCGImageAlphaNone : kCGImageAlphaPremultipliedLast; //kCGImageAlphaLast; //RGBA format
context_ref = CGBitmapContextCreate(buffer->data, (size_t)image_size.width, (size_t)image_size.height, 8, buffer_rowbytes, colorspace_ref, alpha_info);
if (context_ref)
{
CGContextSetFillColorSpace(context_ref, colorspace_ref);
CGContextSetStrokeColorSpace(context_ref, colorspace_ref);
// move down, and flip vertically
// to turn postscript style coordinates to "screen style"
CGContextTranslateCTM(context_ref, 0.0, image_size.height);
CGContextScaleCTM(context_ref, 1.0, -1.0);
}
CGColorSpaceRelease(colorspace_ref);
colorspace_ref = NULL;
CGContextTranslateCTM(context_ref, 0.0, image_size.height);
CGContextScaleCTM(context_ref, 1.0, -1.0);
}
return !!context_ref;
}
CGColorSpaceRelease(colorspace_ref);
colorspace_ref = NULL;
return !!context_ref;
}
void RenderCGImage(const CGRect& dst_rect)
{
if (!context_ref || !image_ref)
return;
CGContextDrawImage(context_ref, dst_rect, image_ref);
}
void RenderCGImage(const CGRect& dst_rect)
{
if (!context_ref || !image_ref)
return;
CGContextDrawImage(context_ref, dst_rect, image_ref);
}
public:
MemoryBuffer* buffer;
CGSize image_size;
size_t image_depth;
bool image_finished;
CGBuffer(const char* path)
{
Init();
Open(path);
}
MemoryBuffer* buffer;
CGSize image_size;
size_t image_depth;
bool image_finished;
CGBuffer(const char* path)
{
Init();
Open(path);
}
~CGBuffer()
{
Reset();
}
{
Reset();
}
CGBuffer* Retain()
{
++ref_count;
return this;
}
CGBuffer* Retain()
{
++ref_count;
return this;
}
void Release()
{
if (--ref_count == 0)
delete this;
}
void Release()
{
if (--ref_count == 0)
delete this;
}
bool Open(const char* path)
{
file.Reset();
return file.Open(path);
}
bool Open(const char* path)
{
file.Reset();
return file.Open(path);
}
bool LoadJPEG()
{
if (!file.Read())
return false;
bool LoadJPEG()
{
if (!file.Read())
return false;
file.Close();
file.Close();
CGDataProviderRef src_provider_ref = CGDataProviderCreateWithData(this, file.data_buffer->data, file.data_size, NULL);
CGDataProviderRef src_provider_ref = CGDataProviderCreateWithData(this, file.data_buffer->data, file.data_size, NULL);
if (!src_provider_ref)
return false;
if (!src_provider_ref)
return false;
image_ref = CGImageCreateWithJPEGDataProvider(src_provider_ref, NULL, true, kCGRenderingIntentDefault);
image_ref = CGImageCreateWithJPEGDataProvider(src_provider_ref, NULL, true, kCGRenderingIntentDefault);
CGDataProviderRelease(src_provider_ref);
src_provider_ref = NULL;
CGDataProviderRelease(src_provider_ref);
src_provider_ref = NULL;
if (!image_ref)
return false;
if (!image_ref)
return false;
image_size = CGSizeMake(CGImageGetWidth(image_ref), CGImageGetHeight(image_ref));
image_depth = CGImageGetBitsPerPixel(image_ref);
return !!image_ref;
}
image_size = CGSizeMake(CGImageGetWidth(image_ref), CGImageGetHeight(image_ref));
image_depth = CGImageGetBitsPerPixel(image_ref);
bool Render()
{
if (!image_ref)
return false;
if (!CreateCGContext())
return false;
RenderCGImage(CGFrame(image_size));
CGContextRelease(context_ref);
context_ref = NULL;
return !!image_ref;
}
CGImageRelease(image_ref);
image_ref = NULL;
file.Reset();
bool Render()
{
if (!image_ref)
return false;
return true;
}
void Reset()
{
if (buffer)
{
buffer->Release();
buffer = NULL;
}
if (!CreateCGContext())
return false;
if (image_ref)
{
CGImageRelease(image_ref);
image_ref = NULL;
}
if (context_ref)
{
CGContextRelease(context_ref);
context_ref = NULL;
}
}
RenderCGImage(CGFrame(image_size));
CGContextRelease(context_ref);
context_ref = NULL;
CGImageRelease(image_ref);
image_ref = NULL;
file.Reset();
return true;
}
void Reset()
{
if (buffer)
{
buffer->Release();
buffer = NULL;
}
if (image_ref)
{
CGImageRelease(image_ref);
image_ref = NULL;
}
if (context_ref)
{
CGContextRelease(context_ref);
context_ref = NULL;
}
}
};

View File

@ -69,7 +69,7 @@ bool Asterism::getActive() const
*/
void Asterism::setActive(bool _active)
{
active = _active;
active = _active;
}
@ -106,7 +106,7 @@ void Asterism::unsetOverrideColor()
* if it should be drawn in the default color.
*/
bool Asterism::isColorOverridden() const
{
{
return useOverrideColor;
}

View File

@ -1,7 +1,7 @@
// asterism.h
//
// Copyright (C) 2001-2008, the Celestia Development Team
// Original version by Chris Laurel <claurel@gmail.com>
// Original version by Chris Laurel <claurel@gmail.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -28,13 +28,13 @@ class Asterism
int getChainCount() const;
const Chain& getChain(int) const;
bool getActive() const;
void setActive(bool _active);
bool getActive() const;
void setActive(bool _active);
Color getOverrideColor() const;
void setOverrideColor(Color c);
void unsetOverrideColor();
bool isColorOverridden() const;
void setOverrideColor(Color c);
void unsetOverrideColor();
bool isColorOverridden() const;
void addChain(Chain&);
@ -43,8 +43,8 @@ class Asterism
std::string i18nName;
std::vector<Chain*> chains;
bool active;
bool useOverrideColor;
bool active;
bool useOverrideColor;
Color color;
};

View File

@ -66,7 +66,7 @@ static const Quaterniond EQUATORIAL_TO_GALACTIC_ROTATION =
XRotation(degToRad(GALACTIC_INCLINATION)) *
ZRotation(degToRad(-GALACTIC_LONGITUDE_AT_NODE));
static const Matrix3d EQUATORIAL_TO_GALACTIC_MATRIX = EQUATORIAL_TO_GALACTIC_ROTATION.toRotationMatrix();
// epoch B1950: 22:09 UT on 21 Dec 1949
#define B1950 2433282.423
@ -395,7 +395,7 @@ void astro::anomaly(double meanAnomaly, double eccentricity,
{
double e, delta, err;
double tol = 0.00000001745;
int iterations = 20; // limit while() to maximum of 20 iterations.
int iterations = 20; // limit while() to maximum of 20 iterations.
e = meanAnomaly - 2*PI * (int) (meanAnomaly / (2*PI));
err = 1;
@ -573,8 +573,8 @@ const char* astro::Date::toCStr(Format format) const
{
case Locale:
case TZName:
snprintf(date, sizeof(date), "%04d %s %02d %02d:%02d:%02d %s",
year, _(MonthAbbrList[month-1]), day,
snprintf(date, sizeof(date), "%04d %s %02d %02d:%02d:%02d %s",
year, _(MonthAbbrList[month-1]), day,
hour, minute, (int)seconds, tzname.c_str());
break;
case UTCOffset:
@ -582,8 +582,8 @@ const char* astro::Date::toCStr(Format format) const
int sign = utc_offset < 0 ? -1:1;
int h_offset = sign * utc_offset / 3600;
int m_offset = (sign * utc_offset - h_offset * 3600) / 60;
snprintf(date, sizeof(date), "%04d %s %02d %02d:%02d:%02d %c%02d%02d",
year, _(MonthAbbrList[month-1]), day,
snprintf(date, sizeof(date), "%04d %s %02d %02d:%02d:%02d %c%02d%02d",
year, _(MonthAbbrList[month-1]), day,
hour, minute, (int)seconds, (sign==1?'+':'-'), h_offset, m_offset);
}
break;
@ -678,7 +678,7 @@ astro::Date::systemDate()
d.hour = gmt->tm_hour;
d.minute = gmt->tm_min;
d.seconds = (int) gmt->tm_sec;
return d;
}
@ -845,7 +845,7 @@ astro::TDBtoLocal(double tdb)
hourdiff = -24;
else
hourdiff = 24;
d.utc_offset = (hourdiff + d.hour - utcDate.hour) * 3600
d.utc_offset = (hourdiff + d.hour - utcDate.hour) * 3600
+ (d.minute - utcDate.minute) * 60;
}
d.tzname = localt->tm_isdst ? _("DST"): _("STD");
@ -920,7 +920,7 @@ bool astro::getLengthScale(string unitName, double& scale)
break;
}
}
return foundMatch;
}
@ -939,7 +939,7 @@ bool astro::getTimeScale(string unitName, double& scale)
break;
}
}
return foundMatch;
}
@ -958,7 +958,7 @@ bool astro::getAngleScale(string unitName, double& scale)
break;
}
}
return foundMatch;
}

View File

@ -67,7 +67,7 @@ namespace astro
const char* toCStr(Format format = Locale) const;
operator double() const;
static Date systemDate();
@ -171,7 +171,7 @@ namespace astro
double secondsToJulianDate(double);
double julianDateToSeconds(double);
bool isLengthUnit(string unitName);
bool isTimeUnit(string unitName);
bool isAngleUnit(string unitName);

View File

@ -45,12 +45,12 @@ class Atmosphere
Color upperColor;
Color skyColor;
Color sunsetColor;
float cloudHeight;
float cloudSpeed;
MultiResTexture cloudTexture;
MultiResTexture cloudNormalMap;
float mieCoeff;
float mieScaleHeight;
float miePhaseAsymmetry;

View File

@ -32,11 +32,11 @@ static void RenderArrow(float shaftLength,
{
float sintab[MaxArrowSections];
float costab[MaxArrowSections];
unsigned int i;
nSections = min(MaxArrowSections, nSections);
// Initialize the trig tables
for (i = 0; i < nSections; i++)
{
@ -44,7 +44,7 @@ static void RenderArrow(float shaftLength,
sintab[i] = (float) sin(theta);
costab[i] = (float) cos(theta);
}
// Render the circle at the botton of the arrow shaft
glBegin(GL_TRIANGLE_FAN);
glVertex3f(0.0f, 0.0f, 0.0f);
@ -54,7 +54,7 @@ static void RenderArrow(float shaftLength,
glVertex3f(shaftRadius * costab[n], shaftRadius * sintab[n], 0.0f);
}
glEnd();
// Render the arrow shaft
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= nSections; i++)
@ -64,17 +64,17 @@ static void RenderArrow(float shaftLength,
glVertex3f(shaftRadius * costab[n], shaftRadius * sintab[n], 0.0f);
}
glEnd();
// Render the annulus
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= nSections; i++)
{
unsigned int n = i % nSections;
glVertex3f(headRadius * costab[n], headRadius * sintab[n], shaftLength);
glVertex3f(headRadius * costab[n], headRadius * sintab[n], shaftLength);
glVertex3f(shaftRadius * costab[n], shaftRadius * sintab[n], shaftLength);
}
glEnd();
// Render the head of the arrow
glBegin(GL_TRIANGLE_FAN);
glVertex3f(0.0f, 0.0f, shaftLength + headLength);
@ -201,7 +201,7 @@ ArrowReferenceMark::render(Renderer* /* renderer */,
float shaftRadius = 0.010f;
float headRadius = 0.025f;
unsigned int nSections = 30;
glColor4f(color.red(), color.green(), color.blue(), opacity);
RenderArrow(shaftLength, headLength, shaftRadius, headRadius, nSections);
@ -278,13 +278,13 @@ AxesReferenceMark::render(Renderer* /* renderer */,
glPushMatrix();
glRotate(q.cast<float>());
glScalef(size, size, size);
glDisable(GL_LIGHTING);
#if 0
// Simple line axes
glBegin(GL_LINES);
glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(-1.0f, 0.0f, 0.0f);
@ -296,7 +296,7 @@ AxesReferenceMark::render(Renderer* /* renderer */,
glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
#endif
@ -306,7 +306,7 @@ AxesReferenceMark::render(Renderer* /* renderer */,
float headRadius = 0.025f;
unsigned int nSections = 30;
float labelScale = 0.1f;
// x-axis
glPushMatrix();
glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
@ -336,7 +336,7 @@ AxesReferenceMark::render(Renderer* /* renderer */,
glScalef(labelScale, labelScale, labelScale);
RenderZ();
glPopMatrix();
glPopMatrix();
glDisable(GL_DEPTH_TEST);

View File

@ -116,7 +116,7 @@ void Body::setDefaultProperties()
*/
const vector<string>& Body::getNames() const
{
return names;
return names;
}
@ -125,7 +125,7 @@ const vector<string>& Body::getNames() const
*/
string Body::getName(bool i18n) const
{
if (!i18n)
if (!i18n)
return names[0];
else
return names[localizedNameIndex];
@ -511,13 +511,13 @@ Vector3d Body::getVelocity(double tdb) const
Vector3d v = phase->orbit()->velocityAtTime(tdb);
v = orbitFrame->getOrientation(tdb).conjugate() * v + orbitFrame->getCenter().getVelocity(tdb);
if (!orbitFrame->isInertial())
{
if (!orbitFrame->isInertial())
{
Vector3d r = Selection(const_cast<Body*>(this)).getPosition(tdb).offsetFromKm(orbitFrame->getCenter().getPosition(tdb));
v += orbitFrame->getAngularVelocity(tdb).cross(r);
}
return v;
return v;
}
@ -531,10 +531,10 @@ Vector3d Body::getAngularVelocity(double tdb) const
ReferenceFrame* bodyFrame = phase->bodyFrame();
v = bodyFrame->getOrientation(tdb).conjugate() * v;
if (!bodyFrame->isInertial())
{
if (!bodyFrame->isInertial())
{
v += bodyFrame->getAngularVelocity(tdb);
}
}
return v;
}
@ -573,7 +573,7 @@ Quaterniond Body::getEclipticToFrame(double tdb) const
}
/*! Get a rotation that converts from the ecliptic frame to the body's
/*! Get a rotation that converts from the ecliptic frame to the body's
* mean equatorial frame.
*/
Quaterniond Body::getEclipticToEquatorial(double tdb) const
@ -609,7 +609,7 @@ Quaterniond Body::getEquatorialToBodyFixed(double tdb) const
Matrix4d Body::getBodyFixedToAstrocentric(double tdb) const
{
//return getEquatorialToBodyFixed(tdb).toMatrix4() * getLocalToAstrocentric(tdb);
Matrix4d m = Eigen::Transform<double, 3, Affine>(getEquatorialToBodyFixed(tdb)).matrix();
Matrix4d m = Eigen::Transform<double, 3, Affine>(getEquatorialToBodyFixed(tdb)).matrix();
return m * getLocalToAstrocentric(tdb);
}
@ -693,7 +693,7 @@ float Body::getLuminosity(float sunLuminosity,
double incidentEnergy = satIrradiance * circleArea(radius * 1000);
double reflectedEnergy = incidentEnergy * albedo;
// Compute the luminosity (i.e. power relative to solar power)
return (float) (reflectedEnergy / astro::SOLAR_POWER);
}
@ -884,7 +884,7 @@ Location* Body::findLocation(const string& name, bool i18n) const
// Compute the positions of locations on an irregular object using ray-mesh
// intersections. This is not automatically done when a location is added
// because it would force the loading of all meshes for objects with
// because it would force the loading of all meshes for objects with
// defined locations; on-demand (i.e. when the object becomes visible to
// a user) loading of meshes is preferred.
void Body::computeLocations()
@ -1129,7 +1129,7 @@ PlanetarySystem::~PlanetarySystem()
void PlanetarySystem::addAlias(Body* body, const string& alias)
{
assert(body->getSystem() == this);
objectIndex.insert(make_pair(alias, body));
}
@ -1141,7 +1141,7 @@ void PlanetarySystem::addAlias(Body* body, const string& alias)
void PlanetarySystem::removeAlias(const Body* body, const string& alias)
{
assert(body->getSystem() == this);
ObjectIndex::iterator iter = objectIndex.find(alias);
if (iter != objectIndex.end())
{
@ -1173,13 +1173,13 @@ void PlanetarySystem::addBodyToNameIndex(Body* body)
void PlanetarySystem::removeBodyFromNameIndex(const Body* body)
{
assert(body->getSystem() == this);
// Erase the object from the object indices
const vector<string>& names = body->getNames();
for (vector<string>::const_iterator iter = names.begin(); iter != names.end(); iter++)
{
removeAlias(body, *iter);
}
}
}
@ -1194,7 +1194,7 @@ void PlanetarySystem::removeBody(Body* body)
break;
}
}
removeBodyFromNameIndex(body);
}
@ -1217,7 +1217,7 @@ void PlanetarySystem::replaceBody(Body* oldBody, Body* newBody)
/*! Find a body with the specified name within a planetary system.
*
*
* deepSearch: if true, recursively search the systems of child objects
* i18n: if true, allow matching of localized body names. When responding
* to a user query, this flag should be true. In other cases--such
@ -1230,7 +1230,7 @@ Body* PlanetarySystem::find(const string& _name, bool deepSearch, bool i18n) con
if (firstMatch != objectIndex.end())
{
Body* matchedBody = firstMatch->second;
if (i18n)
{
return matchedBody;
@ -1293,13 +1293,13 @@ std::vector<std::string> PlanetarySystem::getCompletion(const std::string& _name
iter != objectIndex.end(); iter++)
{
const string& alias = iter->first;
if (UTF8StringCompare(alias, _name, _name_length) == 0)
{
completion.push_back(alias);
}
}
// Scan child objects
if (deepSearch)
{
@ -1313,7 +1313,7 @@ std::vector<std::string> PlanetarySystem::getCompletion(const std::string& _name
}
}
}
return completion;
}

View File

@ -41,7 +41,7 @@ class PlanetarySystem
Body* getPrimaryBody() const { return primary; };
int getSystemSize() const { return satellites.size(); };
Body* getBody(int i) const { return satellites[i]; };
void addAlias(Body* body, const std::string& alias);
void removeAlias(const Body* body, const std::string& alias);
void addBody(Body* body);
@ -65,7 +65,7 @@ class PlanetarySystem
private:
void addBodyToNameIndex(Body* body);
void removeBodyFromNameIndex(const Body* body);
private:
typedef std::map<std::string, Body*, UTF8StringOrderingPredicate> ObjectIndex;
@ -77,7 +77,7 @@ class PlanetarySystem
};
class RingSystem
class RingSystem
{
public:
float innerRadius;
@ -201,7 +201,7 @@ class Body
const Orbit* getOrbit(double tdb) const;
const ReferenceFrame* getBodyFrame(double tdb) const;
const RotationModel* getRotationModel(double tdb) const;
// Size methods
void setSemiAxes(const Eigen::Vector3f&);
Eigen::Vector3f getSemiAxes() const;
@ -321,7 +321,7 @@ class Body
SunDirection = 0x08,
VelocityVector = 0x10,
};
bool referenceMarkVisible(uint32) const;
uint32 getVisibleReferenceMarks() const;
void setVisibleReferenceMarks(uint32);

View File

@ -121,8 +121,8 @@ void CommandParser::error(const string errMsg)
static ObserverFrame::CoordinateSystem parseCoordinateSystem(const string& name)
{
// 'geographic' is a deprecated name for the bodyfixed coordinate system,
// maintained here for compatibility with older scripts.
// 'geographic' is a deprecated name for the bodyfixed coordinate system,
// maintained here for compatibility with older scripts.
if (compareIgnoringCase(name, "observer") == 0)
return ObserverFrame::ObserverLocal;
else if (compareIgnoringCase(name, "bodyfixed") == 0)
@ -558,31 +558,31 @@ Command* CommandParser::parseCommand()
cmd = new CommandOrbitFlags(setFlags, clearFlags);
}
else if (commandName == "constellations")
else if (commandName == "constellations")
{
string s;
CommandConstellations *cmdcons= new CommandConstellations();
CommandConstellations *cmdcons= new CommandConstellations();
if (paramList->getString("set", s))
parseConstellations(cmdcons, s, 1);
if (paramList->getString("clear", s))
parseConstellations(cmdcons, s, 0);
cmd = cmdcons;
parseConstellations(cmdcons, s, 0);
cmd = cmdcons;
}
else if (commandName == "constellationcolor")
else if (commandName == "constellationcolor")
{
string s;
CommandConstellationColor *cmdconcol= new CommandConstellationColor();
Vec3d colorv(1.0f, 0.0f, 0.0f);
CommandConstellationColor *cmdconcol= new CommandConstellationColor();
Vec3d colorv(1.0f, 0.0f, 0.0f);
paramList->getVector("color", colorv);
if (paramList->getString("set", s))
parseConstellationColor(cmdconcol, s, &colorv, 1);
if (paramList->getString("clear", s))
parseConstellationColor(cmdconcol, s, &colorv, 0);
cmd = cmdconcol;
parseConstellationColor(cmdconcol, s, &colorv, 0);
cmd = cmdconcol;
}
else if (commandName == "setvisibilitylimit")
{
@ -668,12 +668,12 @@ Command* CommandParser::parseCommand()
else if (compareIgnoringCase(symbolString, "disk") == 0)
rep = MarkerRepresentation(MarkerRepresentation::Disk);
}
string label;
paramList->getString("label", label);
rep.setSize((float) size);
rep.setColor(color);
rep.setLabel(label);
rep.setLabel(label);
bool occludable = true;
paramList->getBoolean("occludable", occludable);
@ -784,7 +784,7 @@ Command* CommandParser::parseCommand()
float alpha;
string filename;
int fitscreen;
if(!paramList->getNumber("duration", duration))
duration = 3;
if(!paramList->getNumber("xoffset", xoffset))
@ -804,7 +804,7 @@ Command* CommandParser::parseCommand()
else if (commandName == "verbosity")
{
int level;
if(!paramList->getNumber("level", level))
level = 2;
@ -923,12 +923,12 @@ int parseConstellations(CommandConstellations* cmd, string s, int act)
if (ttype == Tokenizer::TokenName)
{
string name = tokenizer.getNameValue();
if (compareIgnoringCase(name, "all") == 0 && act==1)
cmd->all=1;
else if (compareIgnoringCase(name, "all") == 0 && act==0)
cmd->none=1;
else
cmd->setValues(name,act);
if (compareIgnoringCase(name, "all") == 0 && act==1)
cmd->all=1;
else if (compareIgnoringCase(name, "all") == 0 && act==0)
cmd->none=1;
else
cmd->setValues(name,act);
ttype = tokenizer.nextToken();
if (ttype == Tokenizer::TokenBar)
@ -951,10 +951,10 @@ int parseConstellationColor(CommandConstellationColor* cmd, string s, Vec3d *col
Tokenizer tokenizer(&in);
int flags = 0;
if(!act)
cmd->unsetColor();
else
cmd->setColor((float)col->x, (float)col->y, (float)col->z);
if(!act)
cmd->unsetColor();
else
cmd->setColor((float)col->x, (float)col->y, (float)col->z);
Tokenizer::TokenType ttype = tokenizer.nextToken();
while (ttype != Tokenizer::TokenEnd)
@ -962,13 +962,13 @@ int parseConstellationColor(CommandConstellationColor* cmd, string s, Vec3d *col
if (ttype == Tokenizer::TokenName)
{
string name = tokenizer.getNameValue();
if (compareIgnoringCase(name, "all") == 0 && act==1)
cmd->all=1;
else if (compareIgnoringCase(name, "all") == 0 && act==0)
cmd->none=1;
else
cmd->setConstellations(name);
if (compareIgnoringCase(name, "all") == 0 && act==1)
cmd->all=1;
else if (compareIgnoringCase(name, "all") == 0 && act==0)
cmd->none=1;
else
cmd->setConstellations(name);
ttype = tokenizer.nextToken();
if (ttype == Tokenizer::TokenBar)
ttype = tokenizer.nextToken();

View File

@ -632,7 +632,7 @@ void CommandMark::process(ExecutionEnvironment& env)
if (env.getSimulation()->getUniverse() != NULL)
{
env.getSimulation()->getUniverse()->markObject(sel, rep, 1, occludable);
}
}
@ -867,7 +867,7 @@ void CommandSetRadius::process(ExecutionEnvironment& env)
{
body->setSemiAxes(body->getSemiAxes() * ((float) radius / iradius));
}
if (body->getRings() != NULL)
{
RingSystem rings(0.0f, 0.0f);
@ -1017,7 +1017,7 @@ void CommandScriptImage::process(ExecutionEnvironment& env)
}
// Verbosity command
CommandVerbosity::CommandVerbosity(int _level) :
CommandVerbosity::CommandVerbosity(int _level) :
level(_level)
{
}
@ -1033,9 +1033,9 @@ void CommandVerbosity::process(ExecutionEnvironment& env)
//====================================================
CommandConstellations::CommandConstellations()
{
numConstellations = 0;
all = 0;
none = 0;
numConstellations = 0;
all = 0;
none = 0;
}
void CommandConstellations::process(ExecutionEnvironment& env)
@ -1043,72 +1043,72 @@ void CommandConstellations::process(ExecutionEnvironment& env)
Universe* u = env.getSimulation()->getUniverse();
if (u != NULL)
{
AsterismList* asterisms = u->getAsterisms();
AsterismList* asterisms = u->getAsterisms();
for (AsterismList::const_iterator iter = asterisms->begin();
iter != asterisms->end(); iter++)
{
Asterism* ast = *iter;
if (none)
Asterism* ast = *iter;
if (none)
{
ast->setActive(0);
ast->setActive(0);
}
else if (all)
else if (all)
{
ast->setActive(1);
ast->setActive(1);
}
else
else
{
for (int i = 0; i < numConstellations; i++)
for (int i = 0; i < numConstellations; i++)
{
if (compareIgnoringCase(constellation[i],ast->getName(false)) == 0)
if (compareIgnoringCase(constellation[i],ast->getName(false)) == 0)
{
ast->setActive(active[i] != 0);
break;
}
ast->setActive(active[i] != 0);
break;
}
}
}
}
}
}
}
void CommandConstellations::setValues(string cons, int act)
{
int found = 0;
for (unsigned int j = 0; j < cons.size(); j++)
int found = 0;
for (unsigned int j = 0; j < cons.size(); j++)
{
if(cons[j] == '_')
cons[j] = ' ';
if(cons[j] == '_')
cons[j] = ' ';
}
// ignore all above 99 constellations
if (numConstellations == MAX_CONSTELLATIONS)
return;
for (int i = 0; i < numConstellations; i++)
// ignore all above 99 constellations
if (numConstellations == MAX_CONSTELLATIONS)
return;
for (int i = 0; i < numConstellations; i++)
{
if (compareIgnoringCase(constellation[i], cons) == 0 )
if (compareIgnoringCase(constellation[i], cons) == 0 )
{
active[i]=act;
found=1;
break;
}
}
active[i]=act;
found=1;
break;
}
}
if (!found)
if (!found)
{
constellation[numConstellations]=cons;
active[numConstellations]=act;
numConstellations++;
}
constellation[numConstellations]=cons;
active[numConstellations]=act;
numConstellations++;
}
}
CommandConstellationColor::CommandConstellationColor()
{
numConstellations=0;
all=0;
none=0;
unset=0;
numConstellations=0;
all=0;
none=0;
unset=0;
}
@ -1117,33 +1117,33 @@ void CommandConstellationColor::process(ExecutionEnvironment& env)
Universe* u = env.getSimulation()->getUniverse();
if (u != NULL)
{
AsterismList* asterisms = u->getAsterisms();
AsterismList* asterisms = u->getAsterisms();
for (AsterismList::const_iterator iter = asterisms->begin();
iter != asterisms->end(); iter++)
{
Asterism* ast = *iter;
if (none)
Asterism* ast = *iter;
if (none)
{
ast->unsetOverrideColor();
ast->unsetOverrideColor();
}
else if (all)
else if (all)
{
ast->setOverrideColor(rgb);
ast->setOverrideColor(rgb);
}
else
else
{
for(int i = 0; i < numConstellations; i++)
for(int i = 0; i < numConstellations; i++)
{
if (compareIgnoringCase(constellation[i],ast->getName(false)) ==0 )
if (compareIgnoringCase(constellation[i],ast->getName(false)) ==0 )
{
if(unset)
ast->unsetOverrideColor();
else
ast->setOverrideColor(rgb);
break;
}
if(unset)
ast->unsetOverrideColor();
else
ast->setOverrideColor(rgb);
break;
}
}
}
}
}
}
}
@ -1152,41 +1152,41 @@ void CommandConstellationColor::process(ExecutionEnvironment& env)
void CommandConstellationColor::setColor(float r, float g, float b)
{
rgb = Color(r, g, b);
unset = 0;
unset = 0;
}
void CommandConstellationColor::unsetColor()
{
unset = 1;
unset = 1;
}
void CommandConstellationColor::setConstellations(string cons)
{
int found=0;
for (unsigned int j = 0; j < cons.size(); j++)
int found=0;
for (unsigned int j = 0; j < cons.size(); j++)
{
if (cons[j] == '_')
cons[j] = ' ';
if (cons[j] == '_')
cons[j] = ' ';
}
// ignore all above 99 constellations
if (numConstellations == MAX_CONSTELLATIONS)
return;
for (int i=0; i<numConstellations; i++)
// ignore all above 99 constellations
if (numConstellations == MAX_CONSTELLATIONS)
return;
for (int i=0; i<numConstellations; i++)
{
if (compareIgnoringCase(constellation[i], cons) == 0)
if (compareIgnoringCase(constellation[i], cons) == 0)
{
found=1;
break;
}
}
found=1;
break;
}
}
if (!found)
if (!found)
{
constellation[numConstellations]=cons;
numConstellations++;
}
constellation[numConstellations]=cons;
numConstellations++;
}
}

View File

@ -395,11 +395,11 @@ class CommandConstellations : public InstantaneousCommand
public:
CommandConstellations();
void process(ExecutionEnvironment&);
void setValues(string cons, int act);
void setValues(string cons, int act);
std::string constellation[MAX_CONSTELLATIONS];
int active[MAX_CONSTELLATIONS];
int active[MAX_CONSTELLATIONS];
int numConstellations;
int all;
int all;
int none;
};
@ -409,14 +409,14 @@ class CommandConstellationColor : public InstantaneousCommand
public:
CommandConstellationColor();
void process(ExecutionEnvironment&);
void setConstellations(string cons);
void setColor(float r, float g, float b);
void unsetColor();
void setConstellations(string cons);
void setColor(float r, float g, float b);
void unsetColor();
std::string constellation[MAX_CONSTELLATIONS];
Color rgb;
int unset;
Color rgb;
int unset;
int numConstellations;
int all;
int all;
int none;
};

View File

@ -207,7 +207,7 @@ void Console::printf(const char* format, ...)
char buf[1024];
vsprintf(buf, format, args);
print(buf);
va_end(args);
}
#endif

View File

@ -61,7 +61,7 @@ class Console : public std::ostream
void newline();
#if 0
void printf(const char*, ...);
#endif
#endif
int getRow() const;
int getColumn() const;

View File

@ -125,19 +125,19 @@ Constellation::Constellation(const char *_name, const char *_genitive, const cha
Constellation* Constellation::getConstellation(unsigned int n)
{
if (constellations == NULL)
initialize();
initialize();
if (constellations == NULL ||
n >= sizeof(constellationInfo) / sizeof(constellationInfo[0]))
return NULL;
n >= sizeof(constellationInfo) / sizeof(constellationInfo[0]))
return NULL;
else
return constellations[n];
return constellations[n];
}
Constellation* Constellation::getConstellation(const string& name)
{
if (constellations == NULL)
initialize();
initialize();
for (unsigned int i = 0;
i < sizeof(constellationInfo) / sizeof(constellationInfo[0]);
@ -176,11 +176,11 @@ void Constellation::initialize()
if (constellations != NULL)
{
for (int i = 0; i < nConstellations; i++)
for (int i = 0; i < nConstellations; i++)
{
constellations[i] = new Constellation(constellationInfo[i].name,
constellationInfo[i].gen,
constellationInfo[i].abbr);
}
constellations[i] = new Constellation(constellationInfo[i].name,
constellationInfo[i].gen,
constellationInfo[i].abbr);
}
}
}

View File

@ -65,7 +65,7 @@ struct DDSurfaceDesc
DDPixelFormat format;
DDSCaps caps;
uint32 textureStage;
};

View File

@ -123,59 +123,59 @@ bool DeepSkyObject::pick(const Ray3d& ray,
void DeepSkyObject::hsv2rgb( float *r, float *g, float *b, float h, float s, float v )
{
// r,g,b values are from 0 to 1
// h = [0,360], s = [0,1], v = [0,1]
// r,g,b values are from 0 to 1
// h = [0,360], s = [0,1], v = [0,1]
int i;
float f, p, q, t;
int i;
float f, p, q, t;
if( s == 0 )
{
// achromatic (grey)
*r = *g = *b = v;
return;
}
if( s == 0 )
{
// achromatic (grey)
*r = *g = *b = v;
return;
}
h /= 60; // sector 0 to 5
i = (int) floorf( h );
f = h - (float) i; // factorial part of h
p = v * ( 1 - s );
q = v * ( 1 - s * f );
t = v * ( 1 - s * ( 1 - f ) );
h /= 60; // sector 0 to 5
i = (int) floorf( h );
f = h - (float) i; // factorial part of h
p = v * ( 1 - s );
q = v * ( 1 - s * f );
t = v * ( 1 - s * ( 1 - f ) );
switch( i )
{
case 0:
*r = v;
*g = t;
*b = p;
break;
case 1:
*r = q;
*g = v;
*b = p;
break;
case 2:
*r = p;
*g = v;
*b = t;
break;
case 3:
*r = p;
*g = q;
*b = v;
break;
case 4:
*r = t;
*g = p;
*b = v;
break;
default:
*r = v;
*g = p;
*b = q;
break;
}
switch( i )
{
case 0:
*r = v;
*g = t;
*b = p;
break;
case 1:
*r = q;
*g = v;
*b = p;
break;
case 2:
*r = p;
*g = v;
*b = t;
break;
case 3:
*r = p;
*g = q;
*b = v;
break;
case 4:
*r = t;
*g = p;
*b = v;
break;
default:
*r = v;
*g = p;
*b = q;
break;
}
}
bool DeepSkyObject::load(AssociativeArray* params, const string& resPath)
@ -194,7 +194,7 @@ bool DeepSkyObject::load(AssociativeArray* params, const string& resPath)
params->getLength("Distance", distance, KM_PER_LY);
params->getAngle("RA", RA, DEG_PER_HRA);
params->getAngle("Dec", dec);
Vector3d p = astro::equatorialToCelestialCart(RA, dec, distance);
setPosition(p);
}
@ -237,18 +237,18 @@ bool DeepSkyObject::load(AssociativeArray* params, const string& resPath)
}
setInfoURL(infoURL);
}
bool visible = true;
if (params->getBoolean("Visible", visible))
{
setVisible(visible);
}
bool clickable = true;
if (params->getBoolean("Clickable", clickable))
{
setClickable(clickable);
}
return true;
}

View File

@ -43,10 +43,10 @@ class DeepSkyObject
Eigen::Vector3d getPosition() const;
void setPosition(const Eigen::Vector3d&);
static void hsv2rgb( float*, float*, float*, float, float, float);
virtual const char* getType() const = 0;
static void hsv2rgb( float*, float*, float*, float, float, float);
virtual const char* getType() const = 0;
virtual void setType(const std::string&) = 0;
virtual size_t getDescription(char* buf, size_t bufLength) const;
@ -62,11 +62,11 @@ class DeepSkyObject
/*! Return the radius of the object. This radius will be displayed in the UI and
* should match the conventional astronomical definition of the object size.
*/
*/
float getRadius() const { return radius; }
void setRadius(float r);
virtual float getHalfMassRadius() const { return radius; }
float getAbsoluteMagnitude() const;
void setAbsoluteMagnitude(float);
@ -77,9 +77,9 @@ class DeepSkyObject
void setVisible(bool _visible) { visible = _visible; }
bool isClickable() const { return clickable; }
void setClickable(bool _clickable) { clickable = _clickable; }
virtual const char* getObjTypeName() const = 0;
virtual const char* getObjTypeName() const = 0;
virtual bool pick(const Ray3d& ray,
double& distanceToPicker,
@ -106,7 +106,7 @@ class DeepSkyObject
float radius;
float absMag;
std::string* infoURL;
bool visible : 1;
bool clickable : 1;
};

View File

@ -18,7 +18,7 @@ typedef float (*DisplacementMapFunc)(float, float, void*);
class DisplacementMap
{
public:
DisplacementMap(int w, int h);
DisplacementMap(int w, int h);
~DisplacementMap();
int getWidth() const { return width; };
int getHeight() const { return height; };
@ -26,7 +26,7 @@ class DisplacementMap
inline void setDisplacement(int x, int y, float d);
void generate(DisplacementMapFunc func, void* info = NULL);
void clear();
private:
int width;
int height;

View File

@ -286,9 +286,9 @@ bool DSODatabase::load(istream& in, const string& resourcePath)
DeepSkyObject* obj = NULL;
if (compareIgnoringCase(objType, "Galaxy") == 0)
obj = new Galaxy();
else if (compareIgnoringCase(objType, "Globular") == 0)
obj = new Globular();
else if (compareIgnoringCase(objType, "Nebula") == 0)
else if (compareIgnoringCase(objType, "Globular") == 0)
obj = new Globular();
else if (compareIgnoringCase(objType, "Nebula") == 0)
obj = new Nebula();
else if (compareIgnoringCase(objType, "OpenCluster") == 0)
obj = new OpenCluster();

View File

@ -80,7 +80,7 @@ private:
DeepSkyObject** catalogNumberIndex;
DSOOctree* octreeRoot;
uint32 nextAutoCatalogNumber;
double avgAbsMag;
};

View File

@ -18,7 +18,7 @@ class Execution
{
public:
Execution(CommandSequence&, ExecutionEnvironment&);
bool tick(double);
void reset(CommandSequence&);

View File

@ -1,5 +1,5 @@
// frame.cpp
//
//
// Reference frame base class.
//
// Copyright (C) 2003-2009, the Celestia Development Team
@ -57,11 +57,11 @@ static UniversalCoord rotate(const UniversalCoord& uc, const Quaterniond& q)
{
Matrix3d r = q.toRotationMatrix();
UniversalCoord uc1;
uc1.x = uc.x * BigFix(r(0, 0)) + uc.y * BigFix(r(1, 0)) + uc.z * BigFix(r(2, 0));
uc1.y = uc.x * BigFix(r(0, 1)) + uc.y * BigFix(r(1, 1)) + uc.z * BigFix(r(2, 1));
uc1.z = uc.x * BigFix(r(0, 2)) + uc.y * BigFix(r(1, 2)) + uc.z * BigFix(r(2, 2));
return uc1;
}
@ -152,7 +152,7 @@ ReferenceFrame::convertToAstrocentric(const Vector3d& p, double tjd) const
// bad if the center object is a galaxy
// what about locations?
return Vector3d::Zero();
}
}
}
@ -175,11 +175,11 @@ ReferenceFrame::getAngularVelocity(double tjd) const
if (std::abs(dq.w()) > 0.99999999)
return Vector3d::Zero();
else
return dq.vec().normalized() * (2.0 * acos(dq.w()) / ANGULAR_VELOCITY_DIFF_DELTA);
return dq.vec().normalized() * (2.0 * acos(dq.w()) / ANGULAR_VELOCITY_DIFF_DELTA);
#ifdef CELVEC
Vector3d v(dq.x, dq.y, dq.z);
v.normalize();
return v * (2.0 * acos(dq.w) / ANGULAR_VELOCITY_DIFF_DELTA);
v.normalize();
return v * (2.0 * acos(dq.w) / ANGULAR_VELOCITY_DIFF_DELTA);
#endif
}
@ -216,7 +216,7 @@ getFrameDepth(const Selection& sel, unsigned int depth, unsigned int maxDepth,
if (orbitFrameDepth > maxDepth)
return orbitFrameDepth;
}
if (body->getBodyFrame(0.0) != NULL && frameType == ReferenceFrame::OrientationFrame)
{
bodyFrameDepth = body->getBodyFrame(0.0)->nestingDepth(depth + 1, maxDepth, frameType);
@ -238,7 +238,7 @@ J2000EclipticFrame::J2000EclipticFrame(Selection center) :
bool
J2000EclipticFrame::isInertial() const
{
return true;
return true;
}
@ -269,7 +269,7 @@ J2000EquatorFrame::getOrientation(double /* tjd */) const
bool
J2000EquatorFrame::isInertial() const
{
return true;
return true;
}
@ -318,11 +318,11 @@ BodyFixedFrame::getOrientation(double tjd) const
Vector3d
BodyFixedFrame::getAngularVelocity(double tjd) const
{
switch (fixObject.getType())
{
case Selection::Type_Body:
switch (fixObject.getType())
{
case Selection::Type_Body:
return fixObject.body()->getAngularVelocity(tjd);
case Selection::Type_Star:
case Selection::Type_Star:
return fixObject.star()->getRotationModel()->angularVelocityAtTime(tjd);
case Selection::Type_Location:
if (fixObject.location()->getParentBody())
@ -331,14 +331,14 @@ BodyFixedFrame::getAngularVelocity(double tjd) const
return Vector3d::Zero();
default:
return Vector3d::Zero();
}
}
}
bool
BodyFixedFrame::isInertial() const
{
return false;
return false;
}
@ -403,12 +403,12 @@ BodyMeanEquatorFrame::getOrientation(double tjd) const
Vector3d
BodyMeanEquatorFrame::getAngularVelocity(double tjd) const
{
if (isFrozen)
{
if (isFrozen)
{
return Vector3d::Zero();
}
else
{
}
else
{
if (equatorObject.body() != NULL)
{
return equatorObject.body()->getBodyFrame(tjd)->getAngularVelocity(tjd);
@ -417,32 +417,32 @@ BodyMeanEquatorFrame::getAngularVelocity(double tjd) const
{
return Vector3d::Zero();
}
}
}
}
bool
BodyMeanEquatorFrame::isInertial() const
{
if (isFrozen)
{
return true;
}
else
{
// Although the mean equator of an object may vary slightly due to precession,
// treat it as an inertial frame as long as the body frame of the object is
// also inertial.
if (equatorObject.body() != NULL)
{
if (isFrozen)
{
return true;
}
else
{
// Although the mean equator of an object may vary slightly due to precession,
// treat it as an inertial frame as long as the body frame of the object is
// also inertial.
if (equatorObject.body() != NULL)
{
// TIMELINE-TODO: isInertial must take a time argument.
return equatorObject.body()->getBodyFrame(0.0)->isInertial();
}
return equatorObject.body()->getBodyFrame(0.0)->isInertial();
}
else
{
return true;
}
}
}
}
@ -471,9 +471,9 @@ CachingFrame::CachingFrame(Selection _center) :
ReferenceFrame(_center),
lastTime(-1.0e50),
lastOrientation(Quaterniond::Identity()),
lastAngularVelocity(0.0, 0.0, 0.0),
orientationCacheValid(false),
angularVelocityCacheValid(false)
lastAngularVelocity(0.0, 0.0, 0.0),
orientationCacheValid(false),
angularVelocityCacheValid(false)
{
}
@ -481,39 +481,39 @@ CachingFrame::CachingFrame(Selection _center) :
Quaterniond
CachingFrame::getOrientation(double tjd) const
{
if (tjd != lastTime)
{
lastTime = tjd;
lastOrientation = computeOrientation(tjd);
orientationCacheValid = true;
angularVelocityCacheValid = false;
}
else if (!orientationCacheValid)
{
lastOrientation = computeOrientation(tjd);
orientationCacheValid = true;
}
if (tjd != lastTime)
{
lastTime = tjd;
lastOrientation = computeOrientation(tjd);
orientationCacheValid = true;
angularVelocityCacheValid = false;
}
else if (!orientationCacheValid)
{
lastOrientation = computeOrientation(tjd);
orientationCacheValid = true;
}
return lastOrientation;
return lastOrientation;
}
Vector3d CachingFrame::getAngularVelocity(double tjd) const
{
if (tjd != lastTime)
{
lastTime = tjd;
lastAngularVelocity = computeAngularVelocity(tjd);
orientationCacheValid = false;
angularVelocityCacheValid = true;
}
else if (!angularVelocityCacheValid)
{
lastAngularVelocity = computeAngularVelocity(tjd);
angularVelocityCacheValid = true;
}
if (tjd != lastTime)
{
lastTime = tjd;
lastAngularVelocity = computeAngularVelocity(tjd);
orientationCacheValid = false;
angularVelocityCacheValid = true;
}
else if (!angularVelocityCacheValid)
{
lastAngularVelocity = computeAngularVelocity(tjd);
angularVelocityCacheValid = true;
}
return lastAngularVelocity;
return lastAngularVelocity;
}
@ -525,10 +525,10 @@ Vector3d CachingFrame::computeAngularVelocity(double tjd) const
{
Quaterniond q0 = getOrientation(tjd);
// Call computeOrientation() instead of getOrientation() so that we
// don't affect the cached value.
// TODO: check the valid ranges of the frame to make sure that
// jd+dt is still in range.
// Call computeOrientation() instead of getOrientation() so that we
// don't affect the cached value.
// TODO: check the valid ranges of the frame to make sure that
// jd+dt is still in range.
Quaterniond q1 = computeOrientation(tjd + ANGULAR_VELOCITY_DIFF_DELTA);
Quaterniond dq = q0.conjugate() * q1;
@ -639,7 +639,7 @@ TwoVectorFrame::computeOrientation(double tjd) const
}
// The axes are the rows of a rotation matrix. The getOrientation
// method must return the quaternion representation of the
// method must return the quaternion representation of the
// orientation, so convert the rotation matrix to a quaternion now.
Quatd q = Quatd::matrixToQuaternion(Mat3d(v[0], v[1], v[2]));
#endif
@ -679,10 +679,10 @@ TwoVectorFrame::computeOrientation(double tjd) const
bool
TwoVectorFrame::isInertial() const
{
// Although it's possible to specify an inertial two-vector frame, we won't
// bother trying to distinguish these cases: all two-vector frames will be
// treated as non-inertial.
return true;
// Although it's possible to specify an inertial two-vector frame, we won't
// bother trying to distinguish these cases: all two-vector frames will be
// treated as non-inertial.
return true;
}
@ -735,7 +735,7 @@ FrameVector::operator=(const FrameVector& fv)
frame = fv.frame;
if (frame != NULL)
frame->addRef();
return *this;
}

View File

@ -1,5 +1,5 @@
// frame.h
//
//
// Copyright (C) 2003-2009, the Celestia Development Team
// Original version by Chris Laurel <claurel@gmail.com>
//
@ -31,7 +31,7 @@ class ReferenceFrame
int addRef() const;
int release() const;
UniversalCoord convertFromUniversal(const UniversalCoord& uc, double tjd) const;
UniversalCoord convertToUniversal(const UniversalCoord& uc, double tjd) const;
Eigen::Quaterniond convertFromUniversal(const Eigen::Quaterniond& q, double tjd) const;
@ -39,13 +39,13 @@ class ReferenceFrame
Eigen::Vector3d convertFromAstrocentric(const Eigen::Vector3d& p, double tjd) const;
Eigen::Vector3d convertToAstrocentric(const Eigen::Vector3d& p, double tjd) const;
Selection getCenter() const;
virtual Eigen::Quaterniond getOrientation(double tjd) const = 0;
virtual Eigen::Vector3d getAngularVelocity(double tdb) const;
virtual bool isInertial() const = 0;
virtual bool isInertial() const = 0;
enum FrameType
{
@ -85,8 +85,8 @@ class CachingFrame : public ReferenceFrame
mutable double lastTime;
mutable Eigen::Quaterniond lastOrientation;
mutable Eigen::Vector3d lastAngularVelocity;
mutable bool orientationCacheValid;
mutable bool angularVelocityCacheValid;
mutable bool orientationCacheValid;
mutable bool angularVelocityCacheValid;
};
@ -102,7 +102,7 @@ class J2000EclipticFrame : public ReferenceFrame
return Eigen::Quaterniond::Identity();
}
virtual bool isInertial() const;
virtual bool isInertial() const;
virtual unsigned int nestingDepth(unsigned int depth,
unsigned int maxDepth,
@ -117,7 +117,7 @@ class J2000EquatorFrame : public ReferenceFrame
J2000EquatorFrame(Selection center);
virtual ~J2000EquatorFrame() {};
Eigen::Quaterniond getOrientation(double tjd) const;
virtual bool isInertial() const;
virtual bool isInertial() const;
virtual unsigned int nestingDepth(unsigned int depth,
unsigned int maxDepth,
FrameType frameType) const;
@ -137,7 +137,7 @@ class BodyFixedFrame : public ReferenceFrame
virtual ~BodyFixedFrame() {};
Eigen::Quaterniond getOrientation(double tjd) const;
virtual Eigen::Vector3d getAngularVelocity(double tjd) const;
virtual bool isInertial() const;
virtual bool isInertial() const;
virtual unsigned int nestingDepth(unsigned int depth,
unsigned int maxDepth,
FrameType frameType) const;
@ -155,7 +155,7 @@ class BodyMeanEquatorFrame : public ReferenceFrame
virtual ~BodyMeanEquatorFrame() {};
Eigen::Quaterniond getOrientation(double tjd) const;
virtual Eigen::Vector3d getAngularVelocity(double tjd) const;
virtual bool isInertial() const;
virtual bool isInertial() const;
virtual unsigned int nestingDepth(unsigned int depth,
unsigned int maxDepth,
FrameType frameType) const;
@ -193,7 +193,7 @@ class FrameVector
RelativeVelocity,
ConstantVector,
};
static FrameVector createRelativePositionVector(const Selection& _observer,
const Selection& _target);
static FrameVector createRelativeVelocityVector(const Selection& _observer,
@ -229,7 +229,7 @@ class TwoVectorFrame : public CachingFrame
* the primary and secondary vectors:
* 1 = x, 2 = y, 3 = z, -1 = -x, -2 = -y, -3 = -z
*/
TwoVectorFrame(Selection center,
TwoVectorFrame(Selection center,
const FrameVector& prim,
int primAxis,
const FrameVector& sec,
@ -237,7 +237,7 @@ class TwoVectorFrame : public CachingFrame
virtual ~TwoVectorFrame() {};
Eigen::Quaterniond computeOrientation(double tjd) const;
virtual bool isInertial() const;
virtual bool isInertial() const;
virtual unsigned int nestingDepth(unsigned int depth,
unsigned int maxDepth,
FrameType frameType) const;

View File

@ -30,7 +30,7 @@
* parents.
*
* The FrameTree hiearchy is designed for fast visibility culling. There are
* two values stored in each node for this purpose: the bounding sphere
* two values stored in each node for this purpose: the bounding sphere
* radius, and the maximum child object radius. The bounding sphere is large
* enough to contain the orbits of all child objects, as well as the child
* objects themselves. Change tracking is performed whenever the frame tree

View File

@ -47,7 +47,7 @@ float Galaxy::lightGain = 0.0f;
bool operator< (const Blob& b1, const Blob& b2)
{
return (b1.position.squaredNorm() < b2.position.squaredNorm());
return (b1.position.squaredNorm() < b2.position.squaredNorm());
}
typedef vector<Blob, aligned_allocator<Blob> > BlobVector;
@ -164,39 +164,39 @@ void Galaxy::setType(const string& typeStr)
if (!formsInitialized)
InitializeForms();
if (customTmpName != NULL)
{
form = buildGalacticForms("models/" + *customTmpName);
}
else
{
switch (type)
{
case S0:
case Sa:
case Sb:
case Sc:
case SBa:
case SBb:
case SBc:
form = spiralForms[type - S0];
break;
case E0:
case E1:
case E2:
case E3:
case E4:
case E5:
case E6:
case E7:
form = ellipticalForms[type - E0];
//form = NULL;
break;
case Irr:
form = irregularForm;
break;
}
}
if (customTmpName != NULL)
{
form = buildGalacticForms("models/" + *customTmpName);
}
else
{
switch (type)
{
case S0:
case Sa:
case Sb:
case Sc:
case SBa:
case SBb:
case SBc:
form = spiralForms[type - S0];
break;
case E0:
case E1:
case E2:
case E3:
case E4:
case E5:
case E6:
case E7:
form = ellipticalForms[type - E0];
//form = NULL;
break;
case Irr:
form = irregularForm;
break;
}
}
}
@ -228,7 +228,7 @@ bool Galaxy::pick(const Ray3d& ray,
{
if (!isVisible())
return false;
// The ellipsoid should be slightly larger to compensate for the fact
// that blobs are considered points when galaxies are built, but have size
// when they are drawn.
@ -251,9 +251,9 @@ bool Galaxy::load(AssociativeArray* params, const string& resPath)
params->getNumber("Detail", detail);
setDetail((float) detail);
string customTmpName;
if(params->getString("CustomTemplate",customTmpName))
setCustomTmpName(customTmpName);
string customTmpName;
if(params->getString("CustomTemplate",customTmpName))
setCustomTmpName(customTmpName);
string typeName;
params->getString("Type", typeName);
@ -518,95 +518,95 @@ void Galaxy::setLightGain(float lg)
GalacticForm* buildGalacticForms(const std::string& filename)
{
Blob b;
Blob b;
BlobVector* galacticPoints = new BlobVector;
// Load templates in standard .png format
int width, height, rgb, j = 0, kmin = 9;
unsigned char value;
float h = 0.75f;
Image* img;
img = LoadPNGImage(filename);
if (img == NULL)
{
cout<<"\nThe galaxy template *** "<<filename<<" *** could not be loaded!\n\n";
return NULL;
}
width = img->getWidth();
height = img->getHeight();
rgb = img->getComponents();
// Load templates in standard .png format
int width, height, rgb, j = 0, kmin = 9;
unsigned char value;
float h = 0.75f;
Image* img;
img = LoadPNGImage(filename);
if (img == NULL)
{
cout<<"\nThe galaxy template *** "<<filename<<" *** could not be loaded!\n\n";
return NULL;
}
width = img->getWidth();
height = img->getHeight();
rgb = img->getComponents();
for (int i = 0; i < width * height; i++)
{
value = img->getPixels()[rgb * i];
if (value > 10)
{
float x, y, z, r2, yy, prob;
z = floor(i /(float) width);
x = (i - width * z - 0.5f * (width - 1)) / (float) width;
z = (0.5f * (height - 1) - z) / (float) height;
x += Mathf::sfrand() * 0.008f;
z += Mathf::sfrand() * 0.008f;
r2 = x * x + z * z;
for (int i = 0; i < width * height; i++)
{
value = img->getPixels()[rgb * i];
if (value > 10)
{
float x, y, z, r2, yy, prob;
z = floor(i /(float) width);
x = (i - width * z - 0.5f * (width - 1)) / (float) width;
z = (0.5f * (height - 1) - z) / (float) height;
x += Mathf::sfrand() * 0.008f;
z += Mathf::sfrand() * 0.008f;
r2 = x * x + z * z;
if ( strcmp ( filename.c_str(), "models/E0.png") != 0 )
{
float y0 = 0.5f * MAX_SPIRAL_THICKNESS * sqrt((float)value/256.0f) * exp(- 5.0f * r2);
float B, yr;
B = (r2 > 0.35f)? 1.0f: 0.75f; // the darkness of the "dust lane", 0 < B < 1
float p0 = 1.0f - B * exp(-h * h); // the uniform reference probability, envelopping prob*p0.
do
{
// generate "thickness" y of spirals with emulation of a dust lane
// in galctic plane (y=0)
if ( strcmp ( filename.c_str(), "models/E0.png") != 0 )
{
float y0 = 0.5f * MAX_SPIRAL_THICKNESS * sqrt((float)value/256.0f) * exp(- 5.0f * r2);
float B, yr;
B = (r2 > 0.35f)? 1.0f: 0.75f; // the darkness of the "dust lane", 0 < B < 1
float p0 = 1.0f - B * exp(-h * h); // the uniform reference probability, envelopping prob*p0.
do
{
// generate "thickness" y of spirals with emulation of a dust lane
// in galctic plane (y=0)
yr = Mathf::sfrand() * h;
prob = (1.0f - B * exp(-yr * yr))/p0;
yr = Mathf::sfrand() * h;
prob = (1.0f - B * exp(-yr * yr))/p0;
} while (Mathf::frand() > prob);
b.brightness = value * prob;
y = y0 * yr / h;
}
else
{
// generate spherically symmetric distribution from E0.png
do
{
yy = Mathf::sfrand();
float ry2 = 1.0f - yy * yy;
prob = ry2 > 0? sqrt(ry2): 0.0f;
} while (Mathf::frand() > prob);
y = yy * sqrt(0.25f - r2) ;
b.brightness = value;
kmin = 12;
}
} while (Mathf::frand() > prob);
b.brightness = value * prob;
y = y0 * yr / h;
}
else
{
// generate spherically symmetric distribution from E0.png
do
{
yy = Mathf::sfrand();
float ry2 = 1.0f - yy * yy;
prob = ry2 > 0? sqrt(ry2): 0.0f;
} while (Mathf::frand() > prob);
y = yy * sqrt(0.25f - r2) ;
b.brightness = value;
kmin = 12;
}
b.position = Vector4f(x, y, z, 1.0f);
unsigned int rr = (unsigned int) (b.position.head(3).norm() * 511);
b.colorIndex = rr < 256? rr: 255;
galacticPoints->push_back(b);
j++;
}
}
b.position = Vector4f(x, y, z, 1.0f);
unsigned int rr = (unsigned int) (b.position.head(3).norm() * 511);
b.colorIndex = rr < 256? rr: 255;
galacticPoints->push_back(b);
j++;
}
}
delete img;
galacticPoints->reserve(j);
galacticPoints->reserve(j);
// sort to start with the galaxy center region (x^2 + y^2 + z^2 ~ 0), such that
// the biggest (brightest) sprites will be localized there!
// sort to start with the galaxy center region (x^2 + y^2 + z^2 ~ 0), such that
// the biggest (brightest) sprites will be localized there!
sort(galacticPoints->begin(), galacticPoints->end());
sort(galacticPoints->begin(), galacticPoints->end());
// reshuffle the galaxy points randomly...except the first kmin+1 in the center!
// the higher that number the stronger the central "glow"
// reshuffle the galaxy points randomly...except the first kmin+1 in the center!
// the higher that number the stronger the central "glow"
random_shuffle( galacticPoints->begin() + kmin, galacticPoints->end());
random_shuffle( galacticPoints->begin() + kmin, galacticPoints->end());
GalacticForm* galacticForm = new GalacticForm();
galacticForm->blobs = galacticPoints;
GalacticForm* galacticForm = new GalacticForm();
galacticForm->blobs = galacticPoints;
galacticForm->scale = Vector3f::Ones();
return galacticForm;
return galacticForm;
}
@ -625,7 +625,7 @@ void InitializeForms()
//convert Hue to RGB
DeepSkyObject::hsv2rgb(&rr, &gg, &bb, hue, 0.20f, 1.0f);
DeepSkyObject::hsv2rgb(&rr, &gg, &bb, hue, 0.20f, 1.0f);
Color c(rr, gg, bb);
colorTable[i] = Vector3f(c.red(), c.green(), c.blue());
}
@ -652,20 +652,20 @@ void InitializeForms()
float ell = 1.0f - (float) eform / 8.0f;
// note the correct x,y-alignment of 'ell' scaling!!
// build all elliptical templates from rescaling E0
// build all elliptical templates from rescaling E0
ellipticalForms[eform] = buildGalacticForms("models/E0.png");
if (*ellipticalForms)
ellipticalForms[eform]->scale = Vector3f(ell, ell, 1.0f);
ellipticalForms[eform] = buildGalacticForms("models/E0.png");
if (*ellipticalForms)
ellipticalForms[eform]->scale = Vector3f(ell, ell, 1.0f);
// account for reddening of ellipticals rel.to spirals
if (*ellipticalForms)
{
unsigned int nPoints = (unsigned int) (ellipticalForms[eform]->blobs->size());
for (unsigned int i = 0; i < nPoints; ++i)
{
(*ellipticalForms[eform]->blobs)[i].colorIndex = (unsigned int) ceil(0.76f * (*ellipticalForms[eform]->blobs)[i].colorIndex);
}
unsigned int nPoints = (unsigned int) (ellipticalForms[eform]->blobs->size());
for (unsigned int i = 0; i < nPoints; ++i)
{
(*ellipticalForms[eform]->blobs)[i].colorIndex = (unsigned int) ceil(0.76f * (*ellipticalForms[eform]->blobs)[i].colorIndex);
}
}
}
//Irregular Galaxies
@ -688,7 +688,7 @@ void InitializeForms()
b.position = Vector4f(p.x, p.y, p.z, 1.0f);
b.brightness = 64u;
unsigned int rr = (unsigned int) (r * 511);
b.colorIndex = rr < 256? rr: 255;
b.colorIndex = rr < 256? rr: 255;
irregularPoints->push_back(b);
++ip;
}

View File

@ -73,7 +73,7 @@ class Galaxy : public DeepSkyObject
virtual unsigned int getRenderMask() const;
virtual unsigned int getLabelMask() const;
virtual const char* getObjTypeName() const;
public:

View File

@ -32,14 +32,14 @@ public:
* distance unmodified.
*/
virtual bool pick(const Ray3d& r, double& distance) const = 0;
virtual bool isOpaque() const = 0;
virtual bool isNormalized() const
{
return true;
}
/*! Return true if the specified texture map type is used at
* all within this geometry object. This information is used
* to decide whether multiple rendering passes are required.

View File

@ -39,7 +39,7 @@ void GLContext::init(const vector<string>& ignoreExt)
if (extensionsString != NULL)
{
char* next = extensionsString;
while (*next != '\0')
{
while (*next != '\0' && *next != ' ')

View File

@ -21,7 +21,7 @@ class GLContext
GLContext();
virtual ~GLContext();
enum GLRenderPath
enum GLRenderPath
{
GLPath_Basic = 0,
GLPath_Multitexture = 1,
@ -42,7 +42,7 @@ class GLContext
};
void init(const std::vector<std::string>& ignoreExt);
GLRenderPath getRenderPath() const { return renderPath; };
bool setRenderPath(GLRenderPath);
bool renderPathSupported(GLRenderPath) const;

View File

@ -3,9 +3,9 @@
// Copyright (C) 2008, Celestia Development Team
// Initial code by Dr. Fridger Schrempp <fridger.schrempp@desy.de>
//
// Simulation of globular clusters, theoretical framework by
// Simulation of globular clusters, theoretical framework by
// Ivan King, Astron. J. 67 (1962) 471; ibid. 71 (1966) 64
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
@ -33,16 +33,16 @@
using namespace Eigen;
using namespace std;
static int cntrTexWidth = 512, cntrTexHeight = 512;
static int cntrTexWidth = 512, cntrTexHeight = 512;
static int starTexWidth = 128, starTexHeight = 128;
static Color colorTable[256];
static const unsigned int GLOBULAR_POINTS = 8192;
static const float LumiShape = 3.0f, Lumi0 = exp(-LumiShape);
// Reference values ( = data base averages) of core radius, King concentration
// and mu25 isophote radius:
static const float R_c_ref = 0.83f, C_ref = 2.1f, R_mu25 = 40.32f;
// Reference values ( = data base averages) of core radius, King concentration
// and mu25 isophote radius:
static const float R_c_ref = 0.83f, C_ref = 2.1f, R_mu25 = 40.32f;
// min/max c-values of globular cluster data
@ -65,18 +65,18 @@ static bool formsInitialized = false;
static bool decreasing (const GBlob& b1, const GBlob& b2)
{
return (b1.radius_2d > b2.radius_2d);
return (b1.radius_2d > b2.radius_2d);
}
static void GlobularTextureEval(float u, float v, float /*w*/, unsigned char *pixel)
{
// use an exponential luminosity shape for the individual stars
// use an exponential luminosity shape for the individual stars
// giving sort of a halo for the brighter (i.e.bigger) stars.
float lumi = exp(- LumiShape * sqrt(u * u + v * v)) - Lumi0;
if (lumi <= 0.0f)
lumi = 0.0f;
if (lumi <= 0.0f)
lumi = 0.0f;
int pixVal = (int) (lumi * 255.99f);
#ifdef HDR_COMPRESS
@ -94,91 +94,91 @@ static void GlobularTextureEval(float u, float v, float /*w*/, unsigned char *pi
float relStarDensity(float eta)
{
/*! As alpha blending weight (relStarDensity) I take the theoretical
* number of globular stars in 2d projection at a distance
* rho = r / r_c = eta * r_t from the center (cf. King_1962's Eq.(18)),
* divided by the area = PI * rho * rho . This number density of stars
* I normalized to 1 at rho=0.
/*! As alpha blending weight (relStarDensity) I take the theoretical
* number of globular stars in 2d projection at a distance
* rho = r / r_c = eta * r_t from the center (cf. King_1962's Eq.(18)),
* divided by the area = PI * rho * rho . This number density of stars
* I normalized to 1 at rho=0.
* The resulting blending weight increases strongly -> 1 if the
* 2d number density of stars rises, i.e for rho -> 0.
*/
* The resulting blending weight increases strongly -> 1 if the
* 2d number density of stars rises, i.e for rho -> 0.
*/
// Since the central "cloud" is due to lack of visual resolution,
// rather than cluster morphology, we limit it's size by
// taking max(C_ref, CBin). Smaller c gives a shallower distribution!
float rRatio = max(RRatio_min, RRatio);
float Xi = 1.0f / sqrt(1.0f + rRatio * rRatio);
float XI2 = Xi * Xi;
float rho2 = 1.0001f + eta * eta * rRatio * rRatio; //add 1e-4 as regulator near rho=0
// rather than cluster morphology, we limit it's size by
// taking max(C_ref, CBin). Smaller c gives a shallower distribution!
return ((log(rho2) + 4.0f * (1.0f - sqrt(rho2)) * Xi) / (rho2 - 1.0f) + XI2) / (1.0f - 2.0f * Xi + XI2);
float rRatio = max(RRatio_min, RRatio);
float Xi = 1.0f / sqrt(1.0f + rRatio * rRatio);
float XI2 = Xi * Xi;
float rho2 = 1.0001f + eta * eta * rRatio * rRatio; //add 1e-4 as regulator near rho=0
return ((log(rho2) + 4.0f * (1.0f - sqrt(rho2)) * Xi) / (rho2 - 1.0f) + XI2) / (1.0f - 2.0f * Xi + XI2);
}
static void CenterCloudTexEval(float u, float v, float /*w*/, unsigned char *pixel)
{
/*! For reasons of speed, calculate central "cloud" texture only for
* 8 bins of King_1962 concentration, c = CBin, XI(CBin), RRatio(CBin).
*/
// Skyplane projected King_1962 profile at center (rho = eta = 0):
float c2d = 1.0f - XI;
float eta = sqrt(u * u + v * v); // u,v = (-1..1)
// eta^2 = u * u + v * v = 1 is the biggest circle fitting into the quadratic
// procedural texture. Hence clipping
if (eta >= 1.0f)
eta = 1.0f;
{
/*! For reasons of speed, calculate central "cloud" texture only for
* 8 bins of King_1962 concentration, c = CBin, XI(CBin), RRatio(CBin).
*/
// eta = 1 corresponds to tidalRadius:
// Skyplane projected King_1962 profile at center (rho = eta = 0):
float c2d = 1.0f - XI;
float rho = eta * RRatio;
float rho2 = 1.0f + rho * rho;
float eta = sqrt(u * u + v * v); // u,v = (-1..1)
// eta^2 = u * u + v * v = 1 is the biggest circle fitting into the quadratic
// procedural texture. Hence clipping
if (eta >= 1.0f)
eta = 1.0f;
// eta = 1 corresponds to tidalRadius:
float rho = eta * RRatio;
float rho2 = 1.0f + rho * rho;
// Skyplane projected King_1962 profile (Eq.(14)), vanishes for eta = 1:
// i.e. absolutely no globular stars for r > tidalRadius:
float profile_2d = (1.0f / sqrt(rho2) - 1.0f)/c2d + 1.0f ;
profile_2d = profile_2d * profile_2d;
// i.e. absolutely no globular stars for r > tidalRadius:
float profile_2d = (1.0f / sqrt(rho2) - 1.0f)/c2d + 1.0f ;
profile_2d = profile_2d * profile_2d;
#ifdef HDR_COMPRESS
pixel[0] = 127;
pixel[1] = 127;
pixel[1] = 127;
pixel[2] = 127;
#else
#else
pixel[0] = 255;
pixel[1] = 255;
pixel[2] = 255;
#endif
pixel[3] = (int) (relStarDensity(eta) * profile_2d * 255.99f);
pixel[3] = (int) (relStarDensity(eta) * profile_2d * 255.99f);
}
Globular::Globular() :
detail (1.0f),
customTmpName (NULL),
form (NULL),
r_c (R_c_ref),
c (C_ref),
tidalRadius(0.0f)
r_c (R_c_ref),
c (C_ref),
tidalRadius(0.0f)
{
recomputeTidalRadius();
recomputeTidalRadius();
}
unsigned int Globular::cSlot(float conc) const
{
// map the physical range of c, minC <= c <= maxC,
// to 8 integers (bin numbers), 0 < cSlot <= 7:
if (conc <= MinC)
conc = MinC;
if (conc >= MaxC)
conc = MaxC;
// map the physical range of c, minC <= c <= maxC,
// to 8 integers (bin numbers), 0 < cSlot <= 7:
if (conc <= MinC)
conc = MinC;
if (conc >= MaxC)
conc = MaxC;
return (unsigned int) floor((conc - MinC) / BinWidth);
}
const char* Globular::getType() const
{
@ -224,38 +224,38 @@ float Globular::getCoreRadius() const
void Globular::setCoreRadius(const float coreRadius)
{
r_c = coreRadius;
recomputeTidalRadius();
r_c = coreRadius;
recomputeTidalRadius();
}
float Globular::getHalfMassRadius() const
{
// Aproximation to the half-mass radius r_h [ly]
// (~ 20% accuracy)
return std::tan(degToRad(r_c / 60.0f)) * (float) getPosition().norm() * pow(10.0f, 0.6f * c - 0.4f);
// Aproximation to the half-mass radius r_h [ly]
// (~ 20% accuracy)
return std::tan(degToRad(r_c / 60.0f)) * (float) getPosition().norm() * pow(10.0f, 0.6f * c - 0.4f);
}
float Globular::getConcentration() const
{
return c;
return c;
}
void Globular::setConcentration(const float conc)
{
c = conc;
if (!formsInitialized)
InitializeForms();
// For saving time, account for the c dependence via 8 bins only,
InitializeForms();
form = globularForms[cSlot(conc)];
// For saving time, account for the c dependence via 8 bins only,
form = globularForms[cSlot(conc)];
recomputeTidalRadius();
}
size_t Globular::getDescription(char* buf, size_t bufLength) const
{
return snprintf(buf, bufLength, _("Globular (core radius: %4.2f', King concentration: %4.2f)"), r_c, c);
return snprintf(buf, bufLength, _("Globular (core radius: %4.2f', King concentration: %4.2f)"), r_c, c);
}
@ -277,12 +277,12 @@ bool Globular::pick(const Ray3d& ray,
{
if (!isVisible())
return false;
/*
/*
* The selection ellipsoid should be slightly larger to compensate for the fact
* that blobs are considered points when globulars are built, but have size
* when they are drawn.
*/
Vec3d ellipsoidAxes(getRadius() * (form->scale.x + RADIUS_CORRECTION),
* when they are drawn.
*/
Vec3d ellipsoidAxes(getRadius() * (form->scale.x + RADIUS_CORRECTION),
getRadius() * (form->scale.y + RADIUS_CORRECTION),
getRadius() * (form->scale.z + RADIUS_CORRECTION));
@ -300,25 +300,25 @@ bool Globular::load(AssociativeArray* params, const string& resPath)
bool ok = DeepSkyObject::load(params, resPath);
if (!ok)
return false;
return false;
if (params->getNumber("Detail", detail))
setDetail((float) detail);
string customTmpName;
if (params->getString("CustomTemplate", customTmpName ))
setCustomTmpName(customTmpName);
setDetail((float) detail);
string customTmpName;
if (params->getString("CustomTemplate", customTmpName ))
setCustomTmpName(customTmpName);
double coreRadius;
if (params->getAngle("CoreRadius", coreRadius, 1.0 / MINUTES_PER_DEG))
if (params->getAngle("CoreRadius", coreRadius, 1.0 / MINUTES_PER_DEG))
{
r_c = coreRadius;
setCoreRadius(r_c);
setCoreRadius(r_c);
}
if (params->getNumber("KingConcentration", c))
setConcentration(c);
if (params->getNumber("KingConcentration", c))
setConcentration(c);
return true;
}
@ -328,7 +328,7 @@ void Globular::render(const GLContext& context,
const Quaternionf& viewerOrientation,
float brightness,
float pixelSize)
{
{
renderGlobularPointSprites(context, fromEigen(offset), fromEigen(viewerOrientation), brightness, pixelSize);
}
@ -341,164 +341,164 @@ void Globular::renderGlobularPointSprites(const GLContext&,
{
if (form == NULL)
return;
float distanceToDSO = offset.length() - getRadius();
if (distanceToDSO < 0)
distanceToDSO = 0;
float minimumFeatureSize = 0.5f * pixelSize * distanceToDSO;
DiskSizeInPixels = getRadius() / minimumFeatureSize;
/*
float distanceToDSO = offset.length() - getRadius();
if (distanceToDSO < 0)
distanceToDSO = 0;
float minimumFeatureSize = 0.5f * pixelSize * distanceToDSO;
DiskSizeInPixels = getRadius() / minimumFeatureSize;
/*
* Is the globular's apparent size big enough to
* be noticeable on screen? If it's not, break right here to
* avoid all the overhead of the matrix transformations and
* GL state changes:
*/
if (DiskSizeInPixels < 1.0f)
return;
* GL state changes:
*/
if (DiskSizeInPixels < 1.0f)
return;
/*
* When resolution (zoom) varies, the blended texture opacity is controlled by the
* factor 'pixelWeight'. At low resolution, the latter starts at 1, but tends to 0,
* if the resolution increases sufficiently (DiskSizeInPixels >= P1 pixels)!
* The smaller P2 (<1), the faster pixelWeight -> 0, for DiskSizeInPixels >= P1.
*/
float pixelWeight = (DiskSizeInPixels >= P1)? 1.0f/(P2 + (1.0f - P2) * DiskSizeInPixels / P1): 1.0f;
// Use same 8 c-bins as in globularForms below!
unsigned int ic = cSlot(c);
* When resolution (zoom) varies, the blended texture opacity is controlled by the
* factor 'pixelWeight'. At low resolution, the latter starts at 1, but tends to 0,
* if the resolution increases sufficiently (DiskSizeInPixels >= P1 pixels)!
* The smaller P2 (<1), the faster pixelWeight -> 0, for DiskSizeInPixels >= P1.
*/
float pixelWeight = (DiskSizeInPixels >= P1)? 1.0f/(P2 + (1.0f - P2) * DiskSizeInPixels / P1): 1.0f;
// Use same 8 c-bins as in globularForms below!
unsigned int ic = cSlot(c);
CBin = MinC + ((float) ic + 0.5f) * BinWidth; // center value of (ic+1)th c-bin
RRatio = pow(10.0f, CBin);
XI = 1.0f / sqrt(1.0f + RRatio * RRatio);
RRatio = pow(10.0f, CBin);
XI = 1.0f / sqrt(1.0f + RRatio * RRatio);
if(centerTex[ic] == NULL)
{
centerTex[ic] = CreateProceduralTexture( cntrTexWidth, cntrTexHeight, GL_RGBA, CenterCloudTexEval);
}
assert(centerTex[ic] != NULL);
if (globularTex == NULL)
{
centerTex[ic] = CreateProceduralTexture( cntrTexWidth, cntrTexHeight, GL_RGBA, CenterCloudTexEval);
}
assert(centerTex[ic] != NULL);
if (globularTex == NULL)
{
globularTex = CreateProceduralTexture( starTexWidth, starTexHeight, GL_RGBA,
GlobularTextureEval);
}
assert(globularTex != NULL);
glEnable (GL_BLEND);
glEnable (GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
glEnable (GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Mat3f viewMat = viewerOrientation.toMatrix3();
Vec3f v0 = Vec3f(-1, -1, 0) * viewMat;
Vec3f v1 = Vec3f( 1, -1, 0) * viewMat;
Vec3f v2 = Vec3f( 1, 1, 0) * viewMat;
Vec3f v3 = Vec3f(-1, 1, 0) * viewMat;
float tidalSize = 2 * tidalRadius;
Mat3f m =
Mat3f::scaling(form->scale) * fromEigen(getOrientation()).toMatrix3() *
Mat3f::scaling(tidalSize);
float tidalSize = 2 * tidalRadius;
Mat3f m =
Mat3f::scaling(form->scale) * fromEigen(getOrientation()).toMatrix3() *
Mat3f::scaling(tidalSize);
vector<GBlob>* points = form->gblobs;
unsigned int nPoints =
(unsigned int) (points->size() * clamp(getDetail()));
/* Render central cloud sprite (centerTex). It fades away when
* distance from center or resolution increases sufficiently.
*/
centerTex[ic]->bind();
float br = 2 * brightness;
unsigned int nPoints =
(unsigned int) (points->size() * clamp(getDetail()));
glColor4f(Rr, Gg, Bb, min(br * pixelWeight, 1.0f));
/* Render central cloud sprite (centerTex). It fades away when
* distance from center or resolution increases sufficiently.
*/
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex(v0 * tidalSize);
centerTex[ic]->bind();
float br = 2 * brightness;
glColor4f(Rr, Gg, Bb, min(br * pixelWeight, 1.0f));
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex(v0 * tidalSize);
glTexCoord2f(1, 0); glVertex(v1 * tidalSize);
glTexCoord2f(1, 1); glVertex(v2 * tidalSize);
glTexCoord2f(0, 1); glVertex(v3 * tidalSize);
glEnd();
/*! Next, render globular cluster via distinct "star" sprites (globularTex)
* for sufficiently large resolution and distance from center of globular.
*
* This RGBA texture fades away when resolution decreases (e.g. via automag!),
* or when distance from globular center decreases.
*/
globularTex->bind();
int pow2 = 128; // Associate "Red Giants" with the 128 biggest star-sprites
glTexCoord2f(0, 1); glVertex(v3 * tidalSize);
float starSize = br * 0.5f; // Maximal size of star sprites -> "Red Giants"
float clipDistance = 100.0f; // observer distance [ly] from globular, where we
// start "morphing" the star-sprite sizes towards
// their physical values
glBegin(GL_QUADS);
for (unsigned int i = 0; i < nPoints; ++i)
{
GBlob b = (*points)[i];
Point3f p = b.position * m;
float eta_2d = b.radius_2d;
/*! Note that the [axis,angle] input in globulars.dsc transforms the
* 2d projected star distance r_2d in the globular frame to refer to the
* skyplane frame for each globular! That's what I need here.
*
* The [axis,angle] input will be needed anyway, when upgrading to
* account for ellipticities, with corresponding inclinations and
* position angles...
*/
glEnd();
/*! Next, render globular cluster via distinct "star" sprites (globularTex)
* for sufficiently large resolution and distance from center of globular.
*
* This RGBA texture fades away when resolution decreases (e.g. via automag!),
* or when distance from globular center decreases.
*/
if ((i & pow2) != 0)
{
pow2 <<= 1;
starSize /= 1.25f;
if (starSize < minimumFeatureSize)
break;
}
globularTex->bind();
float obsDistanceToStarRatio = (p + offset).distanceFromOrigin() / clipDistance;
float saveSize = starSize;
if (obsDistanceToStarRatio < 1.0f)
{
// "Morph" the star-sprite sizes at close observer distance such that
// the overdense globular core is dissolved upon closing in.
starSize = starSize * min(obsDistanceToStarRatio, 1.0f);
}
/* Colors of normal globular stars are given by color profile.
* Associate orange "Red Giant" stars with the largest sprite
* sizes (while pow2 = 128).
*/
int pow2 = 128; // Associate "Red Giants" with the 128 biggest star-sprites
Color col = (pow2 < 256)? colorTable[255]: colorTable[b.colorIndex];
glColor4f(col.red(), col.green(), col.blue(),
min(br * (1.0f - pixelWeight * relStarDensity(eta_2d)), 1.0f));
glTexCoord2f(0, 0); glVertex(p + (v0 * starSize));
glTexCoord2f(1, 0); glVertex(p + (v1 * starSize));
glTexCoord2f(1, 1); glVertex(p + (v2 * starSize));
glTexCoord2f(0, 1); glVertex(p + (v3 * starSize));
starSize = saveSize;
}
glEnd();
float starSize = br * 0.5f; // Maximal size of star sprites -> "Red Giants"
float clipDistance = 100.0f; // observer distance [ly] from globular, where we
// start "morphing" the star-sprite sizes towards
// their physical values
glBegin(GL_QUADS);
for (unsigned int i = 0; i < nPoints; ++i)
{
GBlob b = (*points)[i];
Point3f p = b.position * m;
float eta_2d = b.radius_2d;
/*! Note that the [axis,angle] input in globulars.dsc transforms the
* 2d projected star distance r_2d in the globular frame to refer to the
* skyplane frame for each globular! That's what I need here.
*
* The [axis,angle] input will be needed anyway, when upgrading to
* account for ellipticities, with corresponding inclinations and
* position angles...
*/
if ((i & pow2) != 0)
{
pow2 <<= 1;
starSize /= 1.25f;
if (starSize < minimumFeatureSize)
break;
}
float obsDistanceToStarRatio = (p + offset).distanceFromOrigin() / clipDistance;
float saveSize = starSize;
if (obsDistanceToStarRatio < 1.0f)
{
// "Morph" the star-sprite sizes at close observer distance such that
// the overdense globular core is dissolved upon closing in.
starSize = starSize * min(obsDistanceToStarRatio, 1.0f);
}
/* Colors of normal globular stars are given by color profile.
* Associate orange "Red Giant" stars with the largest sprite
* sizes (while pow2 = 128).
*/
Color col = (pow2 < 256)? colorTable[255]: colorTable[b.colorIndex];
glColor4f(col.red(), col.green(), col.blue(),
min(br * (1.0f - pixelWeight * relStarDensity(eta_2d)), 1.0f));
glTexCoord2f(0, 0); glVertex(p + (v0 * starSize));
glTexCoord2f(1, 0); glVertex(p + (v1 * starSize));
glTexCoord2f(1, 1); glVertex(p + (v2 * starSize));
glTexCoord2f(0, 1); glVertex(p + (v3 * starSize));
starSize = saveSize;
}
glEnd();
}
unsigned int Globular::getRenderMask() const
@ -510,168 +510,168 @@ unsigned int Globular::getLabelMask() const
{
return Renderer::GlobularLabels;
}
void Globular::recomputeTidalRadius()
{
// Convert the core radius from arcminutes to light years
// Compute the tidal radius in light years
float coreRadiusLy = std::tan(degToRad(r_c / 60.0f)) * (float) getPosition().norm();
tidalRadius = coreRadiusLy * std::pow(10.0f, c);
// Convert the core radius from arcminutes to light years
// Compute the tidal radius in light years
float coreRadiusLy = std::tan(degToRad(r_c / 60.0f)) * (float) getPosition().norm();
tidalRadius = coreRadiusLy * std::pow(10.0f, c);
}
GlobularForm* buildGlobularForms(float c)
{
GBlob b;
vector<GBlob>* globularPoints = new vector<GBlob>;
GBlob b;
vector<GBlob>* globularPoints = new vector<GBlob>;
float rRatio = pow(10.0f, c); // = r_t / r_c
float prob;
float cc = 1.0f + rRatio * rRatio;
unsigned int i = 0, k = 0;
// Value of King_1962 luminosity profile at center:
float prob0 = sqrt(cc) - 1.0f;
float rRatio = pow(10.0f, c); // = r_t / r_c
float prob;
float cc = 1.0f + rRatio * rRatio;
unsigned int i = 0, k = 0;
/*! Generate the globular star distribution randomly, according
* to the King_1962 surface density profile f(r), eq.(14).
*
* rho = r / r_c = eta r_t / r_c, 0 <= eta <= 1,
* coreRadius r_c, tidalRadius r_t, King concentration c = log10(r_t/r_c).
*/
while (i < GLOBULAR_POINTS)
{
/*!
* Use a combination of the Inverse Transform method and
* Von Neumann's Acceptance-Rejection method for generating sprite stars
* with eta distributed according to the exact King luminosity profile.
*
* This algorithm leads to almost 100% efficiency for all values of
* parameters and variables!
*/
float uu = Mathf::frand();
/* First step: eta distributed as inverse power distribution (~1/Z^2)
* that majorizes the exact King profile. Compute eta in terms of uniformly
* distributed variable uu! Normalization to 1 for eta -> 0.
*/
float eta = tan(uu *atan(rRatio))/rRatio;
// Value of King_1962 luminosity profile at center:
float rho = eta * rRatio;
float cH = 1.0f/(1.0f + rho * rho);
float prob0 = sqrt(cc) - 1.0f;
/*! Generate the globular star distribution randomly, according
* to the King_1962 surface density profile f(r), eq.(14).
*
* rho = r / r_c = eta r_t / r_c, 0 <= eta <= 1,
* coreRadius r_c, tidalRadius r_t, King concentration c = log10(r_t/r_c).
*/
while (i < GLOBULAR_POINTS)
{
/*!
* Use a combination of the Inverse Transform method and
* Von Neumann's Acceptance-Rejection method for generating sprite stars
* with eta distributed according to the exact King luminosity profile.
*
* This algorithm leads to almost 100% efficiency for all values of
* parameters and variables!
*/
float uu = Mathf::frand();
/* First step: eta distributed as inverse power distribution (~1/Z^2)
* that majorizes the exact King profile. Compute eta in terms of uniformly
* distributed variable uu! Normalization to 1 for eta -> 0.
*/
float eta = tan(uu *atan(rRatio))/rRatio;
float rho = eta * rRatio;
float cH = 1.0f/(1.0f + rho * rho);
float Z = sqrt((1.0f + rho * rho)/cc); // scaling variable
// Express King_1962 profile in terms of the UNIVERSAL variable 0 < Z <= 1,
prob = (1.0f - 1.0f / Z) / prob0;
prob = prob * prob;
/* Second step: Use Acceptance-Rejection method (Von Neumann) for
* correcting the power distribution of eta into the exact,
* desired King form 'prob'!
*/
// Express King_1962 profile in terms of the UNIVERSAL variable 0 < Z <= 1,
prob = (1.0f - 1.0f / Z) / prob0;
prob = prob * prob;
/* Second step: Use Acceptance-Rejection method (Von Neumann) for
* correcting the power distribution of eta into the exact,
* desired King form 'prob'!
*/
k++;
if (Mathf::frand() < prob / cH)
{
/* Generate 3d points of globular cluster stars in polar coordinates:
* Distribution in eta (<=> r) according to King's profile.
* Uniform distribution on any spherical surface for given eta.
* Note: u = cos(phi) must be used as a stochastic variable to get uniformity in angle!
*/
float u = Mathf::sfrand();
float theta = 2 * (float) PI * Mathf::frand();
float sthetu2 = sin(theta) * sqrt(1.0f - u * u);
// x,y,z points within -0.5..+0.5, as required for consistency:
b.position = 0.5f * Point3f(eta * sqrt(1.0f - u * u) * cos(theta), eta * sthetu2 , eta * u);
/*
* Note: 2d projection in x-z plane, according to Celestia's
* conventions! Hence...
*/
b.radius_2d = eta * sqrt(1.0f - sthetu2 * sthetu2);
if (Mathf::frand() < prob / cH)
{
/* Generate 3d points of globular cluster stars in polar coordinates:
* Distribution in eta (<=> r) according to King's profile.
* Uniform distribution on any spherical surface for given eta.
* Note: u = cos(phi) must be used as a stochastic variable to get uniformity in angle!
*/
float u = Mathf::sfrand();
float theta = 2 * (float) PI * Mathf::frand();
float sthetu2 = sin(theta) * sqrt(1.0f - u * u);
/* For now, implement only a generic spectrum for normal cluster
* stars, modelled from Hubble photo of M80.
* Blue Stragglers are qualitatively accounted for...
* assume color index poportional to Z as function of which the King profile
* becomes universal!
*/
b.colorIndex = (unsigned int) (Z * 254);
globularPoints->push_back(b);
i++;
}
}
// Check for efficiency of sprite-star generation => close to 100 %!
//cout << "c = "<< c <<" i = " << i - 1 <<" k = " << k - 1 << " Efficiency: " << 100.0f * i / (float)k<<"%" << endl;
GlobularForm* globularForm = new GlobularForm();
globularForm->gblobs = globularPoints;
globularForm->scale = Vec3f(1.0f, 1.0f, 1.0f);
return globularForm;
// x,y,z points within -0.5..+0.5, as required for consistency:
b.position = 0.5f * Point3f(eta * sqrt(1.0f - u * u) * cos(theta), eta * sthetu2 , eta * u);
/*
* Note: 2d projection in x-z plane, according to Celestia's
* conventions! Hence...
*/
b.radius_2d = eta * sqrt(1.0f - sthetu2 * sthetu2);
/* For now, implement only a generic spectrum for normal cluster
* stars, modelled from Hubble photo of M80.
* Blue Stragglers are qualitatively accounted for...
* assume color index poportional to Z as function of which the King profile
* becomes universal!
*/
b.colorIndex = (unsigned int) (Z * 254);
globularPoints->push_back(b);
i++;
}
}
// Check for efficiency of sprite-star generation => close to 100 %!
//cout << "c = "<< c <<" i = " << i - 1 <<" k = " << k - 1 << " Efficiency: " << 100.0f * i / (float)k<<"%" << endl;
GlobularForm* globularForm = new GlobularForm();
globularForm->gblobs = globularPoints;
globularForm->scale = Vec3f(1.0f, 1.0f, 1.0f);
return globularForm;
}
void InitializeForms()
{
// Build RGB color table, using hue, saturation, value as input.
// Hue in degrees.
// Location of hue transition and saturation peak in color index space:
int i0 = 36, i_satmax = 16;
// Width of hue transition in color index space:
int i_width = 3;
float sat_l = 0.08f, sat_h = 0.1f, hue_r = 27.0f, hue_b = 220.0f;
// Red Giant star color: i = 255:
// -------------------------------
// Convert hue, saturation and value to RGB
// Build RGB color table, using hue, saturation, value as input.
// Hue in degrees.
DeepSkyObject::hsv2rgb(&Rr, &Gg, &Bb, 25.0f, 0.65f, 1.0f);
colorTable[255] = Color(Rr, Gg, Bb);
// normal stars: i < 255, generic color profile for now, improve later
// --------------------------------------------------------------------
// Location of hue transition and saturation peak in color index space:
int i0 = 36, i_satmax = 16;
// Width of hue transition in color index space:
int i_width = 3;
float sat_l = 0.08f, sat_h = 0.1f, hue_r = 27.0f, hue_b = 220.0f;
// Red Giant star color: i = 255:
// -------------------------------
// Convert hue, saturation and value to RGB
DeepSkyObject::hsv2rgb(&Rr, &Gg, &Bb, 25.0f, 0.65f, 1.0f);
colorTable[255] = Color(Rr, Gg, Bb);
// normal stars: i < 255, generic color profile for now, improve later
// --------------------------------------------------------------------
// Convert hue, saturation, value to RGB
for (int i = 254; i >=0; i--)
for (int i = 254; i >=0; i--)
{
// simple qualitative saturation profile:
// i_satmax is value of i where sat = sat_h + sat_l maximal
// simple qualitative saturation profile:
// i_satmax is value of i where sat = sat_h + sat_l maximal
float x = (float) i / (float) i_satmax, x2 = x ;
float sat = sat_l + 2 * sat_h /(x2 + 1.0f / x2);
// Fast transition from hue_r to hue_b at i = i0 within a width
// i_width in color index space:
float x = (float) i / (float) i_satmax, x2 = x ;
float sat = sat_l + 2 * sat_h /(x2 + 1.0f / x2);
float hue = hue_r + 0.5f * (hue_b - hue_r) * (std::tanh((float)(i - i0) / (float) i_width) + 1.0f);
DeepSkyObject::hsv2rgb(&Rr, &Gg, &Bb, hue, sat, 0.85f);
colorTable[i] = Color(Rr, Gg, Bb);
}
// Define globularForms corresponding to 8 different bins of King concentration c
globularForms = new GlobularForm*[8];
// Fast transition from hue_r to hue_b at i = i0 within a width
// i_width in color index space:
for (unsigned int ic = 0; ic <= 7; ++ic)
float hue = hue_r + 0.5f * (hue_b - hue_r) * (std::tanh((float)(i - i0) / (float) i_width) + 1.0f);
DeepSkyObject::hsv2rgb(&Rr, &Gg, &Bb, hue, sat, 0.85f);
colorTable[i] = Color(Rr, Gg, Bb);
}
// Define globularForms corresponding to 8 different bins of King concentration c
globularForms = new GlobularForm*[8];
for (unsigned int ic = 0; ic <= 7; ++ic)
{
float CBin = MinC + ((float) ic + 0.5f) * BinWidth;
globularForms[ic] = buildGlobularForms(CBin);
}
formsInitialized = true;
globularForms[ic] = buildGlobularForms(CBin);
}
formsInitialized = true;
}

View File

@ -3,9 +3,9 @@
// Copyright (C) 2008, Celestia Development Team
// Initial implementation by Dr. Fridger Schrempp <fridger.schrempp@desy.de>
//
// Simulation of globular clusters, theoretical framework by
// Simulation of globular clusters, theoretical framework by
// Ivan King, Astron. J. 67 (1962) 471; ibid. 71 (1966) 64
//
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@ -36,23 +36,23 @@ class Globular : public DeepSkyObject
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Globular();
Globular();
virtual const char* getType() const;
virtual void setType(const std::string&);
virtual size_t getDescription(char* buf, size_t bufLength) const;
virtual std::string getCustomTmpName() const;
virtual void setCustomTmpName(const std::string&);
float getDetail() const;
float getDetail() const;
void setDetail(float);
float getCoreRadius() const;
void setCoreRadius(const float);
void setConcentration(const float);
float getConcentration() const;
float getHalfMassRadius() const;
void setConcentration(const float);
float getConcentration() const;
float getHalfMassRadius() const;
unsigned int cSlot(float) const;
virtual float getBoundingSphereRadius() const { return tidalRadius; }
virtual bool pick(const Ray3d& ray,
double& distanceToPicker,
double& cosAngleToBoundCenter) const;
@ -63,25 +63,25 @@ class Globular : public DeepSkyObject
float brightness,
float pixelSize);
virtual void renderGlobularPointSprites(const GLContext& context,
const Vec3f& offset,
const Quatf& viewerOrientation,
float brightness,
float pixelSize);
GlobularForm* getForm() const;
const Vec3f& offset,
const Quatf& viewerOrientation,
float brightness,
float pixelSize);
GlobularForm* getForm() const;
virtual unsigned int getRenderMask() const;
virtual unsigned int getLabelMask() const;
virtual const char* getObjTypeName() const;
private:
void recomputeTidalRadius();
private:
float detail;
std::string* customTmpName;
GlobularForm* form;
float r_c;
float c;
float detail;
std::string* customTmpName;
GlobularForm* form;
float r_c;
float c;
float tidalRadius;
};

View File

@ -38,7 +38,7 @@ GLShader::compile(const vector<string>& source)
{
if (source.empty())
return ShaderStatus_EmptyProgram;
// Convert vector of shader source strings to an array for OpenGL
const char** sourceStrings = new const char*[source.size()];
for (unsigned int i = 0; i < source.size(); i++)
@ -50,7 +50,7 @@ GLShader::compile(const vector<string>& source)
// Actually compile the shader
glCompileShaderARB(id);
GLint compileSuccess;
glGetObjectParameterivARB(id, GL_OBJECT_COMPILE_STATUS_ARB,
&compileSuccess);
@ -235,7 +235,7 @@ GLShaderLoader::CreateFragmentShader(const vector<string>& source,
GLShaderStatus
GLShaderLoader::CreateVertexShader(const string& source,
GLVertexShader** vs)
{
vector<string> v;
v.push_back(source);
@ -338,11 +338,11 @@ GetInfoLog(GLhandleARB obj)
char* log = new char[logLength];
if (log == NULL)
return string();
glGetInfoLogARB(obj, logLength, &charsWritten, log);
string s(log, charsWritten);
delete[] log;
return s;
}

View File

@ -92,7 +92,7 @@ class FloatShaderParameter
FloatShaderParameter(GLhandleARB _obj, const char* name);
FloatShaderParameter& operator=(float);
private:
int slot;
};

View File

@ -403,7 +403,7 @@ Image* LoadImageFromFile(const string& filename)
struct my_error_mgr
{
struct jpeg_error_mgr pub; // "public" fields
struct jpeg_error_mgr pub; // "public" fields
jmp_buf setjmp_buffer; // for return to caller
};
@ -438,8 +438,8 @@ Image* LoadJPEGImage(const string& filename, int)
// struct, to avoid dangling-pointer problems.
struct my_error_mgr jerr;
// More stuff
JSAMPARRAY buffer; // Output row buffer
int row_stride; // physical row width in output buffer
JSAMPARRAY buffer; // Output row buffer
int row_stride; // physical row width in output buffer
long cont;
// In this example we want to open the input file before doing anything else,

View File

@ -94,7 +94,7 @@ public:
Eigen::Vector3f eyeDir_obj;
Eigen::Vector3f eyePos_obj;
Eigen::Vector3f ambientColor;
};

View File

@ -62,7 +62,7 @@ FeatureNameEntry FeatureNames[] =
{ "Landing Site", Location::LandingSite },
{ "Crater", Location::Crater },
};
Location::Location() :
parent(NULL),
@ -93,7 +93,7 @@ string Location::getName(bool i18n) const
void Location::setName(const string& _name)
{
name = _name;
i18nName = _(_name.c_str());
i18nName = _(_name.c_str());
if (name == i18nName) i18nName = "";
}
@ -190,7 +190,7 @@ void Location::setParentBody(Body* _parent)
}
/*! Get the position of the location relative to its body in
/*! Get the position of the location relative to its body in
* the J2000 ecliptic coordinate system.
*/
Vector3d Location::getPlanetocentricPosition(double t) const

View File

@ -1,5 +1,5 @@
// lodspheremesh.h
//
//
// Copyright (C) 2001-2010, Celestia Development Team
// Original version by Chris Laurel <claurel@gmail.com>
//
@ -60,7 +60,7 @@ public:
context(_context)
{};
int step;
int step;
unsigned int attributes; // vertex attributes
const Frustum& frustum; // frustum, for culling
Point3f fp[8]; // frustum points, for culling
@ -68,7 +68,7 @@ public:
const GLContext& context;
};
int renderPatches(int phi0, int theta0,
int renderPatches(int phi0, int theta0,
int extent,
int level,
const RenderInfo&);

View File

@ -121,11 +121,11 @@ MarkerRepresentation::operator=(const MarkerRepresentation& rep)
m_size = rep.m_size;
m_color = rep.m_color;
m_label = rep.m_label;
return *this;
}
void MarkerRepresentation::setColor(Color color)
{
m_color = color;
@ -260,9 +260,9 @@ void MarkerRepresentation::render(float size) const
case Circle:
glBegin(GL_LINE_LOOP);
DrawCircle(s);
glEnd();
glEnd();
break;
case Disk:
glBegin(GL_POLYGON);
DrawCircle(s);

View File

@ -35,8 +35,8 @@ public:
Circle = 10,
Disk = 11,
Crosshair = 12,
};
};
MarkerRepresentation(Symbol symbol = MarkerRepresentation::Diamond,
float size = 10.0f,
Color color = Color::White,
@ -47,11 +47,11 @@ public:
m_label(label)
{
}
MarkerRepresentation(const MarkerRepresentation& rep);
MarkerRepresentation& operator=(const MarkerRepresentation& rep);
Symbol symbol() const { return m_symbol; }
Color color() const { return m_color; }
void setColor(Color);
@ -59,9 +59,9 @@ public:
void setSize(float size);
string label() const { return m_label; }
void setLabel(const std::string&);
void render(float size) const;
private:
Symbol m_symbol;
float m_size;

View File

@ -86,7 +86,7 @@ string GeometryInfo::resolve(const string& baseDir)
// This suffix is stripped before the file is actually loaded.
char uniquifyingSuffix[128];
sprintf(uniquifyingSuffix, "%c%f,%f,%f,%f,%d", UniqueSuffixChar, center.x(), center.y(), center.z(), scale, (int) isNormalized);
if (!path.empty())
{
string filename = path + "/models/" + source;
@ -107,7 +107,7 @@ Geometry* GeometryInfo::load(const string& resolvedFilename)
// Strip off the uniquifying suffix
string::size_type uniquifyingSuffixStart = resolvedFilename.rfind(UniqueSuffixChar);
string filename(resolvedFilename, 0, uniquifyingSuffixStart);
clog << _("Loading model: ") << filename << '\n';
Model* model = NULL;
ContentType fileType = DetermineFileType(filename);
@ -168,7 +168,7 @@ Geometry* GeometryInfo::load(const string& resolvedFilename)
}
}
#endif
// Condition the model for optimal rendering
if (model != NULL)
{
@ -468,7 +468,7 @@ ConvertTriangleMesh(M3DTriangleMesh& mesh,
Vector2f texCoord = mesh.getTexCoord(triVert[j]);
vertexData[dataOffset + 6] = texCoord.x();
vertexData[dataOffset + 7] = texCoord.y();
}
}
}
}

View File

@ -123,7 +123,7 @@ ModelGeometry::render(RenderContext& rc, double /* t */)
mesh->getVertexCount() * vertexDesc.stride,
mesh->getVertexData(),
GL_STATIC_DRAW_ARB);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
}

View File

@ -40,7 +40,7 @@ class Nebula : public DeepSkyObject
void setGeometry(ResourceHandle);
ResourceHandle getGeometry() const;
virtual const char* getObjTypeName() const;
public:

View File

@ -80,55 +80,55 @@ Observer::Observer() :
/*! Copy constructor. */
Observer::Observer(const Observer& o) :
simTime(o.simTime),
position(o.position),
orientation(o.orientation),
velocity(o.velocity),
angularVelocity(o.angularVelocity),
frame(NULL),
realTime(o.realTime),
targetSpeed(o.targetSpeed),
targetVelocity(o.targetVelocity),
beginAccelTime(o.beginAccelTime),
observerMode(o.observerMode),
journey(o.journey),
trackObject(o.trackObject),
trackingOrientation(o.trackingOrientation),
fov(o.fov),
reverseFlag(o.reverseFlag),
locationFilter(o.locationFilter),
displayedSurface(o.displayedSurface)
simTime(o.simTime),
position(o.position),
orientation(o.orientation),
velocity(o.velocity),
angularVelocity(o.angularVelocity),
frame(NULL),
realTime(o.realTime),
targetSpeed(o.targetSpeed),
targetVelocity(o.targetVelocity),
beginAccelTime(o.beginAccelTime),
observerMode(o.observerMode),
journey(o.journey),
trackObject(o.trackObject),
trackingOrientation(o.trackingOrientation),
fov(o.fov),
reverseFlag(o.reverseFlag),
locationFilter(o.locationFilter),
displayedSurface(o.displayedSurface)
{
frame = new ObserverFrame(*o.frame);
updateUniversal();
frame = new ObserverFrame(*o.frame);
updateUniversal();
}
Observer& Observer::operator=(const Observer& o)
{
simTime = o.simTime;
position = o.position;
orientation = o.orientation;
velocity = o.velocity;
angularVelocity = o.angularVelocity;
frame = NULL;
realTime = o.realTime;
targetSpeed = o.targetSpeed;
targetVelocity = o.targetVelocity;
beginAccelTime = o.beginAccelTime;
observerMode = o.observerMode;
journey = o.journey;
trackObject = o.trackObject;
trackingOrientation = o.trackingOrientation;
fov = o.fov;
reverseFlag = o.reverseFlag;
locationFilter = o.locationFilter;
displayedSurface = o.displayedSurface;
simTime = o.simTime;
position = o.position;
orientation = o.orientation;
velocity = o.velocity;
angularVelocity = o.angularVelocity;
frame = NULL;
realTime = o.realTime;
targetSpeed = o.targetSpeed;
targetVelocity = o.targetVelocity;
beginAccelTime = o.beginAccelTime;
observerMode = o.observerMode;
journey = o.journey;
trackObject = o.trackObject;
trackingOrientation = o.trackingOrientation;
fov = o.fov;
reverseFlag = o.reverseFlag;
locationFilter = o.locationFilter;
displayedSurface = o.displayedSurface;
setFrame(*o.frame);
updateUniversal();
setFrame(*o.frame);
updateUniversal();
return *this;
return *this;
}
@ -155,7 +155,7 @@ double Observer::getRealTime() const
void Observer::setTime(double jd)
{
simTime = jd;
updateUniversal();
updateUniversal();
}
@ -260,7 +260,7 @@ void Observer::setAngularVelocity(const Vector3d& v)
*/
// TODO: This is a generally useful function that should be moved to
// the celmath package.
template<class T> static Quaternion<T>
template<class T> static Quaternion<T>
lookAt(Matrix<T, 3, 1> from, Matrix<T, 3, 1> to, Matrix<T, 3, 1> up)
{
Matrix<T, 3, 1> n = to - from;
@ -277,7 +277,7 @@ lookAt(Matrix<T, 3, 1> from, Matrix<T, 3, 1> to, Matrix<T, 3, 1> up)
}
#ifdef CELVEC
template<class T> static Quat<T>
template<class T> static Quat<T>
lookAt(Point3<T> from, Point3<T> to, Vector3<T> up)
{
Vector3<T> n = to - from;
@ -487,7 +487,7 @@ void Observer::update(double dt, double timeScale)
position = p;
orientation = q;
// If the journey's complete, reset to manual control
if (t == 1.0f)
{
@ -530,7 +530,7 @@ void Observer::update(double dt, double timeScale)
orientation.normalize();
#endif
}
updateUniversal();
// Update orientation for tracking--must occur after updateUniversal(), as it
@ -539,7 +539,7 @@ void Observer::update(double dt, double timeScale)
{
Vector3d up = getOrientation().conjugate() * Vector3d::UnitY();
Vector3d viewDir = trackObject.getPosition(getTime()).offsetFromKm(getPosition()).normalized();
setOrientation(lookAt<double>(Vector3d::Zero(), viewDir, up));
}
}
@ -627,17 +627,17 @@ void Observer::computeGotoParameters(const Selection& destination,
{
setFrame(frame->getCoordinateSystem(), destination);
}
UniversalCoord targetPosition = destination.getPosition(getTime());
Vector3d v = targetPosition.offsetFromKm(getPosition()).normalized();
jparams.traj = Linear;
jparams.duration = gotoTime;
jparams.startTime = realTime;
// Right where we are now . . .
jparams.from = getPosition();
if (offsetCoordSys == ObserverFrame::ObserverLocal)
{
jparams.to = targetPosition.offsetKm(orientationUniv.conjugate() * offset);
@ -647,7 +647,7 @@ void Observer::computeGotoParameters(const Selection& destination,
ObserverFrame offsetFrame(offsetCoordSys, destination);
jparams.to = targetPosition.offsetKm(offsetFrame.getFrame()->getOrientation(getTime()).conjugate() * offset);
}
Vector3d upd = up.cast<double>();
if (upCoordSys == ObserverFrame::ObserverLocal)
{
@ -658,25 +658,25 @@ void Observer::computeGotoParameters(const Selection& destination,
ObserverFrame upFrame(upCoordSys, destination);
upd = upFrame.getFrame()->getOrientation(getTime()).conjugate() * upd;
}
jparams.initialOrientation = getOrientation();
Vector3d focus = targetPosition.offsetFromKm(jparams.to);
jparams.finalOrientation = lookAt<double>(Vector3d::Zero(), focus, upd);
jparams.startInterpolation = min(startInter, endInter);
jparams.endInterpolation = max(startInter, endInter);
jparams.accelTime = 0.5;
double distance = jparams.from.offsetFromKm(jparams.to).norm() / 2.0;
pair<double, double> sol = solve_bisection(TravelExpFunc(distance, jparams.accelTime),
0.0001, 100.0,
1e-10);
jparams.expFactor = sol.first;
// Convert to frame coordinates
jparams.from = frame->convertFromUniversal(jparams.from, getTime());
jparams.initialOrientation = frame->convertFromUniversal(jparams.initialOrientation, getTime());
jparams.to = frame->convertFromUniversal(jparams.to, getTime());
jparams.finalOrientation = frame->convertFromUniversal(jparams.finalOrientation, getTime());
jparams.finalOrientation = frame->convertFromUniversal(jparams.finalOrientation, getTime());
}
@ -707,7 +707,7 @@ void Observer::computeGotoParametersGC(const Selection& destination,
ObserverFrame offsetFrame(offsetCoordSys, destination);
Vector3d offsetTransformed = offsetFrame.getFrame()->getOrientation(getTime()).conjugate() * offset;
jparams.to = targetPosition.offsetKm(offsetTransformed);
Vector3d upd = up.cast<double>();
@ -720,7 +720,7 @@ void Observer::computeGotoParametersGC(const Selection& destination,
ObserverFrame upFrame(upCoordSys, destination);
upd = upFrame.getFrame()->getOrientation(getTime()).conjugate() * upd;
}
jparams.initialOrientation = getOrientation();
Vector3d focus = targetPosition.offsetFromKm(jparams.to);
jparams.finalOrientation = lookAt<double>(Vector3d::Zero(), focus, upd);
@ -738,7 +738,7 @@ void Observer::computeGotoParametersGC(const Selection& destination,
jparams.from = frame->convertFromUniversal(jparams.from, getTime());
jparams.initialOrientation = frame->convertFromUniversal(jparams.initialOrientation, getTime());
jparams.to = frame->convertFromUniversal(jparams.to, getTime());
jparams.finalOrientation = frame->convertFromUniversal(jparams.finalOrientation, getTime());
jparams.finalOrientation = frame->convertFromUniversal(jparams.finalOrientation, getTime());
}
@ -771,7 +771,7 @@ void Observer::computeCenterParameters(const Selection& destination,
jparams.from = frame->convertFromUniversal(jparams.from, getTime());
jparams.initialOrientation = frame->convertFromUniversal(jparams.initialOrientation, getTime());
jparams.to = frame->convertFromUniversal(jparams.to, getTime());
jparams.finalOrientation = frame->convertFromUniversal(jparams.finalOrientation, getTime());
jparams.finalOrientation = frame->convertFromUniversal(jparams.finalOrientation, getTime());
}
@ -845,12 +845,12 @@ void Observer::setMode(Observer::ObserverMode mode)
void Observer::convertFrameCoordinates(const ObserverFrame* newFrame)
{
double now = getTime();
// Universal coordinates don't change.
// Convert frame coordinates to the new frame.
position = newFrame->convertFromUniversal(positionUniv, now);
orientation = newFrame->convertFromUniversal(orientationUniv, now);
// Convert goto parameters to the new frame
journey.from = ObserverFrame::convert(frame, newFrame, journey.from, now);
journey.initialOrientation = ObserverFrame::convert(frame, newFrame, journey.initialOrientation, now);
@ -864,7 +864,7 @@ void Observer::convertFrameCoordinates(const ObserverFrame* newFrame)
*/
void Observer::setFrame(ObserverFrame::CoordinateSystem cs, const Selection& refObj, const Selection& targetObj)
{
ObserverFrame* newFrame = new ObserverFrame(cs, refObj, targetObj);
ObserverFrame* newFrame = new ObserverFrame(cs, refObj, targetObj);
if (newFrame != NULL)
{
convertFrameCoordinates(newFrame);
@ -891,17 +891,17 @@ void Observer::setFrame(const ObserverFrame& f)
if (frame != &f)
{
ObserverFrame* newFrame = new ObserverFrame(f);
if (newFrame != NULL)
{
if (frame != NULL)
{
convertFrameCoordinates(newFrame);
delete frame;
}
if (frame != NULL)
{
convertFrameCoordinates(newFrame);
delete frame;
}
frame = newFrame;
}
}
}
}
@ -1080,7 +1080,7 @@ static double getPreferredDistance(const Selection& selection)
// Handle reference points (i.e. invisible objects) specially, since the
// actual radius of the point is meaningless. Instead, use the size of
// bounding sphere of all child objects. This is useful for system
// barycenters--the normal goto command will place the observer at
// barycenters--the normal goto command will place the observer at
// a viewpoint in which the entire system can be seen.
if (selection.body()->getClassification() == Body::Invisible)
{
@ -1309,10 +1309,10 @@ void Observer::gotoLocation(const UniversalCoord& toPosition,
journey.duration = duration;
journey.from = position;
journey.initialOrientation = orientation;
journey.initialOrientation = orientation;
journey.to = toPosition;
journey.finalOrientation = toOrientation;
journey.startInterpolation = 0.25f;
journey.endInterpolation = 0.75f;
@ -1338,7 +1338,7 @@ void Observer::getSelectionLongLat(const Selection& selection,
{
ObserverFrame frame(ObserverFrame::BodyFixed, selection);
Vector3d bfPos = frame.convertFromUniversal(positionUniv, getTime()).offsetFromKm(UniversalCoord::Zero());
// Convert from Celestia's coordinate system
double x = bfPos.x();
double y = -bfPos.z();
@ -1355,7 +1355,7 @@ void Observer::gotoSurface(const Selection& sel, double duration)
{
Vector3d v = getPosition().offsetFromKm(sel.getPosition(getTime()));
v.normalize();
Vector3d viewDir = orientationUniv.conjugate() * -Vector3d::UnitZ();
Vector3d up = orientationUniv.conjugate() * Vector3d::UnitY();
Quaterniond q = orientationUniv;
@ -1363,16 +1363,16 @@ void Observer::gotoSurface(const Selection& sel, double duration)
{
q = lookAt<double>(Vector3d::Zero(), up, v);
}
ObserverFrame frame(ObserverFrame::BodyFixed, sel);
UniversalCoord bfPos = frame.convertFromUniversal(positionUniv, getTime());
q = frame.convertFromUniversal(q, getTime());
double height = 1.0001 * sel.radius();
Vector3d dir = bfPos.offsetFromKm(UniversalCoord::Zero()).normalized() * height;
UniversalCoord nearSurfacePoint = UniversalCoord::Zero().offsetKm(dir);
gotoLocation(nearSurfacePoint, q, duration);
gotoLocation(nearSurfacePoint, q, duration);
};
@ -1412,7 +1412,7 @@ void Observer::geosynchronousFollow(const Selection& selection)
void Observer::phaseLock(const Selection& selection)
{
Selection refObject = frame->getRefObject();
if (selection != refObject)
{
if (refObject.body() != NULL || refObject.star() != NULL)
@ -1427,7 +1427,7 @@ void Observer::phaseLock(const Selection& selection)
if (selection.body() != NULL)
{
setFrame(ObserverFrame::PhaseLock, selection, Selection(selection.body()->getSystem()->getStar()));
}
}
}
}
@ -1525,12 +1525,12 @@ ObserverFrame& ObserverFrame::operator=(const ObserverFrame& f)
{
coordSys = f.coordSys;
targetObject = f.targetObject;
// In case frames are the same, make sure we addref before releasing
f.frame->addRef();
frame->release();
frame = f.frame;
return *this;
}
@ -1570,7 +1570,7 @@ ObserverFrame::getFrame() const
}
UniversalCoord
UniversalCoord
ObserverFrame::convertFromUniversal(const UniversalCoord& uc, double tjd) const
{
return frame->convertFromUniversal(uc, tjd);
@ -1584,7 +1584,7 @@ ObserverFrame::convertToUniversal(const UniversalCoord& uc, double tjd) const
}
Quaterniond
Quaterniond
ObserverFrame::convertFromUniversal(const Quaterniond& q, double tjd) const
{
return frame->convertFromUniversal(q, tjd);
@ -1634,30 +1634,30 @@ ObserverFrame::createFrame(CoordinateSystem _coordSys,
{
case Universal:
return new J2000EclipticFrame(Selection());
case Ecliptical:
return new J2000EclipticFrame(_refObject);
case Equatorial:
return new BodyMeanEquatorFrame(_refObject, _refObject);
case BodyFixed:
return new BodyFixedFrame(_refObject, _refObject);
case PhaseLock:
{
return new TwoVectorFrame(_refObject,
FrameVector::createRelativePositionVector(_refObject, _targetObject), 1,
FrameVector::createRelativeVelocityVector(_refObject, _targetObject), 2);
}
case Chase:
{
return new TwoVectorFrame(_refObject,
FrameVector::createRelativeVelocityVector(_refObject, _refObject.parent()), 1,
FrameVector::createRelativePositionVector(_refObject, _refObject.parent()), 2);
}
case PhaseLock_Old:
{
FrameVector rotAxis(FrameVector::createConstantVector(Vector3d::UnitY(),
@ -1666,12 +1666,12 @@ ObserverFrame::createFrame(CoordinateSystem _coordSys,
FrameVector::createRelativePositionVector(_refObject, _targetObject), 3,
rotAxis, 2);
}
case Chase_Old:
{
FrameVector rotAxis(FrameVector::createConstantVector(Vector3d::UnitY(),
new BodyMeanEquatorFrame(_refObject, _refObject)));
return new TwoVectorFrame(_refObject,
FrameVector::createRelativeVelocityVector(_refObject.parent(), _refObject), 3,
rotAxis, 2);
@ -1681,7 +1681,7 @@ ObserverFrame::createFrame(CoordinateSystem _coordSys,
// TODO: This is only used for computing up vectors for orientation; it does
// define a proper frame for the observer position orientation.
return new J2000EclipticFrame(Selection());
default:
return new J2000EclipticFrame(_refObject);
}

View File

@ -34,44 +34,44 @@ public:
BodyFixed = 3,
PhaseLock = 5,
Chase = 6,
// Previous versions of PhaseLock and Chase used the
// spin axis of the reference object as a secondary
// vector for the coordinate system.
PhaseLock_Old = 100,
Chase_Old = 101,
// ObserverLocal is not a real frame; it's an optional
// way to specify view vectors. Eventually, there will
// be some other way to accomplish this and ObserverLocal
// will go away.
ObserverLocal = 200,
Unknown = 1000,
};
ObserverFrame();
ObserverFrame(CoordinateSystem cs,
const Selection& _refObject,
const Selection& _targetObj = Selection());
ObserverFrame(const ObserverFrame&);
ObserverFrame(const ReferenceFrame& f);
~ObserverFrame();
ObserverFrame& operator=(const ObserverFrame& f);
CoordinateSystem getCoordinateSystem() const;
Selection getRefObject() const;
Selection getTargetObject() const;
const ReferenceFrame* getFrame() const;
UniversalCoord convertFromUniversal(const UniversalCoord& uc, double tjd) const;
UniversalCoord convertToUniversal(const UniversalCoord& uc, double tjd) const;
Eigen::Quaterniond convertFromUniversal(const Eigen::Quaterniond& q, double tjd) const;
Eigen::Quaterniond convertToUniversal(const Eigen::Quaterniond& q, double tjd) const;
static UniversalCoord convert(const ObserverFrame* fromFrame,
const ObserverFrame* toFrame,
const UniversalCoord& uc,
@ -80,12 +80,12 @@ public:
const ObserverFrame* toFrame,
const Eigen::Quaterniond& q,
double t);
private:
ReferenceFrame* createFrame(CoordinateSystem _coordSys,
const Selection& _refObject,
const Selection& _targetObject);
private:
CoordinateSystem coordSys;
const ReferenceFrame* frame;
@ -107,24 +107,24 @@ public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Observer();
Observer(const Observer& o);
Observer(const Observer& o);
Observer& operator=(const Observer& o);
Observer& operator=(const Observer& o);
UniversalCoord getPosition() const;
void setPosition(const UniversalCoord&);
void setPosition(const Eigen::Vector3d&);
void setPosition(const Eigen::Vector3d&);
Eigen::Quaterniond getOrientation() const;
Eigen::Quaternionf getOrientationf() const;
void setOrientation(const Eigen::Quaternionf&);
void setOrientation(const Eigen::Quaterniond&);
Eigen::Vector3d getVelocity() const;
void setVelocity(const Eigen::Vector3d&);
Eigen::Vector3d getAngularVelocity() const;
void setAngularVelocity(const Eigen::Vector3d&);
float getFOV() const;
void setFOV(float);
@ -144,7 +144,7 @@ public:
const std::string& getDisplayedSurface() const;
void setDisplayedSurface(const std::string&);
uint32 getLocationFilter() const;
void setLocationFilter(uint32);
@ -214,7 +214,7 @@ public:
Free = 0,
Travelling = 1,
};
ObserverMode getMode() const;
void setMode(ObserverMode);
@ -222,7 +222,7 @@ public:
{
Linear = 0,
GreatCircle = 1,
CircularOrbit = 2,
CircularOrbit = 2,
};
struct JourneyParams
@ -241,7 +241,7 @@ public:
Eigen::Quaterniond rotation1; // rotation on the CircularOrbit around centerObject
Selection centerObject;
TrajectoryType traj;
};
@ -277,7 +277,7 @@ public:
void updateUniversal();
void convertFrameCoordinates(const ObserverFrame* newFrame);
private:
double simTime;
@ -286,14 +286,14 @@ public:
Eigen::Quaterniond orientation;
Eigen::Vector3d velocity;
Eigen::Vector3d angularVelocity;
// Position and orientation in universal coordinates, derived from the
// equivalent quantities in the observer reference frame.
UniversalCoord positionUniv;
Eigen::Quaterniond orientationUniv;
ObserverFrame* frame;
double realTime;
double targetSpeed;
@ -302,7 +302,7 @@ public:
double beginAccelTime;
ObserverMode observerMode;
JourneyParams journey;
JourneyParams journey;
Selection trackObject;
Eigen::Quaterniond trackingOrientation; // orientation prior to selecting tracking

View File

@ -37,7 +37,7 @@ class OpenCluster : public DeepSkyObject
virtual unsigned int getRenderMask() const;
virtual unsigned int getLabelMask() const;
virtual const char* getObjTypeName() const;
public:

View File

@ -92,7 +92,7 @@ void Overlay::endText()
if (textBlock > 0)
{
textBlock--;
xoffset = 0.0f;
xoffset = 0.0f;
glPopMatrix();
}
}
@ -184,7 +184,7 @@ void Overlay::oprintf(const char* format, ...)
char buf[1024];
vsprintf(buf, format, args);
print(buf);
va_end(args);
}

View File

@ -33,11 +33,11 @@ using namespace std;
/**
* Returns the default units scale for orbits.
*
*
* If the usePlanetUnits flag is set, this returns a distance scale of AU and a
* time scale of years. Otherwise the distace scale is kilometers and the time
* scale is days.
*
*
* @param[in] usePlanetUnits Controls whether to return planet units or satellite units.
* @param[out] distanceScale The default distance scale in kilometers.
* @param[out] timeScale The default time scale in days.
@ -60,10 +60,10 @@ GetDefaultUnits(bool usePlanetUnits, double& distanceScale, double& timeScale)
/**
* Returns the default distance scale for orbits.
*
*
* If the usePlanetUnits flag is set, this returns AU, otherwise it returns
* kilometers.
*
*
* @param[in] usePlanetUnits Controls whether to return planet units or satellite units.
* @param[out] distanceScale The default distance scale in kilometers.
*/
@ -98,7 +98,7 @@ ParseDate(Hash* hash, const string& name, double& jd)
/*!
* Create a new Keplerian orbit from an ssc property table:
*
*
* \code EllipticalOrbit
* {
* # One of the following is required to specify orbit size:
@ -107,7 +107,7 @@ ParseDate(Hash* hash, const string& name, double& jd)
*
* # Required
* Period <number>
*
*
* Eccentricity <number> (default: 0.0)
* Inclination <degrees> (default: 0.0)
* AscendingNode <degrees> (default: 0.0)
@ -128,7 +128,7 @@ ParseDate(Hash* hash, const string& name, double& jd)
* SemiMajorAxis or PericenterDistance is in AU
* Otherwise:
* Period is in Julian days
* SemiMajorAxis or PericenterDistance is in kilometers.
* SemiMajorAxis or PericenterDistance is in kilometers.
*/
static EllipticalOrbit*
CreateEllipticalOrbit(Hash* orbitData,
@ -136,7 +136,7 @@ CreateEllipticalOrbit(Hash* orbitData,
{
// default units for planets are AU and years, otherwise km and days
double distanceScale;
double timeScale;
GetDefaultUnits(usePlanetUnits, distanceScale, timeScale);
@ -153,23 +153,23 @@ CreateEllipticalOrbit(Hash* orbitData,
return NULL;
}
}
double period = 0.0;
if (!orbitData->getTime("Period", period, 1.0, timeScale))
{
clog << "Period missing! Skipping planet . . .\n";
return NULL;
}
double eccentricity = 0.0;
orbitData->getNumber("Eccentricity", eccentricity);
double inclination = 0.0;
orbitData->getAngle("Inclination", inclination);
double ascendingNode = 0.0;
orbitData->getAngle("AscendingNode", ascendingNode);
double argOfPericenter = 0.0;
if (!orbitData->getAngle("ArgOfPericenter", argOfPericenter))
{
@ -266,13 +266,13 @@ CreateSampledTrajectory(Hash* trajData, const string& path)
/** Create a new FixedPosition trajectory.
*
*
* A FixedPosition is a property list with one of the following 3-vector properties:
*
*
* - \c Rectangular
* - \c Planetographic
* - \c Planetocentric
*
*
* Planetographic and planetocentric coordinates are given in the order longitude,
* latitude, altitude. Units of altitude are kilometers. Planetographic and
* and planetocentric coordinates are only practical when the coordinate system
@ -283,10 +283,10 @@ CreateFixedPosition(Hash* trajData, const Selection& centralObject, bool usePlan
{
double distanceScale;
GetDefaultUnits(usePlanetUnits, distanceScale);
Vector3d position = Vector3d::Zero();
Vector3d v = Vector3d::Zero();
Vector3d v = Vector3d::Zero();
if (trajData->getLengthVector("Rectangular", v, 1.0, distanceScale))
{
// Convert to Celestia's coordinate system
@ -330,41 +330,41 @@ CreateFixedPosition(Hash* trajData, const Selection& centralObject, bool usePlan
*/
static bool
ParseStringList(Hash* table,
const string& propertyName,
list<string>& stringList)
const string& propertyName,
list<string>& stringList)
{
Value* v = table->getValue(propertyName);
if (v == NULL)
return NULL;
Value* v = table->getValue(propertyName);
if (v == NULL)
return NULL;
// Check for a single string first.
if (v->getType() == Value::StringType)
{
stringList.push_back(v->getString());
return true;
}
else if (v->getType() == Value::ArrayType)
{
ValueArray* array = v->getArray();
ValueArray::const_iterator iter;
// Check for a single string first.
if (v->getType() == Value::StringType)
{
stringList.push_back(v->getString());
return true;
}
else if (v->getType() == Value::ArrayType)
{
ValueArray* array = v->getArray();
ValueArray::const_iterator iter;
// Verify that all array entries are strings
for (iter = array->begin(); iter != array->end(); iter++)
{
if ((*iter)->getType() != Value::StringType)
return false;
}
// Verify that all array entries are strings
for (iter = array->begin(); iter != array->end(); iter++)
{
if ((*iter)->getType() != Value::StringType)
return false;
}
// Add strings to stringList
for (iter = array->begin(); iter != array->end(); iter++)
stringList.push_back((*iter)->getString());
// Add strings to stringList
for (iter = array->begin(); iter != array->end(); iter++)
stringList.push_back((*iter)->getString());
return true;
}
else
{
return false;
}
return true;
}
else
{
return false;
}
}
@ -384,7 +384,7 @@ ParseStringList(Hash* table,
* Ending <number> # optional
* } \endcode
*
* The Kernel property specifies one or more SPK files that must be loaded. Any
* The Kernel property specifies one or more SPK files that must be loaded. Any
* already loaded kernels will also be used if they contain trajectories for
* the target or origin.
* Target and origin are strings that give NAIF IDs for the target and origin
@ -406,22 +406,22 @@ CreateSpiceOrbit(Hash* orbitData,
{
string targetBodyName;
string originName;
list<string> kernelList;
list<string> kernelList;
double distanceScale;
double timeScale;
GetDefaultUnits(usePlanetUnits, distanceScale, timeScale);
if (orbitData->getValue("Kernel") != NULL)
{
// Kernel list is optional; a SPICE orbit may rely on kernels already loaded into
// the kernel pool.
if (!ParseStringList(orbitData, "Kernel", kernelList))
{
clog << "Kernel list for SPICE orbit is neither a string nor array of strings\n";
return NULL;
}
}
if (orbitData->getValue("Kernel") != NULL)
{
// Kernel list is optional; a SPICE orbit may rely on kernels already loaded into
// the kernel pool.
if (!ParseStringList(orbitData, "Kernel", kernelList))
{
clog << "Kernel list for SPICE orbit is neither a string nor array of strings\n";
return NULL;
}
}
if (!orbitData->getString("Target", targetBodyName))
{
@ -449,55 +449,55 @@ CreateSpiceOrbit(Hash* orbitData,
double period = 0.0;
orbitData->getTime("Period", period, 1.0, timeScale);
// Either a complete time interval must be specified with Beginning/Ending, or
// else neither field can be present.
Value* beginningDate = orbitData->getValue("Beginning");
Value* endingDate = orbitData->getValue("Ending");
if (beginningDate != NULL && endingDate == NULL)
{
clog << "Beginning specified for SPICE orbit, but ending is missing.\n";
return NULL;
}
// Either a complete time interval must be specified with Beginning/Ending, or
// else neither field can be present.
Value* beginningDate = orbitData->getValue("Beginning");
Value* endingDate = orbitData->getValue("Ending");
if (beginningDate != NULL && endingDate == NULL)
{
clog << "Beginning specified for SPICE orbit, but ending is missing.\n";
return NULL;
}
if (endingDate != NULL && beginningDate == NULL)
{
clog << "Ending specified for SPICE orbit, but beginning is missing.\n";
return NULL;
}
if (endingDate != NULL && beginningDate == NULL)
{
clog << "Ending specified for SPICE orbit, but beginning is missing.\n";
return NULL;
}
SpiceOrbit* orbit = NULL;
if (beginningDate != NULL && endingDate != NULL)
{
double beginningTDBJD = 0.0;
if (!ParseDate(orbitData, "Beginning", beginningTDBJD))
{
clog << "Invalid beginning date specified for SPICE orbit.\n";
return NULL;
}
SpiceOrbit* orbit = NULL;
if (beginningDate != NULL && endingDate != NULL)
{
double beginningTDBJD = 0.0;
if (!ParseDate(orbitData, "Beginning", beginningTDBJD))
{
clog << "Invalid beginning date specified for SPICE orbit.\n";
return NULL;
}
double endingTDBJD = 0.0;
if (!ParseDate(orbitData, "Ending", endingTDBJD))
{
clog << "Invalid ending date specified for SPICE orbit.\n";
return NULL;
}
orbit = new SpiceOrbit(targetBodyName,
originName,
period,
boundingRadius,
beginningTDBJD,
endingTDBJD);
}
else
{
// No time interval given; we'll use whatever coverage window is given
// in the SPICE kernel.
orbit = new SpiceOrbit(targetBodyName,
originName,
period,
boundingRadius);
}
double endingTDBJD = 0.0;
if (!ParseDate(orbitData, "Ending", endingTDBJD))
{
clog << "Invalid ending date specified for SPICE orbit.\n";
return NULL;
}
orbit = new SpiceOrbit(targetBodyName,
originName,
period,
boundingRadius,
beginningTDBJD,
endingTDBJD);
}
else
{
// No time interval given; we'll use whatever coverage window is given
// in the SPICE kernel.
orbit = new SpiceOrbit(targetBodyName,
originName,
period,
boundingRadius);
}
if (!orbit->init(path, &kernelList))
{
@ -524,7 +524,7 @@ CreateSpiceOrbit(Hash* orbitData,
* } \endcode
*
* The Kernel property specifies one or more SPICE kernel files that must be
* loaded in order for the frame to be defined over the required range. Any
* loaded in order for the frame to be defined over the required range. Any
* already loaded kernels will be used if they contain information relevant
* for defining the frame.
* Frame and base name are strings that give SPICE names for the frames. The
@ -545,18 +545,18 @@ CreateSpiceRotation(Hash* rotationData,
{
string frameName;
string baseFrameName = "eclipj2000";
list<string> kernelList;
list<string> kernelList;
if (rotationData->getValue("Kernel") != NULL)
{
// Kernel list is optional; a SPICE rotation may rely on kernels already loaded into
// the kernel pool.
if (!ParseStringList(rotationData, "Kernel", kernelList))
{
clog << "Kernel list for SPICE rotation is neither a string nor array of strings\n";
return NULL;
}
}
if (rotationData->getValue("Kernel") != NULL)
{
// Kernel list is optional; a SPICE rotation may rely on kernels already loaded into
// the kernel pool.
if (!ParseStringList(rotationData, "Kernel", kernelList))
{
clog << "Kernel list for SPICE rotation is neither a string nor array of strings\n";
return NULL;
}
}
if (!rotationData->getString("Frame", frameName))
{
@ -572,52 +572,52 @@ CreateSpiceRotation(Hash* rotationData,
double period = 0.0;
rotationData->getTime("Period", period, 1.0, 1.0 / HOURS_PER_DAY);
// Either a complete time interval must be specified with Beginning/Ending, or
// else neither field can be present.
Value* beginningDate = rotationData->getValue("Beginning");
Value* endingDate = rotationData->getValue("Ending");
if (beginningDate != NULL && endingDate == NULL)
{
clog << "Beginning specified for SPICE rotation, but ending is missing.\n";
return NULL;
}
// Either a complete time interval must be specified with Beginning/Ending, or
// else neither field can be present.
Value* beginningDate = rotationData->getValue("Beginning");
Value* endingDate = rotationData->getValue("Ending");
if (beginningDate != NULL && endingDate == NULL)
{
clog << "Beginning specified for SPICE rotation, but ending is missing.\n";
return NULL;
}
if (endingDate != NULL && beginningDate == NULL)
{
clog << "Ending specified for SPICE rotation, but beginning is missing.\n";
return NULL;
}
if (endingDate != NULL && beginningDate == NULL)
{
clog << "Ending specified for SPICE rotation, but beginning is missing.\n";
return NULL;
}
SpiceRotation* rotation = NULL;
if (beginningDate != NULL && endingDate != NULL)
{
double beginningTDBJD = 0.0;
if (!ParseDate(rotationData, "Beginning", beginningTDBJD))
{
clog << "Invalid beginning date specified for SPICE rotation.\n";
return NULL;
}
SpiceRotation* rotation = NULL;
if (beginningDate != NULL && endingDate != NULL)
{
double beginningTDBJD = 0.0;
if (!ParseDate(rotationData, "Beginning", beginningTDBJD))
{
clog << "Invalid beginning date specified for SPICE rotation.\n";
return NULL;
}
double endingTDBJD = 0.0;
if (!ParseDate(rotationData, "Ending", endingTDBJD))
{
clog << "Invalid ending date specified for SPICE rotation.\n";
return NULL;
}
rotation = new SpiceRotation(frameName,
baseFrameName,
period,
beginningTDBJD,
endingTDBJD);
}
else
{
// No time interval given; rotation is valid at any time.
rotation = new SpiceRotation(frameName,
double endingTDBJD = 0.0;
if (!ParseDate(rotationData, "Ending", endingTDBJD))
{
clog << "Invalid ending date specified for SPICE rotation.\n";
return NULL;
}
rotation = new SpiceRotation(frameName,
baseFrameName,
period,
beginningTDBJD,
endingTDBJD);
}
else
{
// No time interval given; rotation is valid at any time.
rotation = new SpiceRotation(frameName,
baseFrameName,
period);
}
}
if (!rotation->init(path, &kernelList))
{
@ -807,7 +807,7 @@ CreateOrbit(const Selection& centralObject,
fixedPosition = Vector3d(fixedPosition.x(),
fixedPosition.z(),
-fixedPosition.y());
return new FixedOrbit(fixedPosition);
}
else if (fixedPositionValue->getType() == Value::HashType)
@ -942,19 +942,19 @@ CreateFixedAttitudeRotationModel(Hash* rotationData)
{
heading = degToRad(heading);
}
double tilt = 0.0;
if (rotationData->getAngle("Tilt", tilt))
{
tilt = degToRad(tilt);
}
double roll = 0.0;
if (rotationData->getAngle("Roll", roll))
{
roll = degToRad(roll);
}
Quaterniond q = YRotation(-PI - heading) *
XRotation(-tilt) *
ZRotation(-roll);
@ -1189,7 +1189,7 @@ CreateRotationModel(Hash* planetData,
return CreateFixedRotationModel(fixedRotationValue->getHash());
}
}
Value* fixedAttitudeValue = planetData->getValue("FixedAttitude");
if (fixedAttitudeValue != NULL)
{
@ -1673,7 +1673,7 @@ CreateJ2000EclipticFrame(const Universe& universe,
const Selection& defaultCenter)
{
Selection center = getFrameCenter(universe, frameData, defaultCenter);
if (center.empty())
return NULL;
else
@ -1687,7 +1687,7 @@ CreateJ2000EquatorFrame(const Universe& universe,
const Selection& defaultCenter)
{
Selection center = getFrameCenter(universe, frameData, defaultCenter);
if (center.empty())
return NULL;
else
@ -1707,8 +1707,8 @@ CreateTopocentricFrame(const Selection& center,
BodyMeanEquatorFrame* eqFrame = new BodyMeanEquatorFrame(target, target);
FrameVector north = FrameVector::createConstantVector(Vector3d::UnitY(), eqFrame);
FrameVector up = FrameVector::createRelativePositionVector(observer, target);
return new TwoVectorFrame(center, up, -2, north, -3);
return new TwoVectorFrame(center, up, -2, north, -3);
}
@ -1722,15 +1722,15 @@ CreateTopocentricFrame(const Selection& center,
* \code TwoVector
* {
* Center <center>
* Primary
* Primary
* {
* Axis "z"
* RelativePosition { Target <target> Observer <observer> }
* }
* Secondary
* Secondary
* {
* Axis "x"
* ConstantVector
* ConstantVector
* {
* Vector [ 0 0 1]
* Frame { BodyFixed { Center <target> } }
@ -1777,7 +1777,7 @@ CreateTopocentricFrame(const Universe& universe,
observer = center;
target = center.parent();
}
}
else
{
// When no center is provided, use the default observer as the center. This

View File

@ -131,7 +131,7 @@ ValueArray* Parser::readArray()
return NULL;
}
ValueArray* array = new ValueArray();
ValueArray* array = new ValueArray();
Value* v = readValue();
while (v != NULL)
@ -139,7 +139,7 @@ ValueArray* Parser::readArray()
array->insert(array->end(), v);
v = readValue();
}
tok = tokenizer->nextToken();
if (tok != Tokenizer::TokenEndArray)
{
@ -173,7 +173,7 @@ Hash* Parser::readHash()
return NULL;
}
string name = tokenizer->getNameValue();
#ifndef USE_POSTFIX_UNITS
readUnits(name, hash);
#endif
@ -186,7 +186,7 @@ Hash* Parser::readHash()
}
hash->addValue(name, *value);
#ifdef USE_POSTFIX_UNITS
readUnits(name, hash);
#endif
@ -221,10 +221,10 @@ bool Parser::readUnits(const string& propertyName, Hash* hash)
tokenizer->pushBack();
return false;
}
string unit = tokenizer->getNameValue();
Value* value = new Value(unit);
if (astro::isLengthUnit(unit))
{
string keyName(propertyName + "%Length");
@ -245,10 +245,10 @@ bool Parser::readUnits(const string& propertyName, Hash* hash)
delete value;
return false;
}
tok = tokenizer->nextToken();
}
return true;
}
@ -278,7 +278,7 @@ Value* Parser::readValue()
case Tokenizer::TokenBeginArray:
tokenizer->pushBack();
{
ValueArray* array = readArray();
ValueArray* array = readArray();
if (array == NULL)
return NULL;
else
@ -418,7 +418,7 @@ bool AssociativeArray::getVector(const string& key, Vec3d& val) const
if (v == NULL || v->getType() != Value::ArrayType)
return false;
ValueArray* arr = v->getArray();
ValueArray* arr = v->getArray();
if (arr->size() != 3)
return false;
@ -442,7 +442,7 @@ bool AssociativeArray::getVector(const string& key, Vector3d& val) const
if (v == NULL || v->getType() != Value::ArrayType)
return false;
ValueArray* arr = v->getArray();
ValueArray* arr = v->getArray();
if (arr->size() != 3)
return false;
@ -493,7 +493,7 @@ bool AssociativeArray::getRotation(const string& key, Quatf& val) const
if (v == NULL || v->getType() != Value::ArrayType)
return false;
ValueArray* arr = v->getArray();
ValueArray* arr = v->getArray();
if (arr->size() != 4)
return false;
@ -512,7 +512,7 @@ bool AssociativeArray::getRotation(const string& key, Quatf& val) const
(float) y->getNumber(),
(float) z->getNumber());
axis.normalize();
double ang = w->getNumber();
double angScale = 1.0;
getAngleScale(key, angScale);
@ -526,10 +526,10 @@ bool AssociativeArray::getRotation(const string& key, Quatf& val) const
/**
* Retrieves a quaternion, scaled to an associated angle unit.
*
*
* The quaternion is specified in the catalog file in axis-angle format as follows:
* \verbatim {PropertyName} [ angle axisX axisY axisZ ] \endverbatim
*
*
* @param[in] key Hash key for the rotation.
* @param[out] val A quaternion representing the value if present, unaffected if not.
* @return True if the key exists in the hash, false otherwise.
@ -540,7 +540,7 @@ bool AssociativeArray::getRotation(const string& key, Eigen::Quaternionf& val) c
if (v == NULL || v->getType() != Value::ArrayType)
return false;
ValueArray* arr = v->getArray();
ValueArray* arr = v->getArray();
if (arr->size() != 4)
return false;
@ -596,7 +596,7 @@ AssociativeArray::getAngle(const string& key, double& val, double outputScale, d
{
if (!getNumber(key, val))
return false;
double angleScale;
if(getAngleScale(key, angleScale))
{
@ -606,24 +606,24 @@ AssociativeArray::getAngle(const string& key, double& val, double outputScale, d
{
angleScale = (defaultScale == 0.0) ? 1.0 : defaultScale / outputScale;
}
val *= angleScale;
return true;
}
/** @copydoc AssociativeArray::getAngle() */
/** @copydoc AssociativeArray::getAngle() */
bool
AssociativeArray::getAngle(const string& key, float& val, double outputScale, double defaultScale) const
{
double dval;
if (!getAngle(key, dval, outputScale, defaultScale))
return false;
val = ((float) dval);
return true;
}
@ -641,7 +641,7 @@ AssociativeArray::getLength(const string& key, double& val, double outputScale,
{
if(!getNumber(key, val))
return false;
double lengthScale;
if(getLengthScale(key, lengthScale))
{
@ -651,9 +651,9 @@ AssociativeArray::getLength(const string& key, double& val, double outputScale,
{
lengthScale = (defaultScale == 0.0) ? 1.0 : defaultScale / outputScale;
}
val *= lengthScale;
return true;
}
@ -662,12 +662,12 @@ AssociativeArray::getLength(const string& key, double& val, double outputScale,
bool AssociativeArray::getLength(const string& key, float& val, double outputScale, double defaultScale) const
{
double dval;
if (!getLength(key, dval, outputScale, defaultScale))
return false;
val = ((float) dval);
return true;
}
@ -684,7 +684,7 @@ bool AssociativeArray::getTime(const string& key, double& val, double outputScal
{
if(!getNumber(key, val))
return false;
double timeScale;
if(getTimeScale(key, timeScale))
{
@ -694,9 +694,9 @@ bool AssociativeArray::getTime(const string& key, double& val, double outputScal
{
timeScale = (defaultScale == 0.0) ? 1.0 : defaultScale / outputScale;
}
val *= timeScale;
return true;
}
@ -705,12 +705,12 @@ bool AssociativeArray::getTime(const string& key, double& val, double outputScal
bool AssociativeArray::getTime(const string& key, float& val, double outputScale, double defaultScale) const
{
double dval;
if(!getLength(key, dval, outputScale, defaultScale))
return false;
val = ((float) dval);
return true;
}
@ -727,7 +727,7 @@ bool AssociativeArray::getLengthVector(const string& key, Eigen::Vector3d& val,
{
if(!getVector(key, val))
return false;
double lengthScale;
if(getLengthScale(key, lengthScale))
{
@ -737,9 +737,9 @@ bool AssociativeArray::getLengthVector(const string& key, Eigen::Vector3d& val,
{
lengthScale = (defaultScale == 0.0) ? 1.0 : defaultScale / outputScale;
}
val *= lengthScale;
return true;
}
@ -748,12 +748,12 @@ bool AssociativeArray::getLengthVector(const string& key, Eigen::Vector3d& val,
bool AssociativeArray::getLengthVector(const string& key, Eigen::Vector3f& val, double outputScale, double defaultScale) const
{
Vector3d vecVal;
if(!getLengthVector(key, vecVal, outputScale, defaultScale))
return false;
val = vecVal.cast<float>();
return true;
}
@ -768,18 +768,18 @@ bool AssociativeArray::getSphericalTuple(const string& key, Vector3d& val) const
{
if(!getVector(key, val))
return false;
double angleScale;
if(getAngleScale(key, angleScale))
{
val[0] *= angleScale;
val[1] *= angleScale;
}
double lengthScale = 1.0;
getLengthScale(key, lengthScale);
val[2] *= lengthScale;
return true;
}
@ -788,12 +788,12 @@ bool AssociativeArray::getSphericalTuple(const string& key, Vector3d& val) const
bool AssociativeArray::getSphericalTuple(const string& key, Vector3f& val) const
{
Vector3d vecVal;
if(!getSphericalTuple(key, vecVal))
return false;
val = vecVal.cast<float>();
return true;
}
@ -808,10 +808,10 @@ bool AssociativeArray::getAngleScale(const string& key, double& scale) const
{
string unitKey(key + "%Angle");
string unit;
if (!getString(unitKey, unit))
return false;
return astro::getAngleScale(unit, scale);
}
@ -822,7 +822,7 @@ bool AssociativeArray::getAngleScale(const string& key, float& scale) const
double dscale;
if (!getAngleScale(key, dscale))
return false;
scale = ((float) dscale);
return true;
}
@ -838,10 +838,10 @@ bool AssociativeArray::getLengthScale(const string& key, double& scale) const
{
string unitKey(key + "%Length");
string unit;
if (!getString(unitKey, unit))
return false;
return astro::getLengthScale(unit, scale);
}
@ -852,7 +852,7 @@ bool AssociativeArray::getLengthScale(const string& key, float& scale) const
double dscale;
if (!getLengthScale(key, dscale))
return false;
scale = ((float) dscale);
return true;
}
@ -868,10 +868,10 @@ bool AssociativeArray::getTimeScale(const string& key, double& scale) const
{
string unitKey(key + "%Time");
string unit;
if (!getString(unitKey, unit))
return false;
return astro::getTimeScale(unit, scale);
}
@ -882,7 +882,7 @@ bool AssociativeArray::getTimeScale(const string& key, float& scale) const
double dscale;
if (!getTimeScale(key, dscale))
return false;
scale = ((float) dscale);
return true;
}

View File

@ -66,7 +66,7 @@ class AssociativeArray
HashIterator begin();
HashIterator end();
private:
map<string, Value*> assoc;
};
@ -97,7 +97,7 @@ public:
double getNumber() const;
string getString() const;
ValueArray* getArray() const;
ValueArray* getArray() const;
Hash* getHash() const;
bool getBoolean() const;
@ -107,7 +107,7 @@ private:
union {
string* s;
double d;
ValueArray* a;
ValueArray* a;
Hash* h;
} data;
};
@ -122,9 +122,9 @@ public:
private:
Tokenizer* tokenizer;
bool readUnits(const std::string&, Hash*);
ValueArray* readArray();
ValueArray* readArray();
Hash* readHash();
};

View File

@ -50,7 +50,7 @@ using namespace std;
* This process is well-suited to a simulation where the time steps are
* relatively uniform. But, we cannot rely on a uniform time step in Celestia.
* The user may skip ahead instantly to times in the distance past or future,
* change the time rate to over a billion times normal, or reverse time.
* change the time rate to over a billion times normal, or reverse time.
* Numerical integration of particle positions is completely impractical.
*
* Instead, Celestia uses 'stateless' particle systems. From the particle
@ -94,26 +94,26 @@ public:
previous(0)
{
}
LCGRandomGenerator(uint64 seed) :
previous(seed)
{
}
uint64 randUint64()
{
previous = (A * previous + C) & M;
return previous;
}
/*! Return a random integer between -2^31 and 2^31 - 1
*/
int32 randInt32()
{
return (int32) (randUint64() >> 16);
}
/*! Return a random integer between 0 and 2^32 - 1
/*! Return a random integer between 0 and 2^32 - 1
*/
uint32 randUint32()
{
@ -131,7 +131,7 @@ public:
randBits = (randBits & 0x007fffff) | 0x3f800000;
return *reinterpret_cast<float*>(&randBits) - 1.0f;
}
/*! Generate a random floating point value in [ -1, 1 )
* This function directly manipulates the bits of a floating
* point number, and will not work properly on a system that
@ -143,7 +143,7 @@ public:
randBits = (randBits & 0x007fffff) | 0x40000000;
return *reinterpret_cast<float*>(&randBits) - 3.0f;
}
private:
uint64 previous;
};
@ -182,7 +182,7 @@ EllipsoidSurfaceGenerator::generate(LCGRandomGenerator& gen) const
float sinPhi = std::sqrt(1.0f - cosPhi * cosPhi);
if (cosPhi < 0.0f)
sinPhi = -sinPhi;
float s = std::sin(theta);
float c = std::cos(theta);
return Vector3f(sinPhi * c * m_semiAxes.x(), sinPhi * s * m_semiAxes.y(), cosPhi * m_semiAxes.z()) + m_center;
@ -197,11 +197,11 @@ ConeGenerator::generate(LCGRandomGenerator& gen) const
float sinPhi = std::sqrt(1.0f - cosPhi * cosPhi);
if (cosPhi < 0.0f)
sinPhi = -sinPhi;
float s = std::sin(theta);
float c = std::cos(theta);
return Vector3f(sinPhi * c, sinPhi * s, cosPhi) * (m_minLength + gen.randFloat() * m_lengthVariance);
}
}
@ -291,7 +291,7 @@ ParticleEmitter::setBlendMode(cmod::Material::BlendMode blendMode)
}
static const uint64 scrambleMask = (uint64(0xcccccccc) << 32) | 0xcccccccc;
static const uint64 scrambleMask = (uint64(0xcccccccc) << 32) | 0xcccccccc;
void
ParticleEmitter::render(double tsec,
@ -310,7 +310,7 @@ ParticleEmitter::render(double tsec,
if (t > m_endTime + m_lifetime)
return;
}
// If a start time is specified, set t to be relative to the start time.
// Return immediately if we haven't reached the start time yet.
if (startBounded)
@ -319,7 +319,7 @@ ParticleEmitter::render(double tsec,
if (t < 0.0)
return;
}
Matrix3f modelViewMatrix = rc.getCameraOrientation().conjugate().toRotationMatrix();
rc.setMaterial(&m_material);
@ -330,13 +330,13 @@ ParticleEmitter::render(double tsec,
Vector3f v3 = modelViewMatrix * Vector3f(-1.0f, 1.0f, 0.0f);
glDisable(GL_LIGHTING);
Texture* texture = NULL;
if (m_texture != InvalidResource)
{
texture = GetTextureManager()->find(m_texture);
}
if (texture != NULL)
{
glEnable(GL_TEXTURE_2D);
@ -346,50 +346,50 @@ ParticleEmitter::render(double tsec,
{
glDisable(GL_TEXTURE_2D);
}
// Use premultiplied alpha
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(GL_FALSE);
glDepthMask(GL_FALSE);
double emissionInterval = 1.0 / m_rate;
double dserial = std::fmod(t * m_rate, (double) (1 << 31));
int serial = (int) (dserial);
double age = (dserial - serial) * emissionInterval;
float invLifetime = (float) (1.0 / m_lifetime);
double maxAge = m_lifetime;
if (startBounded)
{
maxAge = std::min((double) m_lifetime, t);
}
if (endBounded && tsec > m_endTime)
{
int skipParticles = (int) ((tsec - m_endTime) * m_rate);
serial -= skipParticles;
age += skipParticles * emissionInterval;
}
Vec4f startColor(m_startColor.red(), m_startColor.green(), m_startColor.blue(), m_startColor.alpha());
Vec4f endColor(m_endColor.red(), m_endColor.green(), m_endColor.blue(), m_endColor.alpha());
unsigned int particleCount = 0;
while (age < maxAge)
{
// When the particle buffer is full, render the particles and flush it
if (particleCount == particleBufferCapacity)
{
glDrawArrays(GL_QUADS, 0, particleCount * 4);
glDrawArrays(GL_QUADS, 0, particleCount * 4);
particleCount = 0;
}
float alpha = (float) age * invLifetime;
float beta = 1.0f - alpha;
float size = alpha * m_endSize + beta * m_startSize;
// Scramble the random number generator seed so that we don't end up with
// artifacts from using regularly incrementing values.
//
@ -406,12 +406,12 @@ ParticleEmitter::render(double tsec,
color[Color::Green] = (unsigned char) ((alpha * endColor.y + beta * startColor.y) * 255.99f);
color[Color::Blue] = (unsigned char) ((alpha * endColor.z + beta * startColor.z) * 255.99f);
color[Color::Alpha] = (unsigned char) ((alpha * endColor.w + beta * startColor.w) * 255.99f);
Vector3f v = m_velocityGenerator->generate(gen);
Vector3f center = m_positionGenerator->generate(gen) + v * (float) age;
if (m_nonZeroAcceleration)
center += m_acceleration * (float) (age * age);
if (!m_rotationEnabled)
{
particleBuffer[particleCount * 4 + 0].set(center + v0 * size, Vector2f(0.0f, 1.0f), color);
@ -425,19 +425,19 @@ ParticleEmitter::render(double tsec,
float rotation = rotationRate * (float) age;
float c = std::cos(rotation);
float s = std::sin(rotation);
particleBuffer[particleCount * 4 + 0].set(center + (modelViewMatrix * Vector3f(-c + s, -s - c, 0.0f)) * size, Vector2f(0.0f, 1.0f), color);
particleBuffer[particleCount * 4 + 1].set(center + (modelViewMatrix * Vector3f( c + s, s - c, 0.0f)) * size, Vector2f(1.0f, 1.0f), color);
particleBuffer[particleCount * 4 + 2].set(center + (modelViewMatrix * Vector3f( c - s, s + c, 0.0f)) * size, Vector2f(1.0f, 0.0f), color);
particleBuffer[particleCount * 4 + 3].set(center + (modelViewMatrix * Vector3f(-c - s, -s + c, 0.0f)) * size, Vector2f(0.0f, 0.0f), color);
}
++particleCount;
age += emissionInterval;
serial--;
}
// Render any remaining particles in the buffer
if (particleCount > 0)
{
@ -454,7 +454,7 @@ ParticleEmitter::createMaterial()
m_material.blend = m_blendMode;
m_material.opacity = 0.99f;
m_material.maps[0] = new CelestiaTextureResource(m_texture);
}
}
#define STRUCT_OFFSET(s, memberName) ((uint32) (reinterpret_cast<char*>(&(s).memberName) - reinterpret_cast<char*>(&(s))))
@ -467,7 +467,7 @@ ParticleSystem::ParticleSystem() :
{
m_particleCapacity = 1000;
m_vertexData = new ParticleVertex[m_particleCapacity * 4];
// Create the vertex description; currently, it is the same for all
// particle systems.
ParticleVertex temp;
@ -485,8 +485,8 @@ ParticleSystem::~ParticleSystem()
iter != m_emitterList.end(); iter++)
{
delete (*iter);
}
}
delete[] m_vertexData;
delete m_vertexDesc;
}
@ -496,13 +496,13 @@ void
ParticleSystem::render(RenderContext& rc, double tsec)
{
rc.setVertexArrays(*m_vertexDesc, m_vertexData);
for (list<ParticleEmitter*>::const_iterator iter = m_emitterList.begin();
iter != m_emitterList.end(); iter++)
{
(*iter)->render(tsec, rc, m_vertexData, m_particleCapacity);
}
glEnable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
}

View File

@ -34,7 +34,7 @@ struct ParticleVertex
color[Color::Blue] = _color[Color::Blue];
color[Color::Alpha] = _color[Color::Alpha];
}
Eigen::Vector3f position;
Eigen::Vector2f texCoord;
unsigned char color[4];
@ -48,45 +48,45 @@ public:
ParticleEmitter();
~ParticleEmitter();
void render(double tsec, RenderContext& rc, ParticleVertex* particleBuffer, unsigned int bufferCapacity) const;
void setAcceleration(const Eigen::Vector3f& acceleration);
void createMaterial();
void setLifespan(double startTime, double endTime);
void setRotationRateRange(float minRate, float maxRate);
void setBlendMode(cmod::Material::BlendMode blendMode);
private:
double m_startTime;
double m_endTime;
public:
ResourceHandle m_texture;
float m_rate;
float m_lifetime;
Color m_startColor;
float m_startSize;
Color m_endColor;
float m_endSize;
VectorGenerator* m_positionGenerator;
VectorGenerator* m_velocityGenerator;
private:
Eigen::Vector3f m_acceleration;
bool m_nonZeroAcceleration;
float m_minRotationRate;
float m_rotationRateVariance;
bool m_rotationEnabled;
cmod::Material::BlendMode m_blendMode;
cmod::Material m_material;
};
@ -96,20 +96,20 @@ class ParticleSystem : public Geometry
public:
ParticleSystem();
virtual ~ParticleSystem();
virtual void render(RenderContext& rc, double t = 0.0);
virtual bool pick(const Ray3d& r, double& distance) const;
virtual bool isOpaque() const;
void addEmitter(ParticleEmitter* emitter);
public:
std::list<ParticleEmitter*> m_emitterList;
cmod::Mesh::VertexDescription* m_vertexDesc;
ParticleVertex* m_vertexData;
unsigned int m_particleCapacity;
unsigned int m_particleCount;
unsigned int m_particleCount;
};
@ -134,9 +134,9 @@ class ConstantGenerator : public VectorGenerator
{
public:
ConstantGenerator(const Eigen::Vector3f& value) : m_value(value) {}
virtual Eigen::Vector3f generate(LCGRandomGenerator& gen) const;
private:
Eigen::Vector3f m_value;
};
@ -152,9 +152,9 @@ public:
m_semiAxes(axes * 0.5f)
{
}
virtual Eigen::Vector3f generate(LCGRandomGenerator& gen) const;
private:
Eigen::Vector3f m_center;
Eigen::Vector3f m_semiAxes;
@ -172,9 +172,9 @@ public:
m_direction(p1 - p0)
{
}
virtual Eigen::Vector3f generate(LCGRandomGenerator& gen) const;
private:
Eigen::Vector3f m_origin;
Eigen::Vector3f m_direction;
@ -192,9 +192,9 @@ public:
m_semiAxes(semiAxes)
{
}
virtual Eigen::Vector3f generate(LCGRandomGenerator& gen) const;
private:
Eigen::Vector3f m_center;
Eigen::Vector3f m_semiAxes;
@ -214,9 +214,9 @@ public:
m_lengthVariance(maxLength - minLength)
{
}
virtual Eigen::Vector3f generate(LCGRandomGenerator& gen) const;
private:
float m_cosMinAngle;
float m_cosAngleVariance;

View File

@ -43,18 +43,18 @@ ParticleSystem*
ParticleSystemLoader::load()
{
ParticleSystem* particleSystem = new ParticleSystem();
while (m_tokenizer.nextToken() != Tokenizer::TokenEnd)
{
string objType;
if (m_tokenizer.getTokenType() != Tokenizer::TokenName)
{
raiseError("Error parsing particle system");
delete particleSystem;
return NULL;
}
objType = m_tokenizer.getNameValue();
if (objType != "Emitter")
{
@ -74,7 +74,7 @@ ParticleSystemLoader::load()
delete particleSystem;
return NULL;
}
Hash* objParams = objParamsValue->getHash();
if (objType == "Emitter")
{
@ -84,11 +84,11 @@ ParticleSystemLoader::load()
delete particleSystem;
return NULL;
}
particleSystem->addEmitter(emitter);
}
}
return particleSystem;
}
@ -101,7 +101,7 @@ ParticleSystemLoader::parseGenerator(Hash* params)
{
return new ConstantGenerator(constantValue);
}
Value* generatorValue = NULL;
generatorValue = params->getValue("Box");
if (generatorValue != NULL)
@ -111,17 +111,17 @@ ParticleSystemLoader::parseGenerator(Hash* params)
raiseError("Error in Box syntax");
return NULL;
}
Hash* boxParams = generatorValue->getHash();
Vector3f center(0.0f, 0.0f, 0.0f);
Vector3f size(0.0f, 0.0f, 0.0f);
boxParams->getVector("Center", center);
boxParams->getVector("Size", size);
return new BoxGenerator(center, size);
}
generatorValue = params->getValue("Line");
if (generatorValue != NULL)
{
@ -130,17 +130,17 @@ ParticleSystemLoader::parseGenerator(Hash* params)
raiseError("Error in Line syntax");
return NULL;
}
Hash* lineParams = generatorValue->getHash();
Vector3f p0(0.0f, 0.0f, 0.0f);
Vector3f p1(0.0f, 0.0f, 0.0f);
lineParams->getVector("Point1", p0);
lineParams->getVector("Point2", p1);
return new LineGenerator(p0, p1);
}
generatorValue = params->getValue("EllipsoidSurface");
if (generatorValue != NULL)
{
@ -149,17 +149,17 @@ ParticleSystemLoader::parseGenerator(Hash* params)
raiseError("Error in EllipsoidSurface syntax");
return NULL;
}
Hash* ellipsoidSurfaceParams = generatorValue->getHash();
Vector3f center(0.0f, 0.0f, 0.0f);
Vector3f size(2.0f, 2.0f, 2.0f);
ellipsoidSurfaceParams->getVector("Center", center);
ellipsoidSurfaceParams->getVector("Size", size);
return new EllipsoidSurfaceGenerator(center, size * 0.5f);
return new EllipsoidSurfaceGenerator(center, size * 0.5f);
}
generatorValue = params->getValue("Cone");
if (generatorValue != NULL)
{
@ -168,9 +168,9 @@ ParticleSystemLoader::parseGenerator(Hash* params)
raiseError("Error in Cone syntax");
return NULL;
}
Hash* coneParams = generatorValue->getHash();
double minAngle = 0.0;
double maxAngle = 0.0;
double minSpeed = 0.0;
@ -179,8 +179,8 @@ ParticleSystemLoader::parseGenerator(Hash* params)
coneParams->getNumber("MaxAngle", maxAngle);
coneParams->getNumber("MinSpeed", minSpeed);
coneParams->getNumber("MaxSpeed", maxSpeed);
return new ConeGenerator((float) degToRad(minAngle), (float) degToRad(maxAngle), (float) minSpeed, (float) maxSpeed);
return new ConeGenerator((float) degToRad(minAngle), (float) degToRad(maxAngle), (float) minSpeed, (float) maxSpeed);
}
generatorValue = params->getValue("GaussianDisc");
@ -191,17 +191,17 @@ ParticleSystemLoader::parseGenerator(Hash* params)
raiseError("Error in GaussianDisc syntax");
return NULL;
}
Hash* gaussianDiscParams = generatorValue->getHash();
double sigma = 1.0;
gaussianDiscParams->getNumber("Sigma", sigma);
return new GaussianDiscGenerator((float) sigma);
}
raiseError("Missing generator for emitter");
return NULL;
}
@ -215,27 +215,27 @@ ParticleSystemLoader::parseEmitter(Hash* params)
{
textureHandle = GetTextureManager()->getHandle(TextureInfo(textureFileName, getTexturePath(), TextureInfo::BorderClamp));
}
double rate = 1.0;
double lifetime = 1.0;
params->getNumber("Rate", rate);
params->getNumber("Lifetime", lifetime);
double startSize = 1.0;
double endSize = 1.0;
params->getNumber("StartSize", startSize);
params->getNumber("EndSize", endSize);
Color startColor(Color::White);
Color endColor(Color::Black);
float startOpacity = 0.0f;
float endOpacity = 0.0f;
params->getColor("StartColor", startColor);
params->getNumber("StartOpacity", startOpacity);
params->getColor("EndColor", endColor);
params->getNumber("EndOpacity", endOpacity);
VectorGenerator* initialPositionGenerator = NULL;
Value* positionValue = params->getValue("InitialPosition");
if (positionValue == NULL)
@ -253,12 +253,12 @@ ParticleSystemLoader::parseEmitter(Hash* params)
initialPositionGenerator = parseGenerator(positionValue->getHash());
}
}
if (initialPositionGenerator == NULL)
{
return NULL;
}
VectorGenerator* initialVelocityGenerator = NULL;
Value* velocityValue = params->getValue("InitialVelocity");
if (velocityValue == NULL)
@ -276,26 +276,26 @@ ParticleSystemLoader::parseEmitter(Hash* params)
initialVelocityGenerator = parseGenerator(velocityValue->getHash());
}
}
if (initialVelocityGenerator == NULL)
{
delete initialPositionGenerator;
return NULL;
}
Vector3f acceleration;
params->getVector("Acceleration", acceleration);
double startTime = -numeric_limits<double>::infinity();
double endTime = numeric_limits<double>::infinity();
params->getNumber("Beginning", startTime);
params->getNumber("Ending", endTime);
double minRotationRate = 0.0;
double maxRotationRate = 0.0;
params->getNumber("MinRotationRate", minRotationRate);
params->getNumber("MaxRotationRate", maxRotationRate);
ParticleEmitter* emitter = new ParticleEmitter();
emitter->m_texture = textureHandle;
emitter->m_rate = (float) rate;
@ -307,12 +307,12 @@ ParticleSystemLoader::parseEmitter(Hash* params)
emitter->m_positionGenerator = initialPositionGenerator;
emitter->m_velocityGenerator = initialVelocityGenerator;
emitter->createMaterial();
emitter->setAcceleration(acceleration);
emitter->setLifespan(startTime, endTime);
emitter->setRotationRateRange((float) degToRad(minRotationRate), (float) degToRad(maxRotationRate));
return emitter;
}
@ -345,7 +345,7 @@ ParticleSystemLoader::getTexturePath() const
}
ParticleSystem*
ParticleSystem*
LoadParticleSystem(istream& in, const string& texPath)
{
ParticleSystemLoader* loader = new ParticleSystemLoader(in);

View File

@ -34,7 +34,7 @@ class ParticleSystemLoader
const std::string& getErrorMessage() const;
void setTexturePath(const std::string&);
const std::string& getTexturePath() const;
static ParticleSystemLoader* OpenParticleSystemFile(std::istream& in);
private:
@ -44,7 +44,7 @@ class ParticleSystemLoader
Tokenizer m_tokenizer;
Parser m_parser;
std::string m_errorMessage;
std::string m_texPath;
std::string m_texPath;
};

View File

@ -63,11 +63,11 @@ static void longLatLabel(const string& labelText,
Vector3d pos(cos(phi) * cos(theta) * semiAxes.x(),
sin(phi) * semiAxes.y(),
-cos(phi) * sin(theta) * semiAxes.z());
float nearDist = renderer->getNearPlaneDistance();
pos = pos * (1.0 + labelOffset);
double boundingRadius = semiAxes.maxCoeff();
// Draw the label only if it isn't obscured by the body ellipsoid
@ -77,7 +77,7 @@ static void longLatLabel(const string& labelText,
// Compute the position of the label
Vector3d labelPos = bodyCenter +
bodyOrientation.conjugate() * pos * (1.0 + labelOffset);
// Calculate the intersection of the eye-to-label ray with the plane perpendicular to
// the view normal that touches the front of the objects bounding sphere
double planetZ = viewNormal.dot(bodyCenter) - boundingRadius;
@ -85,7 +85,7 @@ static void longLatLabel(const string& labelText,
planetZ = -nearDist * 1.001;
double z = viewNormal.dot(labelPos);
labelPos *= planetZ / z;
renderer->addObjectAnnotation(NULL, labelText,
Renderer::PlanetographicGridLabelColor,
labelPos.cast<float>());
@ -113,7 +113,7 @@ PlanetographicGrid::render(Renderer* renderer,
Vector3f semiAxes = body.getSemiAxes();
Vector3d posd = pos.cast<double>();
Vector3d viewRayOrigin = q * -pos.cast<double>();
// Calculate the view normal; this is used for placement of the long/lat
// label text.
Vector3f vn = renderer->getCameraOrientation().conjugate() * -Vector3f::UnitZ();
@ -146,7 +146,7 @@ PlanetographicGrid::render(Renderer* renderer,
latitudeStep = 30.0f;
longitudeStep = 30.0f;
}
for (float latitude = -90.0f + latitudeStep; latitude < 90.0f; latitude += latitudeStep)
{
float phi = degToRad(latitude);
@ -167,7 +167,7 @@ PlanetographicGrid::render(Renderer* renderer,
glDrawArrays(GL_LINE_LOOP, 0, circleSubdivisions);
glPopMatrix();
glLineWidth(1.0f);
if (showCoordinateLabels)
{
if (latitude != 0.0f && abs(latitude) < 90.0f)
@ -241,7 +241,7 @@ PlanetographicGrid::render(Renderer* renderer,
break;
}
sprintf(buf, "%d%c", showLongitude, ew);
sprintf(buf, "%d%c", showLongitude, ew);
longLatLabel(buf, -longitude, 0.0, viewRayOrigin, viewNormal, posd, q, semiAxes, offset, renderer);
}
}

View File

@ -1,5 +1,5 @@
// regcombine.h
//
//
// Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
//
// Some functions for setting up the nVidia register combiners

View File

@ -319,7 +319,7 @@ FixedFunctionRenderContext::makeCurrent(const Material& m)
glMaterialfv(GL_FRONT, GL_SHININESS, &m.specularPower);
specularOn = true;
}
{
float matEmissive[4] = { m.emissive.red(),
m.emissive.green(),
@ -836,7 +836,7 @@ GLSL_RenderContext::makeCurrent(const Material& m)
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(disableDepthWriteOnBlend ? GL_FALSE : GL_TRUE);
break;
break;
default:
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
@ -1002,7 +1002,7 @@ GLSLUnlit_RenderContext::makeCurrent(const Material& m)
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(GL_FALSE);
break;
break;
default:
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);

View File

@ -47,10 +47,10 @@ class RenderContext
void setPointScale(float);
float getPointScale() const;
void setCameraOrientation(const Eigen::Quaternionf& q);
Eigen::Quaternionf getCameraOrientation() const;
private:
const cmod::Material* material;
bool locked;
@ -113,15 +113,15 @@ class GLSL_RenderContext : public RenderContext
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
GLSL_RenderContext(const LightingState& ls, float _objRadius, const Eigen::Quaternionf& orientation);
GLSL_RenderContext(const LightingState& ls, const Eigen::Vector3f& _objScale, const Eigen::Quaternionf& orientation);
virtual ~GLSL_RenderContext();
virtual void makeCurrent(const cmod::Material&);
virtual void setVertexArrays(const cmod::Mesh::VertexDescription& desc,
const void* vertexData);
virtual void setLunarLambert(float);
virtual void setAtmosphere(const Atmosphere*);
@ -129,7 +129,7 @@ class GLSL_RenderContext : public RenderContext
void initLightingEnvironment();
void setLightingParameters(CelestiaGLProgram& prog, Color diffuseColor, Color specularColor);
void setShadowParameters(CelestiaGLProgram& prog);
private:
const LightingState& lightingState;
const Atmosphere* atmosphere;
@ -137,10 +137,10 @@ class GLSL_RenderContext : public RenderContext
float objRadius;
Eigen::Vector3f objScale;
Eigen::Quaternionf objOrientation;
// extended material properties
float lunarLambert;
ShaderProperties shaderProps;
};
@ -150,7 +150,7 @@ class GLSLUnlit_RenderContext : public RenderContext
public:
GLSLUnlit_RenderContext(float _objRadius);
virtual ~GLSLUnlit_RenderContext();
virtual void makeCurrent(const cmod::Material&);
virtual void setVertexArrays(const cmod::Mesh::VertexDescription& desc,
const void* vertexData);
@ -158,11 +158,11 @@ class GLSLUnlit_RenderContext : public RenderContext
private:
void initLightingEnvironment();
void setLightingParameters(CelestiaGLProgram& prog, Color diffuseColor, Color specularColor);
private:
cmod::Material::BlendMode blendMode;
float objRadius;
ShaderProperties shaderProps;
};

View File

@ -317,7 +317,7 @@ public:
void render();
void finish();
inline void addStar(const Eigen::Vector3f& pos, const Color&, float);
void setTexture(Texture*);
void setTexture(Texture*);
private:
struct StarVertex
@ -333,7 +333,7 @@ private:
StarVertex* vertices;
const GLContext* context;
bool useSprites;
Texture* texture;
Texture* texture;
};
@ -442,7 +442,7 @@ PointStarVertexBuffer::PointStarVertexBuffer(unsigned int _capacity) :
vertices(NULL),
context(NULL),
useSprites(false),
texture(NULL)
texture(NULL)
{
vertices = new StarVertex[capacity];
}
@ -576,7 +576,7 @@ inline void PointStarVertexBuffer::addStar(const Eigen::Vector3f& pos,
void PointStarVertexBuffer::setTexture(Texture* _texture)
{
texture = _texture;
texture = _texture;
}
/**** End star vertex buffer classes ****/
@ -852,11 +852,11 @@ static void RectToSphericalMapEval(float x, float y, float z,
// Compute spherical coodinates (r is always 1)
double phi = asin(y);
double theta = atan2(z, -x);
// Convert to texture coordinates
double u = (theta / PI + 1.0) * 0.5;
double v = (-phi / PI + 0.5);
// Pack texture coordinates in red/green and blue/alpha
// u = red + green/256
// v = blue* + alpha/256
@ -1613,7 +1613,7 @@ void Renderer::addSortedAnnotation(const MarkerRepresentation* markerRep,
&winX, &winY, &winZ) != GL_FALSE)
{
Annotation a;
a.labelText[0] = '\0';
if (markerRep == NULL)
{
@ -1673,7 +1673,7 @@ void Renderer::beginObjectAnnotations()
void Renderer::endObjectAnnotations()
{
objectAnnotationSetOpen = false;
if (!objectAnnotations.empty())
{
renderAnnotations(objectAnnotations.begin(),
@ -1708,7 +1708,7 @@ void Renderer::addObjectAnnotation(const MarkerRepresentation* markerRep,
{
Annotation a;
a.labelText[0] = '\0';
if (!labelText.empty())
{
@ -2325,7 +2325,7 @@ void Renderer::genBlurTexture(int blurLevel)
void Renderer::genSceneTexture()
{
unsigned int *data;
unsigned int *data;
if (sceneTexture != 0)
glDeleteTextures(1, &sceneTexture);
@ -2339,19 +2339,19 @@ void Renderer::genSceneTexture()
1.0f;
sceneTexHScale = (windowHeight > 0) ? (GLfloat)sceneTexHeight / (GLfloat)windowHeight :
1.0f;
data = (unsigned int* )malloc(sceneTexWidth*sceneTexHeight*4*sizeof(unsigned int));
data = (unsigned int* )malloc(sceneTexWidth*sceneTexHeight*4*sizeof(unsigned int));
memset(data, 0, sceneTexWidth*sceneTexHeight*4*sizeof(unsigned int));
glGenTextures(1, &sceneTexture);
glBindTexture(GL_TEXTURE_2D, sceneTexture);
glBindTexture(GL_TEXTURE_2D, sceneTexture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, sceneTexWidth, sceneTexHeight, 0,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, sceneTexWidth, sceneTexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data);
free(data);
free(data);
#ifdef DEBUG_HDR
static int genSceneTexCounter = 1;
HDR_LOG <<
@ -3000,12 +3000,12 @@ void Renderer::draw(const Observer& observer,
{
float nearZ = center.distanceFromOrigin() - radius;
nearZ = -nearZ * nearZcoeff;
if (nearZ > -MinNearPlaneDistance)
iter->nearZ = -max(MinNearPlaneDistance, radius / 2000.0f);
else
iter->nearZ = nearZ;
if (!convex)
{
iter->farZ = center.z - radius;
@ -3016,7 +3016,7 @@ void Renderer::draw(const Observer& observer,
{
// Make the far plane as close as possible
float d = center.distanceFromOrigin();
// Account for ellipsoidal objects
float eradius = radius;
if (iter->body != NULL)
@ -3036,7 +3036,7 @@ void Renderer::draw(const Observer& observer,
// is spherical, inside the planet.)
iter->farZ = iter->nearZ * 2.0f;
}
if (cloudHeight > 0.0f)
{
// If there's a cloud layer, we need to move the
@ -3046,7 +3046,7 @@ void Renderer::draw(const Observer& observer,
square(eradius));
}
}
*notCulled = *iter;
notCulled++;
@ -3080,7 +3080,7 @@ void Renderer::draw(const Observer& observer,
float radius = iter->body->getRadius();
Vector3f semiAxes = iter->body->getSemiAxes() / radius;
Vector3f recipSemiAxes = semiAxes.cwiseInverse();
Vector3f recipSemiAxes = semiAxes.cwiseInverse();
Vector3f eyeVec = iter->position / radius;
// Compute the orientation of the planet before axial rotation
@ -3173,7 +3173,7 @@ void Renderer::draw(const Observer& observer,
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
// Render sky grids first--these will always be in the background
{
glDisable(GL_TEXTURE_2D);
@ -3187,8 +3187,8 @@ void Renderer::draw(const Observer& observer,
}
// Render deep sky objects
if ((renderFlags & (ShowGalaxies |
ShowGlobulars |
if ((renderFlags & (ShowGalaxies |
ShowGlobulars |
ShowNebulae |
ShowOpenClusters)) != 0 &&
universe.getDSOCatalog() != NULL)
@ -3250,24 +3250,24 @@ void Renderer::draw(const Observer& observer,
{
Asterism* ast = *iter;
if (ast->getActive())
if (ast->getActive())
{
if (ast->isColorOverridden())
glColor(ast->getOverrideColor(), opacity);
else
glColor(ConstellationColor, opacity);
if (ast->isColorOverridden())
glColor(ast->getOverrideColor(), opacity);
else
glColor(ConstellationColor, opacity);
for (int i = 0; i < ast->getChainCount(); i++)
{
const Asterism::Chain& chain = ast->getChain(i);
for (int i = 0; i < ast->getChainCount(); i++)
{
const Asterism::Chain& chain = ast->getChain(i);
glBegin(GL_LINE_STRIP);
for (Asterism::Chain::const_iterator iter = chain.begin();
iter != chain.end(); iter++)
glVertex3fv(iter->data());
glEnd();
}
}
glBegin(GL_LINE_STRIP);
for (Asterism::Chain::const_iterator iter = chain.begin();
iter != chain.end(); iter++)
glVertex3fv(iter->data());
glEnd();
}
}
}
if ((renderFlags & ShowSmoothLines) != 0)
@ -3313,13 +3313,13 @@ void Renderer::draw(const Observer& observer,
{
renderMarkers(*universe.getMarkers(),
observer.getPosition(),
observer.getOrientation(),
observer.getOrientation(),
now);
// Render background markers; rendering of other markers is deferred until
// solar system objects are rendered.
renderBackgroundAnnotations(FontNormal);
}
}
// Draw the selection cursor
bool selectionVisible = false;
@ -3340,7 +3340,7 @@ void Renderer::draw(const Observer& observer,
if (sel.body() != NULL)
boundingRadius = sel.body()->getBoundingRadius();
else
boundingRadius = sel.radius();
boundingRadius = sel.radius();
offset *= (1.0 - boundingRadius * 1.01 / distance);
// The selection cursor is only partially visible when the selected object is obscured. To implement
@ -3666,19 +3666,19 @@ void Renderer::draw(const Observer& observer,
if (minNearDistance > zNearest)
zNearest = minNearDistance;
}
// Adjust the nearest interval to include the closest marker (if it's
// closer to the observer than anything else
if (!depthSortedAnnotations.empty())
{
// Factor of 0.999 makes sure ensures that the near plane does not fall
// exactly at the marker's z coordinate (in which case the marker
// would be susceptible to getting clipped.)
// exactly at the marker's z coordinate (in which case the marker
// would be susceptible to getting clipped.)
if (-depthSortedAnnotations[0].position.z() > zNearest)
zNearest = -depthSortedAnnotations[0].position.z() * 0.999f;
}
#if DEBUG_COALESCE
clog << "nEntries: " << nEntries << ", zNearest: " << zNearest << ", prevNear: " << prevNear << "\n";
#endif
@ -3793,7 +3793,7 @@ void Renderer::draw(const Observer& observer,
clog << "point: " << renderList[i].body->getName() << "\n";
}
break;
case RenderListEntry::RenderableStar:
if (renderList[i].discSizeInPixels > 1)
{
@ -3804,7 +3804,7 @@ void Renderer::draw(const Observer& observer,
clog << "point: " << "Star" << "\n";
}
break;
default:
break;
}
@ -3910,7 +3910,7 @@ void Renderer::draw(const Observer& observer,
// reset the depth range
glDepthRange(0, 1);
}
renderForegroundAnnotations(FontNormal);
glMatrixMode(GL_PROJECTION);
@ -3932,7 +3932,7 @@ void Renderer::draw(const Observer& observer,
glPolygonMode(GL_FRONT, GL_FILL);
glPolygonMode(GL_BACK, GL_FILL);
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
glEnable(GL_LIGHTING);
@ -4621,7 +4621,7 @@ void Renderer::renderEllipsoidAtmosphere(const Atmosphere& atmosphere,
double centerDist = eyeVec.norm();
float height = atmosphere.height / radius;
Vector3f recipSemiAxes = semiAxes.cwiseInverse();
Vector3f recipSemiAxes = semiAxes.cwiseInverse();
Vector3f recipAtmSemiAxes = recipSemiAxes / (1.0f + height);
// ellipDist is not the true distance from the surface unless the
@ -4733,7 +4733,7 @@ void Renderer::renderEllipsoidAtmosphere(const Atmosphere& atmosphere,
Vector3f botColor = atmosphere.lowerColor.toVector3();
Vector3f topColor = atmosphere.upperColor.toVector3();
Vector3f sunsetColor = atmosphere.sunsetColor.toVector3();
if (within)
{
Vector3f skyColor = atmosphere.skyColor.toVector3();
@ -4994,7 +4994,7 @@ static void setLightParameters_VP(VertexProcessor& vproc,
Vector3f lightColor = light.color.toVector3() * light.irradiance;
Vector3f diffuse = diffuseColor.cwiseProduct(lightColor);
Vector3f specular = specularColor.cwiseProduct(lightColor);
// Just handle two light sources for now
if (i == 0)
{
@ -6296,7 +6296,7 @@ renderEclipseShadows_Shaders(Geometry* geometry,
const GLContext& context)
{
Matrix3f planetTransform = planetOrientation.toRotationMatrix();
// Eclipse shadows on mesh objects are only implemented in the GLSL path
if (geometry != NULL)
return;
@ -6498,9 +6498,9 @@ void Renderer::renderLocations(const Body& body,
const vector<Location*>* locations = body.getLocations();
if (locations == NULL)
return;
Vector3f semiAxes = body.getSemiAxes();
float nearDist = getNearPlaneDistance();
double boundingRadius = semiAxes.maxCoeff();
@ -6510,37 +6510,37 @@ void Renderer::renderLocations(const Body& body,
Vector3f vn = getCameraOrientation().conjugate() * -Vector3f::UnitZ();
Vector3d viewNormal = vn.cast<double>();
Ellipsoidd bodyEllipsoid(semiAxes.cast<double>());
Matrix3d bodyMatrix = bodyOrientation.conjugate().toRotationMatrix();
for (vector<Location*>::const_iterator iter = locations->begin();
iter != locations->end(); iter++)
{
const Location& location = **iter;
if (location.getFeatureType() & locationFilter)
{
// Get the position of the location with respect to the planet center
Vector3f ppos = location.getPosition();
// Compute the bodycentric position of the location
Vector3d locPos = ppos.cast<double>();
// Get the planetocentric position of the label. Add a slight scale factor
// to keep the point from being exactly on the surface.
Vector3d pcLabelPos = locPos * (1.0 + labelOffset);
// Get the camera space label position
Vector3d labelPos = bodyCenter + bodyMatrix * locPos;
float effSize = location.getImportance();
if (effSize < 0.0f)
effSize = location.getSize();
float pixSize = effSize / (float) (labelPos.norm() * pixelSize);
if (pixSize > minFeatureSize && labelPos.dot(viewNormal) > 0.0)
{
// Labels on non-ellipsoidal bodies need special handling; the
@ -6554,9 +6554,9 @@ void Renderer::renderLocations(const Body& body,
if (r < boundingRadius)
pcLabelPos = locPos * (boundingRadius * 1.01 / r);
}
double t = 0.0;
// Test for an intersection of the eye-to-location ray with
// the planet ellipsoid. If we hit the planet first, then
// the label is obscured by the planet. An exact calculation
@ -6566,7 +6566,7 @@ void Renderer::renderLocations(const Body& body,
bool hit = testIntersection(testRay, bodyEllipsoid, t);
if (!hit || t >= 1.0)
{
{
// Calculate the intersection of the eye-to-label ray with the plane perpendicular to
// the view normal that touches the front of the object's bounding sphere
double planetZ = viewNormal.dot(bodyCenter) - boundingRadius;
@ -6574,7 +6574,7 @@ void Renderer::renderLocations(const Body& body,
planetZ = -nearDist * 1.001;
double z = viewNormal.dot(labelPos);
labelPos *= planetZ / z;
uint32 featureType = location.getFeatureType();
MarkerRepresentation* locationMarker = NULL;
if (featureType & Location::City)
@ -6596,7 +6596,7 @@ void Renderer::renderLocations(const Body& body,
}
}
}
}
}
}
@ -6639,7 +6639,7 @@ estimateReflectedLightFraction(const Vector3d& toSun,
// s = sin(phi) * sin(theta)
float s = (float) sqrt((1.0f - cosPhi * cosPhi) * (1.0f - cosTheta * cosTheta));
float cosPhi1 = cosPhi * cosTheta - s; // cos(phi + theta)
float cosPhi2 = cosPhi * cosTheta + s; // cos(phi - theta)
@ -6715,7 +6715,7 @@ setupObjectLighting(const vector<LightSource>& suns,
{
// Account for the phase
Vector3d toSun = objpos - suns[0].position;
irr *= estimateReflectedLightFraction(toSun, toIllum, iter->radius);
irr *= estimateReflectedLightFraction(toSun, toIllum, iter->radius);
if (irr > maxIrr)
{
maxIrr = irr;
@ -6724,7 +6724,7 @@ setupObjectLighting(const vector<LightSource>& suns,
}
}
}
#if DEBUG_SECONDARY_ILLUMINATION
#if DEBUG_SECONDARY_ILLUMINATION
clog << "maxIrr = " << maxIrr << ", "
<< secondaryIlluminators[maxIrrSource].body->getName() << ", "
<< secondaryIlluminators[maxIrrSource].reflectedIrradiance << endl;
@ -6737,7 +6737,7 @@ setupObjectLighting(const vector<LightSource>& suns,
ls.lights[i].direction_eye = toIllum.cast<float>();
ls.lights[i].direction_eye.normalize();
ls.lights[i].irradiance = maxIrr;
ls.lights[i].color = secondaryIlluminators[maxIrrSource].body->getSurface().color;
ls.lights[i].color = secondaryIlluminators[maxIrrSource].body->getSurface().color;
ls.lights[i].apparentSize = 0.0f;
ls.lights[i].castsShadows = false;
i++;
@ -7436,7 +7436,7 @@ bool Renderer::testEclipse(const Body& receiver,
const DirectionalLight& light = lightingState.lights[lightIndex];
LightingState::EclipseShadowVector& shadows = *lightingState.shadows[lightIndex];
bool isReceiverShadowed = false;
// Ignore situations where the shadow casting body is much smaller than
// the receiver, as these shadows aren't likely to be relevant. Also,
// ignore eclipses where the caster is not an ellipsoid, since we can't
@ -7520,21 +7520,21 @@ bool Renderer::testEclipse(const Body& receiver,
isReceiverShadowed = true;
}
// If the caster has a ring system, see if it casts a shadow on the receiver.
// Ring shadows are only supported in the OpenGL 2.0 path.
if (caster.getRings() && context->getRenderPath() == GLContext::GLPath_GLSL)
{
bool shadowed = false;
// The shadow volume of the rings is an oblique circular cylinder
if (dist < caster.getRings()->outerRadius + receiver.getRadius())
{
// Possible intersection, but it depends on the orientation of the
// rings.
Quaterniond casterOrientation = caster.getOrientation(now);
Vector3d ringPlaneNormal = casterOrientation * Vector3d::UnitY();
Vector3d shadowDirection = lightToCasterDir.normalized();
Vector3d ringPlaneNormal = casterOrientation * Vector3d::UnitY();
Vector3d shadowDirection = lightToCasterDir.normalized();
Vector3d v = ringPlaneNormal.cross(shadowDirection);
if (v.squaredNorm() < 1.0e-6)
{
@ -7549,7 +7549,7 @@ bool Renderer::testEclipse(const Body& receiver,
// perpendicular to the ring plane and containing the light direction.
Vector3d shadowPlaneNormal = v.normalized().cross(shadowDirection);
Hyperplane<double, 3> shadowPlane(shadowPlaneNormal, posCaster - posReceiver);
double minDistance = receiver.getRadius() +
double minDistance = receiver.getRadius() +
caster.getRings()->outerRadius * ringPlaneNormal.dot(shadowDirection);
if (abs(shadowPlane.signedDistance(Vector3d::Zero())) < minDistance)
{
@ -7566,7 +7566,7 @@ bool Renderer::testEclipse(const Body& receiver,
shadow.ringSystem = caster.getRings();
shadow.casterOrientation = casterOrientation.cast<float>();
}
}
}
}
}
@ -7672,7 +7672,7 @@ void Renderer::renderPlanet(Body& body,
lights.ringShadows[li].direction = -lights.lights[li].position.normalized().cast<float>();
}
}
// Calculate eclipse circumstances
if ((renderFlags & ShowEclipseShadows) != 0 &&
body.getSystem() != NULL)
@ -7835,7 +7835,7 @@ void Renderer::renderPlanet(Body& body,
observatoryRep = MarkerRepresentation(MarkerRepresentation::Plus, 8.0f, LocationLabelColor);
cityRep = MarkerRepresentation(MarkerRepresentation::X, 3.0f, LocationLabelColor);
genericLocationRep = MarkerRepresentation(MarkerRepresentation::Square, 8.0f, LocationLabelColor);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
@ -8244,7 +8244,7 @@ static float luminosityAtOpposition(float sunLuminosity,
// Compute the total energy hitting the planet; assume an albedo of 1.0, so
// reflected energy = incident energy.
double incidentEnergy = irradiance * circleArea(objRadius * 1000);
// Compute the luminosity (i.e. power relative to solar power)
return (float) (incidentEnergy / astro::SOLAR_POWER);
}
@ -8323,7 +8323,7 @@ void Renderer::buildRenderLists(const Vector3d& astrocentricObserverPos,
Matrix3f viewMat = observer.getOrientationf().toRotationMatrix();
Vector3f viewMatZ = viewMat.row(2);
double invCosViewAngle = 1.0 / cosViewConeAngle;
double sinViewAngle = sqrt(1.0 - square(cosViewConeAngle));
double sinViewAngle = sqrt(1.0 - square(cosViewConeAngle));
unsigned int nChildren = tree != NULL ? tree->childCount() : 0;
for (unsigned int i = 0; i < nChildren; i++)
@ -8360,7 +8360,7 @@ void Renderer::buildRenderLists(const Vector3d& astrocentricObserverPos,
// The result of the planetshine test can be reused for the view cone
// test, but only when the object's light influence sphere is larger
// than the geometry. This is not
// than the geometry. This is not
bool viewConeTestFailed = false;
if (body->isSecondaryIlluminator())
{
@ -8476,7 +8476,7 @@ void Renderer::buildRenderLists(const Vector3d& astrocentricObserverPos,
// Figure out the magnitude of the brightest possible object in the subtree.
// Compute the luminosity from reflected light of the largest object in the subtree
float lum = 0.0f;
float lum = 0.0f;
for (unsigned int li = 0; li < lightSourceList.size(); li++)
{
Vector3d sunPos = pos_v - lightSourceList[li].position;
@ -8517,7 +8517,7 @@ void Renderer::buildRenderLists(const Vector3d& astrocentricObserverPos,
{
double maxPerpDist = (influenceRadius + dist_vn * sinViewAngle) * invCosViewAngle;
double perpDistSq = toViewNormal.squaredNorm();
if (perpDistSq < maxPerpDist * maxPerpDist)
if (perpDistSq < maxPerpDist * maxPerpDist)
traverseSubtree = true;
}
}
@ -8569,7 +8569,7 @@ void Renderer::buildOrbitLists(const Vector3d& astrocentricObserverPos,
// relative to the observer.
Vector3d pos_v = pos_s - astrocentricObserverPos;
// Only show orbits for major bodies or selected objects.
// Only show orbits for major bodies or selected objects.
Body::VisibilityPolicy orbitVis = body->getOrbitVisibility();
if (body->isVisible() &&
@ -8788,7 +8788,7 @@ void Renderer::buildLabelLists(const Frustum& viewFrustum,
}
}
}
} // for each render list entry
} // for each render list entry
}
@ -9616,29 +9616,29 @@ void DSORenderer::process(DeepSkyObject* const & dso,
{
if (distanceToDSO > distanceLimit)
return;
Vector3d dsoPos = dso->getPosition();
Vector3f relPos = (dsoPos - obsPos).cast<float>();
Vector3f center = orientationMatrix.transpose() * relPos;
double enhance = 4.0, pc10 = 32.6167;
// The parameter 'enhance' adjusts the DSO brightness as viewed from "inside"
// (e.g. MilkyWay as seen from Earth). It provides an enhanced apparent core
// brightness appMag ~ absMag - enhance. 'enhance' thus serves to uniformly
// enhance the too low sprite luminosity at close distance.
double enhance = 4.0, pc10 = 32.6167;
// The parameter 'enhance' adjusts the DSO brightness as viewed from "inside"
// (e.g. MilkyWay as seen from Earth). It provides an enhanced apparent core
// brightness appMag ~ absMag - enhance. 'enhance' thus serves to uniformly
// enhance the too low sprite luminosity at close distance.
float appMag = (distanceToDSO >= pc10)? (float) astro::absToAppMag((double) absMag, distanceToDSO): absMag + (float) (enhance * tanh(distanceToDSO/pc10 - 1.0));
// Test the object's bounding sphere against the view frustum. If we
// Test the object's bounding sphere against the view frustum. If we
// avoid this stage, overcrowded octree cells may hit performance badly:
// each object (even if it's not visible) would be sent to the OpenGL
// pipeline.
if (dso->isVisible())
{
double dsoRadius = dso->getBoundingSphereRadius();
double dsoRadius = dso->getBoundingSphereRadius();
bool inFrustum = frustum.testSphere(center, (float) dsoRadius) != Frustum::Outside;
if (inFrustum)
@ -9651,29 +9651,29 @@ void DSORenderer::process(DeepSkyObject* const & dso,
// Ansatz: brightness = a - b * appMag(distanceToDSO), emulating eye sensitivity...
// determine a,b such that
// a - b * absMag = absMag / avgAbsMag ~ 1; a - b * faintestMag = 0.2.
// The 2nd eq. guarantees that the faintest galaxies are still visible.
if(!strcmp(dso->getObjTypeName(),"globular"))
avgAbsMag = -6.86; // average over 150 globulars in globulars.dsc.
else if (!strcmp(dso->getObjTypeName(),"galaxy"))
avgAbsMag = -19.04; // average over 10937 galaxies in galaxies.dsc.
float r = absMag / (float) avgAbsMag;
float brightness = r - (r - 0.2f) * (absMag - appMag) / (absMag - faintestMag);
// obviously, brightness(appMag = absMag) = r and
// brightness(appMag = faintestMag) = 0.2, as desired.
// The 2nd eq. guarantees that the faintest galaxies are still visible.
brightness = 2.3f * brightness * (faintestMag - 4.75f) / renderer->getFaintestAM45deg();
if(!strcmp(dso->getObjTypeName(),"globular"))
avgAbsMag = -6.86; // average over 150 globulars in globulars.dsc.
else if (!strcmp(dso->getObjTypeName(),"galaxy"))
avgAbsMag = -19.04; // average over 10937 galaxies in galaxies.dsc.
float r = absMag / (float) avgAbsMag;
float brightness = r - (r - 0.2f) * (absMag - appMag) / (absMag - faintestMag);
// obviously, brightness(appMag = absMag) = r and
// brightness(appMag = faintestMag) = 0.2, as desired.
brightness = 2.3f * brightness * (faintestMag - 4.75f) / renderer->getFaintestAM45deg();
#ifdef USE_HDR
brightness *= exposure;
#endif
if (brightness < 0)
brightness = 0;
if (dsoRadius < 1000.0)
brightness = 0;
if (dsoRadius < 1000.0)
{
// Small objects may be prone to clipping; give them special
// handling. We don't want to always set the projection
@ -9753,11 +9753,11 @@ void DSORenderer::process(DeepSkyObject* const & dso,
appMagEff = appMag;
step = 6.0f;
break;
case Renderer::GlobularLabels:
case Renderer::GlobularLabels:
labelColor = Renderer::GlobularLabelColor;
appMagEff = appMag;
step = 3.0f;
break;
break;
default:
// Unrecognized object class
labelColor = Color::White;
@ -9897,7 +9897,7 @@ void Renderer::renderSkyGrids(const Observer& observer)
double tdb = observer.getTime();
const ObserverFrame* frame = observer.getFrame();
Body* body = frame->getRefObject().body();
if (body)
{
SkyGrid grid;
@ -9905,13 +9905,13 @@ void Renderer::renderSkyGrids(const Observer& observer)
grid.setLabelColor(HorizonGridLabelColor);
grid.setLongitudeUnits(SkyGrid::LongitudeDegrees);
grid.setLongitudeDirection(SkyGrid::IncreasingClockwise);
Vector3d zenithDirection = observer.getPosition().offsetFromKm(body->getPosition(tdb)).normalized();
Vector3d northPole = body->getEclipticToEquatorial(tdb).conjugate() * Vector3d::UnitY();
zenithDirection = toStandardCoords(zenithDirection);
northPole = toStandardCoords(northPole);
Vector3d v = zenithDirection.cross(northPole);
// Horizontal coordinate system not well defined when observer
@ -9921,13 +9921,13 @@ void Renderer::renderSkyGrids(const Observer& observer)
{
v.normalize();
Vector3d u = v.cross(zenithDirection);
Matrix3d m;
m.row(0) = u;
m.row(1) = v;
m.row(2) = zenithDirection;
grid.setOrientation(Quaterniond(m));
grid.render(*this, observer, windowWidth, windowHeight);
}
}
@ -10016,9 +10016,9 @@ void Renderer::renderSelectionPointer(const Observer& observer,
Vector3f p2(-20.0f * pixelSize, -6.0f * pixelSize, 0.0f);
glBegin(GL_TRIANGLES);
glVertex((p0.x() * c - p0.y() * s + x0) * u + (p0.x() * s + p0.y() * c + y0) * v);
glVertex((p1.x() * c - p1.y() * s + x0) * u + (p1.x() * s + p1.y() * c + y0) * v);
glVertex((p2.x() * c - p2.y() * s + x0) * u + (p2.x() * s + p2.y() * c + y0) * v);
glVertex((p0.x() * c - p0.y() * s + x0) * u + (p0.x() * s + p0.y() * c + y0) * v);
glVertex((p1.x() * c - p1.y() * s + x0) * u + (p1.x() * s + p1.y() * c + y0) * v);
glVertex((p2.x() * c - p2.y() * s + x0) * u + (p2.x() * s + p2.y() * c + y0) * v);
glEnd();
glPopMatrix();
@ -10172,7 +10172,7 @@ void Renderer::renderAnnotations(const vector<Annotation>& annotations, FontStyl
// Enable line smoothing for rendering symbols
if ((renderFlags & ShowSmoothLines) != 0)
enableSmoothLines();
#ifdef USE_HDR
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
#endif
@ -10212,13 +10212,13 @@ void Renderer::renderAnnotations(const vector<Annotation>& annotations, FontStyl
else
markerRep.render(size);
glEnable(GL_TEXTURE_2D);
if (!markerRep.label().empty())
{
int labelOffset = (int) markerRep.size() / 2;
glTranslatef(labelOffset + PixelOffset, -labelOffset - font[fs]->getHeight() + PixelOffset, 0.0f);
font[fs]->render(markerRep.label(), 0.0f, 0.0f);
}
}
glPopMatrix();
}
@ -10228,25 +10228,25 @@ void Renderer::renderAnnotations(const vector<Annotation>& annotations, FontStyl
int labelWidth = 0;
int hOffset = 2;
int vOffset = 0;
switch (annotations[i].halign)
{
case AlignCenter:
labelWidth = (font[fs]->getWidth(annotations[i].labelText));
hOffset = -labelWidth / 2;
break;
case AlignRight:
labelWidth = (font[fs]->getWidth(annotations[i].labelText));
hOffset = -(labelWidth + 2);
break;
case AlignLeft:
if (annotations[i].markerRep != NULL)
hOffset = 2 + (int) annotations[i].markerRep->size() / 2;
break;
}
switch (annotations[i].valign)
{
case AlignCenter:
@ -10259,7 +10259,7 @@ void Renderer::renderAnnotations(const vector<Annotation>& annotations, FontStyl
vOffset = 0;
break;
}
glColor(annotations[i].color);
glTranslatef((int) annotations[i].position.x() + hOffset + PixelOffset,
(int) annotations[i].position.y() + vOffset + PixelOffset, 0.0f);
@ -10288,7 +10288,7 @@ Renderer::renderBackgroundAnnotations(FontStyle fs)
glEnable(GL_DEPTH_TEST);
renderAnnotations(backgroundAnnotations, fs);
glDisable(GL_DEPTH_TEST);
clearAnnotations(backgroundAnnotations);
}
@ -10298,7 +10298,7 @@ Renderer::renderForegroundAnnotations(FontStyle fs)
{
glDisable(GL_DEPTH_TEST);
renderAnnotations(foregroundAnnotations, fs);
clearAnnotations(foregroundAnnotations);
}
@ -10352,17 +10352,17 @@ Renderer::renderSortedAnnotations(vector<Annotation>::iterator iter,
{
size = iter->size;
}
glTranslatef((GLfloat) (int) iter->position.x(), (GLfloat) (int) iter->position.y(), ndc_z);
glColor(iter->color);
glDisable(GL_TEXTURE_2D);
if (markerRep.symbol() == MarkerRepresentation::Crosshair)
renderCrosshair(size, realTime);
else
markerRep.render(size);
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
if (!markerRep.label().empty())
{
int labelOffset = (int) markerRep.size() / 2;
@ -10442,17 +10442,17 @@ Renderer::renderAnnotations(vector<Annotation>::iterator startIter,
{
size = iter->size;
}
glTranslatef((GLfloat) (int) iter->position.x(), (GLfloat) (int) iter->position.y(), ndc_z);
glColor(iter->color);
glDisable(GL_TEXTURE_2D);
if (markerRep.symbol() == MarkerRepresentation::Crosshair)
renderCrosshair(size, realTime);
else
markerRep.render(size);
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
if (!markerRep.label().empty())
{
int labelOffset = (int) markerRep.size() / 2;
@ -10461,7 +10461,7 @@ Renderer::renderAnnotations(vector<Annotation>::iterator startIter,
}
glPopMatrix();
}
if (iter->labelText[0] != '\0')
{
if (iter->markerRep != NULL)
@ -10489,7 +10489,7 @@ Renderer::renderAnnotations(vector<Annotation>::iterator startIter,
void Renderer::renderMarkers(const MarkerList& markers,
const UniversalCoord& cameraPosition,
const Quaterniond& cameraOrientation,
const Quaterniond& cameraOrientation,
double jd)
{
// Calculate the cosine of half the maximum field of view. We'll use this for
@ -10499,13 +10499,13 @@ void Renderer::renderMarkers(const MarkerList& markers,
double h = tan(degToRad(fov / 2));
double diag = sqrt(1.0 + square(h) + square(h * (double) windowWidth / (double) windowHeight));
double cosFOV = 1.0 / diag;
Vector3d viewVector = cameraOrientation.conjugate() * -Vector3d::UnitZ();
for (MarkerList::const_iterator iter = markers.begin(); iter != markers.end(); iter++)
{
Vector3d offset = iter->position(jd).offsetFromKm(cameraPosition);
// Only render those markers that lie withing the field of view.
if ((offset.dot(viewVector)) > cosFOV * offset.norm())
{
@ -10527,9 +10527,9 @@ void Renderer::renderMarkers(const MarkerList& markers,
if (iter->object().body() != NULL)
boundingRadius = iter->object().body()->getBoundingRadius();
else
boundingRadius = iter->object().radius();
boundingRadius = iter->object().radius();
offset *= (1.0 - boundingRadius * 1.01 / distance);
addSortedAnnotation(&(iter->representation()), EMPTY_STRING, iter->representation().color(),
offset.cast<float>(),
AlignLeft, VerticalAlignTop, symbolSize);
@ -10596,7 +10596,7 @@ void Renderer::loadTextures(Body* body)
{
body->getRings()->texture.find(textureResolution);
}
if (body->getGeometry() != InvalidResource)
{
Geometry* geometry = GetGeometryManager()->find(body->getGeometry());
@ -10633,6 +10633,7 @@ void Renderer::addWatcher(RendererWatcher* watcher)
watchers.insert(watchers.end(), watcher);
}
void Renderer::removeWatcher(RendererWatcher* watcher)
{
list<RendererWatcher*>::iterator iter =
@ -10641,6 +10642,7 @@ void Renderer::removeWatcher(RendererWatcher* watcher)
watchers.erase(iter);
}
void Renderer::notifyWatchers() const
{
for (list<RendererWatcher*>::const_iterator iter = watchers.begin();

View File

@ -139,9 +139,9 @@ class Renderer
I18nConstellationLabels = 0x800,
DwarfPlanetLabels = 0x1000,
MinorMoonLabels = 0x2000,
GlobularLabels = 0x4000,
BodyLabelMask = (PlanetLabels | DwarfPlanetLabels | MoonLabels | MinorMoonLabels | AsteroidLabels | SpacecraftLabels | CometLabels),
};
GlobularLabels = 0x4000,
BodyLabelMask = (PlanetLabels | DwarfPlanetLabels | MoonLabels | MinorMoonLabels | AsteroidLabels | SpacecraftLabels | CometLabels),
};
enum {
ShowNothing = 0x0000,
@ -174,7 +174,7 @@ class Renderer
ShowTintedIllumination = 0x4000000,
};
enum StarStyle
enum StarStyle
{
FuzzyPointStars = 0,
PointStars = 1,
@ -186,7 +186,7 @@ class Renderer
static const int DefaultRenderFlags = Renderer::ShowStars |
Renderer::ShowPlanets |
Renderer::ShowGalaxies |
Renderer::ShowGlobulars |
Renderer::ShowGlobulars |
Renderer::ShowCloudMaps |
Renderer::ShowAtmospheres |
Renderer::ShowEclipseShadows |
@ -249,14 +249,14 @@ class Renderer
AlignLeft,
AlignRight
};
enum LabelVerticalAlignment
{
VerticalAlignCenter,
VerticalAlignBottom,
VerticalAlignTop,
};
static const int MaxLabelLength = 48;
struct Annotation
{
@ -270,7 +270,7 @@ class Renderer
bool operator<(const Annotation&) const;
};
void addForegroundAnnotation(const MarkerRepresentation* markerRep,
const std::string& labelText,
Color color,
@ -300,12 +300,12 @@ class Renderer
void endObjectAnnotations();
Eigen::Quaternionf getCameraOrientation() const;
float getNearPlaneDistance() const;
void clearAnnotations(std::vector<Annotation>&);
void clearSortedAnnotations();
void clearSortedAnnotations();
void invalidateOrbitCache();
struct OrbitPathListEntry
{
float centerZ;
@ -316,7 +316,7 @@ class Renderer
float opacity;
bool operator<(const OrbitPathListEntry&) const;
};
};
enum FontStyle
{
@ -324,7 +324,7 @@ class Renderer
FontLarge = 1,
FontCount = 2,
};
void setFont(FontStyle, TextureFont*);
TextureFont* getFont(FontStyle) const;
@ -338,7 +338,7 @@ class Renderer
public:
// Internal types
// TODO: Figure out how to make these private. Even with a friend
//
//
struct Particle
{
Eigen::Vector3f center;
@ -419,7 +419,7 @@ class Renderer
typedef ObjectLabel<Star> StarLabel;
typedef ObjectLabel<DeepSkyObject> DSOLabel; // currently not used
struct DepthBufferPartition
{
int index;
@ -491,7 +491,7 @@ class Renderer
const Eigen::Quaternionf& orientation,
double now,
float, float);
void renderReferenceMark(const ReferenceMark& refMark,
const Eigen::Vector3f& pos,
float distance,
@ -533,8 +533,8 @@ class Renderer
void renderLocations(const Body& body,
const Eigen::Vector3d& bodyPosition,
const Eigen::Quaterniond& bodyOrientation);
// Render an item from the render list
// Render an item from the render list
void renderItem(const RenderListEntry& rle,
const Observer& observer,
const Eigen::Quaternionf& cameraOrientation,
@ -551,8 +551,8 @@ class Renderer
const Observer& observer);
void renderParticles(const std::vector<Particle>& particles,
const Eigen::Quaternionf& orientation);
void addAnnotation(std::vector<Annotation>&,
const MarkerRepresentation*,
const std::string& labelText,
@ -654,7 +654,7 @@ class Renderer
Eigen::Quaternionf m_cameraOrientation;
StarVertexBuffer* starVertexBuffer;
PointStarVertexBuffer* pointStarVertexBuffer;
PointStarVertexBuffer* glareVertexBuffer;
PointStarVertexBuffer* glareVertexBuffer;
std::vector<RenderListEntry> renderList;
std::vector<SecondaryIlluminator> secondaryIlluminators;
std::vector<DepthBufferPartition> depthPartitions;
@ -679,7 +679,7 @@ class Renderer
bool useClampToBorder;
unsigned int textureResolution;
DetailOptions detailOptions;
bool useNewStarRendering;
uint32 frameCount;
@ -689,11 +689,11 @@ class Renderer
public:
#if 0
struct OrbitSample
struct OrbitSample
{
double t;
Point3d pos;
OrbitSample(const Eigen::Vector3d& _pos, double _t) : t(_t), pos(_pos.x(), _pos.y(), _pos.z()) { }
OrbitSample() { }
};
@ -703,7 +703,7 @@ class Renderer
Capsuled boundingVolume;
uint32 firstSample;
};
struct CachedOrbit
{
std::vector<OrbitSample> trajectory;
@ -727,7 +727,7 @@ class Renderer
SkyContourPoint* skyContour;
const ColorTemperatureTable* colorTemp;
Selection highlightObject;
bool videoSync;
@ -737,7 +737,7 @@ class Renderer
bool objectAnnotationSetOpen;
double realTime;
// Location markers
public:
MarkerRepresentation mountainRep;
@ -764,8 +764,8 @@ class Renderer
static Color SpacecraftLabelColor;
static Color LocationLabelColor;
static Color GalaxyLabelColor;
static Color GlobularLabelColor;
static Color NebulaLabelColor;
static Color GlobularLabelColor;
static Color NebulaLabelColor;
static Color OpenClusterLabelColor;
static Color ConstellationLabelColor;
static Color EquatorialGridLabelColor;

View File

@ -65,7 +65,7 @@ void renderEllipsoid_GLSL(const RenderInfo& ri,
{
float radius = semiAxes.maxCoeff();
Texture* textures[MAX_SPHERE_MESH_TEXTURES] =
Texture* textures[MAX_SPHERE_MESH_TEXTURES] =
{ NULL, NULL, NULL, NULL, NULL, NULL };
unsigned int nTextures = 0;
@ -186,7 +186,7 @@ void renderEllipsoid_GLSL(const RenderInfo& ri,
// Track the total number of shadows; if there are too many, we'll have
// to fall back to multipass.
unsigned int totalShadows = 0;
for (unsigned int li = 0; li < ls.nLights; li++)
{
if (ls.shadows[li] && !ls.shadows[li]->empty())
@ -205,7 +205,7 @@ void renderEllipsoid_GLSL(const RenderInfo& ri,
glActiveTextureARB(GL_TEXTURE0_ARB + nTextures);
ringsTex->bind();
nTextures++;
// Tweak the texture--set clamp to border and a border color with
// a zero alpha.
float bc[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
@ -225,8 +225,8 @@ void renderEllipsoid_GLSL(const RenderInfo& ri,
}
}
}
// Get a shader for the current rendering configuration
CelestiaGLProgram* prog = GetShaderManager().getShader(shadprop);
if (prog == NULL)
@ -402,7 +402,7 @@ void renderClouds_GLSL(const RenderInfo& ri,
{
float radius = semiAxes.maxCoeff();
Texture* textures[MAX_SPHERE_MESH_TEXTURES] =
Texture* textures[MAX_SPHERE_MESH_TEXTURES] =
{ NULL, NULL, NULL, NULL, NULL, NULL };
unsigned int nTextures = 0;
@ -448,7 +448,7 @@ void renderClouds_GLSL(const RenderInfo& ri,
}
}
#endif
if (atmosphere != NULL)
{
if (renderFlags & Renderer::ShowAtmospheres)
@ -502,7 +502,7 @@ void renderClouds_GLSL(const RenderInfo& ri,
prog->ringWidth = 1.0f / (ringWidth / cloudRadius);
}
#endif
if (shadprop.shadowCounts != 0)
prog->setEclipseShadowParameters(ls, semiAxes, planetOrientation);

View File

@ -27,7 +27,7 @@ void renderEllipsoid_GLSL(const RenderInfo& ri,
const Eigen::Quaternionf& planetOrientation,
const Frustum& frustum,
const GLContext& context);
void renderGeometry_GLSL(Geometry* geometry,
const RenderInfo& ri,
ResourceHandle texOverride,
@ -37,7 +37,7 @@ void renderGeometry_GLSL(Geometry* geometry,
int renderFlags,
const Eigen::Quaternionf& planetOrientation,
double tsec);
void renderClouds_GLSL(const RenderInfo& ri,
const LightingState& ls,
Atmosphere* atmosphere,
@ -50,7 +50,7 @@ void renderClouds_GLSL(const RenderInfo& ri,
const Eigen::Quaternionf& planetOrientation,
const Frustum& frustum,
const GLContext& context);
void renderAtmosphere_GLSL(const RenderInfo& ri,
const LightingState& ls,
Atmosphere* atmosphere,
@ -58,7 +58,7 @@ void renderAtmosphere_GLSL(const RenderInfo& ri,
const Eigen::Quaternionf& planetOrientation,
const Frustum& frustum,
const GLContext& context);
void renderRings_GLSL(RingSystem& rings,
RenderInfo& ri,
const LightingState& ls,
@ -124,6 +124,5 @@ private:
#endif // _CELENGINE_RENDERGLSL_H_

View File

@ -1,5 +1,5 @@
// selection.cpp
//
//
// Copyright (C) 2001-2009, the Celestia Development Team
// Original version by Chris Laurel <claurel@gmail.com>
//
@ -48,7 +48,7 @@ UniversalCoord Selection::getPosition(double t) const
{
case Type_Body:
return body()->getPosition(t);
case Type_Star:
return star()->getPosition(t);
@ -59,7 +59,7 @@ UniversalCoord Selection::getPosition(double t) const
Vector3f p = deepsky()->getPosition().cast<float>();
return UniversalCoord::CreateLy(p.cast<double>());
}
case Type_Location:
{
Body* body = location()->getParentBody();
@ -87,7 +87,7 @@ Vector3d Selection::getVelocity(double t) const
{
case Type_Body:
return body()->getVelocity(t);
case Type_Star:
return star()->getVelocity(t);
@ -95,10 +95,10 @@ Vector3d Selection::getVelocity(double t) const
return Vector3d::Zero();
case Type_Location:
{
// For now, just use differentiation for location velocities.
{
// For now, just use differentiation for location velocities.
return getPosition(t).offsetFromKm(getPosition(t - VELOCITY_DIFF_DELTA)) / VELOCITY_DIFF_DELTA;
}
}
default:
return Vector3d::Zero();
@ -123,7 +123,7 @@ string Selection::getName(bool i18n) const
sprintf(buf, "#%d", deepsky()->getCatalogNumber());
return string(buf);
}
case Type_Body:
{
string name = body()->getName(i18n);
@ -191,7 +191,7 @@ Selection Selection::parent() const
case Type_Star:
return Selection(star()->getOrbitBarycenter());
case Type_DeepSky:
// Currently no hierarchy for stars and deep sky objects.
return Selection();

View File

@ -1,5 +1,5 @@
// selection.h
//
//
// Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
//
// This program is free software; you can redistribute it and/or

View File

@ -1228,16 +1228,16 @@ Shadow(unsigned int light, unsigned int shadow)
// surrounded by a ring of linear falloff from maxDepth to zero. For a total
// eclipse, maxDepth is zero. In reality, the falloff function is much more complex:
// to calculate the exact amount of sunlight blocked, we need to calculate the
// a circle-circle intersection area.
// a circle-circle intersection area.
// (See http://mathworld.wolfram.com/Circle-CircleIntersection.html)
// The code generated below will compute:
// r = 2 * sqrt(dot(shadowCenter, shadowCenter));
// shadowR = clamp((r - 1) * shadowFalloff, 0, shadowMaxDepth)
source += "shadowR = clamp((2.0 * sqrt(dot(shadowCenter, shadowCenter)) - 1.0) * " +
IndexedParameter("shadowFalloff", light, shadow) + ", 0.0, " +
IndexedParameter("shadowMaxDepth", light, shadow) + ");\n";
source += "shadow *= 1.0 - shadowR;\n";
return source;
@ -1537,7 +1537,7 @@ PointSizeCalculation()
source += "float ptSize = pointScale * pointSize / length(vec3(gl_ModelViewMatrix * gl_Vertex));\n";
source += "pointFade = min(1.0, ptSize * ptSize);\n";
source += "gl_PointSize = ptSize;\n";
return source;
}
@ -2036,7 +2036,7 @@ ShaderManager::buildFragmentShader(const ShaderProperties& props)
{
source += DeclareVarying("pointFade", Shader_Float);
}
source += "\nvoid main(void)\n{\n";
source += "vec4 color;\n";
@ -2243,7 +2243,7 @@ ShaderManager::buildFragmentShader(const ShaderProperties& props)
if (!props.usesTangentSpaceLighting())
{
source += "float totalLight = ";
if (props.nLights == 0)
{
source += "0.0f\n";
@ -2763,7 +2763,7 @@ ShaderManager::buildEmissiveVertexShader(const ShaderProperties& props)
source += " gl_TexCoord[0].st = " + TexCoord2D(0) + ";\n";
}
// Set the color.
// Set the color.
string colorSource;
if (props.texUsage & ShaderProperties::VertexColors)
colorSource = "gl_Color.rgb";
@ -2811,7 +2811,7 @@ ShaderManager::buildEmissiveFragmentShader(const ShaderProperties& props)
{
source += "varying float pointFade;\n";
}
// Begin main()
source += "\nvoid main(void)\n";
source += "{\n";
@ -2825,7 +2825,7 @@ ShaderManager::buildEmissiveFragmentShader(const ShaderProperties& props)
#endif
colorSource = "color";
}
if (props.texUsage & ShaderProperties::DiffuseTexture)
{
source += " gl_FragColor = " + colorSource + " * texture2D(diffTex, gl_TexCoord[0].st);\n";
@ -2859,30 +2859,30 @@ GLVertexShader*
ShaderManager::buildParticleVertexShader(const ShaderProperties& props)
{
ostringstream source;
source << CommonHeader;
source << "// PARTICLE SHADER\n";
source << "// shadow count: " << props.shadowCounts << endl;
source << DeclareLights(props);
source << "uniform vec3 eyePosition;\n";
// TODO: scattering constants
if (props.texUsage & ShaderProperties::PointSprite)
{
source << "uniform float pointScale;\n";
source << "attribute float pointSize;\n";
}
// Shadow parameters
if (props.shadowCounts != 0)
{
source << "varying vec3 position_obj;\n";
}
// Begin main() function
source << "\nvoid main(void)\n{\n";
@ -2913,26 +2913,26 @@ ShaderManager::buildParticleVertexShader(const ShaderProperties& props)
{
source << " gl_TexCoord[0].st = " << TexCoord2D(0) << ";\n";
}
// Set the color. Should *always* use vertex colors for color and opacity.
source << " gl_FrontColor = gl_Color * brightness;\n";
// Optional point size
if ((props.texUsage & ShaderProperties::PointSprite) != 0)
source << PointSizeCalculation();
source << " gl_Position = ftransform();\n";
source << "}\n";
// End of main()
if (g_shaderLogFile != NULL)
{
*g_shaderLogFile << "Vertex shader source:\n";
DumpShaderSource(*g_shaderLogFile, source.str());
*g_shaderLogFile << endl;
}
GLVertexShader* vs = NULL;
GLShaderStatus status = GLShaderLoader::CreateVertexShader(source.str(), &vs);
if (status != ShaderStatus_OK)
@ -2948,7 +2948,7 @@ ShaderManager::buildParticleFragmentShader(const ShaderProperties& props)
ostringstream source;
source << CommonHeader;
if (props.texUsage & ShaderProperties::DiffuseTexture)
{
source << "uniform sampler2D diffTex;\n";
@ -2960,9 +2960,9 @@ ShaderManager::buildParticleFragmentShader(const ShaderProperties& props)
for (unsigned int i = 0; i < props.nLights; i++)
{
source << "uniform vec3 " << FragLightProperty(i, "color") << ";\n";
}
}
}
// Declare shadow parameters
if (props.shadowCounts != 0)
{
@ -2978,11 +2978,11 @@ ShaderManager::buildParticleFragmentShader(const ShaderProperties& props)
}
}
}
// Begin main()
source << "\nvoid main(void)\n";
source << "{\n";
if (props.texUsage & ShaderProperties::DiffuseTexture)
{
source << " gl_FragColor = gl_Color * texture2D(diffTex, gl_TexCoord[0].st);\n";
@ -2991,17 +2991,17 @@ ShaderManager::buildParticleFragmentShader(const ShaderProperties& props)
{
source << " gl_FragColor = gl_Color;\n";
}
source << "}\n";
// End of main()
if (g_shaderLogFile != NULL)
{
*g_shaderLogFile << "Fragment shader source:\n";
DumpShaderSource(*g_shaderLogFile, source.str());
*g_shaderLogFile << '\n';
}
GLFragmentShader* fs = NULL;
GLShaderStatus status = GLShaderLoader::CreateFragmentShader(source.str(), &fs);
if (status != ShaderStatus_OK)
@ -3415,7 +3415,7 @@ CelestiaGLProgram::setEclipseShadowParameters(const LightingState& ls,
// Compose the world-to-shadow matrix
Matrix4f worldToShadow = shadowRotation *
Affine3f(Scaling(1.0f / shadow.penumbraRadius)).matrix() *
Affine3f(Translation3f(-shadow.origin)).matrix();
Affine3f(Translation3f(-shadow.origin)).matrix();
// Finally, multiply all the matrices together to get the mapping from
// object space to shadow map space.
@ -3468,6 +3468,6 @@ CelestiaGLProgram::setAtmosphereParameters(const Atmosphere& atmosphere,
// in the vertex shader.
Vector3f tScatterCoeffSum = tRayleighCoeff.array() + tMieCoeff;
scatterCoeffSum = tScatterCoeffSum;
invScatterCoeffSum = tScatterCoeffSum.cwiseInverse();
invScatterCoeffSum = tScatterCoeffSum.cwiseInverse();
extinctionCoeff = tScatterCoeffSum + tAbsorptionCoeff;
}

View File

@ -79,7 +79,7 @@ class ShaderProperties
EmissiveModel = 8,
ParticleModel = 9,
};
enum
{
VolumetricScatteringEffect = 0x0001,
@ -89,7 +89,7 @@ class ShaderProperties
public:
unsigned short nLights;
unsigned short texUsage;
unsigned short texUsage;
unsigned short lightModel;
// Eight bits per light, up to four lights
@ -99,16 +99,16 @@ class ShaderProperties
// Bit 3, on for self shadowing
// Bit 4, on for cloud shadows
uint32 shadowCounts;
// Effects that may be applied with any light model
unsigned short effects;
private:
enum
{
ShadowBitsPerLight = 4,
};
enum
{
EclipseShadowMask = 0x3,
@ -119,7 +119,7 @@ class ShaderProperties
AnyRingShadowMask = 0x04040404,
AnySelfShadowMask = 0x08080808,
AnyCloudShadowMask = 0x10101010,
};
};
};
@ -149,7 +149,7 @@ class CelestiaGLProgram
~CelestiaGLProgram();
void use() const { program->use(); }
void setLightParameters(const LightingState& ls,
Color materialDiffuse,
Color materialSpecular,
@ -164,7 +164,7 @@ class CelestiaGLProgram
void setAtmosphereParameters(const Atmosphere& atmosphere,
float atmPlanetRadius,
float objRadius);
public:
CelestiaGLProgramLight lights[MaxShaderLights];
Vec3ShaderParameter fragLightColor[MaxShaderLights];
@ -183,7 +183,7 @@ class CelestiaGLProgram
FloatShaderParameter ringRadius;
Vec4ShaderParameter ringPlane;
Vec3ShaderParameter ringCenter;
// Mix of Lambertian and "lunar" (Lommel-Seeliger) photometric models.
// 0 = pure Lambertian, 1 = L-S
FloatShaderParameter lunarLambert;
@ -195,7 +195,7 @@ class CelestiaGLProgram
// Height of cloud layer above planet, in units of object radius
FloatShaderParameter cloudHeight;
FloatShaderParameter shadowTextureOffset;
// Parameters for atmospheric scattering; all distances are normalized for
// a unit sphere.
FloatShaderParameter mieCoeff;
@ -204,21 +204,21 @@ class CelestiaGLProgram
// A value of 0 is isotropic, negative values a primarily backscattering,
// positive values are forward scattering.
FloatShaderParameter miePhaseAsymmetry;
// Rayleigh scattering terms. There are three scattering coefficients: red,
// green, and blue light. To simulate Rayleigh scattering, the coefficients
// green, and blue light. To simulate Rayleigh scattering, the coefficients
// should be in ratios that fit 1/wavelength^4, but other values may be used
// to simulate different types of wavelength dependent scattering.
Vec3ShaderParameter rayleighCoeff;
FloatShaderParameter rayleighScaleHeight;
// Precomputed sum and inverse sum of Rayleigh and Mie scattering coefficients
Vec3ShaderParameter scatterCoeffSum;
Vec3ShaderParameter invScatterCoeffSum;
// Precomputed sum of absorption and scattering coefficients--identical to
// scatterCoeffSum when there is no absorption.
Vec3ShaderParameter extinctionCoeff;
// Radius of sphere for atmosphere--should be significantly larger than
// scale height. Three components:
// x = radius
@ -230,7 +230,7 @@ class CelestiaGLProgram
FloatShaderParameter pointScale;
CelestiaGLProgramShadow shadows[MaxShaderLights][MaxShaderEclipseShadows];
private:
void initParameters();
void initSamplers();
@ -254,13 +254,13 @@ class ShaderManager
private:
CelestiaGLProgram* buildProgram(const ShaderProperties&);
GLVertexShader* buildVertexShader(const ShaderProperties&);
GLFragmentShader* buildFragmentShader(const ShaderProperties&);
GLVertexShader* buildRingsVertexShader(const ShaderProperties&);
GLFragmentShader* buildRingsFragmentShader(const ShaderProperties&);
GLVertexShader* buildAtmosphereVertexShader(const ShaderProperties&);
GLFragmentShader* buildAtmosphereFragmentShader(const ShaderProperties&);

View File

@ -63,7 +63,7 @@ class Simulation
Selection findObjectFromPath(std::string s, bool i18n = false);
std::vector<std::string> getObjectCompletion(std::string s, bool withLocations = false);
void gotoSelection(double gotoTime,
const Eigen::Vector3f& up,
const Eigen::Vector3f& up,
ObserverFrame::CoordinateSystem upFrame);
void gotoSelection(double gotoTime, double distance,
const Eigen::Vector3f& up,
@ -113,7 +113,7 @@ class Simulation
void setObserverMode(Observer::ObserverMode);
Observer::ObserverMode getObserverMode() const;
void setFrame(ObserverFrame::CoordinateSystem, const Selection& refObject, const Selection& targetObject);
void setFrame(ObserverFrame::CoordinateSystem, const Selection& refObject, const Selection& targetObject);
void setFrame(ObserverFrame::CoordinateSystem, const Selection& refObject);
const ObserverFrame* getFrame() const;

View File

@ -96,7 +96,7 @@ static const int DEG_MIN_SEC_SPACING[] =
200*MSEC,
100*MSEC
};
// Alternate spacing tables
#if 0
@ -107,7 +107,7 @@ static const int HOUR_MIN_SEC_SPACING[] =
2*HR, 1*HR, 30*MIN, 10*MIN, 5*MIN,
1*MIN, 30*SEC, 10*SEC, 5*SEC, 1*SEC,
500*MSEC, 100*MSEC
};
};
static const int DEG_MIN_SEC_SPACING[] =
{
@ -124,10 +124,10 @@ static const int HOUR_MIN_SEC_STEPS[] =
2*HR, 1*HR, 30*MIN, 10*MIN, 5*MIN, 2*MIN+30*SEC,
1*MIN, 30*SEC, 10*SEC, 5*SEC, 2*SEC+500*MSEC, 1*SEC,
500*MSEC, 200*MSEC, 100*MSEC, 50*MSEC, 20*MSEC, 10*MSEC
};
};
static const int DEG_MIN_SEC_STEPS[] =
{
{
30*DEG, 10*DEG, 5*DEG, 2*DEG+30*MIN, 1*DEG, 30*MIN,
10*MIN, 5*MIN, 2*MIN+30*SEC, 1*MIN, 30*SEC, 10*SEC,
5*SEC, 2*SEC+500*MSEC, 1*SEC, 500*MSEC, 200*MSEC, 100*MSEC,
@ -233,7 +233,7 @@ template<typename T> static bool planeCircleIntersection(const Matrix<T, 3, 1>&
T a = u.dot(planeNormal);
T b = v.dot(planeNormal);
T c = center.dot(planeNormal);
// The solution is +-acos((-ac +- sqrt(a^2+b^2-c^2))/(a^2+b^2))
T s = a * a + b * b;
if (s == 0.0)
@ -241,14 +241,14 @@ template<typename T> static bool planeCircleIntersection(const Matrix<T, 3, 1>&
// No solution; plane containing circle is parallel to test plane
return false;
}
if (s - c * c <= 0)
{
// One or no solutions; no need to distinguish between these
// cases for our purposes.
return false;
}
// No need to actually call acos to get the solution, since we're just
// going to plug it into sin and cos anyhow.
T r = b * std::sqrt(s - c * c);
@ -256,22 +256,22 @@ template<typename T> static bool planeCircleIntersection(const Matrix<T, 3, 1>&
T cosTheta1 = (-a * c - r) / s;
T sinTheta0 = std::sqrt(1 - cosTheta0 * cosTheta0);
T sinTheta1 = std::sqrt(1 - cosTheta1 * cosTheta1);
*sol0 = center + cosTheta0 * u + sinTheta0 * v;
*sol1 = center + cosTheta1 * u + sinTheta1 * v;
// Check that we've chosen a solution that produces a point on the
// plane. If not, we need to use the -acos solution.
if (std::abs(sol0->dot(planeNormal)) > 1.0e-8)
{
*sol0 = center + cosTheta0 * u - sinTheta0 * v;
}
if (std::abs(sol1->dot(planeNormal)) > 1.0e-8)
{
*sol1 = center + cosTheta1 * u - sinTheta1 * v;
}
return true;
}
@ -332,7 +332,7 @@ SkyGrid::longitudeLabel(int longitude, int longitudeStep) const
// eastward from due north.
if (m_longitudeDirection == IncreasingClockwise)
longitude = (totalUnits - longitude) % totalUnits;
out << longitude / baseUnit << baseUnitSymbol;
if (longitudeStep % baseUnit != 0)
{
@ -351,7 +351,7 @@ SkyGrid::longitudeLabel(int longitude, int longitudeStep) const
// Compute the angular step between parallels
int
int
SkyGrid::parallelSpacing(double idealSpacing) const
{
// We want to use parallels and meridian spacings that are nice multiples of hours, degrees,
@ -367,7 +367,7 @@ SkyGrid::parallelSpacing(double idealSpacing) const
break;
spacing = DEG_MIN_SEC_SPACING[i];
}
return spacing;
}
@ -423,7 +423,7 @@ SkyGrid::render(Renderer& renderer,
double diag = sqrt(1.0 + square(h) + square(h * viewAspectRatio));
double cosHalfFov = 1.0 / diag;
double halfFov = acos(cosHalfFov);
float polarCrossSize = (float) (POLAR_CROSS_SIZE * halfFov);
// We want to avoid drawing more of the grid than we have to. The following code
@ -458,7 +458,7 @@ SkyGrid::render(Renderer& renderer,
// Compute the minimum longitude range containing the corners; slightly
// tricky because of the wrapping at PI/-PI.
double minTheta = thetaC0;
double maxTheta = thetaC1;
double maxTheta = thetaC1;
double maxDiff = 0.0;
updateAngleRange(thetaC0, thetaC1, &maxDiff, &minTheta, &maxTheta);
updateAngleRange(thetaC0, thetaC2, &maxDiff, &minTheta, &maxTheta);
@ -478,7 +478,7 @@ SkyGrid::render(Renderer& renderer,
std::swap(minTheta, maxTheta);
}
maxTheta = minTheta + maxDiff;
// Calculate the normals to the view frustum planes; we'll use these to
// when computing intersection points with the parallels and meridians of the
// grid. Coordinate labels will be drawn at the intersection points.
@ -487,7 +487,7 @@ SkyGrid::render(Renderer& renderer,
frustumNormal[1] = Vector3d( 0, -1, -h);
frustumNormal[2] = Vector3d( 1, 0, -w);
frustumNormal[3] = Vector3d(-1, 0, -w);
{
for (int i = 0; i < 4; i++)
{
@ -505,7 +505,7 @@ SkyGrid::render(Renderer& renderer,
centerDec = -PI / 2.0;
else
centerDec = PI / 2.0;
double minDec = centerDec - halfFov;
double maxDec = centerDec + halfFov;
@ -586,7 +586,7 @@ SkyGrid::render(Renderer& renderer,
glVertex3f(x, z, -y); // convert to Celestia coords
}
glEnd();
// Place labels at the intersections of the view frustum planes
// and the parallels.
Vector3d center(0.0, 0.0, sinPhi);
@ -616,20 +616,20 @@ SkyGrid::render(Renderer& renderer,
glColor(m_lineColor);
glEnd();
#endif
Matrix3f m = observer.getOrientationf().toRotationMatrix();
p0 = orientationf.conjugate() * p0;
p1 = orientationf.conjugate() * p1;
if ((m * p0).z() < 0.0)
{
renderer.addBackgroundAnnotation(NULL, labelText, m_labelColor, p0, hAlign, vAlign);
}
if ((m * p1).z() < 0.0)
{
renderer.addBackgroundAnnotation(NULL, labelText, m_labelColor, p1, hAlign, vAlign);
}
}
}
}
}
@ -662,7 +662,7 @@ SkyGrid::render(Renderer& renderer,
glVertex3f(x, z, -y); // convert to Celestia coords
}
glEnd();
// Place labels at the intersections of the view frustum planes
// and the meridians.
Vector3d center(0.0, 0.0, 0.0);
@ -696,20 +696,20 @@ SkyGrid::render(Renderer& renderer,
Matrix3f m = observer.getOrientationf().toRotationMatrix();
p0 = orientationf.conjugate() * p0;
p1 = orientationf.conjugate() * p1;
if ((m * p0).z() < 0.0 && axis0.dot(isect0) >= cosMaxMeridianAngle)
{
renderer.addBackgroundAnnotation(NULL, labelText, m_labelColor, p0, hAlign, vAlign);
}
if ((m * p1).z() < 0.0 && axis0.dot(isect1) >= cosMaxMeridianAngle)
{
renderer.addBackgroundAnnotation(NULL, labelText, m_labelColor, p1, hAlign, vAlign);
}
}
}
}
}
}
// Draw crosses indicating the north and south poles
glBegin(GL_LINES);
glVertex3f(-polarCrossSize, 1.0f, 0.0f);
@ -721,6 +721,6 @@ SkyGrid::render(Renderer& renderer,
glVertex3f(0.0f, -1.0f, -polarCrossSize);
glVertex3f(0.0f, -1.0f, polarCrossSize);
glEnd();
glPopMatrix();
}

View File

@ -38,7 +38,7 @@ public:
IncreasingCounterclockwise,
IncreasingClockwise,
};
SkyGrid();
~SkyGrid();
@ -88,13 +88,13 @@ public:
{
m_longitudeUnits = longitudeUnits;
}
//! Get the direction of increasing longitude
LongitudeDirection longitudeDirection() const
{
return m_longitudeDirection;
}
//! Set the direction of increasing longitude (clockwise or counterclockwise)
void setLongitudeDirection(LongitudeDirection longitudeDirection)
{

View File

@ -368,7 +368,7 @@ TimelinePhase* CreateTimelinePhase(Body* body,
}
bodyFrame->addRef();
// Use planet units (AU for semimajor axis) if the center of the orbit
// Use planet units (AU for semimajor axis) if the center of the orbit
// reference frame is a star.
bool usePlanetUnits = orbitFrame->getCenter().star() != NULL;
@ -497,7 +497,7 @@ static bool CreateTimeline(Body* body,
defaultOrbitFrame = parentFrameTree->getDefaultReferenceFrame();
defaultBodyFrame = parentFrameTree->getDefaultReferenceFrame();
}
// If there's an explicit timeline definition, parse that. Otherwise, we'll do
// things the old way.
Value* value = planetData->getValue("Timeline");
@ -643,7 +643,7 @@ static bool CreateTimeline(Body* body,
// for nearly all natural satellites in the solar system.)
rotationModel = CreateDefaultRotationModel(syncRotationPeriod);
}
if (ParseDate(planetData, "Beginning", beginning))
overrideOldTimeline = true;
if (ParseDate(planetData, "Ending", ending))
@ -730,7 +730,7 @@ static Body* CreateBody(const string& name,
body = new Body(system, name);
// If the body doesn't exist, always treat the disposition as 'Add'
disposition = AddObject;
// Set the default classification for new objects based on the body type.
// This may be overridden by the Class property.
if (bodyType == SurfaceObject)
@ -1009,7 +1009,7 @@ static Body* CreateBody(const string& name,
}
}
}
bool clickable = true;
if (planetData->getBoolean("Clickable", clickable))
{
@ -1131,7 +1131,7 @@ bool LoadSolarSystemObjects(istream& in,
sscError(tokenizer, "object name expected");
return false;
}
// The name list is a string with zero more names. Multiple names are
// delimited by colons.
string nameList = tokenizer.getStringValue().c_str();
@ -1160,7 +1160,7 @@ bool LoadSolarSystemObjects(istream& in,
Selection parent = universe.findPath(parentName, NULL, 0);
PlanetarySystem* parentSystem = NULL;
vector<string> names;
// Iterate through the string for names delimited
// by ':', and insert them into the name list.
@ -1193,7 +1193,7 @@ bool LoadSolarSystemObjects(istream& in,
bodyType = ReferencePoint;
else if (itemType == "SurfaceObject")
bodyType = SurfaceObject;
if (bodyType != UnknownBodyType)
{
//bool orbitsPlanet = false;
@ -1249,7 +1249,7 @@ bool LoadSolarSystemObjects(istream& in,
body = CreateReferencePoint(primaryName, parentSystem, universe, existingBody, objectData, directory, disposition);
else
body = CreateBody(primaryName, parentSystem, universe, existingBody, objectData, directory, disposition, bodyType);
if (body != NULL && disposition == AddObject)
{
vector<string>::const_iterator iter = names.begin();
@ -1302,7 +1302,7 @@ bool LoadSolarSystemObjects(istream& in,
}
SolarSystem::SolarSystem(Star* _star) :
SolarSystem::SolarSystem(Star* _star) :
star(_star),
planets(NULL),
frameTree(NULL)

View File

@ -287,7 +287,7 @@ void SphereMesh::scale(const Vector3f& s)
{
// TODO: Make a fast special case for uniform scale factors, where
// renormalization is not required.
Vector3f is = s.cwiseInverse();
Vector3f is = s.cwiseInverse();
for (i = 0; i < nVertices; i++)
{
int n = i * 3;

View File

@ -1,5 +1,5 @@
// spheremesh.h
//
//
// Copyright (C) 2001-2009, the Celestia Development Team
// Original version by Chris Laurel <claurel@gmail.com>
//

View File

@ -461,7 +461,7 @@ StarDetails::GetNormalStarDetails(StellarClass::SpectralClass specClass,
SubclassNames[subclass],
LumClassNames[lumClass]);
}
// Use the same properties for an unknown subclass as for subclass 5
if (subclass == StellarClass::Subclass_Unknown)
{
@ -1067,8 +1067,8 @@ Star::getVelocity(double t) const
const Orbit* orbit = getOrbit();
if (!orbit)
{
// The star doesn't have a defined orbit, so the velocity is just
// zero. (This will change when stellar proper motion is implemented.)
// The star doesn't have a defined orbit, so the velocity is just
// zero. (This will change when stellar proper motion is implemented.)
return Vector3d::Zero();
}
else
@ -1077,13 +1077,13 @@ Star::getVelocity(double t) const
if (barycenter == NULL)
{
// Star orbit is defined around a fixed point, so the total velocity
// is just the star's orbit velocity.
// Star orbit is defined around a fixed point, so the total velocity
// is just the star's orbit velocity.
return orbit->velocityAtTime(t);
}
else
{
// Sum the star's orbital velocity and the velocity of the barycenter.
// Sum the star's orbital velocity and the velocity of the barycenter.
return barycenter->getVelocity(t) + orbit->velocityAtTime(t);
}
}

View File

@ -34,7 +34,7 @@ class StarDetails
StarDetails(const StarDetails&);
~StarDetails();
private:
// Prohibit assignment of StarDetails objects
StarDetails& operator=(const StarDetails&);
@ -70,7 +70,7 @@ class StarDetails
void setInfoURL(const std::string& _infoURL);
bool shared() const;
enum
{
KnowRadius = 0x1,
@ -106,7 +106,7 @@ class StarDetails
Eigen::Vector3f semiAxes;
std::string* infoURL;
std::vector<Star*>* orbitingStars;
bool isShared;
@ -117,7 +117,7 @@ class StarDetails
MultiResTexture neutronStarTex;
MultiResTexture starTex[StellarClass::Spectral_Count];
};
public:
static StarDetails* GetStarDetails(const StellarClass&);
static StarDetails* CreateStandardStarType(const std::string& _specType,
@ -132,9 +132,9 @@ class StarDetails
static StarDetails* GetNeutronStarDetails();
static StarDetails* GetBlackHoleDetails();
static StarDetails* GetBarycenterDetails();
static void SetStarTextures(const StarTextureSet&);
private:
static StarTextureSet starTextures;
};

View File

@ -1,5 +1,5 @@
// starbrowser.cpp
//
//
// Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
//
// Star browser tool for Celestia.
@ -36,7 +36,7 @@ struct CloserStarPredicate
Vector3f v0 = p0 * 1.0e6f - pos;
Vector3f v1 = p1 * 1.0e6f - pos;
return (v0.squaredNorm() < v1.squaredNorm());
return (v0.squaredNorm() < v1.squaredNorm());
}
};

View File

@ -1,5 +1,5 @@
// starbrowser.h
//
//
// Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
//
// Star browser tool for celestia.

View File

@ -66,407 +66,407 @@ Color StarColors_Enhanced[41] =
// http://www.vendian.org/mncharity/dir3/blackbody/
Color StarColors_Blackbody_2deg_D65[401] =
{
Color(0.0000f, 0.0000f, 0.0000f), // T= 0K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 100K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 200K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 300K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 400K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 500K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 600K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 700K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 800K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 900K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 1000K P=2.472e+06
Color(1.0000f, 0.0592f, 0.0000f), // T= 1100K P=2.112e+07
Color(1.0000f, 0.0846f, 0.0000f), // T= 1200K P=1.282e+08
Color(1.0000f, 0.1096f, 0.0000f), // T= 1300K P=5.959e+08
Color(1.0000f, 0.1341f, 0.0000f), // T= 1400K P=2.243e+09
Color(1.0000f, 0.1578f, 0.0000f), // T= 1500K P=7.121e+09
Color(1.0000f, 0.1806f, 0.0000f), // T= 1600K P=1.967e+10
Color(1.0000f, 0.2025f, 0.0000f), // T= 1700K P=4.839e+10
Color(1.0000f, 0.2235f, 0.0000f), // T= 1800K P=1.081e+11
Color(1.0000f, 0.2434f, 0.0000f), // T= 1900K P=2.224e+11
Color(1.0000f, 0.2647f, 0.0033f), // T= 2000K P=4.268e+11
Color(1.0000f, 0.2889f, 0.0120f), // T= 2100K P=7.710e+11
Color(1.0000f, 0.3126f, 0.0219f), // T= 2200K P=1.322e+12
Color(1.0000f, 0.3360f, 0.0331f), // T= 2300K P=2.166e+12
Color(1.0000f, 0.3589f, 0.0454f), // T= 2400K P=3.408e+12
Color(1.0000f, 0.3814f, 0.0588f), // T= 2500K P=5.178e+12
Color(1.0000f, 0.4034f, 0.0734f), // T= 2600K P=7.624e+12
Color(1.0000f, 0.4250f, 0.0889f), // T= 2700K P=1.092e+13
Color(1.0000f, 0.4461f, 0.1054f), // T= 2800K P=1.524e+13
Color(1.0000f, 0.4668f, 0.1229f), // T= 2900K P=2.081e+13
Color(1.0000f, 0.4870f, 0.1411f), // T= 3000K P=2.784e+13
Color(1.0000f, 0.5067f, 0.1602f), // T= 3100K P=3.657e+13
Color(1.0000f, 0.5259f, 0.1800f), // T= 3200K P=4.725e+13
Color(1.0000f, 0.5447f, 0.2005f), // T= 3300K P=6.012e+13
Color(1.0000f, 0.5630f, 0.2216f), // T= 3400K P=7.545e+13
Color(1.0000f, 0.5809f, 0.2433f), // T= 3500K P=9.349e+13
Color(1.0000f, 0.5983f, 0.2655f), // T= 3600K P=1.145e+14
Color(1.0000f, 0.6153f, 0.2881f), // T= 3700K P=1.387e+14
Color(1.0000f, 0.6318f, 0.3112f), // T= 3800K P=1.665e+14
Color(1.0000f, 0.6480f, 0.3346f), // T= 3900K P=1.979e+14
Color(1.0000f, 0.6636f, 0.3583f), // T= 4000K P=2.333e+14
Color(1.0000f, 0.6789f, 0.3823f), // T= 4100K P=2.729e+14
Color(1.0000f, 0.6938f, 0.4066f), // T= 4200K P=3.169e+14
Color(1.0000f, 0.7083f, 0.4310f), // T= 4300K P=3.654e+14
Color(1.0000f, 0.7223f, 0.4556f), // T= 4400K P=4.188e+14
Color(1.0000f, 0.7360f, 0.4803f), // T= 4500K P=4.771e+14
Color(1.0000f, 0.7494f, 0.5051f), // T= 4600K P=5.406e+14
Color(1.0000f, 0.7623f, 0.5299f), // T= 4700K P=6.093e+14
Color(1.0000f, 0.7750f, 0.5548f), // T= 4800K P=6.835e+14
Color(1.0000f, 0.7872f, 0.5797f), // T= 4900K P=7.632e+14
Color(1.0000f, 0.7992f, 0.6045f), // T= 5000K P=8.485e+14
Color(1.0000f, 0.8108f, 0.6293f), // T= 5100K P=9.396e+14
Color(1.0000f, 0.8221f, 0.6541f), // T= 5200K P=1.036e+15
Color(1.0000f, 0.8330f, 0.6787f), // T= 5300K P=1.139e+15
Color(1.0000f, 0.8437f, 0.7032f), // T= 5400K P=1.248e+15
Color(1.0000f, 0.8541f, 0.7277f), // T= 5500K P=1.363e+15
Color(1.0000f, 0.8642f, 0.7519f), // T= 5600K P=1.484e+15
Color(1.0000f, 0.8740f, 0.7760f), // T= 5700K P=1.611e+15
Color(1.0000f, 0.8836f, 0.8000f), // T= 5800K P=1.744e+15
Color(1.0000f, 0.8929f, 0.8238f), // T= 5900K P=1.883e+15
Color(1.0000f, 0.9019f, 0.8473f), // T= 6000K P=2.028e+15
Color(1.0000f, 0.9107f, 0.8707f), // T= 6100K P=2.179e+15
Color(1.0000f, 0.9193f, 0.8939f), // T= 6200K P=2.337e+15
Color(1.0000f, 0.9276f, 0.9168f), // T= 6300K P=2.500e+15
Color(1.0000f, 0.9357f, 0.9396f), // T= 6400K P=2.669e+15
Color(1.0000f, 0.9436f, 0.9621f), // T= 6500K P=2.845e+15
Color(1.0000f, 0.9513f, 0.9844f), // T= 6600K P=3.026e+15
Color(0.9937f, 0.9526f, 1.0000f), // T= 6700K P=3.214e+15
Color(0.9726f, 0.9395f, 1.0000f), // T= 6800K P=3.407e+15
Color(0.9526f, 0.9270f, 1.0000f), // T= 6900K P=3.606e+15
Color(0.9337f, 0.9150f, 1.0000f), // T= 7000K P=3.811e+15
Color(0.9157f, 0.9035f, 1.0000f), // T= 7100K P=4.022e+15
Color(0.8986f, 0.8925f, 1.0000f), // T= 7200K P=4.238e+15
Color(0.8823f, 0.8819f, 1.0000f), // T= 7300K P=4.460e+15
Color(0.8668f, 0.8718f, 1.0000f), // T= 7400K P=4.688e+15
Color(0.8520f, 0.8621f, 1.0000f), // T= 7500K P=4.920e+15
Color(0.8379f, 0.8527f, 1.0000f), // T= 7600K P=5.159e+15
Color(0.8244f, 0.8437f, 1.0000f), // T= 7700K P=5.402e+15
Color(0.8115f, 0.8351f, 1.0000f), // T= 7800K P=5.651e+15
Color(0.7992f, 0.8268f, 1.0000f), // T= 7900K P=5.906e+15
Color(0.7874f, 0.8187f, 1.0000f), // T= 8000K P=6.165e+15
Color(0.7761f, 0.8110f, 1.0000f), // T= 8100K P=6.429e+15
Color(0.7652f, 0.8035f, 1.0000f), // T= 8200K P=6.698e+15
Color(0.7548f, 0.7963f, 1.0000f), // T= 8300K P=6.973e+15
Color(0.7449f, 0.7894f, 1.0000f), // T= 8400K P=7.252e+15
Color(0.7353f, 0.7827f, 1.0000f), // T= 8500K P=7.535e+15
Color(0.7260f, 0.7762f, 1.0000f), // T= 8600K P=7.824e+15
Color(0.7172f, 0.7699f, 1.0000f), // T= 8700K P=8.117e+15
Color(0.7086f, 0.7638f, 1.0000f), // T= 8800K P=8.415e+15
Color(0.7004f, 0.7579f, 1.0000f), // T= 8900K P=8.717e+15
Color(0.6925f, 0.7522f, 1.0000f), // T= 9000K P=9.023e+15
Color(0.6848f, 0.7467f, 1.0000f), // T= 9100K P=9.334e+15
Color(0.6774f, 0.7414f, 1.0000f), // T= 9200K P=9.649e+15
Color(0.6703f, 0.7362f, 1.0000f), // T= 9300K P=9.969e+15
Color(0.6635f, 0.7311f, 1.0000f), // T= 9400K P=1.029e+16
Color(0.6568f, 0.7263f, 1.0000f), // T= 9500K P=1.062e+16
Color(0.6504f, 0.7215f, 1.0000f), // T= 9600K P=1.095e+16
Color(0.6442f, 0.7169f, 1.0000f), // T= 9700K P=1.129e+16
Color(0.6382f, 0.7124f, 1.0000f), // T= 9800K P=1.163e+16
Color(0.6324f, 0.7081f, 1.0000f), // T= 9900K P=1.197e+16
Color(0.6268f, 0.7039f, 1.0000f), // T= 10000K P=1.231e+16
Color(0.6213f, 0.6998f, 1.0000f), // T= 10100K P=1.267e+16
Color(0.6161f, 0.6958f, 1.0000f), // T= 10200K P=1.302e+16
Color(0.6109f, 0.6919f, 1.0000f), // T= 10300K P=1.338e+16
Color(0.6060f, 0.6881f, 1.0000f), // T= 10400K P=1.374e+16
Color(0.6012f, 0.6844f, 1.0000f), // T= 10500K P=1.410e+16
Color(0.5965f, 0.6808f, 1.0000f), // T= 10600K P=1.447e+16
Color(0.5919f, 0.6773f, 1.0000f), // T= 10700K P=1.484e+16
Color(0.5875f, 0.6739f, 1.0000f), // T= 10800K P=1.521e+16
Color(0.5833f, 0.6706f, 1.0000f), // T= 10900K P=1.559e+16
Color(0.5791f, 0.6674f, 1.0000f), // T= 11000K P=1.597e+16
Color(0.5750f, 0.6642f, 1.0000f), // T= 11100K P=1.636e+16
Color(0.5711f, 0.6611f, 1.0000f), // T= 11200K P=1.674e+16
Color(0.5673f, 0.6581f, 1.0000f), // T= 11300K P=1.713e+16
Color(0.5636f, 0.6552f, 1.0000f), // T= 11400K P=1.752e+16
Color(0.5599f, 0.6523f, 1.0000f), // T= 11500K P=1.792e+16
Color(0.5564f, 0.6495f, 1.0000f), // T= 11600K P=1.832e+16
Color(0.5530f, 0.6468f, 1.0000f), // T= 11700K P=1.872e+16
Color(0.5496f, 0.6441f, 1.0000f), // T= 11800K P=1.912e+16
Color(0.5463f, 0.6415f, 1.0000f), // T= 11900K P=1.953e+16
Color(0.5431f, 0.6389f, 1.0000f), // T= 12000K P=1.994e+16
Color(0.5400f, 0.6364f, 1.0000f), // T= 12100K P=2.035e+16
Color(0.5370f, 0.6340f, 1.0000f), // T= 12200K P=2.076e+16
Color(0.5340f, 0.6316f, 1.0000f), // T= 12300K P=2.118e+16
Color(0.5312f, 0.6293f, 1.0000f), // T= 12400K P=2.160e+16
Color(0.5283f, 0.6270f, 1.0000f), // T= 12500K P=2.202e+16
Color(0.5256f, 0.6247f, 1.0000f), // T= 12600K P=2.244e+16
Color(0.5229f, 0.6225f, 1.0000f), // T= 12700K P=2.287e+16
Color(0.5203f, 0.6204f, 1.0000f), // T= 12800K P=2.330e+16
Color(0.5177f, 0.6183f, 1.0000f), // T= 12900K P=2.373e+16
Color(0.5152f, 0.6162f, 1.0000f), // T= 13000K P=2.416e+16
Color(0.5128f, 0.6142f, 1.0000f), // T= 13100K P=2.459e+16
Color(0.5104f, 0.6122f, 1.0000f), // T= 13200K P=2.503e+16
Color(0.5080f, 0.6103f, 1.0000f), // T= 13300K P=2.547e+16
Color(0.5057f, 0.6084f, 1.0000f), // T= 13400K P=2.591e+16
Color(0.5035f, 0.6065f, 1.0000f), // T= 13500K P=2.635e+16
Color(0.5013f, 0.6047f, 1.0000f), // T= 13600K P=2.680e+16
Color(0.4991f, 0.6029f, 1.0000f), // T= 13700K P=2.724e+16
Color(0.4970f, 0.6012f, 1.0000f), // T= 13800K P=2.769e+16
Color(0.4950f, 0.5994f, 1.0000f), // T= 13900K P=2.814e+16
Color(0.4930f, 0.5978f, 1.0000f), // T= 14000K P=2.860e+16
Color(0.4910f, 0.5961f, 1.0000f), // T= 14100K P=2.905e+16
Color(0.4891f, 0.5945f, 1.0000f), // T= 14200K P=2.951e+16
Color(0.4872f, 0.5929f, 1.0000f), // T= 14300K P=2.997e+16
Color(0.4853f, 0.5913f, 1.0000f), // T= 14400K P=3.043e+16
Color(0.4835f, 0.5898f, 1.0000f), // T= 14500K P=3.089e+16
Color(0.4817f, 0.5882f, 1.0000f), // T= 14600K P=3.135e+16
Color(0.4799f, 0.5868f, 1.0000f), // T= 14700K P=3.182e+16
Color(0.4782f, 0.5853f, 1.0000f), // T= 14800K P=3.228e+16
Color(0.4765f, 0.5839f, 1.0000f), // T= 14900K P=3.275e+16
Color(0.4749f, 0.5824f, 1.0000f), // T= 15000K P=3.322e+16
Color(0.4733f, 0.5811f, 1.0000f), // T= 15100K P=3.369e+16
Color(0.4717f, 0.5797f, 1.0000f), // T= 15200K P=3.416e+16
Color(0.4701f, 0.5784f, 1.0000f), // T= 15300K P=3.464e+16
Color(0.4686f, 0.5770f, 1.0000f), // T= 15400K P=3.511e+16
Color(0.4671f, 0.5757f, 1.0000f), // T= 15500K P=3.559e+16
Color(0.4656f, 0.5745f, 1.0000f), // T= 15600K P=3.607e+16
Color(0.4641f, 0.5732f, 1.0000f), // T= 15700K P=3.655e+16
Color(0.4627f, 0.5720f, 1.0000f), // T= 15800K P=3.703e+16
Color(0.4613f, 0.5708f, 1.0000f), // T= 15900K P=3.751e+16
Color(0.4599f, 0.5696f, 1.0000f), // T= 16000K P=3.800e+16
Color(0.4586f, 0.5684f, 1.0000f), // T= 16100K P=3.848e+16
Color(0.4572f, 0.5673f, 1.0000f), // T= 16200K P=3.897e+16
Color(0.4559f, 0.5661f, 1.0000f), // T= 16300K P=3.946e+16
Color(0.4546f, 0.5650f, 1.0000f), // T= 16400K P=3.995e+16
Color(0.4534f, 0.5639f, 1.0000f), // T= 16500K P=4.044e+16
Color(0.4521f, 0.5628f, 1.0000f), // T= 16600K P=4.093e+16
Color(0.4509f, 0.5617f, 1.0000f), // T= 16700K P=4.143e+16
Color(0.4497f, 0.5607f, 1.0000f), // T= 16800K P=4.192e+16
Color(0.4485f, 0.5597f, 1.0000f), // T= 16900K P=4.241e+16
Color(0.4474f, 0.5586f, 1.0000f), // T= 17000K P=4.291e+16
Color(0.4462f, 0.5576f, 1.0000f), // T= 17100K P=4.341e+16
Color(0.4451f, 0.5566f, 1.0000f), // T= 17200K P=4.391e+16
Color(0.4440f, 0.5557f, 1.0000f), // T= 17300K P=4.441e+16
Color(0.4429f, 0.5547f, 1.0000f), // T= 17400K P=4.491e+16
Color(0.4418f, 0.5538f, 1.0000f), // T= 17500K P=4.541e+16
Color(0.4408f, 0.5528f, 1.0000f), // T= 17600K P=4.592e+16
Color(0.4397f, 0.5519f, 1.0000f), // T= 17700K P=4.642e+16
Color(0.4387f, 0.5510f, 1.0000f), // T= 17800K P=4.693e+16
Color(0.4377f, 0.5501f, 1.0000f), // T= 17900K P=4.743e+16
Color(0.4367f, 0.5492f, 1.0000f), // T= 18000K P=4.794e+16
Color(0.4357f, 0.5483f, 1.0000f), // T= 18100K P=4.845e+16
Color(0.4348f, 0.5475f, 1.0000f), // T= 18200K P=4.896e+16
Color(0.4338f, 0.5466f, 1.0000f), // T= 18300K P=4.947e+16
Color(0.4329f, 0.5458f, 1.0000f), // T= 18400K P=4.998e+16
Color(0.4319f, 0.5450f, 1.0000f), // T= 18500K P=5.049e+16
Color(0.4310f, 0.5442f, 1.0000f), // T= 18600K P=5.100e+16
Color(0.4301f, 0.5434f, 1.0000f), // T= 18700K P=5.152e+16
Color(0.4293f, 0.5426f, 1.0000f), // T= 18800K P=5.203e+16
Color(0.4284f, 0.5418f, 1.0000f), // T= 18900K P=5.255e+16
Color(0.4275f, 0.5410f, 1.0000f), // T= 19000K P=5.307e+16
Color(0.4267f, 0.5403f, 1.0000f), // T= 19100K P=5.358e+16
Color(0.4258f, 0.5395f, 1.0000f), // T= 19200K P=5.410e+16
Color(0.4250f, 0.5388f, 1.0000f), // T= 19300K P=5.462e+16
Color(0.4242f, 0.5381f, 1.0000f), // T= 19400K P=5.514e+16
Color(0.4234f, 0.5373f, 1.0000f), // T= 19500K P=5.566e+16
Color(0.4226f, 0.5366f, 1.0000f), // T= 19600K P=5.618e+16
Color(0.4218f, 0.5359f, 1.0000f), // T= 19700K P=5.671e+16
Color(0.4211f, 0.5352f, 1.0000f), // T= 19800K P=5.723e+16
Color(0.4203f, 0.5345f, 1.0000f), // T= 19900K P=5.775e+16
Color(0.4196f, 0.5339f, 1.0000f), // T= 20000K P=5.828e+16
Color(0.4188f, 0.5332f, 1.0000f), // T= 20100K P=5.880e+16
Color(0.4181f, 0.5325f, 1.0000f), // T= 20200K P=5.933e+16
Color(0.4174f, 0.5319f, 1.0000f), // T= 20300K P=5.986e+16
Color(0.4167f, 0.5312f, 1.0000f), // T= 20400K P=6.038e+16
Color(0.4160f, 0.5306f, 1.0000f), // T= 20500K P=6.091e+16
Color(0.4153f, 0.5300f, 1.0000f), // T= 20600K P=6.144e+16
Color(0.4146f, 0.5293f, 1.0000f), // T= 20700K P=6.197e+16
Color(0.4139f, 0.5287f, 1.0000f), // T= 20800K P=6.250e+16
Color(0.4133f, 0.5281f, 1.0000f), // T= 20900K P=6.303e+16
Color(0.4126f, 0.5275f, 1.0000f), // T= 21000K P=6.357e+16
Color(0.4119f, 0.5269f, 1.0000f), // T= 21100K P=6.410e+16
Color(0.4113f, 0.5264f, 1.0000f), // T= 21200K P=6.463e+16
Color(0.4107f, 0.5258f, 1.0000f), // T= 21300K P=6.517e+16
Color(0.4100f, 0.5252f, 1.0000f), // T= 21400K P=6.570e+16
Color(0.4094f, 0.5246f, 1.0000f), // T= 21500K P=6.623e+16
Color(0.4088f, 0.5241f, 1.0000f), // T= 21600K P=6.677e+16
Color(0.4082f, 0.5235f, 1.0000f), // T= 21700K P=6.731e+16
Color(0.4076f, 0.5230f, 1.0000f), // T= 21800K P=6.784e+16
Color(0.4070f, 0.5224f, 1.0000f), // T= 21900K P=6.838e+16
Color(0.4064f, 0.5219f, 1.0000f), // T= 22000K P=6.892e+16
Color(0.4059f, 0.5214f, 1.0000f), // T= 22100K P=6.946e+16
Color(0.4053f, 0.5209f, 1.0000f), // T= 22200K P=7.000e+16
Color(0.4047f, 0.5203f, 1.0000f), // T= 22300K P=7.054e+16
Color(0.4042f, 0.5198f, 1.0000f), // T= 22400K P=7.108e+16
Color(0.4036f, 0.5193f, 1.0000f), // T= 22500K P=7.162e+16
Color(0.4031f, 0.5188f, 1.0000f), // T= 22600K P=7.216e+16
Color(0.4026f, 0.5183f, 1.0000f), // T= 22700K P=7.270e+16
Color(0.4020f, 0.5178f, 1.0000f), // T= 22800K P=7.325e+16
Color(0.4015f, 0.5174f, 1.0000f), // T= 22900K P=7.379e+16
Color(0.4010f, 0.5169f, 1.0000f), // T= 23000K P=7.433e+16
Color(0.4005f, 0.5164f, 1.0000f), // T= 23100K P=7.488e+16
Color(0.4000f, 0.5159f, 1.0000f), // T= 23200K P=7.542e+16
Color(0.3995f, 0.5155f, 1.0000f), // T= 23300K P=7.597e+16
Color(0.3990f, 0.5150f, 1.0000f), // T= 23400K P=7.651e+16
Color(0.3985f, 0.5146f, 1.0000f), // T= 23500K P=7.706e+16
Color(0.3980f, 0.5141f, 1.0000f), // T= 23600K P=7.760e+16
Color(0.3975f, 0.5137f, 1.0000f), // T= 23700K P=7.815e+16
Color(0.3970f, 0.5132f, 1.0000f), // T= 23800K P=7.870e+16
Color(0.3966f, 0.5128f, 1.0000f), // T= 23900K P=7.925e+16
Color(0.3961f, 0.5123f, 1.0000f), // T= 24000K P=7.980e+16
Color(0.3956f, 0.5119f, 1.0000f), // T= 24100K P=8.035e+16
Color(0.3952f, 0.5115f, 1.0000f), // T= 24200K P=8.089e+16
Color(0.3947f, 0.5111f, 1.0000f), // T= 24300K P=8.144e+16
Color(0.3943f, 0.5107f, 1.0000f), // T= 24400K P=8.199e+16
Color(0.3938f, 0.5103f, 1.0000f), // T= 24500K P=8.255e+16
Color(0.3934f, 0.5098f, 1.0000f), // T= 24600K P=8.310e+16
Color(0.3930f, 0.5094f, 1.0000f), // T= 24700K P=8.365e+16
Color(0.3925f, 0.5090f, 1.0000f), // T= 24800K P=8.420e+16
Color(0.3921f, 0.5086f, 1.0000f), // T= 24900K P=8.475e+16
Color(0.3917f, 0.5083f, 1.0000f), // T= 25000K P=8.531e+16
Color(0.3913f, 0.5079f, 1.0000f), // T= 25100K P=8.586e+16
Color(0.3909f, 0.5075f, 1.0000f), // T= 25200K P=8.641e+16
Color(0.3905f, 0.5071f, 1.0000f), // T= 25300K P=8.697e+16
Color(0.3901f, 0.5067f, 1.0000f), // T= 25400K P=8.752e+16
Color(0.3897f, 0.5064f, 1.0000f), // T= 25500K P=8.808e+16
Color(0.3893f, 0.5060f, 1.0000f), // T= 25600K P=8.863e+16
Color(0.3889f, 0.5056f, 1.0000f), // T= 25700K P=8.919e+16
Color(0.3885f, 0.5053f, 1.0000f), // T= 25800K P=8.974e+16
Color(0.3881f, 0.5049f, 1.0000f), // T= 25900K P=9.030e+16
Color(0.3877f, 0.5045f, 1.0000f), // T= 26000K P=9.086e+16
Color(0.3874f, 0.5042f, 1.0000f), // T= 26100K P=9.141e+16
Color(0.3870f, 0.5038f, 1.0000f), // T= 26200K P=9.197e+16
Color(0.3866f, 0.5035f, 1.0000f), // T= 26300K P=9.253e+16
Color(0.3863f, 0.5032f, 1.0000f), // T= 26400K P=9.309e+16
Color(0.3859f, 0.5028f, 1.0000f), // T= 26500K P=9.365e+16
Color(0.3855f, 0.5025f, 1.0000f), // T= 26600K P=9.421e+16
Color(0.3852f, 0.5021f, 1.0000f), // T= 26700K P=9.476e+16
Color(0.3848f, 0.5018f, 1.0000f), // T= 26800K P=9.532e+16
Color(0.3845f, 0.5015f, 1.0000f), // T= 26900K P=9.588e+16
Color(0.3841f, 0.5012f, 1.0000f), // T= 27000K P=9.644e+16
Color(0.3838f, 0.5008f, 1.0000f), // T= 27100K P=9.701e+16
Color(0.3835f, 0.5005f, 1.0000f), // T= 27200K P=9.757e+16
Color(0.3831f, 0.5002f, 1.0000f), // T= 27300K P=9.813e+16
Color(0.3828f, 0.4999f, 1.0000f), // T= 27400K P=9.869e+16
Color(0.3825f, 0.4996f, 1.0000f), // T= 27500K P=9.925e+16
Color(0.3821f, 0.4993f, 1.0000f), // T= 27600K P=9.981e+16
Color(0.3818f, 0.4990f, 1.0000f), // T= 27700K P=1.004e+17
Color(0.3815f, 0.4987f, 1.0000f), // T= 27800K P=1.009e+17
Color(0.3812f, 0.4984f, 1.0000f), // T= 27900K P=1.015e+17
Color(0.3809f, 0.4981f, 1.0000f), // T= 28000K P=1.021e+17
Color(0.3805f, 0.4978f, 1.0000f), // T= 28100K P=1.026e+17
Color(0.3802f, 0.4975f, 1.0000f), // T= 28200K P=1.032e+17
Color(0.3799f, 0.4972f, 1.0000f), // T= 28300K P=1.038e+17
Color(0.3796f, 0.4969f, 1.0000f), // T= 28400K P=1.043e+17
Color(0.3793f, 0.4966f, 1.0000f), // T= 28500K P=1.049e+17
Color(0.3790f, 0.4963f, 1.0000f), // T= 28600K P=1.055e+17
Color(0.3787f, 0.4960f, 1.0000f), // T= 28700K P=1.060e+17
Color(0.3784f, 0.4958f, 1.0000f), // T= 28800K P=1.066e+17
Color(0.3781f, 0.4955f, 1.0000f), // T= 28900K P=1.072e+17
Color(0.3779f, 0.4952f, 1.0000f), // T= 29000K P=1.077e+17
Color(0.3776f, 0.4949f, 1.0000f), // T= 29100K P=1.083e+17
Color(0.3773f, 0.4947f, 1.0000f), // T= 29200K P=1.089e+17
Color(0.3770f, 0.4944f, 1.0000f), // T= 29300K P=1.094e+17
Color(0.3767f, 0.4941f, 1.0000f), // T= 29400K P=1.100e+17
Color(0.3764f, 0.4939f, 1.0000f), // T= 29500K P=1.106e+17
Color(0.3762f, 0.4936f, 1.0000f), // T= 29600K P=1.111e+17
Color(0.3759f, 0.4934f, 1.0000f), // T= 29700K P=1.117e+17
Color(0.3756f, 0.4931f, 1.0000f), // T= 29800K P=1.123e+17
Color(0.3754f, 0.4928f, 1.0000f), // T= 29900K P=1.128e+17
Color(0.3751f, 0.4926f, 1.0000f), // T= 30000K P=1.134e+17
Color(0.3748f, 0.4923f, 1.0000f), // T= 30100K P=1.140e+17
Color(0.3746f, 0.4921f, 1.0000f), // T= 30200K P=1.145e+17
Color(0.3743f, 0.4918f, 1.0000f), // T= 30300K P=1.151e+17
Color(0.3741f, 0.4916f, 1.0000f), // T= 30400K P=1.157e+17
Color(0.3738f, 0.4914f, 1.0000f), // T= 30500K P=1.162e+17
Color(0.3735f, 0.4911f, 1.0000f), // T= 30600K P=1.168e+17
Color(0.3733f, 0.4909f, 1.0000f), // T= 30700K P=1.174e+17
Color(0.3730f, 0.4906f, 1.0000f), // T= 30800K P=1.180e+17
Color(0.3728f, 0.4904f, 1.0000f), // T= 30900K P=1.185e+17
Color(0.3726f, 0.4902f, 1.0000f), // T= 31000K P=1.191e+17
Color(0.3723f, 0.4899f, 1.0000f), // T= 31100K P=1.197e+17
Color(0.3721f, 0.4897f, 1.0000f), // T= 31200K P=1.202e+17
Color(0.3718f, 0.4895f, 1.0000f), // T= 31300K P=1.208e+17
Color(0.3716f, 0.4893f, 1.0000f), // T= 31400K P=1.214e+17
Color(0.3714f, 0.4890f, 1.0000f), // T= 31500K P=1.220e+17
Color(0.3711f, 0.4888f, 1.0000f), // T= 31600K P=1.225e+17
Color(0.3709f, 0.4886f, 1.0000f), // T= 31700K P=1.231e+17
Color(0.3707f, 0.4884f, 1.0000f), // T= 31800K P=1.237e+17
Color(0.3704f, 0.4881f, 1.0000f), // T= 31900K P=1.242e+17
Color(0.3702f, 0.4879f, 1.0000f), // T= 32000K P=1.248e+17
Color(0.3700f, 0.4877f, 1.0000f), // T= 32100K P=1.254e+17
Color(0.3698f, 0.4875f, 1.0000f), // T= 32200K P=1.260e+17
Color(0.3695f, 0.4873f, 1.0000f), // T= 32300K P=1.265e+17
Color(0.3693f, 0.4871f, 1.0000f), // T= 32400K P=1.271e+17
Color(0.3691f, 0.4869f, 1.0000f), // T= 32500K P=1.277e+17
Color(0.3689f, 0.4867f, 1.0000f), // T= 32600K P=1.283e+17
Color(0.3687f, 0.4864f, 1.0000f), // T= 32700K P=1.288e+17
Color(0.3684f, 0.4862f, 1.0000f), // T= 32800K P=1.294e+17
Color(0.3682f, 0.4860f, 1.0000f), // T= 32900K P=1.300e+17
Color(0.3680f, 0.4858f, 1.0000f), // T= 33000K P=1.306e+17
Color(0.3678f, 0.4856f, 1.0000f), // T= 33100K P=1.311e+17
Color(0.3676f, 0.4854f, 1.0000f), // T= 33200K P=1.317e+17
Color(0.3674f, 0.4852f, 1.0000f), // T= 33300K P=1.323e+17
Color(0.3672f, 0.4850f, 1.0000f), // T= 33400K P=1.329e+17
Color(0.3670f, 0.4848f, 1.0000f), // T= 33500K P=1.334e+17
Color(0.3668f, 0.4847f, 1.0000f), // T= 33600K P=1.340e+17
Color(0.3666f, 0.4845f, 1.0000f), // T= 33700K P=1.346e+17
Color(0.3664f, 0.4843f, 1.0000f), // T= 33800K P=1.352e+17
Color(0.3662f, 0.4841f, 1.0000f), // T= 33900K P=1.358e+17
Color(0.3660f, 0.4839f, 1.0000f), // T= 34000K P=1.363e+17
Color(0.3658f, 0.4837f, 1.0000f), // T= 34100K P=1.369e+17
Color(0.3656f, 0.4835f, 1.0000f), // T= 34200K P=1.375e+17
Color(0.3654f, 0.4833f, 1.0000f), // T= 34300K P=1.381e+17
Color(0.3652f, 0.4831f, 1.0000f), // T= 34400K P=1.386e+17
Color(0.3650f, 0.4830f, 1.0000f), // T= 34500K P=1.392e+17
Color(0.3649f, 0.4828f, 1.0000f), // T= 34600K P=1.398e+17
Color(0.3647f, 0.4826f, 1.0000f), // T= 34700K P=1.404e+17
Color(0.3645f, 0.4824f, 1.0000f), // T= 34800K P=1.410e+17
Color(0.3643f, 0.4822f, 1.0000f), // T= 34900K P=1.415e+17
Color(0.3641f, 0.4821f, 1.0000f), // T= 35000K P=1.421e+17
Color(0.3639f, 0.4819f, 1.0000f), // T= 35100K P=1.427e+17
Color(0.3638f, 0.4817f, 1.0000f), // T= 35200K P=1.433e+17
Color(0.3636f, 0.4815f, 1.0000f), // T= 35300K P=1.439e+17
Color(0.3634f, 0.4814f, 1.0000f), // T= 35400K P=1.444e+17
Color(0.3632f, 0.4812f, 1.0000f), // T= 35500K P=1.450e+17
Color(0.3630f, 0.4810f, 1.0000f), // T= 35600K P=1.456e+17
Color(0.3629f, 0.4809f, 1.0000f), // T= 35700K P=1.462e+17
Color(0.3627f, 0.4807f, 1.0000f), // T= 35800K P=1.468e+17
Color(0.3625f, 0.4805f, 1.0000f), // T= 35900K P=1.473e+17
Color(0.3624f, 0.4804f, 1.0000f), // T= 36000K P=1.479e+17
Color(0.3622f, 0.4802f, 1.0000f), // T= 36100K P=1.485e+17
Color(0.3620f, 0.4800f, 1.0000f), // T= 36200K P=1.491e+17
Color(0.3619f, 0.4799f, 1.0000f), // T= 36300K P=1.497e+17
Color(0.3617f, 0.4797f, 1.0000f), // T= 36400K P=1.502e+17
Color(0.3615f, 0.4796f, 1.0000f), // T= 36500K P=1.508e+17
Color(0.3614f, 0.4794f, 1.0000f), // T= 36600K P=1.514e+17
Color(0.3612f, 0.4792f, 1.0000f), // T= 36700K P=1.520e+17
Color(0.3610f, 0.4791f, 1.0000f), // T= 36800K P=1.526e+17
Color(0.3609f, 0.4789f, 1.0000f), // T= 36900K P=1.531e+17
Color(0.3607f, 0.4788f, 1.0000f), // T= 37000K P=1.537e+17
Color(0.3605f, 0.4786f, 1.0000f), // T= 37100K P=1.543e+17
Color(0.3604f, 0.4785f, 1.0000f), // T= 37200K P=1.549e+17
Color(0.3602f, 0.4783f, 1.0000f), // T= 37300K P=1.555e+17
Color(0.3601f, 0.4782f, 1.0000f), // T= 37400K P=1.561e+17
Color(0.3599f, 0.4780f, 1.0000f), // T= 37500K P=1.566e+17
Color(0.3598f, 0.4779f, 1.0000f), // T= 37600K P=1.572e+17
Color(0.3596f, 0.4777f, 1.0000f), // T= 37700K P=1.578e+17
Color(0.3595f, 0.4776f, 1.0000f), // T= 37800K P=1.584e+17
Color(0.3593f, 0.4774f, 1.0000f), // T= 37900K P=1.590e+17
Color(0.3592f, 0.4773f, 1.0000f), // T= 38000K P=1.595e+17
Color(0.3590f, 0.4771f, 1.0000f), // T= 38100K P=1.601e+17
Color(0.3589f, 0.4770f, 1.0000f), // T= 38200K P=1.607e+17
Color(0.3587f, 0.4768f, 1.0000f), // T= 38300K P=1.613e+17
Color(0.3586f, 0.4767f, 1.0000f), // T= 38400K P=1.619e+17
Color(0.3584f, 0.4766f, 1.0000f), // T= 38500K P=1.625e+17
Color(0.3583f, 0.4764f, 1.0000f), // T= 38600K P=1.630e+17
Color(0.3581f, 0.4763f, 1.0000f), // T= 38700K P=1.636e+17
Color(0.3580f, 0.4761f, 1.0000f), // T= 38800K P=1.642e+17
Color(0.3579f, 0.4760f, 1.0000f), // T= 38900K P=1.648e+17
Color(0.3577f, 0.4759f, 1.0000f), // T= 39000K P=1.654e+17
Color(0.3576f, 0.4757f, 1.0000f), // T= 39100K P=1.660e+17
Color(0.3574f, 0.4756f, 1.0000f), // T= 39200K P=1.666e+17
Color(0.3573f, 0.4755f, 1.0000f), // T= 39300K P=1.671e+17
Color(0.3572f, 0.4753f, 1.0000f), // T= 39400K P=1.677e+17
Color(0.3570f, 0.4752f, 1.0000f), // T= 39500K P=1.683e+17
Color(0.3569f, 0.4751f, 1.0000f), // T= 39600K P=1.689e+17
Color(0.3567f, 0.4749f, 1.0000f), // T= 39700K P=1.695e+17
Color(0.3566f, 0.4748f, 1.0000f), // T= 39800K P=1.701e+17
Color(0.3565f, 0.4747f, 1.0000f), // T= 39900K P=1.707e+17
Color(0.3563f, 0.4745f, 1.0000f), // T= 40000K P=1.712e+17
Color(0.0000f, 0.0000f, 0.0000f), // T= 0K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 100K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 200K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 300K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 400K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 500K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 600K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 700K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 800K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 900K P=2.472e+06
Color(1.0000f, 0.0337f, 0.0000f), // T= 1000K P=2.472e+06
Color(1.0000f, 0.0592f, 0.0000f), // T= 1100K P=2.112e+07
Color(1.0000f, 0.0846f, 0.0000f), // T= 1200K P=1.282e+08
Color(1.0000f, 0.1096f, 0.0000f), // T= 1300K P=5.959e+08
Color(1.0000f, 0.1341f, 0.0000f), // T= 1400K P=2.243e+09
Color(1.0000f, 0.1578f, 0.0000f), // T= 1500K P=7.121e+09
Color(1.0000f, 0.1806f, 0.0000f), // T= 1600K P=1.967e+10
Color(1.0000f, 0.2025f, 0.0000f), // T= 1700K P=4.839e+10
Color(1.0000f, 0.2235f, 0.0000f), // T= 1800K P=1.081e+11
Color(1.0000f, 0.2434f, 0.0000f), // T= 1900K P=2.224e+11
Color(1.0000f, 0.2647f, 0.0033f), // T= 2000K P=4.268e+11
Color(1.0000f, 0.2889f, 0.0120f), // T= 2100K P=7.710e+11
Color(1.0000f, 0.3126f, 0.0219f), // T= 2200K P=1.322e+12
Color(1.0000f, 0.3360f, 0.0331f), // T= 2300K P=2.166e+12
Color(1.0000f, 0.3589f, 0.0454f), // T= 2400K P=3.408e+12
Color(1.0000f, 0.3814f, 0.0588f), // T= 2500K P=5.178e+12
Color(1.0000f, 0.4034f, 0.0734f), // T= 2600K P=7.624e+12
Color(1.0000f, 0.4250f, 0.0889f), // T= 2700K P=1.092e+13
Color(1.0000f, 0.4461f, 0.1054f), // T= 2800K P=1.524e+13
Color(1.0000f, 0.4668f, 0.1229f), // T= 2900K P=2.081e+13
Color(1.0000f, 0.4870f, 0.1411f), // T= 3000K P=2.784e+13
Color(1.0000f, 0.5067f, 0.1602f), // T= 3100K P=3.657e+13
Color(1.0000f, 0.5259f, 0.1800f), // T= 3200K P=4.725e+13
Color(1.0000f, 0.5447f, 0.2005f), // T= 3300K P=6.012e+13
Color(1.0000f, 0.5630f, 0.2216f), // T= 3400K P=7.545e+13
Color(1.0000f, 0.5809f, 0.2433f), // T= 3500K P=9.349e+13
Color(1.0000f, 0.5983f, 0.2655f), // T= 3600K P=1.145e+14
Color(1.0000f, 0.6153f, 0.2881f), // T= 3700K P=1.387e+14
Color(1.0000f, 0.6318f, 0.3112f), // T= 3800K P=1.665e+14
Color(1.0000f, 0.6480f, 0.3346f), // T= 3900K P=1.979e+14
Color(1.0000f, 0.6636f, 0.3583f), // T= 4000K P=2.333e+14
Color(1.0000f, 0.6789f, 0.3823f), // T= 4100K P=2.729e+14
Color(1.0000f, 0.6938f, 0.4066f), // T= 4200K P=3.169e+14
Color(1.0000f, 0.7083f, 0.4310f), // T= 4300K P=3.654e+14
Color(1.0000f, 0.7223f, 0.4556f), // T= 4400K P=4.188e+14
Color(1.0000f, 0.7360f, 0.4803f), // T= 4500K P=4.771e+14
Color(1.0000f, 0.7494f, 0.5051f), // T= 4600K P=5.406e+14
Color(1.0000f, 0.7623f, 0.5299f), // T= 4700K P=6.093e+14
Color(1.0000f, 0.7750f, 0.5548f), // T= 4800K P=6.835e+14
Color(1.0000f, 0.7872f, 0.5797f), // T= 4900K P=7.632e+14
Color(1.0000f, 0.7992f, 0.6045f), // T= 5000K P=8.485e+14
Color(1.0000f, 0.8108f, 0.6293f), // T= 5100K P=9.396e+14
Color(1.0000f, 0.8221f, 0.6541f), // T= 5200K P=1.036e+15
Color(1.0000f, 0.8330f, 0.6787f), // T= 5300K P=1.139e+15
Color(1.0000f, 0.8437f, 0.7032f), // T= 5400K P=1.248e+15
Color(1.0000f, 0.8541f, 0.7277f), // T= 5500K P=1.363e+15
Color(1.0000f, 0.8642f, 0.7519f), // T= 5600K P=1.484e+15
Color(1.0000f, 0.8740f, 0.7760f), // T= 5700K P=1.611e+15
Color(1.0000f, 0.8836f, 0.8000f), // T= 5800K P=1.744e+15
Color(1.0000f, 0.8929f, 0.8238f), // T= 5900K P=1.883e+15
Color(1.0000f, 0.9019f, 0.8473f), // T= 6000K P=2.028e+15
Color(1.0000f, 0.9107f, 0.8707f), // T= 6100K P=2.179e+15
Color(1.0000f, 0.9193f, 0.8939f), // T= 6200K P=2.337e+15
Color(1.0000f, 0.9276f, 0.9168f), // T= 6300K P=2.500e+15
Color(1.0000f, 0.9357f, 0.9396f), // T= 6400K P=2.669e+15
Color(1.0000f, 0.9436f, 0.9621f), // T= 6500K P=2.845e+15
Color(1.0000f, 0.9513f, 0.9844f), // T= 6600K P=3.026e+15
Color(0.9937f, 0.9526f, 1.0000f), // T= 6700K P=3.214e+15
Color(0.9726f, 0.9395f, 1.0000f), // T= 6800K P=3.407e+15
Color(0.9526f, 0.9270f, 1.0000f), // T= 6900K P=3.606e+15
Color(0.9337f, 0.9150f, 1.0000f), // T= 7000K P=3.811e+15
Color(0.9157f, 0.9035f, 1.0000f), // T= 7100K P=4.022e+15
Color(0.8986f, 0.8925f, 1.0000f), // T= 7200K P=4.238e+15
Color(0.8823f, 0.8819f, 1.0000f), // T= 7300K P=4.460e+15
Color(0.8668f, 0.8718f, 1.0000f), // T= 7400K P=4.688e+15
Color(0.8520f, 0.8621f, 1.0000f), // T= 7500K P=4.920e+15
Color(0.8379f, 0.8527f, 1.0000f), // T= 7600K P=5.159e+15
Color(0.8244f, 0.8437f, 1.0000f), // T= 7700K P=5.402e+15
Color(0.8115f, 0.8351f, 1.0000f), // T= 7800K P=5.651e+15
Color(0.7992f, 0.8268f, 1.0000f), // T= 7900K P=5.906e+15
Color(0.7874f, 0.8187f, 1.0000f), // T= 8000K P=6.165e+15
Color(0.7761f, 0.8110f, 1.0000f), // T= 8100K P=6.429e+15
Color(0.7652f, 0.8035f, 1.0000f), // T= 8200K P=6.698e+15
Color(0.7548f, 0.7963f, 1.0000f), // T= 8300K P=6.973e+15
Color(0.7449f, 0.7894f, 1.0000f), // T= 8400K P=7.252e+15
Color(0.7353f, 0.7827f, 1.0000f), // T= 8500K P=7.535e+15
Color(0.7260f, 0.7762f, 1.0000f), // T= 8600K P=7.824e+15
Color(0.7172f, 0.7699f, 1.0000f), // T= 8700K P=8.117e+15
Color(0.7086f, 0.7638f, 1.0000f), // T= 8800K P=8.415e+15
Color(0.7004f, 0.7579f, 1.0000f), // T= 8900K P=8.717e+15
Color(0.6925f, 0.7522f, 1.0000f), // T= 9000K P=9.023e+15
Color(0.6848f, 0.7467f, 1.0000f), // T= 9100K P=9.334e+15
Color(0.6774f, 0.7414f, 1.0000f), // T= 9200K P=9.649e+15
Color(0.6703f, 0.7362f, 1.0000f), // T= 9300K P=9.969e+15
Color(0.6635f, 0.7311f, 1.0000f), // T= 9400K P=1.029e+16
Color(0.6568f, 0.7263f, 1.0000f), // T= 9500K P=1.062e+16
Color(0.6504f, 0.7215f, 1.0000f), // T= 9600K P=1.095e+16
Color(0.6442f, 0.7169f, 1.0000f), // T= 9700K P=1.129e+16
Color(0.6382f, 0.7124f, 1.0000f), // T= 9800K P=1.163e+16
Color(0.6324f, 0.7081f, 1.0000f), // T= 9900K P=1.197e+16
Color(0.6268f, 0.7039f, 1.0000f), // T= 10000K P=1.231e+16
Color(0.6213f, 0.6998f, 1.0000f), // T= 10100K P=1.267e+16
Color(0.6161f, 0.6958f, 1.0000f), // T= 10200K P=1.302e+16
Color(0.6109f, 0.6919f, 1.0000f), // T= 10300K P=1.338e+16
Color(0.6060f, 0.6881f, 1.0000f), // T= 10400K P=1.374e+16
Color(0.6012f, 0.6844f, 1.0000f), // T= 10500K P=1.410e+16
Color(0.5965f, 0.6808f, 1.0000f), // T= 10600K P=1.447e+16
Color(0.5919f, 0.6773f, 1.0000f), // T= 10700K P=1.484e+16
Color(0.5875f, 0.6739f, 1.0000f), // T= 10800K P=1.521e+16
Color(0.5833f, 0.6706f, 1.0000f), // T= 10900K P=1.559e+16
Color(0.5791f, 0.6674f, 1.0000f), // T= 11000K P=1.597e+16
Color(0.5750f, 0.6642f, 1.0000f), // T= 11100K P=1.636e+16
Color(0.5711f, 0.6611f, 1.0000f), // T= 11200K P=1.674e+16
Color(0.5673f, 0.6581f, 1.0000f), // T= 11300K P=1.713e+16
Color(0.5636f, 0.6552f, 1.0000f), // T= 11400K P=1.752e+16
Color(0.5599f, 0.6523f, 1.0000f), // T= 11500K P=1.792e+16
Color(0.5564f, 0.6495f, 1.0000f), // T= 11600K P=1.832e+16
Color(0.5530f, 0.6468f, 1.0000f), // T= 11700K P=1.872e+16
Color(0.5496f, 0.6441f, 1.0000f), // T= 11800K P=1.912e+16
Color(0.5463f, 0.6415f, 1.0000f), // T= 11900K P=1.953e+16
Color(0.5431f, 0.6389f, 1.0000f), // T= 12000K P=1.994e+16
Color(0.5400f, 0.6364f, 1.0000f), // T= 12100K P=2.035e+16
Color(0.5370f, 0.6340f, 1.0000f), // T= 12200K P=2.076e+16
Color(0.5340f, 0.6316f, 1.0000f), // T= 12300K P=2.118e+16
Color(0.5312f, 0.6293f, 1.0000f), // T= 12400K P=2.160e+16
Color(0.5283f, 0.6270f, 1.0000f), // T= 12500K P=2.202e+16
Color(0.5256f, 0.6247f, 1.0000f), // T= 12600K P=2.244e+16
Color(0.5229f, 0.6225f, 1.0000f), // T= 12700K P=2.287e+16
Color(0.5203f, 0.6204f, 1.0000f), // T= 12800K P=2.330e+16
Color(0.5177f, 0.6183f, 1.0000f), // T= 12900K P=2.373e+16
Color(0.5152f, 0.6162f, 1.0000f), // T= 13000K P=2.416e+16
Color(0.5128f, 0.6142f, 1.0000f), // T= 13100K P=2.459e+16
Color(0.5104f, 0.6122f, 1.0000f), // T= 13200K P=2.503e+16
Color(0.5080f, 0.6103f, 1.0000f), // T= 13300K P=2.547e+16
Color(0.5057f, 0.6084f, 1.0000f), // T= 13400K P=2.591e+16
Color(0.5035f, 0.6065f, 1.0000f), // T= 13500K P=2.635e+16
Color(0.5013f, 0.6047f, 1.0000f), // T= 13600K P=2.680e+16
Color(0.4991f, 0.6029f, 1.0000f), // T= 13700K P=2.724e+16
Color(0.4970f, 0.6012f, 1.0000f), // T= 13800K P=2.769e+16
Color(0.4950f, 0.5994f, 1.0000f), // T= 13900K P=2.814e+16
Color(0.4930f, 0.5978f, 1.0000f), // T= 14000K P=2.860e+16
Color(0.4910f, 0.5961f, 1.0000f), // T= 14100K P=2.905e+16
Color(0.4891f, 0.5945f, 1.0000f), // T= 14200K P=2.951e+16
Color(0.4872f, 0.5929f, 1.0000f), // T= 14300K P=2.997e+16
Color(0.4853f, 0.5913f, 1.0000f), // T= 14400K P=3.043e+16
Color(0.4835f, 0.5898f, 1.0000f), // T= 14500K P=3.089e+16
Color(0.4817f, 0.5882f, 1.0000f), // T= 14600K P=3.135e+16
Color(0.4799f, 0.5868f, 1.0000f), // T= 14700K P=3.182e+16
Color(0.4782f, 0.5853f, 1.0000f), // T= 14800K P=3.228e+16
Color(0.4765f, 0.5839f, 1.0000f), // T= 14900K P=3.275e+16
Color(0.4749f, 0.5824f, 1.0000f), // T= 15000K P=3.322e+16
Color(0.4733f, 0.5811f, 1.0000f), // T= 15100K P=3.369e+16
Color(0.4717f, 0.5797f, 1.0000f), // T= 15200K P=3.416e+16
Color(0.4701f, 0.5784f, 1.0000f), // T= 15300K P=3.464e+16
Color(0.4686f, 0.5770f, 1.0000f), // T= 15400K P=3.511e+16
Color(0.4671f, 0.5757f, 1.0000f), // T= 15500K P=3.559e+16
Color(0.4656f, 0.5745f, 1.0000f), // T= 15600K P=3.607e+16
Color(0.4641f, 0.5732f, 1.0000f), // T= 15700K P=3.655e+16
Color(0.4627f, 0.5720f, 1.0000f), // T= 15800K P=3.703e+16
Color(0.4613f, 0.5708f, 1.0000f), // T= 15900K P=3.751e+16
Color(0.4599f, 0.5696f, 1.0000f), // T= 16000K P=3.800e+16
Color(0.4586f, 0.5684f, 1.0000f), // T= 16100K P=3.848e+16
Color(0.4572f, 0.5673f, 1.0000f), // T= 16200K P=3.897e+16
Color(0.4559f, 0.5661f, 1.0000f), // T= 16300K P=3.946e+16
Color(0.4546f, 0.5650f, 1.0000f), // T= 16400K P=3.995e+16
Color(0.4534f, 0.5639f, 1.0000f), // T= 16500K P=4.044e+16
Color(0.4521f, 0.5628f, 1.0000f), // T= 16600K P=4.093e+16
Color(0.4509f, 0.5617f, 1.0000f), // T= 16700K P=4.143e+16
Color(0.4497f, 0.5607f, 1.0000f), // T= 16800K P=4.192e+16
Color(0.4485f, 0.5597f, 1.0000f), // T= 16900K P=4.241e+16
Color(0.4474f, 0.5586f, 1.0000f), // T= 17000K P=4.291e+16
Color(0.4462f, 0.5576f, 1.0000f), // T= 17100K P=4.341e+16
Color(0.4451f, 0.5566f, 1.0000f), // T= 17200K P=4.391e+16
Color(0.4440f, 0.5557f, 1.0000f), // T= 17300K P=4.441e+16
Color(0.4429f, 0.5547f, 1.0000f), // T= 17400K P=4.491e+16
Color(0.4418f, 0.5538f, 1.0000f), // T= 17500K P=4.541e+16
Color(0.4408f, 0.5528f, 1.0000f), // T= 17600K P=4.592e+16
Color(0.4397f, 0.5519f, 1.0000f), // T= 17700K P=4.642e+16
Color(0.4387f, 0.5510f, 1.0000f), // T= 17800K P=4.693e+16
Color(0.4377f, 0.5501f, 1.0000f), // T= 17900K P=4.743e+16
Color(0.4367f, 0.5492f, 1.0000f), // T= 18000K P=4.794e+16
Color(0.4357f, 0.5483f, 1.0000f), // T= 18100K P=4.845e+16
Color(0.4348f, 0.5475f, 1.0000f), // T= 18200K P=4.896e+16
Color(0.4338f, 0.5466f, 1.0000f), // T= 18300K P=4.947e+16
Color(0.4329f, 0.5458f, 1.0000f), // T= 18400K P=4.998e+16
Color(0.4319f, 0.5450f, 1.0000f), // T= 18500K P=5.049e+16
Color(0.4310f, 0.5442f, 1.0000f), // T= 18600K P=5.100e+16
Color(0.4301f, 0.5434f, 1.0000f), // T= 18700K P=5.152e+16
Color(0.4293f, 0.5426f, 1.0000f), // T= 18800K P=5.203e+16
Color(0.4284f, 0.5418f, 1.0000f), // T= 18900K P=5.255e+16
Color(0.4275f, 0.5410f, 1.0000f), // T= 19000K P=5.307e+16
Color(0.4267f, 0.5403f, 1.0000f), // T= 19100K P=5.358e+16
Color(0.4258f, 0.5395f, 1.0000f), // T= 19200K P=5.410e+16
Color(0.4250f, 0.5388f, 1.0000f), // T= 19300K P=5.462e+16
Color(0.4242f, 0.5381f, 1.0000f), // T= 19400K P=5.514e+16
Color(0.4234f, 0.5373f, 1.0000f), // T= 19500K P=5.566e+16
Color(0.4226f, 0.5366f, 1.0000f), // T= 19600K P=5.618e+16
Color(0.4218f, 0.5359f, 1.0000f), // T= 19700K P=5.671e+16
Color(0.4211f, 0.5352f, 1.0000f), // T= 19800K P=5.723e+16
Color(0.4203f, 0.5345f, 1.0000f), // T= 19900K P=5.775e+16
Color(0.4196f, 0.5339f, 1.0000f), // T= 20000K P=5.828e+16
Color(0.4188f, 0.5332f, 1.0000f), // T= 20100K P=5.880e+16
Color(0.4181f, 0.5325f, 1.0000f), // T= 20200K P=5.933e+16
Color(0.4174f, 0.5319f, 1.0000f), // T= 20300K P=5.986e+16
Color(0.4167f, 0.5312f, 1.0000f), // T= 20400K P=6.038e+16
Color(0.4160f, 0.5306f, 1.0000f), // T= 20500K P=6.091e+16
Color(0.4153f, 0.5300f, 1.0000f), // T= 20600K P=6.144e+16
Color(0.4146f, 0.5293f, 1.0000f), // T= 20700K P=6.197e+16
Color(0.4139f, 0.5287f, 1.0000f), // T= 20800K P=6.250e+16
Color(0.4133f, 0.5281f, 1.0000f), // T= 20900K P=6.303e+16
Color(0.4126f, 0.5275f, 1.0000f), // T= 21000K P=6.357e+16
Color(0.4119f, 0.5269f, 1.0000f), // T= 21100K P=6.410e+16
Color(0.4113f, 0.5264f, 1.0000f), // T= 21200K P=6.463e+16
Color(0.4107f, 0.5258f, 1.0000f), // T= 21300K P=6.517e+16
Color(0.4100f, 0.5252f, 1.0000f), // T= 21400K P=6.570e+16
Color(0.4094f, 0.5246f, 1.0000f), // T= 21500K P=6.623e+16
Color(0.4088f, 0.5241f, 1.0000f), // T= 21600K P=6.677e+16
Color(0.4082f, 0.5235f, 1.0000f), // T= 21700K P=6.731e+16
Color(0.4076f, 0.5230f, 1.0000f), // T= 21800K P=6.784e+16
Color(0.4070f, 0.5224f, 1.0000f), // T= 21900K P=6.838e+16
Color(0.4064f, 0.5219f, 1.0000f), // T= 22000K P=6.892e+16
Color(0.4059f, 0.5214f, 1.0000f), // T= 22100K P=6.946e+16
Color(0.4053f, 0.5209f, 1.0000f), // T= 22200K P=7.000e+16
Color(0.4047f, 0.5203f, 1.0000f), // T= 22300K P=7.054e+16
Color(0.4042f, 0.5198f, 1.0000f), // T= 22400K P=7.108e+16
Color(0.4036f, 0.5193f, 1.0000f), // T= 22500K P=7.162e+16
Color(0.4031f, 0.5188f, 1.0000f), // T= 22600K P=7.216e+16
Color(0.4026f, 0.5183f, 1.0000f), // T= 22700K P=7.270e+16
Color(0.4020f, 0.5178f, 1.0000f), // T= 22800K P=7.325e+16
Color(0.4015f, 0.5174f, 1.0000f), // T= 22900K P=7.379e+16
Color(0.4010f, 0.5169f, 1.0000f), // T= 23000K P=7.433e+16
Color(0.4005f, 0.5164f, 1.0000f), // T= 23100K P=7.488e+16
Color(0.4000f, 0.5159f, 1.0000f), // T= 23200K P=7.542e+16
Color(0.3995f, 0.5155f, 1.0000f), // T= 23300K P=7.597e+16
Color(0.3990f, 0.5150f, 1.0000f), // T= 23400K P=7.651e+16
Color(0.3985f, 0.5146f, 1.0000f), // T= 23500K P=7.706e+16
Color(0.3980f, 0.5141f, 1.0000f), // T= 23600K P=7.760e+16
Color(0.3975f, 0.5137f, 1.0000f), // T= 23700K P=7.815e+16
Color(0.3970f, 0.5132f, 1.0000f), // T= 23800K P=7.870e+16
Color(0.3966f, 0.5128f, 1.0000f), // T= 23900K P=7.925e+16
Color(0.3961f, 0.5123f, 1.0000f), // T= 24000K P=7.980e+16
Color(0.3956f, 0.5119f, 1.0000f), // T= 24100K P=8.035e+16
Color(0.3952f, 0.5115f, 1.0000f), // T= 24200K P=8.089e+16
Color(0.3947f, 0.5111f, 1.0000f), // T= 24300K P=8.144e+16
Color(0.3943f, 0.5107f, 1.0000f), // T= 24400K P=8.199e+16
Color(0.3938f, 0.5103f, 1.0000f), // T= 24500K P=8.255e+16
Color(0.3934f, 0.5098f, 1.0000f), // T= 24600K P=8.310e+16
Color(0.3930f, 0.5094f, 1.0000f), // T= 24700K P=8.365e+16
Color(0.3925f, 0.5090f, 1.0000f), // T= 24800K P=8.420e+16
Color(0.3921f, 0.5086f, 1.0000f), // T= 24900K P=8.475e+16
Color(0.3917f, 0.5083f, 1.0000f), // T= 25000K P=8.531e+16
Color(0.3913f, 0.5079f, 1.0000f), // T= 25100K P=8.586e+16
Color(0.3909f, 0.5075f, 1.0000f), // T= 25200K P=8.641e+16
Color(0.3905f, 0.5071f, 1.0000f), // T= 25300K P=8.697e+16
Color(0.3901f, 0.5067f, 1.0000f), // T= 25400K P=8.752e+16
Color(0.3897f, 0.5064f, 1.0000f), // T= 25500K P=8.808e+16
Color(0.3893f, 0.5060f, 1.0000f), // T= 25600K P=8.863e+16
Color(0.3889f, 0.5056f, 1.0000f), // T= 25700K P=8.919e+16
Color(0.3885f, 0.5053f, 1.0000f), // T= 25800K P=8.974e+16
Color(0.3881f, 0.5049f, 1.0000f), // T= 25900K P=9.030e+16
Color(0.3877f, 0.5045f, 1.0000f), // T= 26000K P=9.086e+16
Color(0.3874f, 0.5042f, 1.0000f), // T= 26100K P=9.141e+16
Color(0.3870f, 0.5038f, 1.0000f), // T= 26200K P=9.197e+16
Color(0.3866f, 0.5035f, 1.0000f), // T= 26300K P=9.253e+16
Color(0.3863f, 0.5032f, 1.0000f), // T= 26400K P=9.309e+16
Color(0.3859f, 0.5028f, 1.0000f), // T= 26500K P=9.365e+16
Color(0.3855f, 0.5025f, 1.0000f), // T= 26600K P=9.421e+16
Color(0.3852f, 0.5021f, 1.0000f), // T= 26700K P=9.476e+16
Color(0.3848f, 0.5018f, 1.0000f), // T= 26800K P=9.532e+16
Color(0.3845f, 0.5015f, 1.0000f), // T= 26900K P=9.588e+16
Color(0.3841f, 0.5012f, 1.0000f), // T= 27000K P=9.644e+16
Color(0.3838f, 0.5008f, 1.0000f), // T= 27100K P=9.701e+16
Color(0.3835f, 0.5005f, 1.0000f), // T= 27200K P=9.757e+16
Color(0.3831f, 0.5002f, 1.0000f), // T= 27300K P=9.813e+16
Color(0.3828f, 0.4999f, 1.0000f), // T= 27400K P=9.869e+16
Color(0.3825f, 0.4996f, 1.0000f), // T= 27500K P=9.925e+16
Color(0.3821f, 0.4993f, 1.0000f), // T= 27600K P=9.981e+16
Color(0.3818f, 0.4990f, 1.0000f), // T= 27700K P=1.004e+17
Color(0.3815f, 0.4987f, 1.0000f), // T= 27800K P=1.009e+17
Color(0.3812f, 0.4984f, 1.0000f), // T= 27900K P=1.015e+17
Color(0.3809f, 0.4981f, 1.0000f), // T= 28000K P=1.021e+17
Color(0.3805f, 0.4978f, 1.0000f), // T= 28100K P=1.026e+17
Color(0.3802f, 0.4975f, 1.0000f), // T= 28200K P=1.032e+17
Color(0.3799f, 0.4972f, 1.0000f), // T= 28300K P=1.038e+17
Color(0.3796f, 0.4969f, 1.0000f), // T= 28400K P=1.043e+17
Color(0.3793f, 0.4966f, 1.0000f), // T= 28500K P=1.049e+17
Color(0.3790f, 0.4963f, 1.0000f), // T= 28600K P=1.055e+17
Color(0.3787f, 0.4960f, 1.0000f), // T= 28700K P=1.060e+17
Color(0.3784f, 0.4958f, 1.0000f), // T= 28800K P=1.066e+17
Color(0.3781f, 0.4955f, 1.0000f), // T= 28900K P=1.072e+17
Color(0.3779f, 0.4952f, 1.0000f), // T= 29000K P=1.077e+17
Color(0.3776f, 0.4949f, 1.0000f), // T= 29100K P=1.083e+17
Color(0.3773f, 0.4947f, 1.0000f), // T= 29200K P=1.089e+17
Color(0.3770f, 0.4944f, 1.0000f), // T= 29300K P=1.094e+17
Color(0.3767f, 0.4941f, 1.0000f), // T= 29400K P=1.100e+17
Color(0.3764f, 0.4939f, 1.0000f), // T= 29500K P=1.106e+17
Color(0.3762f, 0.4936f, 1.0000f), // T= 29600K P=1.111e+17
Color(0.3759f, 0.4934f, 1.0000f), // T= 29700K P=1.117e+17
Color(0.3756f, 0.4931f, 1.0000f), // T= 29800K P=1.123e+17
Color(0.3754f, 0.4928f, 1.0000f), // T= 29900K P=1.128e+17
Color(0.3751f, 0.4926f, 1.0000f), // T= 30000K P=1.134e+17
Color(0.3748f, 0.4923f, 1.0000f), // T= 30100K P=1.140e+17
Color(0.3746f, 0.4921f, 1.0000f), // T= 30200K P=1.145e+17
Color(0.3743f, 0.4918f, 1.0000f), // T= 30300K P=1.151e+17
Color(0.3741f, 0.4916f, 1.0000f), // T= 30400K P=1.157e+17
Color(0.3738f, 0.4914f, 1.0000f), // T= 30500K P=1.162e+17
Color(0.3735f, 0.4911f, 1.0000f), // T= 30600K P=1.168e+17
Color(0.3733f, 0.4909f, 1.0000f), // T= 30700K P=1.174e+17
Color(0.3730f, 0.4906f, 1.0000f), // T= 30800K P=1.180e+17
Color(0.3728f, 0.4904f, 1.0000f), // T= 30900K P=1.185e+17
Color(0.3726f, 0.4902f, 1.0000f), // T= 31000K P=1.191e+17
Color(0.3723f, 0.4899f, 1.0000f), // T= 31100K P=1.197e+17
Color(0.3721f, 0.4897f, 1.0000f), // T= 31200K P=1.202e+17
Color(0.3718f, 0.4895f, 1.0000f), // T= 31300K P=1.208e+17
Color(0.3716f, 0.4893f, 1.0000f), // T= 31400K P=1.214e+17
Color(0.3714f, 0.4890f, 1.0000f), // T= 31500K P=1.220e+17
Color(0.3711f, 0.4888f, 1.0000f), // T= 31600K P=1.225e+17
Color(0.3709f, 0.4886f, 1.0000f), // T= 31700K P=1.231e+17
Color(0.3707f, 0.4884f, 1.0000f), // T= 31800K P=1.237e+17
Color(0.3704f, 0.4881f, 1.0000f), // T= 31900K P=1.242e+17
Color(0.3702f, 0.4879f, 1.0000f), // T= 32000K P=1.248e+17
Color(0.3700f, 0.4877f, 1.0000f), // T= 32100K P=1.254e+17
Color(0.3698f, 0.4875f, 1.0000f), // T= 32200K P=1.260e+17
Color(0.3695f, 0.4873f, 1.0000f), // T= 32300K P=1.265e+17
Color(0.3693f, 0.4871f, 1.0000f), // T= 32400K P=1.271e+17
Color(0.3691f, 0.4869f, 1.0000f), // T= 32500K P=1.277e+17
Color(0.3689f, 0.4867f, 1.0000f), // T= 32600K P=1.283e+17
Color(0.3687f, 0.4864f, 1.0000f), // T= 32700K P=1.288e+17
Color(0.3684f, 0.4862f, 1.0000f), // T= 32800K P=1.294e+17
Color(0.3682f, 0.4860f, 1.0000f), // T= 32900K P=1.300e+17
Color(0.3680f, 0.4858f, 1.0000f), // T= 33000K P=1.306e+17
Color(0.3678f, 0.4856f, 1.0000f), // T= 33100K P=1.311e+17
Color(0.3676f, 0.4854f, 1.0000f), // T= 33200K P=1.317e+17
Color(0.3674f, 0.4852f, 1.0000f), // T= 33300K P=1.323e+17
Color(0.3672f, 0.4850f, 1.0000f), // T= 33400K P=1.329e+17
Color(0.3670f, 0.4848f, 1.0000f), // T= 33500K P=1.334e+17
Color(0.3668f, 0.4847f, 1.0000f), // T= 33600K P=1.340e+17
Color(0.3666f, 0.4845f, 1.0000f), // T= 33700K P=1.346e+17
Color(0.3664f, 0.4843f, 1.0000f), // T= 33800K P=1.352e+17
Color(0.3662f, 0.4841f, 1.0000f), // T= 33900K P=1.358e+17
Color(0.3660f, 0.4839f, 1.0000f), // T= 34000K P=1.363e+17
Color(0.3658f, 0.4837f, 1.0000f), // T= 34100K P=1.369e+17
Color(0.3656f, 0.4835f, 1.0000f), // T= 34200K P=1.375e+17
Color(0.3654f, 0.4833f, 1.0000f), // T= 34300K P=1.381e+17
Color(0.3652f, 0.4831f, 1.0000f), // T= 34400K P=1.386e+17
Color(0.3650f, 0.4830f, 1.0000f), // T= 34500K P=1.392e+17
Color(0.3649f, 0.4828f, 1.0000f), // T= 34600K P=1.398e+17
Color(0.3647f, 0.4826f, 1.0000f), // T= 34700K P=1.404e+17
Color(0.3645f, 0.4824f, 1.0000f), // T= 34800K P=1.410e+17
Color(0.3643f, 0.4822f, 1.0000f), // T= 34900K P=1.415e+17
Color(0.3641f, 0.4821f, 1.0000f), // T= 35000K P=1.421e+17
Color(0.3639f, 0.4819f, 1.0000f), // T= 35100K P=1.427e+17
Color(0.3638f, 0.4817f, 1.0000f), // T= 35200K P=1.433e+17
Color(0.3636f, 0.4815f, 1.0000f), // T= 35300K P=1.439e+17
Color(0.3634f, 0.4814f, 1.0000f), // T= 35400K P=1.444e+17
Color(0.3632f, 0.4812f, 1.0000f), // T= 35500K P=1.450e+17
Color(0.3630f, 0.4810f, 1.0000f), // T= 35600K P=1.456e+17
Color(0.3629f, 0.4809f, 1.0000f), // T= 35700K P=1.462e+17
Color(0.3627f, 0.4807f, 1.0000f), // T= 35800K P=1.468e+17
Color(0.3625f, 0.4805f, 1.0000f), // T= 35900K P=1.473e+17
Color(0.3624f, 0.4804f, 1.0000f), // T= 36000K P=1.479e+17
Color(0.3622f, 0.4802f, 1.0000f), // T= 36100K P=1.485e+17
Color(0.3620f, 0.4800f, 1.0000f), // T= 36200K P=1.491e+17
Color(0.3619f, 0.4799f, 1.0000f), // T= 36300K P=1.497e+17
Color(0.3617f, 0.4797f, 1.0000f), // T= 36400K P=1.502e+17
Color(0.3615f, 0.4796f, 1.0000f), // T= 36500K P=1.508e+17
Color(0.3614f, 0.4794f, 1.0000f), // T= 36600K P=1.514e+17
Color(0.3612f, 0.4792f, 1.0000f), // T= 36700K P=1.520e+17
Color(0.3610f, 0.4791f, 1.0000f), // T= 36800K P=1.526e+17
Color(0.3609f, 0.4789f, 1.0000f), // T= 36900K P=1.531e+17
Color(0.3607f, 0.4788f, 1.0000f), // T= 37000K P=1.537e+17
Color(0.3605f, 0.4786f, 1.0000f), // T= 37100K P=1.543e+17
Color(0.3604f, 0.4785f, 1.0000f), // T= 37200K P=1.549e+17
Color(0.3602f, 0.4783f, 1.0000f), // T= 37300K P=1.555e+17
Color(0.3601f, 0.4782f, 1.0000f), // T= 37400K P=1.561e+17
Color(0.3599f, 0.4780f, 1.0000f), // T= 37500K P=1.566e+17
Color(0.3598f, 0.4779f, 1.0000f), // T= 37600K P=1.572e+17
Color(0.3596f, 0.4777f, 1.0000f), // T= 37700K P=1.578e+17
Color(0.3595f, 0.4776f, 1.0000f), // T= 37800K P=1.584e+17
Color(0.3593f, 0.4774f, 1.0000f), // T= 37900K P=1.590e+17
Color(0.3592f, 0.4773f, 1.0000f), // T= 38000K P=1.595e+17
Color(0.3590f, 0.4771f, 1.0000f), // T= 38100K P=1.601e+17
Color(0.3589f, 0.4770f, 1.0000f), // T= 38200K P=1.607e+17
Color(0.3587f, 0.4768f, 1.0000f), // T= 38300K P=1.613e+17
Color(0.3586f, 0.4767f, 1.0000f), // T= 38400K P=1.619e+17
Color(0.3584f, 0.4766f, 1.0000f), // T= 38500K P=1.625e+17
Color(0.3583f, 0.4764f, 1.0000f), // T= 38600K P=1.630e+17
Color(0.3581f, 0.4763f, 1.0000f), // T= 38700K P=1.636e+17
Color(0.3580f, 0.4761f, 1.0000f), // T= 38800K P=1.642e+17
Color(0.3579f, 0.4760f, 1.0000f), // T= 38900K P=1.648e+17
Color(0.3577f, 0.4759f, 1.0000f), // T= 39000K P=1.654e+17
Color(0.3576f, 0.4757f, 1.0000f), // T= 39100K P=1.660e+17
Color(0.3574f, 0.4756f, 1.0000f), // T= 39200K P=1.666e+17
Color(0.3573f, 0.4755f, 1.0000f), // T= 39300K P=1.671e+17
Color(0.3572f, 0.4753f, 1.0000f), // T= 39400K P=1.677e+17
Color(0.3570f, 0.4752f, 1.0000f), // T= 39500K P=1.683e+17
Color(0.3569f, 0.4751f, 1.0000f), // T= 39600K P=1.689e+17
Color(0.3567f, 0.4749f, 1.0000f), // T= 39700K P=1.695e+17
Color(0.3566f, 0.4748f, 1.0000f), // T= 39800K P=1.701e+17
Color(0.3565f, 0.4747f, 1.0000f), // T= 39900K P=1.707e+17
Color(0.3563f, 0.4745f, 1.0000f), // T= 40000K P=1.712e+17
};

View File

@ -238,7 +238,7 @@ uint32 StarDatabase::findCatalogNumberByName(const string& name) const
if (catalogNumber != Star::InvalidCatalogNumber)
return catalogNumber;
}
if (parseCelestiaCatalogNumber(name, &catalogNumber))
{
return catalogNumber;
@ -351,7 +351,7 @@ static void catalogNumberToString(uint32 catalogNumber, char* buf, unsigned int
buf[0] = '\0';
}
if (catalogNumber <= StarDatabase::MAX_HIPPARCOS_NUMBER)
if (catalogNumber <= StarDatabase::MAX_HIPPARCOS_NUMBER)
{
sprintf(buf, "HIP %d", catalogNumber);
}
@ -701,7 +701,7 @@ bool StarDatabase::loadBinary(istream& in)
star.setDetails(details);
star.setCatalogNumber(catNo);
unsortedStars.add(star);
nStars++;
}
@ -710,7 +710,7 @@ bool StarDatabase::loadBinary(istream& in)
DPRINTF(0, "StarDatabase::read: nStars = %d\n", nStarsInFile);
clog << nStars << _(" stars in binary database\n");
// Create the temporary list of stars sorted by catalog number; this
// will be used to lookup stars during file loading. After loading is
// complete, the stars are sorted into an octree and this list gets
@ -721,12 +721,12 @@ bool StarDatabase::loadBinary(istream& in)
binFileCatalogNumberIndex = new Star*[binFileStarCount];
for (unsigned int i = 0; i < binFileStarCount; i++)
{
binFileCatalogNumberIndex[i] = &unsortedStars[i];
binFileCatalogNumberIndex[i] = &unsortedStars[i];
}
sort(binFileCatalogNumberIndex, binFileCatalogNumberIndex + binFileStarCount,
PtrCatalogNumberOrderingPredicate());
}
return true;
}
@ -734,14 +734,14 @@ bool StarDatabase::loadBinary(istream& in)
void StarDatabase::finish()
{
clog << _("Total star count: ") << nStars << endl;
buildOctree();
buildIndexes();
// Delete the temporary indices used only during loading
delete[] binFileCatalogNumberIndex;
stcFileCatalogNumberIndex.clear();
// Resolve all barycenters; this can't be done before star sorting. There's
// still a bug here: final orbital radii aren't available until after
// the barycenters have been resolved, and these are required when building
@ -818,12 +818,12 @@ bool StarDatabase::createStar(Star* star,
}
}
}
bool modifyExistingDetails = false;
if (disposition == ModifyStar)
{
StarDetails* existingDetails = star->getDetails();
// If we're modifying an existing star and it already has a
// customized details record, we'll just modify that.
if (!existingDetails->shared())
@ -842,7 +842,7 @@ bool StarDatabase::createStar(Star* star,
existingDetails->setRotationModel(details->getRotationModel());
existingDetails->setVisibility(details->getVisibility());
}
details = existingDetails;
}
else if (details == NULL)
@ -850,7 +850,7 @@ bool StarDatabase::createStar(Star* star,
details = existingDetails;
}
}
string modelName;
string textureName;
bool hasTexture = starData->getString("Texture", textureName);
@ -866,7 +866,7 @@ bool StarDatabase::createStar(Star* star,
double radius;
bool hasRadius = starData->getLength("Radius", radius);
double temperature = 0.0;
bool hasTemperature = starData->getNumber("Temperature", temperature);
// disallow unphysical temperature values
@ -921,7 +921,7 @@ bool StarDatabase::createStar(Star* star,
details->setRadius((float) radius);
details->addKnowledge(StarDetails::KnowRadius);
}
if (hasTemperature)
{
details->setTemperature((float) temperature);
@ -991,7 +991,7 @@ bool StarDatabase::createStar(Star* star,
{
hasBarycenter = true;
barycenterPosition = barycenter->getPosition();
}
}
}
if (!hasBarycenter)
@ -1022,7 +1022,7 @@ bool StarDatabase::createStar(Star* star,
double ra = 0.0;
double dec = 0.0;
double distance = 0.0;
if (disposition == ModifyStar)
{
Vector3f pos = star->getPosition();
@ -1039,7 +1039,7 @@ bool StarDatabase::createStar(Star* star,
dec = radToDeg(std::asin(v.z()));
}
}
bool modifyPosition = false;
if (starData->getAngle("RA", ra, DEG_PER_HRA, 1.0))
{
@ -1180,7 +1180,7 @@ bool StarDatabase::load(istream& in, const string& resourcePath)
while (tokenizer.nextToken() != Tokenizer::TokenEnd)
{
bool isStar = true;
// Parse the disposition--either Add, Replace, or Modify. The disposition
// may be omitted. The default value is Add.
StcDisposition disposition = AddStar;
@ -1202,7 +1202,7 @@ bool StarDatabase::load(istream& in, const string& resourcePath)
tokenizer.nextToken();
}
}
// Parse the object type--either Star or Barycenter. The object type
// may be omitted. The default is Star.
if (tokenizer.getTokenType() == Tokenizer::TokenName)
@ -1244,7 +1244,7 @@ bool StarDatabase::load(istream& in, const string& resourcePath)
firstName = objName.substr(0, next);
}
}
Star* star = NULL;
switch (disposition)
@ -1270,7 +1270,7 @@ bool StarDatabase::load(istream& in, const string& resourcePath)
catalogNumber = findCatalogNumberByName(firstName);
}
}
if (catalogNumber == Star::InvalidCatalogNumber)
{
catalogNumber = nextAutoCatalogNumber--;
@ -1280,22 +1280,22 @@ bool StarDatabase::load(istream& in, const string& resourcePath)
star = findWhileLoading(catalogNumber);
}
break;
case ModifyStar:
// If no catalog number was specified, try looking up the star by name
if (catalogNumber == Star::InvalidCatalogNumber && !firstName.empty())
{
catalogNumber = findCatalogNumberByName(firstName);
}
if (catalogNumber != Star::InvalidCatalogNumber)
{
star = findWhileLoading(catalogNumber);
}
break;
}
bool isNewStar = star == NULL;
tokenizer.pushBack();
@ -1306,7 +1306,7 @@ bool StarDatabase::load(istream& in, const string& resourcePath)
clog << "Error reading star." << endl;
return false;
}
if (starDataValue->getType() != Value::HashType)
{
DPRINTF(0, "Bad star definition.\n");
@ -1317,7 +1317,7 @@ bool StarDatabase::load(istream& in, const string& resourcePath)
if (isNewStar)
star = new Star();
bool ok = false;
if (isNewStar && disposition == ModifyStar)
{
@ -1336,7 +1336,7 @@ bool StarDatabase::load(istream& in, const string& resourcePath)
unsortedStars.add(*star);
nStars++;
delete star;
// Add the new star to the temporary (load time) index.
stcFileCatalogNumberIndex[catalogNumber] = &unsortedStars[unsortedStars.size() - 1];
}
@ -1394,7 +1394,7 @@ void StarDatabase::buildOctree()
{
root->insertObject(unsortedStars[i], STAR_OCTREE_ROOT_SIZE);
}
DPRINTF(1, "Spatially sorting stars for improved locality of reference . . .\n");
Star* sortedStars = new Star[nStars];
Star* firstStar = sortedStars;
@ -1459,23 +1459,23 @@ Star* StarDatabase::findWhileLoading(uint32 catalogNumber) const
{
Star refStar;
refStar.setCatalogNumber(catalogNumber);
Star** star = lower_bound(binFileCatalogNumberIndex,
binFileCatalogNumberIndex + binFileStarCount,
&refStar,
PtrCatalogNumberOrderingPredicate());
if (star != binFileCatalogNumberIndex + binFileStarCount && (*star)->getCatalogNumber() == catalogNumber)
return *star;
}
// Next check for stars loaded from an stc file
map<uint32, Star*>::const_iterator iter = stcFileCatalogNumberIndex.find(catalogNumber);
if (iter != stcFileCatalogNumberIndex.end())
{
return iter->second;
}
// Star not found
return NULL;
}

View File

@ -42,17 +42,17 @@ public:
m_elementCount(0)
{
}
~BlockArray()
{
clear();
}
unsigned int size() const
{
return m_elementCount;
}
/*! Append an item to the BlockArray. */
void add(T& element)
{
@ -62,13 +62,13 @@ public:
T* newBlock = new T[m_blockSize];
m_blocks.push_back(newBlock);
}
unsigned int elementIndex = m_elementCount % m_blockSize;
m_blocks.back()[elementIndex] = element;
++m_elementCount;
}
void clear()
{
for (typename std::vector<T*>::const_iterator iter = m_blocks.begin(); iter != m_blocks.end(); ++iter)
@ -78,7 +78,7 @@ public:
m_elementCount = 0;
m_blocks.clear();
}
T& operator[](int index)
{
unsigned int blockNumber = index / m_blockSize;
@ -92,7 +92,7 @@ public:
unsigned int elementNumber = index % m_blockSize;
return m_blocks[blockNumber][elementNumber];
}
private:
unsigned int m_blockSize;
unsigned int m_elementCount;
@ -101,7 +101,7 @@ private:
class StarDatabase
{
{
public:
StarDatabase();
~StarDatabase();
@ -133,7 +133,7 @@ class StarDatabase
StarNameDatabase* getNameDatabase() const;
void setNameDatabase(StarNameDatabase*);
bool load(std::istream&, const std::string& resourcePath);
bool loadBinary(std::istream&);
@ -151,10 +151,10 @@ class StarDatabase
ReplaceStar,
ModifyStar,
};
// Not exact, but any star with a catalog number greater than this is assumed to not be
// a HIPPARCOS stars.
static const uint32 MAX_HIPPARCOS_NUMBER = 999999;
// Not exact, but any star with a catalog number greater than this is assumed to not be
// a HIPPARCOS stars.
static const uint32 MAX_HIPPARCOS_NUMBER = 999999;
struct CrossIndexEntry
{
@ -191,7 +191,7 @@ private:
Star* findWhileLoading(uint32 catalogNumber) const;
int nStars;
Star* stars;
StarNameDatabase* namesDB;
Star** catalogNumberIndex;
@ -207,7 +207,7 @@ private:
Star** binFileCatalogNumberIndex;
unsigned int binFileStarCount;
// Catalog number -> star mapping for stars loaded from stc files
std::map<uint32, Star*> stcFileCatalogNumberIndex;
std::map<uint32, Star*> stcFileCatalogNumberIndex;
struct BarycenterUsage
{

View File

@ -104,14 +104,14 @@ StarNameDatabase* StarNameDatabase::readNames(istream& in)
{
uint32 catalogNumber = Star::InvalidCatalogNumber;
in >> catalogNumber;
if (in.eof())
break;
if (in.bad())
in >> catalogNumber;
if (in.eof())
break;
if (in.bad())
{
failed = true;
break;
}
failed = true;
break;
}
// in.get(); // skip a space (or colon);
@ -126,7 +126,7 @@ StarNameDatabase* StarNameDatabase::readNames(istream& in)
// Iterate through the string for names delimited
// by ':', and insert them into the star database. Note that
// db->add() will skip empty names.
string::size_type startPos = 0;
string::size_type startPos = 0;
while (startPos != string::npos)
{
++startPos;

View File

@ -118,7 +118,7 @@ void StarOctree::processVisibleObjects(StarHandler& processor,
{
float distance = (obsPosition - obj.getPosition()).norm();
float appMag = astro::absToAppMag(obj.getAbsoluteMagnitude(), distance);
if (appMag < limitingFactor || (distance < MAX_STAR_ORBIT_RADIUS && obj.getOrbit()))
processor.process(obj, distance, appMag);
}

View File

@ -86,39 +86,39 @@ char* StellarClass::str(char* buf, unsigned int buflen) const
}
else if (st == StellarClass::NormalStar)
{
s0[0] = "OBAFGKMRSNWW?LTC"[(unsigned int) getSpectralClass()];
s0[0] = "OBAFGKMRSNWW?LTC"[(unsigned int) getSpectralClass()];
s0[1] = '\0';
s1[0] = "0123456789"[getSubclass()];
s1[0] = "0123456789"[getSubclass()];
s1[1] = '\0';
switch (getLuminosityClass())
switch (getLuminosityClass())
{
case StellarClass::Lum_Ia0:
s2 = " I-a0";
break;
case StellarClass::Lum_Ia:
s2 = " I-a";
break;
case StellarClass::Lum_Ib:
s2 = " I-b";
break;
case StellarClass::Lum_II:
s2 = " II";
break;
case StellarClass::Lum_III:
s2 = " III";
break;
case StellarClass::Lum_IV:
s2 = " IV";
break;
case StellarClass::Lum_V:
s2 = " V";
break;
case StellarClass::Lum_VI:
s2 = " VI";
break;
case StellarClass::Lum_Ia0:
s2 = " I-a0";
break;
case StellarClass::Lum_Ia:
s2 = " I-a";
break;
case StellarClass::Lum_Ib:
s2 = " I-b";
break;
case StellarClass::Lum_II:
s2 = " II";
break;
case StellarClass::Lum_III:
s2 = " III";
break;
case StellarClass::Lum_IV:
s2 = " IV";
break;
case StellarClass::Lum_V:
s2 = " V";
break;
case StellarClass::Lum_VI:
s2 = " VI";
break;
default: break; // Do nothing, but prevent GCC4 warnings (Beware: potentially dangerous)
}
}
}
else
{
@ -149,9 +149,9 @@ uint16
StellarClass::pack() const
{
return (((uint16) starType << 12) |
(((uint16) specClass & 0xf) << 8) |
((uint16) subclass << 4) |
((uint16) lumClass));
(((uint16) specClass & 0xf) << 8) |
((uint16) subclass << 4) |
((uint16) lumClass));
}

View File

@ -21,26 +21,26 @@ class StellarClass
public:
enum StarType
{
NormalStar = 0,
WhiteDwarf = 1,
NeutronStar = 2,
NormalStar = 0,
WhiteDwarf = 1,
NeutronStar = 2,
BlackHole = 3,
};
enum SpectralClass
{
Spectral_O = 0,
Spectral_B = 1,
Spectral_A = 2,
Spectral_F = 3,
Spectral_G = 4,
Spectral_K = 5,
Spectral_M = 6,
Spectral_R = 7, // superceded by class C
Spectral_S = 8,
Spectral_N = 9, // superceded by class C
Spectral_WC = 10,
Spectral_WN = 11,
Spectral_O = 0,
Spectral_B = 1,
Spectral_A = 2,
Spectral_F = 3,
Spectral_G = 4,
Spectral_K = 5,
Spectral_M = 6,
Spectral_R = 7, // superceded by class C
Spectral_S = 8,
Spectral_N = 9, // superceded by class C
Spectral_WC = 10,
Spectral_WN = 11,
Spectral_Unknown = 12,
Spectral_L = 13,
Spectral_T = 14,
@ -66,14 +66,14 @@ public:
enum LuminosityClass
{
Lum_Ia0 = 0,
Lum_Ia = 1,
Lum_Ib = 2,
Lum_II = 3,
Lum_III = 4,
Lum_IV = 5,
Lum_V = 6,
Lum_VI = 7,
Lum_Ia0 = 0,
Lum_Ia = 1,
Lum_Ib = 2,
Lum_II = 3,
Lum_III = 4,
Lum_IV = 5,
Lum_V = 6,
Lum_VI = 7,
Lum_Unknown = 8,
Lum_Count = 9,
};
@ -85,9 +85,9 @@ public:
inline StellarClass();
inline StellarClass(StarType,
SpectralClass,
unsigned int,
LuminosityClass);
SpectralClass,
unsigned int,
LuminosityClass);
inline StarType getStarType() const;
inline SpectralClass getSpectralClass() const;
@ -122,9 +122,9 @@ std::ostream& operator<<(std::ostream& s, const StellarClass& sc);
bool operator<(const StellarClass& sc0, const StellarClass& sc1);
StellarClass::StellarClass(StarType t,
SpectralClass sc,
unsigned int ssub,
LuminosityClass lum) :
SpectralClass sc,
unsigned int ssub,
LuminosityClass lum) :
starType(t),
specClass(sc),
lumClass(lum),
@ -138,7 +138,7 @@ StellarClass::StellarClass() :
lumClass(Lum_Unknown),
subclass(Subclass_Unknown)
{
}
StellarClass::StarType StellarClass::getStarType() const

View File

@ -460,7 +460,7 @@ ImageTexture::ImageTexture(Image& img,
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, texCaps.preferredAnisotropy);
}
if (mipMapMode == AutoMipMaps)
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);

View File

@ -79,7 +79,7 @@ class Texture
* shader tricks to be used correctly.
*/
unsigned int getFormatOptions() const;
//! Set the format options.
void setFormatOptions(unsigned int opts);

View File

@ -18,7 +18,7 @@
using namespace std;
/*! A Timeline is a list of TimelinePhases that covers a continuous
/*! A Timeline is a list of TimelinePhases that covers a continuous
* interval of time.
*/
@ -57,7 +57,7 @@ Timeline::appendPhase(TimelinePhase* phase)
return true;
}
const TimelinePhase*
Timeline::findPhase(double t) const

View File

@ -78,7 +78,7 @@ Orbit* TrajectoryInfo::load(const string& filename)
}
}
else
{
{
switch (precision)
{
case TrajectoryPrecisionSingle:

View File

@ -111,7 +111,7 @@ class UniversalCoord
/** Get the offset in light years of this coordinate from a point (also with
* units of light years.) The difference is calculated at high precision and
* the reduced to single precision.
* the reduced to single precision.
*
* This method is only here to help in porting older code; it shouldn't be
* necessary to use it in new code, where the use of the rather the rather

View File

@ -496,21 +496,21 @@ Selection Universe::pickPlanet(SolarSystem& solarSystem,
// Retain that body
Body* closestBody = pickInfo.closestBody;
// Check if there is a satellite in front of the primary body that is
// sufficiently close to the pickRay
// Check if there is a satellite in front of the primary body that is
// sufficiently close to the pickRay
traverseFrameTree(solarSystem.getFrameTree(), when, ApproxPlanetPickTraversal, (void*) &pickInfo);
if (pickInfo.closestBody == closestBody)
return Selection(closestBody);
return Selection(closestBody);
// Nothing else around, select the body and return
// Are we close enough to the satellite and is it in front of the body?
if ((pickInfo.sinAngle2Closest <= sinTol2) &&
if ((pickInfo.sinAngle2Closest <= sinTol2) &&
(pickInfo.closestDistance > pickInfo.closestApproxDistance))
return Selection(pickInfo.closestBody);
// Yes, select the satellite
else
return Selection(closestBody);
else
return Selection(closestBody);
// No, select the primary body
}

View File

@ -114,13 +114,13 @@ inline void glLightColor(GLenum light, GLenum which, const Vec4f& color)
inline void glLightColor(GLenum light, GLenum which, const Color& color)
{
Eigen::Vector4f v(color.red(), color.green(), color.blue(), color.alpha());
Eigen::Vector4f v(color.red(), color.green(), color.blue(), color.alpha());
glLightfv(light, which, v.data());
}
inline void glAmbientLightColor(const Color& color)
{
Eigen::Vector4f v(color.red(), color.green(), color.blue(), color.alpha());
Eigen::Vector4f v(color.red(), color.green(), color.blue(), color.alpha());
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, v.data());
}
@ -155,14 +155,14 @@ inline void glTranslate(const Eigen::Vector3d& offset)
inline void glRotate(const Eigen::Quaternionf& q)
{
Eigen::Matrix4f m = Eigen::Matrix4f::Identity();
m.topLeftCorner(3, 3) = q.toRotationMatrix();
m.topLeftCorner(3, 3) = q.toRotationMatrix();
glMultMatrixf(m.data());
}
inline void glRotate(const Eigen::Quaterniond& q)
{
Eigen::Matrix4d m = Eigen::Matrix4d::Identity();
m.topLeftCorner(3, 3) = q.toRotationMatrix();
m.topLeftCorner(3, 3) = q.toRotationMatrix();
glMultMatrixd(m.data());
}

View File

@ -191,7 +191,7 @@ static bool LoadARBVertexProgram(const string& filename, unsigned int& id)
const char* errMsg = (const char*) glGetString(GL_PROGRAM_ERROR_STRING_ARB);
if (errMsg == NULL)
errMsg = "Unknown error";
cout << _("Error in vertex program ") << filename <<
_(", line ") << findLineNumber(*source, errPos) << ": " << errMsg << '\n';
}
@ -390,7 +390,7 @@ void VertexProcessor::parameter(vp::Parameter param, const Color& c)
// VertexProcessorNV implementation
static unsigned int parameterMappings[] =
static unsigned int parameterMappings[] =
{
16, // LightDirection0
15, // EyePosition
@ -441,7 +441,7 @@ void VertexProcessorNV::use(unsigned int prog)
void VertexProcessorNV::parameter(vp::Parameter param,
float x, float y, float z, float w)
{
glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV,
glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV,
parameterMappings[param], x, y, z, w);
}

View File

@ -369,14 +369,14 @@ static VirtualTexture* CreateVirtualTexture(Hash* texParams,
string tilePrefix = "tx_";
texParams->getString("TilePrefix", tilePrefix);
// if absolute directory notation for ImageDirectory used,
// don't prepend the current add-on path.
string directory = imageDirectory + "/";
if (directory.substr(0,1) != "/" && directory.substr(1,1) !=":")
// if absolute directory notation for ImageDirectory used,
// don't prepend the current add-on path.
string directory = imageDirectory + "/";
if (directory.substr(0,1) != "/" && directory.substr(1,1) !=":")
{
directory = path + "/" + directory;
}
directory = path + "/" + directory;
}
return new VirtualTexture(directory,
(unsigned int) baseSplit,
(unsigned int) tileSize,

View File

@ -51,7 +51,7 @@ class VirtualTexture : public Texture
for (int i = 0; i < 4; i++)
children[i] = NULL;
};
Tile* tile;
TileQuadtreeNode* children[4];
};

View File

@ -30,7 +30,7 @@ using namespace Eigen;
* visible. The following are assumed:
* - target is a point
* - the body is an ellipsoid
*
*
* This reference mark is useful in a few situations. When the
* body is a planet or moon and target is the sun, the outline of
* the visible region is the terminator. If target is a satellite,
@ -224,7 +224,7 @@ VisibleRegion::render(Renderer* /* renderer */,
{
double theta = (double) i / (double) (nSections) * 2.0 * PI;
Vector3d w = cos(theta) * uAxis + sin(theta) * vAxis;
Vector3d toCenter = ellipsoidTangent(recipSemiAxes, w, e, e_, ee);
toCenter *= maxSemiAxis * scale;
glVertex3dv(toCenter.data());

View File

@ -43,85 +43,85 @@ static JPLEphemeris* jpleph = NULL;
double gPlanetElements[8][9];
double gElements[8][23] = {
{ /* mercury... */
{ /* mercury... */
178.179078, 415.2057519, 3.011e-4, 0.0,
75.899697, 1.5554889, 2.947e-4, 0.0,
.20561421, 2.046e-5, 3e-8, 0.0,
7.002881, 1.8608e-3, -1.83e-5, 0.0,
47.145944, 1.1852083, 1.739e-4, 0.0,
.3870986, 6.74, -0.42
},
178.179078, 415.2057519, 3.011e-4, 0.0,
75.899697, 1.5554889, 2.947e-4, 0.0,
.20561421, 2.046e-5, 3e-8, 0.0,
7.002881, 1.8608e-3, -1.83e-5, 0.0,
47.145944, 1.1852083, 1.739e-4, 0.0,
.3870986, 6.74, -0.42
},
{ /* venus... */
{ /* venus... */
342.767053, 162.5533664, 3.097e-4, 0.0,
130.163833, 1.4080361, -9.764e-4, 0.0,
6.82069e-3, -4.774e-5, 9.1e-8, 0.0,
3.393631, 1.0058e-3, -1e-6, 0.0,
75.779647, .89985, 4.1e-4, 0.0,
.7233316, 16.92, -4.4
},
342.767053, 162.5533664, 3.097e-4, 0.0,
130.163833, 1.4080361, -9.764e-4, 0.0,
6.82069e-3, -4.774e-5, 9.1e-8, 0.0,
3.393631, 1.0058e-3, -1e-6, 0.0,
75.779647, .89985, 4.1e-4, 0.0,
.7233316, 16.92, -4.4
},
{ /* mars... */
{ /* mars... */
293.737334, 53.17137642, 3.107e-4, 0.0,
3.34218203e2, 1.8407584, 1.299e-4, -1.19e-6,
9.33129e-2, 9.2064e-5, 7.7e-8, 0.0,
1.850333, -6.75e-4, 1.26e-5, 0.0,
48.786442, .7709917, -1.4e-6, -5.33e-6,
1.5236883, 9.36, -1.52
},
293.737334, 53.17137642, 3.107e-4, 0.0,
3.34218203e2, 1.8407584, 1.299e-4, -1.19e-6,
9.33129e-2, 9.2064e-5, 7.7e-8, 0.0,
1.850333, -6.75e-4, 1.26e-5, 0.0,
48.786442, .7709917, -1.4e-6, -5.33e-6,
1.5236883, 9.36, -1.52
},
{ /* jupiter... */
{ /* jupiter... */
238.049257, 8.434172183, 3.347e-4, -1.65e-6,
1.2720972e1, 1.6099617, 1.05627e-3, -3.43e-6,
4.833475e-2, 1.6418e-4, -4.676e-7, -1.7e-9,
1.308736, -5.6961e-3, 3.9e-6, 0.0,
99.443414, 1.01053, 3.5222e-4, -8.51e-6,
5.202561, 196.74, -9.4
},
238.049257, 8.434172183, 3.347e-4, -1.65e-6,
1.2720972e1, 1.6099617, 1.05627e-3, -3.43e-6,
4.833475e-2, 1.6418e-4, -4.676e-7, -1.7e-9,
1.308736, -5.6961e-3, 3.9e-6, 0.0,
99.443414, 1.01053, 3.5222e-4, -8.51e-6,
5.202561, 196.74, -9.4
},
{ /* saturn... */
{ /* saturn... */
266.564377, 3.398638567, 3.245e-4, -5.8e-6,
9.1098214e1, 1.9584158, 8.2636e-4, 4.61e-6,
5.589232e-2, -3.455e-4, -7.28e-7, 7.4e-10,
2.492519, -3.9189e-3, -1.549e-5, 4e-8,
112.790414, .8731951, -1.5218e-4, -5.31e-6,
9.554747, 165.6, -8.88
},
266.564377, 3.398638567, 3.245e-4, -5.8e-6,
9.1098214e1, 1.9584158, 8.2636e-4, 4.61e-6,
5.589232e-2, -3.455e-4, -7.28e-7, 7.4e-10,
2.492519, -3.9189e-3, -1.549e-5, 4e-8,
112.790414, .8731951, -1.5218e-4, -5.31e-6,
9.554747, 165.6, -8.88
},
{ /* uranus... */
{ /* uranus... */
244.19747, 1.194065406, 3.16e-4, -6e-7,
1.71548692e2, 1.4844328, 2.372e-4, -6.1e-7,
4.63444e-2, -2.658e-5, 7.7e-8, 0.0,
.772464, 6.253e-4, 3.95e-5, 0.0,
73.477111, .4986678, 1.3117e-3, 0.0,
19.21814, 65.8, -7.19
},
244.19747, 1.194065406, 3.16e-4, -6e-7,
1.71548692e2, 1.4844328, 2.372e-4, -6.1e-7,
4.63444e-2, -2.658e-5, 7.7e-8, 0.0,
.772464, 6.253e-4, 3.95e-5, 0.0,
73.477111, .4986678, 1.3117e-3, 0.0,
19.21814, 65.8, -7.19
},
{ /* neptune... */
{ /* neptune... */
84.457994, .6107942056, 3.205e-4, -6e-7,
4.6727364e1, 1.4245744, 3.9082e-4, -6.05e-7,
8.99704e-3, 6.33e-6, -2e-9, 0.0,
1.779242, -9.5436e-3, -9.1e-6, 0.0,
130.681389, 1.098935, 2.4987e-4, -4.718e-6,
30.10957, 62.2, -6.87
},
84.457994, .6107942056, 3.205e-4, -6e-7,
4.6727364e1, 1.4245744, 3.9082e-4, -6.05e-7,
8.99704e-3, 6.33e-6, -2e-9, 0.0,
1.779242, -9.5436e-3, -9.1e-6, 0.0,
130.681389, 1.098935, 2.4987e-4, -4.718e-6,
30.10957, 62.2, -6.87
},
{ /* pluto...(osculating 1984 jan 21) */
{ /* pluto...(osculating 1984 jan 21) */
95.3113544, .3980332167, 0.0, 0.0,
224.017, 0.0, 0.0, 0.0,
.25515, 0.0, 0.0, 0.0,
17.1329, 0.0, 0.0, 0.0,
110.191, 0.0, 0.0, 0.0,
39.8151, 8.2, -1.0
}
95.3113544, .3980332167, 0.0, 0.0,
224.017, 0.0, 0.0, 0.0,
.25515, 0.0, 0.0, 0.0,
17.1329, 0.0, 0.0, 0.0,
110.191, 0.0, 0.0, 0.0,
39.8151, 8.2, -1.0
}
};
@ -151,11 +151,11 @@ static void Nutation(double t, double &deps, double& dpsi)
// Parameter t represents the Julian centuries elapsed since 1900.
// In other words, t = (jd - 2415020.0) / 36525.0
double ls, ld; // sun's mean longitude, moon's mean longitude
double ms, md; // sun's mean anomaly, moon's mean anomaly
double nm; // longitude of moon's ascending node
double ls, ld; // sun's mean longitude, moon's mean longitude
double ms, md; // sun's mean anomaly, moon's mean anomaly
double nm; // longitude of moon's ascending node
double t2;
double tls, tnm, tld; // twice above
double tls, tnm, tld; // twice above
double a, b;
t2 = t*t;
@ -210,30 +210,30 @@ static void EclipticToEquatorial(double t, double fEclLat, double fEclLon,
// Parameter t represents the Julian centuries elapsed since 1900.
// In other words, t = (jd - 2415020.0) / 36525.0
double seps, ceps; // sin and cos of mean obliquity
double seps, ceps; // sin and cos of mean obliquity
double sx, cx, sy, cy, ty;
double eps;
double deps, dpsi;
t = (astro::J2000 - 2415020.0) / 36525.0;
t = 0;
eps = Obliquity(t); // mean obliquity for date
eps = Obliquity(t); // mean obliquity for date
Nutation(t, deps, dpsi);
eps += deps;
seps = sin(eps);
ceps = cos(eps);
sy = sin(fEclLat);
cy = cos(fEclLat); // always non-negative
cy = cos(fEclLat); // always non-negative
if (fabs(cy)<1e-20)
cy = 1e-20; // insure > 0
cy = 1e-20; // insure > 0
ty = sy/cy;
cx = cos(fEclLon);
sx = sin(fEclLon);
dec = asin((sy*ceps)+(cy*seps*sx));
RA = atan(((sx*ceps)-(ty*seps))/cx);
if (cx<0)
RA += PI; // account for atan quad ambiguity
RA += PI; // account for atan quad ambiguity
RA = pfmod(RA, TWOPI);
}
@ -272,9 +272,9 @@ double meanAnomalySun(double t)
{
double t2, a, b;
t2 = t*t;
a = 9.999736042e1*t;
b = 360*(a - (int)a);
t2 = t*t;
a = 9.999736042e1*t;
b = 360*(a - (int)a);
return degToRad(3.5847583e2 - (1.5e-4 + 3.3e-6*t)*t2 + b);
}
@ -463,7 +463,7 @@ class VenusOrbit : public CachingOrbit
dl = dr = dml = ds = dm = da = dhl = 0.0;
//Calculate the Julian centuries elapsed since 1900
t = (jd - 2415020.0)/36525.0;
t = (jd - 2415020.0)/36525.0;
mas = meanAnomalySun(t);
@ -482,19 +482,19 @@ class VenusOrbit : public CachingOrbit
dml = degToRad(7.7e-4*sin(4.1406+t*2.6227));
dm = dml;
dl = 3.13e-3*cos(2*mas-2*map[1]-2.587)+
1.98e-3*cos(3*mas-3*map[1]+4.4768e-2)+
1.36e-3*cos(mas-map[1]-2.0788)+
9.6e-4*cos(3*mas-2*map[1]-2.3721)+
8.2e-4*cos(map[3]-map[1]-3.6318);
dl = 3.13e-3*cos(2*mas-2*map[1]-2.587)+
1.98e-3*cos(3*mas-3*map[1]+4.4768e-2)+
1.36e-3*cos(mas-map[1]-2.0788)+
9.6e-4*cos(3*mas-2*map[1]-2.3721)+
8.2e-4*cos(map[3]-map[1]-3.6318);
dr = 2.2501e-5*cos(2*mas-2*map[1]-1.01592)+
1.9045e-5*cos(3*mas-3*map[1]+1.61577)+
6.887e-6*cos(map[3]-map[1]-2.06106)+
5.172e-6*cos(mas-map[1]-5.08065e-1)+
3.62e-6*cos(5*mas-4*map[1]-1.81877)+
3.283e-6*cos(4*mas-4*map[1]+1.10851)+
3.074e-6*cos(2*map[3]-2*map[1]-9.62846e-1);
dr = 2.2501e-5*cos(2*mas-2*map[1]-1.01592)+
1.9045e-5*cos(3*mas-3*map[1]+1.61577)+
6.887e-6*cos(map[3]-map[1]-2.06106)+
5.172e-6*cos(mas-map[1]-5.08065e-1)+
3.62e-6*cos(5*mas-4*map[1]-1.81877)+
3.283e-6*cos(4*mas-4*map[1]+1.10851)+
3.074e-6*cos(2*map[3]-2*map[1]-9.62846e-1);
computePlanetCoords(p, map[p], da, dhl, dl, dm, dml, dr, ds,
eclLong, eclLat, distance);
@ -526,41 +526,41 @@ class EarthOrbit : public CachingOrbit
Vector3d computePosition(double jd) const
{
double t, t2;
double ls, ms; // mean longitude and mean anomaly
double s, nu, ea; // eccentricity, true anomaly, eccentric anomaly
double a, b, a1, b1, c1, d1, e1, h1, dl, dr;
double t, t2;
double ls, ms; // mean longitude and mean anomaly
double s, nu, ea; // eccentricity, true anomaly, eccentric anomaly
double a, b, a1, b1, c1, d1, e1, h1, dl, dr;
double eclLong, distance;
// Calculate the Julian centuries elapsed since 1900
t = (jd - 2415020.0)/36525.0;
t = (jd - 2415020.0)/36525.0;
t2 = t*t;
a = 100.0021359*t;
b = 360.*(a-(int)a);
ls = 279.69668+.0003025*t2+b;
t2 = t*t;
a = 100.0021359*t;
b = 360.*(a-(int)a);
ls = 279.69668+.0003025*t2+b;
ms = meanAnomalySun(t);
s = .016751-.0000418*t-1.26e-07*t2;
s = .016751-.0000418*t-1.26e-07*t2;
astro::anomaly(degToRad(ms), s, nu, ea);
a = 62.55209472000015*t;
b = 360*(a-(int)a);
a1 = degToRad(153.23+b);
a = 125.1041894*t;
b = 360*(a-(int)a);
b1 = degToRad(216.57+b);
a = 91.56766028*t;
b = 360*(a-(int)a);
c1 = degToRad(312.69+b);
a = 1236.853095*t;
b = 360*(a-(int)a);
d1 = degToRad(350.74-.00144*t2+b);
e1 = degToRad(231.19+20.2*t);
a = 183.1353208*t;
b = 360*(a-(int)a);
h1 = degToRad(353.4+b);
dl = .00134*cos(a1)+.00154*cos(b1)+.002*cos(c1)+.00179*sin(d1)+
a = 62.55209472000015*t;
b = 360*(a-(int)a);
a1 = degToRad(153.23+b);
a = 125.1041894*t;
b = 360*(a-(int)a);
b1 = degToRad(216.57+b);
a = 91.56766028*t;
b = 360*(a-(int)a);
c1 = degToRad(312.69+b);
a = 1236.853095*t;
b = 360*(a-(int)a);
d1 = degToRad(350.74-.00144*t2+b);
e1 = degToRad(231.19+20.2*t);
a = 183.1353208*t;
b = 360*(a-(int)a);
h1 = degToRad(353.4+b);
dl = .00134*cos(a1)+.00154*cos(b1)+.002*cos(c1)+.00179*sin(d1)+
.00178*sin(e1);
dr = 5.43e-06*sin(a1)+1.575e-05*sin(b1)+1.627e-05*sin(c1)+
dr = 5.43e-06*sin(a1)+1.575e-05*sin(b1)+1.627e-05*sin(c1)+
3.076e-05*cos(d1)+9.27e-06*sin(h1);
eclLong = nu+degToRad(ls-ms+dl) + PI;
@ -594,124 +594,124 @@ class LunarOrbit : public CachingOrbit
Vector3d computePosition(double jd) const
{
double jd19, t, t2;
double ld, ms, md, de, f, n, hp;
double a, sa, sn, b, sb, c, sc, e, e2, l, g, w1, w2;
double m1, m2, m3, m4, m5, m6;
double jd19, t, t2;
double ld, ms, md, de, f, n, hp;
double a, sa, sn, b, sb, c, sc, e, e2, l, g, w1, w2;
double m1, m2, m3, m4, m5, m6;
double eclLon, eclLat, horzPar, distance;
double RA, dec;
// Computation requires an abbreviated Julian day:
// epoch January 0.5, 1900.
jd19 = jd - 2415020.0;
t = jd19/36525;
t2 = t*t;
t = jd19/36525;
t2 = t*t;
m1 = jd19/27.32158213;
m1 = 360.0*(m1-(int)m1);
m2 = jd19/365.2596407;
m2 = 360.0*(m2-(int)m2);
m3 = jd19/27.55455094;
m3 = 360.0*(m3-(int)m3);
m4 = jd19/29.53058868;
m4 = 360.0*(m4-(int)m4);
m5 = jd19/27.21222039;
m5 = 360.0*(m5-(int)m5);
m6 = jd19/6798.363307;
m6 = 360.0*(m6-(int)m6);
m1 = jd19/27.32158213;
m1 = 360.0*(m1-(int)m1);
m2 = jd19/365.2596407;
m2 = 360.0*(m2-(int)m2);
m3 = jd19/27.55455094;
m3 = 360.0*(m3-(int)m3);
m4 = jd19/29.53058868;
m4 = 360.0*(m4-(int)m4);
m5 = jd19/27.21222039;
m5 = 360.0*(m5-(int)m5);
m6 = jd19/6798.363307;
m6 = 360.0*(m6-(int)m6);
ld = 270.434164+m1-(.001133-.0000019*t)*t2;
ms = 358.475833+m2-(.00015+.0000033*t)*t2;
md = 296.104608+m3+(.009192+.0000144*t)*t2;
de = 350.737486+m4-(.001436-.0000019*t)*t2;
f = 11.250889+m5-(.003211+.0000003*t)*t2;
n = 259.183275-m6+(.002078+.000022*t)*t2;
ld = 270.434164+m1-(.001133-.0000019*t)*t2;
ms = 358.475833+m2-(.00015+.0000033*t)*t2;
md = 296.104608+m3+(.009192+.0000144*t)*t2;
de = 350.737486+m4-(.001436-.0000019*t)*t2;
f = 11.250889+m5-(.003211+.0000003*t)*t2;
n = 259.183275-m6+(.002078+.000022*t)*t2;
a = degToRad(51.2+20.2*t);
sa = sin(a);
sn = sin(degToRad(n));
b = 346.56+(132.87-.0091731*t)*t;
sb = .003964*sin(degToRad(b));
c = degToRad(n+275.05-2.3*t);
sc = sin(c);
ld = ld+.000233*sa+sb+.001964*sn;
ms = ms-.001778*sa;
md = md+.000817*sa+sb+.002541*sn;
f = f+sb-.024691*sn-.004328*sc;
de = de+.002011*sa+sb+.001964*sn;
e = 1-(.002495+7.52e-06*t)*t;
e2 = e*e;
a = degToRad(51.2+20.2*t);
sa = sin(a);
sn = sin(degToRad(n));
b = 346.56+(132.87-.0091731*t)*t;
sb = .003964*sin(degToRad(b));
c = degToRad(n+275.05-2.3*t);
sc = sin(c);
ld = ld+.000233*sa+sb+.001964*sn;
ms = ms-.001778*sa;
md = md+.000817*sa+sb+.002541*sn;
f = f+sb-.024691*sn-.004328*sc;
de = de+.002011*sa+sb+.001964*sn;
e = 1-(.002495+7.52e-06*t)*t;
e2 = e*e;
ld = degToRad(ld);
ms = degToRad(ms);
n = degToRad(n);
de = degToRad(de);
f = degToRad(f);
md = degToRad(md);
ld = degToRad(ld);
ms = degToRad(ms);
n = degToRad(n);
de = degToRad(de);
f = degToRad(f);
md = degToRad(md);
l = 6.28875*sin(md)+1.27402*sin(2*de-md)+.658309*sin(2*de)+
.213616*sin(2*md)-e*.185596*sin(ms)-.114336*sin(2*f)+
.058793*sin(2*(de-md))+.057212*e*sin(2*de-ms-md)+
.05332*sin(2*de+md)+.045874*e*sin(2*de-ms)+.041024*e*sin(md-ms);
l = l-.034718*sin(de)-e*.030465*sin(ms+md)+.015326*sin(2*(de-f))-
.012528*sin(2*f+md)-.01098*sin(2*f-md)+.010674*sin(4*de-md)+
.010034*sin(3*md)+.008548*sin(4*de-2*md)-e*.00791*sin(ms-md+2*de)-
e*.006783*sin(2*de+ms);
l = l+.005162*sin(md-de)+e*.005*sin(ms+de)+.003862*sin(4*de)+
e*.004049*sin(md-ms+2*de)+.003996*sin(2*(md+de))+
.003665*sin(2*de-3*md)+e*.002695*sin(2*md-ms)+
.002602*sin(md-2*(f+de))+e*.002396*sin(2*(de-md)-ms)-
.002349*sin(md+de);
l = l+e2*.002249*sin(2*(de-ms))-e*.002125*sin(2*md+ms)-
e2*.002079*sin(2*ms)+e2*.002059*sin(2*(de-ms)-md)-
.001773*sin(md+2*(de-f))-.001595*sin(2*(f+de))+
e*.00122*sin(4*de-ms-md)-.00111*sin(2*(md+f))+.000892*sin(md-3*de);
l = l-e*.000811*sin(ms+md+2*de)+e*.000761*sin(4*de-ms-2*md)+
l = 6.28875*sin(md)+1.27402*sin(2*de-md)+.658309*sin(2*de)+
.213616*sin(2*md)-e*.185596*sin(ms)-.114336*sin(2*f)+
.058793*sin(2*(de-md))+.057212*e*sin(2*de-ms-md)+
.05332*sin(2*de+md)+.045874*e*sin(2*de-ms)+.041024*e*sin(md-ms);
l = l-.034718*sin(de)-e*.030465*sin(ms+md)+.015326*sin(2*(de-f))-
.012528*sin(2*f+md)-.01098*sin(2*f-md)+.010674*sin(4*de-md)+
.010034*sin(3*md)+.008548*sin(4*de-2*md)-e*.00791*sin(ms-md+2*de)-
e*.006783*sin(2*de+ms);
l = l+.005162*sin(md-de)+e*.005*sin(ms+de)+.003862*sin(4*de)+
e*.004049*sin(md-ms+2*de)+.003996*sin(2*(md+de))+
.003665*sin(2*de-3*md)+e*.002695*sin(2*md-ms)+
.002602*sin(md-2*(f+de))+e*.002396*sin(2*(de-md)-ms)-
.002349*sin(md+de);
l = l+e2*.002249*sin(2*(de-ms))-e*.002125*sin(2*md+ms)-
e2*.002079*sin(2*ms)+e2*.002059*sin(2*(de-ms)-md)-
.001773*sin(md+2*(de-f))-.001595*sin(2*(f+de))+
e*.00122*sin(4*de-ms-md)-.00111*sin(2*(md+f))+.000892*sin(md-3*de);
l = l-e*.000811*sin(ms+md+2*de)+e*.000761*sin(4*de-ms-2*md)+
e2*.000704*sin(md-2*(ms+de))+e*.000693*sin(ms-2*(md-de))+
e*.000598*sin(2*(de-f)-ms)+.00055*sin(md+4*de)+.000538*sin(4*md)+
e*.000521*sin(4*de-ms)+.000486*sin(2*md-de);
l = l+e2*.000717*sin(md-2*ms);
eclLon = ld+degToRad(l);
eclLon = pfmod(eclLon, TWOPI);
l = l+e2*.000717*sin(md-2*ms);
eclLon = ld+degToRad(l);
eclLon = pfmod(eclLon, TWOPI);
g = 5.12819*sin(f)+.280606*sin(md+f)+.277693*sin(md-f)+
.173238*sin(2*de-f)+.055413*sin(2*de+f-md)+.046272*sin(2*de-f-md)+
.032573*sin(2*de+f)+.017198*sin(2*md+f)+.009267*sin(2*de+md-f)+
.008823*sin(2*md-f)+e*.008247*sin(2*de-ms-f);
g = g+.004323*sin(2*(de-md)-f)+.0042*sin(2*de+f+md)+
e*.003372*sin(f-ms-2*de)+e*.002472*sin(2*de+f-ms-md)+
e*.002222*sin(2*de+f-ms)+e*.002072*sin(2*de-f-ms-md)+
e*.001877*sin(f-ms+md)+.001828*sin(4*de-f-md)-e*.001803*sin(f+ms)-
.00175*sin(3*f);
g = g+e*.00157*sin(md-ms-f)-.001487*sin(f+de)-e*.001481*sin(f+ms+md)+
g = 5.12819*sin(f)+.280606*sin(md+f)+.277693*sin(md-f)+
.173238*sin(2*de-f)+.055413*sin(2*de+f-md)+.046272*sin(2*de-f-md)+
.032573*sin(2*de+f)+.017198*sin(2*md+f)+.009267*sin(2*de+md-f)+
.008823*sin(2*md-f)+e*.008247*sin(2*de-ms-f);
g = g+.004323*sin(2*(de-md)-f)+.0042*sin(2*de+f+md)+
e*.003372*sin(f-ms-2*de)+e*.002472*sin(2*de+f-ms-md)+
e*.002222*sin(2*de+f-ms)+e*.002072*sin(2*de-f-ms-md)+
e*.001877*sin(f-ms+md)+.001828*sin(4*de-f-md)-e*.001803*sin(f+ms)-
.00175*sin(3*f);
g = g+e*.00157*sin(md-ms-f)-.001487*sin(f+de)-e*.001481*sin(f+ms+md)+
e*.001417*sin(f-ms-md)+e*.00135*sin(f-ms)+.00133*sin(f-de)+
.001106*sin(f+3*md)+.00102*sin(4*de-f)+.000833*sin(f+4*de-md)+
.000781*sin(md-3*f)+.00067*sin(f+4*de-2*md);
g = g+.000606*sin(2*de-3*f)+.000597*sin(2*(de+md)-f)+
e*.000492*sin(2*de+md-ms-f)+.00045*sin(2*(md-de)-f)+
.000439*sin(3*md-f)+.000423*sin(f+2*(de+md))+
.000422*sin(2*de-f-3*md)-e*.000367*sin(ms+f+2*de-md)-
e*.000353*sin(ms+f+2*de)+.000331*sin(f+4*de);
g = g+e*.000317*sin(2*de+f-ms+md)+e2*.000306*sin(2*(de-ms)-f)-
.000283*sin(md+3*f);
w1 = .0004664*cos(n);
w2 = .0000754*cos(c);
eclLat = degToRad(g)*(1-w1-w2);
g = g+.000606*sin(2*de-3*f)+.000597*sin(2*(de+md)-f)+
e*.000492*sin(2*de+md-ms-f)+.00045*sin(2*(md-de)-f)+
.000439*sin(3*md-f)+.000423*sin(f+2*(de+md))+
.000422*sin(2*de-f-3*md)-e*.000367*sin(ms+f+2*de-md)-
e*.000353*sin(ms+f+2*de)+.000331*sin(f+4*de);
g = g+e*.000317*sin(2*de+f-ms+md)+e2*.000306*sin(2*(de-ms)-f)-
.000283*sin(md+3*f);
w1 = .0004664*cos(n);
w2 = .0000754*cos(c);
eclLat = degToRad(g)*(1-w1-w2);
hp = .950724+.051818*cos(md)+.009531*cos(2*de-md)+.007843*cos(2*de)+
.002824*cos(2*md)+.000857*cos(2*de+md)+e*.000533*cos(2*de-ms)+
e*.000401*cos(2*de-md-ms)+e*.00032*cos(md-ms)-.000271*cos(de)-
e*.000264*cos(ms+md)-.000198*cos(2*f-md);
hp = hp+.000173*cos(3*md)+.000167*cos(4*de-md)-e*.000111*cos(ms)+
.000103*cos(4*de-2*md)-.000084*cos(2*md-2*de)-
e*.000083*cos(2*de+ms)+.000079*cos(2*de+2*md)+.000072*cos(4*de)+
e*.000064*cos(2*de-ms+md)-e*.000063*cos(2*de+ms-md)+
e*.000041*cos(ms+de);
hp = hp+e*.000035*cos(2*md-ms)-.000033*cos(3*md-2*de)-
.00003*cos(md+de)-.000029*cos(2*(f-de))-e*.000029*cos(2*md+ms)+
e2*.000026*cos(2*(de-ms))-.000023*cos(2*(f-de)+md)+
e*.000019*cos(4*de-ms-md);
horzPar = degToRad(hp);
hp = .950724+.051818*cos(md)+.009531*cos(2*de-md)+.007843*cos(2*de)+
.002824*cos(2*md)+.000857*cos(2*de+md)+e*.000533*cos(2*de-ms)+
e*.000401*cos(2*de-md-ms)+e*.00032*cos(md-ms)-.000271*cos(de)-
e*.000264*cos(ms+md)-.000198*cos(2*f-md);
hp = hp+.000173*cos(3*md)+.000167*cos(4*de-md)-e*.000111*cos(ms)+
.000103*cos(4*de-2*md)-.000084*cos(2*md-2*de)-
e*.000083*cos(2*de+ms)+.000079*cos(2*de+2*md)+.000072*cos(4*de)+
e*.000064*cos(2*de-ms+md)-e*.000063*cos(2*de+ms-md)+
e*.000041*cos(ms+de);
hp = hp+e*.000035*cos(2*md-ms)-.000033*cos(3*md-2*de)-
.00003*cos(md+de)-.000029*cos(2*(f-de))-e*.000029*cos(2*md+ms)+
e2*.000026*cos(2*(de-ms))-.000023*cos(2*(f-de)+md)+
e*.000019*cos(4*de-ms-md);
horzPar = degToRad(hp);
// At this point we have values of ecliptic longitude, latitude and
// horizontal parallax (eclLong, eclLat, horzPar) in radians.
@ -775,7 +775,7 @@ class MarsOrbit : public CachingOrbit
dl = dr = dml = ds = dm = da = dhl = 0.0;
//Calculate the Julian centuries elapsed since 1900
t = (jd - 2415020.0)/36525.0;
t = (jd - 2415020.0)/36525.0;
mas = meanAnomalySun(t);
@ -796,28 +796,28 @@ class MarsOrbit : public CachingOrbit
dml = degToRad(-1*(1.133e-2*sin(a)+9.33e-3*cos(a)));
dm = dml;
dl = 7.05e-3*cos(map[3]-map[2]-8.5448e-1)+
6.07e-3*cos(2*map[3]-map[2]-3.2873)+
4.45e-3*cos(2*map[3]-2*map[2]-3.3492)+
3.88e-3*cos(mas-2*map[2]+3.5771e-1)+
2.38e-3*cos(mas-map[2]+6.1256e-1)+
2.04e-3*cos(2*mas-3*map[2]+2.7688)+
1.77e-3*cos(3*map[2]-map[2-1]-1.0053)+
1.36e-3*cos(2*mas-4*map[2]+2.6894)+
1.04e-3*cos(map[3]+3.0749e-1);
6.07e-3*cos(2*map[3]-map[2]-3.2873)+
4.45e-3*cos(2*map[3]-2*map[2]-3.3492)+
3.88e-3*cos(mas-2*map[2]+3.5771e-1)+
2.38e-3*cos(mas-map[2]+6.1256e-1)+
2.04e-3*cos(2*mas-3*map[2]+2.7688)+
1.77e-3*cos(3*map[2]-map[2-1]-1.0053)+
1.36e-3*cos(2*mas-4*map[2]+2.6894)+
1.04e-3*cos(map[3]+3.0749e-1);
dr = 5.3227e-5*cos(map[3]-map[2]+7.17864e-1)+
5.0989e-5*cos(2*map[3]-2*map[2]-1.77997)+
3.8278e-5*cos(2*map[3]-map[2]-1.71617)+
1.5996e-5*cos(mas-map[2]-9.69618e-1)+
1.4764e-5*cos(2*mas-3*map[2]+1.19768)+
8.966e-6*cos(map[3]-2*map[2]+7.61225e-1);
5.0989e-5*cos(2*map[3]-2*map[2]-1.77997)+
3.8278e-5*cos(2*map[3]-map[2]-1.71617)+
1.5996e-5*cos(mas-map[2]-9.69618e-1)+
1.4764e-5*cos(2*mas-3*map[2]+1.19768)+
8.966e-6*cos(map[3]-2*map[2]+7.61225e-1);
dr += 7.914e-6*cos(3*map[3]-2*map[2]-2.43887)+
7.004e-6*cos(2*map[3]-3*map[2]-1.79573)+
6.62e-6*cos(mas-2*map[2]+1.97575)+
4.93e-6*cos(3*map[3]-3*map[2]-1.33069)+
4.693e-6*cos(3*mas-5*map[2]+3.32665)+
4.571e-6*cos(2*mas-4*map[2]+4.27086)+
4.409e-6*cos(3*map[3]-map[2]-2.02158);
7.004e-6*cos(2*map[3]-3*map[2]-1.79573)+
6.62e-6*cos(mas-2*map[2]+1.97575)+
4.93e-6*cos(3*map[3]-3*map[2]-1.33069)+
4.693e-6*cos(3*mas-5*map[2]+3.32665)+
4.571e-6*cos(2*mas-4*map[2]+4.27086)+
4.409e-6*cos(3*map[3]-map[2]-2.02158);
computePlanetCoords(p, map[p], da, dhl, dl, dm, dml, dr, ds,
eclLong, eclLat, distance);
@ -864,7 +864,7 @@ class JupiterOrbit : public CachingOrbit
dl = dr = dml = ds = dm = da = dhl = 0.0;
//Calculate the Julian centuries elapsed since 1900
t = (jd - 2415020.0)/36525.0;
t = (jd - 2415020.0)/36525.0;
computePlanetElements(t, pList);
@ -892,42 +892,42 @@ class JupiterOrbit : public CachingOrbit
c4x7 = cos(4*x7);
c5x7 = cos(5*x7);
dml = (3.31364e-1-(1.0281e-2+4.692e-3*x1)*x1)*sx5+
(3.228e-3-(6.4436e-2-2.075e-3*x1)*x1)*cx5-
(3.083e-3+(2.75e-4-4.89e-4*x1)*x1)*s2x5+
2.472e-3*sx6+1.3619e-2*sx7+1.8472e-2*s2x7+6.717e-3*s3x7+
2.775e-3*s4x7+6.417e-3*s2x7*sx3+
(7.275e-3-1.253e-3*x1)*sx7*sx3+
2.439e-3*s3x7*sx3-(3.5681e-2+1.208e-3*x1)*sx7*cx3;
(3.228e-3-(6.4436e-2-2.075e-3*x1)*x1)*cx5-
(3.083e-3+(2.75e-4-4.89e-4*x1)*x1)*s2x5+
2.472e-3*sx6+1.3619e-2*sx7+1.8472e-2*s2x7+6.717e-3*s3x7+
2.775e-3*s4x7+6.417e-3*s2x7*sx3+
(7.275e-3-1.253e-3*x1)*sx7*sx3+
2.439e-3*s3x7*sx3-(3.5681e-2+1.208e-3*x1)*sx7*cx3;
dml += -3.767e-3*c2x7*sx3-(3.3839e-2+1.125e-3*x1)*cx7*sx3-
4.261e-3*s2x7*cx3+
(1.161e-3*x1-6.333e-3)*cx7*cx3+
2.178e-3*cx3-6.675e-3*c2x7*cx3-2.664e-3*c3x7*cx3-
2.572e-3*sx7*s2x3-3.567e-3*s2x7*s2x3+2.094e-3*cx7*c2x3+
3.342e-3*c2x7*c2x3;
4.261e-3*s2x7*cx3+
(1.161e-3*x1-6.333e-3)*cx7*cx3+
2.178e-3*cx3-6.675e-3*c2x7*cx3-2.664e-3*c3x7*cx3-
2.572e-3*sx7*s2x3-3.567e-3*s2x7*s2x3+2.094e-3*cx7*c2x3+
3.342e-3*c2x7*c2x3;
dml = degToRad(dml);
ds = (3606+(130-43*x1)*x1)*sx5+(1289-580*x1)*cx5-6764*sx7*sx3-
1110*s2x7*sx3-224*s3x7*sx3-204*sx3+(1284+116*x1)*cx7*sx3+
188*c2x7*sx3+(1460+130*x1)*sx7*cx3+224*s2x7*cx3-817*cx3+
6074*cx3*cx7+992*c2x7*cx3+
508*c3x7*cx3+230*c4x7*cx3+108*c5x7*cx3;
1110*s2x7*sx3-224*s3x7*sx3-204*sx3+(1284+116*x1)*cx7*sx3+
188*c2x7*sx3+(1460+130*x1)*sx7*cx3+224*s2x7*cx3-817*cx3+
6074*cx3*cx7+992*c2x7*cx3+
508*c3x7*cx3+230*c4x7*cx3+108*c5x7*cx3;
ds += -(956+73*x1)*sx7*s2x3+448*s2x7*s2x3+137*s3x7*s2x3+
(108*x1-997)*cx7*s2x3+480*c2x7*s2x3+148*c3x7*s2x3+
(99*x1-956)*sx7*c2x3+490*s2x7*c2x3+
158*s3x7*c2x3+179*c2x3+(1024+75*x1)*cx7*c2x3-
437*c2x7*c2x3-132*c3x7*c2x3;
(108*x1-997)*cx7*s2x3+480*c2x7*s2x3+148*c3x7*s2x3+
(99*x1-956)*sx7*c2x3+490*s2x7*c2x3+
158*s3x7*c2x3+179*c2x3+(1024+75*x1)*cx7*c2x3-
437*c2x7*c2x3-132*c3x7*c2x3;
ds *= 1e-7;
dp = (7.192e-3-3.147e-3*x1)*sx5-4.344e-3*sx3+
(x1*(1.97e-4*x1-6.75e-4)-2.0428e-2)*cx5+
3.4036e-2*cx7*sx3+(7.269e-3+6.72e-4*x1)*sx7*sx3+
5.614e-3*c2x7*sx3+2.964e-3*c3x7*sx3+3.7761e-2*sx7*cx3+
6.158e-3*s2x7*cx3-
6.603e-3*cx7*cx3-5.356e-3*sx7*s2x3+2.722e-3*s2x7*s2x3+
4.483e-3*cx7*s2x3-2.642e-3*c2x7*s2x3+4.403e-3*sx7*c2x3-
2.536e-3*s2x7*c2x3+5.547e-3*cx7*c2x3-2.689e-3*c2x7*c2x3;
(x1*(1.97e-4*x1-6.75e-4)-2.0428e-2)*cx5+
3.4036e-2*cx7*sx3+(7.269e-3+6.72e-4*x1)*sx7*sx3+
5.614e-3*c2x7*sx3+2.964e-3*c3x7*sx3+3.7761e-2*sx7*cx3+
6.158e-3*s2x7*cx3-
6.603e-3*cx7*cx3-5.356e-3*sx7*s2x3+2.722e-3*s2x7*s2x3+
4.483e-3*cx7*s2x3-2.642e-3*c2x7*s2x3+4.403e-3*sx7*c2x3-
2.536e-3*s2x7*c2x3+5.547e-3*cx7*c2x3-2.689e-3*c2x7*c2x3;
dm = dml-(degToRad(dp)/s);
da = 205*cx7-263*cx5+693*c2x7+312*c3x7+147*c4x7+299*sx7*sx3+
181*c2x7*sx3+204*s2x7*cx3+111*s3x7*cx3-337*cx7*cx3-
111*c2x7*cx3;
181*c2x7*sx3+204*s2x7*cx3+111*s3x7*cx3-337*cx7*cx3-
111*c2x7*cx3;
da *= 1e-6;
computePlanetCoords(p, map, da, dhl, dl, dm, dml, dr, ds,
@ -976,7 +976,7 @@ class SaturnOrbit : public CachingOrbit
dl = dr = dml = ds = dm = da = dhl = 0.0;
//Calculate the Julian centuries elapsed since 1900
t = (jd - 2415020.0)/36525.0;
t = (jd - 2415020.0)/36525.0;
computePlanetElements(t, pList);
@ -1015,57 +1015,57 @@ class SaturnOrbit : public CachingOrbit
s3x8 = sin(3*x8);
c3x8 = cos(3*x8);
dml = 7.581e-3*s2x5-7.986e-3*sx6-1.48811e-1*sx7-4.0786e-2*s2x7-
(8.14181e-1-(1.815e-2-1.6714e-2*x1)*x1)*sx5-
(1.0497e-2-(1.60906e-1-4.1e-3*x1)*x1)*cx5-1.5208e-2*s3x7-
6.339e-3*s4x7-6.244e-3*sx3-1.65e-2*s2x7*sx3+
(8.931e-3+2.728e-3*x1)*sx7*sx3-5.775e-3*s3x7*sx3+
(8.1344e-2+3.206e-3*x1)*cx7*sx3+1.5019e-2*c2x7*sx3;
(8.14181e-1-(1.815e-2-1.6714e-2*x1)*x1)*sx5-
(1.0497e-2-(1.60906e-1-4.1e-3*x1)*x1)*cx5-1.5208e-2*s3x7-
6.339e-3*s4x7-6.244e-3*sx3-1.65e-2*s2x7*sx3+
(8.931e-3+2.728e-3*x1)*sx7*sx3-5.775e-3*s3x7*sx3+
(8.1344e-2+3.206e-3*x1)*cx7*sx3+1.5019e-2*c2x7*sx3;
dml += (8.5581e-2+2.494e-3*x1)*sx7*cx3+1.4394e-2*c2x7*cx3+
(2.5328e-2-3.117e-3*x1)*cx7*cx3+
6.319e-3*c3x7*cx3+6.369e-3*sx7*s2x3+9.156e-3*s2x7*s2x3+
7.525e-3*s3x8*s2x3-5.236e-3*cx7*c2x3-7.736e-3*c2x7*c2x3-
7.528e-3*c3x8*c2x3;
(2.5328e-2-3.117e-3*x1)*cx7*cx3+
6.319e-3*c3x7*cx3+6.369e-3*sx7*s2x3+9.156e-3*s2x7*s2x3+
7.525e-3*s3x8*s2x3-5.236e-3*cx7*c2x3-7.736e-3*c2x7*c2x3-
7.528e-3*c3x8*c2x3;
dml = degToRad(dml);
ds = (-7927+(2548+91*x1)*x1)*sx5+(13381+(1226-253*x1)*x1)*cx5+
(248-121*x1)*s2x5-(305+91*x1)*c2x5+412*s2x7+12415*sx3+
(390-617*x1)*sx7*sx3+(165-204*x1)*s2x7*sx3+26599*cx7*sx3-
4687*c2x7*sx3-1870*c3x7*sx3-821*c4x7*sx3-
377*c5x7*sx3+497*c2x8*sx3+(163-611*x1)*cx3;
(248-121*x1)*s2x5-(305+91*x1)*c2x5+412*s2x7+12415*sx3+
(390-617*x1)*sx7*sx3+(165-204*x1)*s2x7*sx3+26599*cx7*sx3-
4687*c2x7*sx3-1870*c3x7*sx3-821*c4x7*sx3-
377*c5x7*sx3+497*c2x8*sx3+(163-611*x1)*cx3;
ds += -12696*sx7*cx3-4200*s2x7*cx3-1503*s3x7*cx3-619*s4x7*cx3-
268*s5x7*cx3-(282+1306*x1)*cx7*cx3+(-86+230*x1)*c2x7*cx3+
461*s2x8*cx3-350*s2x3+(2211-286*x1)*sx7*s2x3-
2208*s2x7*s2x3-568*s3x7*s2x3-346*s4x7*s2x3-
(2780+222*x1)*cx7*s2x3+(2022+263*x1)*c2x7*s2x3+248*c3x7*s2x3+
242*s3x8*s2x3+467*c3x8*s2x3-490*c2x3-(2842+279*x1)*sx7*c2x3;
268*s5x7*cx3-(282+1306*x1)*cx7*cx3+(-86+230*x1)*c2x7*cx3+
461*s2x8*cx3-350*s2x3+(2211-286*x1)*sx7*s2x3-
2208*s2x7*s2x3-568*s3x7*s2x3-346*s4x7*s2x3-
(2780+222*x1)*cx7*s2x3+(2022+263*x1)*c2x7*s2x3+248*c3x7*s2x3+
242*s3x8*s2x3+467*c3x8*s2x3-490*c2x3-(2842+279*x1)*sx7*c2x3;
ds += (128+226*x1)*s2x7*c2x3+224*s3x7*c2x3+
(-1594+282*x1)*cx7*c2x3+(2162-207*x1)*c2x7*c2x3+
561*c3x7*c2x3+343*c4x7*c2x3+469*s3x8*c2x3-242*c3x8*c2x3-
205*sx7*s3x3+262*s3x7*s3x3+208*cx7*c3x3-271*c3x7*c3x3-
382*c3x7*s4x3-376*s3x7*c4x3;
(-1594+282*x1)*cx7*c2x3+(2162-207*x1)*c2x7*c2x3+
561*c3x7*c2x3+343*c4x7*c2x3+469*s3x8*c2x3-242*c3x8*c2x3-
205*sx7*s3x3+262*s3x7*s3x3+208*cx7*c3x3-271*c3x7*c3x3-
382*c3x7*s4x3-376*s3x7*c4x3;
ds *= 1e-7;
dp = (7.7108e-2+(7.186e-3-1.533e-3*x1)*x1)*sx5-7.075e-3*sx7+
(4.5803e-2-(1.4766e-2+5.36e-4*x1)*x1)*cx5-7.2586e-2*cx3-
7.5825e-2*sx7*sx3-2.4839e-2*s2x7*sx3-8.631e-3*s3x7*sx3-
1.50383e-1*cx7*cx3+2.6897e-2*c2x7*cx3+1.0053e-2*c3x7*cx3-
(1.3597e-2+1.719e-3*x1)*sx7*s2x3+1.1981e-2*s2x7*c2x3;
(4.5803e-2-(1.4766e-2+5.36e-4*x1)*x1)*cx5-7.2586e-2*cx3-
7.5825e-2*sx7*sx3-2.4839e-2*s2x7*sx3-8.631e-3*s3x7*sx3-
1.50383e-1*cx7*cx3+2.6897e-2*c2x7*cx3+1.0053e-2*c3x7*cx3-
(1.3597e-2+1.719e-3*x1)*sx7*s2x3+1.1981e-2*s2x7*c2x3;
dp += -(7.742e-3-1.517e-3*x1)*cx7*s2x3+
(1.3586e-2-1.375e-3*x1)*c2x7*c2x3-
(1.3667e-2-1.239e-3*x1)*sx7*c2x3+
(1.4861e-2+1.136e-3*x1)*cx7*c2x3-
(1.3064e-2+1.628e-3*x1)*c2x7*c2x3;
(1.3586e-2-1.375e-3*x1)*c2x7*c2x3-
(1.3667e-2-1.239e-3*x1)*sx7*c2x3+
(1.4861e-2+1.136e-3*x1)*cx7*c2x3-
(1.3064e-2+1.628e-3*x1)*c2x7*c2x3;
dm = dml-(degToRad(dp)/s);
da = 572*sx5-1590*s2x7*cx3+2933*cx5-647*s3x7*cx3+33629*cx7-
344*s4x7*cx3-3081*c2x7+2885*cx7*cx3-1423*c3x7+
(2172+102*x1)*c2x7*cx3-671*c4x7+296*c3x7*cx3-320*c5x7-
267*s2x7*s2x3+1098*sx3-778*cx7*s2x3-2812*sx7*sx3;
344*s4x7*cx3-3081*c2x7+2885*cx7*cx3-1423*c3x7+
(2172+102*x1)*c2x7*cx3-671*c4x7+296*c3x7*cx3-320*c5x7-
267*s2x7*s2x3+1098*sx3-778*cx7*s2x3-2812*sx7*sx3;
da += 495*c2x7*s2x3+688*s2x7*sx3+250*c3x7*s2x3-393*s3x7*sx3-
856*sx7*c2x3-228*s4x7*sx3+441*s2x7*c2x3+2138*cx7*sx3+
296*c2x7*c2x3-999*c2x7*sx3+211*c3x7*c2x3-642*c3x7*sx3-
427*sx7*s3x3-325*c4x7*sx3+398*s3x7*s3x3-890*cx3+
344*cx7*c3x3+2206*sx7*cx3-427*c3x7*c3x3;
856*sx7*c2x3-228*s4x7*sx3+441*s2x7*c2x3+2138*cx7*sx3+
296*c2x7*c2x3-999*c2x7*sx3+211*c3x7*c2x3-642*c3x7*sx3-
427*sx7*s3x3-325*c4x7*sx3+398*s3x7*s3x3-890*cx3+
344*cx7*c3x3+2206*sx7*cx3-427*c3x7*c3x3;
da *= 1e-6;
dhl = 7.47e-4*cx7*sx3+1.069e-3*cx7*cx3+2.108e-3*s2x7*s2x3+
1.261e-3*c2x7*s2x3+1.236e-3*s2x7*c2x3-2.075e-3*c2x7*c2x3;
1.261e-3*c2x7*s2x3+1.236e-3*s2x7*c2x3-2.075e-3*c2x7*c2x3;
dhl = degToRad(dhl);
computePlanetCoords(p, map, da, dhl, dl, dm, dml, dr, ds,
@ -1113,7 +1113,7 @@ class UranusOrbit : public CachingOrbit
dl = dr = dml = ds = dm = da = dhl = 0.0;
//Calculate the Julian centuries elapsed since 1900
t = (jd - 2415020.0)/36525.0;
t = (jd - 2415020.0)/36525.0;
computePlanetElements(t, pList);
@ -1132,7 +1132,7 @@ class UranusOrbit : public CachingOrbit
x11 = x4-x3;
x12 = x8-x4;
dml = (8.64319e-1-1.583e-3*x1)*sx9+(8.2222e-2-6.833e-3*x1)*cx9+
3.6017e-2*s2x9-3.019e-3*c2x9+8.122e-3*sin(x6);
3.6017e-2*s2x9-3.019e-3*c2x9+8.122e-3*sin(x6);
dml = degToRad(dml);
dp = 1.20303e-1*sx9+6.197e-3*s2x9+(1.9472e-2-9.47e-4*x1)*cx9;
dm = dml-(degToRad(dp)/s);
@ -1140,11 +1140,11 @@ class UranusOrbit : public CachingOrbit
ds *= 1e-7;
da = -3.825e-3*cx9;
dl = (1.0122e-2-9.88e-4*x1)*sin(x4+x11)+
(-3.8581e-2+(2.031e-3-1.91e-3*x1)*x1)*cos(x4+x11)+
(3.4964e-2-(1.038e-3-8.68e-4*x1)*x1)*cos(2*x4+x11)+
5.594e-3*sin(x4+3*x12)-1.4808e-2*sin(x10)-
5.794e-3*sin(x11)+2.347e-3*cos(x11)+9.872e-3*sin(x12)+
8.803e-3*sin(2*x12)-4.308e-3*sin(3*x12);
(-3.8581e-2+(2.031e-3-1.91e-3*x1)*x1)*cos(x4+x11)+
(3.4964e-2-(1.038e-3-8.68e-4*x1)*x1)*cos(2*x4+x11)+
5.594e-3*sin(x4+3*x12)-1.4808e-2*sin(x10)-
5.794e-3*sin(x11)+2.347e-3*cos(x11)+9.872e-3*sin(x12)+
8.803e-3*sin(2*x12)-4.308e-3*sin(3*x12);
sx11 = sin(x11);
cx11 = cos(x11);
sx4 = sin(x4);
@ -1152,13 +1152,13 @@ class UranusOrbit : public CachingOrbit
s2x4 = sin(2*x4);
c2x4 = cos(2*x4);
dhl = (4.58e-4*sx11-6.42e-4*cx11-5.17e-4*cos(4*x12))*sx4-
(3.47e-4*sx11+8.53e-4*cx11+5.17e-4*sin(4*x11))*cx4+
4.03e-4*(cos(2*x12)*s2x4+sin(2*x12)*c2x4);
(3.47e-4*sx11+8.53e-4*cx11+5.17e-4*sin(4*x11))*cx4+
4.03e-4*(cos(2*x12)*s2x4+sin(2*x12)*c2x4);
dhl = degToRad(dhl);
dr = -25948+4985*cos(x10)-1230*cx4+3354*cos(x11)+904*cos(2*x12)+
894*(cos(x12)-cos(3*x12))+(5795*cx4-1165*sx4+1388*c2x4)*sx11+
(1351*cx4+5702*sx4+1388*s2x4)*cos(x11);
894*(cos(x12)-cos(3*x12))+(5795*cx4-1165*sx4+1388*c2x4)*sx11+
(1351*cx4+5702*sx4+1388*s2x4)*cos(x11);
dr *= 1e-6;
computePlanetCoords(p, map, da, dhl, dl, dm, dml, dr, ds,
@ -1206,7 +1206,7 @@ class NeptuneOrbit : public CachingOrbit
dl = dr = dml = ds = dm = da = dhl = 0.0;
//Calculate the Julian centuries elapsed since 1900
t = (jd - 2415020.0)/36525.0;
t = (jd - 2415020.0)/36525.0;
computePlanetElements(t, pList);
@ -1214,35 +1214,35 @@ class NeptuneOrbit : public CachingOrbit
//Compute perturbations
s = gPlanetElements[p][3];
auxJSun(t, &x1, &x2, &x3, &x4, &x5, &x6);
auxJSun(t, &x1, &x2, &x3, &x4, &x5, &x6);
x8 = pfmod(1.46205+3.81337*t, TWOPI);
x9 = 2*x8-x4;
sx9 = sin(x9);
cx9 = cos(x9);
sx9 = sin(x9);
cx9 = cos(x9);
s2x9 = sin(2*x9);
c2x9 = cos(2*x9);
x10 = x8-x2;
x11 = x8-x3;
x12 = x8-x4;
dml = (1.089e-3*x1-5.89833e-1)*sx9+(4.658e-3*x1-5.6094e-2)*cx9-
2.4286e-2*s2x9;
dml = degToRad(dml);
dp = 2.4039e-2*sx9-2.5303e-2*cx9+6.206e-3*s2x9-5.992e-3*c2x9;
dm = dml-(degToRad(dp)/s);
ds = 4389*sx9+1129*s2x9+4262*cx9+1089*c2x9;
ds *= 1e-7;
da = 8189*cx9-817*sx9+781*c2x9;
da *= 1e-6;
s2x12 = sin(2*x12);
c2x12 = cos(2*x12);
sx8 = sin(x8);
cx8 = cos(x8);
dl = -9.556e-3*sin(x10)-5.178e-3*sin(x11)+2.572e-3*s2x12-
2.972e-3*c2x12*sx8-2.833e-3*s2x12*cx8;
dhl = 3.36e-4*c2x12*sx8+3.64e-4*s2x12*cx8;
dhl = degToRad(dhl);
dr = -40596+4992*cos(x10)+2744*cos(x11)+2044*cos(x12)+1051*c2x12;
dr *= 1e-6;
c2x9 = cos(2*x9);
x10 = x8-x2;
x11 = x8-x3;
x12 = x8-x4;
dml = (1.089e-3*x1-5.89833e-1)*sx9+(4.658e-3*x1-5.6094e-2)*cx9-
2.4286e-2*s2x9;
dml = degToRad(dml);
dp = 2.4039e-2*sx9-2.5303e-2*cx9+6.206e-3*s2x9-5.992e-3*c2x9;
dm = dml-(degToRad(dp)/s);
ds = 4389*sx9+1129*s2x9+4262*cx9+1089*c2x9;
ds *= 1e-7;
da = 8189*cx9-817*sx9+781*c2x9;
da *= 1e-6;
s2x12 = sin(2*x12);
c2x12 = cos(2*x12);
sx8 = sin(x8);
cx8 = cos(x8);
dl = -9.556e-3*sin(x10)-5.178e-3*sin(x11)+2.572e-3*s2x12-
2.972e-3*c2x12*sx8-2.833e-3*s2x12*cx8;
dhl = 3.36e-4*c2x12*sx8+3.64e-4*s2x12*cx8;
dhl = degToRad(dhl);
dr = -40596+4992*cos(x10)+2744*cos(x11)+2044*cos(x12)+1051*c2x12;
dr *= 1e-6;
computePlanetCoords(p, map, da, dhl, dl, dm, dml, dr, ds,
eclLong, eclLat, distance);
@ -2077,7 +2077,7 @@ class MimasOrbit : public CachingOrbit
double getPeriod() const
{
return 0.9424218;
return 0.9424218;
};
double getBoundingRadius() const
@ -2118,7 +2118,7 @@ class EnceladusOrbit : public CachingOrbit
double getPeriod() const
{
return 1.370218;
return 1.370218;
};
double getBoundingRadius() const
@ -2197,7 +2197,7 @@ class DioneOrbit : public CachingOrbit
double getPeriod() const
{
return 2.736915;
return 2.736915;
};
double getBoundingRadius() const
@ -2726,7 +2726,7 @@ static UranianSatelliteOrbit* CreateUranianSatelliteOrbit(int n)
/*! Orbit of Triton, from Seidelmann, _Explanatory Supplement to the
* Astronomical Almanac_ (1992), p.373-374. The position of Triton
* is calculated in Neptunocentric coordinates referred to the
* is calculated in Neptunocentric coordinates referred to the
* Earth equator/equinox of J2000.0.
*/
class TritonOrbit : public CachingOrbit
@ -2796,9 +2796,9 @@ class TritonOrbit : public CachingOrbit
* Translated to C++ by Chris Laurel from FORTRAN source available at:
* ftp://ftp.imcce.fr/pub/ephem/satel/htc20
*
* Coordinates are Saturnocentric and referred to the ecliptic
* Coordinates are Saturnocentric and referred to the ecliptic
* and equinox of J2000.0.
*/
*/
static const double HeleneTerms[24*5] =
{
0,0,0,0,1,
@ -2827,8 +2827,8 @@ static const double HeleneTerms[24*5] =
0,1,-1,0,1,
};
static const double HeleneAmps[24*6] =
{
static const double HeleneAmps[24*6] =
{
-0.002396,-0.000399,0.000442,0.001278,-0.004939,0.002466,
0.000557,-0.002152,0.001074,0.005500,0.000916,-0.001015,-0.000003,
0.,0.,0.000003,-0.000011,0.000006,-0.000066,0.000265,-0.000133,
@ -2943,8 +2943,8 @@ struct HTC20Angles
static const HTC20Angles HeleneAngles =
{
2.29427177,
{
2.29427177,
-0.00802443,
2.29714724,
2.29571726,
@ -3243,7 +3243,7 @@ Orbit* GetCustomOrbit(const string& name)
return CreateJPLEphOrbit(JPLEph_Moon, JPLEph_Earth, 27.321661, 5.0e5);
if (name == "jpl-earth-emb") // Earth, barycentric
return CreateJPLEphOrbit(JPLEph_Earth, JPLEph_EarthMoonBary, 27.321, 1.0e5);
if (name == "jpl-sun-ssb") // Position of Sun relative to SSB
return CreateJPLEphOrbit(JPLEph_Sun, JPLEph_SSB, 11.861773 * 365.25, 2000000);

Some files were not shown because too many files have changed in this diff Show More