mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
@@ -828,6 +828,8 @@ cocos_source_files(
|
||||
cocos/scripting/js-bindings/manual/jsb_cocos2dx_network_manual.h
|
||||
cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp
|
||||
cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.h
|
||||
cocos/scripting/js-bindings/manual/jsb_pipeline_manual.h
|
||||
cocos/scripting/js-bindings/manual/jsb_pipeline_manual.cpp
|
||||
)
|
||||
|
||||
if(USE_SOCKET)
|
||||
|
||||
@@ -13,6 +13,9 @@ DescriptorSet::~DescriptorSet() {
|
||||
}
|
||||
|
||||
void DescriptorSet::bindBuffer(uint binding, Buffer *buffer) {
|
||||
if (!_layout->getBindings().size()) {
|
||||
return;;
|
||||
}
|
||||
const DescriptorSetLayoutBinding &descriptor = _layout->getBindings()[binding];
|
||||
if ((uint)descriptor.descriptorType & DESCRIPTOR_BUFFER_TYPE) {
|
||||
if (_buffers[binding] != buffer) {
|
||||
@@ -25,6 +28,9 @@ void DescriptorSet::bindBuffer(uint binding, Buffer *buffer) {
|
||||
}
|
||||
|
||||
void DescriptorSet::bindTexture(uint binding, Texture *texture) {
|
||||
if (!_layout->getBindings().size()) {
|
||||
return;
|
||||
}
|
||||
const DescriptorSetLayoutBinding &descriptor = _layout->getBindings()[binding];
|
||||
if ((uint)descriptor.descriptorType & DESCRIPTOR_SAMPLER_TYPE) {
|
||||
if (_textures[binding] != texture) {
|
||||
@@ -37,6 +43,9 @@ void DescriptorSet::bindTexture(uint binding, Texture *texture) {
|
||||
}
|
||||
|
||||
void DescriptorSet::bindSampler(uint binding, Sampler *sampler) {
|
||||
if(!_layout->getBindings().size()) {
|
||||
return;
|
||||
}
|
||||
const DescriptorSetLayoutBinding &descriptor = _layout->getBindings()[binding];
|
||||
if ((uint)descriptor.descriptorType & DESCRIPTOR_SAMPLER_TYPE) {
|
||||
if (_samplers[binding] != sampler) {
|
||||
|
||||
@@ -20,6 +20,7 @@ bool CCMTLPipelineLayout::initialize(const PipelineLayoutInfo &info) {
|
||||
|
||||
uint i = 0;
|
||||
for (auto setLayout : _setLayouts) {
|
||||
if(setLayout == nullptr) continue;
|
||||
auto gpuDescriptorSetLayout = static_cast<CCMTLDescriptorSetLayout *>(setLayout)->gpuDescriptorSetLayout();
|
||||
auto dynamicCount = gpuDescriptorSetLayout->dynamicBindings.size();
|
||||
auto bindingCount = gpuDescriptorSetLayout->bindings.size();
|
||||
|
||||
@@ -35,7 +35,7 @@ bool CCMTLSampler::initialize(const SamplerInfo &info) {
|
||||
descriptor.minFilter = mu::toMTLSamplerMinMagFilter(_minFilter);
|
||||
descriptor.magFilter = mu::toMTLSamplerMinMagFilter(_magFilter);
|
||||
descriptor.mipFilter = mu::toMTLSamplerMipFilter(_mipFilter);
|
||||
descriptor.maxAnisotropy = _maxAnisotropy;
|
||||
descriptor.maxAnisotropy = _maxAnisotropy == 0 ? 1 : _maxAnisotropy;
|
||||
descriptor.compareFunction = mu::toMTLCompareFunction(_cmpFunc);
|
||||
descriptor.lodMinClamp = _minLOD;
|
||||
descriptor.lodMaxClamp = _maxLOD;
|
||||
|
||||
@@ -34,7 +34,10 @@ public:
|
||||
CC_INLINE const RenderFlowList &getFlows() const { return _flows; }
|
||||
CC_INLINE uint getTag() const { return _tag; }
|
||||
CC_INLINE const map<String, InternalBindingInst> &getGlobalBindings() const { return _globalBindings; }
|
||||
CC_INLINE const DefineMap &getMacro() const { return _macros; }
|
||||
CC_INLINE const ValueMap &getMacros() const { return _macros.getValues(); }
|
||||
template <class T, class RET = void>
|
||||
ENABLE_IF_T3_RET(float, bool, String)
|
||||
CC_INLINE setValue(const String &name, const T &value) { _macros.setValue(name, value);}
|
||||
CC_INLINE gfx::DescriptorSet *getDescriptorSet() const { return _descriptorSet; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
|
||||
namespace cc {
|
||||
namespace pipeline {
|
||||
RenderView::RenderView(uint cameraID)
|
||||
: _camera(GET_CAMERA(cameraID)) {
|
||||
RenderView::RenderView() {
|
||||
_pipeline = RenderPipeline::getInstance();
|
||||
|
||||
//TODO coulsong for test
|
||||
_window = CC_NEW(RenderWindow);
|
||||
}
|
||||
|
||||
RenderView::~RenderView() {
|
||||
@@ -16,9 +18,11 @@ RenderView::~RenderView() {
|
||||
}
|
||||
|
||||
bool RenderView::initialize(const RenderViewInfo &info) {
|
||||
|
||||
_name = info.name;
|
||||
_priority = info.priority;
|
||||
setExecuteFlows(info.flows);
|
||||
_camera = GET_CAMERA(info.cameraID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ struct CC_DLL RenderViewInfo {
|
||||
|
||||
class CC_DLL RenderView : public Object {
|
||||
public:
|
||||
RenderView(uint cameraID);
|
||||
RenderView();
|
||||
virtual ~RenderView();
|
||||
|
||||
void destroy();
|
||||
@@ -34,16 +34,10 @@ public:
|
||||
CC_INLINE void setVisibility(uint value) { _visibility = value; }
|
||||
CC_INLINE Camera *getCamera() const { return _camera; }
|
||||
CC_INLINE bool isEnabled() const { return _isEnabled; }
|
||||
CC_INLINE void enable(bool value) { _isEnabled = value; }
|
||||
CC_INLINE void setEnable(bool value) { _isEnabled = value; }
|
||||
CC_INLINE const RenderFlowList &getFlows() const { return _flows; }
|
||||
CC_INLINE RenderWindow *getWindow() const { return _window; }
|
||||
|
||||
// getWindow
|
||||
// setWindow
|
||||
|
||||
private:
|
||||
RenderView() = default;
|
||||
|
||||
private:
|
||||
RenderFlowList _flows;
|
||||
String _name;
|
||||
|
||||
@@ -72,9 +72,10 @@ bool ForwardPipeline::initialize(const RenderPipelineInfo &info) {
|
||||
RenderPipeline::initialize(info);
|
||||
|
||||
if (_flows.size() == 0) {
|
||||
auto shadowFlow = CC_NEW(ShadowFlow);
|
||||
shadowFlow->initialize(ShadowFlow::getInitializeInfo());
|
||||
_flows.emplace_back(shadowFlow);
|
||||
//TODO coulsonwang
|
||||
// auto shadowFlow = CC_NEW(ShadowFlow);
|
||||
// shadowFlow->initialize(ShadowFlow::getInitializeInfo());
|
||||
// _flows.emplace_back(shadowFlow);
|
||||
|
||||
auto forwardFlow = CC_NEW(ForwardFlow);
|
||||
forwardFlow->initialize(ForwardFlow::getInitializeInfo());
|
||||
|
||||
@@ -25,9 +25,11 @@ public:
|
||||
setValue(const String &name, const T &value) {
|
||||
_values[name] = value;
|
||||
}
|
||||
|
||||
const ValueMap &getValues() const { return _values; }
|
||||
|
||||
private:
|
||||
map<String, Value> _values;
|
||||
ValueMap _values;
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "core/CoreStd.h"
|
||||
#include "renderer/core/CoreStd.h"
|
||||
#include "math/Vec2.h"
|
||||
#include "math/Vec3.h"
|
||||
#include "scripting/dop/ArrayPool.h"
|
||||
|
||||
@@ -37,6 +37,7 @@ bool ShadowFlow::initialize(const RenderFlowInfo &info) {
|
||||
}
|
||||
|
||||
void ShadowFlow::activate(RenderPipeline *pipeline) {
|
||||
return; //TODO coulsonwang
|
||||
RenderFlow::activate(pipeline);
|
||||
|
||||
auto device = gfx::Device::getInstance();
|
||||
|
||||
@@ -31,7 +31,7 @@ using namespace se;
|
||||
cc::map<PoolType, BufferPool *> BufferPool::_poolMap;
|
||||
|
||||
BufferPool::BufferPool(PoolType type, uint entryBits, uint bytesPerEntry)
|
||||
: _entryBits(entryBits), _bytesPerEntry(bytesPerEntry) {
|
||||
: _entryBits(entryBits), _bytesPerEntry(bytesPerEntry), _type(type) {
|
||||
CCASSERT(BufferPool::_poolMap.count(type) == 0, "The type of pool is already exist");
|
||||
|
||||
_entriesPerChunk = 1 << entryBits;
|
||||
@@ -44,23 +44,19 @@ BufferPool::BufferPool(PoolType type, uint entryBits, uint bytesPerEntry)
|
||||
}
|
||||
|
||||
BufferPool::~BufferPool() {
|
||||
CCASSERT(_chunks.size() == _jsObjs.size(), "BufferPool: Page count doesn't match the number of javascript array buffer objects.");
|
||||
for (auto element : _jsObjs) {
|
||||
CC_FREE(element.first);
|
||||
element.second->decRef();
|
||||
element.second->unroot();
|
||||
}
|
||||
|
||||
BufferPool::_poolMap.erase(_type);
|
||||
}
|
||||
|
||||
Object *BufferPool::allocateNewChunk() {
|
||||
Chunk chunk = (uint8_t *)CC_MALLOC(_bytesPerChunk);
|
||||
_chunks.push_back(chunk);
|
||||
|
||||
Object *jsObj = Object::createArrayBufferObject(chunk, _bytesPerChunk);
|
||||
jsObj->root();
|
||||
jsObj->incRef();
|
||||
_jsObjs.emplace(chunk, jsObj);
|
||||
|
||||
uint8_t *realPtr = nullptr;
|
||||
size_t len = 0;
|
||||
jsObj->getArrayBufferData(&realPtr, &len);
|
||||
_chunks.push_back(realPtr);
|
||||
|
||||
CC_FREE(chunk);
|
||||
|
||||
return jsObj;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
uint chunk = (_chunkMask & id) >> _entryBits;
|
||||
uint entry = _entryMask & id;
|
||||
CCASSERT(chunk < _chunks.size() && entry < _entriesPerChunk, "BufferPool: Invalid buffer pool entry id");
|
||||
return reinterpret_cast<T *>(_chunks[chunk][entry]);
|
||||
return reinterpret_cast<T *>(_chunks[chunk] + (entry * _bytesPerEntry));
|
||||
}
|
||||
|
||||
Object *allocateNewChunk();
|
||||
@@ -64,7 +64,6 @@ private:
|
||||
static cc::map<PoolType, BufferPool *> _poolMap;
|
||||
|
||||
cc::vector<Chunk> _chunks;
|
||||
cc::map<Chunk, Object *> _jsObjs;
|
||||
const uint _poolFlag = 1 << 30;
|
||||
uint _entryBits = 1 << 8;
|
||||
uint _chunkMask = 0;
|
||||
|
||||
@@ -224,17 +224,16 @@ static bool jsb_ArrayPool_alloc(se::State &s) {
|
||||
s.rval().setObject(arrayPool->alloc(index));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc);
|
||||
return false;
|
||||
|
||||
}
|
||||
SE_BIND_FUNC(jsb_ArrayPool_alloc);
|
||||
|
||||
static bool js_register_se_ArrayPool(se::Object *obj) {
|
||||
se::Class *cls = se::Class::create("NativeArrayPool", obj, nullptr, _SE(jsb_ArrayPool_constructor));
|
||||
cls->defineFunction("resize", _SE(jsb_ArrayPool_resize));
|
||||
cls->defineFunction("getAlloc", _SE(jsb_ArrayPool_alloc));
|
||||
cls->defineFunction("alloc", _SE(jsb_ArrayPool_alloc));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<se::ArrayPool>(cls);
|
||||
|
||||
|
||||
@@ -1851,12 +1851,7 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_RenderView_finalize)
|
||||
|
||||
static bool js_pipeline_RenderView_constructor(se::State& s)
|
||||
{
|
||||
CC_UNUSED bool ok = true;
|
||||
const auto& args = s.args();
|
||||
unsigned int arg0 = 0;
|
||||
ok &= seval_to_uint32(args[0], (uint32_t*)&arg0);
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderView_constructor : Error processing arguments");
|
||||
cc::pipeline::RenderView* cobj = JSB_ALLOC(cc::pipeline::RenderView, arg0);
|
||||
cc::pipeline::RenderView* cobj = JSB_ALLOC(cc::pipeline::RenderView);
|
||||
s.thisObject()->setPrivateData(cobj);
|
||||
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
|
||||
return true;
|
||||
|
||||
@@ -25,63 +25,63 @@
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_module_register.h"
|
||||
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_module_register.h"
|
||||
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.h"
|
||||
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_conversions.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_platform.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_cocos2dx_network_manual.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_gfx_manual.h"
|
||||
#include "cocos/scripting/dop/jsb_dop.h"
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_gfx_auto.h"
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.h"
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.h"
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.h"
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_gfx_auto.h"
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_pipeline_auto.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_pipeline_manual.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_cocos2dx_network_manual.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_conversions.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_gfx_manual.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_platform.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.h"
|
||||
|
||||
#if USE_GFX_RENDERER
|
||||
#endif
|
||||
|
||||
#if USE_SOCKET
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_websocket.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_socketio.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_socketio.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_websocket.h"
|
||||
#endif // USE_SOCKET
|
||||
|
||||
#if USE_AUDIO
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.h"
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.h"
|
||||
#endif
|
||||
|
||||
#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_MAC_OSX)
|
||||
#include "cocos/scripting/js-bindings/manual/JavaScriptObjCBridge.h"
|
||||
#include "cocos/scripting/js-bindings/manual/JavaScriptObjCBridge.h"
|
||||
#endif
|
||||
|
||||
#if (CC_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
#include "cocos/scripting/js-bindings/manual/JavaScriptJavaBridge.h"
|
||||
#include "cocos/scripting/js-bindings/manual/JavaScriptJavaBridge.h"
|
||||
#endif
|
||||
|
||||
#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
|
||||
#if USE_VIDEO
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_video_auto.h"
|
||||
#endif
|
||||
#if USE_VIDEO
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_video_auto.h"
|
||||
#endif
|
||||
|
||||
#endif // (CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
|
||||
using namespace cc;
|
||||
|
||||
bool jsb_register_all_modules()
|
||||
{
|
||||
se::ScriptEngine* se = se::ScriptEngine::getInstance();
|
||||
bool jsb_register_all_modules() {
|
||||
se::ScriptEngine *se = se::ScriptEngine::getInstance();
|
||||
|
||||
se->addBeforeInitHook([](){
|
||||
se->addBeforeInitHook([]() {
|
||||
JSBClassType::init();
|
||||
});
|
||||
|
||||
se->addBeforeCleanupHook([se](){
|
||||
se->addBeforeCleanupHook([se]() {
|
||||
se->garbageCollect();
|
||||
PoolManager::getInstance()->getCurrentPool()->clear();
|
||||
se->garbageCollect();
|
||||
@@ -94,7 +94,7 @@ bool jsb_register_all_modules()
|
||||
se->addRegisterCallback(register_platform_bindings);
|
||||
se->addRegisterCallback(register_all_gfx);
|
||||
se->addRegisterCallback(register_all_gfx_manual);
|
||||
|
||||
|
||||
se->addRegisterCallback(register_all_network);
|
||||
se->addRegisterCallback(register_all_cocos2dx_network_manual);
|
||||
se->addRegisterCallback(register_all_xmlhttprequest);
|
||||
@@ -102,6 +102,7 @@ bool jsb_register_all_modules()
|
||||
se->addRegisterCallback(register_all_extension);
|
||||
se->addRegisterCallback(register_all_dop_bindings);
|
||||
se->addRegisterCallback(register_all_pipeline);
|
||||
se->addRegisterCallback(register_all_pipeline_manual);
|
||||
|
||||
#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_MAC_OSX)
|
||||
se->addRegisterCallback(register_javascript_objc_bridge);
|
||||
@@ -114,7 +115,7 @@ bool jsb_register_all_modules()
|
||||
#if USE_AUDIO
|
||||
se->addRegisterCallback(register_all_audioengine);
|
||||
#endif
|
||||
|
||||
|
||||
#if USE_SOCKET
|
||||
se->addRegisterCallback(register_all_websocket);
|
||||
se->addRegisterCallback(register_all_socketio);
|
||||
@@ -122,13 +123,13 @@ bool jsb_register_all_modules()
|
||||
|
||||
#if (CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
|
||||
#if USE_VIDEO
|
||||
// se->addRegisterCallback(register_all_video);
|
||||
#endif
|
||||
#if USE_VIDEO
|
||||
// se->addRegisterCallback(register_all_video);
|
||||
#endif
|
||||
|
||||
#endif // (CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
|
||||
se->addAfterCleanupHook([](){
|
||||
se->addAfterCleanupHook([]() {
|
||||
PoolManager::getInstance()->getCurrentPool()->clear();
|
||||
JSBClassType::destroy();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
#include "jsb_gfx_manual.h"
|
||||
#include "scripting/js-bindings/auto/jsb_pipeline_auto.h"
|
||||
#include "scripting/js-bindings/jswrapper/SeApi.h"
|
||||
#include "scripting/js-bindings/manual/jsb_conversions.h"
|
||||
#include "scripting/js-bindings/manual/jsb_global.h"
|
||||
|
||||
#include "renderer/pipeline/Define.h"
|
||||
#include "renderer/pipeline/RenderFlow.h"
|
||||
#include "renderer/pipeline/RenderPipeline.h"
|
||||
#include "renderer/pipeline/RenderStage.h"
|
||||
#include "renderer/pipeline/RenderView.h"
|
||||
#include "renderer/pipeline/forward/ForwardFlow.h"
|
||||
#include "renderer/pipeline/forward/ForwardPipeline.h"
|
||||
#include "renderer/pipeline/forward/ForwardStage.h"
|
||||
#include "renderer/pipeline/shadow/ShadowFlow.h"
|
||||
#include "renderer/pipeline/shadow/ShadowStage.h"
|
||||
#include "renderer/pipeline/ui/UIFlow.h"
|
||||
#include "renderer/pipeline/ui/UIStage.h"
|
||||
#include "scripting/js-bindings/manual/jsb_conversions.h"
|
||||
#include "scripting/js-bindings/manual/jsb_global.h"
|
||||
|
||||
se::Object *__jsb_cc_pipeline_RenderViewInfo_proto = nullptr;
|
||||
se::Class *__jsb_cc_pipeline_RenderViewInfo_class = nullptr;
|
||||
|
||||
SE_DECLARE_FINALIZE_FUNC(js_cc_pipeline_RenderViewInfo_finalize)
|
||||
|
||||
static bool js_pipeline_RenderViewInfo_constructor(se::State &s) {
|
||||
CC_UNUSED bool ok = true;
|
||||
const auto &args = s.args();
|
||||
size_t argc = args.size();
|
||||
|
||||
if (argc == 0) {
|
||||
cc::pipeline::RenderViewInfo *cobj = JSB_ALLOC(cc::pipeline::RenderViewInfo);
|
||||
s.thisObject()->setPrivateData(cobj);
|
||||
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
|
||||
return true;
|
||||
} else if (argc == 1 && args[0].isObject()) {
|
||||
se::Object *json = args[0].toObject();
|
||||
se::Value field;
|
||||
|
||||
cc::pipeline::RenderViewInfo *cobj = JSB_ALLOC(cc::pipeline::RenderViewInfo);
|
||||
unsigned int arg0 = 0;
|
||||
json->getProperty("cameraID", &field);
|
||||
if (!field.isUndefined()) {
|
||||
ok &= seval_to_uint32(field, (uint32_t *)&arg0);
|
||||
cobj->cameraID = arg0;
|
||||
}
|
||||
cc::String arg1;
|
||||
json->getProperty("name", &field);
|
||||
if (!field.isUndefined()) {
|
||||
arg1 = field.toStringForce().c_str();
|
||||
cobj->name = arg1;
|
||||
}
|
||||
unsigned int arg2 = 0;
|
||||
json->getProperty("priority", &field);
|
||||
if (!field.isUndefined()) {
|
||||
ok &= seval_to_uint32(field, (uint32_t *)&arg2);
|
||||
cobj->priority = arg2;
|
||||
}
|
||||
std::vector<std::string> arg3;
|
||||
json->getProperty("flows", &field);
|
||||
if (!field.isUndefined()) {
|
||||
ok &= seval_to_std_vector_string(field, &arg3);
|
||||
cobj->flows = arg3;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
JSB_FREE(cobj);
|
||||
SE_REPORT_ERROR("argument convertion error");
|
||||
return false;
|
||||
}
|
||||
|
||||
s.thisObject()->setPrivateData(cobj);
|
||||
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
|
||||
return true;
|
||||
} else if (argc == 4) {
|
||||
cc::pipeline::RenderViewInfo *cobj = JSB_ALLOC(cc::pipeline::RenderViewInfo);
|
||||
unsigned int arg0 = 0;
|
||||
if (!args[0].isUndefined()) {
|
||||
ok &= seval_to_uint32(args[0], (uint32_t *)&arg0);
|
||||
cobj->cameraID = arg0;
|
||||
}
|
||||
cc::String arg1;
|
||||
if (!args[1].isUndefined()) {
|
||||
arg1 = args[1].toStringForce().c_str();
|
||||
cobj->name = arg1;
|
||||
}
|
||||
unsigned int arg2 = 0;
|
||||
if (!args[2].isUndefined()) {
|
||||
ok &= seval_to_uint32(args[2], (uint32_t *)&arg2);
|
||||
cobj->priority = arg2;
|
||||
}
|
||||
std::vector<std::string> arg3;
|
||||
if (!args[3].isUndefined()) {
|
||||
ok &= seval_to_std_vector_string(args[3], &arg3);
|
||||
cobj->flows = arg3;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
JSB_FREE(cobj);
|
||||
SE_REPORT_ERROR("Argument convertion error");
|
||||
return false;
|
||||
}
|
||||
|
||||
s.thisObject()->setPrivateData(cobj);
|
||||
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
|
||||
return true;
|
||||
}
|
||||
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_CTOR(js_pipeline_RenderViewInfo_constructor, __jsb_cc_pipeline_RenderViewInfo_class, js_cc_pipeline_RenderViewInfo_finalize)
|
||||
|
||||
static bool js_cc_pipeline_RenderViewInfo_finalize(se::State &s) {
|
||||
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject());
|
||||
if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) {
|
||||
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
|
||||
cc::pipeline::RenderViewInfo *cobj = (cc::pipeline::RenderViewInfo *)s.nativeThisObject();
|
||||
JSB_FREE(cobj);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FINALIZE_FUNC(js_cc_pipeline_RenderViewInfo_finalize)
|
||||
|
||||
bool js_register_pipeline_RenderViewInfo(se::Object *obj) {
|
||||
auto cls = se::Class::create("RenderViewInfo", obj, nullptr, _SE(js_pipeline_RenderViewInfo_constructor));
|
||||
|
||||
cls->defineFinalizeFunction(_SE(js_cc_pipeline_RenderViewInfo_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cc::pipeline::RenderViewInfo>(cls);
|
||||
|
||||
__jsb_cc_pipeline_RenderViewInfo_proto = cls->getProto();
|
||||
__jsb_cc_pipeline_RenderViewInfo_class = cls;
|
||||
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool js_pipeline_RenderPipeline_getMacros(se::State& s)
|
||||
{
|
||||
cc::pipeline::RenderPipeline* cobj = (cc::pipeline::RenderPipeline*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_getMacros : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
const cc::ValueMap& result = cobj->getMacros();
|
||||
ok &= ccvaluemap_to_seval(result, &s.rval());
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_getMacros : Error processing arguments");
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_PROP_GET(js_pipeline_RenderPipeline_getMacros)
|
||||
|
||||
static bool js_pipeline_RenderPipeline_setMacros(se::State& s)
|
||||
{
|
||||
cc::pipeline::RenderPipeline* cobj = (cc::pipeline::RenderPipeline*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_RenderPipeline_setMacros : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
cc::ValueMap arg0;
|
||||
std::string arg1;
|
||||
ok &= seval_to_ccvaluemap(args[0], &arg0);
|
||||
ok &= seval_to_std_string(args[1], &arg1);
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderPipeline_setMacros : Error processing arguments");
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_PROP_SET(js_pipeline_RenderPipeline_setMacros)
|
||||
|
||||
static bool js_pipeline_RenderView_setEnabled(se::State& s)
|
||||
{
|
||||
cc::pipeline::RenderView* cobj = (cc::pipeline::RenderView*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_RenderView_setEnabled : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
bool arg0;
|
||||
ok &= seval_to_boolean(args[0], &arg0);
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderView_setEnabled : Error processing arguments");
|
||||
cobj->setEnable(arg0);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_pipeline_RenderView_setEnabled)
|
||||
|
||||
static bool js_pipeline_RenderView_IsEnabled(se::State& s)
|
||||
{
|
||||
cc::pipeline::RenderView* cobj = (cc::pipeline::RenderView*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_pipeline_RenderView_getIsEnable : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
bool result = cobj->isEnabled();
|
||||
ok &= boolean_to_seval(result, &s.rval());
|
||||
SE_PRECONDITION2(ok, false, "js_pipeline_RenderView_getIsEnable : Error processing arguments");
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_PROP_GET(js_pipeline_RenderView_IsEnabled)
|
||||
|
||||
bool register_all_pipeline_manual(se::Object *obj) {
|
||||
// Get the ns
|
||||
se::Value nsVal;
|
||||
if (!obj->getProperty("nr", &nsVal)) {
|
||||
se::HandleObject jsobj(se::Object::createPlainObject());
|
||||
nsVal.setObject(jsobj);
|
||||
obj->setProperty("nr", nsVal);
|
||||
}
|
||||
se::Object *ns = nsVal.toObject();
|
||||
|
||||
js_register_pipeline_RenderViewInfo(ns);
|
||||
|
||||
__jsb_cc_pipeline_RenderPipeline_proto->defineProperty("macros", _SE(js_pipeline_RenderPipeline_getMacros), _SE(js_pipeline_RenderPipeline_setMacros));
|
||||
__jsb_cc_pipeline_RenderView_proto->defineFunction("enable", _SE(js_pipeline_RenderView_setEnabled));
|
||||
__jsb_cc_pipeline_RenderView_proto->defineProperty("isEnable", _SE(js_pipeline_RenderView_IsEnabled), nullptr);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace se {
|
||||
class Object;
|
||||
}
|
||||
bool register_all_pipeline_manual(se::Object *obj);
|
||||
@@ -16,7 +16,7 @@ android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILIT
|
||||
clang_headers =
|
||||
clang_flags = -nostdinc -x c++ -std=c++14 -fsigned-char -U__SSE__
|
||||
|
||||
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources
|
||||
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/external/ios/include/v8
|
||||
cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ cxxgenerator_headers =
|
||||
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
|
||||
|
||||
# what headers to parse
|
||||
headers = %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardPipeline.h %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardFlow.h %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardStage.h %(cocosdir)s/cocos/renderer/pipeline/shadow/ShadowFlow.h %(cocosdir)s/cocos/renderer/pipeline/shadow/ShadowStage.h %(cocosdir)s/cocos/renderer/pipeline/ui/UIFlow.h %(cocosdir)s/cocos/renderer/pipeline/ui/UIStage.h %(cocosdir)s/cocos/renderer/pipeline/RenderPipeline.h %(cocosdir)s/cocos/renderer/pipeline/RenderFlow.h %(cocosdir)s/cocos/renderer/pipeline/RenderStage.h %(cocosdir)s/cocos/renderer/pipeline/Define.h %(cocosdir)s/cocos/renderer/pipeline/RenderView.h
|
||||
headers = %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardPipeline.h %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardFlow.h %(cocosdir)s/cocos/renderer/pipeline/forward/ForwardStage.h %(cocosdir)s/cocos/renderer/pipeline/shadow/ShadowFlow.h %(cocosdir)s/cocos/renderer/pipeline/shadow/ShadowStage.h %(cocosdir)s/cocos/renderer/pipeline/ui/UIFlow.h %(cocosdir)s/cocos/renderer/pipeline/ui/UIStage.h %(cocosdir)s/cocos/renderer/pipeline/RenderPipeline.h %(cocosdir)s/cocos/renderer/pipeline/RenderFlow.h %(cocosdir)s/cocos/renderer/pipeline/RenderStage.h %(cocosdir)s/cocos/renderer/pipeline/Define.h %(cocosdir)s/cocos/renderer/pipeline/RenderView.h %(cocosdir)s/cocos/renderer/pipeline/helper/SharedMemory.h
|
||||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||
classes = RenderPipeline ForwardPipeline ForwardFlow ForwardStage ShadowFlow ShadowStage UIFlow UIStage RenderView RenderPipelineInfo RenderFlowInfo RenderStageInfo RenderQueueDesc RenderFlow RenderStage
|
||||
classes = RenderPipeline ForwardPipeline ForwardFlow ForwardStage ShadowFlow ShadowStage UIFlow UIStage RenderView RenderPipelineInfo RenderFlowInfo RenderStageInfo RenderQueueDesc RenderFlow RenderStage RenderWindow
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
@@ -39,7 +39,7 @@ classes = RenderPipeline ForwardPipeline ForwardFlow ForwardStage ShadowFlow Sha
|
||||
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
|
||||
# functions from all classes.
|
||||
skip = ForwardPipeline::[updateUBOs setHDR getOrCreateRenderPass getLightsUBO getValidLights getLightBuffers getLightIndexOffsets getLightIndices getRenderObjects getShadowObjects getCommandBuffers getShadingScale getFpScale isHDR setRenderObjcts setShadowObjects getShadowMap],
|
||||
RenderPipeline::[getFlows getTag getGlobalBindings getMacro getDescriptorSet],
|
||||
RenderPipeline::[getFlows getTag getGlobalBindings getMacros getDescriptorSet],
|
||||
RenderFlow::[render destroy getPriority getName],
|
||||
RenderStage::[render destroy getPriority getName],
|
||||
ForwardFlow::[initialize activate destroy render],
|
||||
@@ -48,10 +48,12 @@ skip = ForwardPipeline::[updateUBOs setHDR getOrCreateRenderPass getLightsUBO ge
|
||||
ShadowStage::[initialize activate destroy render],
|
||||
UIFlow::[initialize activate destroy render],
|
||||
UIStage::[initialize activate destroy render],
|
||||
RenderView::[getWindow getCamera]
|
||||
RenderView::[getCamera isEnabled setEnable]
|
||||
|
||||
rename_functions =
|
||||
|
||||
getter_setter=RenderView::[name window]
|
||||
|
||||
rename_classes =
|
||||
|
||||
# for all class names, should we remove something when registering in the target VM?
|
||||
|
||||
Reference in New Issue
Block a user