[Add] Stars glow right?!
This commit is contained in:
parent
1de5584f7c
commit
94df6a528c
28
src/star.cpp
28
src/star.cpp
@ -16,6 +16,33 @@ void Star::SetPosition(vector3d p) {
|
||||
pos = p;
|
||||
}
|
||||
|
||||
static void DrawCorona(double rad, vector3d& pos, const float col[3]) {
|
||||
glPushMatrix();
|
||||
/* Face the camera damnit! */
|
||||
vector3d dir = vector3d::Normalize(pos);
|
||||
vector3d d2 = vector3d(0, 1, 0);
|
||||
vector3d d3 = vector3d::Cross(dir, d2);
|
||||
d3.Normalize();
|
||||
d2 = vector3d::Cross(dir, d3);
|
||||
matrix4x4d rot = matrix4x4d::MakeRotMatrix(d3, d2, dir);
|
||||
glMultMatrixd(&rot[0]);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glColor4f(col[0], col[1], col[2], 1);
|
||||
glVertex3f(0, 0, 0);
|
||||
glColor4f(0, 0, 0, 0);
|
||||
for(float ang = 0; ang < 2*M_PI; ang += 0.2) {
|
||||
glVertex3f(rad*sin(ang), rad*cos(ang), 0);
|
||||
}
|
||||
glVertex3f(0, rad, 0);
|
||||
glEnd();
|
||||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_BLEND);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void Star::Render(const Frame* a_camFrame) {
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
@ -36,6 +63,7 @@ void Star::Render(const Frame* a_camFrame) {
|
||||
|
||||
glColor3fv(StarSystem::starColors[type]);
|
||||
gluSphere(L3D::gluQuadric, rad, 100, 100);
|
||||
DrawCorona(rad*4, fpos, StarSystem::starColors[type]);
|
||||
glPopMatrix();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
|
Loading…
Reference in New Issue
Block a user