Remove dupilicate perlin noise impl, and update the remaining one.
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
#include "llviewertexture.h"
|
||||
#include "llviewertexturelist.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "noise.h"
|
||||
#include "llperlin.h"
|
||||
#include "llregionhandle.h" // for from_region_handle
|
||||
#include "llviewercontrol.h"
|
||||
|
||||
@@ -152,7 +152,7 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y,
|
||||
// For perlin noise generation...
|
||||
const F32 slope_squared = 1.5f*1.5f;
|
||||
const F32 xyScale = 4.9215f; //0.93284f;
|
||||
const F32 zScale = 4; //0.92165f;
|
||||
//const F32 zScale = 4; //0.92165f; //Unused
|
||||
const F32 z_offset = 0.f;
|
||||
const F32 noise_magnitude = 2.f; // Degree to which noise modulates composition layer (versus
|
||||
// simple height)
|
||||
@@ -162,7 +162,7 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y,
|
||||
const S32 NUM_TEXTURES = 4;
|
||||
|
||||
const F32 xyScaleInv = (1.f / xyScale);
|
||||
const F32 zScaleInv = (1.f / zScale);
|
||||
//const F32 zScaleInv = (1.f / zScale); //Unused
|
||||
|
||||
// <FS:CR> Aurora Sim
|
||||
//const F32 inv_width = 1.f/mWidth;
|
||||
@@ -174,9 +174,6 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y,
|
||||
{
|
||||
for (S32 i = x_begin; i < x_end; i++)
|
||||
{
|
||||
|
||||
F32 vec[3];
|
||||
F32 vec1[3];
|
||||
F32 twiddle;
|
||||
|
||||
// Bilinearly interpolate the start height and height range of the textures
|
||||
@@ -196,18 +193,18 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y,
|
||||
F32 height = mSurfacep->resolveHeightRegion(location) + z_offset;
|
||||
|
||||
// Step 0: Measure the exact height at this texel
|
||||
vec[0] = (F32)(origin_global.mdV[VX]+location.mV[VX])*xyScaleInv; // Adjust to non-integer lattice
|
||||
vec[1] = (F32)(origin_global.mdV[VY]+location.mV[VY])*xyScaleInv;
|
||||
vec[2] = height*zScaleInv;
|
||||
|
||||
// Adjust to non - integer lattice
|
||||
LLVector2 vec = (LLVector2(LLVector3(origin_global)) + LLVector2(location));
|
||||
vec *= xyScaleInv;
|
||||
//vec[VZ] = height*zScaleInv; //Unused.
|
||||
|
||||
//
|
||||
// Choose material value by adding to the exact height a random value
|
||||
//
|
||||
vec1[0] = vec[0]*(0.2222222222f);
|
||||
vec1[1] = vec[1]*(0.2222222222f);
|
||||
vec1[2] = vec[2]*(0.2222222222f);
|
||||
twiddle = noise2(vec1)*6.5f; // Low freq component for large divisions
|
||||
twiddle = LLPerlinNoise::noise(vec*0.2222222222f)*6.5f; // Low freq component for large divisions
|
||||
|
||||
twiddle += turbulence2(vec, 2)*slope_squared; // High frequency component
|
||||
twiddle += LLPerlinNoise::turbulence(vec, 2.f)*slope_squared; // High frequency component
|
||||
twiddle *= noise_magnitude;
|
||||
|
||||
F32 scaled_noisy_height = (height + twiddle - start_height) * F32(NUM_TEXTURES) / height_range;
|
||||
|
||||
Reference in New Issue
Block a user