[Fix] Tweaked a little bit, and the transitions is perfectly smooth now.
This commit is contained in:
parent
86f7480826
commit
17db004ba1
@ -10,7 +10,7 @@
|
||||
#include "rng.h"
|
||||
#include "perlin.h"
|
||||
|
||||
#define NEBU_DT_MAX 1.
|
||||
#define NEBU_DT_MAX 5.
|
||||
|
||||
#define NEBULAE_Z 16 /* Z plane. */
|
||||
#define NEBULAE_PATH "gen/nebu_%02d.png"
|
||||
@ -132,12 +132,12 @@ void nebu_render(void) {
|
||||
/* Texture 0. */
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, nebu_textures[cur_nebu[0]]);
|
||||
glBindTexture(GL_TEXTURE_2D, nebu_textures[cur_nebu[1]]);
|
||||
|
||||
/* Texture 1. */
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, nebu_textures[cur_nebu[1]]);
|
||||
glBindTexture(GL_TEXTURE_2D, nebu_textures[cur_nebu[0]]);
|
||||
|
||||
/* Prepare it. */
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
||||
@ -147,8 +147,9 @@ void nebu_render(void) {
|
||||
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, col);
|
||||
|
||||
/* Arguments. */
|
||||
/* Arg0 */
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE1);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
|
||||
/* Arg 1. */
|
||||
|
@ -199,8 +199,10 @@ float* noise_genNebulaeMap(const int w, const int h, const int n, float rug) {
|
||||
|
||||
/* Start to create the nebulae. */
|
||||
max = 0.;
|
||||
f[2] = 0.;
|
||||
for(z = 0; z < n; z++) {
|
||||
|
||||
f[2] = zoom * (float)z / (float)n;
|
||||
|
||||
for(y = 0; y < h; y++) {
|
||||
|
||||
f[1] = zoom * (float)y / (float)h;
|
||||
@ -215,7 +217,6 @@ float* noise_genNebulaeMap(const int w, const int h, const int n, float rug) {
|
||||
nebulae[z*w*h + y*w+x] = value;
|
||||
}
|
||||
}
|
||||
f[2] += 0.01;
|
||||
|
||||
/* More time magic debug. */
|
||||
t[z] = SDL_GetTicks();
|
||||
|
Loading…
Reference in New Issue
Block a user