-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxlaser.h
More file actions
146 lines (133 loc) · 2.59 KB
/
xlaser.h
File metadata and controls
146 lines (133 loc) · 2.59 KB
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
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <signal.h>
#include <time.h>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include <math.h>
#define XLASER_VERSION "XLaser v1.1"
#define SHORTNAME "XLaser"
#define DMX_CHANNELS 16
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#ifdef OPENGL
#include "backend_opengl.h"
#include "shaders/shaders.h"
#elif OPENGL2
#include "backend_opengl2.h"
#include "shaders/shaders.h"
#else
#include "backend_xrender.h"
#endif
#include "xfds.h"
volatile sig_atomic_t abort_signaled = 0;
typedef struct /*_GOBO*/ {
int width;
int height;
int components;
#ifndef OPENGL
XImage* ximage;
#endif
uint8_t* data;
} GOBO_IMG;
typedef struct /*_XDATA*/ {
int screen;
Display* display;
Window main;
X_FDS xfds;
Atom wm_delete;
unsigned window_width;
unsigned window_height;
GOBO_IMG gobo[256];
struct timespec last_render;
Colormap colormap;
XVisualInfo visual_info;
backend_data backend;
} XRESOURCES;
typedef struct /*_CHANNEL_CFG*/ {
bool fixed;
bool inverted;
uint16_t source;
uint8_t min;
uint8_t max;
} CHANNEL_CONFIG;
typedef struct /*XLASER_CFG*/ {
uint16_t dmx_address;
uint8_t dmx_data[DMX_CHANNELS];
CHANNEL_CONFIG dmx_config[DMX_CHANNELS];
uint8_t art_net;
uint8_t art_subUni;
uint8_t art_universe;
bool windowed;
unsigned window_width;
unsigned window_height;
unsigned x_offset;
unsigned y_offset;
unsigned xmax;
unsigned ymax;
char* bindhost;
char* window_name;
char* gobo_prefix;
bool double_buffer;
int sockfd;
//char* backgnd_image;
//chanmap?
} CONFIG;
enum /*DMX_CHANNEL*/ {
PAN = 0,
PAN_FINE = 1,
TILT = 2,
TILT_FINE = 3,
RED = 4,
GREEN = 5,
BLUE = 6,
DIMMER = 7,
SHUTTER = 8,
GOBO = 9,
ZOOM = 10,
ROTATION = 11,
ROTATION_SPEED = 12,
FOCUS = 13,
EXPOSURE = 14,
TRACE = 15
};
const char* CHANNEL_NAME[DMX_CHANNELS] = {
[PAN] = "pan",
[PAN_FINE] = "panfine",
[TILT] = "tilt",
[TILT_FINE] = "tiltfine",
[RED] = "red",
[GREEN] = "green",
[BLUE] = "blue",
[DIMMER] = "dimmer",
[SHUTTER] = "shutter",
[GOBO] = "gobo",
[ZOOM] = "zoom",
[ROTATION] = "rotation",
[ROTATION_SPEED] = "rotationspeed",
[FOCUS] = "focus",
[EXPOSURE] = "exposure",
[TRACE] = "trace"
};
int usage(char* fn);
#include "easy_config.h"
#include "easy_config.c"
#include "easy_args.h"
#include "easy_args.c"
#include "config.c"
#include "network.c"
#include "artnet.h"
#include "artnet.c"
#include "xfds.c"
#ifdef OPENGL
#include "backend_opengl.c"
#elif OPENGL2
#include "backend_opengl2.c"
#else
#include "backend_xrender.c"
#endif
#include "x11.c"
#include "coreloop.c"