noise.h File Reference

Perlin noise routines for procedural textures, etc. More...

#include "llmath.h"

Include dependency graph for noise.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define B   0x100
#define BM   0xff
#define N   0x1000
#define NF32   (4096.f)
#define NP   12
#define NM   0xfff
#define s_curve(t)   ( t * t * (3.f - 2.f * t) )
#define lerp_m(t, a, b)   ( a + t * (b - a) )
#define setup_noise(i, b0, b1, r0, r1)

Functions

F32 turbulence2 (F32 *v, F32 freq)
F32 turbulence3 (float *v, float freq)
F32 clouds3 (float *v, float freq)
F32 noise2 (float *vec)
F32 noise3 (float *vec)
F32 bias (F32 a, F32 b)
F32 gain (F32 a, F32 b)
static void init (void)
void fast_setup (F32 vec, U8 &b0, U8 &b1, F32 &r0, F32 &r1)
F32 noise1 (const F32 arg)
F32 fast_at2 (F32 rx, F32 ry, F32 *q)
F32 fast_at3 (F32 rx, F32 ry, F32 rz, F32 *q)
static void normalize2 (F32 v[2])
static void normalize3 (F32 v[3])

Variables

S32 p [B+B+2]
F32 g3 [B+B+2][3]
F32 g2 [B+B+2][2]
F32 g1 [B+B+2]
S32 gNoiseStart


Detailed Description

Perlin noise routines for procedural textures, etc.

LicenseInfo
firstyear=2000&license=viewergpl

Copyright (c) 2000-2008, Linden Research, Inc.

Second Life Viewer Source Code The source code in this file ("Source Code") is provided by Linden Lab to you under the terms of the GNU General Public License, version 2.0 ("GPL"), unless you have obtained a separate licensing agreement ("Other License"), formally executed by you and Linden Lab. Terms of the GPL can be found in doc/GPL-license.txt in this distribution, or online at http://secondlifegrid.net/programs/open_source/licensing/gplv2

There are special exceptions to the terms and conditions of the GPL as it is applied to this Source Code. View the full text of the exception in the file doc/FLOSS-exception.txt in this software distribution, or online at http://secondlifegrid.net/programs/open_source/licensing/flossexception

By copying, modifying or distributing this software, you acknowledge that you have read and understood your obligations described above, and agree to abide by those obligations.

ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, COMPLETENESS OR PERFORMANCE. $/LicenseInfo$

Definition in file noise.h.


Define Documentation

#define B   0x100

Definition at line 108 of file noise.h.

#define BM   0xff

Definition at line 109 of file noise.h.

#define lerp_m ( t,
a,
 )     ( a + t * (b - a) )

Definition at line 126 of file noise.h.

#define N   0x1000

Definition at line 111 of file noise.h.

#define NF32   (4096.f)

Definition at line 112 of file noise.h.

#define NM   0xfff

Definition at line 114 of file noise.h.

#define NP   12

Definition at line 113 of file noise.h.

#define s_curve (  )     ( t * t * (3.f - 2.f * t) )

Definition at line 124 of file noise.h.

#define setup_noise ( i,
b0,
b1,
r0,
r1   ) 

Value:

t = vec[i] + N;\
        b0 = (lltrunc(t)) & BM;\
        b1 = (b0+1) & BM;\
        r0 = t - lltrunc(t);\
        r1 = r0 - 1.f;

Definition at line 128 of file noise.h.

Referenced by noise1().


Function Documentation

F32 bias ( F32  a,
F32  b 
) [inline]

Definition at line 43 of file noise.h.

References indra::base::lllog::log().

Referenced by LLAgent::calcFocusOffset(), LLStringBase< T >::compareDict(), LLImageTGA::decodeAndProcess(), and LLFace::renderSelectedUV().

Here is the call graph for this function:

Here is the caller graph for this function:

F32 clouds3 ( float *  v,
float  freq 
) [inline]

