Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support the SequentialImpulseConstraintSolver_reset #15

Open
wants to merge 25 commits into
base: cocos-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ad27a45
support the SequentialImpulseConstraintSolver_reset
longchuan Oct 20, 2024
a97e769
support the SequentialImpulseConstraintSolver_reset
longchuan Oct 20, 2024
4b24d0c
support the new emcc+python3
longchuan Oct 21, 2024
5f04d6c
support the new emcc+python3
longchuan Oct 21, 2024
66b62cb
support the SequentialImpulseConstraintSolver_reset
longchuan Oct 23, 2024
60d9595
add cc namespace
longchuan Oct 23, 2024
9aa92e2
fix cast from ‘void*’ to ‘int’ loses precision [-fpermissive]
longchuan Oct 23, 2024
ab54726
add cc namespace and delete ///xxx setMaterial
longchuan Oct 23, 2024
c58c5db
fix EXTRA_EXPORTED_RUNTIME_METHODS is deprecated (please use EXPORTED…
longchuan Oct 24, 2024
288fe1d
adjust compilation order
longchuan Oct 24, 2024
9312d46
use Popen
longchuan Oct 27, 2024
b49dac0
revise the make to emcc 1.39.20
longchuan Oct 27, 2024
9c24335
fix"ERROR: EMSCRIPTEN_ROOT environment variable (which should be equa…
longchuan Oct 27, 2024
e281917
fix the extensions' dir
longchuan Oct 27, 2024
5ceb240
support the constexpr
longchuan Oct 27, 2024
a10aa2d
edit mecc 1.38.48 pause
longchuan Oct 28, 2024
2325219
use Popen
longchuan Oct 27, 2024
ec01ade
support cocos engine
longchuan Nov 1, 2024
4aede80
cancel the implements edit
longchuan Nov 1, 2024
0f22763
save file
longchuan Nov 1, 2024
69e9300
build to publish
longchuan Nov 1, 2024
f7c7708
support the SequentialImpulseConstraintSolver_reset
longchuan Nov 1, 2024
a738f0b
edit cmake
longchuan Nov 1, 2024
4e87fe8
ccDiscreteDynamicsWorld_reset
longchuan Nov 2, 2024
8d3a817
cancel the size_t
longchuan Nov 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.cache
.cmake
compile_commands.json
build-for-vscode
build-win
build
cocos
publish
bullet/build
bullet/build-win
bullet/examples/pybullet
Expand Down
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"files.associations": {
"*.idl": "idl"
"*.ts": "typescriptreact",
"*.idl": "idl",
"memory": "cpp",
"optional": "cpp",
"functional": "cpp",
"charconv": "cpp",
"xhash": "cpp",
"xlocbuf": "cpp",
"xmemory": "cpp"
},
"C_Cpp.default.includePath": ["bullet/src"]
}
11 changes: 8 additions & 3 deletions ammo.idl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ interface ClosestRayResultCallback {
};
ClosestRayResultCallback implements RayResultCallback;

