-
Notifications
You must be signed in to change notification settings - Fork 0
/
NetworkStuff.h
66 lines (48 loc) · 1.25 KB
/
NetworkStuff.h
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
#ifndef _NETWORKSTUFF_H
#define _NETWORKSTUFF_H
#include "Engine.h"
#include "Camera.h"
#include "OpenGLstuff.h"
#include "Font.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_, OpenGLstuff* openglstuff_);
~NetworkStuff();
void sendMessageToRenderServers();
void receiveMessageFromRenderServer();
private:
Camera* camera;
OpenGLstuff* openglstuff;
char* lz4Buf;
void init();
void determineNumBytesToReceive();
bool determineIfThisFrameShouldBeRendered(int i);
void sendInitPackets();
void receiveMessageFromRenderServerETC1();
void receiveMessageFromRenderServerETC1NoRect();
void receiveMessageFromRenderServerETC1Rect();
unsigned int numBytesToReceive;
int serverLastRendered;
int framesToWait;
clientMessage msgBufferSend;
void initMsgBufferSend();
};
#endif