Eulerian Smoke Simulation on the GPU
|
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). |
a marching cubes geometry shader
int fetchEdgeTableVal | ( | int | _i | ) |
Fetches a texel of the edge table texture.
[in] | _i | table index |
int fetchTriTableVal | ( | int | _i, |
int | _j | ||
) |
Fetches a texel of the triangulation table texture.
[in] | _i | table index |
vec3 getCubeCorner | ( | int | _index | ) |
Returns a cube's corner.
[in] | _index | The 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.
[in] | _the | vertex 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.
[in] | _v0 | the first vertex |
[in] | _s0 | the first vertex iso value |
[in] | _v1 | the second vertex |
[in] | _s1 | the second vertex iso value |
[in] | _isoLevel | the current iso level |