summaryrefslogtreecommitdiffstats
path: root/Smoke/heightplots.c
blob: bc72c5b5bb00ad54d6052a7d5642cbf2190d2397 (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#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 "heightplots.h"


static int heightplots_render = FALSE;

static int heightplots_num_colors = PALETTE_MAXCOLORS;

static int heightplots_colormap = PALETTE_BLACKWHITE;

static float heightplots_alpha = 1.0f;

static int heightplots_dataset = DATASET_RHO;

static int heightplots_rho   = 32;
static int heightplots_vel   = 2000;
static int heightplots_force = 100;
static int heightplots_divv  = 100;
static int heightplots_divf  = 100;

static fftw_real *heightplots_frame;


void heightplots_set_render(int render_heightplots)
{
  heightplots_render = render_heightplots;
}

int heightplots_get_render(void)
{
  return heightplots_render;
}

void heightplots_set_num_colors(int num_colors)
{
  heightplots_num_colors = num_colors;
}

int heightplots_get_num_colors(void)
{
  return heightplots_num_colors;
}

void heightplots_set_colormap(int colormap)
{
  heightplots_colormap = colormap;
}

int heightplots_get_colormap(void)
{
  return heightplots_colormap;
}

void heightplots_set_alpha(float alpha)
{
  heightplots_alpha = alpha;
}

float heightplots_get_alpha(void)
{
  return heightplots_alpha;
}

void heightplots_set_dataset(int dataset)
{
  heightplots_dataset = dataset;
}

int heightplots_get_dataset(void)
{
  return heightplots_dataset;
}

void heightplots_set_height(int height)
{
  switch(heightplots_dataset) {
    case DATASET_RHO:
      heightplots_rho = height;
    break;
    case DATASET_VEL:
      heightplots_vel = height;
    break;
    case DATASET_FORCE:
      heightplots_force = height;
    break;
    case DATASET_DIVV:
      heightplots_divv = height;
    break;
    case DATASET_DIVF:
      heightplots_divf = height;
    break;
    default:
    break;
  }
}

int heightplots_get_height(void)
{
  int return_value;

  return_value = 0;

  switch(heightplots_dataset) {
    case DATASET_RHO:
      return_value = heightplots_rho;
    break;
    case DATASET_VEL:
      return_value = heightplots_vel;
    break;
    case DATASET_FORCE:
      return_value = heightplots_force;
    break;
    case DATASET_DIVV:
      return_value = heightplots_divv;
    break;
    case DATASET_DIVF:
      return_value = heightplots_divf;
    break;
    default:
    break;
  }

  return return_value;
}

void heightplots_set_frame(fftw_real *frame)
{
  heightplots_frame = frame;
}

fftw_real *heightplots_get_frame(void)
{
  return heightplots_frame;
}


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

  return_value = set_palette(heightplots_colormap, value, heightplots_num_colors);
  return_value.a = heightplots_alpha;

  return return_value;
}