[Prefix="cc::"]
interface ccClosestRayResultCallback {
void ccClosestRayResultCallback([Const, Ref] btVector3 from, [Const, Ref] btVector3 to);
attribute long m_shapeUserPointer;
Expand Down Expand Up @@ -222,6 +223,7 @@ interface AllHitsRayResultCallback {
};
AllHitsRayResultCallback implements RayResultCallback;

[Prefix="cc::"]
interface ccAllHitsRayResultCallback {
void ccAllHitsRayResultCallback([Const, Ref] btVector3 from, [Const, Ref] btVector3 to);
[Value] attribute btIntArray m_shapeUserPointers;
Expand Down Expand Up @@ -498,7 +500,7 @@ interface btCompoundShape {
float getMargin();

///XXX
void setMaterial(long childShapeindex, float f, float r, optional float rf, optional float sf);
//void setMaterial(long childShapeindex, float f, float r, optional float rf, optional float sf);
};
btCompoundShape implements btCollisionShape;

Expand Down Expand Up @@ -618,6 +620,7 @@ interface btOverlappingPairCallback {
interface btOverlapFilterCallback {
};

[Prefix="cc::"]
interface ccOverlapFilterCallback {
void ccOverlapFilterCallback();
};
Expand Down Expand Up @@ -916,14 +919,15 @@ interface btDiscreteDynamicsWorld {
};
btDiscreteDynamicsWorld implements btDynamicsWorld;

[Prefix="cc::"]
interface ccDiscreteDynamicsWorld {
void ccDiscreteDynamicsWorld(btDispatcher dispatcher, btBroadphaseInterface pairCache, btConstraintSolver constraintSolver, btCollisionConfiguration collisionConfiguration);
void setAllowSleep(boolean v);
void setDeactivationTime(float v);
void setNarrowPhaseMethod(long v);
void setAllowCcdPenetration(float v);
void setCcdCastCheckResponse(boolean v);
[Ref] btIntArray getCcdTriggerRecorder();
//void setCcdCastCheckResponse(boolean v);
//[Ref] btIntArray getCcdTriggerRecorder();
};
ccDiscreteDynamicsWorld implements btDiscreteDynamicsWorld;

Expand Down Expand Up @@ -1043,6 +1047,7 @@ interface btKinematicCharacterController {
};
btKinematicCharacterController implements btActionInterface;

[Prefix="cc::"]
interface ccKinematicCharacterController {
void ccKinematicCharacterController(btPairCachingGhostObject ghostObject, btConvexShape convexShape, float stepHeight, optional long upAxis);

Expand Down
13 changes: 8 additions & 5 deletions ammo.release.idl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ interface ClosestRayResultCallback {
};
ClosestRayResultCallback implements RayResultCallback;

[Prefix="cc::"]
interface ccClosestRayResultCallback {
void ccClosestRayResultCallback([Const, Ref] btVector3 from, [Const, Ref] btVector3 to);
// attribute long m_shapeUserPointer;
Expand Down Expand Up @@ -222,6 +223,7 @@ interface AllHitsRayResultCallback {
};
AllHitsRayResultCallback implements RayResultCallback;

[Prefix="cc::"]
interface ccAllHitsRayResultCallback {
void ccAllHitsRayResultCallback([Const, Ref] btVector3 from, [Const, Ref] btVector3 to);
// [Value] attribute btIntArray m_shapeParts;
Expand Down Expand Up @@ -353,7 +355,7 @@ interface btBoxShape {
// XXX
void setUnscaledHalfExtents([Ref] btVector3 boxHalfExtents);
};
btBoxShape implements btConvexInternalShape;
btBoxShape implements btCollisionShape;

interface btCapsuleShape {
void btCapsuleShape(float radius, float height);
Expand All @@ -366,7 +368,7 @@ interface btCapsuleShape {
// XXX
void updateProp(float r, float h, long upAxis);
};
btCapsuleShape implements btConvexInternalShape;
btBoxShape implements btCollisionShape;

// interface btCapsuleShapeX {
// void btCapsuleShapeX(float radius, float height);
Expand Down Expand Up @@ -502,7 +504,7 @@ interface btCompoundShape {
float getMargin();

///XXX
void setMaterial(long childShapeindex, float f, float r, optional float rf, optional float sf);
//void setMaterial(long childShapeindex, float f, float r, optional float rf, optional float sf);
};
btCompoundShape implements btCollisionShape;

Expand Down Expand Up @@ -913,14 +915,15 @@ interface btDiscreteDynamicsWorld {
};
btDiscreteDynamicsWorld implements btDynamicsWorld;

[Prefix="cc::"]
interface ccDiscreteDynamicsWorld {
void ccDiscreteDynamicsWorld(btDispatcher dispatcher, btBroadphaseInterface pairCache, btConstraintSolver constraintSolver, btCollisionConfiguration collisionConfiguration);
void setAllowSleep(boolean v);
void setDeactivationTime(float v);
void setNarrowPhaseMethod(long v);
void setAllowCcdPenetration(float v);
void setCcdCastCheckResponse(boolean v);
[Ref] btIntArray getCcdTriggerRecorder();
//void setCcdCastCheckResponse(boolean v);
//[Ref] btIntArray getCcdTriggerRecorder();
};
ccDiscreteDynamicsWorld implements btDiscreteDynamicsWorld;

Expand Down
6 changes: 6 additions & 0 deletions build-asm-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
cd bullet
sh autogen.sh
cd ..
python make.py add_func closure debug
npm run port2node
6 changes: 6 additions & 0 deletions build-asm-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
cd bullet
sh autogen.sh
cd ..
python make.py add_func closure release
npm run port2node
5 changes: 5 additions & 0 deletions build-wasm-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
cd bullet
sh autogen.sh
cd ..
python make.py add_func wasm closure debug
5 changes: 5 additions & 0 deletions build-wasm-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
cd bullet
sh autogen.sh
cd ..
python make.py add_func wasm closure release
2 changes: 1 addition & 1 deletion builds/node/ammo.cocos.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions bullet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.8)
PROJECT(BULLET_PHYSICS)
SET(BULLET_VERSION 2.82)

message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../bullet-release-embind/${CMAKE_BUILD_TYPE}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../bullet-release-embind/${CMAKE_BUILD_TYPE}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../../bullet-release-embind/${CMAKE_BUILD_TYPE}")
Expand Down
2 changes: 2 additions & 0 deletions bullet/webBinding/BulletWebBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ EMSCRIPTEN_BINDINGS(bullet) {
function("DbvtBroadphase_new", &DbvtBroadphase_new, allow_raw_pointers());
function("SequentialImpulseConstraintSolver_new", &SequentialImpulseConstraintSolver_new, allow_raw_pointers());

function("ccDiscreteDynamicsWorld_reset", &ccDiscreteDynamicsWorld_reset, allow_raw_pointers());

function("CollisionWorld_addCollisionObject", &CollisionWorld_addCollisionObject, allow_raw_pointers());
function("CollisionWorld_removeCollisionObject", &CollisionWorld_removeCollisionObject, allow_raw_pointers());
function("CollisionWorld_rayTest", &CollisionWorld_rayTest, allow_raw_pointers());
Expand Down
1 change: 1 addition & 0 deletions bullet/webBinding/bullet.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ declare namespace Bullet {

DbvtBroadphase_new(): ptr;
SequentialImpulseConstraintSolver_new(): ptr;
ccDiscreteDynamicsWorld_reset(dispatcher: ptr,broadphase: ptr,solver: ptr): void;

CollisionWorld_addCollisionObject(p: ptr, body: ptr, g: number, m: number): void;
CollisionWorld_removeCollisionObject(p: ptr, body: ptr): void;
Expand Down
10 changes: 10 additions & 0 deletions bullet/webBinding/collision-world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
return (int)new btSequentialImpulseConstraintSolver();
}

void DLL_EXPORT ccDiscreteDynamicsWorld_reset(int dispatcher,int broadphase,int solver)
{
btCollisionDispatcher *m_dispatcher = (btCollisionDispatcher *)dispatcher;
btDbvtBroadphase *m_broadphase = (btDbvtBroadphase *)broadphase;
btConstraintSolver *m_solver = (btConstraintSolver *)solver;

m_broadphase->resetPool(m_dispatcher);
m_solver->reset();
}

// btDispatcherInfo
bool DLL_EXPORT CollisionWorld_get_m_useContinuous(int ptr)
{
Expand Down
Loading