Fix compilation on Linux

master
Nicole Collings 2019-11-02 16:27:13 -07:00
parent 2d5aa93f38
commit 352caaa268
9 changed files with 43 additions and 40 deletions

View File

@ -18,14 +18,6 @@ find_path(NOISE_HEADERS noise/noise.h)
find_path(GLM_HEADERS glm/glm.hpp)
find_path(PTHREAD_HEADERS pthread.h)
find_library(GLEW_LIB NAMES glew32 GLEW glew glew32s)
if (WIN32)
find_library(GLFW_LIB glfw3dll)
else()
find_library(GLFW_LIB glfw3)
endif()
find_library(LUA_LIB NAMES lua lua5.1 PATHS
/usr/lib/x86_64-linux-gnu
/usr/lib

View File

@ -5,16 +5,24 @@ target_link_libraries(${MAIN_EXEC_NAME} ${ENET_LIB})
find_package (OpenGL REQUIRED)
target_link_libraries(${MAIN_EXEC_NAME} ${OPENGL_gl_LIBRARY})
# Build and Link GLFW
set (GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set (GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set (GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
# Find GLFW
# Build GLFW
if (WIN32)
target_link_libraries (${MAIN_EXEC_NAME} glfw3dll)
find_library(GLFW_LIB glfw3dll)
else()
target_link_libraries (${MAIN_EXEC_NAME} glfw)
set (GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set (GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set (GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory (lib/static/glfw)
target_link_libraries (${MAIN_EXEC_NAME} glfw)
include_directories(lib/static/glfw/src)
endif()
# Link GLFW
if (WIN32)
find_library(GLEW_LIB glew32)
else()
set(GLEW_LIB ${CMAKE_SOURCE_DIR}/lib/static/glew/libGLEW.a)
endif()
# Link Glew

View File

@ -34,7 +34,7 @@ struct BlockModel {
{glm::vec3{0, 1, 1}, glm::vec3{}, glm::vec2{1, 0}, glm::vec2{}},
{glm::vec3{0, 1, 0}, glm::vec3{}, glm::vec2{0, 0}, glm::vec2{}}};
indices = {0, 1, 2, 2, 3, 0};
MeshPart leftMeshPart = MeshPart::MeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 2)]);
MeshPart leftMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 2)]);
blockModel.parts[static_cast<int>(Dir::LEFT)].push_back(leftMeshPart);
//Right Face
@ -44,7 +44,7 @@ struct BlockModel {
{glm::vec3{1, 0, 0}, glm::vec3{}, glm::vec2{0, 1}, glm::vec2{}},
{glm::vec3{1, 1, 0}, glm::vec3{}, glm::vec2{0, 0}, glm::vec2{}}};
indices = {0, 1, 2, 2, 3, 0};
MeshPart rightMeshPart = MeshPart::MeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 3)]);
MeshPart rightMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 3)]);
blockModel.parts[static_cast<int>(Dir::RIGHT)].push_back(rightMeshPart);
//Top Face
@ -54,7 +54,7 @@ struct BlockModel {
{glm::vec3{1, 1, 1}, glm::vec3{}, glm::vec2{1, 1}, glm::vec2{}},
{glm::vec3{1, 1, 0}, glm::vec3{}, glm::vec2{1, 0}, glm::vec2{}}};
indices = {0, 1, 2, 2, 3, 0};
MeshPart topMeshPart = MeshPart::MeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 0)]);
MeshPart topMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 0)]);
blockModel.parts[static_cast<int>(Dir::TOP)].push_back(topMeshPart);
//Bottom Face
@ -64,7 +64,7 @@ struct BlockModel {
{glm::vec3{1, 0, 1}, glm::vec3{}, glm::vec2{1, 1}, glm::vec2{}},
{glm::vec3{0, 0, 1}, glm::vec3{}, glm::vec2{0, 1}, glm::vec2{}}};
indices = {0, 1, 2, 2, 3, 0};
MeshPart bottomMeshPart = MeshPart::MeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 1)]);
MeshPart bottomMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 1)]);
blockModel.parts[static_cast<int>(Dir::BOTTOM)].push_back(bottomMeshPart);
//Front Face
@ -74,7 +74,7 @@ struct BlockModel {
{glm::vec3{1, 1, 1}, glm::vec3{}, glm::vec2{1, 0}, glm::vec2{}},
{glm::vec3{0, 1, 1}, glm::vec3{}, glm::vec2{0, 0}, glm::vec2{}}};
indices = {0, 1, 2, 2, 3, 0};
MeshPart frontMeshPart = MeshPart::MeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 4)]);
MeshPart frontMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 4)]);
blockModel.parts[static_cast<int>(Dir::FRONT)].push_back(frontMeshPart);
//Back Face
@ -84,7 +84,7 @@ struct BlockModel {
{glm::vec3{1, 1, 0}, glm::vec3{}, glm::vec2{1, 0}, glm::vec2{}},
{glm::vec3{1, 0, 0}, glm::vec3{}, glm::vec2{1, 1}, glm::vec2{}}};
indices = {0, 1, 2, 2, 3, 0};
MeshPart backMeshPart = MeshPart::MeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 5)]);
MeshPart backMeshPart(vertices, indices, (textureRefs.empty()) ? nullptr : textureRefs[(std::min)(static_cast<int>(textureRefs.size() - 1), 5)]);
blockModel.parts[static_cast<int>(Dir::BACK)].push_back(backMeshPart);
return blockModel;

View File

