mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-03 14:05:17 +00:00
Noise Implementation Improved
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1104 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -33,7 +33,7 @@ PerlinNoise::PerlinNoise()
|
||||
|
||||
for (int x = 0; x < 512;x++)
|
||||
for (int y = 0; y < 512;y++)
|
||||
noise_perlin[x][y] = perlin_noise_2d(x,y,6321,7,seed2,0.5,64);
|
||||
noise_perlin[x][y] = perlin_noise_2d(x,y,6321,7,seed2,0.5,128);
|
||||
|
||||
for (int x = 0; x < 32;x++)
|
||||
for (int y = 0; y < 32;y++)
|
||||
|
||||
@ -160,13 +160,19 @@ glTexImage2D(GL_TEXTURE_2D,0,4,256,256,0,GL_LUMINANCE,GL_FLOAT,noise.noise_mq);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
|
||||
glGenTextures( 1, &noise_texture_hq );
|
||||
glBindTexture( GL_TEXTURE_2D, noise_texture_hq );
|
||||
glTexImage2D(GL_TEXTURE_2D,0,4,256,256,0,GL_LUMINANCE,GL_FLOAT,noise.noise_hq);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
glGenTextures( 1, &noise_texture_perlin );
|
||||
glBindTexture( GL_TEXTURE_2D, noise_texture_perlin );
|
||||
glTexImage2D(GL_TEXTURE_2D,0,4,512,512,0,GL_LUMINANCE,GL_FLOAT,noise.noise_perlin);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
|
||||
glGenTextures( 1, &noise_texture_lq_vol );
|
||||
glBindTexture( GL_TEXTURE_3D, noise_texture_lq_vol );
|
||||
glTexImage3D(GL_TEXTURE_3D,0,4,32,32,32,0,GL_LUMINANCE,GL_FLOAT,noise.noise_lq_vol);
|
||||
@ -459,6 +465,9 @@ void Renderer::SetupCgVariables(CGprogram program, const Pipeline &pipeline, con
|
||||
cgGLSetTextureParameter(cgGetNamedParameter(program, "sampler_noise_lq"),noise_texture_lq);
|
||||
cgGLEnableTextureParameter(cgGetNamedParameter(program, "sampler_noise_lq"));
|
||||
|
||||
cgGLSetTextureParameter(cgGetNamedParameter(program, "sampler_noise_perlin"),noise_texture_perlin);
|
||||
cgGLEnableTextureParameter(cgGetNamedParameter(program, "sampler_noise_perlin"));
|
||||
|
||||
cgGLSetTextureParameter(cgGetNamedParameter(program, "sampler_noisevol_hq"),noise_texture_hq_vol);
|
||||
cgGLEnableTextureParameter(cgGetNamedParameter(program, "sampler_noisevol_hq"));
|
||||
|
||||
@ -484,6 +493,7 @@ void Renderer::SetupCgVariables(CGprogram program, const Pipeline &pipeline, con
|
||||
cgGLSetParameter4f(cgGetNamedParameter(program, "texsize_noise_lq"), 256, 256,1.0/(float)256,1.0/(float)256);
|
||||
cgGLSetParameter4f(cgGetNamedParameter(program, "texsize_noise_mq"), 64, 64,1.0/(float)64,1.0/(float)64);
|
||||
cgGLSetParameter4f(cgGetNamedParameter(program, "texsize_noise_hq"), 32, 32,1.0/(float)32,1.0/(float)32);
|
||||
cgGLSetParameter4f(cgGetNamedParameter(program, "texsize_noise_perlin"), 512, 512,1.0/(float)512,1.0/(float)512);
|
||||
cgGLSetParameter4f(cgGetNamedParameter(program, "texsize_noise_lq_lite"), 32, 32,1.0/(float)32,1.0/(float)32);
|
||||
}
|
||||
|
||||
|
||||
@ -126,6 +126,7 @@ private:
|
||||
GLuint noise_texture_lq;
|
||||
GLuint noise_texture_mq;
|
||||
GLuint noise_texture_hq;
|
||||
GLuint noise_texture_perlin;
|
||||
GLuint noise_texture_lq_vol;
|
||||
GLuint noise_texture_hq_vol;
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@ uniform sampler2D sampler_noise_lq;
|
||||
uniform sampler2D sampler_noise_lq_lite;
|
||||
uniform sampler2D sampler_noise_mq;
|
||||
uniform sampler2D sampler_noise_hq;
|
||||
uniform sampler2D sampler_noise_perlin;
|
||||
uniform sampler3D sampler_noisevol_lq;
|
||||
uniform sampler3D sampler_noisevol_hq;
|
||||
|
||||
@ -63,6 +64,7 @@ uniform sampler2D sampler_blur3;
|
||||
float4 texsize_noise_lq;
|
||||
float4 texsize_noise_mq;
|
||||
float4 texsize_noise_hq;
|
||||
float4 texsize_noise_perlin;
|
||||
float4 texsize_noise_lq_lite;
|
||||
|
||||
float4 _qa;
|
||||
|
||||
Reference in New Issue
Block a user