Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
view.h
Go to the documentation of this file.
1/** @file view.h
2 */
3/**
4# Basilisk View
5
6This module defines functions which compute various graphical
7representations ("drawings") of Basilisk fields, including
8reconstructed Volume-Of-Fluid facets and colorscale representations of
9cross-sections of scalar fields. These representations are rendered
10using [OpenGL](https://en.wikipedia.org/wiki/OpenGL) and can be saved
11in various formats (PPM, Gnuplot, OBJ, KML, PDF, SVG etc.).
12
13## Installation
14
15In contrast with other Basilisk modules, this module relies on
16additional libraries which needs to be installed and linked with the
17Basilisk program. See [INSTALL#visualisation]() for instructions.
18
19## Usage
20
21A simple example would look like:
22
23~~~literatec
24...
25#include "view.h"
26...
27/** @brief Event: image (t = 1) */
28void event_image (void) {
29 clear();
30 draw_vof ("f");
31 box();
32 save ("image.ppm");
33}
34~~~
35
38in [PPM](https://en.wikipedia.org/wiki/Netpbm_format) format. See
40
43
44~~~bash
46~~~
47
49
50~~~bash
52~~~
53
55
58
61#include <gl/utils.h>
63
64#include "utils.h"
65#include "input.h"
66
67/**
68## A cache of "compiled" expressions
69
70The cache has a maximum size and least-used expressions are discarded
71first. */
72
77
78static scalar get_cexpr (cexpr * cache, const char * expr)
79{
80 cexpr * c = cache;
81 while (c->expr) {
82 if (!strcmp (c->expr, expr)) {
83 // move this expression to the top of the cache.
84 // the "top" is the last element.
85 cexpr tmp = *c;
86 while ((c + 1)->expr)
87 *c = *(c + 1), c++;
88 *c = tmp;
89 return c->s;
90 }
91 c++;
92 }
93 return (scalar){-1};
94}
95
96static cexpr * add_cexpr (cexpr * cache, int maxlen,
97 const char * expr, scalar s)
98{
99 cexpr * c = cache;
100 while (c->expr) c++;
101 int len = c - cache;
102 if (len < maxlen) {
103 cache = realloc (cache, sizeof(cexpr)*(len + 2));
104 c = &cache[len];
105 }
106 else {
107 // discard first expression
108 c = cache;
109 free (c->expr);
110 scalar s = c->s;
111 delete ({s});
112 // shift remaining expressions
113 while ((c + 1)->expr)
114 *c = *(c + 1), c++;
115 }
116 c->expr = strdup (expr);
117 c->s = s;
118 (c + 1)->expr = NULL;
119 return cache;
120}
121
122static void free_cexpr (cexpr * cache)
123{
124 cexpr * c = cache;
125 while (c->expr) {
126 free (c->expr);
127 scalar s = c->s;
128 delete ({s});
129 c++;
130 }
131 free (cache);
132}
133
134/**
135## The *bview* class
136
137Contains the definition of the current view. */
138
139typedef void (* MapFunc) (coord *);
140
141struct _bview {
142 float tx, ty, sx, sy, sz;
143 float quat[4];
144 float fov;
145 float tz, near, far;
146
147 bool gfsview; // rotate axis to match gfsview
148 bool reversed; // reverse normals
149
150 float bg[3];
151 float lc;
152 float res;
153
154 unsigned width, height, samples;
155
156 int maxlevel; // the maximum level to draw
157
159 Frustum frustum; // the view frustum
160
161 MapFunc map; // an optional mapping function
162
163 int ni; // number of items drawn
164
165 bool active;
166
167 cexpr * cache; // a cache of compiled expressions
168 int maxlen; // the maximum number of cached expressions
169};
170
171typedef struct _bview bview;
172
173/**
174The allocator method. */
175
177{
178 bview * p = qcalloc (1, bview);
179
180 p->tx = p->ty = 0;
181 p->sx = p->sy = p->sz = 1.;
182 p->quat[0] = p->quat[1] = p->quat[2] = 0; p->quat[3] = 1;
183 p->fov = 24.;
184 gl_trackball (p->quat, 0.0, 0.0, 0.0, 0.0);
185
186#if dimension <= 2
187 p->bg[0] = 1; p->bg[1] = 1; p->bg[2] = 1;
188#else
189 p->bg[0] = 0.3; p->bg[1] = 0.4; p->bg[2] = 0.6;
190#endif
191 p->res = 1.;
192 p->lc = 0.004;
193
194 p->samples = 4;
195 p->width = 600*p->samples, p->height = 600*p->samples;
196 p->maxlevel = -1;
197
198 /* OpenGL somehow generates floating-point exceptions... turn them off */
200
201 p->fb = framebuffer_new (p->width, p->height);
202
203 init_gl();
204 p->active = false;
205
207
208 return p;
209}
210
211/**
212The destructor method. */
213
215{
217 if (p->cache)
218 free_cexpr (p->cache);
219 free (p);
220}
221
222/**
223For the moment there is a single (static) current view. */
224
225static bview * _view = NULL;
226
227/**
228The current view needs to be destroyed when we exit Basilisk. This is
229done by adding this callback to the free_solver() lists of
230destructors. */
231
232static void destroy_view()
233{
234 assert (_view);
236}
237
239 if (!_view) {
240 _view = bview_new();
242 }
243 return _view;
244}
245
246/**
247The main drawing function. */
248
249static void redraw (bool clear = true) {
250 bview * view = get_view();
251
252 /* OpenGL somehow generates floating-point exceptions... turn them off */
254
257
258 if (view->far <= view->near) { // "traditional" camera parameters
259 double max = 2.;
260 gl_perspective (view->fov, view->width/(float)view->height, 1., 1. + 2.*max);
261
264 glTranslatef (view->tx, view->ty, - (1. + max));
265 }
266 else { // camera parameters compatible with interactive Basilisk View
267 gl_perspective (view->fov, view->width/(float)view->height,
268 view->near, view->far);
269
272 glTranslatef (view->tx, view->ty, view->tz);
273 }
274
275 GLfloat m[4][4];
276 gl_build_rotmatrix (m, view->quat);
277 glMultMatrixf (&m[0][0]);
278
279 if (view->gfsview) { // rotate to match gfsview parameters
280 m[0][0] = 0., m[0][1] = 0., m[0][2] = -1.;
281 m[1][0] = 0., m[1][1] = -1., m[1][2] = 0.;
282 m[2][0] = 1., m[2][1] = 0., m[2][2] = 0.;
283 glMultMatrixf (&m[0][0]);
284 }
285
286 glScalef (view->sx/L0, view->sy/L0, view->sz/L0);
287
288 if (clear) {
289 glClearColor (view->bg[0], view->bg[1], view->bg[2], 0.);
291 }
292
293 gl_get_frustum (&view->frustum);
294
295 view->active = true;
296 view->ni = 0;
297}
298
299/**
300This is called by graphics primitives before drawing. */
301
303 bview * view = get_view();
304 if (!view->active)
305 redraw();
306 else
307 /* OpenGL somehow generates floating-point exceptions... turn them off
308 See also: https://bugs.freedesktop.org/show_bug.cgi?id=108856 */
311 glTranslatef (0, 0, - 1e-4); // next object is drawn below the current one
312 return view;
313}
314
315/**
316## Helper function for parallel image composition
317
318compose_image() returns an image buffer made by composition of the
319framebuffer images on each of the MPI processes. */
320
321typedef void * pointer; // fixme: trace is confused by pointers
322
323#if !_MPI
324trace
326 return framebuffer_image((view)->fb);
327}
328#else // _MPI
329#if dimension <= 2
330typedef struct {
331 GLubyte a[4];
332} RGBA;
333
334static void compose_image_op (void * pin, void * pout, int * len,
336{
337 RGBA * rin = pin, * out = pout;
338 for (int i = 0; i < *len; i++,rin++,out++)
339 if (out->a[3] == 0)
340 *out = *rin;
341}
342
343trace
345{
346 unsigned char * image = framebuffer_image (view->fb);
347 assert (image);
348 if (npe() > 1) {
349 MPI_Op op;
354 int size = view->width*view->height;
355 if (pid() == 0)
357 else
359 MPI_Op_free (&op);
361 }
362 return image;
363}
364#else /* 3D */
365typedef struct {
366 GLubyte a[4];
367 float depth;
368} RGBA;
369
370static void compose_image_op (void * pin, void * pout, int * len,
372{
373 RGBA * rin = pin, * out = pout;
374 for (int i = 0; i < *len; i++,rin++,out++)
375 if (out->depth > rin->depth)
376 *out = *rin;
377}
378
379trace
381{
382 unsigned char * image = framebuffer_image (view->fb);
383 assert (image);
384 if (npe() > 1) {
385 MPI_Op op;
389 (int[]){4,1},
390 (MPI_Aint[]){0,4},
392 &rgba);
394 float * depth = framebuffer_depth (view->fb);
395 int size = view->width*view->height;
396 RGBA * buf = malloc (size*sizeof(RGBA));
397 unsigned char * ptr = image;
398 float * dptr = depth;
399 for (int i = 0; i < size; i++) {
400 for (int j = 0; j < 4; j++)
401 buf[i].a[j] = *ptr++;
402 buf[i].depth = *dptr++;
403 }
404 if (pid() == 0) {
406 unsigned char * ptr = image;
407 for (int i = 0; i < size; i++)
408 for (int j = 0; j < 4; j++)
409 *ptr++ = buf[i].a[j];
410 }
411 else
413 free (buf);
414 MPI_Op_free (&op);
416 }
417 return image;
418}
419#endif /* 3D */
420#endif /* _MPI */
421
422#include "vertexbuffer.h"
423
424/**
425# User functions
426
427Drawing user functions are defined in [draw.h](). */
428
429#include "draw.h"
430
431/**
432## *load()*: read drawing commands from a file or buffer
433
434The commands are calls of user functions. They can be read from a
435file defined by *fp* or *file*, or from the memory buffer *buf*.
436
437Besides the *load()*, *save()* and drawing functions defined in
438[draw.h](), valid drawing commands also include:
439
440* [*restore()*](output.h#dump-basilisk-snapshots)
441* [*dump()*](output.h#dump-basilisk-snapshots)
442* [*input_gfs()*](input.h#input_gfs-gerris-simulation-format)
443*/
444
445bool load (FILE * fp = NULL, char * file = NULL, Array * buf = NULL);
446
447static void bview_draw (bview * view)
448{
449 if (!view->active)
450 return;
451 view->active = false;
452 glFinish ();
454}
455
456/**
457## *save()*: saves drawing to a file in various formats
458
459The file to write to is given either using its name *file* or the file
460pointer *fp*. If neither is specified, the default is *stdout*.
461
462If *file* is used, options for 'convert' or 'ffmpeg' can be given in
463*opt*.
464
465The format to use is given either explicitly using *format*, or, if a
466*file* name is given, using the file name extension (i.e. *.ppm*,
467*.bv*, etc.). If neither is specified, the default is "ppm".
468
469For vector graphics, the base line width can be specified using
470*lw*. The default is one.
471
472The recognised file formats are:
473
474* "ppm": [Portable PixMap](https://en.wikipedia.org/wiki/Netpbm_format)
475 format. A basic uncompressed image format.
476* "png", "jpg": Compressed image formats. Will only work if the
477 *convert* command from
478 [ImageMagick](http://imagemagick.org) is installed on
479 the system.
480* "mp4", "gif", "ogv": Compressed animation formats. Will only work if
481 [ffmpeg](https://www.ffmpeg.org) is installed on
482 the system.
483
484The following formats are no longer supported, but this could be fixed
485later:
486
487* "bv": Basilisk View format. Saves all Basilisk function calls necessary to
488 reproduce the figure. Use together with
489 [load()](view.h#load-read-drawing-commands-from-a-file-or-buffer).
490* "gnu": Gnuplot format. Saves a vector graphics (3D) representation
491 of the objects.
492* "obj": [Wavefront 3D object format](https://en.wikipedia.org/wiki/Wavefront_.obj_file). Can be read by a number of 3D visualisation tools.
493* "kml": [Keyhole Markup Language](https://en.wikipedia.org/wiki/Keyhole_Markup_Language). Can be used with Google Earth and other [GIS](https://en.wikipedia.org/wiki/Geographic_information_system).
494* "ps", "eps", "tex", "pdf", "svg", "pgf": the various
495 [vector graphics](https://en.wikipedia.org/wiki/Vector_graphics)
496 formats supported by [gl2ps](http://www.geuz.org/gl2ps).
497
498Note that MPI-parallel output is only implemented for the "ppm" format
499at the moment. Other animation and image formats will be automatically
500converted to PPM when using MPI. */
501
502trace
503bool save (char * file = NULL, char * format = "ppm", char * opt = NULL,
504 FILE * fp = NULL,
505 float lw = 0,
506 int sort = 0, int options = 0,
507 FILE * checksum = NULL,
508
509 bview * view = NULL)
510{
511 if (file) {
512 char * s = strchr (file, '.'), * dot = s;
513 while (s) {
514 dot = s;
515 s = strchr (s + 1, '.');
516 }
517 if (dot)
518 format = dot + 1;
519 }
520
521 if (!view)
522 view = get_view();
523
524 if ((!strcmp (format, "png") && which ("convert")) ||
525 !strcmp (format, "jpg") ||
526 (file && is_animation (file))) {
528 unsigned char * image = (unsigned char *) compose_image (view);
529 if (pid() == 0) {
530 FILE * fp = open_image (file, opt);
531 if (!fp) {
532 perror (file);
533 return false;
534 }
535 gl_write_image (fp, image, view->width, view->height, view->samples);
537 if (checksum) {
540 a32_hash_add (&hash, image, view->width*view->height*4*sizeof (unsigned char));
541 fputs ("# ", checksum);
542 if (file)
543 fprintf (checksum, "%s: ", file);
544 fprintf (checksum, "checksum: %08lx\n", (unsigned long) a32_hash (&hash));
545 }
546 }
547 return true;
548 }
549
550 if (file && (fp = fopen (file, "w")) == NULL) {
551 perror (file);
552 return false;
553 }
554 if (!fp)
555 fp = stdout;
556
557 if (!strcmp (format, "ppm")) {
559 unsigned char * image = (unsigned char *) compose_image (view);
560 if (pid() == 0)
561 gl_write_image (fp, image, view->width, view->height, view->samples);
562 }
563
564 else if (!strcmp (format, "png")) {
566 unsigned char * image = (unsigned char *) compose_image (view);
567 if (pid() == 0)
568 gl_write_image_png (fp, image, view->width, view->height, view->samples);
569 }
570
571 else if (!strcmp (format, "bv")) {
572#if 1 // fixme: not implemented yet
573 fprintf (ferr, "save(): error: the '%s' format is no longer supported\n",
574 format);
575#else
576 assert (history);
577 fprintf (fp,
578 "view (fov = %g, quat = {%g,%g,%g,%g}, "
579 "tx = %g, ty = %g, "
580 "bg = {%g,%g,%g}, "
581 "width = %d, height = %d, samples = %d"
582 ");\n",
583 view->fov,
584 view->quat[0], view->quat[1], view->quat[2], view->quat[3],
585 view->tx, view->ty,
586 view->bg[0], view->bg[1], view->bg[2],
587 view->width/view->samples, view->height/view->samples,
588 view->samples);
589 fwrite (history->p, 1, history->len, fp);
590#endif
591 }
592
593 else if (!strcmp (format, "gnu") ||
594 !strcmp (format, "obj") ||
595 !strcmp (format, "kml") ||
596 !strcmp (format, "ps") ||
597 !strcmp (format, "eps") ||
598 !strcmp (format, "tex") ||
599 !strcmp (format, "pdf") ||
600 !strcmp (format, "svg") ||
601 !strcmp (format, "pgf"))
602 fprintf (ferr, "save(): error: the '%s' format is no longer supported\n",
603 format);
604
605 else {
606 fprintf (ferr, "save(): unknown format '%s'\n", format);
607 if (file) {
608 fclose (fp);
609 remove (file);
610 }
611 return false;
612 }
613
614 fflush (fp);
615 if (file)
616 fclose (fp);
617
618 return true;
619}
620
621/**
622## Implementation of the *load()* function.
623
624The functions below parse a text file and perform the corresponding
625function calls. */
626
627static char * remove_blanks (char * line)
628{
629 while (strchr (" \t", *line)) line++;
630 char * s = line, * cur = line;
631 bool instring = false;
632 while (*s != '\0' && *s != '#') {
633 if (*s == '"')
635 if (instring || !strchr (" \t", *s))
636 *cur++ = *s;
637 s++;
638 }
639 *cur = '\0';
640 return line;
641}
642
643#include "parse.h"
644
645bool process_line (char * line)
646{
647 if (line[0] == '\0')
648 return true;
649 char * s = mystrtok (remove_blanks (line), "(");
650 if (!s)
651 return true;
652
653 if (!strcmp (s, "restore")) {
654 char * file = NULL;
655 parse_params ((Params[]){{"file", pstring, &file}, {NULL}});
656 if (file) {
657 bview * view = get_view();
658 if (view->cache) {
659 free_cexpr (view->cache);
660 view->cache = calloc (1, sizeof (cexpr));
661 }
662 if (!restore (file = file, list = all))
663 fprintf (ferr, "could not restore from '%s'\n", file);
664 else {
666 fields_stats();
667 clear();
668 }
669 }
670 }
671
672 else if (!strcmp (s, "dump")) {
673 char * file = NULL;
674 parse_params ((Params[]){{"file", pstring, &file}, {NULL}});
675 dump (file = file);
676 }
677
678 else if (!strcmp (s, "input_gfs")) {
679 char * file = NULL;
680 parse_params ((Params[]){{"file", pstring, &file}, {NULL}});
681 if (file) {
682 input_gfs (file = file, list = all);
684 fields_stats();
685 clear();
686 }
687 }
688
689 else if (!strcmp (s, "save")) {
690 char * file = NULL;
691 parse_params ((Params[]){{"file", pstring, &file}, {NULL}});
692 if (file)
693 save (file = file);
694 }
695
696 else if (!strcmp (s, "load")) {
697 char * file = NULL;
698 parse_params ((Params[]){{"file", pstring, &file}, {NULL}});
699 if (file)
700 load (file = file);
701 }
702
703 /**
704 The [draw_get.h]() file is generated automatically by [params.awk]()
705 and contains parsing commands for the functions defined in
706 [draw.h](). */
707
708 #include "draw_get.h"
709
710 else if (!strcmp (s, "clear"))
711 clear();
712
713 else if (s[0] != '\n' && s[0] != '\0')
714 fprintf (ferr, "load(): syntax error: '%s'\n", s);
715
716 return true;
717}
718
719bool load (FILE * fp = NULL, char * file = NULL, Array * buf = NULL)
720{
721 if (file) {
722 fp = fopen (file, "r");
723 if (!fp) {
724 perror (file);
725 return false;
726 }
727 }
728
729 if (fp) { // read lines from file
730 char line[256];
731 while (fgets (line, 256, fp) && process_line (line));
732 }
733 else if (buf) { // read lines from buffer
734 int i = 0;
735 char * s = (char *) buf->p;
736 while (i < buf->len) {
737 char * start = s;
738 while (i < buf->len && *s != '\n')
739 s++, i++;
740 if (*s == '\n' && ++s > start) {
741 char line[s - start + 1];
742 strncpy (line, start, s - start);
743 line[s - start] = '\0';
745 }
746 }
747 }
748 return true;
749}
vector g[]
We store the combined pressure gradient and acceleration field in g*.
Definition all-mach.h:65
const vector a
Definition all-mach.h:59
scalar h[]
Definition atmosphere.h:6
int npe
Definition balance.h:195
define m((k)==0 &&(l)==0 &&(m)==0) macro2 foreach_point(double _x=0.
free(list1)
define VT _attribute[s.i] v y scalar * list
Definition cartesian.h:276
int x
Definition common.h:76
void free_solver_func_add(free_solver_func func)
Definition common.h:512
scalar * all
Definition common.h:342
double L0
Definition common.h:36
static uint32_t a32_hash(const Adler32Hash *hash)
Definition common.h:608
static void a32_hash_add(Adler32Hash *hash, const void *data, size_t size)
Definition common.h:600
static void a32_hash_init(Adler32Hash *hash)
Definition common.h:594
#define p
Definition tree.h:320
if __APPLE__ include< stdint.h > include fp_osx h endif if _GPU define enable_fpe(flags) @else @ define enable_fpe(flags) feenableexcept(flags) @endif @ define disable_fpe(flags) fedisableexcept(flags) static void set_fpe(void)
Definition config.h:603
#define qcalloc(size, type)
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line calloc(n, s) @ define prealloc(p
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line line line line op define op
Definition config.h:573
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define file
Definition config.h:120
#define assert(a)
Definition config.h:107
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line line realloc(p, s) @ define pfree(p
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line line line line strdup(s) @ define tracing(...) @ define end_tracing(...) @define tid() 0 @define pid() 0 @define npe() 1 @define mpi_all_reduce(v
coord o
Definition curvature.h:672
void view(float tx=0., float ty=0., float fov=0., float quat[4]={0}, float sx=1., float sy=1., float sz=1., unsigned width=800, unsigned height=800, unsigned samples=4, float bg[3]={0}, float theta=0., float phi=0., float psi=0., bool relative=false, float tz=0., float near=0., float far=0., float res=0., char *camera=NULL, MapFunc map=NULL, int cache=0, float p1x=0., float p1y=0., float p2x=0., float p2y=0., bview *view1=NULL)
Definition draw.h:52
trace bool draw_vof(char *c, char *s=NULL, bool edges=false, double larger=0., int filled=0, char *color=NULL, double min=0, double max=0, double spread=0, bool linear=false, Colormap map=jet, float fc[3]={0}, float lc[3]={0}, float lw=1., bool expr=false, bool cbar=false, float size=15, float pos[2]={-.95, -.95}, char *label="", double lscale=1, bool horizontal=false, bool border=false, bool mid=false, float fsize=50, char *format="%g", int levels=50)
Definition draw.h:897
trace bool box(bool notics=false, float lc[3]={0}, float lw=1.)
Definition draw.h:1397
void clear()
Definition draw.h:14
scalar s
Definition embed-tree.h:56
*cs[i, 0, 0] a *[i -1, 0, 0] j
Definition embed.h:88
bool defined
Definition embed.h:384
scalar int i
Definition embed.h:74
static int line
Definition errors.c:754
#define glClearColor
Definition glad.h:1921
#define glTranslatef
Definition glad.h:2791
khronos_uint8_t GLubyte
Definition glad.h:97
#define glMultMatrixf
Definition glad.h:2761
#define glFinish
Definition glad.h:1945
khronos_float_t GLfloat
Definition glad.h:104
#define GL_PROJECTION
Definition glad.h:522
#define GL_MODELVIEW
Definition glad.h:521
#define GL_COLOR_BUFFER_BIT
Definition glad.h:140
#define glMatrixMode
Definition glad.h:2758
#define glScalef
Definition glad.h:2785
#define glLoadIdentity
Definition glad.h:2749
#define GL_DEPTH_BUFFER_BIT
Definition glad.h:138
#define glClear
Definition glad.h:1918
#define depth()
Definition cartesian.h:14
static int include(char *file, FILE *fin, FILE *fout)
Definition include.c:2801
trace void input_gfs(FILE *fp=stdin, scalar *list=NULL, char *file=NULL)
Definition input.h:159
size_t max
Definition mtrace.h:8
FILE * fp
Definition mtrace.h:7
void(* restriction)(Point, scalar)
size_t size
size *double * buf
FILE * open_image(const char *file, const char *options)
Definition output.h:428
static bool which(const char *command)
Definition output.h:389
static const char * is_animation(const char *file)
Definition output.h:353
void close_image(const char *file, FILE *fp)
Definition output.h:508
static char * mystrtok(char *str, const char *delim)
Definition parse.h:140
@ pstring
Definition parse.h:7
int parse_params(Params *params)
Definition parse.h:158
static char * autolink
Definition postproc.c:856
Definition array.h:5
Definition parse.h:9
Definition view.h:141
float sx
Definition view.h:142
bool reversed
Definition view.h:148
int maxlen
Definition view.h:168
float sz
Definition view.h:142
float near
Definition view.h:145
bool gfsview
Definition view.h:147
int ni
Definition view.h:163
float res
Definition view.h:152
float quat[4]
Definition view.h:143
float ty
Definition view.h:142
unsigned samples
Definition view.h:154
Frustum frustum
Definition view.h:159
float fov
Definition view.h:144
float tz
Definition view.h:145
unsigned height
Definition view.h:154
float far
Definition view.h:145
framebuffer * fb
Definition view.h:158
float sy
Definition view.h:142
cexpr * cache
Definition view.h:167
float tx
Definition view.h:142
int maxlevel
Definition view.h:156
MapFunc map
Definition view.h:161
unsigned width
Definition view.h:154
float bg[3]
Definition view.h:150
float lc
Definition view.h:151
bool active
Definition view.h:165
Definition view.h:73
scalar s
Definition view.h:75
Definition common.h:78
define n sizeof(Cell))) @define fine(a
@ user
Definition tree.h:63
void fields_stats(scalar *list=all)
This function returns a summary of the currently-defined fields.
Definition utils.h:382
static void bview_draw(bview *view)
Definition view.h:447
trace bool save(char *file=NULL, char *format="ppm", char *opt=NULL, FILE *fp=NULL, float lw=0, int sort=0, int options=0, FILE *checksum=NULL, bview *view=NULL)
Definition view.h:503
static bview * _view
For the moment there is a single (static) current view.
Definition view.h:225
bview * draw()
This is called by graphics primitives before drawing.
Definition view.h:302
static void destroy_view()
The current view needs to be destroyed when we exit Basilisk.
Definition view.h:232
static void redraw(bool clear=true)
The main drawing function.
Definition view.h:249
static cexpr * add_cexpr(cexpr *cache, int maxlen, const char *expr, scalar s)
Definition view.h:96
void * pointer
Definition view.h:321
static char * remove_blanks(char *line)
Definition view.h:627
bview * get_view()
Definition view.h:238
static scalar get_cexpr(cexpr *cache, const char *expr)
Definition view.h:78
void bview_destroy(bview *p)
The destructor method.
Definition view.h:214
static trace pointer compose_image(bview *view)
Definition view.h:325
static void free_cexpr(cexpr *cache)
Definition view.h:122
bool load(FILE *fp=NULL, char *file=NULL, Array *buf=NULL)
Definition view.h:719
bool process_line(char *line)
Definition view.h:645
void(* MapFunc)(coord *)
Definition view.h:139
bview * bview_new()
The allocator method.
Definition view.h:176
scalar c
Definition vof.h:57
src vof fflush(ferr)