paysages : Small optimization.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@353 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-06-17 16:46:30 +00:00 committed by ThunderK
parent 40a0d576bc
commit f93f97ed38
3 changed files with 39 additions and 23 deletions

25
TODO
View file

@ -6,7 +6,6 @@ Technology Preview 2 :
- Add "hardness to light" and shadow control ("minimum lighting") to material. - Add "hardness to light" and shadow control ("minimum lighting") to material.
- Render tab previews should not rerender when changing render options. - Render tab previews should not rerender when changing render options.
- Add layer sorting/naming. - Add layer sorting/naming.
- Disable specular lighting in explorer (and everything camera dependent).
- Add logarithmic sliders for some float values. - Add logarithmic sliders for some float values.
- Save GUI config (views, render params). - Save GUI config (views, render params).
- Add an OSD ability on previews and use it for camera location and user landmarks. - Add an OSD ability on previews and use it for camera location and user landmarks.
@ -14,22 +13,11 @@ Technology Preview 2 :
- Add a terrain modifier dialog with zones. - Add a terrain modifier dialog with zones.
- Use the curve editor in noise editor - Use the curve editor in noise editor
- Add a noise filler (and maybe noise intervals ?). - Add a noise filler (and maybe noise intervals ?).
- Optimize the use of noiseGetMaxValue (limit its use or cache it).
- Fix the distorted sun appearance. - Fix the distorted sun appearance.
- Improve curve editor. - Improve curve editor.
=> Add curve modes => Add curve modes
=> Add axis labels and grid => Add axis labels and grid
=> Add logarithmic mode => Add logarithmic mode
- Improve 3d explorer
=> Restore LOD and intelligent poly count (and raise max tessellation)
=> Interrupt chunk rendering when quitting dialog
=> Don't display the water if it's below all ground
=> Try to overcome the near frustum cutting
=> Disable texture reflection of light (dependant on camera location)
=> Add toggles (for water...)
=> Max texture size should depend on GPU memory available
- Water and terrain LOD moves with the camera, fix it like in the wanderer.
- Interrupt preview chunk renderings that will be discarded at commit, or that are no more visible.
- Fix "RGB parameters out of range" (and segfault) on preview while moving render params fast in render tab. - Fix "RGB parameters out of range" (and segfault) on preview while moving render params fast in render tab.
=> May need to change the updateData system. => May need to change the updateData system.
=> Previews need to be paused while updating data. => Previews need to be paused while updating data.
@ -49,8 +37,17 @@ Technology Preview 3 :
- Mark modified tabs and ask for losing modifications (idem for layers). - Mark modified tabs and ask for losing modifications (idem for layers).
- Fix potential holes in land rendering. - Fix potential holes in land rendering.
- Progressive final render. - Progressive final render.
- Propose several backgrounds for water rendering (grid, sinus...). - Propose several backgrounds for water preview (grid, sinus...).
- If we can't remove clouds artifacts, blur them. - Water and terrain LOD moves with the camera, fix it like in the wanderer.
- Improve 3d explorer
=> Restore LOD and intelligent poly count (and raise max tessellation)
=> Interrupt chunk rendering when quitting dialog
=> Don't display the water if it's below all ground
=> Try to overcome the near frustum cutting
=> Disable specular lighting (dependant on camera location)
=> Add toggles (for water...)
=> Max texture size should depend on GPU memory available
- Interrupt preview chunk renderings that will be discarded at commit, or that are no more visible.
Release Candidate : Release Candidate :
- Polish all features and UI. - Polish all features and UI.

View file

