aarch64 build support
This commit is contained in:
@@ -246,7 +246,7 @@ add_custom_target(stage_files ALL DEPENDS ${CMAKE_BINARY_DIR}/resources.cfg ${MA
|
||||
|
||||
add_custom_target(remove_scenes COMMAND rm -f ${VRM_SOURCE} ${VRM_IMPORTED_BLENDS} ${CHARACTER_GLBS})
|
||||
|
||||
target_compile_definitions(Game PRIVATE FLECS_CPP_NO_AUTO_REGISTRATION JPH_PROFILE_ENABLED)
|
||||
target_compile_definitions(Game PRIVATE FLECS_CPP_NO_AUTO_REGISTRATION JPH_PROFILE_ENABLED JPH_DEBUG_RENDERER JPH_PROFILE_ENABLED JPH_DOUBLE_PRECISION)
|
||||
|
||||
install(TARGETS Game DESTINATION bin)
|
||||
install(TARGETS Editor DESTINATION bin)
|
||||
|
||||
5
Game.cpp
5
Game.cpp
@@ -10,7 +10,6 @@
|
||||
#include <OgreTimer.h>
|
||||
#include <OgreMeshLodGenerator.h>
|
||||
|
||||
// #include "water/water.h"
|
||||
#include "GameData.h"
|
||||
#include "Components.h"
|
||||
#include "CharacterModule.h"
|
||||
@@ -630,11 +629,11 @@ end:
|
||||
void setupInput()
|
||||
{
|
||||
}
|
||||
JoltPhysicsWrapper *mJolt;
|
||||
JoltPhysicsWrapper *mJolt;
|
||||
void createContent()
|
||||
{
|
||||
int i;
|
||||
mJolt = new JoltPhysicsWrapper(mScnMgr, mCameraNode);
|
||||
mJolt = new JoltPhysicsWrapper(mScnMgr, mCameraNode);
|
||||
|
||||
sky = new SkyBoxRenderer(getSceneManager());
|
||||
bool drawFirst = true;
|
||||
|
||||
@@ -16,5 +16,5 @@ find_package(flecs REQUIRED CONFIG)
|
||||
add_library(physics STATIC physics.cpp)
|
||||
target_link_libraries(physics PUBLIC OgreMain Jolt::Jolt)
|
||||
target_include_directories(physics PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_compile_definitions(physics PRIVATE JPH_PROFILE_ENABLED)
|
||||
target_compile_definitions(physics PUBLIC JPH_DEBUG_RENDERER JPH_PROFILE_ENABLED JPH_DOUBLE_PRECISION)
|
||||
|
||||
|
||||
@@ -523,7 +523,6 @@ void ContactListener::update()
|
||||
}
|
||||
|
||||
class Physics {
|
||||
JPH::PhysicsSystem physics_system;
|
||||
// We need a temp allocator for temporary allocations during the physics update. We're
|
||||
// pre-allocating 10 MB to avoid having to do allocations during the physics update.
|
||||
// B.t.w. 10 MB is way too much for this example but it is a typical value you can use.
|
||||
@@ -550,6 +549,7 @@ class Physics {
|
||||
// Also have a look at ObjectLayerPairFilterTable or ObjectLayerPairFilterMask for a simpler interface.
|
||||
ObjectLayerPairFilterImpl object_vs_object_layer_filter;
|
||||
|
||||
JPH::PhysicsSystem physics_system;
|
||||
DebugRenderer *mDebugRenderer;
|
||||
std::map<JPH::BodyID, Ogre::SceneNode *> id2node;
|
||||
std::map<Ogre::SceneNode *, JPH::BodyID> node2id;
|
||||
@@ -573,17 +573,13 @@ public:
|
||||
std::thread::hardware_concurrency() - 1)
|
||||
, mDebugRenderer(new DebugRenderer(scnMgr, cameraNode))
|
||||
, object_vs_broadphase_layer_filter{}
|
||||
, object_vs_object_layer_filter{}
|
||||
, object_vs_object_layer_filter{}
|
||||
, debugDraw(false)
|
||||
{
|
||||
static int instanceCount = 0;
|
||||
OgreAssert(instanceCount == 0, "Bad initialisation");
|
||||
instanceCount++;
|
||||
|
||||
// Register all physics types with the factory and install their collision handlers with the CollisionDispatch class.
|
||||
// If you have your own custom shape types you probably need to register their handlers with the CollisionDispatch before calling this function.
|
||||
// If you implement your own default material (PhysicsMaterial::sDefault) make sure to initialize it before this function or else this function will create one for you.
|
||||
JPH::RegisterTypes();
|
||||
|
||||
// This is the max amount of rigid bodies that you can add to the physics system. If you try to add more you'll get an error.
|
||||
// Note: This value is low because this is a simple test. For a real project use something in the order of 65536.
|
||||
@@ -1531,7 +1527,7 @@ void physics()
|
||||
// physics.update(1.0f / 60.0f);
|
||||
}
|
||||
|
||||
Physics *phys = nullptr;
|
||||
static std::unique_ptr<Physics> phys = nullptr;
|
||||
JoltPhysicsWrapper::JoltPhysicsWrapper(Ogre::SceneManager *scnMgr,
|
||||
Ogre::SceneNode *cameraNode)
|
||||
: Ogre::Singleton<JoltPhysicsWrapper>()
|
||||
@@ -1540,21 +1536,24 @@ JoltPhysicsWrapper::JoltPhysicsWrapper(Ogre::SceneManager *scnMgr,
|
||||
// This needs to be done before any other Jolt function is called.
|
||||
JPH::RegisterDefaultAllocator();
|
||||
|
||||
// Create a factory, this class is responsible for creating instances of classes based on their name or hash and is mainly used for deserialization of saved data.
|
||||
// It is not directly used in this example but still required.
|
||||
JPH::Factory::sInstance = new JPH::Factory();
|
||||
|
||||
// Install trace and assert callbacks
|
||||
JPH::Trace = TraceImpl;
|
||||
JPH_IF_ENABLE_ASSERTS(JPH::AssertFailed = AssertFailedImpl;)
|
||||
|
||||
|
||||
phys = new Physics(scnMgr, cameraNode, nullptr, &contacts);
|
||||
// Create a factory, this class is responsible for creating instances of classes based on their name or hash and is mainly used for deserialization of saved data.
|
||||
// It is not directly used in this example but still required.
|
||||
JPH::Factory::sInstance = new JPH::Factory();
|
||||
// Register all physics types with the factory and install their collision handlers with the CollisionDispatch class.
|
||||
// If you have your own custom shape types you probably need to register their handlers with the CollisionDispatch before calling this function.
|
||||
// If you implement your own default material (PhysicsMaterial::sDefault) make sure to initialize it before this function or else this function will create one for you.
|
||||
JPH::RegisterTypes();
|
||||
|
||||
phys = std::make_unique<Physics>(scnMgr, cameraNode, nullptr, &contacts);
|
||||
}
|
||||
|
||||
JoltPhysicsWrapper::~JoltPhysicsWrapper()
|
||||
{
|
||||
if (phys)
|
||||
delete phys;
|
||||
}
|
||||
|
||||
void JoltPhysicsWrapper::update(float dt)
|
||||
|
||||
Reference in New Issue
Block a user