straightens data pipeline and several bugs after exhaustive testing

This commit is contained in:
tosh 2013-03-29 01:08:24 +01:00
parent 0b183cf7a0
commit df7f3942e1
3 changed files with 636 additions and 399 deletions

File diff suppressed because it is too large Load diff

View file

@ -43,14 +43,14 @@ class Stars
* The parameter determines the number of tiles in azimuthal * The parameter determines the number of tiles in azimuthal
* and altitudinal directions. * and altitudinal directions.
* *
* GPU resources are updated upon change. * GPU resources are updated upon change in which case 'true'
* is returned.
*/ */
void setResolution(unsigned k); bool setResolution(unsigned k);
/** /**
* Allows to reduce the number of stars to be rendered given a * Allows to alter the number of stars to be rendered given a
* fractional LOD value. The least brightest ones are omitted * factor. The least brightest ones are omitted first.
* first.
* *
* The further parameters determine when GPU resources should * The further parameters determine when GPU resources should
* be reallocated. Its value is fractional in respect to the * be reallocated. Its value is fractional in respect to the
@ -61,8 +61,10 @@ class Stars
* are updated. Note that all parameters must be fractions, * are updated. Note that all parameters must be fractions,
* that is within the range [0;1] and that 'overalloc' must be * that is within the range [0;1] and that 'overalloc' must be
* greater than or equal to 'realloc'. * greater than or equal to 'realloc'.
*
* The current level of detail is returned as a float in [0;1].
*/ */
void setLOD(float fraction, float changeLOD(float factor,
float overalloc = 0.25, float realloc = 0.15); float overalloc = 0.25, float realloc = 0.15);
private: private:

View file

@ -102,6 +102,8 @@ Head myHead; // The rendered head of oneself
FieldOfView fov; FieldOfView fov;
Stars stars; Stars stars;
int stars_tiles = 20;
double stars_lod = 1.0;
glm::vec3 box(WORLD_SIZE,WORLD_SIZE,WORLD_SIZE); glm::vec3 box(WORLD_SIZE,WORLD_SIZE,WORLD_SIZE);
ParticleSystem balls(0, ParticleSystem balls(0,
@ -768,8 +770,15 @@ void key(unsigned char k, int x, int y)
if (k == ' ') reset_sensors(); if (k == ' ') reset_sensors();
if (k == 'a') render_yaw_rate -= KEYBOARD_YAW_RATE; if (k == 'a') render_yaw_rate -= KEYBOARD_YAW_RATE;
if (k == 'd') render_yaw_rate += KEYBOARD_YAW_RATE; if (k == 'd') render_yaw_rate += KEYBOARD_YAW_RATE;
// >> tosh (for testing starfield)
if (k == 't') render_pitch_rate += KEYBOARD_PITCH_RATE; if (k == 't') render_pitch_rate += KEYBOARD_PITCH_RATE;
if (k == 'g') render_pitch_rate -= KEYBOARD_PITCH_RATE; if (k == 'g') render_pitch_rate -= KEYBOARD_PITCH_RATE;
if (k == 'u') stars.setResolution(stars_tiles += 1);
if (k == 'j') stars.setResolution(stars_tiles = max(stars_tiles-1,1));
if (k == 'i') if (stars_lod < 1.0) stars_lod = stars.changeLOD(1.01);
if (k == 'k') if (stars_lod > 0.01) stars_lod = stars.changeLOD(0.99);
if (k == 'r') stars.readInput("file://stars.txt", 0);
// << tosh
if (k == 'o') simulate_on = !simulate_on; if (k == 'o') simulate_on = !simulate_on;
if (k == 'p') if (k == 'p')
{ {