Small fixes.
This commit is contained in:
parent
810a3b5ed3
commit
e09f177511
150
.ycm_extra_conf.py
Normal file
150
.ycm_extra_conf.py
Normal file
@ -0,0 +1,150 @@
|
||||
# Generated by YCM Generator at 2018-06-05 01:25:36.562970
|
||||
|
||||
# This file is NOT licensed under the GPLv3, which is the license for the rest
|
||||
# of YouCompleteMe.
|
||||
#
|
||||
# Here's the license text for this file:
|
||||
#
|
||||
# This is free and unencumbered software released into the public domain.
|
||||
#
|
||||
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
# distribute this software, either in source code form or as a compiled
|
||||
# binary, for any purpose, commercial or non-commercial, and by any
|
||||
# means.
|
||||
#
|
||||
# In jurisdictions that recognize copyright laws, the author or authors
|
||||
# of this software dedicate any and all copyright interest in the
|
||||
# software to the public domain. We make this dedication for the benefit
|
||||
# of the public at large and to the detriment of our heirs and
|
||||
# successors. We intend this dedication to be an overt act of
|
||||
# relinquishment in perpetuity of all present and future rights to this
|
||||
# software under copyright law.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
import os
|
||||
import ycm_core
|
||||
|
||||
flags = [
|
||||
'-x',
|
||||
'c++',
|
||||
'-I/home/bazin_q/rendu/Perso/KubKraft/external',
|
||||
'-I/home/bazin_q/rendu/Perso/KubKraft/include/core',
|
||||
'-I/home/bazin_q/rendu/Perso/KubKraft/include/display',
|
||||
'-I/home/bazin_q/rendu/Perso/KubKraft/include/gl',
|
||||
'-I/home/bazin_q/rendu/Perso/KubKraft/include/states',
|
||||
'-I/home/bazin_q/rendu/Perso/KubKraft/include/system',
|
||||
'-I/home/bazin_q/rendu/Perso/KubKraft/include/world',
|
||||
'-I/usr/include/SDL2',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wfatal-errors',
|
||||
'-Wno-variadic-macros',
|
||||
'-std=c++11',
|
||||
]
|
||||
|
||||
|
||||
# Set this to the absolute path to the folder (NOT the file!) containing the
|
||||
# compile_commands.json file to use that instead of 'flags'. See here for
|
||||
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
||||
#
|
||||
# You can get CMake to generate this file for you by adding:
|
||||
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
|
||||
# to your CMakeLists.txt file.
|
||||
#
|
||||
# Most projects will NOT need to set this to anything; you can just change the
|
||||
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
|
||||
compilation_database_folder = ''
|
||||
|
||||
if os.path.exists( compilation_database_folder ):
|
||||
database = ycm_core.CompilationDatabase( compilation_database_folder )
|
||||
else:
|
||||
database = None
|
||||
|
||||
SOURCE_EXTENSIONS = [ '.C', '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
|
||||
|
||||
def DirectoryOfThisScript():
|
||||
return os.path.dirname( os.path.abspath( __file__ ) )
|
||||
|
||||
|
||||
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
|
||||
if not working_directory:
|
||||
return list( flags )
|
||||
new_flags = []
|
||||
make_next_absolute = False
|
||||
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
|
||||
for flag in flags:
|
||||
new_flag = flag
|
||||
|
||||
if make_next_absolute:
|
||||
make_next_absolute = False
|
||||
if not flag.startswith( '/' ):
|
||||
new_flag = os.path.join( working_directory, flag )
|
||||
|
||||
for path_flag in path_flags:
|
||||
if flag == path_flag:
|
||||
make_next_absolute = True
|
||||
break
|
||||
|
||||
if flag.startswith( path_flag ):
|
||||
path = flag[ len( path_flag ): ]
|
||||
new_flag = path_flag + os.path.join( working_directory, path )
|
||||
break
|
||||
|
||||
if new_flag:
|
||||
new_flags.append( new_flag )
|
||||
return new_flags
|
||||
|
||||
|
||||
def IsHeaderFile( filename ):
|
||||
extension = os.path.splitext( filename )[ 1 ]
|
||||
return extension in [ '.H', '.h', '.hxx', '.hpp', '.hh' ]
|
||||
|
||||
|
||||
def GetCompilationInfoForFile( filename ):
|
||||
# The compilation_commands.json file generated by CMake does not have entries
|
||||
# for header files. So we do our best by asking the db for flags for a
|
||||
# corresponding source file, if any. If one exists, the flags for that file
|
||||
# should be good enough.
|
||||
if IsHeaderFile( filename ):
|
||||
basename = os.path.splitext( filename )[ 0 ]
|
||||
for extension in SOURCE_EXTENSIONS:
|
||||
replacement_file = basename + extension
|
||||
if os.path.exists( replacement_file ):
|
||||
compilation_info = database.GetCompilationInfoForFile(
|
||||
replacement_file )
|
||||
if compilation_info.compiler_flags_:
|
||||
return compilation_info
|
||||
return None
|
||||
return database.GetCompilationInfoForFile( filename )
|
||||
|
||||
|
||||
def FlagsForFile( filename, **kwargs ):
|
||||
if database:
|
||||
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
|
||||
# python list, but a "list-like" StringVec object
|
||||
compilation_info = GetCompilationInfoForFile( filename )
|
||||
if not compilation_info:
|
||||
return None
|
||||
|
||||
final_flags = MakeRelativePathsInFlagsAbsolute(
|
||||
compilation_info.compiler_flags_,
|
||||
compilation_info.compiler_working_dir_ )
|
||||
|
||||
else:
|
||||
relative_to = DirectoryOfThisScript()
|
||||
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
|
||||
|
||||
return {
|
||||
'flags': final_flags,
|
||||
'do_cache': True
|
||||
}
|
||||
|
@ -18,8 +18,8 @@
|
||||
#ifndef CONFIG_HPP_
|
||||
#define CONFIG_HPP_
|
||||
|
||||
#define SCREEN_WIDTH 640
|
||||
#define SCREEN_HEIGHT 480
|
||||
#define SCREEN_WIDTH 1600
|
||||
#define SCREEN_HEIGHT 1050
|
||||
|
||||
#define APP_NAME "KubKraft"
|
||||
|
||||
|
@ -65,10 +65,10 @@ class Chunk {
|
||||
static const u8 height = 32;
|
||||
static const u8 depth = 16;
|
||||
|
||||
void setLeft(Chunk *left) { m_surroundingChunks[0] = left; }
|
||||
void setLeft(Chunk *left) { m_surroundingChunks[0] = left; }
|
||||
void setRight(Chunk *right) { m_surroundingChunks[1] = right; }
|
||||
void setFront(Chunk *front) { m_surroundingChunks[2] = front; }
|
||||
void setBack(Chunk *back) { m_surroundingChunks[3] = back; }
|
||||
void setBack(Chunk *back) { m_surroundingChunks[3] = back; }
|
||||
|
||||
private:
|
||||
s32 m_x;
|
||||
|
@ -25,7 +25,6 @@
|
||||
class World {
|
||||
public:
|
||||
World();
|
||||
~World();
|
||||
|
||||
void draw(Shader &shader, const glm::mat4 &projectionMatrix, const glm::mat4 &viewMatrix);
|
||||
|
||||
|
@ -58,7 +58,7 @@ void Application::initGL() {
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
|
||||
glClearColor(0.196078, 0.6, 0.8, 1.0); // Skyblue
|
||||
//glClearColor(0.0, 0.0, 0.0, 1.0); // Skyblue
|
||||
//glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
void Application::run() {
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtx/transform.hpp>
|
||||
// #include <glm/gtx/transform.hpp>
|
||||
|
||||
#include "Camera.hpp"
|
||||
#include "Skybox.hpp"
|
||||
|
@ -42,30 +42,30 @@ Camera::~Camera() {
|
||||
void Camera::turnH(float angle) {
|
||||
m_angleH += angle;
|
||||
|
||||
while(m_angleH >= 180.0) {
|
||||
m_angleH -= 360.0;
|
||||
while(m_angleH >= 180.0f) {
|
||||
m_angleH -= 360.0f;
|
||||
}
|
||||
while(m_angleH < -180.0) {
|
||||
m_angleH += 360.0;
|
||||
while(m_angleH < -180.0f) {
|
||||
m_angleH += 360.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void Camera::turnV(float angle) {
|
||||
m_angleV += angle;
|
||||
|
||||
if(89.9 < m_angleV) {
|
||||
m_angleV = 89.9;
|
||||
if(89.9f < m_angleV) {
|
||||
m_angleV = 89.9f;
|
||||
}
|
||||
else if(-89.9 > m_angleV) {
|
||||
m_angleV = -89.9;
|
||||
else if(-89.9f > m_angleV) {
|
||||
m_angleV = -89.9f;
|
||||
}
|
||||
}
|
||||
|
||||
void Camera::move(float direction) {
|
||||
direction += m_angleH;
|
||||
|
||||
m_vx = 0.04f * cos(direction * M_PI / 180.0);
|
||||
m_vz = 0.04f * sin(direction * M_PI / 180.0);
|
||||
m_vx = 0.04f * cos(direction * M_PI / 180.0f);
|
||||
m_vz = 0.04f * sin(direction * M_PI / 180.0f);
|
||||
|
||||
m_x += m_vx;
|
||||
m_z += m_vz;
|
||||
@ -76,8 +76,8 @@ void Camera::move(float direction) {
|
||||
|
||||
glm::mat4 Camera::processInputs() {
|
||||
if(Mouse::getDX() != 0 || Mouse::getDY() != 0) {
|
||||
turnH(Mouse::getDX() * 0.02);
|
||||
turnV(-Mouse::getDY() * 0.02);
|
||||
turnH(Mouse::getDX() * 0.2f);//0.02);
|
||||
turnV(-Mouse::getDY() * 0.2f);//0.02);
|
||||
m_viewMatrix = update();
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "Exception.hpp"
|
||||
#include "SDLManager.hpp"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(int, char *[]) {
|
||||
try {
|
||||
SDLManager::init();
|
||||
|
||||
|
@ -183,28 +183,28 @@ void Chunk::update() {
|
||||
}
|
||||
|
||||
// Merge adjacent faces
|
||||
/*if(x > 0 && getBlock(x - 1, y, z)->id() && (i != 0 || i != 1) && vertexExists(x - 1, y, z, i, 0)) {
|
||||
m_vertices[getVertexID(x - 1, y, z, i, 1, 0)] += 1;
|
||||
m_vertices[getVertexID(x - 1, y, z, i, 2, 0)] += 1;
|
||||
|
||||
m_texCoords[getTexCoordID(x - 1, y, z, i, 1, 0)] += 16 / 256 * 2;//1;
|
||||
m_texCoords[getTexCoordID(x - 1, y, z, i, 2, 0)] += 16 / 256 * 2;//1;
|
||||
|
||||
m_extendedFaces[getCoordID(x, y, z, i, 0, 0)] = getCoordID(x - 1, y, z, i, 0, 0);
|
||||
|
||||
continue;
|
||||
}
|
||||
if(z > 0 && getBlock(x, y, z - 1)->id() && (i == 0 || i == 1) && vertexExists(x, y, z - 1, i, 0)) {
|
||||
m_vertices[getVertexID(x, y, z - 1, i, 0, 2)] += 1;
|
||||
m_vertices[getVertexID(x, y, z - 1, i, 3, 2)] += 1;
|
||||
|
||||
m_texCoords[getTexCoordID(x, y, z - 1, i, 1, 0)] += 16 / 256 * 2;//1;
|
||||
m_texCoords[getTexCoordID(x, y, z - 1, i, 2, 0)] += 16 / 256 * 2;//1;
|
||||
|
||||
m_extendedFaces[getCoordID(x, y, z, i, 0, 0)] = getCoordID(x, y, z - 1, i, 0, 0);
|
||||
|
||||
continue;
|
||||
}*/
|
||||
// if(x > 0 && getBlock(x - 1, y, z)->id() && (i != 0 || i != 1) && vertexExists(x - 1, y, z, i, 0)) {
|
||||
// m_vertices[getVertexID(x - 1, y, z, i, 1, 0)] += 1;
|
||||
// m_vertices[getVertexID(x - 1, y, z, i, 2, 0)] += 1;
|
||||
//
|
||||
// m_texCoords[getTexCoordID(x - 1, y, z, i, 1, 0)] += 16 / 256 * 2;//1;
|
||||
// m_texCoords[getTexCoordID(x - 1, y, z, i, 2, 0)] += 16 / 256 * 2;//1;
|
||||
//
|
||||
// m_extendedFaces[getCoordID(x, y, z, i, 0, 0)] = getCoordID(x - 1, y, z, i, 0, 0);
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
// if(z > 0 && getBlock(x, y, z - 1)->id() && (i == 0 || i == 1) && vertexExists(x, y, z - 1, i, 0)) {
|
||||
// m_vertices[getVertexID(x, y, z - 1, i, 0, 2)] += 1;
|
||||
// m_vertices[getVertexID(x, y, z - 1, i, 3, 2)] += 1;
|
||||
//
|
||||
// m_texCoords[getTexCoordID(x, y, z - 1, i, 1, 0)] += 16 / 256 * 2;//1;
|
||||
// m_texCoords[getTexCoordID(x, y, z - 1, i, 2, 0)] += 16 / 256 * 2;//1;
|
||||
//
|
||||
// m_extendedFaces[getCoordID(x, y, z, i, 0, 0)] = getCoordID(x, y, z - 1, i, 0, 0);
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
|
||||
/*if(y > 0 && getBlock(x, y - 1, z)->id() && (i == 2 || i == 3) && vertexExists(x, y - 1, z, i, 0)) {
|
||||
m_vertices[getVertexID(x, y - 1, z, i, 0, 1)] += 1;
|
||||
@ -295,9 +295,9 @@ void Chunk::draw(Shader &shader) {
|
||||
|
||||
Texture::bind(nullptr);
|
||||
|
||||
/*for(u32 i = 0 ; i < m_vertices.size() / 3 ; i += 4) {
|
||||
glDrawArrays(GL_LINE_LOOP, i, 4);
|
||||
}*/
|
||||
// for(u32 i = 0 ; i < m_vertices.size() / 3 ; i += 4) {
|
||||
// glDrawArrays(GL_LINE_LOOP, i, 4);
|
||||
//}
|
||||
|
||||
shader.disableVertexAttribArray("texCoord");
|
||||
shader.disableVertexAttribArray("normal");
|
||||
|
@ -43,9 +43,6 @@ World::World() {
|
||||
}
|
||||
}
|
||||
|
||||
World::~World() {
|
||||
}
|
||||
|
||||
void World::draw(Shader &shader, const glm::mat4 &projectionMatrix, const glm::mat4 &viewMatrix) {
|
||||
float ud = 1000.0;
|
||||
s32 ux = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user