Skip to content

Commit ac3c905

Browse files
committed
Moved helper functionality Clone and ToString into the package
1 parent 7da12fa commit ac3c905

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ set(EMCC_ARGS
109109
--post-js glue.js
110110
--closure=1
111111
${MULTI_THREADED_FLAG}
112+
--post-js ${CMAKE_CURRENT_SOURCE_DIR}/helpers.js
112113
-s ALLOW_MEMORY_GROWTH=${ALLOW_MEMORY_GROWTH}
113114
-s ALLOW_TABLE_GROWTH=1
114115
${ENVIRONMENT_FLAG}

Examples/conveyor_belt_threaded.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121

2222
<script id="workerScript" type="module">
2323
const onWorker = globalThis.onWorker = async (Jolt, args) => {
24-
Jolt.Vec3.prototype.Clone = function () { return new Jolt.Vec3(this.GetX(), this.GetY(), this.GetZ()); };
25-
Jolt.RVec3.prototype.Clone = function () { return new Jolt.RVec3(this.GetX(), this.GetY(), this.GetZ()); };
26-
Jolt.Quat.prototype.Clone = function () { return new Jolt.Quat(this.GetX(), this.GetY(), this.GetZ(), this.GetW()); };
2724
const DegreesToRadians = (deg) => deg * (Math.PI / 180.0);
2825

2926
const cLocalSpaceVelocity = new Jolt.Vec3(0, 0, -10.0);

Examples/js/example.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,6 @@ function initPhysics() {
109109
Jolt.destroy(settings);
110110
physicsSystem = jolt.GetPhysicsSystem();
111111
bodyInterface = physicsSystem.GetBodyInterface();
112-
113-
// Helper functions
114-
Jolt.Vec3.prototype.ToString = function () { return `(${this.GetX()}, ${this.GetY()}, ${this.GetZ()})` };
115-
Jolt.Vec3.prototype.Clone = function () { return new Jolt.Vec3(this.GetX(), this.GetY(), this.GetZ()); };
116-
Jolt.RVec3.prototype.ToString = function () { return `(${this.GetX()}, ${this.GetY()}, ${this.GetZ()})` };
117-
Jolt.RVec3.prototype.Clone = function () { return new Jolt.RVec3(this.GetX(), this.GetY(), this.GetZ()); };
118-
Jolt.Quat.prototype.ToString = function () { return `(${this.GetX()}, ${this.GetY()}, ${this.GetZ()}, ${this.GetW()})` };
119-
Jolt.Quat.prototype.Clone = function () { return new Jolt.Quat(this.GetX(), this.GetY(), this.GetZ(), this.GetW()); };
120-
Jolt.AABox.prototype.ToString = function () { return `[${this.mMax.ToString()}, ${this.mMin.ToString()}]`; };
121112
}
122113

123114
function updatePhysics(deltaTime) {

helpers.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)