Skip to content

Commit

Permalink
--
Browse files Browse the repository at this point in the history
  • Loading branch information
name committed May 31, 2020
1 parent e5ee5d5 commit ccef845
Show file tree
Hide file tree
Showing 21 changed files with 92 additions and 100 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(BlackBox)
#project(BlackBox)

if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(
Expand Down Expand Up @@ -44,4 +44,4 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")

set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
set(CPACK_NSIS_CREATE_ICONS "CreateShortCut '\$SMPROGRAMS\\\\${PROJECT_NAME}.lnk' '\$INSTDIR\\\\bin\\\\Launcher.exe'")
set(CPACK_NSIS_CREATE_ICONS "CreateShortCut '\$SMPROGRAMS\\\\${PROJECT_NAME}.lnk' '\$INSTDIR\\\\bin\\\\Launcher.exe'")
2 changes: 1 addition & 1 deletion Tools/CMake/CommonMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function(add_package Package)
set(result OFF)
if (NOT ${Package}_INSTALLED)
message(STATUS "${Package} yet not installed")
install_package("${Package}" result)
#install_package("${Package}" result)
if (NOT result EQUAL 0)
message(FATAL_ERROR "could not install ${Package}")
else()
Expand Down
6 changes: 3 additions & 3 deletions Tools/CMake/toolchain/linux/Linux_Clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ set(LINUX64 1)

set(OUTPUT_DIRECTORY_NAME "linux_x64_clang")

set(CMAKE_C_COMPILER clang-3.8)
set(CMAKE_CXX_COMPILER clang++-3.8)
#set(CMAKE_C_COMPILER clang-3.8)
#set(CMAKE_CXX_COMPILER clang++-3.8)

add_definitions(-DLINUX64)

message(STATUS "BUILD_CPU_ARCHITECTURE = ${BUILD_CPU_ARCHITECTURE}")

include ("${CMAKE_CURRENT_LIST_DIR}/../../CRYENGINE-CLANG.cmake")
#include ("${CMAKE_CURRENT_LIST_DIR}/../../CRYENGINE-CLANG.cmake")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLINUX -D__linux__ -DOPENGL" CACHE STRING "C Common Flags" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLINUX -D__linux__ -DOPENGL" CACHE STRING "C++ Common Flags" FORCE)
Expand Down
6 changes: 2 additions & 4 deletions Tools/CMake/toolchain/linux/Linux_GCC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ set(LINUX64 1)

set(OUTPUT_DIRECTORY_NAME "linux_x64_gcc")

#[[
set(CMAKE_C_COMPILER gcc-4.9)
set(CMAKE_CXX_COMPILER g++-4.9)
]]
set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPILER /usr/bin/g++)

add_definitions(-DLINUX64)

Expand Down
2 changes: 1 addition & 1 deletion include/private/BlackBox/Input/SDLPad.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#pragma once

#include <SDL.h>
#include <SDL2/SDL.h>
#include <BlackBox/Input/SDLInput.hpp>
// We need a manager, since all the input for each Game Pad is collected
// in the same queue. If we were to update the game pads seperately
Expand Down
2 changes: 2 additions & 0 deletions include/public/BlackBox/Core/Platform/WindowsSpecific.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ typedef ULONG_PTR DWORD_PTR, * PDWORD_PTR;
#undef min
#undef max

#define strdup _strdup

#define TARGET_DEFAULT_ALIGN (0x8U)
6 changes: 3 additions & 3 deletions include/public/BlackBox/Renderer/Camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ class CCamera
}


void CCamera::SetPos(glm::vec3 pos)
void GetPos(glm::vec3 pos)
{
transform.position = pos;
}

