mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-22 02:20:25 +01:00
Merge branch 'master' of https://github.com/ptitSeb/Serious-Engine
This commit is contained in:
commit
c769194787
76
Sources/CMakeLists.txt
Normal file → Executable file
76
Sources/CMakeLists.txt
Normal file → Executable file
|
@ -90,7 +90,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|||
add_compile_options(-Wall)
|
||||
add_compile_options(-pipe)
|
||||
add_compile_options(-fPIC)
|
||||
add_compile_options(-march=native)
|
||||
if(NOT PANDORA)
|
||||
add_compile_options(-march=native)
|
||||
endif()
|
||||
add_compile_options(-fno-strict-aliasing)
|
||||
add_definitions(-D_REENTRANT=1)
|
||||
add_definitions(-D_MT=1)
|
||||
|
@ -99,15 +101,27 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|||
|
||||
## For C flags
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -D_DEBUG=1 -DDEBUG=1 -O0")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -O3 -fno-unsafe-math-optimizations")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -fno-unsafe-math-optimizations")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -fno-unsafe-math-optimizations")
|
||||
if(PANDORA)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 - -faligned-new -ffast-math")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -faligned-new -ffast-math")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -ffast-math")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -fno-unsafe-math-optimizations")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -fno-unsafe-math-optimizations")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -fno-unsafe-math-optimizations")
|
||||
endif()
|
||||
|
||||
## For C++ flags
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -D_DEBUG=1 -DDEBUG=1 -O0")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -O3 -fno-unsafe-math-optimizations")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -fno-unsafe-math-optimizations") ## RAKE! Does -DNDEBUG=1 and -D_NDEBUG=1 mess with RelWithDebInfo?
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -fno-unsafe-math-optimizations")
|
||||
if(PANDORA)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -O3 -faligned-new -ffast-math")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -faligned-new -ffast-math")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -ffast-math")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -O3 -fno-unsafe-math-optimizations")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -fno-unsafe-math-optimizations") ## RAKE! Does -DNDEBUG=1 and -D_NDEBUG=1 mess with RelWithDebInfo?
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -fno-unsafe-math-optimizations")
|
||||
endif()
|
||||
|
||||
# TODO fix these warnings
|
||||
add_compile_options(-Wno-switch)
|
||||
|
@ -118,7 +132,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|||
add_compile_options(-Wno-missing-braces)
|
||||
add_compile_options(-Wno-overloaded-virtual)
|
||||
add_compile_options(-Wno-invalid-offsetof)
|
||||
MESSAGE(WARNING, "re-enable some of the warnings some day!")
|
||||
#MESSAGE(WARNING, "re-enable some of the warnings some day!")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
|
||||
# !!! FIXME: turn a bunch of these off, this is just for now. I hope. --ryan.
|
||||
|
@ -702,6 +716,33 @@ if(NOT USE_SYSTEM_ZLIB)
|
|||
Engine/zlib/uncompr.c)
|
||||
endif()
|
||||
|
||||
set(ENGINE_SAFEMATH_SRCS
|
||||
Engine/Brushes/Brush.cpp
|
||||
Engine/Brushes/BrushPolygon.cpp
|
||||
Engine/Brushes/BrushSector.cpp
|
||||
Engine/Entities/Entity.cpp
|
||||
Engine/Entities/EntityClass.cpp
|
||||
Engine/Entities/EntityCollision.cpp
|
||||
Engine/Entities/PlayerCharacter.cpp
|
||||
Engine/Terrain/TerrainMisc.cpp
|
||||
Engine/Terrain/TerrainRayCasting.cpp
|
||||
Engine/World/WorldCSG.cpp
|
||||
Engine/World/WorldRayCasting.cpp
|
||||
Engine/World/WorldCollision.cpp
|
||||
Engine/World/WorldCollisionGrid.cpp
|
||||
|
||||
Engine/Math/Projection_Simple_DOUBLE.cpp
|
||||
Engine/Math/Geometry_DOUBLE.cpp
|
||||
)
|
||||
add_library(engine_safemath STATIC
|
||||
${ENGINE_SAFEMATH_SRCS}
|
||||
)
|
||||
target_compile_options(engine_safemath PRIVATE "-fno-unsafe-math-optimizations")
|
||||
if(PANDORA)
|
||||
target_compile_options(engine_safemath PRIVATE "-mfpu=vfpv3")
|
||||
endif()
|
||||
add_dependencies(engine_safemath ParseEntities)
|
||||
|
||||
set(ENGINE_SRCS
|
||||
${ENGINE_ENTITIES_CPP}
|
||||
Engine/Engine.cpp
|
||||
|
@ -741,23 +782,16 @@ set(ENGINE_SRCS
|
|||
Engine/Base/SDL/SDLInput.cpp
|
||||
Engine/Base/SDL/SDLEvents.cpp
|
||||
${SYNCHRO_SRCS}
|
||||
Engine/Brushes/Brush.cpp
|
||||
Engine/Brushes/BrushIO.cpp
|
||||
Engine/Brushes/BrushShadows.cpp
|
||||
Engine/Brushes/BrushTriangularize.cpp
|
||||
Engine/Brushes/BrushArchive.cpp
|
||||
Engine/Brushes/BrushImport.cpp
|
||||
Engine/Brushes/BrushMip.cpp
|
||||
Engine/Brushes/BrushPolygon.cpp
|
||||
Engine/Brushes/BrushExport.cpp
|
||||
Engine/Brushes/BrushSector.cpp
|
||||
Engine/Entities/Entity.cpp
|
||||
Engine/Entities/NearestPolygon.cpp
|
||||
Engine/Entities/EntityProperties.cpp
|
||||
Engine/Entities/PlayerCharacter.cpp
|
||||
Engine/Entities/EntityClass.cpp
|
||||
Engine/Entities/FieldBSPTesting.cpp
|
||||
Engine/Entities/EntityCollision.cpp
|
||||
Engine/Entities/EntityCopying.cpp
|
||||
Engine/Entities/LastPositions.cpp
|
||||
Engine/Math/Projection_Isometric.cpp
|
||||
|
@ -767,14 +801,12 @@ set(ENGINE_SRCS
|
|||
Engine/Math/Float.cpp
|
||||
Engine/Math/Object3D_CSG.cpp
|
||||
Engine/Math/Projection_Simple.cpp
|
||||
Engine/Math/Projection_Simple_DOUBLE.cpp
|
||||
Engine/Math/Functions.cpp
|
||||
Engine/Math/ObjectSector.cpp
|
||||
Engine/Math/Placement.cpp
|
||||
Engine/Math/TextureMapping.cpp
|
||||
Engine/Math/Geometry.cpp
|
||||
Engine/Math/Projection.cpp
|
||||
Engine/Math/Geometry_DOUBLE.cpp
|
||||
#Engine/Math/Object3D_IO.cpp # Exploration 3D support.
|
||||
#Engine/Models/EditModel.cpp
|
||||
Engine/Models/Model.cpp
|
||||
|
@ -837,8 +869,6 @@ set(ENGINE_SRCS
|
|||
Engine/Terrain/TerrainArchive.cpp
|
||||
Engine/Terrain/TerrainEditing.cpp
|
||||
Engine/Terrain/TerrainLayer.cpp
|
||||
Engine/Terrain/TerrainMisc.cpp
|
||||
Engine/Terrain/TerrainRayCasting.cpp
|
||||
Engine/Terrain/TerrainRender.cpp
|
||||
Engine/Terrain/TerrainTile.cpp
|
||||
Engine/Rendering/Render.cpp
|
||||
|
@ -873,14 +903,10 @@ set(ENGINE_SRCS
|
|||
Engine/Templates/NameTable_CTFileName.cpp
|
||||
Engine/Templates/NameTable_CTranslationPair.cpp
|
||||
Engine/Templates/BSP.cpp
|
||||
Engine/World/WorldCSG.cpp
|
||||
Engine/World/PhysicsProfile.cpp
|
||||
Engine/World/WorldCollision.cpp
|
||||
Engine/World/WorldIO.cpp
|
||||
Engine/World/WorldRayCasting.cpp
|
||||
Engine/World/World.cpp
|
||||
Engine/World/WorldCollisionGrid.cpp
|
||||
Engine/World/WorldEditingProfile.cpp
|
||||
Engine/World/WorldIO.cpp
|
||||
${ADDITIONAL_ENGINE_SRCS}
|
||||
${ZLIB_SRCS}
|
||||
)
|
||||
|
@ -900,10 +926,12 @@ add_executable(ssam
|
|||
SeriousSam/MenuGadgets.cpp
|
||||
SeriousSam/MenuPrinting.cpp
|
||||
)
|
||||
target_link_libraries(ssam engine_safemath)
|
||||
add_dependencies(ssam ParseEntities)
|
||||
# Make symbols in the main executable available to dynamic objects
|
||||
set_target_properties(ssam PROPERTIES ENABLE_EXPORTS ON)
|
||||
|
||||
|
||||
# !!! FIXME: this is an option because you have to recompile the entire engine twice.
|
||||
# !!! FIXME: If we can put the engine in a static library and not lose symbols,
|
||||
# !!! FIXME: that's a better plan and we can remove the toggle here.
|
||||
|
|
21
Sources/Engine/Terrain/TerrainMisc.cpp
Normal file → Executable file
21
Sources/Engine/Terrain/TerrainMisc.cpp
Normal file → Executable file
|
@ -310,10 +310,15 @@ Rect ExtractPolygonsInBox(CTerrain *ptrTerrain, const FLOATaabbox3D &bboxExtract
|
|||
if(!bFixSize) {
|
||||
// max vector of bbox in incremented for one, because first vertex is at 0,0,0 in world and in heightmap is at 1,1
|
||||
#ifdef __arm__
|
||||
rc.rc_iLeft = (isinf(bbox.minvect(1)))?(INDEX)0:Clamp((INDEX)(bbox.minvect(1)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iTop = (isinf(bbox.minvect(3)))?(INDEX)0:Clamp((INDEX)(bbox.minvect(3)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
rc.rc_iRight = (isinf(bbox.maxvect(1)))?(INDEX)0:Clamp((INDEX)ceil(bbox.maxvect(1)+1),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iBottom = (isinf(bbox.maxvect(3)))?(INDEX)0:Clamp((INDEX)ceil(bbox.maxvect(3)+1),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
#ifdef PANDORA
|
||||
#define Isinf(a) (((*(unsigned int*)&a)&0x7fffffff)==0x7f800000)
|
||||
#else
|
||||
#define Isinf insif
|
||||
#endif
|
||||
rc.rc_iLeft = (Isinf(bbox.minvect(1)))?(INDEX)0:Clamp((INDEX)(bbox.minvect(1)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iTop = (Isinf(bbox.minvect(3)))?(INDEX)0:Clamp((INDEX)(bbox.minvect(3)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
rc.rc_iRight = (Isinf(bbox.maxvect(1)))?(INDEX)0:Clamp((INDEX)ceil(bbox.maxvect(1)+1),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iBottom = (Isinf(bbox.maxvect(3)))?(INDEX)0:Clamp((INDEX)ceil(bbox.maxvect(3)+1),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
#else
|
||||
rc.rc_iLeft = Clamp((INDEX)(bbox.minvect(1)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iTop = Clamp((INDEX)(bbox.minvect(3)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
|
@ -323,10 +328,10 @@ Rect ExtractPolygonsInBox(CTerrain *ptrTerrain, const FLOATaabbox3D &bboxExtract
|
|||
} else {
|
||||
// max vector of bbox in incremented for one, because first vertex is at 0,0,0 in world and in heightmap is at 1,1
|
||||
#ifdef __arm__
|
||||
rc.rc_iLeft = (isinf(bbox.minvect(1)))?(INDEX)0:Clamp((INDEX)(bbox.minvect(1)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iTop = (isinf(bbox.minvect(3)))?(INDEX)0:Clamp((INDEX)(bbox.minvect(3)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
rc.rc_iRight = (isinf(bbox.maxvect(1)))?(INDEX)0:Clamp((INDEX)(bbox.maxvect(1)+0),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iBottom = (isinf(bbox.maxvect(3)))?(INDEX)0:Clamp((INDEX)(bbox.maxvect(3)+0),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
rc.rc_iLeft = (Isinf(bbox.minvect(1)))?(INDEX)0:Clamp((INDEX)(bbox.minvect(1)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iTop = (Isinf(bbox.minvect(3)))?(INDEX)0:Clamp((INDEX)(bbox.minvect(3)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
rc.rc_iRight = (Isinf(bbox.maxvect(1)))?(INDEX)0:Clamp((INDEX)(bbox.maxvect(1)+0),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iBottom = (Isinf(bbox.maxvect(3)))?(INDEX)0:Clamp((INDEX)(bbox.maxvect(3)+0),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
#else
|
||||
rc.rc_iLeft = Clamp((INDEX)(bbox.minvect(1)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapWidth);
|
||||
rc.rc_iTop = Clamp((INDEX)(bbox.minvect(3)-0),(INDEX)0,ptrTerrain->tr_pixHeightMapHeight);
|
||||
|
|
22
Sources/Engine/World/WorldCollisionGrid.cpp
Normal file → Executable file
22
Sources/Engine/World/WorldCollisionGrid.cpp
Normal file → Executable file
|
@ -14,7 +14,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
|
||||
|
||||
#include <Engine/StdH.h>
|
||||
#pragma GCC optimize 0
|
||||
//#pragma GCC optimize 0
|
||||
#include <Engine/World/World.h>
|
||||
#include <Engine/World/PhysicsProfile.h>
|
||||
#include <Engine/Templates/StaticStackArray.cpp>
|
||||
|
@ -47,15 +47,27 @@ static inline void BoxToGrid(
|
|||
FLOAT fMinZ = boxEntity.Min()(3);
|
||||
FLOAT fMaxX = boxEntity.Max()(1);
|
||||
FLOAT fMaxZ = boxEntity.Max()(3);
|
||||
iMinX = (isinf(fMinX))?INDEX(GRID_MIN):INDEX(floor(fMinX/GRID_CELLSIZE));
|
||||
iMinZ = (isinf(fMinZ))?INDEX(GRID_MIN):INDEX(floor(fMinZ/GRID_CELLSIZE));
|
||||
iMaxX = (isinf(fMaxX))?INDEX(GRID_MIN):INDEX(ceil(fMaxX/GRID_CELLSIZE));
|
||||
iMaxZ = (isinf(fMaxZ))?INDEX(GRID_MIN):INDEX(ceil(fMaxZ/GRID_CELLSIZE));
|
||||
#ifdef __arm__
|
||||
#ifdef PANDORA
|
||||
#define Isinf(a) (((*(unsigned int*)&a)&0x7fffffff)==0x7f800000)
|
||||
#else
|
||||
#define Isinf insif
|
||||
#endif
|
||||
iMinX = (Isinf(fMinX))?INDEX(GRID_MIN):Clamp(INDEX(floor(fMinX/GRID_CELLSIZE)), (INDEX)GRID_MIN, (INDEX)GRID_MAX);
|
||||
iMinZ = (Isinf(fMinZ))?INDEX(GRID_MIN):Clamp(INDEX(floor(fMinZ/GRID_CELLSIZE)), (INDEX)GRID_MIN, (INDEX)GRID_MAX);
|
||||
iMaxX = (Isinf(fMaxX))?INDEX(GRID_MIN):Clamp(INDEX(ceil(fMaxX/GRID_CELLSIZE)), (INDEX)GRID_MIN, (INDEX)GRID_MAX);
|
||||
iMaxZ = (Isinf(fMaxZ))?INDEX(GRID_MIN):Clamp(INDEX(ceil(fMaxZ/GRID_CELLSIZE)), (INDEX)GRID_MIN, (INDEX)GRID_MAX);
|
||||
#else
|
||||
iMinX = INDEX(GRID_MIN):INDEX(floor(fMinX/GRID_CELLSIZE));
|
||||
iMinZ = INDEX(GRID_MIN):INDEX(floor(fMinZ/GRID_CELLSIZE));
|
||||
iMaxX = INDEX(GRID_MIN):INDEX(ceil(fMaxX/GRID_CELLSIZE));
|
||||
iMaxZ = INDEX(GRID_MIN):INDEX(ceil(fMaxZ/GRID_CELLSIZE));
|
||||
|
||||
iMinX = Clamp(iMinX, (INDEX)GRID_MIN, (INDEX)GRID_MAX);
|
||||
iMinZ = Clamp(iMinZ, (INDEX)GRID_MIN, (INDEX)GRID_MAX);
|
||||
iMaxX = Clamp(iMaxX, (INDEX)GRID_MIN, (INDEX)GRID_MAX);
|
||||
iMaxZ = Clamp(iMaxZ, (INDEX)GRID_MIN, (INDEX)GRID_MAX);
|
||||
#endif
|
||||
}
|
||||
|
||||
// key calculations
|
||||
|
|
Loading…
Reference in New Issue
Block a user