[Add] Make display lists of planets within range. Nice FPS improvment.
:D
This commit is contained in:
parent
0d79a17c31
commit
15b6d9178c
@ -12,6 +12,7 @@ Planet::Planet(StarSystem::SBody* sbody) : Body() {
|
|||||||
this->sbody = *sbody;
|
this->sbody = *sbody;
|
||||||
this->sbody.children.clear();
|
this->sbody.children.clear();
|
||||||
this->sbody.parent = 0;
|
this->sbody.parent = 0;
|
||||||
|
crudDList = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Planet::~Planet(void) {
|
Planet::~Planet(void) {
|
||||||
@ -566,6 +567,10 @@ void Planet::Render(const Frame* a_camFrame) {
|
|||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
|
|
||||||
if(apparent_size < 0.001) {
|
if(apparent_size < 0.001) {
|
||||||
|
if(crudDList) {
|
||||||
|
glDeleteLists(crudDList, 1);
|
||||||
|
crudDList = 0;
|
||||||
|
}
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glPointSize(1.0);
|
glPointSize(1.0);
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
@ -573,13 +578,19 @@ void Planet::Render(const Frame* a_camFrame) {
|
|||||||
glEnd();
|
glEnd();
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
} else {
|
} else {
|
||||||
glScalef(rad, rad, rad);
|
if(!crudDList) {
|
||||||
|
crudDList = glGenLists(1);
|
||||||
|
glNewList(crudDList, GL_COMPILE);
|
||||||
/* This is a rather brittle test.. */
|
/* This is a rather brittle test.. */
|
||||||
if(sbody.type < StarSystem::TYPE_PLANET_DWARF) {
|
if(sbody.type < StarSystem::TYPE_PLANET_DWARF) {
|
||||||
DrawGasGiant();
|
DrawGasGiant();
|
||||||
} else {
|
} else {
|
||||||
DrawRockyPlanet();
|
DrawRockyPlanet();
|
||||||
}
|
}
|
||||||
|
glEndList();
|
||||||
|
}
|
||||||
|
glScalef(rad, rad, rad);
|
||||||
|
glCallList(crudDList);
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
@ -22,5 +22,6 @@ private:
|
|||||||
double radius;
|
double radius;
|
||||||
dGeomID geom;
|
dGeomID geom;
|
||||||
StarSystem::SBody sbody;
|
StarSystem::SBody sbody;
|
||||||
|
GLuint crudDList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user