Commit Graph

24 Commits

Author SHA1 Message Date
bofeng-song 836ad2211d fix screenPointToRay logic error (#12210)
* fix screenPointToRay logic error
2022-07-27 15:34:43 +08:00
James Chen ba4a98a71c Keep the struct in cc::Rect the same as which in ts (#11864)
Co-authored-by: Yiwen <15225434259xue@gmail.com>
2022-07-06 09:54:24 +08:00
Yiwen d1e141990b fix camera jsb (#11842)
* fix camera jsb
2022-07-05 11:38:11 +08:00
minggo 6bb5f9d447 use smart pointer and remove unneeded codes (#11750) 2022-06-30 17:01:17 +08:00
James Chen 174ba0eff2 Add macros: CC_USE_GEOMETRY_RENDERER and CC_USE_DEBUG_RENDERER to control these debugging features. (#11740) 2022-06-30 10:25:02 +08:00
李吉林 f3be7666a2 crop geometry renderer & debug renderer (#11752) 2022-06-29 17:16:17 +08:00
James Chen d5e1bfa1a1 Fix wrong logic in Camera::screenToWorld function and remove Node._xxxCache properties to keep the same logic as web (#11693)
* 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.
2022-06-24 18:30:59 +08:00
GengineJS b353209223 Remove native camera scale matrix (#11487)
* Remove native camera scale matrix

* Change the position where the camera scale matrix is ​​removed
2022-06-14 14:07:57 +08:00
pandamicro 04b00e7fad Detach camera from scene in destroy 2022-06-09 15:32:27 +08:00
minggo 271cc5cf23 Remove some format rule (#10919)
* remove some rules
* format all codes with new format rule
2022-05-04 13:09:24 +08:00
李吉林 3457292707 refactor exit process (#10880)
* refactor exit process

* add override

* fix geometry-renderer missing in deferred pipeline

* invoke destroy directly

* fix ESLint error

* add -misc-static-assert for clang-tidy
2022-04-27 14:59:23 +08:00
bofeng-song 719315add2 fix editor to do (#10827) 2022-04-22 09:51:16 +08:00
minggo 444bfe31c4 Refactor CC_NEW/CC_DELETE (#10810)
* replace CC_NEW/CC_DELETE with ccnew/delete
2022-04-21 16:39:34 +08:00
minggo cb1234b63a Revert "fix memory leak (#10804)" (#10823)
This reverts commit 3374c7e41c.
2022-04-21 13:52:20 +08:00
李吉林 3374c7e41c fix memory leak (#10804) 2022-04-20 14:43:02 +08:00
Cocos Robot df50878b14 [ci skip][AUTO]: Automated clang-format update: 735860a2aa285979c890bad6356b14afeff13db5 (#10560) (#10570)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-03-29 16:40:20 +08:00
minggo 1a9d49e4c6 replace std::list/std::array with ccstd::list/ccstd::array (#10560)
* replace std::list/std::array with ccstd::list/ccstd::array
2022-03-29 16:36:53 +08:00
李吉林 6c935352dd geometry renderer refactor (#10444) 2022-03-22 17:44:39 +08:00
Cocos Robot 24d84664f8 [ci skip][AUTO]: Automated clang-format update: 3de15842004cba2142ec0fecd82876d8f6a28236 (#10402) (#10424)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-03-21 16:04:49 +08:00
minggo 34bf14269c unify stl (#10402)
* add ccstd::vector
* replace cc::vector with ccstd::vector 
* replace std::vector with ccstd::vector
* do not include <vector>
2022-03-21 15:55:02 +08:00
bofeng-song 48d8baf3ac implement logic of debug.ts (#10070)
* implement logic of debug.ts
2022-02-10 15:32:51 +08:00
mmyduckx e332c02ca0 add forward declaration for 3d/scene-graph/scene (#4246)
* add forward declaration for 3d/scene-graph/scene

* fix genbindings error

* define ctor in cpp
2022-02-09 15:41:00 +08:00
bofeng-song 8bdfbd60e2 implement syncCameraEditor for editor's logic & remove unneed code (#4197)
* implement syncCameraEditor  for editor's logic & remove unneed code
2022-01-19 16:13:48 +08:00
minggo 5410a48a58 Implement more logic in native (#4131)
Co-authored-by: bofeng.song <bofeng.song@chukong-inc.com>
Co-authored-by: dumganhar <dumganhar@gmail.com>
Co-authored-by: mmyduckx <308303735@qq.com>
Co-authored-by: Patrice Jiang <397136899@qq.com>
Co-authored-by: 江战 <40414978+PatriceJiang@users.noreply.github.com>
2022-01-07 18:39:40 +08:00