more windows build hackery

This commit is contained in:
Brad Hefta-Gaub 2014-01-10 20:36:37 -08:00
parent 44893b0a8c
commit b0f8e21d06
4 changed files with 66 additions and 31 deletions

View file

@ -10,7 +10,20 @@
#define __hifi__AvatarData__ #define __hifi__AvatarData__
#include <string> #include <string>
/* VS2010 defines stdint.h, but not inttypes.h */
#if defined(_MSC_VER)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#define PRId64 "I64d"
#else
#include <inttypes.h> #include <inttypes.h>
#endif
#include <vector> #include <vector>
#include <glm/glm.hpp> #include <glm/glm.hpp>
@ -50,7 +63,7 @@ class JointData;
class AvatarData : public NodeData { class AvatarData : public NodeData {
Q_OBJECT Q_OBJECT
Q_PROPERTY(glm::vec3 position READ getPosition WRITE setPosition) Q_PROPERTY(glm::vec3 position READ getPosition WRITE setPosition)
Q_PROPERTY(glm::vec3 handPosition READ getHandPosition WRITE setHandPosition) Q_PROPERTY(glm::vec3 handPosition READ getHandPosition WRITE setHandPosition)
Q_PROPERTY(float bodyYaw READ getBodyYaw WRITE setBodyYaw) Q_PROPERTY(float bodyYaw READ getBodyYaw WRITE setBodyYaw)
@ -60,19 +73,19 @@ class AvatarData : public NodeData {
public: public:
AvatarData(Node* owningNode = NULL); AvatarData(Node* owningNode = NULL);
~AvatarData(); ~AvatarData();
const glm::vec3& getPosition() const { return _position; } const glm::vec3& getPosition() const { return _position; }
void setPosition(const glm::vec3 position) { _position = position; } void setPosition(const glm::vec3 position) { _position = position; }
const glm::vec3& getHandPosition() const { return _handPosition; } const glm::vec3& getHandPosition() const { return _handPosition; }
void setHandPosition(const glm::vec3 handPosition) { _handPosition = handPosition; } void setHandPosition(const glm::vec3 handPosition) { _handPosition = handPosition; }
int getBroadcastData(unsigned char* destinationBuffer); int getBroadcastData(unsigned char* destinationBuffer);
int parseData(unsigned char* sourceBuffer, int numBytes); int parseData(unsigned char* sourceBuffer, int numBytes);
QUuid& getUUID() { return _uuid; } QUuid& getUUID() { return _uuid; }
void setUUID(const QUuid& uuid) { _uuid = uuid; } void setUUID(const QUuid& uuid) { _uuid = uuid; }
// Body Rotation // Body Rotation
float getBodyYaw() const { return _bodyYaw; } float getBodyYaw() const { return _bodyYaw; }
void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; } void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; }
@ -80,19 +93,19 @@ public:
void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; } void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; }
float getBodyRoll() const { return _bodyRoll; } float getBodyRoll() const { return _bodyRoll; }
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; } void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
// Scale // Scale
float getNewScale() const { return _newScale; } float getNewScale() const { return _newScale; }
void setNewScale(float); void setNewScale(float);
// Hand State // Hand State
void setHandState(char s) { _handState = s; } void setHandState(char s) { _handState = s; }
char getHandState() const { return _handState; } char getHandState() const { return _handState; }
// key state // key state
void setKeyState(KeyState s) { _keyState = s; } void setKeyState(KeyState s) { _keyState = s; }
KeyState keyState() const { return _keyState; } KeyState keyState() const { return _keyState; }
// chat message // chat message
void setChatMessage(const std::string& msg) { _chatMessage = msg; } void setChatMessage(const std::string& msg) { _chatMessage = msg; }
void setChatMessage(const QString& string) { _chatMessage = string.toLocal8Bit().constData(); } void setChatMessage(const QString& string) { _chatMessage = string.toLocal8Bit().constData(); }
@ -102,7 +115,7 @@ public:
bool isChatCirclingEnabled() const { return _isChatCirclingEnabled; } bool isChatCirclingEnabled() const { return _isChatCirclingEnabled; }
const QUuid& getLeaderUUID() const { return _leaderUUID; } const QUuid& getLeaderUUID() const { return _leaderUUID; }
const HeadData* getHeadData() const { return _headData; } const HeadData* getHeadData() const { return _headData; }
const HandData* getHandData() const { return _handData; } const HandData* getHandData() const { return _handData; }
@ -119,13 +132,13 @@ public:
/// \return whether or not the sphere penetrated /// \return whether or not the sphere penetrated
virtual bool findSpherePenetration(const glm::vec3& penetratorCenter, float penetratorRadius, virtual bool findSpherePenetration(const glm::vec3& penetratorCenter, float penetratorRadius,
glm::vec3& penetration, int skeletonSkipIndex = -1) const { return false; } glm::vec3& penetration, int skeletonSkipIndex = -1) const { return false; }
protected: protected:
QUuid _uuid; QUuid _uuid;
glm::vec3 _position; glm::vec3 _position;
glm::vec3 _handPosition; glm::vec3 _handPosition;
// Body rotation // Body rotation
float _bodyYaw; float _bodyYaw;
float _bodyPitch; float _bodyPitch;
@ -139,20 +152,20 @@ protected:
// Hand state (are we grabbing something or not) // Hand state (are we grabbing something or not)
char _handState; char _handState;
// key state // key state
KeyState _keyState; KeyState _keyState;
// chat message // chat message
std::string _chatMessage; std::string _chatMessage;
bool _isChatCirclingEnabled; bool _isChatCirclingEnabled;
std::vector<JointData> _joints; std::vector<JointData> _joints;
HeadData* _headData; HeadData* _headData;
HandData* _handData; HandData* _handData;
private: private:
// privatize the copy constructor and assignment operator so they cannot be called // privatize the copy constructor and assignment operator so they cannot be called
AvatarData(const AvatarData&); AvatarData(const AvatarData&);
@ -161,7 +174,7 @@ private:
class JointData { class JointData {
public: public:
int jointID; int jointID;
glm::quat rotation; glm::quat rotation;
}; };

