aboutsummaryrefslogtreecommitdiff
path: root/src/render_cpu.h
blob: ab5076696e7fb815f09b10f9cca81faaaabe85fd (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
/*
 * render_cpu.h
 *
 *  Created on: 25.01.2018
 *      Author: Superleo1810
 */

#ifndef RENDER_CPU_H_
#define RENDER_CPU_H_

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

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

typedef struct config_cpu {
	u8 threads;
	GLuint tex;
	u32 *arr;
	d64 (*zoom_func)(d64, d64);
	u32 (*set_func)(d64, d64, u32);
	u32 iterations;
	u32 colorFrom;
	u32 colorTo;
	d64 to_x;
	d64 to_y;
	d64 speed;
	u16 width;
	u16 height;
	u8 renderFPS;
} CpuConfig;

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

CpuConfig *config_cpu;
u32 rendercnt;
float ft;
int t_old_cpu;

d64 x_min, x_max, y_min, y_max;
d64 x_min_s, x_max_s, y_min_s, y_max_s;

void init_cpu(CpuConfig *config);
void render_cpu(void);
void idle_cpu(void);
void idle_cpu_dummy(void);
void keyboard_cpu(unsigned char key, int mouseX, int mouseY);
void mouse_cpu(int button, int state, int x, int y);
void calculate(d64 x_min, d64 y_min, d64 x_max, d64 y_max, u32 (*sfunc) (d64, d64, u32), u32 *arr);
void calculate_t(void *args);

#endif /* RENDER_CPU_H_ */