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
|
//
// ofxHelios.cpp
//
//
// Created by Tim Redfern Nov 2017
//
//
#include "ofxHelios.h"
/*
draw a colourpolyline
put in mid points
draw a vector of lines
put in dwell points
*/
int ofxHelios::draw(vector <ofPolyline> &points,ofColor colour,int intensity){
return 0;
}
int ofxHelios::draw(ofPolyline &line,ofColor colour,int intensity){
colourPolyline col=colourPolyline(line,colour);
return draw(col);
}
int ofxHelios::draw(colourPolyline &line, int intensity){
//todo: move to a thread
//todo: add a transform
//POC
int xoffs=0x800-(ofGetWidth()/2);
int yoffs=0x800-(ofGetHeight()/2);
if (device!=OFXHELIOS_NODEVICE){
while (!dac.GetStatus(device)); //timeout for this?
//assemble data
HeliosPoint points[line.size()];
for (int i=0;i<line.size();i++){
points[i]=HeliosPoint(
{
(uint16_t)(line[i].x+xoffs),
(uint16_t)(line[i].y+yoffs),
(uint8_t)(((line.getColourAt(i).r)*laserintensity)>>8),
(uint8_t)(((line.getColourAt(i).g)*laserintensity)>>8),
(uint8_t)(((line.getColourAt(i).b)*laserintensity)>>8),
(uint8_t)intensity
});
}
if (HELIOS_ERROR==dac.WriteFrame(device, pps, HELIOS_FLAGS_DEFAULT, points, line.size())){
printf("ofxHelios: write error (%i,%i,%i,%i)\n",device, pps, HELIOS_FLAGS_DEFAULT, (int)line.size());
return -1;
}
}
return 0;
}
void ofxHelios::threadedFunction(){
while(isThreadRunning()) {
}
}
|