source: proiecte/SIMEO/Simeo/src/SimeoGui/GuiUpdater.h @ 167

Last change on this file since 167 was 167, checked in by (none), 14 years ago

Simeo: added final project and also older proof of concept code.

We used Git for version control, so look at the Git repo
in SIMEO/Simeo/ for more info.

File size: 1.4 KB
Line 
1#ifndef GUIUPDATER_H
2#define GUIUPDATER_H
3
4#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
5#include "BulletCollision/CollisionShapes/btCollisionShape.h"
6
7#include <vector>
8#include <map>
9
10#include <stdio.h>
11#include <string.h>
12#include <stdlib.h>
13#include <sys/types.h>
14#include <sys/socket.h>
15#include <netinet/in.h>
16#include <netdb.h>
17
18using namespace std;
19
20typedef struct {
21        int id;
22        btScalar m[16];
23        btMatrix3x3 rot;
24        btVector3 aabbMin, aabbMax;
25} guiUpdateData;
26
27typedef struct {
28        int id;
29        int numVertices;
30        int numIndices;
31        btVector3 *vertexPointer;
32        int *indexPointer;
33} guiAddData;
34
35typedef struct {
36        guiUpdateData *ud;
37        guiAddData *ad;
38} guiObject;
39
40class GuiUpdater
41{
42
43private:
44    int sockfd, portno;
45    struct sockaddr_in serv_addr;
46    struct hostent *server;
47
48        void receiveData(int sock, void* buffer, size_t size);
49
50        // unpacking data
51        void* unpackInt(void *buffer, int &a);
52        void* unpackScalar(void *buffer, btScalar &a);
53        void* unpackVector3(void *buffer, btVector3 &v);
54        void* unpackMatrix3x3(void *buffer, btMatrix3x3 &m);
55        void unpackAddData(void *buffer, int n, map<int,guiAddData *> &addObjects);
56        void unpackUpdateData(void *buffer, int n, map<int, guiUpdateData *> &updateObjects);
57
58        void applyChanges(map<int, guiAddData *> addObjects, map<int, guiUpdateData *> updateObjects, int *removeObjects, int remObjNum);
59
60public:
61        map<int, guiObject *> m_cache;
62
63        GuiUpdater(int port, hostent *serv);
64        ~GuiUpdater();
65
66        void init();
67        int update();
68};
69
70#endif
71
Note: See TracBrowser for help on using the repository browser.