Space Sim
Loading...
Searching...
No Matches
density.comp File Reference

Creates a density field from a chunk. More...

Go to the source code of this file.

Data Structures

struct  Vertex
struct  VertexInfo
struct  WarpLayer
struct  PerlinLayer
struct  FBMLayer

Macros

#define LODMAX   4
#define MAX_CHUNKS   400
#define MAX_LAYERS   24
#define NUM_OCTAVES   5

Functions

 layout (local_size_x=1, local_size_y=1, local_size_z=1) in
 layout (std140) uniform CameraData
 layout (std430, binding=8) buffer MarchingCubesData
float mod289 (float x)
vec4 mod289 (vec4 x)
vec4 perm (vec4 x)
float noise (vec3 p)
float fbm (vec3 x)
void main ()

Variables

const float radius = 1000.0
uniform int uSize
uniform int lod
uniform vec3 chunk_offset
uniform sampler3D perlin_tex
uniform sampler3D fbm_tex
uniform int chunk_id

Detailed Description

Creates a density field from a chunk.

Definition in file density.comp.


Data Structure Documentation

◆ Vertex

struct Vertex

Definition at line 347 of file types.h.

Data Fields
vec3 pos
float pad0
vec3 normal
float pad1
vec3 color
float pad2

◆ VertexInfo

struct VertexInfo

Definition at line 484 of file types.h.

Data Fields
int vcnt
uint32_t uid
uint32_t pad0
uint32_t pad1
uint uid
uint pad0
uint pad1

◆ WarpLayer

struct WarpLayer

Definition at line 371 of file types.h.

Data Fields
vec3 offset0
float freq0
vec3 offset1
float freq1
vec3 offset2
float freq2
float amp
float pad0
float pad1
float pad3

◆ PerlinLayer

struct PerlinLayer

Definition at line 387 of file types.h.

Data Fields
float freq
float amp
float pad0
float pad1

◆ FBMLayer

struct FBMLayer

Definition at line 397 of file types.h.

Data Fields
float freq
float amp
float pad0
float pad1

Macro Definition Documentation

◆ LODMAX

#define LODMAX   4

Definition at line 39 of file density.comp.

◆ MAX_CHUNKS

#define MAX_CHUNKS   400

Definition at line 40 of file density.comp.

◆ MAX_LAYERS

#define MAX_LAYERS   24

Definition at line 54 of file density.comp.

◆ NUM_OCTAVES

#define NUM_OCTAVES   5

Definition at line 111 of file density.comp.

Referenced by fbm().

Function Documentation

◆ layout() [1/3]

layout ( local_size_x = 1,
local_size_y = 1,
local_size_z = 1 )

References layout().

◆ layout() [2/3]

layout ( std140 )

Definition at line 12 of file density.comp.

References layout(), projection, and view.

◆ layout() [3/3]

layout ( std430 ,
binding = 8 )

Definition at line 20 of file density.comp.

References EDGE_TABLE, EDGE_TO_VERTICES, layout(), and TRIANGLE_TABLE.

◆ mod289() [1/2]

float mod289 ( float x)

Definition at line 112 of file density.comp.

References mod289().

Referenced by mod289(), mod289(), and perm().

◆ mod289() [2/2]

vec4 mod289 ( vec4 x)

Definition at line 113 of file density.comp.

References mod289().

◆ perm()

vec4 perm ( vec4 x)

Definition at line 114 of file density.comp.

References mod289(), and perm().

Referenced by fbm_noise(), noise(), and perm().

◆ noise()

float noise ( vec3 p)

Definition at line 116 of file density.comp.

◆ fbm()

float fbm ( vec3 x)

Definition at line 139 of file density.comp.

References fbm(), noise(), and NUM_OCTAVES.

Referenced by density_fn(), fbm(), fbm(), and precompute_fbm_texture().

◆ main()

Variable Documentation

◆ radius

const float radius = 1000.0

Definition at line 151 of file density.comp.

◆ uSize

uniform int uSize

Definition at line 153 of file density.comp.

Referenced by main(), and sample_density().

◆ lod

◆ chunk_offset

uniform vec3 chunk_offset

Definition at line 155 of file density.comp.

Referenced by main(), and sample_density().

◆ perlin_tex

uniform sampler3D perlin_tex

Definition at line 156 of file density.comp.

◆ fbm_tex

uniform sampler3D fbm_tex

Definition at line 157 of file density.comp.

◆ chunk_id