SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CommonNetStructures.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 
10 #include <glm/vec3.hpp>
11 #include <glm/mat4x3.hpp>
12 #include "BitStream.h"
14 
15 class QString;
16 
18 {
19 public:
20  TransformStruct(const glm::vec3 &a,const glm::vec3 &b,const glm::vec3 &c,bool set1,bool set2,bool set3) :
21  v1(a),v2(b),v3(c),v1_set(set1),v2_set(set2),v3_set(set3)
22  {
23  }
25  glm::vec3 v1;
26  glm::vec3 v2;
27  glm::vec3 v3;
29 };
30 
35 {
36 public:
37  virtual void packColor(uint32_t c,BitStream &into) const=0;
38  virtual void unpackColor(BitStream &from,uint32_t &tgt) const =0;
39  virtual void packPartname(const QString &c,BitStream &into) const =0;
40  virtual void unpackPartname(BitStream &from,QString &tgt) const =0;
41 };
42 extern void storeBitsConditional(BitStream &bs, uint8_t numbits, int bits);
43 extern int getBitsConditional(BitStream &bs, uint32_t numbits);
44 extern void storePackedBitsConditional(BitStream &bs, uint8_t numbits, int bits);
45 extern void storeFloatConditional(BitStream &bs,float val);
46 extern void storeFloatPacked(BitStream &bs,float val);
47 extern int getPackedBitsConditional(BitStream &bs, uint8_t numbits);
48 extern void storeStringConditional(BitStream &bs, const QString &str);
49 extern void storeVector(BitStream &bs, glm::vec3 &vec);
50 extern void storeVectorConditional(BitStream &bs, glm::vec3 &vec);
51 extern void storeTransformMatrix(BitStream &tgt,const glm::mat4x3 &src);
52 extern void storeTransformMatrix(BitStream &tgt,const TransformStruct &src);
53 extern void getTransformMatrix(BitStream &bs,glm::mat4x3 &src);
54 extern void storeCached_Color(BitStream &bs, uint32_t col, ColorHash &color_hash, uint32_t bitcount);
55 extern void storeCached_String(BitStream &bs, const QString &str,const StringHash &string_hash, uint32_t bitc);
56 extern uint32_t getCached_Color(BitStream &bs,ColorHash &color_hash, uint32_t bitcount);
57 extern QString getCached_String(BitStream &bs, const StringHash &string_hash, uint32_t bitcount);
The ColorAndPartPacker class is responsible for packing/unpacking colors and part names from BitStrea...
Definition: CommonNetStructures.h:34
Definition: CoXHash.h:198
glm::vec3 v2
Definition: CommonNetStructures.h:26
bool v1_set
Definition: CommonNetStructures.h:28
void storeTransformMatrix(BitStream &tgt, const glm::mat4x3 &src)
Definition: CommonNetStructures.cpp:87
virtual void unpackColor(BitStream &from, uint32_t &tgt) const =0
int getBitsConditional(BitStream &bs, uint32_t numbits)
Definition: CommonNetStructures.cpp:28
Definition: CoXHash.h:160
void storeFloatPacked(BitStream &bs, float val)
Definition: CommonNetStructures.cpp:65
int getPackedBitsConditional(BitStream &bs, uint8_t numbits)
Definition: CommonNetStructures.cpp:71
Definition: BitStream.h:30
virtual void packPartname(const QString &c, BitStream &into) const =0
bool v2_set
Definition: CommonNetStructures.h:28
void storeCached_String(BitStream &bs, const QString &str, const StringHash &string_hash, uint32_t bitc)
QString getCached_String(BitStream &bs, const StringHash &string_hash, uint32_t bitcount)
void storePackedBitsConditional(BitStream &bs, uint8_t numbits, int bits)
Definition: CommonNetStructures.cpp:37
void getTransformMatrix(BitStream &bs, glm::mat4x3 &src)
Definition: CommonNetStructures.cpp:116
void storeBitsConditional(BitStream &bs, uint8_t numbits, int bits)
Definition: CommonNetStructures.cpp:21
void storeFloatConditional(BitStream &bs, float val)
Definition: CommonNetStructures.cpp:58
glm::vec3 v1
Definition: CommonNetStructures.h:25
void storeVectorConditional(BitStream &bs, glm::vec3 &vec)
Definition: CommonNetStructures.cpp:51
uint32_t getCached_Color(BitStream &bs, ColorHash &color_hash, uint32_t bitcount)
Definition: CommonNetStructures.h:17
void storeStringConditional(BitStream &bs, const QString &str)
Definition: CommonNetStructures.cpp:80
TransformStruct()
Definition: CommonNetStructures.h:24
void storeVector(BitStream &bs, glm::vec3 &vec)
Definition: CommonNetStructures.cpp:44
virtual void packColor(uint32_t c, BitStream &into) const =0
TransformStruct(const glm::vec3 &a, const glm::vec3 &b, const glm::vec3 &c, bool set1, bool set2, bool set3)
Definition: CommonNetStructures.h:20
glm::vec3 v3
Definition: CommonNetStructures.h:27
bool v3_set
Definition: CommonNetStructures.h:28
virtual void unpackPartname(BitStream &from, QString &tgt) const =0
void storeCached_Color(BitStream &bs, uint32_t col, ColorHash &color_hash, uint32_t bitcount)