Files
cocos4/native/cocos/renderer/pipeline/forward/ForwardFlow.cpp
T
fqamic d4055f7e32 new basic capabilities of supporting handset ar and webxr (#13420)
* feat: add the basic capability of handset ar native

* feat: add handset input device, for ar camera pose

* feat: native pack tool supports xr platform name

* feat: web gl context supports webxr

* feat: webxr has been converted to screen coordinates via camera

* fix: pr ts-expect-error undefined xr

* feat: support webxr, and remove ar redundant code

* fix:xr-spaces gradlew permission error

* feat: revert redundant ar engine feature

* fix: eslint check error

* feat: remove redundant code

* fix: eslint check warning

* adjust armodule process in forward stage, mtl texture and jsb

* fix: exlint warning, and add license

* adjust ar lib and interfaces

* change webxr check interface

* merge external arlib header and move it to engine

* improve: update native external version

* move ar background stage to xr/rendering and move its init to webxr device in xr plugin

* fix format error

* fix format error

* adjust jsb_ar_manual, ARModule, ARBackground

* adjust arbackground

Co-authored-by: Parryzhai <1306895355@qq.com>
Co-authored-by: MoHai <1192652394@qq.com>
2022-11-24 13:33:50 +08:00

82 lines
2.7 KiB
C++

/****************************************************************************
Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "ForwardFlow.h"
#include "../SceneCulling.h"
#include "ForwardPipeline.h"
#include "ForwardStage.h"
#include "profiler/Profiler.h"
#if CC_USE_AR_MODULE
#include "pipeline/xr/ar/ARStage.h"
#endif
namespace cc {
namespace pipeline {
RenderFlowInfo ForwardFlow::initInfo = {
"ForwardFlow",
static_cast<uint32_t>(ForwardFlowPriority::FORWARD),
static_cast<uint32_t>(RenderFlowTag::SCENE),
{},
};
const RenderFlowInfo &ForwardFlow::getInitializeInfo() { return ForwardFlow::initInfo; }
ForwardFlow::~ForwardFlow() = default;
bool ForwardFlow::initialize(const RenderFlowInfo &info) {
RenderFlow::initialize(info);
if (_stages.empty()) {
_isResourceOwner = true;
#if CC_USE_AR_MODULE
auto *arStage = ccnew ARStage;
arStage->initialize(ARStage::getInitializeInfo());
_stages.emplace_back(arStage);
#endif
auto *forwardStage = ccnew ForwardStage;
forwardStage->initialize(ForwardStage::getInitializeInfo());
_stages.emplace_back(forwardStage);
}
return true;
}
void ForwardFlow::activate(RenderPipeline *pipeline) {
RenderFlow::activate(pipeline);
}
void ForwardFlow::render(scene::Camera *camera) {
CC_PROFILE(ForwardFlowRender);
RenderFlow::render(camera);
}
void ForwardFlow::destroy() {
RenderFlow::destroy();
}
} // namespace pipeline
} // namespace cc