Working version for linux
This commit is contained in:
+4
-3
@@ -10,6 +10,7 @@ add_executable(CrystalPoint ${SOURCE_FILES})
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLUT REQUIRED)
|
||||
include_directories( ${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} )
|
||||
target_link_libraries(CrystalPoint ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall ")
|
||||
find_package(OpenAL REQUIRED)
|
||||
include_directories( ${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIRS} )
|
||||
target_link_libraries(CrystalPoint ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${OPENAL_LIBRARY} )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -lpthread")
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#include "Cursor.h"
|
||||
#include <GL\freeglut.h>
|
||||
#include <GL/freeglut.h>
|
||||
#include <cmath>
|
||||
#include "CrystalPoint.h"
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
#include "HeightMap.h"
|
||||
#include "stb_image.h"
|
||||
#include "vector.h"
|
||||
#include "Vector.h"
|
||||
|
||||
#include "LevelObject.h"
|
||||
|
||||
@@ -127,6 +127,7 @@ float HeightMap::GetHeight(float x, float y)
|
||||
float labda3 = 1 - labda1 - labda2;
|
||||
|
||||
Vertex z = a * labda1 + b * labda2 + c * labda3;
|
||||
// Vertex z = (a * labda1) + (b * labda2) ;
|
||||
|
||||
return z.y;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#include "Interface.h"
|
||||
#include <GL\freeglut.h>
|
||||
#include <GL/freeglut.h>
|
||||
#include "CrystalPoint.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -138,7 +138,7 @@ Model::Model(std::string fileName)
|
||||
radius = fmax(radius, (center.x - v.x) * (center.x - v.x) + (center.z - v.z) * (center.z - v.z));
|
||||
radius = sqrt(radius);
|
||||
|
||||
for each(ObjGroup *group in groups)
|
||||
for (ObjGroup *group : groups)
|
||||
{
|
||||
Optimise(group);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ void Model::Optimise(ObjGroup *t)
|
||||
{
|
||||
for (Face &face : t->faces)
|
||||
{
|
||||
for each(auto &vertex in face.vertices)
|
||||
for (auto &vertex : face.vertices)
|
||||
{
|
||||
t->VertexArray.push_back(Vertex(vertices[vertex.position].x, vertices[vertex.position].y, vertices[vertex.position].z,
|
||||
normals[vertex.normal].x, normals[vertex.normal].y, normals[vertex.normal].z,
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
#include "Sound.h"
|
||||
|
||||
#include <iostream>
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <al.h>
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
typedef unsigned long DWORD;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned int UNINT32;
|
||||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
|
||||
|
||||
Sound::Sound(const char* inWavPath, bool inLooping):
|
||||
buffer_id(0),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "vector.h"
|
||||
#include "Vector.h"
|
||||
|
||||
class Sound
|
||||
{
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
#include "SoundSystem.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
SoundSystem::SoundSystem():
|
||||
device(nullptr),
|
||||
context(nullptr)
|
||||
|
||||
+8
-1
@@ -1,9 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <al.h>
|
||||
#include <alc.h>
|
||||
#include "vector.h"
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#endif
|
||||
|
||||
#include "Vector.h"
|
||||
#include "Sound.h"
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -18,22 +18,22 @@ Vertex::~Vertex()
|
||||
{
|
||||
}
|
||||
|
||||
Vertex Vertex::operator/(float &other)
|
||||
Vertex Vertex::operator/(const float &other) const
|
||||
{
|
||||
return Vertex(x / other, y / other, z / other, normalX, normalY, normalZ, texX, texY);
|
||||
}
|
||||
|
||||
Vertex Vertex::operator*(Vertex & other)
|
||||
Vertex Vertex::operator*(const Vertex & other) const
|
||||
{
|
||||
return Vertex(x*other.x, y*other.y, z*other.z, normalX, normalY, normalZ, texX, texY);
|
||||
}
|
||||
|
||||
Vertex Vertex::operator*(float & other)
|
||||
Vertex Vertex::operator*(const float & other) const
|
||||
{
|
||||
return Vertex(x*other, y*other, z*other, normalX, normalY, normalZ, texX, texY);
|
||||
}
|
||||
|
||||
Vertex Vertex::operator+(Vertex & other)
|
||||
Vertex Vertex::operator+(const Vertex & other) const
|
||||
{
|
||||
return Vertex(x+other.x, y+other.y, z+other.z, normalX, normalY, normalZ, texX, texY);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ public:
|
||||
float texX;
|
||||
float texY;
|
||||
|
||||
Vertex operator/(float &other);
|
||||
Vertex operator*(Vertex &other);
|
||||
Vertex operator*(float &other);
|
||||
Vertex operator+(Vertex &other);
|
||||
Vertex operator/(const float &other) const;
|
||||
Vertex operator*(const Vertex &other) const;
|
||||
Vertex operator*(const float &other) const;
|
||||
Vertex operator+(const Vertex &other) const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user