summaryrefslogtreecommitdiffstats
path: root/Smoke/streamlines.c
blob: 6bae37366e7bc089996d9239f7d4c6222e0da571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif


#include <rfftw.h>

#include "fluids.h"
#include "funcs.h"
#include "palette.h"

#include "streamlines.h"

static int streamlines_render     = FALSE;
static int streamlines_num_colors = PALETTE_MAXCOLORS;
static int streamlines_colormap   = PALETTE_BLACKWHITE;
static int streamlines_dataset    = DATASET_RHO;
static float streamlines_alpha    = 1.0f;

static fftw_real *streamlines_frame;
static fftw_real **streamlines_history;
struct fftw_real_xy *streamlines_history_scalars;

static int hisdex = 0;
 
void streamlines_set_hisdex(int arg)
{
  int idx = (fluids_get_hisdex() + 1) % HISTORY_SIZE;

  hisdex = (arg + idx) % HISTORY_SIZE;
}
 
int streamlines_get_hisdex(void)
{
  return hisdex;
}

void streamlines_set_render(int render_streamlines)
{
  streamlines_render = render_streamlines;
}

int streamlines_get_render(void)
{
  return streamlines_render;
}

void streamlines_set_num_colors(int num_colors)
{
  streamlines_num_colors = num_colors;
}

int streamlines_get_num_colors(void)
{
  return streamlines_num_colors;
}

void streamlines_set_colormap(int colormap)
{
  streamlines_colormap = colormap;
}

int streamlines_get_colormap(void)
{
  return streamlines_colormap;
}

void streamlines_set_alpha(float alpha)
{
  streamlines_alpha = alpha;
}

float streamlines_get_alpha(void)
{
  return streamlines_alpha;
}

void streamlines_set_dataset(int dataset)
{
  streamlines_dataset = dataset;
}

int streamlines_get_dataset(void)
{
  return streamlines_dataset;
}

void streamlines_set_frame(fftw_real *frame)
{
  streamlines_frame = frame;
}

fftw_real *streamlines_get_frame(void)
{
  return streamlines_frame;
}

/* rename and move to flowvis */
void streamlines_set_history(fftw_real **history)
{
  streamlines_history = history;
}

/* rename and move to flowvis */
fftw_real *streamlines_get_history(int hisdex)
{
  return streamlines_history[hisdex];
}

void streamlines_set_history_scalars(struct fftw_real_xy *history)
{
  streamlines_history_scalars = history;
}

struct fftw_real_xy *streamlines_get_history_scalars(void)
{
  return streamlines_history_scalars;
}



struct color4f streamlines_get_color(float value)
{
  struct color4f return_value;

  return_value = set_palette(streamlines_colormap, value, streamlines_num_colors);
  return_value.a = streamlines_alpha;

  return return_value;
}