Code Monkey home page Code Monkey logo

Comments (3)

yuigahamayuki avatar yuigahamayuki commented on September 27, 2024

Update: The exact engine version is 3.8.2. I test the official cocos-example-projects/occlusion-query project with builtin engine (version 3.8.2), build a windows debug application, setOcclusionQueryEnabled() triggers the same error.

In occlusion-query.ts, I add director.root.pipeline.pipelineSceneData.getOctree();, this function is triggered. The modified function onToggle() in occlusion-query.ts is as follows:

    onToggle (toggle: Toggle) {
        if (NATIVE) {
            director.root.pipeline.pipelineSceneData.getOctree();
            director.root.pipeline.setOcclusionQueryEnabled(toggle.isChecked);
        }
        log('Occlusion query enabled: ' + toggle.isChecked);
    }

Why method of PipelineSceneData could be called, while method of RenderPipeline could not? The difference of the two classes I see is PipelineSceneData directly derives from RefCounted, while RenderPipeline does not.

BTW, RenderPipeline::getOcclusionQueryEnabled() seems deleted, so I deleted line 15 of occlusion-query.ts:
this.toggleOcclusionQuery.isChecked = director.root.pipeline.getOcclusionQueryEnabled();

from cocos-engine.

yuigahamayuki avatar yuigahamayuki commented on September 27, 2024

Found the problem. Since v3.6.0, the engine has re-implemented Native render pipeline. When calling director.root.pipeline in TypeScript, Native version will return an instance of RenderPipelineBridge (defined in Root.cpp), which derives from PipelineRuntime cpp class, while TypeScript version will return an instance of RenderPipeline (not a cpp class, defined in render-pipeline.ts).

The official cocos-example-projects are based on engine version 3.4.0, I guess native version of director.root.pipeline returns an instance of RenderPipeline (cpp class, defined in RenderPipeline.h)

from cocos-engine.

star-e avatar star-e commented on September 27, 2024

Found the problem. Since v3.6.0, the engine has re-implemented Native render pipeline. When calling director.root.pipeline in TypeScript, Native version will return an instance of RenderPipelineBridge (defined in Root.cpp), which derives from PipelineRuntime cpp class, while TypeScript version will return an instance of RenderPipeline (not a cpp class, defined in render-pipeline.ts).

The official cocos-example-projects are based on engine version 3.4.0, I guess native version of director.root.pipeline returns an instance of RenderPipeline (cpp class, defined in RenderPipeline.h)

Sorry for the inconvenience.

To support custom render pipeline in 3.6.0, we have refactored the native engine.
The custom pipeline and legacy pipeline share the common PipelineRuntime interface.

Native RenderPipeline cannot be access from typescript anymore, as we are moving forward to the custom pipeline.

Currently, occlusion query is not well supported in custom pipeline. The reason is that we have not yet worked out a cross-platform solution.

We might support occlusion query in the future release, and are also considering other methods such as PVS (potential visible set).

from cocos-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.