Eulerian Smoke Simulation on the GPU
shaders/MarchingCubes.gs File Reference

a marching cubes geometry shader More...

Functions

vec3 getCubeCorner (int _index)
 Returns a cube's corner.
float sampleVert (int _i)
 Samples the scalar field on a grid vertex.
int fetchEdgeTableVal (int _i)
 Fetches a texel of the edge table texture.
int fetchTriTableVal (int _i, int _j)
 Fetches a texel of the triangulation table texture.
vec3 vertLerp (vec3 _v0, float _s0, vec3 _v1, float _s1, float _isoLevel)
 Performs linear interpolation between two vertices using their iso values as weight.
void main (void)
 Geometry shader entry point.

Variables

uniform isampler1D edgeTableTex
 The edge table texture.
uniform isampler2D triTableTex
 The triangulation table texture.
uniform sampler3D densityTex
 The scalar field texture.
uniform int samplingChannel
 The texture channel to sample from.
uniform vec3 marchingStep
 The marching step.
uniform float isoLevel
 The iso level threshold.
uniform mat4 projectionMatrix
 The projection matrix generated from the Camera.
uniform mat4 ViewMatrix
 The ViewMatrix generated from the Camera.
uniform mat4 ModelMatrix
 The ModelMatrix generated from the scene transforms.
varying out vec4 position
 The calculated vertex positions (output to fragment shader).

Detailed Description

a marching cubes geometry shader


Function Documentation

int fetchEdgeTableVal ( int  _i)

Fetches a texel of the edge table texture.

Parameters:
[in]_itable index
int fetchTriTableVal ( int  _i,
int  _j 
)

Fetches a texel of the triangulation table texture.

Parameters:
[in]_itable index
vec3 getCubeCorner ( int  _index)

Returns a cube's corner.

Parameters:
[in]_indexThe corner index.

The following section is modified from :- Cyril Crassin (2007). Tutorial on implementing Marching Cubes algorithm using OpenGL API Geometry Shaders extension available at: http://www.icare3d.org/content/view/50/9/ accessed at 02/04/11

end of citation

void main ( void  )

Geometry shader entry point.

The following section is modified from :- Cyril Crassin (2007). Tutorial on implementing Marching Cubes algorithm using OpenGL API Geometry Shaders extension available at: http://www.icare3d.org/content/view/50/9/ accessed at 02/04/11

end of citation

float sampleVert ( int  _i)

Samples the scalar field on a grid vertex.

Parameters:
[in]_thevertex index.
vec3 vertLerp ( vec3  _v0,
float  _s0,
vec3  _v1,
float  _s1,
float  _isoLevel 
)

Performs linear interpolation between two vertices using their iso values as weight.

Parameters:
[in]_v0the first vertex
[in]_s0the first vertex iso value
[in]_v1the second vertex
[in]_s1the second vertex iso value
[in]_isoLevelthe current iso level
 All Classes Files Functions Variables