-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetworkStuff.h
More file actions
63 lines (45 loc) · 1.13 KB
/
NetworkStuff.h
File metadata and controls
63 lines (45 loc) · 1.13 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
#ifndef _NETWORKSTUFF_H
#define _NETWORKSTUFF_H
#include "Engine.h"
#include "SDLstuff.h"
#include "Camera.h"
#include "RT_RayTracer.h"
using namespace std;
struct clientMessage{
int magic;
int clientMessageLength;
int protocolVersion;
CVector3 cameraPosition;
CVector3 cameraView;
CVector3 cameraUp;
int screenWidthRT;
int screenHeightRT;
int rectLeft;
int rectTop;
int rectRight;
int rectBottom;
float currentTime;
int frameNr;
bool doExit;
};
class NetworkStuff {
public:
NetworkStuff(Camera* camera_, RT_RayTracer* rayTracer);
~NetworkStuff();
void shutdown();
void sendMessageToGameClient();
void receiveMessageFromGameClient();
private:
Camera* camera;
RT_RayTracer* rayTracer;
unsigned char* outputBuffer;
unsigned char* frameBufferCopy;
char* lz4Buf;
int numBytesToSend;
void init();
void determineNumBytesToSend();
void receiveInitPacket();
void sendMessageToGameClientETC1noThread();
void copyRect(unsigned char* copiedBuffer, unsigned char* frameBuffer);
};
#endif