Refactor CMakeLists.txt files to use more modern CMAKE
This commit is contained in:
parent
3df602edfa
commit
39bbd6ec6d
18
.travis.yml
18
.travis.yml
|
@ -55,7 +55,7 @@ matrix:
|
|||
packages:
|
||||
- g++-7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE="Debug" DOUBLE_PRECISION="False" LOGGER="True" Profiler="True"
|
||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE="Debug" DOUBLE_PRECISION="False" Profiler="True"
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
|
@ -64,7 +64,7 @@ matrix:
|
|||
packages:
|
||||
- g++-7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE="Release" DOUBLE_PRECISION="False" LOGGER="True" Profiler="True"
|
||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE="Release" DOUBLE_PRECISION="False" Profiler="True"
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
|
@ -108,11 +108,11 @@ matrix:
|
|||
#- os: osx
|
||||
# osx_image: xcode9.3
|
||||
# env:
|
||||
# - MATRIX_EVAL="brew update && brew install gcc && CC=gcc-7 && CXX=g++-7" BUILD_TYPE="Debug" DOUBLE_PRECISION="True" LOGGER="True" PROFILER="True"
|
||||
# - MATRIX_EVAL="brew update && brew install gcc && CC=gcc-7 && CXX=g++-7" BUILD_TYPE="Debug" DOUBLE_PRECISION="True" PROFILER="True"
|
||||
#- os: osx
|
||||
# osx_image: xcode9.3
|
||||
# env:
|
||||
# - MATRIX_EVAL="brew update && brew install gcc && CC=gcc-7 && CXX=g++-7" BUILD_TYPE="Release" DOUBLE_PRECISION="True" LOGGER="True" PROFILER="True"
|
||||
# - MATRIX_EVAL="brew update && brew install gcc && CC=gcc-7 && CXX=g++-7" BUILD_TYPE="Release" DOUBLE_PRECISION="True" PROFILER="True"
|
||||
|
||||
# ----- Linux / Clang -----
|
||||
- os: linux
|
||||
|
@ -172,7 +172,7 @@ matrix:
|
|||
- clang-3.8
|
||||
- g++-7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8" BUILD_TYPE="Debug" DOUBLE_PRECISION="True" LOGGER="True" PROFILER="True"
|
||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8" BUILD_TYPE="Debug" DOUBLE_PRECISION="True" PROFILER="True"
|
||||
- os: linux
|
||||
addons:
|
||||
apt:
|
||||
|
@ -183,7 +183,7 @@ matrix:
|
|||
- clang-3.8
|
||||
- g++-7
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8" BUILD_TYPE="Release" DOUBLE_PRECISION="True" LOGGER="True" PROFILER="True"
|
||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8" BUILD_TYPE="Release" DOUBLE_PRECISION="True" PROFILER="True"
|
||||
|
||||
# ----- OS X / Clang -----
|
||||
- os: osx
|
||||
|
@ -209,12 +209,12 @@ matrix:
|
|||
- os: osx
|
||||
osx_image: xcode8
|
||||
env:
|
||||
- BUILD_TYPE="Debug" DOUBLE_PRECISION="True" LOGGER="True" PROFILER="True"
|
||||
- BUILD_TYPE="Debug" DOUBLE_PRECISION="True" PROFILER="True"
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
env:
|
||||
- BUILD_TYPE="Release" DOUBLE_PRECISION="True" LOGGER="True" PROFILER="True"
|
||||
- BUILD_TYPE="Release" DOUBLE_PRECISION="True" PROFILER="True"
|
||||
|
||||
before_install:
|
||||
- eval "${MATRIX_EVAL}"
|
||||
|
@ -227,7 +227,7 @@ branches:
|
|||
script:
|
||||
- mkdir build_directory
|
||||
- cd build_directory
|
||||
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} —DRP3D_DOUBLE_PRECISION_ENABLED=${DOUBLE_PRECISION} -DRP3D_COMPILE_TESTS=True -DRP3D_LOGS_ENABLE=${LOGGER} -DRP3D_PROFILING_ENABLED=${PROFILER} -DRP3D_CODE_COVERAGE_ENABLED=${CODE_COVERAGE} ../
|
||||
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} —DRP3D_DOUBLE_PRECISION_ENABLED=${DOUBLE_PRECISION} -DRP3D_COMPILE_TESTS=True -DRP3D_PROFILING_ENABLED=${PROFILER} -DRP3D_CODE_COVERAGE_ENABLED=${CODE_COVERAGE} ../
|
||||
- make && make test ARGS="-V"
|
||||
- if [ "${VALGRIND}" == "True" ]; then
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --error-exitcode=1 test/tests;
|
||||
|
|
120
CMakeLists.txt
120
CMakeLists.txt
|
@ -1,79 +1,46 @@
|
|||
# Minimum cmake version required
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
# Project configuration
|
||||
PROJECT(REACTPHYSICS3D LANGUAGES CXX)
|
||||
project(REACTPHYSICS3D LANGUAGES CXX)
|
||||
|
||||
# In order to install libraries into correct locations on all platforms.
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Build type
|
||||
IF (NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE "Release")
|
||||
ENDIF()
|
||||
|
||||
# Where to build the library
|
||||
SET(LIBRARY_OUTPUT_PATH "lib")
|
||||
|
||||
# Where to build the executables
|
||||
SET(OUR_EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin")
|
||||
# Set default build type
|
||||
set(default_build_type "Release")
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
||||
STRING "Choose the type of build." FORCE)
|
||||
# Set the possible values of build type for cmake-gui
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
# CMake modules path
|
||||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
|
||||
|
||||
# Enable testing
|
||||
ENABLE_TESTING()
|
||||
enable_testing()
|
||||
|
||||
# Options
|
||||
OPTION(RP3D_COMPILE_TESTBED "Select this if you want to build the testbed application" OFF)
|
||||
OPTION(RP3D_COMPILE_TESTS "Select this if you want to build the tests" OFF)
|
||||
OPTION(RP3D_PROFILING_ENABLED "Select this if you want to compile with enabled profiling" OFF)
|
||||
OPTION(RP3D_LOGS_ENABLED "Select this if you want to compile with logs enabled during execution" OFF)
|
||||
OPTION(RP3D_CODE_COVERAGE_ENABLED "Select this if you need to build for code coverage calculation" OFF)
|
||||
OPTION(RP3D_DOUBLE_PRECISION_ENABLED "Select this if you want to compile using double precision floating
|
||||
values" OFF)
|
||||
option(RP3D_COMPILE_TESTBED "Select this if you want to build the testbed application with demos" OFF)
|
||||
option(RP3D_COMPILE_TESTS "Select this if you want to build the unit tests" OFF)
|
||||
option(RP3D_PROFILING_ENABLED "Select this if you want to compile for performanace profiling" OFF)
|
||||
option(RP3D_CODE_COVERAGE_ENABLED "Select this if you need to build for code coverage calculation" OFF)
|
||||
option(RP3D_DOUBLE_PRECISION_ENABLED "Select this if you want to compile using double precision floating values" OFF)
|
||||
|
||||
# Warning Compiler flags
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
|
||||
IF(RP3D_CODE_COVERAGE_ENABLED)
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(RP3D_CODE_COVERAGE_ENABLED)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
INCLUDE(CodeCoverage)
|
||||
SETUP_TARGET_FOR_COVERAGE(${PROJECT_NAME}_coverage tests coverage)
|
||||
ENDIF()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
ENDIF()
|
||||
|
||||
# C++11 flags
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
IF(COMPILER_SUPPORTS_CXX11)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
ELSE()
|
||||
message("The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Use libc++ with Clang
|
||||
#IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
#ENDIF()
|
||||
|
||||
IF(RP3D_PROFILING_ENABLED)
|
||||
ADD_DEFINITIONS(-DIS_PROFILING_ACTIVE)
|
||||
ENDIF()
|
||||
|
||||
IF(RP3D_LOGS_ENABLED)
|
||||
ADD_DEFINITIONS(-DIS_LOGGING_ACTIVE)
|
||||
ENDIF()
|
||||
|
||||
IF(RP3D_DOUBLE_PRECISION_ENABLED)
|
||||
ADD_DEFINITIONS(-DIS_DOUBLE_PRECISION_ENABLED)
|
||||
ENDIF()
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
endif()
|
||||
|
||||
# Headers filen1s
|
||||
SET (REACTPHYSICS3D_HEADERS
|
||||
set (REACTPHYSICS3D_HEADERS
|
||||
"include/reactphysics3d/configuration.h"
|
||||
"include/reactphysics3d/decimal.h"
|
||||
"include/reactphysics3d/reactphysics3d.h"
|
||||
|
@ -185,7 +152,7 @@ SET (REACTPHYSICS3D_HEADERS
|
|||
)
|
||||
|
||||
# Source files
|
||||
SET (REACTPHYSICS3D_SOURCES
|
||||
set (REACTPHYSICS3D_SOURCES
|
||||
"src/body/CollisionBody.cpp"
|
||||
"src/body/RigidBody.cpp"
|
||||
"src/collision/broadphase/DynamicAABBTree.cpp"
|
||||
|
@ -276,38 +243,53 @@ SET (REACTPHYSICS3D_SOURCES
|
|||
)
|
||||
|
||||
# Create the library
|
||||
ADD_LIBRARY(reactphysics3d ${REACTPHYSICS3D_HEADERS} ${REACTPHYSICS3D_SOURCES})
|
||||
add_library(reactphysics3d ${REACTPHYSICS3D_HEADERS} ${REACTPHYSICS3D_SOURCES})
|
||||
|
||||
# C++11 compiler features
|
||||
target_compile_features(reactphysics3d PUBLIC cxx_std_11)
|
||||
set_target_properties(reactphysics3d PROPERTIES CXX_EXTENSIONS OFF)
|
||||
|
||||
# Compile with warning messages
|
||||
target_compile_options(reactphysics3d PRIVATE -Wall)
|
||||
|
||||
# Headers
|
||||
TARGET_INCLUDE_DIRECTORIES(reactphysics3d PUBLIC
|
||||
target_include_directories(reactphysics3d PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
# If we need to compile the testbed application
|
||||
IF(RP3D_COMPILE_TESTBED)
|
||||
if(RP3D_COMPILE_TESTBED)
|
||||
add_subdirectory(testbed/)
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
# If we need to compile the tests
|
||||
IF(RP3D_COMPILE_TESTS)
|
||||
if(RP3D_COMPILE_TESTS)
|
||||
add_subdirectory(test/)
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
#SET_TARGET_PROPERTIES(reactphysics3d PROPERTIES PUBLIC_HEADER "${REACTPHYSICS3D_HEADERS}")
|
||||
# Enable profiling if necessary
|
||||
if(RP3D_PROFILING_ENABLED)
|
||||
target_compile_definitions(reactphysics3d PUBLIC IS_RP3D_PROFILING_ENABLED)
|
||||
endif()
|
||||
|
||||
# Enable double precision if necessary
|
||||
if(RP3D_DOUBLE_PRECISION_ENABLED)
|
||||
target_compile_definitions(reactphysics3d PUBLIC IS_RP3D_DOUBLE_PRECISION_ENABLED)
|
||||
endif()
|
||||
|
||||
# Version number and soname for the library
|
||||
SET_TARGET_PROPERTIES(reactphysics3d PROPERTIES
|
||||
set_target_properties(reactphysics3d PROPERTIES
|
||||
VERSION "0.7.1"
|
||||
SOVERSION "0.7"
|
||||
)
|
||||
|
||||
# Install target (install library only, not headers)
|
||||
INSTALL(TARGETS reactphysics3d
|
||||
install(TARGETS reactphysics3d
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
# Install the headers separately (because INSTALL(TARGETS ... PUBLIC_HEADER DESTINATION ...) does not support subfolders
|
||||
INSTALL(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
|
|
@ -62,7 +62,7 @@ class CollisionBody {
|
|||
/// Reference to the world the body belongs to
|
||||
PhysicsWorld& mWorld;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -157,7 +157,7 @@ class CollisionBody {
|
|||
/// Return the body local-space coordinates of a vector given in the world-space coordinates
|
||||
Vector3 getLocalVector(const Vector3& worldVector) const;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
virtual void setProfiler(Profiler* profiler);
|
||||
|
@ -190,7 +190,7 @@ inline Entity CollisionBody::getEntity() const {
|
|||
return mEntity;
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void CollisionBody::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -183,7 +183,7 @@ class RigidBody : public CollisionBody {
|
|||
/// Remove a collider from the body
|
||||
virtual void removeCollider(Collider* collider) override;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler) override;
|
||||
|
|
|
@ -65,7 +65,7 @@ class Collider {
|
|||
/// Pointer to user data
|
||||
void* mUserData;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -160,7 +160,7 @@ class Collider {
|
|||
/// Set whether the collider is a trigger
|
||||
void setIsTrigger(bool isTrigger) const;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
|
|
@ -161,7 +161,7 @@ class DynamicAABBTree {
|
|||
/// The fat AABB is the initial AABB inflated by a given percentage of its size.
|
||||
decimal mFatAABBInflatePercentage;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -254,7 +254,7 @@ class DynamicAABBTree {
|
|||
/// Clear all the nodes and reset the tree
|
||||
void reset();
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -316,7 +316,7 @@ inline int32 DynamicAABBTree::addObject(const AABB& aabb, void* data) {
|
|||
return nodeId;
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void DynamicAABBTree::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -105,7 +105,7 @@ class CollisionDispatch {
|
|||
/// use between two types of collision shapes.
|
||||
NarrowPhaseAlgorithmType selectAlgorithm(int type1, int type2);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -163,7 +163,7 @@ class CollisionDispatch {
|
|||
NarrowPhaseAlgorithmType selectNarrowPhaseAlgorithm(const CollisionShapeType& shape1Type,
|
||||
const CollisionShapeType& shape2Type) const;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -202,7 +202,7 @@ inline ConvexPolyhedronVsConvexPolyhedronAlgorithm* CollisionDispatch::getConvex
|
|||
return mConvexPolyhedronVsConvexPolyhedronAlgorithm;
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void CollisionDispatch::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -65,7 +65,7 @@ class GJKAlgorithm {
|
|||
|
||||
// -------------------- Attributes -------------------- //
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -100,7 +100,7 @@ class GJKAlgorithm {
|
|||
void testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex,
|
||||
uint batchNbItems, List<GJKResult>& gjkResults);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -109,7 +109,7 @@ class GJKAlgorithm {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void GJKAlgorithm::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -70,7 +70,7 @@ class NarrowPhaseAlgorithm {
|
|||
|
||||
// -------------------- Attributes -------------------- //
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -94,7 +94,7 @@ class NarrowPhaseAlgorithm {
|
|||
/// Deleted assignment operator
|
||||
NarrowPhaseAlgorithm& operator=(const NarrowPhaseAlgorithm& algorithm) = delete;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -103,7 +103,7 @@ class NarrowPhaseAlgorithm {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void NarrowPhaseAlgorithm::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -78,7 +78,7 @@ class SATAlgorithm {
|
|||
/// Memory allocator
|
||||
MemoryAllocator& mMemoryAllocator;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -173,7 +173,7 @@ class SATAlgorithm {
|
|||
/// Test collision between two convex meshes
|
||||
bool testCollisionConvexPolyhedronVsConvexPolyhedron(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, uint batchNbItems) const;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -182,7 +182,7 @@ class SATAlgorithm {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void SATAlgorithm::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -79,7 +79,7 @@ class CollisionShape {
|
|||
/// List of the colliders associated with this shape
|
||||
List<Collider*> mColliders;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -152,7 +152,7 @@ class CollisionShape {
|
|||
/// Return the string representation of the shape
|
||||
virtual std::string to_string() const=0;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
virtual void setProfiler(Profiler* profiler);
|
||||
|
@ -199,7 +199,7 @@ inline void CollisionShape::removeCollider(Collider* collider) {
|
|||
mColliders.remove(collider);
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void CollisionShape::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -82,7 +82,7 @@ class ConcaveMeshRaycastCallback : public DynamicAABBTreeRaycastCallback {
|
|||
MemoryAllocator& mAllocator;
|
||||
const Vector3& mMeshScale;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -110,7 +110,7 @@ class ConcaveMeshRaycastCallback : public DynamicAABBTreeRaycastCallback {
|
|||
return mIsHit;
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler) {
|
||||
|
@ -196,7 +196,7 @@ class ConcaveMeshShape : public ConcaveShape {
|
|||
/// Return the string representation of the shape
|
||||
virtual std::string to_string() const override;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
virtual void setProfiler(Profiler* profiler) override;
|
||||
|
@ -250,7 +250,7 @@ inline void ConvexTriangleAABBOverlapCallback::notifyOverlappingNode(int nodeId)
|
|||
mTriangleTestCallback.testTriangle(trianglePoints, verticesNormals, mConcaveMeshShape.computeTriangleShapeId(data[0], data[1]));
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void ConcaveMeshShape::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
/// ReactPhysiscs3D namespace
|
||||
namespace reactphysics3d {
|
||||
|
||||
#if defined(IS_DOUBLE_PRECISION_ENABLED) // If we are compiling for double precision
|
||||
#if defined(IS_RP3D_DOUBLE_PRECISION_ENABLED) // If we are compiling for double precision
|
||||
using decimal = double;
|
||||
#else // If we are compiling for single precision
|
||||
using decimal = float;
|
||||
|
|
|
@ -194,7 +194,7 @@ class OverlappingPairs {
|
|||
/// Reference to the collision dispatch
|
||||
CollisionDispatch& mCollisionDispatch;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -297,7 +297,7 @@ class OverlappingPairs {
|
|||
/// Set to true if the two colliders of the pair were already colliding the previous frame
|
||||
void setCollidingInPreviousFrame(uint64 pairId, bool wereCollidingInPreviousFrame);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -407,7 +407,7 @@ inline void OverlappingPairs::setCollidingInPreviousFrame(uint64 pairId, bool we
|
|||
mCollidingInPreviousFrame[mMapPairIdToPairIndex[pairId]] = wereCollidingInPreviousFrame;
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void OverlappingPairs::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -98,7 +98,7 @@ class PhysicsCommon {
|
|||
void release();
|
||||
|
||||
// If profiling is enabled
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Create and return a new profiler
|
||||
Profiler* createProfiler();
|
||||
|
|
|
@ -229,7 +229,7 @@ class PhysicsWorld {
|
|||
/// Name of the physics world
|
||||
std::string mName;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Real-time hierarchical profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -461,7 +461,7 @@ class PhysicsWorld {
|
|||
/// Return a reference to the Debug Renderer of the world
|
||||
DebugRenderer& getDebugRenderer();
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Return a reference to the profiler
|
||||
Profiler* getProfiler();
|
||||
|
@ -584,7 +584,7 @@ inline const std::string& PhysicsWorld::getName() const {
|
|||
return mName;
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Return a pointer to the profiler
|
||||
/**
|
||||
|
|
|
@ -131,7 +131,7 @@ class BroadPhaseSystem {
|
|||
/// Reference to the collision detection object
|
||||
CollisionDetectionSystem& mCollisionDetection;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -198,7 +198,7 @@ class BroadPhaseSystem {
|
|||
/// Ray casting method
|
||||
void raycast(const Ray& ray, RaycastTest& raycastTest, unsigned short raycastWithCategoryMaskBits) const;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -225,7 +225,7 @@ inline Collider* BroadPhaseSystem::getColliderForBroadPhaseId(int broadPhaseId)
|
|||
return static_cast<Collider*>(mDynamicAABBTree.getNodeDataPointer(broadPhaseId));
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void BroadPhaseSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -166,7 +166,7 @@ class CollisionDetectionSystem {
|
|||
/// Map a body entity to the list of contact pairs in which it is involved
|
||||
Map<Entity, List<uint>> mMapBodyToContactPairs;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -361,7 +361,7 @@ class CollisionDetectionSystem {
|
|||
/// Return the world event listener
|
||||
EventListener* getWorldEventListener();
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -440,7 +440,7 @@ inline void CollisionDetectionSystem::updateColliders(decimal timeStep) {
|
|||
mBroadPhaseSystem.updateColliders(timeStep);
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void CollisionDetectionSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -173,7 +173,7 @@ class ConstraintSolverSystem {
|
|||
/// Solver for the SliderJoint constraints
|
||||
SolveSliderJointSystem mSolveSliderJointSystem;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -209,7 +209,7 @@ class ConstraintSolverSystem {
|
|||
/// Enable/Disable the Non-Linear-Gauss-Seidel position correction technique.
|
||||
void setIsNonLinearGaussSeidelPositionCorrectionActive(bool isActive);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -218,7 +218,7 @@ class ConstraintSolverSystem {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void ConstraintSolverSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -330,7 +330,7 @@ class ContactSolverSystem {
|
|||
/// True if the split impulse position correction is active
|
||||
bool mIsSplitImpulseActive;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -391,7 +391,7 @@ class ContactSolverSystem {
|
|||
/// Activate or Deactivate the split impulses for contacts
|
||||
void setIsSplitImpulseActive(bool isActive);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -409,7 +409,7 @@ inline void ContactSolverSystem::setIsSplitImpulseActive(bool isActive) {
|
|||
mIsSplitImpulseActive = isActive;
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void ContactSolverSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -69,7 +69,7 @@ class DynamicsSystem {
|
|||
/// Reference to the world gravity vector
|
||||
Vector3& mGravity;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -87,7 +87,7 @@ class DynamicsSystem {
|
|||
/// Destructor
|
||||
~DynamicsSystem() = default;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -111,7 +111,7 @@ class DynamicsSystem {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void DynamicsSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -74,7 +74,7 @@ class SolveBallAndSocketJointSystem {
|
|||
/// True if warm starting of the solver is active
|
||||
bool mIsWarmStartingActive;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -111,7 +111,7 @@ class SolveBallAndSocketJointSystem {
|
|||
/// Set to true to enable warm starting
|
||||
void setIsWarmStartingActive(bool isWarmStartingActive);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -120,7 +120,7 @@ class SolveBallAndSocketJointSystem {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void SolveBallAndSocketJointSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -73,7 +73,7 @@ class SolveFixedJointSystem {
|
|||
/// True if warm starting of the solver is active
|
||||
bool mIsWarmStartingActive;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -108,7 +108,7 @@ class SolveFixedJointSystem {
|
|||
/// Set to true to enable warm starting
|
||||
void setIsWarmStartingActive(bool isWarmStartingActive);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -117,7 +117,7 @@ class SolveFixedJointSystem {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void SolveFixedJointSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -73,7 +73,7 @@ class SolveHingeJointSystem {
|
|||
/// True if warm starting of the solver is active
|
||||
bool mIsWarmStartingActive;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -126,7 +126,7 @@ class SolveHingeJointSystem {
|
|||
/// Set to true to enable warm starting
|
||||
void setIsWarmStartingActive(bool isWarmStartingActive);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -135,7 +135,7 @@ class SolveHingeJointSystem {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void SolveHingeJointSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -73,7 +73,7 @@ class SolveSliderJointSystem {
|
|||
/// True if warm starting of the solver is active
|
||||
bool mIsWarmStartingActive;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Pointer to the profiler
|
||||
Profiler* mProfiler;
|
||||
|
@ -112,7 +112,7 @@ class SolveSliderJointSystem {
|
|||
/// Set to true to enable warm starting
|
||||
void setIsWarmStartingActive(bool isWarmStartingActive);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
/// Set the profiler
|
||||
void setProfiler(Profiler* profiler);
|
||||
|
@ -121,7 +121,7 @@ class SolveSliderJointSystem {
|
|||
|
||||
};
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Set the profiler
|
||||
inline void SolveSliderJointSystem::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#define REACTPHYSICS3D_PROFILER_H
|
||||
|
||||
// If profiling is enabled
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Libraries
|
||||
#include <reactphysics3d/configuration.h>
|
||||
|
|
|
@ -43,7 +43,8 @@ using namespace reactphysics3d;
|
|||
CollisionBody::CollisionBody(PhysicsWorld& world, Entity entity)
|
||||
: mEntity(entity), mWorld(world) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
mProfiler = nullptr;
|
||||
#endif
|
||||
|
||||
|
@ -92,7 +93,8 @@ Collider* CollisionBody::addCollider(CollisionShape* collisionShape, const Trans
|
|||
// Assign the collider with the collision shape
|
||||
collisionShape->addCollider(collider);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Set the profiler
|
||||
collider->setProfiler(mProfiler);
|
||||
|
|
|
@ -582,7 +582,8 @@ Collider* RigidBody::addCollider(CollisionShape* collisionShape, const Transform
|
|||
// Assign the collider with the collision shape
|
||||
collisionShape->addCollider(collider);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Set the profiler
|
||||
collider->setProfiler(mProfiler);
|
||||
|
@ -905,7 +906,8 @@ void RigidBody::setIsActive(bool isActive) {
|
|||
CollisionBody::setIsActive(isActive);
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Set the profiler
|
||||
void RigidBody::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -247,7 +247,8 @@ void Collider::setIsTrigger(bool isTrigger) const {
|
|||
mBody->mWorld.mCollidersComponents.setIsTrigger(mEntity, isTrigger);
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Set the profiler
|
||||
void Collider::setProfiler(Profiler* profiler) {
|
||||
|
|
|
@ -50,7 +50,8 @@ bool CapsuleVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& nar
|
|||
GJKAlgorithm gjkAlgorithm;
|
||||
SATAlgorithm satAlgorithm(clipWithPreviousAxisIfStillColliding, memoryAllocator);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
gjkAlgorithm.setProfiler(mProfiler);
|
||||
satAlgorithm.setProfiler(mProfiler);
|
||||
|
|
|
@ -42,7 +42,8 @@ bool ConvexPolyhedronVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoB
|
|||
// Run the SAT algorithm to find the separating axis and compute contact point
|
||||
SATAlgorithm satAlgorithm(clipWithPreviousAxisIfStillColliding, memoryAllocator);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
satAlgorithm.setProfiler(mProfiler);
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ const decimal SATAlgorithm::SEPARATING_AXIS_ABSOLUTE_TOLERANCE = decimal(0.0005)
|
|||
SATAlgorithm::SATAlgorithm(bool clipWithPreviousAxisIfStillColliding, MemoryAllocator& memoryAllocator)
|
||||
: mClipWithPreviousAxisIfStillColliding(clipWithPreviousAxisIfStillColliding), mMemoryAllocator(memoryAllocator) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
mProfiler = nullptr;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ bool SphereVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& narr
|
|||
|
||||
bool isCollisionFound = false;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
gjkAlgorithm.setProfiler(mProfiler);
|
||||
|
||||
|
@ -82,7 +83,8 @@ bool SphereVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& narr
|
|||
// Run the SAT algorithm to find the separating axis and compute contact point
|
||||
SATAlgorithm satAlgorithm(clipWithPreviousAxisIfStillColliding, memoryAllocator);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
satAlgorithm.setProfiler(mProfiler);
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ using namespace reactphysics3d;
|
|||
CollisionShape::CollisionShape(CollisionShapeName name, CollisionShapeType type, MemoryAllocator &allocator)
|
||||
: mType(type), mName(name), mId(0), mColliders(allocator) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
mProfiler = nullptr;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -182,7 +182,8 @@ bool ConcaveMeshShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collide
|
|||
// Create the callback object that will compute ray casting against triangles
|
||||
ConcaveMeshRaycastCallback raycastCallback(mDynamicAABBTree, *this, collider, raycastInfo, scaledRay, mScale, allocator);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Set the profiler
|
||||
raycastCallback.setProfiler(mProfiler);
|
||||
|
@ -249,7 +250,8 @@ void ConcaveMeshRaycastCallback::raycastTriangles() {
|
|||
TriangleShape triangleShape(trianglePoints, verticesNormals, mConcaveMeshShape.computeTriangleShapeId(data[0], data[1]), mAllocator);
|
||||
triangleShape.setRaycastTestType(mConcaveMeshShape.getRaycastTestType());
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Set the profiler to the triangle shape
|
||||
triangleShape.setProfiler(mProfiler);
|
||||
|
|
|
@ -256,7 +256,8 @@ bool HeightFieldShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collide
|
|||
TriangleShape triangleShape(&(triangleVertices[i * 3]), &(triangleVerticesNormals[i * 3]), shapeIds[i], allocator);
|
||||
triangleShape.setRaycastTestType(getRaycastTestType());
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Set the profiler to the triangle shape
|
||||
triangleShape.setProfiler(mProfiler);
|
||||
|
|
|
@ -104,7 +104,8 @@ void PhysicsCommon::release() {
|
|||
}
|
||||
|
||||
// If profiling is enabled
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Destroy the profilers
|
||||
for (auto it = mProfilers.begin(); it != mProfilers.end(); ++it) {
|
||||
|
@ -120,7 +121,8 @@ PhysicsWorld* PhysicsCommon::createPhysicsWorld(const PhysicsWorld::WorldSetting
|
|||
|
||||
Profiler* profiler = nullptr;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
profiler = createProfiler();
|
||||
|
||||
|
@ -373,7 +375,8 @@ void PhysicsCommon::destroyDefaultLogger(DefaultLogger* logger) {
|
|||
}
|
||||
|
||||
// If profiling is enabled
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Create and return a new profiler
|
||||
/// Note that you need to use a different profiler for each PhysicsWorld.
|
||||
|
|
|
@ -85,7 +85,8 @@ PhysicsWorld::PhysicsWorld(MemoryManager& memoryManager, const WorldSettings& wo
|
|||
mName = ss.str();
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
assert(profiler != nullptr);
|
||||
mProfiler = profiler;
|
||||
|
@ -121,7 +122,8 @@ PhysicsWorld::~PhysicsWorld() {
|
|||
destroyCollisionBody(mCollisionBodies[i]);
|
||||
}
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Print the profiling report into the destinations
|
||||
mProfiler->printReport();
|
||||
|
@ -175,7 +177,8 @@ CollisionBody* PhysicsWorld::createCollisionBody(const Transform& transform) {
|
|||
// Add the collision body to the world
|
||||
mCollisionBodies.add(collisionBody);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
collisionBody->setProfiler(mProfiler);
|
||||
|
||||
|
@ -313,7 +316,8 @@ AABB PhysicsWorld::getWorldAABB(const Collider* collider) const {
|
|||
*/
|
||||
void PhysicsWorld::update(decimal timeStep) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
// Increment the frame counter of the profiler
|
||||
mProfiler->incrementFrameCounter();
|
||||
#endif
|
||||
|
@ -462,7 +466,8 @@ RigidBody* PhysicsWorld::createRigidBody(const Transform& transform) {
|
|||
// Add the rigid body to the physics world
|
||||
mRigidBodies.add(rigidBody);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
rigidBody->setProfiler(mProfiler);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ BroadPhaseSystem::BroadPhaseSystem(CollisionDetectionSystem& collisionDetection,
|
|||
mRigidBodyComponents(rigidBodyComponents), mMovedShapes(collisionDetection.getMemoryManager().getPoolAllocator()),
|
||||
mCollisionDetection(collisionDetection) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
mProfiler = nullptr;
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ CollisionDetectionSystem::CollisionDetectionSystem(PhysicsWorld* world, Collider
|
|||
mContactPoints2(mMemoryManager.getPoolAllocator()), mPreviousContactPoints(&mContactPoints1),
|
||||
mCurrentContactPoints(&mContactPoints2), mMapBodyToContactPairs(mMemoryManager.getSingleFrameAllocator()) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
mProfiler = nullptr;
|
||||
mCollisionDispatch.setProfiler(mProfiler);
|
||||
|
@ -412,7 +413,8 @@ void CollisionDetectionSystem::computeConvexVsConcaveMiddlePhase(uint64 pairInde
|
|||
TriangleShape* triangleShape = new (allocator.allocate(sizeof(TriangleShape)))
|
||||
TriangleShape(&(triangleVertices[i * 3]), &(triangleVerticesNormals[i * 3]), shapeIds[i], allocator);
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Set the profiler to the triangle shape
|
||||
triangleShape->setProfiler(mProfiler);
|
||||
|
|
|
@ -47,7 +47,8 @@ ConstraintSolverSystem::ConstraintSolverSystem(PhysicsWorld& world, Islands& isl
|
|||
mSolveHingeJointSystem(world, rigidBodyComponents, transformComponents, jointComponents, hingeJointComponents),
|
||||
mSolveSliderJointSystem(world, rigidBodyComponents, transformComponents, jointComponents, sliderJointComponents) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
mProfiler = nullptr;
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ ContactSolverSystem::ContactSolverSystem(MemoryManager& memoryManager, PhysicsWo
|
|||
mBodyComponents(bodyComponents), mRigidBodyComponents(rigidBodyComponents),
|
||||
mColliderComponents(colliderComponents), mIsSplitImpulseActive(true) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
mProfiler = nullptr;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
********************************************************************************/
|
||||
|
||||
// If profiling is enabled
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
|
||||
// Libraries
|
||||
#include <reactphysics3d/utils/Profiler.h>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Minimum cmake version required
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
# Project configuration
|
||||
PROJECT(TESTS)
|
||||
project(TESTS)
|
||||
|
||||
# Header files
|
||||
SET (RP3D_TESTS_HEADERS
|
||||
set (RP3D_TESTS_HEADERS
|
||||
"Test.h"
|
||||
"TestSuite.h"
|
||||
"tests/collision/TestAABB.h"
|
||||
|
@ -30,20 +30,20 @@ SET (RP3D_TESTS_HEADERS
|
|||
)
|
||||
|
||||
# Source files
|
||||
SET (RP3D_TESTS_SOURCES
|
||||
set (RP3D_TESTS_SOURCES
|
||||
"main.cpp"
|
||||
"Test.cpp"
|
||||
"TestSuite.cpp"
|
||||
)
|
||||
|
||||
# Create the tests executable
|
||||
ADD_EXECUTABLE(tests ${RP3D_TESTS_HEADERS} ${RP3D_TESTS_SOURCES})
|
||||
add_executable(tests ${RP3D_TESTS_HEADERS} ${RP3D_TESTS_SOURCES})
|
||||
|
||||
# Headers
|
||||
TARGET_INCLUDE_DIRECTORIES(reactphysics3d PUBLIC
|
||||
target_include_directories(reactphysics3d PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(tests reactphysics3d)
|
||||
target_link_libraries(tests reactphysics3d)
|
||||
|
||||
ADD_TEST(Test tests)
|
||||
add_test(Test tests)
|
||||
|
|
|
@ -97,7 +97,8 @@ class TestDynamicAABBTree : public Test {
|
|||
|
||||
PhysicsCommon mPhysicsCommon;
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
Profiler* mProfiler;
|
||||
#endif
|
||||
|
||||
|
@ -108,7 +109,8 @@ class TestDynamicAABBTree : public Test {
|
|||
/// Constructor
|
||||
TestDynamicAABBTree(const std::string& name): Test(name) {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
mProfiler = new Profiler();
|
||||
#endif
|
||||
|
||||
|
@ -117,7 +119,8 @@ class TestDynamicAABBTree : public Test {
|
|||
/// Constructor
|
||||
~TestDynamicAABBTree() {
|
||||
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
delete mProfiler;
|
||||
#endif
|
||||
|
||||
|
@ -142,7 +145,8 @@ class TestDynamicAABBTree : public Test {
|
|||
|
||||
// Dynamic AABB Tree
|
||||
DynamicAABBTree tree(mAllocator);
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
tree.setProfiler(mProfiler);
|
||||
#endif
|
||||
|
||||
|
@ -191,7 +195,8 @@ class TestDynamicAABBTree : public Test {
|
|||
|
||||
// Dynamic AABB Tree
|
||||
DynamicAABBTree tree(mAllocator);
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
tree.setProfiler(mProfiler);
|
||||
#endif
|
||||
|
||||
|
@ -386,7 +391,8 @@ class TestDynamicAABBTree : public Test {
|
|||
|
||||
// Dynamic AABB Tree
|
||||
DynamicAABBTree tree(mAllocator);
|
||||
#ifdef IS_PROFILING_ACTIVE
|
||||
#ifdef IS_RP3D_PROFILING_ENABLED
|
||||
|
||||
tree.setProfiler(mProfiler);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,28 +1,22 @@
|
|||
# Minimum cmake version required
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
# Project configuration
|
||||
PROJECT(Testbed)
|
||||
project(Testbed)
|
||||
|
||||
# Where to build the executables
|
||||
SET(EXECUTABLE_OUTPUT_PATH "${OUR_EXECUTABLE_OUTPUT_PATH}/testbed")
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH})
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})
|
||||
|
||||
ADD_SUBDIRECTORY(nanogui/)
|
||||
add_subdirectory(nanogui/)
|
||||
|
||||
# Copy the shaders used for the demo into the build directory
|
||||
FILE(COPY "shaders/" DESTINATION "${EXECUTABLE_OUTPUT_PATH}/shaders/")
|
||||
file(COPY "shaders/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/shaders/")
|
||||
|
||||
# Copy the meshes used for the demo into the build directory
|
||||
FILE(COPY "meshes/" DESTINATION "${EXECUTABLE_OUTPUT_PATH}/meshes/")
|
||||
file(COPY "meshes/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/meshes/")
|
||||
|
||||
# Headers
|
||||
INCLUDE_DIRECTORIES("src/" "nanogui/include/" "opengl-framework/src/" "common/" "scenes/" ${NANOGUI_EXTRA_INCS})
|
||||
include_directories("src/" "nanogui/include/" "opengl-framework/src/" "common/" "scenes/" ${NANOGUI_EXTRA_INCS})
|
||||
|
||||
# OpenGLFramework source files
|
||||
SET(OPENGLFRAMEWORK_SOURCES
|
||||
set(OPENGLFRAMEWORK_SOURCES
|
||||
opengl-framework/src/maths/Color.h
|
||||
opengl-framework/src/maths/Matrix3.h
|
||||
opengl-framework/src/maths/Matrix4.h
|
||||
|
@ -56,7 +50,7 @@ SET(OPENGLFRAMEWORK_SOURCES
|
|||
)
|
||||
|
||||
# Testbed source files
|
||||
SET(TESTBED_SOURCES
|
||||
set(TESTBED_SOURCES
|
||||
src/Main.cpp
|
||||
src/TestbedApplication.h
|
||||
src/TestbedApplication.cpp
|
||||
|
@ -71,7 +65,7 @@ SET(TESTBED_SOURCES
|
|||
)
|
||||
|
||||
# Common source files
|
||||
SET(COMMON_SOURCES
|
||||
set(COMMON_SOURCES
|
||||
common/Box.h
|
||||
common/Box.cpp
|
||||
common/Sphere.h
|
||||
|
@ -99,7 +93,7 @@ SET(COMMON_SOURCES
|
|||
)
|
||||
|
||||
# Examples scenes source files
|
||||
SET(SCENES_SOURCES
|
||||
set(SCENES_SOURCES
|
||||
scenes/cubes/CubesScene.h
|
||||
scenes/cubes/CubesScene.cpp
|
||||
scenes/joints/JointsScene.h
|
||||
|
@ -121,20 +115,20 @@ SET(SCENES_SOURCES
|
|||
)
|
||||
|
||||
# Add .user file to set debug path in Visual Studio
|
||||
SET(USER_FILE testbed.vcxproj.user)
|
||||
SET(VS_USERFILE_WORKING_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})
|
||||
SET(OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${USER_FILE})
|
||||
CONFIGURE_FILE(VisualStudioUserTemplate.user ${USER_FILE} @ONLY)
|
||||
set(USER_FILE testbed.vcxproj.user)
|
||||
set(VS_USERFILE_WORKING_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})
|
||||
set(OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${USER_FILE})
|
||||
configure_file(VisualStudioUserTemplate.user ${USER_FILE} @ONLY)
|
||||
|
||||
# Compile definitions
|
||||
ADD_DEFINITIONS(${NANOGUI_EXTRA_DEFS})
|
||||
add_definitions(${NANOGUI_EXTRA_DEFS})
|
||||
|
||||
# Create the executable
|
||||
ADD_EXECUTABLE(testbed ${TESTBED_SOURCES} ${SCENES_SOURCES} ${COMMON_SOURCES} ${OPENGLFRAMEWORK_SOURCES})
|
||||
add_executable(testbed ${TESTBED_SOURCES} ${SCENES_SOURCES} ${COMMON_SOURCES} ${OPENGLFRAMEWORK_SOURCES})
|
||||
|
||||
# Enable C++11 features
|
||||
set_property(TARGET testbed PROPERTY CXX_STANDARD 11)
|
||||
set_property(TARGET testbed PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Link with libraries
|
||||
TARGET_LINK_LIBRARIES(testbed reactphysics3d nanogui ${NANOGUI_EXTRA_LIBS})
|
||||
target_link_libraries(testbed reactphysics3d nanogui ${NANOGUI_EXTRA_LIBS})
|
||||
|
|
Loading…
Reference in New Issue
Block a user