* Fix wrong logic in Carmea::screenToWorld function.
* [jsb] Remove Node._xxxCache properties. Keep the same logic as web.
In camera-component.ts
public screenToWorld (screenPos: Vec3, out?: Vec3) {
if (!out) { out = this.node.getWorldPosition(); } // if out is null, getWorldPosition will return _worldPositionCache object
if (this._camera) { this._camera.screenToWorld(out, screenPos); }
return out;
}
In user code, there may be something like this:
const target = cameraCom.screenToWorld(pos); // target is _worldPositionCache object
const dir = Vec3.subtract(new Vec3(), target, this.node.worldPosition).normalize(); // this.node.worldPosition also returns _worldPositionCache object because we define _pos like the following:
// node.jsb.ts
Object.defineProperty(nodeProto, '_pos', {
configurable: true,
enumerable: true,
get (): Readonly<Vec3> {
return this.getWorldPosition();
}
});
nodeProto.getWorldPosition = function (out?: Vec3): Vec3 {
const r = oldGetWorldPosition.call(this);
if (out) {
return Vec3.copy(out, r);
}
return Vec3.copy(this._worldPositionCache, r); // node.getWorldPosition() will return _worldPositionCache tool.
};
So the code [[[[ const dir = Vec3.subtract(new Vec3(), target, this.node.worldPosition).normalize(); ]]]] will replace target value since this.node.worldPosition getter overrides the target value.
* Update spidermonkey backend for se.
* Update cmakelist
* Bug fix for se spidermonkey backend.
* Fix constructor binding for spidermonkey backend.
* Fix wrong syntax of calling native function in simple-texture.jsb.ts & builtin-res-mgr.jsb.ts
* Use jsb.createExternalArrayBuffer for caching since it will not be moved during GGC.
* Cleanup se spidermonkey backend
* Add Object::createExternalArrayBuffer for se v8 backend.
* Remove unused code in jsb_assets_manual.cpp
* Add jsb.createExternalArrayBuffer binding.
* Remove unused WebGLRenderingContext registeration.
* Remove unused code in jsb_global_init.cpp
* Add Root::setDevice.
* Invoke ScriptEngine::mainLoopUpdate in Engine.cpp.
* Update CMakeLists.txt
* Make missing return type as an error.
* Cleanup for sm/ScriptEngine.cpp
* prefine.cmake fix for vs.