aboutsummaryrefslogtreecommitdiff
path: root/src/render.h
blob: dde79be893dd3927c1ce287230760d03846afdc2 (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
/*
 * render.h
 *
 *  Created on: 15.01.2018
 *      Author: Superleo1810
 */

#ifndef RENDER_H_
#define RENDER_H_

#define COORDS(x, y, width) ((y)*(width)+(x))

#include "defs.h"
#include <stdlib.h>
#include <GL/glut.h>
#include <pthread.h>
#include <math.h>

typedef struct config {
	u32 iterations;
	u8 threads;
	u32 colorFrom;
	u32 colorTo;
	long double to_x;
	long double to_y;
	long double speed;
	u8 video;
	u8 filetype;
	u16 width;
	u16 height;
	u8 renderFPS;
	u8 videoFPS;
	u32 bitrate;
	const char *path;
	// TODO: key mapping als option in die struct
} Config;

typedef struct t_args {
	u8 tc;
	u8 tid;
	long double x_min;
	long double x_max;
	long double y_min;
	long double y_max;
	u32 (*sfunc) (long double, long double, u32);
	u32 *arr;
} ThreadArgs;

Config *_config;
u32 (*_sfunc) (long double, long double, u32);
u32 *s_arr;
GLuint tex;
u32 rendercnt;
long double x_min, x_max, y_min, y_max;
long double x_min_s, x_max_s, y_min_s, y_max_s;
int delta;
long double dt, ft;

void render_init(Config *config, u32 (*sfunc) (long double, long double, u32));
void render_show();
void gl_render(void);
void gl_idle(void);

void calculate(long double x_min, long double y_min, long double x_max, long double y_max, u32 (*sfunc) (long double, long double, u32), u32 *arr);
void calculate_t(void *args);

#endif /* RENDER_H_ */