@ -236,7 +236,7 @@ void Model::calcBoneTransformation(double animTime, ModelBone& bone, glm::mat4 p
aiQuaternion rotation;
calcInterpolatedRotation(rotation, animTime, bone, *channel, bounds);
glm::mat4 rotationMat = glm::transpose(MatConv::AiToGLMMat3(rotation.GetMatrix()));
glm::mat4 rotationMat = glm::transpose(glm::mat4(MatConv::AiToGLMMat3(rotation.GetMatrix())));
glm::vec3 position;
calcInterpolatedPosition(position, animTime, bone, *channel, bounds);
@ -288,7 +288,7 @@ void Model::calcInterpolatedRotation(aiQuaternion &rotation, double animTime, Mo
const aiQuaternion& startRotation = channel.rotationKeys[index].second;
const aiQuaternion& endRotation = channel.rotationKeys[nextIndex].second;
aiQuaternion::Interpolate(rotation, startRotation, endRotation, static_cast<ai_real>(factor));
aiQuaternion::Interpolate(rotation, startRotation, endRotation, factor);
rotation = rotation.Normalize();
}

View File

@ -53,20 +53,20 @@ void WireframeEntity::buildMesh(const std::vector<SelectionBox>& boxes) {
}
void WireframeEntity::createBox(glm::vec3 a, glm::vec3 b, float x, float y, float z, float xSize, float ySize, float zSize) {
float hw = (width/2.0f);
float w = width;
auto c = color;
float hw = (width/2.0f);
float w = width;
glm::vec3 c = color;
std::vector<EntityVertex> myVerts {
/*0*/ {{x - hw + a.x, y - hw + a.y, z - hw + a.z }, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*1*/ {{x - hw + a.x + xSize + w, y - hw + a.y, z - hw + a.z }, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*2*/ {{x - hw + a.x + xSize + w, y - hw + a.y, z - hw + a.z + zSize + w}, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*3*/ {{x - hw + a.x, y - hw + a.y, z - hw + a.z + zSize + w}, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*0*/ {{x - hw + a.x, y - hw + a.y, z - hw + a.z }, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*1*/ {{x - hw + a.x + xSize + w, y - hw + a.y, z - hw + a.z }, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*2*/ {{x - hw + a.x + xSize + w, y - hw + a.y, z - hw + a.z + zSize + w}, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*3*/ {{x - hw + a.x, y - hw + a.y, z - hw + a.z + zSize + w}, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*4*/ {{x - hw + a.x, y - hw + a.y + ySize + w, z - hw + a.z }, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*5*/ {{x - hw + a.x + xSize + w, y - hw + a.y + ySize + w, z - hw + a.z }, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*6*/ {{x - hw + a.x + xSize + w, y - hw + a.y + ySize + w, z - hw + a.z + zSize + w}, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*7*/ {{x - hw + a.x, y - hw + a.y + ySize + w, z - hw + a.z + zSize + w}, {c, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*4*/ {{x - hw + a.x, y - hw + a.y + ySize + w, z - hw + a.z }, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*5*/ {{x - hw + a.x + xSize + w, y - hw + a.y + ySize + w, z - hw + a.z }, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*6*/ {{x - hw + a.x + xSize + w, y - hw + a.y + ySize + w, z - hw + a.z + zSize + w}, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
/*7*/ {{x - hw + a.x, y - hw + a.y + ySize + w, z - hw + a.z + zSize + w}, {c.x, c.y, c.z, 1}, {1, 1, 1}, false, {0, 1, 0}},
};
std::vector<unsigned int> myInds {

View File

@ -59,7 +59,7 @@ void DebugGui::positionElements(glm::vec2 bufferSize) {
auto bufferHeight = (int)bufferSize.y;
get<GUIText>("crosshairText")->setPos({bufferWidth / 2 + 22, bufferHeight / 2 - 7});
get<GUIText>("dataText")->setPos(glm::vec3(10, 10, 0));
get<GUIText>("dataText")->setPos({10, 10});
get<GUILabelledGraph>("genGraph")->setPos({bufferWidth - 254, bufferHeight - 70 - 160});
get<GUILabelledGraph>("packetGraph")->setPos({bufferWidth - 254, bufferHeight - 70 - 240});

View File

@ -8,7 +8,12 @@ GUILabelledGraph::GUILabelledGraph(const std::string &key) : GUIContainer(key) {
void GUILabelledGraph::create(glm::vec2 scale, glm::vec4 padding, const std::string &title,
unsigned int graphLength, unsigned int graphScale,
std::shared_ptr <AtlasRef> graphTextureRef, Font font) {
std::shared_ptr<AtlasRef> graphTextureRef, Font font) {
const static int GRAPH_PAD_X = 2;
const static int GRAPH_PAD_Y = 62;
const static int TEXT_PAD_X = 4;
const static int TEXT_PAD_Y = 8;
this->scale = scale;
this->padding = padding;

View File

@ -22,8 +22,6 @@ public:
void pushValue(float value);
private:
const static int GRAPH_PAD_X = 2, GRAPH_PAD_Y = 62, TEXT_PAD_X = 4, TEXT_PAD_Y = 8;
std::string title;
std::shared_ptr<AtlasRef> graphTextureRef;

View File

@ -49,7 +49,7 @@ namespace MatConv {
}
static inline glm::mat3 AiToGLMMat3(const aiMatrix3x3 &in_mat) {
glm::mat4 tmp;
glm::mat3 tmp;
tmp[0][0] = in_mat.a1;
tmp[1][0] = in_mat.b1;