void CCamera::SetAngles(glm::vec3 ang)
void SetAngles(glm::vec3 ang)
{
transform.rotation = ang;
}
Expand Down Expand Up @@ -121,4 +121,4 @@ class CCamera
this->Up = glm::normalize(glm::cross(this->Right, this->Front));

}
};
};
2 changes: 1 addition & 1 deletion include/public/BlackBox/Renderer/IRender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ union UCol {
};
*/
UCol() = default;
UCol(Vec4& v)
UCol(const Vec4& v)
{
bcolor[0] = static_cast<char>(v[3] * 255.f);
bcolor[1] = static_cast<char>(v[1] * 255.f);
Expand Down
84 changes: 42 additions & 42 deletions include/public/BlackBox/Renderer/VertexFormats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ _inline int VertFormatForComponents(bool bNeedCol, bool bNeedSecCol, bool bNeedN
//////////////////////////////////////////////////////////////////////////
struct SBufInfoTable
{
int OffsTC;
int OffsColor;
int OffsSecColor;
int OffsNormal;
INT_PTR OffsTC;
INT_PTR OffsColor;
INT_PTR OffsSecColor;
INT_PTR OffsNormal;
};

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -293,51 +293,51 @@ const int gVertexSize[]=
// this is the table of offsets of UVs relative to the start of the structure
// -1 means there's no UVs in this format
// This is required by Animation and must be kept intact with the vertex format enumeration
const int g_VertFormatUVOffsets[] =
const INT_PTR g_VertFormatUVOffsets[] =
{
-1, // no UVs in this format - invalid format
-1, // VERTEX_FORMAT_P3F=1, // shadow volumes (12 bytes)
-1, // VERTEX_FORMAT_P3F_C4B=2, // usually terrain (16 bytes)
(int)&(((SVF_P3F_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_T2F=3, // everything else (20 bytes)
(int)&(((SVF_P3F_C4B_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_C4B_T2F=4, // usually plants (24 bytes)
(int)&(((SVF_TRP3F_C4B_T2F*)0)->st[0]),// VERTEX_FORMAT_TRP3F_C4B_T2F=5, // fonts (28 bytes)
(INT_PTR)&(((SVF_P3F_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_T2F=3, // everything else (20 bytes)
(INT_PTR)&(((SVF_P3F_C4B_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_C4B_T2F=4, // usually plants (24 bytes)
(INT_PTR)&(((SVF_TRP3F_C4B_T2F*)0)->st[0]),// VERTEX_FORMAT_TRP3F_C4B_T2F=5, // fonts (28 bytes)
-1, // VERTEX_FORMAT_P3F_C4B_C4B=1,
-1, // VERTEX_FORMAT_P3F_N=1,
-1, // VERTEX_FORMAT_P3F_N_C4B=1,
(int)&(((SVF_P3F_N_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_N_T2F=3, // everything else (20 bytes)
(int)&(((SVF_P3F_N_C4B_T2F*)0)->st[0]) // VERTEX_FORMAT_P3F_N_C4B_T2F=4, // usually plants (24 bytes)
(INT_PTR)&(((SVF_P3F_N_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_N_T2F=3, // everything else (20 bytes)
(INT_PTR)&(((SVF_P3F_N_C4B_T2F*)0)->st[0]) // VERTEX_FORMAT_P3F_N_C4B_T2F=4, // usually plants (24 bytes)
-1, // VERTEX_FORMAT_P3F_N_C4B_C4B=1,
(int)&(((SVF_P3F_C4B_C4B_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_C4B_C4B_T2F=4, // usually plants (24 bytes)
(int)&(((SVF_P3F_N_C4B_C4B_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_N_C4B_C4B_T2F=4, // usually plants (24 bytes)
(INT_PTR)&(((SVF_P3F_C4B_C4B_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_C4B_C4B_T2F=4, // usually plants (24 bytes)
(INT_PTR)&(((SVF_P3F_N_C4B_C4B_T2F*)0)->st[0]), // VERTEX_FORMAT_P3F_N_C4B_C4B_T2F=4, // usually plants (24 bytes)
};

//////////////////////////////////////////////////////////////////////////
// this is the table of offsets of colors relative to the start of the structure
// -1 means there's no colors in this format
// This is required by Animation and must be kept in tact with the vertex format enumeration
const int g_VertFormatRGBAOffsets[] =
const INT_PTR g_VertFormatRGBAOffsets[] =
{
-1, // invalid format
-1,
(int)&(((SVF_P3F_C4B*)0)->color.dcolor),
(INT_PTR)&(((SVF_P3F_C4B*)0)->color.dcolor),
-1,
(int)&(((SVF_P3F_C4B_T2F*)0)->color.dcolor),
(int)&(((SVF_TRP3F_C4B_T2F*)0)->color.dcolor),
(int)&(((SVF_P3F_C4B_C4B*)0)->color.dcolor),
(INT_PTR)&(((SVF_P3F_C4B_T2F*)0)->color.dcolor),
(INT_PTR)&(((SVF_TRP3F_C4B_T2F*)0)->color.dcolor),
(INT_PTR)&(((SVF_P3F_C4B_C4B*)0)->color.dcolor),
-1,
(int)&(((SVF_P3F_N_C4B*)0)->color.dcolor),
(INT_PTR)&(((SVF_P3F_N_C4B*)0)->color.dcolor),
-1,
(int)&(((SVF_P3F_N_C4B_T2F*)0)->color.dcolor),
(int)&(((SVF_P3F_N_C4B_C4B*)0)->color.dcolor),
(int)&(((SVF_P3F_C4B_C4B_T2F*)0)->color.dcolor),
(int)&(((SVF_P3F_N_C4B_C4B_T2F*)0)->color.dcolor),
(INT_PTR)&(((SVF_P3F_N_C4B_T2F*)0)->color.dcolor),
(INT_PTR)&(((SVF_P3F_N_C4B_C4B*)0)->color.dcolor),
(INT_PTR)&(((SVF_P3F_C4B_C4B_T2F*)0)->color.dcolor),
(INT_PTR)&(((SVF_P3F_N_C4B_C4B_T2F*)0)->color.dcolor),
};

//////////////////////////////////////////////////////////////////////////
// this is the table of offsets of normals relative to the start of the structure
// -1 means there's no colors in this format
// This is required by Animation and must be kept in tact with the vertex format enumeration
const int g_VertFormatNormalOffsets[] =
const INT_PTR g_VertFormatNormalOffsets[] =
{
-1, // invalid format
-1, // VERTEX_FORMAT_P3F=1
Expand All @@ -346,13 +346,13 @@ const int g_VertFormatNormalOffsets[] =
-1, // VERTEX_FORMAT_P3F_C4B_T2F=4,
-1, // VERTEX_FORMAT_TRP3F_C4B_T2F=5,
-1, // VERTEX_FORMAT_P3F_C4B_C4B,
(int)&(((SVF_P3F_N*)0)->normal), // VERTEX_FORMAT_P3F_N=1,
(int)&(((SVF_P3F_N_C4B*)0)->normal), // VERTEX_FORMAT_P3F_N_C4B=1,
(int)&(((SVF_P3F_N_T2F*)0)->normal), // VERTEX_FORMAT_P3F_N_T2F=3, // everything else (20 bytes)
(int)&(((SVF_P3F_N_C4B_T2F*)0)->normal), // VERTEX_FORMAT_P3F_N_C4B_T2F=4, // usually plants (24 bytes)
(int)&(((SVF_P3F_N_C4B_C4B*)0)->normal),
(INT_PTR)&(((SVF_P3F_N*)0)->normal), // VERTEX_FORMAT_P3F_N=1,
(INT_PTR)&(((SVF_P3F_N_C4B*)0)->normal), // VERTEX_FORMAT_P3F_N_C4B=1,
(INT_PTR)&(((SVF_P3F_N_T2F*)0)->normal), // VERTEX_FORMAT_P3F_N_T2F=3, // everything else (20 bytes)
(INT_PTR)&(((SVF_P3F_N_C4B_T2F*)0)->normal), // VERTEX_FORMAT_P3F_N_C4B_T2F=4, // usually plants (24 bytes)
(INT_PTR)&(((SVF_P3F_N_C4B_C4B*)0)->normal),
-1,
(int)&(((SVF_P3F_N_C4B_C4B_T2F*)0)->normal),
(INT_PTR)&(((SVF_P3F_N_C4B_C4B_T2F*)0)->normal),
};

static struct SBufInfoTable gBufInfoTable[] =
Expand All @@ -361,90 +361,90 @@ static struct SBufInfoTable gBufInfoTable[] =
0
},
{ //VERTEX_FORMAT_P3F
#define OOFS(x) (int)&(((SVF_P3F *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F *)0)->x)
0
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_C4B
#define OOFS(x) (int)&(((SVF_P3F_C4B *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_C4B *)0)->x)
0,
OOFS(color.dcolor),
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_T2F
#define OOFS(x) (int)&(((SVF_P3F_T2F *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_T2F *)0)->x)
OOFS(st[0])
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_C4B_T2F
#define OOFS(x) (int)&(((SVF_P3F_C4B_T2F *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_C4B_T2F *)0)->x)
OOFS(st[0]),
OOFS(color.dcolor)
#undef OOFS
},
{ //VERTEX_FORMAT_TRP3F_C4B_T2F
#define OOFS(x) (int)&(((SVF_TRP3F_C4B_T2F *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_TRP3F_C4B_T2F *)0)->x)
OOFS(st[0]),
OOFS(color.dcolor),
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_C4B_C4B
#define OOFS(x) (int)&(((SVF_P3F_C4B_C4B *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_C4B_C4B *)0)->x)
0,
OOFS(color.dcolor),
OOFS(seccolor.dcolor),
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_N
#define OOFS(x) (int)&(((SVF_P3F_N *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_N *)0)->x)
0,
0,
0,
OOFS(normal.x),
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_N_C4B
#define OOFS(x) (int)&(((SVF_P3F_N_C4B *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_N_C4B *)0)->x)
0,
OOFS(color.dcolor),
0,
OOFS(normal.x),
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_N_T2F
#define OOFS(x) (int)&(((SVF_P3F_N_T2F *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_N_T2F *)0)->x)
OOFS(st[0]),
0,
0,
OOFS(normal.x),
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_N_C4B_T2F
#define OOFS(x) (int)&(((SVF_P3F_N_C4B_T2F *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_N_C4B_T2F *)0)->x)
OOFS(st[0]),
OOFS(color.dcolor),
0,
OOFS(normal.x),
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_N_C4B_C4B
#define OOFS(x) (int)&(((SVF_P3F_N_C4B_C4B *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_N_C4B_C4B *)0)->x)
0,
OOFS(color.dcolor),
OOFS(seccolor.dcolor),
OOFS(normal.x),
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_C4B_C4B_T2F
#define OOFS(x) (int)&(((SVF_P3F_C4B_C4B_T2F *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_C4B_C4B_T2F *)0)->x)
OOFS(st[0]),
OOFS(color.dcolor),
OOFS(seccolor.dcolor),
0,
#undef OOFS
},
{ //VERTEX_FORMAT_P3F_N_C4B_C4B_T2F
#define OOFS(x) (int)&(((SVF_P3F_N_C4B_C4B_T2F *)0)->x)
#define OOFS(x) (INT_PTR)&(((SVF_P3F_N_C4B_C4B_T2F *)0)->x)
OOFS(st[0]),
OOFS(color.dcolor),
OOFS(seccolor.dcolor),
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/3DEngine/Scene/SceneSerialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void Scene::Serializator::loadLight(tinyxml2::XMLElement* light)
{
return;
}
baseLight->toStr = _strdup(tmp.c_str());
baseLight->toStr = strdup(tmp.c_str());
}

baseLight->ambient = serialization::loadColorAttribute(light->FirstChildElement("ambient"));
Expand Down
4 changes: 2 additions & 2 deletions src/Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ macro(main)
###################################################
#--------------------------------------------------
if (LINUX OR UNIX OR APPLE)
target_link_libraries(BlackBox PUBLIC ${CMAKE_DL_LIBS})
target_link_libraries(BlackBox INTERFACE ${CMAKE_DL_LIBS})
endif()
#--------------------------------------------------
#get_target_property(SOURCE_FILES ${BLACKBOX_PROJECT} SOURCES)
Expand All @@ -129,7 +129,7 @@ macro(main)
FILES ${SOURCE_FILES}
)
]]
install_target()
#install_target()
endmacro()

main()
6 changes: 4 additions & 2 deletions src/Engine/Input/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ if (OPTION_USE_SDL)
message(STATUS "Using sdl for Input System")
#################################################################
if (DEFINED LINUX )
#[[
if (NOT DEFINED VCPKG_INSTALLER)
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ${SDL2_LIBRARY})
target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIR})
else()
]]
add_package(SDL2)
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2-static)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2)
#endif()
else()
add_package(SDL2)
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2)
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Input/SDLInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <BlackBox/System/ISystem.hpp>
#include <BlackBox/Renderer/IRender.hpp>

#include <SDL.h>
#include <SDL2/SDL.h>

#include <BlackBox/Input/SDLKeyboard.hpp>
#include <BlackBox/Input/SDLMouse.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Input/SDLKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <BlackBox/Input/SDLMouse.hpp>
#include <BlackBox/System/ISystem.hpp>
#include <BlackBox/System/ILog.hpp>
#include <SDL.h>
#include <SDL2/SDL.h>
#include <BlackBox/Core/Utils.hpp>
//#include <SDL.h>

Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Input/SDLMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <BlackBox/Input/IHardwareMouse.hpp>
#include <BlackBox/Input/InputCVars.hpp>

#include <SDL.h>
#include <SDL2/SDL.h>

#define MOUSE_SYM_BASE (1024)
#define MOUSE_SYM(X) (MOUSE_SYM_BASE + (X))
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Renderer/BufferManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void CBufferManager::Draw(CVertexBuffer* src, SVertexStream* indicies, int numin
if (indicies != nullptr)
{
assert(numindices != 0);
auto s = sizeof GLushort;
auto s = sizeof(GLushort);
gl::BindBuffer(GL_ELEMENT_ARRAY_BUFFER, indicies->m_VertBuf.m_nID);
gl::DrawElements(gl_mode, numindices, GL_UNSIGNED_SHORT, reinterpret_cast<GLushort*>(offsindex * s + offset_in_buffer));
}
Expand Down
Loading

0 comments on commit ccef845

Please sign in to comment.