View file

@ -10,7 +10,23 @@
#define __hifi__OctreeQuery__ #define __hifi__OctreeQuery__
#include <string> #include <string>
/* VS2010 defines stdint.h, but not inttypes.h */
#if defined(_MSC_VER)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#define PRId64 "I64d"
#else
#include <inttypes.h> #include <inttypes.h>
#endif
#include <vector> #include <vector>
#include <glm/glm.hpp> #include <glm/glm.hpp>
@ -33,17 +49,17 @@ const int WANT_COMPRESSION = 4; // 5th bit
class OctreeQuery : public NodeData { class OctreeQuery : public NodeData {
Q_OBJECT Q_OBJECT
public: public:
OctreeQuery(Node* owningNode = NULL); OctreeQuery(Node* owningNode = NULL);
virtual ~OctreeQuery(); virtual ~OctreeQuery();
int getBroadcastData(unsigned char* destinationBuffer); int getBroadcastData(unsigned char* destinationBuffer);
int parseData(unsigned char* sourceBuffer, int numBytes); int parseData(unsigned char* sourceBuffer, int numBytes);
QUuid& getUUID() { return _uuid; } QUuid& getUUID() { return _uuid; }
void setUUID(const QUuid& uuid) { _uuid = uuid; } void setUUID(const QUuid& uuid) { _uuid = uuid; }
// getters for camera details // getters for camera details
const glm::vec3& getCameraPosition() const { return _cameraPosition; } const glm::vec3& getCameraPosition() const { return _cameraPosition; }
const glm::quat& getCameraOrientation() const { return _cameraOrientation; } const glm::quat& getCameraOrientation() const { return _cameraOrientation; }
@ -55,7 +71,7 @@ public:
glm::vec3 calculateCameraDirection() const; glm::vec3 calculateCameraDirection() const;
// setters for camera details // setters for camera details
void setCameraPosition(const glm::vec3& position) { _cameraPosition = position; } void setCameraPosition(const glm::vec3& position) { _cameraPosition = position; }
void setCameraOrientation(const glm::quat& orientation) { _cameraOrientation = orientation; } void setCameraOrientation(const glm::quat& orientation) { _cameraOrientation = orientation; }
void setCameraFov(float fov) { _cameraFov = fov; } void setCameraFov(float fov) { _cameraFov = fov; }
@ -63,7 +79,7 @@ public:
void setCameraNearClip(float nearClip) { _cameraNearClip = nearClip; } void setCameraNearClip(float nearClip) { _cameraNearClip = nearClip; }
void setCameraFarClip(float farClip) { _cameraFarClip = farClip; } void setCameraFarClip(float farClip) { _cameraFarClip = farClip; }
void setCameraEyeOffsetPosition(const glm::vec3& eyeOffsetPosition) { _cameraEyeOffsetPosition = eyeOffsetPosition; } void setCameraEyeOffsetPosition(const glm::vec3& eyeOffsetPosition) { _cameraEyeOffsetPosition = eyeOffsetPosition; }
// related to Octree Sending strategies // related to Octree Sending strategies
bool getWantColor() const { return _wantColor; } bool getWantColor() const { return _wantColor; }
bool getWantDelta() const { return _wantDelta; } bool getWantDelta() const { return _wantDelta; }
@ -73,7 +89,7 @@ public:
int getMaxOctreePacketsPerSecond() const { return _maxOctreePPS; } int getMaxOctreePacketsPerSecond() const { return _maxOctreePPS; }
float getOctreeSizeScale() const { return _octreeElementSizeScale; } float getOctreeSizeScale() const { return _octreeElementSizeScale; }
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; } int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
public slots: public slots:
void setWantLowResMoving(bool wantLowResMoving) { _wantLowResMoving = wantLowResMoving; } void setWantLowResMoving(bool wantLowResMoving) { _wantLowResMoving = wantLowResMoving; }
void setWantColor(bool wantColor) { _wantColor = wantColor; } void setWantColor(bool wantColor) { _wantColor = wantColor; }
@ -83,10 +99,10 @@ public slots:
void setMaxOctreePacketsPerSecond(int maxOctreePPS) { _maxOctreePPS = maxOctreePPS; } void setMaxOctreePacketsPerSecond(int maxOctreePPS) { _maxOctreePPS = maxOctreePPS; }
void setOctreeSizeScale(float octreeSizeScale) { _octreeElementSizeScale = octreeSizeScale; } void setOctreeSizeScale(float octreeSizeScale) { _octreeElementSizeScale = octreeSizeScale; }
void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; } void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; }
protected: protected:
QUuid _uuid; QUuid _uuid;
// camera details for the avatar // camera details for the avatar
glm::vec3 _cameraPosition; glm::vec3 _cameraPosition;
glm::quat _cameraOrientation; glm::quat _cameraOrientation;
@ -95,7 +111,7 @@ protected:
float _cameraNearClip; float _cameraNearClip;
float _cameraFarClip; float _cameraFarClip;
glm::vec3 _cameraEyeOffsetPosition; glm::vec3 _cameraEyeOffsetPosition;
// octree server sending items // octree server sending items
bool _wantColor; bool _wantColor;
bool _wantDelta; bool _wantDelta;
@ -105,7 +121,7 @@ protected:
int _maxOctreePPS; int _maxOctreePPS;
float _octreeElementSizeScale; /// used for LOD calculations float _octreeElementSizeScale; /// used for LOD calculations
int _boundaryLevelAdjust; /// used for LOD calculations int _boundaryLevelAdjust; /// used for LOD calculations
private: private:
// privatize the copy constructor and assignment operator so they cannot be called // privatize the copy constructor and assignment operator so they cannot be called
OctreeQuery(const OctreeQuery&); OctreeQuery(const OctreeQuery&);

