Fix for polluted headers that were messing with glm

This commit is contained in:
KimLS 2015-01-23 17:58:03 -08:00
parent 17af9e3808
commit a7710c027b
4 changed files with 30 additions and 70 deletions

View File

@ -45,47 +45,6 @@
return; \
}
// Definitions for WELLRNG
//
#define W 32
#define R 624
#define DISCARD 31
#define MASKU (0xffffffffU>>(W-DISCARD))
#define MASKL (~MASKU)
#define M1 70
#define M2 179
#define M3 449
#define MAT0POS(t,v) (v^(v>>t))
#define MAT0NEG(t,v) (v^(v<<(-(t))))
#define MAT1(v) v
#define MAT3POS(t,v) (v>>t)
#define V0 STATE[state_i]
#define VM1Over STATE[state_i+M1-R]
#define VM1 STATE[state_i+M1]
#define VM2Over STATE[state_i+M2-R]
#define VM2 STATE[state_i+M2]
#define VM3Over STATE[state_i+M3-R]
#define VM3 STATE[state_i+M3]
#define VRm1 STATE[state_i-1]
#define VRm1Under STATE[state_i+R-1]
#define VRm2 STATE[state_i-2]
#define VRm2Under STATE[state_i+R-2]
#define newV0 STATE[state_i-1]
#define newV0Under STATE[state_i-1+R]
#define newV1 STATE[state_i]
#define newVRm1 STATE[state_i-2]
#define newVRm1Under STATE[state_i-2+R]
#define newVM2Over STATE[state_i+M2-R+1]
#define newVM2 STATE[state_i+M2+1]
#define BITMASK 0x41180000
int32 filesize(FILE* fp);
uint32 ResolveIP(const char* hostname, char* errbuf = 0);
bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf = 0);

View File

@ -4792,7 +4792,7 @@ void Client::SummonAndRezzAllCorpses()
void Client::SummonAllCorpses(const glm::vec4& position)
{
auto summonLocation = position;
if(IsOrigin(position) && position.w == 0.0f)
if(IsOrigin(position) == 0 && position.w == 0.0f)
summonLocation = GetPosition();
ServerPacket *Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct));

View File

