StelPainter.cpp   StelPainter.cpp 
skipping to change at line 163 skipping to change at line 163
QFontMetrics StelPainter::getFontMetrics() const QFontMetrics StelPainter::getFontMetrics() const
{ {
return QFontMetrics(currentFont); return QFontMetrics(currentFont);
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Standard methods for drawing primitives // Standard methods for drawing primitives
// Fill with black around the circle // Fill with black around the circle
void StelPainter::drawViewportShape(const GLfloat innerRadius) void StelPainter::drawViewportShape(void)
{ {
if (prj->maskType != StelProjector::MaskDisk) if (prj->maskType != StelProjector::MaskDisk)
return; return;
glDisable(GL_BLEND); glDisable(GL_BLEND);
setColor(0.f,0.f,0.f); setColor(0.f,0.f,0.f);
GLfloat innerRadius = 0.5*prj->viewportFovDiameter;
GLfloat outerRadius = prj->getViewportWidth()+prj->getViewportHeight (); GLfloat outerRadius = prj->getViewportWidth()+prj->getViewportHeight ();
GLint slices = 256; GLint slices = 239;
GLfloat sweepAngle = 360.;
GLfloat sinCache[240]; GLfloat sinCache[240];
GLfloat cosCache[240]; GLfloat cosCache[240];
GLfloat vertices[(240+1)*2][3]; GLfloat vertices[(240+1)*2][3];
GLfloat deltaRadius; GLfloat deltaRadius;
GLfloat radiusHigh; GLfloat radiusHigh;
if (slices>=240)
{
slices=240-1;
}
if (outerRadius<=0.0 || innerRadius<0.0 ||innerRadius > outerRadius) if (outerRadius<=0.0 || innerRadius<0.0 ||innerRadius > outerRadius)
{ {
Q_ASSERT(0); Q_ASSERT(0);
return; return;
} }
/* Compute length (needed for normal calculations) */ /* Compute length (needed for normal calculations) */
deltaRadius=outerRadius-innerRadius; deltaRadius=outerRadius-innerRadius;
/* Cache is the vertex locations cache */ /* Cache is the vertex locations cache */
for (int i=0; i<=slices; i++) for (int i=0; i<=slices; i++)
{ {
GLfloat angle=((M_PI*sweepAngle)/180.0f)*i/slices; GLfloat angle=(M_PI*2.0f)*i/slices;
sinCache[i]=(GLfloat)sin(angle); sinCache[i]=(GLfloat)sin(angle);
cosCache[i]=(GLfloat)cos(angle); cosCache[i]=(GLfloat)cos(angle);
} }
sinCache[slices]=sinCache[0]; sinCache[slices]=sinCache[0];
cosCache[slices]=cosCache[0]; cosCache[slices]=cosCache[0];
/* Enable arrays */ /* Enable arrays */
enableClientStates(true); enableClientStates(true);
setVertexPointer(3, GL_FLOAT, vertices); setVertexPointer(3, GL_FLOAT, vertices);
skipping to change at line 224 skipping to change at line 219
vertices[i*2][1]= prj->viewportCenter[1] + outerRadius*cosCa che[i]; vertices[i*2][1]= prj->viewportCenter[1] + outerRadius*cosCa che[i];
vertices[i*2][2] = 0.0; vertices[i*2][2] = 0.0;
vertices[i*2+1][0]= prj->viewportCenter[0] + radiusHigh*sinC ache[i]; vertices[i*2+1][0]= prj->viewportCenter[0] + radiusHigh*sinC ache[i];
vertices[i*2+1][1]= prj->viewportCenter[1] + radiusHigh*cosC ache[i]; vertices[i*2+1][1]= prj->viewportCenter[1] + radiusHigh*cosC ache[i];
vertices[i*2+1][2] = 0.0; vertices[i*2+1][2] = 0.0;
} }
drawFromArray(TriangleStrip, (slices+1)*2, 0, false); drawFromArray(TriangleStrip, (slices+1)*2, 0, false);
enableClientStates(false); enableClientStates(false);
} }
void StelPainter::drawViewportShape(void)
{
this->drawViewportShape(0.5*prj->viewportFovDiameter);
}
void StelPainter::computeFanDisk(float radius, int innerFanSlices, int leve l, QVector<double>& vertexArr, QVector<float>& texCoordArr) void StelPainter::computeFanDisk(float radius, int innerFanSlices, int leve l, QVector<double>& vertexArr, QVector<float>& texCoordArr)
{ {
Q_ASSERT(level<64); Q_ASSERT(level<64);
float rad[64]; float rad[64];
int i,j; int i,j;
rad[level] = radius; rad[level] = radius;
for (i=level-1;i>=0;--i) for (i=level-1;i>=0;--i)
{ {
rad[i] = rad[i+1]*(1.f-M_PI/(innerFanSlices<<(i+1)))*2.f/3.f ; rad[i] = rad[i+1]*(1.f-M_PI/(innerFanSlices<<(i+1)))*2.f/3.f ;
} }
 End of changes. 6 change blocks. 
14 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/