rev |
line source |
nuclear@1
|
1 metasurf - a library for implicit surface polygonization
|
nuclear@1
|
2
|
nuclear@10
|
3 http://nuclear.mutantstargoat.com/sw/metasurf
|
nuclear@9
|
4
|
nuclear@1
|
5 1. Overview
|
nuclear@1
|
6 -----------
|
nuclear@1
|
7
|
nuclear@1
|
8 Metasurf is a library for implict surface polygonization. You only need to
|
nuclear@1
|
9 set a callback that returns the scalar field value at any given point in
|
nuclear@1
|
10 3-space, and another callback to accept isosurface vertices. Then at any point
|
nuclear@1
|
11 just call msurf_polygonize, and the library handles everything else for you.
|
nuclear@1
|
12
|
nuclear@1
|
13 2. Usage
|
nuclear@1
|
14 --------
|
nuclear@2
|
15 The following snippet is sufficient to draw the surface of an implicit unit
|
nuclear@2
|
16 sphere, centered around the origin.
|
nuclear@1
|
17
|
nuclear@1
|
18 struct metasurface *ms;
|
nuclear@1
|
19
|
nuclear@1
|
20 /* initialization */
|
nuclear@1
|
21 ms = msurf_create();
|
nuclear@1
|
22 msurf_eval_func(ms, eval);
|
nuclear@1
|
23 msurf_vertex_func(ms, glVertex3f);
|
nuclear@1
|
24
|
nuclear@1
|
25 /* drawing */
|
nuclear@1
|
26 glBegin(GL_TRIANGLES);
|
nuclear@1
|
27 msurf_polygonize(ms);
|
nuclear@1
|
28 glEnd();
|
nuclear@1
|
29
|
nuclear@1
|
30 /* evaluator */
|
nuclear@1
|
31 float eval(float x, float y, float z)
|
nuclear@1
|
32 {
|
nuclear@2
|
33 return (x * x + y * y + z * z) - 1.0;
|
nuclear@1
|
34 }
|
nuclear@1
|
35
|
nuclear@1
|
36 See the examples subdirectory for more examples.
|
nuclear@1
|
37
|
nuclear@1
|
38 3. License
|
nuclear@1
|
39 ----------
|
nuclear@1
|
40 Copyright: John Tsiombikas <nuclear@member.fsf.org>
|
nuclear@1
|
41
|
nuclear@1
|
42 Metasurf is free software, you may use, modify, and redistribute it freely under
|
nuclear@1
|
43 the terms of the GNU Lesser General Public License (LGPL) v3 (or at your option,
|
nuclear@1
|
44 any later version published by the Free Software Foundation). See COPYING and
|
nuclear@1
|
45 COPYING.LESSER for more details.
|
nuclear@1
|
46
|
nuclear@1
|
47
|
nuclear@1
|
48 4. Contributions
|
nuclear@1
|
49 ----------------
|
nuclear@1
|
50 If you'd like to fix the marching tetrahedra implementation or have any other
|
nuclear@1
|
51 ideas for improving this library drop me an email at: nuclear@member.fsf.org.
|
nuclear@1
|
52 Also feel free to submit patches for bugfixes.
|