@ -6,99 +6,99 @@
#include "../common/string_util.h"
std::string to_string(const glm::vec4 &position) {
return StringFormat("(%.3f, %.3f, %.3f, %.3f)", position.x,position.y,position.z,position.w);
return StringFormat("(%.3f, %.3f, %.3f, %.3f)", position.x,position.y,position.z,position.w);
}
std::string to_string(const glm::vec3 &position){
return StringFormat("(%.3f, %.3f, %.3f)", position.x,position.y,position.z);
return StringFormat("(%.3f, %.3f, %.3f)", position.x,position.y,position.z);
}
std::string to_string(const glm::vec2 &position){
return StringFormat("(%.3f, %.3f)", position.x,position.y);
return StringFormat("(%.3f, %.3f)", position.x,position.y);
}
bool IsOrigin(const glm::vec2 &position) {
return position.x == 0.0f && position.y == 0.0f;
return glm::dot(position, position) == 0;
}
bool IsOrigin(const glm::vec3 &position) {
return position.x == 0.0f && position.y == 0.0f && position.z == 0.0f;
return glm::dot(position, position) == 0;
}
bool IsOrigin(const glm::vec4 &position) {
return position.x == 0.0f && position.y == 0.0f && position.z == 0.0f;
return IsOrigin(glm::vec3(position));
}
/**
* Produces the non square root'ed distance between the two points within the XY plane.
*/
float DistanceSquared(const glm::vec2& point1, const glm::vec2& point2) {
auto diff = point1 - point2;
return diff.x * diff.x + diff.y * diff.y;
auto diff = point1 - point2;
return glm::dot(diff, diff);
}
/**
* Produces the distance between the two points on the XY plane.
*/
float Distance(const glm::vec2& point1, const glm::vec2& point2) {
return sqrt(DistanceSquared(point1, point2));
return std::sqrt(DistanceSquared(point1, point2));
}
/**
* Produces the non square root'ed distance between the two points.
*/
float DistanceSquared(const glm::vec3& point1, const glm::vec3& point2) {
auto diff = point1 - point2;
return diff.x * diff.x + diff.y * diff.y + diff.z * diff.z;
auto diff = point1 - point2;
return glm::dot(diff, diff);
}
/**
* Produces the non square root'ed distance between the two points.
*/
float DistanceSquared(const glm::vec4& point1, const glm::vec4& point2) {
return DistanceSquared(static_cast<glm::vec3>(point1), static_cast<glm::vec3>(point2));
return DistanceSquared(static_cast<glm::vec3>(point1), static_cast<glm::vec3>(point2));
}
/**
* Produces the distance between the two points.
*/
float Distance(const glm::vec3& point1, const glm::vec3& point2) {
return sqrt(DistanceSquared(point1, point2));
return std::sqrt(DistanceSquared(point1, point2));
}
/**
* Produces the distance between the two points.
*/
float Distance(const glm::vec4& point1, const glm::vec4& point2) {
return Distance(static_cast<glm::vec3>(point1), static_cast<glm::vec3>(point2));
return Distance(static_cast<glm::vec3>(point1), static_cast<glm::vec3>(point2));
}
/**
* Produces the distance between the two points within the XY plane.
*/
float DistanceNoZ(const glm::vec3& point1, const glm::vec3& point2) {
return Distance(static_cast<glm::vec2>(point1),static_cast<glm::vec2>(point2));
return Distance(static_cast<glm::vec2>(point1),static_cast<glm::vec2>(point2));
}
/**
* Produces the distance between the two points within the XY plane.
*/
float DistanceNoZ(const glm::vec4& point1, const glm::vec4& point2) {
return Distance(static_cast<glm::vec2>(point1),static_cast<glm::vec2>(point2));
return Distance(static_cast<glm::vec2>(point1),static_cast<glm::vec2>(point2));
}
/**
* Produces the non square root'ed distance between the two points within the XY plane.
*/
float DistanceSquaredNoZ(const glm::vec3& point1, const glm::vec3& point2) {
return DistanceSquared(static_cast<glm::vec2>(point1),static_cast<glm::vec2>(point2));
return DistanceSquared(static_cast<glm::vec2>(point1),static_cast<glm::vec2>(point2));
}
/**
* Produces the non square root'ed distance between the two points within the XY plane.
*/
float DistanceSquaredNoZ(const glm::vec4& point1, const glm::vec4& point2) {
return DistanceSquared(static_cast<glm::vec2>(point1),static_cast<glm::vec2>(point2));
return DistanceSquared(static_cast<glm::vec2>(point1),static_cast<glm::vec2>(point2));
}
/**
@ -106,12 +106,12 @@ float DistanceSquaredNoZ(const glm::vec4& point1, const glm::vec4& point2) {
* box (3 dimensional) formed from the points minimum and maximum.
*/
bool IsWithinAxisAlignedBox(const glm::vec3 &position, const glm::vec3 &minimum, const glm::vec3 &maximum) {
auto actualMinimum = glm::vec3(std::min(minimum.x, maximum.x), std::min(minimum.y, maximum.y),std::min(minimum.z, maximum.z));
auto actualMaximum = glm::vec3(std::max(minimum.x, maximum.x), std::max(minimum.y, maximum.y),std::max(minimum.z, maximum.z));
auto actualMinimum = glm::vec3(std::min(minimum.x, maximum.x), std::min(minimum.y, maximum.y),std::min(minimum.z, maximum.z));
auto actualMaximum = glm::vec3(std::max(minimum.x, maximum.x), std::max(minimum.y, maximum.y),std::max(minimum.z, maximum.z));
bool xcheck = position.x >= actualMinimum.x && position.x <= actualMaximum.x;
bool ycheck = position.y >= actualMinimum.y && position.y <= actualMaximum.y;
bool zcheck = position.z >= actualMinimum.z && position.z <= actualMaximum.z;
bool xcheck = position.x >= actualMinimum.x && position.x <= actualMaximum.x;
bool ycheck = position.y >= actualMinimum.y && position.y <= actualMaximum.y;
bool zcheck = position.z >= actualMinimum.z && position.z <= actualMaximum.z;
return xcheck && ycheck && zcheck;
}
@ -121,11 +121,11 @@ bool IsWithinAxisAlignedBox(const glm::vec3 &position, const glm::vec3 &minimum,
* box (2 dimensional) formed from the points minimum and maximum.
*/
bool IsWithinAxisAlignedBox(const glm::vec2 &position, const glm::vec2 &minimum, const glm::vec2 &maximum) {
auto actualMinimum = glm::vec2(std::min(minimum.x, maximum.x), std::min(minimum.y, maximum.y));
auto actualMaximum = glm::vec2(std::max(minimum.x, maximum.x), std::max(minimum.y, maximum.y));
auto actualMinimum = glm::vec2(std::min(minimum.x, maximum.x), std::min(minimum.y, maximum.y));
auto actualMaximum = glm::vec2(std::max(minimum.x, maximum.x), std::max(minimum.y, maximum.y));
bool xcheck = position.x >= actualMinimum.x && position.x <= actualMaximum.x;
bool ycheck = position.y >= actualMinimum.y && position.y <= actualMaximum.y;
bool xcheck = position.x >= actualMinimum.x && position.x <= actualMaximum.x;
bool ycheck = position.y >= actualMinimum.y && position.y <= actualMaximum.y;
return xcheck && ycheck;
}
@ -137,7 +137,7 @@ bool IsWithinAxisAlignedBox(const glm::vec2 &position, const glm::vec2 &minimum,
* an EQFloat.
*/
float GetReciprocalHeading(const glm::vec4& point1) {
return GetReciprocalHeading(point1.w);
return GetReciprocalHeading(point1.w);
}
/**

View File

@ -22,6 +22,7 @@
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <glm/geometric.hpp>
std::string to_string(const glm::vec4 &position);
std::string to_string(const glm::vec3 &position);