Definition at line 90 of file noise.h.

References noise3().

Here is the call graph for this function:

F32 fast_at2 ( F32  rx,
F32  ry,
F32 q 
) [inline]

Definition at line 169 of file noise.h.

F32 fast_at3 ( F32  rx,
F32  ry,
F32  rz,
F32 q 
) [inline]

Definition at line 176 of file noise.h.

void fast_setup ( F32  vec,
U8 b0,
U8 b1,
F32 r0,
F32 r1 
) [inline]

Definition at line 136 of file noise.h.

References lltrunc(), NF32, and S32.

Here is the call graph for this function:

F32 gain ( F32  a,
F32  b 
) [inline]

Definition at line 48 of file noise.h.

References indra::base::lllog::log(), and p.

Referenced by LLAudioEngine::mapWindVecToGain(), process_attached_sound(), process_attached_sound_gain_change(), process_sound_trigger(), LLViewerObject::processUpdateMessage(), and LLVOAvatar::updateCharacter().

Here is the call graph for this function:

Here is the caller graph for this function:

static void init ( void   )  [static]

Definition at line 316 of file noise.h.

References B, g1, g2, g3, i, j, normalize2(), normalize3(), and p.

Referenced by tut::LLTemplateMessageBuilderTestData::defaultTemplate(), LLUUID::getCurrentTime(), idle_startup(), tut::LLMessageSystemTestData::LLMessageSystemTestData(), LLVFSFileBlock::LLVFSFileBlock(), noise1(), noise2(), and noise3().

Here is the call graph for this function:

Here is the caller graph for this function:

F32 noise1 ( const F32  arg  )  [inline]

Definition at line 148 of file noise.h.

References g1, gNoiseStart, init(), lerp_m, p, s_curve, and setup_noise.

Referenced by LLVOAvatar::idleUpdate(), and LLDrawPoolAvatar::renderAvatars().

Here is the call graph for this function:

Here is the caller graph for this function:

F32 noise2 ( float *  vec  ) 

Definition at line 47 of file noise.cpp.

References fast_at2(), fast_setup(), g2, gNoiseStart, i, init(), j, lerp_m, p, S32, and s_curve.

Referenced by LLSurfacePatch::eval(), LLVLComposition::generateHeights(), LLBodyNoiseMotion::onUpdate(), and turbulence2().

Here is the call graph for this function:

Here is the caller graph for this function:

F32 noise3 ( float *  vec  )  [inline]

Definition at line 183 of file noise.h.

References d, fast_at3(), fast_setup(), g3, gNoiseStart, i, init(), j, lerp_m, p, S32, and s_curve.

Referenced by clouds3(), and turbulence3().

Here is the call graph for this function:

Here is the caller graph for this function:

static void normalize2 ( F32  v[2]  )  [static]

Definition at line 297 of file noise.h.

static void normalize3 ( F32  v[3]  )  [static]

Definition at line 306 of file noise.h.

F32 turbulence2 ( F32 v,
F32  freq 
) [inline]

Definition at line 62 of file noise.h.

References noise2().

Referenced by LLVLComposition::generateHeights().

Here is the call graph for this function:

Here is the caller graph for this function:

F32 turbulence3 ( float *  v,
float  freq 
) [inline]

Definition at line 74 of file noise.h.

References noise3().

Referenced by LLVOTree::updateGeometry().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

F32 g1[B+B+2]

Definition at line 43 of file noise.cpp.

F32 g2[B+B+2][2]

Definition at line 42 of file noise.cpp.

F32 g3[B+B+2][3]

Definition at line 41 of file noise.cpp.

Definition at line 44 of file noise.cpp.

Referenced by noise1(), noise2(), and noise3().

S32 p[B+B+2]

Definition at line 40 of file noise.cpp.


Generated on Fri May 16 08:38:11 2008 for SecondLife by  doxygen 1.5.5