修复透明度bug

This commit is contained in:
owen
2019-06-27 16:20:33 +08:00
parent 63222190b4
commit eec0bace41
12 changed files with 243 additions and 262 deletions
+5 -2
View File
@@ -127,6 +127,10 @@ void ModelBatcher::commit(NodeProxy* node, Assembler* assembler)
const Mat4& worldMat = useModel && !ignoreWorldMatrix ? nodeWorldMat : Mat4::IDENTITY;
int cullingMask = node->getCullingMask();
auto asmDirty = assembler->getDirty();
auto nodeDirty = node->getDirty();
auto needUpdateOpacity = *asmDirty & RenderFlow::OPACITY_CHANGED || *nodeDirty & RenderFlow::OPACITY_CHANGED || assembler->isOpacityAlwaysDirty();
for (std::size_t i = 0, l = assembler->getIACount(); i < l; ++i)
{
assembler->beforeFillBuffers(i);
@@ -147,8 +151,7 @@ void ModelBatcher::commit(NodeProxy* node, Assembler* assembler)
_cullingMask = cullingMask;
}
auto dirtyFlag = assembler->getDirtyFlag();
if (dirtyFlag & AssemblerBase::OPACITY || assembler->isOpacityAlwaysDirty())
if (needUpdateOpacity)
{
assembler->updateOpacity(i, node->getRealOpacity());
}
+43 -96
View File
@@ -38,14 +38,12 @@
RENDERER_BEGIN
int NodeProxy::_parentOpacityDirty = 0;
int NodeProxy::_worldMatDirty = 0;
NodeProxy::NodeProxy(std::size_t unitID, std::size_t index, std::string id)
NodeProxy::NodeProxy(std::size_t unitID, std::size_t index, const std::string& id, const std::string& name)
{
_id = id;
_unitID = unitID;
_index = index;
_name = name;
NodeMemPool* pool = NodeMemPool::getInstance();
CCASSERT(pool, "NodeProxy constructor NodeMemPool is null");
@@ -238,18 +236,22 @@ void NodeProxy::updateLevel()
levelInfo.dirty = _dirty;
levelInfo.localMat = _localMat;
levelInfo.worldMat = _worldMat;
levelInfo.opacity = _opacity;
levelInfo.realOpacity = &_realOpacity;
if (_parent)
{
_level = _parent->_level + 1;
levelInfo.parentWorldMat = _parent->_worldMat;
levelInfo.parentDirty = _parent->_dirty;
levelInfo.parentRealOpacity = &_parent->_realOpacity;
}
else
{
_level = 0;
levelInfo.parentWorldMat = nullptr;
levelInfo.parentDirty = nullptr;
levelInfo.parentRealOpacity = nullptr;
}
renderFlow->insertNodeLevel(_level, levelInfo);
@@ -299,7 +301,7 @@ void NodeProxy::clearAssembler()
CC_SAFE_RELEASE_NULL(_assembler);
}
AssemblerBase* NodeProxy::getAssembler()
AssemblerBase* NodeProxy::getAssembler() const
{
return _assembler;
}
@@ -386,28 +388,44 @@ void NodeProxy::setOpacity(uint8_t opacity)
void NodeProxy::updateRealOpacity()
{
if (_parent && (_parentOpacityDirty > 0 || *_dirty & RenderFlow::OPACITY))
bool selfOpacityDirty = *_dirty & RenderFlow::OPACITY;
if (_parent)
{
float parentOpacity = _parent ? _parent->getRealOpacity() / 255.0f : 1.0f;
float opacity = (uint8_t)(*_opacity * parentOpacity);
_realOpacity = opacity;
_opacityUpdated = true;
*_dirty &= ~RenderFlow::OPACITY;
if (_assembler)
if (selfOpacityDirty || *_parent->_dirty & RenderFlow::OPACITY_CHANGED)
{
_assembler->notifyDirty(AssemblerBase::OPACITY);
_realOpacity = *_opacity * _parent->getRealOpacity() / 255.0f;
*_dirty &= ~RenderFlow::OPACITY;
*_dirty |= RenderFlow::OPACITY_CHANGED;
}
}
else
{
if (selfOpacityDirty)
{
_realOpacity = *_opacity;
*_dirty &= ~RenderFlow::OPACITY;
*_dirty |= RenderFlow::OPACITY_CHANGED;
}
}
}
void NodeProxy::updateWorldMatrix()
{
if (_updateWorldMatrix && (*_dirty & RenderFlow::WORLD_TRANSFORM || _worldMatDirty > 0))
if (!_updateWorldMatrix) return;
bool selfWorldDirty = *_dirty & RenderFlow::WORLD_TRANSFORM;
if (_parent)
{
// Update world matrix
const cocos2d::Mat4& parentMat = _parent == nullptr ? cocos2d::Mat4::IDENTITY : _parent->getWorldMatrix();
updateWorldMatrix(parentMat);
if (selfWorldDirty || *_parent->_dirty & RenderFlow::WORLD_TRANSFORM_CHANGED)
{
updateWorldMatrix(_parent->getWorldMatrix());
}
}
else if (selfWorldDirty)
{
*_worldMat = *_localMat;
*_dirty &= ~RenderFlow::WORLD_TRANSFORM;
*_dirty |= RenderFlow::WORLD_TRANSFORM_CHANGED;
}
}
@@ -415,7 +433,7 @@ void NodeProxy::updateWorldMatrix(const cocos2d::Mat4& parentMatrix)
{
_worldMat->multiply(parentMatrix, *_localMat, _worldMat);
*_dirty &= ~RenderFlow::WORLD_TRANSFORM;
_matrixUpdated = true;
*_dirty |= RenderFlow::WORLD_TRANSFORM_CHANGED;
}
void NodeProxy::updateLocalMatrix()
@@ -444,55 +462,19 @@ void NodeProxy::updateLocalMatrix()
}
}
void NodeProxy::visitAsRoot(ModelBatcher* batcher, Scene* scene)
void NodeProxy::render(ModelBatcher* batcher, Scene* scene)
{
_worldMatDirty = 0;
_parentOpacityDirty = 0;
visitWithoutTransform(batcher, scene);
}
void NodeProxy::visitWithoutTransform(ModelBatcher* batcher, Scene* scene)
{
if (!_needVisit) return;
updateRealOpacity();
if (_realOpacity == 0)
{
return;
}
if (!_needVisit || _realOpacity == 0) return;
// pre render
if (_assembler && _assembler->enabled()) _assembler->handle(this, batcher, scene);
/////////////////////////////////////////
// begin visit children
/////////////////////////////////////////
bool parentOpacityUpdated = false;
if (_opacityUpdated)
{
_parentOpacityDirty++;
_opacityUpdated = false;
parentOpacityUpdated = true;
}
reorderChildren();
for (const auto& child : _children)
{
child->visitWithoutTransform(batcher, scene);
child->render(batcher, scene);
}
if (parentOpacityUpdated)
{
_parentOpacityDirty--;
}
/////////////////////////////////////////
// end visit children
/////////////////////////////////////////
// post render
if (_assembler && _assembler->enabled()) _assembler->postHandle(this, batcher, scene);
}
@@ -510,51 +492,16 @@ void NodeProxy::visit(ModelBatcher* batcher, Scene* scene)
updateLocalMatrix();
updateWorldMatrix();
// pre render
if (_assembler && _assembler->enabled()) _assembler->handle(this, batcher, scene);
/////////////////////////////////////////
// begin visit children
/////////////////////////////////////////
bool parentWorldMatUpdated = false;
bool parentOpacityUpdated = false;
if (_matrixUpdated)
{
_worldMatDirty++;
_matrixUpdated = false;
parentWorldMatUpdated = true;
}
if (_opacityUpdated)
{
_parentOpacityDirty++;
_opacityUpdated = false;
parentOpacityUpdated = true;
}
reorderChildren();
for (const auto& child : _children)
{
child->visit(batcher, scene);
}
if (parentOpacityUpdated)
{
_parentOpacityDirty--;
}
if (parentWorldMatUpdated)
{
_worldMatDirty--;
}
/////////////////////////////////////////
// end visit children
/////////////////////////////////////////
// post render
if (_assembler && _assembler->enabled()) _assembler->postHandle(this, batcher, scene);
}
+6 -21
View File
@@ -71,7 +71,7 @@ public:
/*
* @brief The default constructor.
*/
NodeProxy(std::size_t unitID, std::size_t index, std::string id);
NodeProxy(std::size_t unitID, std::size_t index, const std::string& id, const std::string& name);
/*
* @brief The destructor.
*/
@@ -232,12 +232,7 @@ public:
* @param[in] sysid The system id.
* @return The system handle object or nullptr if not exist
*/
AssemblerBase* getAssembler();
/*
* @brief Traverse all node proxy in the current node tree.
*/
void visitAsRoot(ModelBatcher* batcher, Scene* scene);
AssemblerBase* getAssembler() const;
/*
* @brief Visit the node as a ordinary node but not a root node.
*/
@@ -245,7 +240,7 @@ public:
/*
* @brief Visit the node but do not transform position.
*/
void visitWithoutTransform(ModelBatcher* batcher, Scene* scene);
void render(ModelBatcher* batcher, Scene* scene);
/*
* @brief Enables visit.
*/
@@ -280,28 +275,18 @@ public:
/*
* @brief Gets node runtime id
*/
std::string getID() { return _id; }
const std::string& getID() const { return _id; }
/*
* @brief Adds world matrix dirty count
* @brief Gets node dirty
*/
void addWorldMatDirty() { _worldMatDirty++; }
/*
* @brief Subs world matrix dirty count
*/
void subWorldMatDirty() { _worldMatDirty--; }
uint32_t* getDirty() const { return _dirty; }
protected:
void updateLevel();
void childrenAlloc();
void detachChild(NodeProxy* child, ssize_t childIndex);
void reorderChildren();
private:
static int _worldMatDirty;
static int _parentOpacityDirty;
bool _matrixUpdated = false;
bool _opacityUpdated = false;
bool _needVisit = true;
bool _updateWorldMatrix = true;
+35 -12
View File
@@ -81,7 +81,7 @@ RenderFlow::RenderFlow(DeviceGraphics* device, Scene* scene, ForwardRenderer* fo
RenderFlow::~RenderFlow()
{
delete _paralleTask;
CC_SAFE_DELETE(_paralleTask);
CC_SAFE_DELETE(_batcher);
}
@@ -163,7 +163,8 @@ void RenderFlow::calculateLocalMatrix(int tid)
{
if (signData->freeFlag == SPACE_FREE_FLAG) continue;
// reset world transform changed flag
*dirty &= ~WORLD_TRANSFORM_CHANGED;
*dirty &= ~(WORLD_TRANSFORM_CHANGED | OPACITY_CHANGED);
// reset opacity changed flag
if (!(*dirty & LOCAL_TRANSFORM)) continue;
localMat->setIdentity();
@@ -202,18 +203,40 @@ void RenderFlow::calculateLevelWorldMatrix(int tid)
for(std::size_t index = begin; index < end; index++)
{
auto& info = levelInfos[index];
auto selfDirty = *info.dirty & WORLD_TRANSFORM;
if (info.parentDirty != nullptr && ((*info.parentDirty & WORLD_TRANSFORM_CHANGED) || selfDirty))
auto selfWorldDirty = *info.dirty & WORLD_TRANSFORM;
auto selfOpacityDirty = *info.dirty & OPACITY;
if (info.parentDirty)
{
cocos2d::Mat4::multiply(*info.parentWorldMat, *info.localMat, info.worldMat);
*info.dirty |= WORLD_TRANSFORM_CHANGED;
*info.dirty &= ~WORLD_TRANSFORM;
if ((*info.parentDirty & WORLD_TRANSFORM_CHANGED) || selfWorldDirty)
{
cocos2d::Mat4::multiply(*info.parentWorldMat, *info.localMat, info.worldMat);
*info.dirty |= WORLD_TRANSFORM_CHANGED;
*info.dirty &= ~WORLD_TRANSFORM;
}
if ((*info.parentDirty & OPACITY_CHANGED) || selfOpacityDirty)
{
*info.realOpacity = *info.opacity * *info.parentRealOpacity / 255.0f;
*info.dirty |= OPACITY_CHANGED;
*info.dirty &= ~OPACITY;
}
}
else if (selfDirty)
else
{
*info.worldMat = *info.localMat;
*info.dirty |= WORLD_TRANSFORM_CHANGED;
*info.dirty &= ~WORLD_TRANSFORM;
if (selfWorldDirty)
{
*info.worldMat = *info.localMat;
*info.dirty |= WORLD_TRANSFORM_CHANGED;
*info.dirty &= ~WORLD_TRANSFORM;
}
if (selfOpacityDirty)
{
*info.realOpacity = *info.opacity;
*info.dirty |= OPACITY_CHANGED;
*info.dirty &= ~OPACITY;
}
}
}
}
@@ -301,7 +324,7 @@ void RenderFlow::render(NodeProxy* scene, float deltaTime)
#endif
_batcher->startBatch();
scene->visitAsRoot(_batcher, _scene);
scene->render(_batcher, _scene);
_batcher->terminateBatch();
_forward->render(_scene);
+9 -4
View File
@@ -72,9 +72,11 @@ public:
FINAL = 1 << 9,
// native render flag
REORDER_CHILDREN = 1 << 10,
REORDER_CHILDREN = 1 << 29,
// world matrix changed
WORLD_TRANSFORM_CHANGED = 1 << 11
WORLD_TRANSFORM_CHANGED = 1 << 30,
// cascade opacity changed
OPACITY_CHANGED = 1 << 31,
};
enum ParallelStage {
@@ -85,10 +87,13 @@ public:
struct LevelInfo{
uint32_t* dirty = nullptr;
uint32_t* parentDirty = nullptr;
cocos2d::Mat4* parentWorldMat = nullptr;
uint8_t* parentRealOpacity = nullptr;
cocos2d::Mat4* localMat = nullptr;
cocos2d::Mat4* worldMat = nullptr;
cocos2d::Mat4* parentWorldMat = nullptr;
uint32_t* parentDirty = nullptr;
uint8_t* opacity = nullptr;
uint8_t* realOpacity = nullptr;
};
static RenderFlow *getInstance()
@@ -32,6 +32,7 @@
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
#include "cocos/scripting/js-bindings/manual/jsb_conversions.hpp"
#include "cocos/scripting/js-bindings/auto/jsb_renderer_auto.hpp"
#include "../RenderFlow.hpp"
RENDERER_BEGIN
@@ -83,7 +84,7 @@ Assembler::~Assembler()
void Assembler::enable()
{
_enabled = true;
_dirtyFlag |= OPACITY;
*_dirty |= RenderFlow::OPACITY_CHANGED;
}
void Assembler::updateMeshIndex(std::size_t iaIndex, int meshIndex)
@@ -261,7 +262,7 @@ void Assembler::updateOpacity(std::size_t index, uint8_t opacity)
ptrAlpha += dataPerVertex;
}
_dirtyFlag &= ~OPACITY;
*_dirty &= ~RenderFlow::OPACITY_CHANGED;
}
RENDERER_END
@@ -33,7 +33,14 @@ AssemblerBase::AssemblerBase()
AssemblerBase::~AssemblerBase()
{
if (_jsDirty)
{
_jsDirty->unroot();
_jsDirty->decRef();
_jsDirty = nullptr;
}
_dirty = nullptr;
_dirtyLen = 0;
}
void AssemblerBase::enable()
@@ -46,4 +53,25 @@ void AssemblerBase::disable()
_enabled = false;
}
void AssemblerBase::setDirty(se_object_ptr jsDirty)
{
if (_jsDirty == jsDirty) return;
if (_jsDirty)
{
_jsDirty->unroot();
_jsDirty->decRef();
_jsDirty = nullptr;
}
if (jsDirty == nullptr) return;
_jsDirty = jsDirty;
_jsDirty->root();
_jsDirty->incRef();
_dirty = nullptr;
_dirtyLen = 0;
_jsDirty->getTypedArrayData((uint8_t**)&_dirty, &_dirtyLen);
}
RENDERER_END
@@ -28,6 +28,7 @@
#include <stdint.h>
#include "base/CCVector.h"
#include "../../renderer/Effect.h"
#include "scripting/js-bindings/jswrapper/Object.hpp"
RENDERER_BEGIN
@@ -58,14 +59,14 @@ public:
* @param[in] batcher
* @param[in] scene
*/
virtual void handle(NodeProxy *node, ModelBatcher* batcher, Scene* scene) {};
virtual void handle(NodeProxy *node, ModelBatcher* batcher, Scene* scene) {}
/**
* @brief Callback which will be invoked after visiting child nodes.
* @param[in] node The node being processed.
* @param[in] batcher
* @param[in] scene
*/
virtual void postHandle(NodeProxy *node, ModelBatcher* batcher, Scene* scene) {};
virtual void postHandle(NodeProxy *node, ModelBatcher* batcher, Scene* scene) {}
/**
* @brief Gets whether the current handle should use model matrix uniform during rendering
@@ -73,7 +74,7 @@ public:
bool getUseModel() const
{
return _useModel;
};
}
/**
* @brief Sets whether the current handle should use model matrix uniform during rendering
@@ -81,24 +82,19 @@ public:
void setUseModel(bool useModel)
{
_useModel = useModel;
};
}
/**
* @brief Notify dirty flag.
* @param[in] node The node being processed.
* @param[in] flag
* @brief Sync script dirty flag.
*/
virtual void notifyDirty(uint32_t flag)
{
_dirtyFlag |= flag;
}
virtual void setDirty(se_object_ptr jsDirty);
/**
* @brief Gets dirty flag.
*/
uint32_t getDirtyFlag() const
uint32_t* getDirty() const
{
return _dirtyFlag;
return _dirty;
}
/**
@@ -115,16 +111,17 @@ public:
* @brief Is assembler enabled.
* @return _enabled
*/
bool enabled() const { return _enabled; };
bool enabled() const { return _enabled; }
/**
* @brief Resets data.
*/
virtual void reset() {};
public:
static const int OPACITY = 1;
virtual void reset() {}
protected:
uint32_t _dirtyFlag = 0;
se::Object* _jsDirty = nullptr;
uint32_t* _dirty = nullptr;
std::size_t _dirtyLen = 0;
bool _enabled = false;
bool _useModel = false;
};
@@ -73,9 +73,7 @@ void TiledMapAssembler::beforeFillBuffers(std::size_t index)
child->disaleUpdateWorldMatrix();
child->updateLocalMatrix();
child->updateWorldMatrix(_tileMapWorldMat);
child->addWorldMatDirty();
flow->visit(child);
child->subWorldMatDirty();
child->enableUpdateWorldMatrix();
child->disableVisit();
}
@@ -264,6 +264,16 @@ double
{
},
/**
* @method copy
* @param {cc.renderer::Effect} arg0
*/
copy : function (
effect
)
{
},
/**
* @method clear
*/
@@ -388,16 +398,6 @@ scene
{
},
/**
* @method getDirtyFlag
* @return {unsigned int}
*/
getDirtyFlag : function (
)
{
return 0;
},
/**
* @method postHandle
* @param {cc.renderer::NodeProxy} arg0
@@ -451,11 +451,21 @@ disable : function (
},
/**
* @method notifyDirty
* @param {unsigned int} arg0
* @method getDirty
* @return {unsigned int}
*/
notifyDirty : function (
int
getDirty : function (
)
{
return 0;
},
/**
* @method setDirty
* @param {se::Object} arg0
*/
setDirty : function (
object
)
{
},
@@ -477,11 +487,11 @@ AssemblerBase : function (
renderer.NodeProxy = {
/**
* @method visitWithoutTransform
* @method render
* @param {cc.renderer::ModelBatcher} arg0
* @param {cc.renderer::Scene} arg1
*/
visitWithoutTransform : function (
render : function (
modelbatcher,
scene
)
@@ -516,14 +526,6 @@ getChildren : function (
return new Array();
},
/**
* @method subWorldMatDirty
*/
subWorldMatDirty : function (
)
{
},
/**
* @method disableVisit
*/
@@ -542,14 +544,6 @@ int
{
},
/**
* @method addWorldMatDirty
*/
addWorldMatDirty : function (
)
{
},
/**
* @method disaleUpdateWorldMatrix
*/
@@ -628,6 +622,16 @@ getRealOpacity : function (
return 0;
},
/**
* @method getDirty
* @return {unsigned int}
*/
getDirty : function (
)
{
return 0;
},
/**
* @method getOpacity
* @return {unsigned char}
@@ -778,10 +782,12 @@ getChildrenCount : function (
* @param {unsigned int} arg0
* @param {unsigned int} arg1
* @param {String} arg2
* @param {String} arg3
*/
NodeProxy : function (
int,
int,
str,
str
)
{
@@ -1315,24 +1315,6 @@ static bool js_renderer_AssemblerBase_handle(se::State& s)
}
SE_BIND_FUNC(js_renderer_AssemblerBase_handle)
static bool js_renderer_AssemblerBase_getDirtyFlag(se::State& s)
{
cocos2d::renderer::AssemblerBase* cobj = (cocos2d::renderer::AssemblerBase*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_renderer_AssemblerBase_getDirtyFlag : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
unsigned int result = cobj->getDirtyFlag();
ok &= uint32_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_renderer_AssemblerBase_getDirtyFlag : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_renderer_AssemblerBase_getDirtyFlag)
static bool js_renderer_AssemblerBase_postHandle(se::State& s)
{
cocos2d::renderer::AssemblerBase* cobj = (cocos2d::renderer::AssemblerBase*)s.nativeThisObject();
@@ -1426,24 +1408,42 @@ static bool js_renderer_AssemblerBase_disable(se::State& s)
}
SE_BIND_FUNC(js_renderer_AssemblerBase_disable)
static bool js_renderer_AssemblerBase_notifyDirty(se::State& s)
static bool js_renderer_AssemblerBase_getDirty(se::State& s)
{
cocos2d::renderer::AssemblerBase* cobj = (cocos2d::renderer::AssemblerBase*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_renderer_AssemblerBase_notifyDirty : Invalid Native Object");
SE_PRECONDITION2(cobj, false, "js_renderer_AssemblerBase_getDirty : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
unsigned int* result = cobj->getDirty();
#pragma warning NO CONVERSION FROM NATIVE FOR unsigned int*;
SE_PRECONDITION2(ok, false, "js_renderer_AssemblerBase_getDirty : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_renderer_AssemblerBase_getDirty)
static bool js_renderer_AssemblerBase_setDirty(se::State& s)
{
cocos2d::renderer::AssemblerBase* cobj = (cocos2d::renderer::AssemblerBase*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_renderer_AssemblerBase_setDirty : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
unsigned int arg0 = 0;
ok &= seval_to_uint32(args[0], (uint32_t*)&arg0);
SE_PRECONDITION2(ok, false, "js_renderer_AssemblerBase_notifyDirty : Error processing arguments");
cobj->notifyDirty(arg0);
se_object_ptr arg0 = nullptr;
arg0 = args[0].toObject();
SE_PRECONDITION2(ok, false, "js_renderer_AssemblerBase_setDirty : Error processing arguments");
cobj->setDirty(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_renderer_AssemblerBase_notifyDirty)
SE_BIND_FUNC(js_renderer_AssemblerBase_setDirty)
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_renderer_AssemblerBase_finalize)
@@ -1483,13 +1483,13 @@ bool js_register_renderer_AssemblerBase(se::Object* obj)
cls->defineFunction("reset", _SE(js_renderer_AssemblerBase_reset));
cls->defineFunction("enable", _SE(js_renderer_AssemblerBase_enable));
cls->defineFunction("handle", _SE(js_renderer_AssemblerBase_handle));
cls->defineFunction("getDirtyFlag", _SE(js_renderer_AssemblerBase_getDirtyFlag));
cls->defineFunction("postHandle", _SE(js_renderer_AssemblerBase_postHandle));
cls->defineFunction("getUseModel", _SE(js_renderer_AssemblerBase_getUseModel));
cls->defineFunction("setUseModel", _SE(js_renderer_AssemblerBase_setUseModel));
cls->defineFunction("enabled", _SE(js_renderer_AssemblerBase_enabled));
cls->defineFunction("disable", _SE(js_renderer_AssemblerBase_disable));
cls->defineFunction("notifyDirty", _SE(js_renderer_AssemblerBase_notifyDirty));
cls->defineFunction("getDirty", _SE(js_renderer_AssemblerBase_getDirty));
cls->defineFunction("setDirty", _SE(js_renderer_AssemblerBase_setDirty));
cls->defineFunction("ctor", _SE(js_renderer_AssemblerBase_ctor));
cls->defineFinalizeFunction(_SE(js_cocos2d_renderer_AssemblerBase_finalize));
cls->install();
@@ -1506,10 +1506,10 @@ bool js_register_renderer_AssemblerBase(se::Object* obj)
se::Object* __jsb_cocos2d_renderer_NodeProxy_proto = nullptr;
se::Class* __jsb_cocos2d_renderer_NodeProxy_class = nullptr;
static bool js_renderer_NodeProxy_visitWithoutTransform(se::State& s)
static bool js_renderer_NodeProxy_render(se::State& s)
{
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_visitWithoutTransform : Invalid Native Object");
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_render : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
@@ -1518,14 +1518,14 @@ static bool js_renderer_NodeProxy_visitWithoutTransform(se::State& s)
cocos2d::renderer::Scene* arg1 = nullptr;
ok &= seval_to_native_ptr(args[0], &arg0);
ok &= seval_to_native_ptr(args[1], &arg1);
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_visitWithoutTransform : Error processing arguments");
cobj->visitWithoutTransform(arg0, arg1);
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_render : Error processing arguments");
cobj->render(arg0, arg1);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
return false;
}
SE_BIND_FUNC(js_renderer_NodeProxy_visitWithoutTransform)
SE_BIND_FUNC(js_renderer_NodeProxy_render)
static bool js_renderer_NodeProxy_updateLocalMatrix(se::State& s)
{
@@ -1589,21 +1589,6 @@ static bool js_renderer_NodeProxy_getChildren(se::State& s)
}
SE_BIND_FUNC(js_renderer_NodeProxy_getChildren)
static bool js_renderer_NodeProxy_subWorldMatDirty(se::State& s)
{
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_subWorldMatDirty : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
if (argc == 0) {
cobj->subWorldMatDirty();
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_renderer_NodeProxy_subWorldMatDirty)
static bool js_renderer_NodeProxy_disableVisit(se::State& s)
{
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
@@ -1638,21 +1623,6 @@ static bool js_renderer_NodeProxy_setCullingMask(se::State& s)
}
SE_BIND_FUNC(js_renderer_NodeProxy_setCullingMask)
static bool js_renderer_NodeProxy_addWorldMatDirty(se::State& s)
{
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_addWorldMatDirty : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
if (argc == 0) {
cobj->addWorldMatDirty();
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_renderer_NodeProxy_addWorldMatDirty)
static bool js_renderer_NodeProxy_disaleUpdateWorldMatrix(se::State& s)
{
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
@@ -1795,6 +1765,24 @@ static bool js_renderer_NodeProxy_getRealOpacity(se::State& s)
}
SE_BIND_FUNC(js_renderer_NodeProxy_getRealOpacity)
static bool js_renderer_NodeProxy_getDirty(se::State& s)
{
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_getDirty : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
unsigned int* result = cobj->getDirty();
#pragma warning NO CONVERSION FROM NATIVE FOR unsigned int*;
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_getDirty : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_renderer_NodeProxy_getDirty)
static bool js_renderer_NodeProxy_getOpacity(se::State& s)
{
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
@@ -1903,7 +1891,7 @@ static bool js_renderer_NodeProxy_getID(se::State& s)
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
std::string result = cobj->getID();
const std::string& result = cobj->getID();
ok &= std_string_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_getID : Error processing arguments");
return true;
@@ -2069,11 +2057,13 @@ static bool js_renderer_NodeProxy_constructor(se::State& s)
size_t arg0 = 0;
size_t arg1 = 0;
std::string arg2;
std::string arg3;
ok &= seval_to_size(args[0], &arg0);
ok &= seval_to_size(args[1], &arg1);
ok &= seval_to_std_string(args[2], &arg2);
ok &= seval_to_std_string(args[3], &arg3);
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_constructor : Error processing arguments");
cocos2d::renderer::NodeProxy* cobj = new (std::nothrow) cocos2d::renderer::NodeProxy(arg0, arg1, arg2);
cocos2d::renderer::NodeProxy* cobj = new (std::nothrow) cocos2d::renderer::NodeProxy(arg0, arg1, arg2, arg3);
s.thisObject()->setPrivateData(cobj);
return true;
}
@@ -2095,14 +2085,12 @@ bool js_register_renderer_NodeProxy(se::Object* obj)
{
auto cls = se::Class::create("NodeProxy", obj, nullptr, _SE(js_renderer_NodeProxy_constructor));
cls->defineFunction("visitWithoutTransform", _SE(js_renderer_NodeProxy_visitWithoutTransform));
cls->defineFunction("render", _SE(js_renderer_NodeProxy_render));
cls->defineFunction("updateLocalMatrix", _SE(js_renderer_NodeProxy_updateLocalMatrix));
cls->defineFunction("updateWorldMatrix", _SE(js_renderer_NodeProxy_updateWorldMatrix));
cls->defineFunction("getChildren", _SE(js_renderer_NodeProxy_getChildren));
cls->defineFunction("subWorldMatDirty", _SE(js_renderer_NodeProxy_subWorldMatDirty));
cls->defineFunction("disableVisit", _SE(js_renderer_NodeProxy_disableVisit));
cls->defineFunction("setCullingMask", _SE(js_renderer_NodeProxy_setCullingMask));
cls->defineFunction("addWorldMatDirty", _SE(js_renderer_NodeProxy_addWorldMatDirty));
cls->defineFunction("disaleUpdateWorldMatrix", _SE(js_renderer_NodeProxy_disaleUpdateWorldMatrix));
cls->defineFunction("getAssembler", _SE(js_renderer_NodeProxy_getAssembler));
cls->defineFunction("getChildByName", _SE(js_renderer_NodeProxy_getChildByName));
@@ -2111,6 +2099,7 @@ bool js_register_renderer_NodeProxy(se::Object* obj)
cls->defineFunction("setOpacity", _SE(js_renderer_NodeProxy_setOpacity));
cls->defineFunction("destroyImmediately", _SE(js_renderer_NodeProxy_destroyImmediately));
cls->defineFunction("getRealOpacity", _SE(js_renderer_NodeProxy_getRealOpacity));
cls->defineFunction("getDirty", _SE(js_renderer_NodeProxy_getDirty));
cls->defineFunction("getOpacity", _SE(js_renderer_NodeProxy_getOpacity));
cls->defineFunction("enableVisit", _SE(js_renderer_NodeProxy_enableVisit));
cls->defineFunction("enableUpdateWorldMatrix", _SE(js_renderer_NodeProxy_enableUpdateWorldMatrix));
@@ -73,13 +73,13 @@ bool register_all_renderer(se::Object* obj);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_reset);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_enable);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_handle);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_getDirtyFlag);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_postHandle);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_getUseModel);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_setUseModel);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_enabled);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_disable);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_notifyDirty);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_getDirty);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_setDirty);
SE_DECLARE_FUNC(js_renderer_AssemblerBase_AssemblerBase);
extern se::Object* __jsb_cocos2d_renderer_NodeProxy_proto;
@@ -87,14 +87,12 @@ extern se::Class* __jsb_cocos2d_renderer_NodeProxy_class;
bool js_register_cocos2d_renderer_NodeProxy(se::Object* obj);
bool register_all_renderer(se::Object* obj);
SE_DECLARE_FUNC(js_renderer_NodeProxy_visitWithoutTransform);
SE_DECLARE_FUNC(js_renderer_NodeProxy_render);
SE_DECLARE_FUNC(js_renderer_NodeProxy_updateLocalMatrix);
SE_DECLARE_FUNC(js_renderer_NodeProxy_updateWorldMatrix);
SE_DECLARE_FUNC(js_renderer_NodeProxy_getChildren);
SE_DECLARE_FUNC(js_renderer_NodeProxy_subWorldMatDirty);
SE_DECLARE_FUNC(js_renderer_NodeProxy_disableVisit);
SE_DECLARE_FUNC(js_renderer_NodeProxy_setCullingMask);
SE_DECLARE_FUNC(js_renderer_NodeProxy_addWorldMatDirty);
SE_DECLARE_FUNC(js_renderer_NodeProxy_disaleUpdateWorldMatrix);
SE_DECLARE_FUNC(js_renderer_NodeProxy_getAssembler);
SE_DECLARE_FUNC(js_renderer_NodeProxy_getChildByName);
@@ -103,6 +101,7 @@ SE_DECLARE_FUNC(js_renderer_NodeProxy_visit);
SE_DECLARE_FUNC(js_renderer_NodeProxy_setOpacity);
SE_DECLARE_FUNC(js_renderer_NodeProxy_destroyImmediately);
SE_DECLARE_FUNC(js_renderer_NodeProxy_getRealOpacity);
SE_DECLARE_FUNC(js_renderer_NodeProxy_getDirty);
SE_DECLARE_FUNC(js_renderer_NodeProxy_getOpacity);
SE_DECLARE_FUNC(js_renderer_NodeProxy_enableVisit);
SE_DECLARE_FUNC(js_renderer_NodeProxy_enableUpdateWorldMatrix);