View file

@ -533,9 +533,13 @@ void NodeList::sendDomainServerCheckIn() {
const int IP_ADDRESS_BYTES = 4; const int IP_ADDRESS_BYTES = 4;
// check in packet has header, optional UUID, node type, port, IP, node types of interest, null termination // check in packet has header, optional UUID, node type, port, IP, node types of interest, null termination
#ifdef _WIN32
const int numPacketBytes = MAX_PACKET_SIZE;
#else
int numPacketBytes = sizeof(PACKET_TYPE) + sizeof(PACKET_VERSION) + sizeof(NODE_TYPE) + int numPacketBytes = sizeof(PACKET_TYPE) + sizeof(PACKET_VERSION) + sizeof(NODE_TYPE) +
NUM_BYTES_RFC4122_UUID + (2 * (sizeof(uint16_t) + IP_ADDRESS_BYTES)) + NUM_BYTES_RFC4122_UUID + (2 * (sizeof(uint16_t) + IP_ADDRESS_BYTES)) +
numBytesNodesOfInterest + sizeof(unsigned char); numBytesNodesOfInterest + sizeof(unsigned char);
#endif
unsigned char checkInPacket[numPacketBytes]; unsigned char checkInPacket[numPacketBytes];
unsigned char* packetPosition = checkInPacket; unsigned char* packetPosition = checkInPacket;

View file

@ -9,6 +9,8 @@
#ifndef __hifi__Tags__ #ifndef __hifi__Tags__
#define __hifi__Tags__ #define __hifi__Tags__
#include <stdint.h>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>