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