Remove dupilicate perlin noise impl, and update the remaining one.

This commit is contained in:
Shyotl
2015-05-15 00:44:34 -05:00
parent 8c58a9c276
commit 8943439629
11 changed files with 210 additions and 770 deletions

View File

@@ -35,15 +35,16 @@
#include "llpostprocess.h"
#include "lldir.h"
#include "llfasttimer.h"
#include "llgl.h"
#include "llglslshader.h"
#include "llmatrix4a.h"
#include "llperlin.h"
#include "llrender.h"
#include "llsdserialize.h"
#include "llsdutil.h"
#include "llsdutil_math.h"
#include "llvertexbuffer.h"
#include "llfasttimer.h"
#include "llmatrix4a.h"
extern LLGLSLShader gPostColorFilterProgram;
extern LLGLSLShader gPostNightVisionProgram;
@@ -457,7 +458,8 @@ void LLPostProcess::createNoiseTexture()
std::vector<GLubyte> buffer(NOISE_SIZE * NOISE_SIZE);
for (unsigned int i = 0; i < NOISE_SIZE; i++){
for (unsigned int k = 0; k < NOISE_SIZE; k++){
buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f);
F32 pnoise = LLPerlinNoise::noise(LLVector2(i, k) * .5f) * (1.f/.7f);
buffer[i * NOISE_SIZE + k] = (GLubyte)(llclamp(.5f + pnoise * .5f, 0.f, 1.f) * 255.f);
}
}
@@ -637,8 +639,9 @@ void LLPostProcess::drawOrthoQuad(QuadType type)
mVBO->getTexCoord1Strider(uv2);
float offs[2] = {
llmath::llround(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE),
llmath::llround(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE) };
/*llmath::llround*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE),
/*llmath::llround*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE)
};
float scale[2] = {
(float)mScreenWidth * mNoiseTextureScale,
(float)mScreenHeight * mNoiseTextureScale };