@ -18,6 +18,8 @@ struct NoiseGenerator
double height_offset; double height_offset;
int level_count; int level_count;
struct NoiseLevel levels[MAX_LEVEL_COUNT]; struct NoiseLevel levels[MAX_LEVEL_COUNT];
double _max_height;
}; };
static int _noise_pool_size; static int _noise_pool_size;
@ -81,6 +83,8 @@ NoiseGenerator* noiseCreateGenerator()
result->level_count = 0; result->level_count = 0;
result->height_offset = 0.0; result->height_offset = 0.0;
noiseValidate(result);
return result; return result;
} }
@ -131,6 +135,8 @@ void noiseLoadGenerator(PackStream* stream, NoiseGenerator* perlin)
packReadDouble(stream, &level->yoffset); packReadDouble(stream, &level->yoffset);
packReadDouble(stream, &level->zoffset); packReadDouble(stream, &level->zoffset);
} }
noiseValidate(perlin);
} }
void noiseCopy(NoiseGenerator* source, NoiseGenerator* destination) void noiseCopy(NoiseGenerator* source, NoiseGenerator* destination)
@ -142,6 +148,21 @@ void noiseCopy(NoiseGenerator* source, NoiseGenerator* destination)
destination->level_count = source->level_count; destination->level_count = source->level_count;
memcpy(destination->levels, source->levels, sizeof(NoiseLevel) * destination->level_count); memcpy(destination->levels, source->levels, sizeof(NoiseLevel) * destination->level_count);
noiseValidate(destination);
}
void noiseValidate(NoiseGenerator* generator)
{
int x;
double max_height = generator->height_offset;
for (x = 0; x < generator->level_count; x++)
{
max_height += generator->levels[x].height / 2.0;
}
generator->_max_height = max_height;
} }
void noiseGenerateBaseNoise(NoiseGenerator* generator, int size) void noiseGenerateBaseNoise(NoiseGenerator* generator, int size)
@ -161,15 +182,7 @@ int noiseGetBaseSize(NoiseGenerator* generator)
double noiseGetMaxValue(NoiseGenerator* generator) double noiseGetMaxValue(NoiseGenerator* generator)
{ {
int x; return generator->_max_height;
double result = generator->height_offset;
for (x = 0; x < generator->level_count; x++)
{
result += generator->levels[x].height / 2.0;
}
return result;
} }
int noiseGetLevelCount(NoiseGenerator* generator) int noiseGetLevelCount(NoiseGenerator* generator)
@ -180,6 +193,7 @@ int noiseGetLevelCount(NoiseGenerator* generator)
void noiseClearLevels(NoiseGenerator* generator) void noiseClearLevels(NoiseGenerator* generator)
{ {
generator->level_count = 0; generator->level_count = 0;
noiseValidate(generator);
} }
void noiseAddLevel(NoiseGenerator* generator, NoiseLevel level) void noiseAddLevel(NoiseGenerator* generator, NoiseLevel level)
@ -188,6 +202,7 @@ void noiseAddLevel(NoiseGenerator* generator, NoiseLevel level)
{ {
generator->levels[generator->level_count] = level; generator->levels[generator->level_count] = level;
generator->level_count++; generator->level_count++;
noiseValidate(generator);
} }
} }
@ -240,6 +255,7 @@ void noiseRemoveLevel(NoiseGenerator* generator, int level)
memmove(generator->levels + level, generator->levels + level + 1, sizeof(NoiseLevel) * (generator->level_count - level - 1)); memmove(generator->levels + level, generator->levels + level + 1, sizeof(NoiseLevel) * (generator->level_count - level - 1));
} }
generator->level_count--; generator->level_count--;
noiseValidate(generator);
} }
} }
@ -261,6 +277,7 @@ void noiseSetLevel(NoiseGenerator* generator, int level, NoiseLevel params)
if (level >= 0 && level < generator->level_count) if (level >= 0 && level < generator->level_count)
{ {
generator->levels[level] = params; generator->levels[level] = params;
noiseValidate(generator);
} }
} }
@ -301,6 +318,7 @@ void noiseNormalizeHeight(NoiseGenerator* generator, double min_height, double m
} }
} }
generator->height_offset = min_height + target_height / 2.0; generator->height_offset = min_height + target_height / 2.0;
noiseValidate(generator);
} }

View file

@ -28,6 +28,7 @@ void noiseDeleteGenerator(NoiseGenerator* generator);
void noiseSaveGenerator(PackStream* stream, NoiseGenerator* perlin); void noiseSaveGenerator(PackStream* stream, NoiseGenerator* perlin);
void noiseLoadGenerator(PackStream* stream, NoiseGenerator* perlin); void noiseLoadGenerator(PackStream* stream, NoiseGenerator* perlin);
void noiseCopy(NoiseGenerator* source, NoiseGenerator* destination); void noiseCopy(NoiseGenerator* source, NoiseGenerator* destination);
void noiseValidate(NoiseGenerator* generator);
void noiseGenerateBaseNoise(NoiseGenerator* generator, int size); void noiseGenerateBaseNoise(NoiseGenerator* generator, int size);
int noiseGetBaseSize(NoiseGenerator* generator); int noiseGetBaseSize(NoiseGenerator* generator);
double noiseGetMaxValue(NoiseGenerator* generator); double noiseGetMaxValue(NoiseGenerator* generator);