mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Merge remote-tracking branch 'youyou/v2.3.0' into v2.3.0-youyou-effect
# Conflicts: # cocos/scripting/js-bindings/auto/jsb_renderer_auto.cpp
This commit is contained in:
@@ -567,6 +567,14 @@
|
||||
04DBD4D422AE2DBD00DBE4CD /* RTTI.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DBD3B922AE2DBC00DBE4CD /* RTTI.h */; };
|
||||
04DBD4D522AE2DBD00DBE4CD /* IkConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DBD3BA22AE2DBC00DBE4CD /* IkConstraint.h */; };
|
||||
04DBD4D622AE2DBD00DBE4CD /* IkConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DBD3BA22AE2DBC00DBE4CD /* IkConstraint.h */; };
|
||||
04DBD4DB22B51EA300DBE4CD /* MemPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04DBD4D922B51EA300DBE4CD /* MemPool.cpp */; };
|
||||
04DBD4DC22B51EA300DBE4CD /* MemPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04DBD4D922B51EA300DBE4CD /* MemPool.cpp */; };
|
||||
04DBD4DD22B51EA300DBE4CD /* MemPool.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 04DBD4DA22B51EA300DBE4CD /* MemPool.hpp */; };
|
||||
04DBD4DE22B51EA300DBE4CD /* MemPool.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 04DBD4DA22B51EA300DBE4CD /* MemPool.hpp */; };
|
||||
04DBD4E122B51EB300DBE4CD /* NodeMemPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04DBD4DF22B51EB300DBE4CD /* NodeMemPool.cpp */; };
|
||||
04DBD4E222B51EB300DBE4CD /* NodeMemPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04DBD4DF22B51EB300DBE4CD /* NodeMemPool.cpp */; };
|
||||
04DBD4E322B51EB300DBE4CD /* NodeMemPool.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 04DBD4E022B51EB300DBE4CD /* NodeMemPool.hpp */; };
|
||||
04DBD4E422B51EB300DBE4CD /* NodeMemPool.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 04DBD4E022B51EB300DBE4CD /* NodeMemPool.hpp */; };
|
||||
04ED68D821F8188F006E82F8 /* MeshBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04ED68D621F8188F006E82F8 /* MeshBuffer.cpp */; };
|
||||
04ED68D921F8188F006E82F8 /* MeshBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04ED68D621F8188F006E82F8 /* MeshBuffer.cpp */; };
|
||||
04ED68DA21F8188F006E82F8 /* MeshBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 04ED68D721F8188F006E82F8 /* MeshBuffer.h */; };
|
||||
@@ -1647,6 +1655,10 @@
|
||||
04DBD3B822AE2DBC00DBE4CD /* LinkedMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LinkedMesh.h; path = "../cocos/editor-support/spine/LinkedMesh.h"; sourceTree = "<group>"; };
|
||||
04DBD3B922AE2DBC00DBE4CD /* RTTI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RTTI.h; path = "../cocos/editor-support/spine/RTTI.h"; sourceTree = "<group>"; };
|
||||
04DBD3BA22AE2DBC00DBE4CD /* IkConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IkConstraint.h; path = "../cocos/editor-support/spine/IkConstraint.h"; sourceTree = "<group>"; };
|
||||
04DBD4D922B51EA300DBE4CD /* MemPool.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MemPool.cpp; sourceTree = "<group>"; };
|
||||
04DBD4DA22B51EA300DBE4CD /* MemPool.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MemPool.hpp; sourceTree = "<group>"; };
|
||||
04DBD4DF22B51EB300DBE4CD /* NodeMemPool.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NodeMemPool.cpp; sourceTree = "<group>"; };
|
||||
04DBD4E022B51EB300DBE4CD /* NodeMemPool.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = NodeMemPool.hpp; sourceTree = "<group>"; };
|
||||
04ED68D621F8188F006E82F8 /* MeshBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = MeshBuffer.cpp; path = "../cocos/editor-support/MeshBuffer.cpp"; sourceTree = "<group>"; };
|
||||
04ED68D721F8188F006E82F8 /* MeshBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MeshBuffer.h; path = "../cocos/editor-support/MeshBuffer.h"; sourceTree = "<group>"; };
|
||||
04F8563222ABCB9900063A20 /* TiledMapAssembler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TiledMapAssembler.cpp; sourceTree = "<group>"; };
|
||||
@@ -2543,6 +2555,10 @@
|
||||
0482F186228D87910019ECF7 /* scene-bindings.h */,
|
||||
0482F193228D87950019ECF7 /* StencilManager.cpp */,
|
||||
0482F18C228D87930019ECF7 /* StencilManager.hpp */,
|
||||
04DBD4D922B51EA300DBE4CD /* MemPool.cpp */,
|
||||
04DBD4DA22B51EA300DBE4CD /* MemPool.hpp */,
|
||||
04DBD4DF22B51EB300DBE4CD /* NodeMemPool.cpp */,
|
||||
04DBD4E022B51EB300DBE4CD /* NodeMemPool.hpp */,
|
||||
);
|
||||
path = scene;
|
||||
sourceTree = "<group>";
|
||||
@@ -3594,6 +3610,7 @@
|
||||
469303922046AE05004A3D6C /* SeApi.h in Headers */,
|
||||
461786532052301A008256E1 /* CCScheduler.h in Headers */,
|
||||
46FDDB4D202ADDCE00931238 /* pvr.h in Headers */,
|
||||
04DBD4DD22B51EA300DBE4CD /* MemPool.hpp in Headers */,
|
||||
4617863920522469008256E1 /* CCDownloaderImpl-apple.h in Headers */,
|
||||
0482F19D228D87970019ECF7 /* scene-bindings.h in Headers */,
|
||||
1A52DB73205BCDC700350EE3 /* Base.h in Headers */,
|
||||
@@ -3850,6 +3867,7 @@
|
||||
1A28FF7D1F20AFAB007A1D9D /* SRMutex.h in Headers */,
|
||||
04DBD4B922AE2DBD00DBE4CD /* Skeleton.h in Headers */,
|
||||
1A28FF711F20AFAB007A1D9D /* SRHash.h in Headers */,
|
||||
04DBD4E322B51EB300DBE4CD /* NodeMemPool.hpp in Headers */,
|
||||
469301CF203FC696004A3D6C /* CCConfiguration.h in Headers */,
|
||||
1A14FD932080B4E300E10ABE /* CCGLUtils.h in Headers */,
|
||||
50ABC0171926664800A911A9 /* CCImage.h in Headers */,
|
||||
@@ -4110,7 +4128,9 @@
|
||||
04DBD47C22AE2DBD00DBE4CD /* AnimationState.h in Headers */,
|
||||
469303AD2046AE05004A3D6C /* Utils.hpp in Headers */,
|
||||
04DBD4D222AE2DBD00DBE4CD /* LinkedMesh.h in Headers */,
|
||||
04DBD4DE22B51EA300DBE4CD /* MemPool.hpp in Headers */,
|
||||
046E06FA2189990700B24E2D /* middleware-adapter.h in Headers */,
|
||||
04DBD4E422B51EB300DBE4CD /* NodeMemPool.hpp in Headers */,
|
||||
1A28FF4E1F20AFAB007A1D9D /* SRDelegateController.h in Headers */,
|
||||
469301D0203FC696004A3D6C /* CCConfiguration.h in Headers */,
|
||||
04DBD45A22AE2DBD00DBE4CD /* PointAttachment.h in Headers */,
|
||||
@@ -4362,6 +4382,7 @@
|
||||
046E06882185B44A00B24E2D /* BaseFactory.cpp in Sources */,
|
||||
1A52DB30205BCD9200350EE3 /* ScriptEngine.cpp in Sources */,
|
||||
0482F1A1228D87970019ECF7 /* NodeProxy.cpp in Sources */,
|
||||
04DBD4E122B51EB300DBE4CD /* NodeMemPool.cpp in Sources */,
|
||||
1A52DB62205BCDC700350EE3 /* ScriptEngine.cpp in Sources */,
|
||||
04DBD44722AE2DBD00DBE4CD /* Skeleton.cpp in Sources */,
|
||||
4DC57D211F7A58B5005B6546 /* xxtea.cpp in Sources */,
|
||||
@@ -4469,6 +4490,7 @@
|
||||
046E06BB2185B49F00B24E2D /* TextureAtlasData.cpp in Sources */,
|
||||
1A28FF831F20AFAB007A1D9D /* SRRandom.m in Sources */,
|
||||
46FDDAC5202ACC6A00931238 /* RenderTarget.cpp in Sources */,
|
||||
04DBD4DB22B51EA300DBE4CD /* MemPool.cpp in Sources */,
|
||||
1A52DB6D205BCDC700350EE3 /* ScriptEngine.cpp in Sources */,
|
||||
04DBD44522AE2DBD00DBE4CD /* AnimationState.cpp in Sources */,
|
||||
50ABBD3C1925AB0000A911A9 /* CCGeometry.cpp in Sources */,
|
||||
@@ -4659,6 +4681,7 @@
|
||||
40AEF7C2216DF22900729AA5 /* jsb_video_auto.cpp in Sources */,
|
||||
ED30578A1BEC77460083C3ED /* tinyxml2.cpp in Sources */,
|
||||
04DBD4C222AE2DBD00DBE4CD /* Updatable.cpp in Sources */,
|
||||
04DBD4E222B51EB300DBE4CD /* NodeMemPool.cpp in Sources */,
|
||||
1A29D76A205665BE00168D9A /* jsb_cocos2dx_auto.cpp in Sources */,
|
||||
46FDDBFC202ADDCE00931238 /* ccCArray.cpp in Sources */,
|
||||
04DBD45422AE2DBD00DBE4CD /* TransformConstraintTimeline.cpp in Sources */,
|
||||
@@ -4755,6 +4778,7 @@
|
||||
04DBD4CE22AE2DBD00DBE4CD /* ClippingAttachment.cpp in Sources */,
|
||||
40CEAEB620CFDC28007A3281 /* CCReachability.cpp in Sources */,
|
||||
046E06BA2185B49F00B24E2D /* ConstraintData.cpp in Sources */,
|
||||
04DBD4DC22B51EA300DBE4CD /* MemPool.cpp in Sources */,
|
||||
046E06832185B43B00B24E2D /* EventObject.cpp in Sources */,
|
||||
46FDDA8C202ACC6A00931238 /* ForwardRenderer.cpp in Sources */,
|
||||
04DBD41C22AE2DBD00DBE4CD /* SlotData.cpp in Sources */,
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
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 "MemPool.hpp"
|
||||
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
|
||||
#include "base/ccMacros.h"
|
||||
|
||||
RENDERER_BEGIN
|
||||
|
||||
UnitBase::UnitBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UnitBase::~UnitBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UnitBase::set(se::Object** dataObj, uint8_t** data, std::size_t* dataLen, se::Object* jsData)
|
||||
{
|
||||
if (*dataObj == jsData) return;
|
||||
|
||||
if (*dataObj)
|
||||
{
|
||||
(*dataObj)->unroot();
|
||||
(*dataObj)->decRef();
|
||||
*dataObj = nullptr;
|
||||
}
|
||||
|
||||
if (jsData == nullptr) return;
|
||||
|
||||
*dataObj = jsData;
|
||||
(*dataObj)->root();
|
||||
(*dataObj)->incRef();
|
||||
*data = nullptr;
|
||||
*dataLen = 0;
|
||||
(*dataObj)->getTypedArrayData(data, dataLen);
|
||||
}
|
||||
|
||||
void UnitBase::unset(se::Object** dataObj, uint8_t** data, std::size_t* dataLen)
|
||||
{
|
||||
if (*dataObj)
|
||||
{
|
||||
(*dataObj)->unroot();
|
||||
(*dataObj)->decRef();
|
||||
*dataObj = nullptr;
|
||||
}
|
||||
|
||||
*data = nullptr;
|
||||
*dataLen = 0;
|
||||
}
|
||||
|
||||
UnitCommon::UnitCommon()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UnitCommon::~UnitCommon()
|
||||
{
|
||||
unset(&dataObj, (uint8_t**)&data, &dataLen);
|
||||
unset(&signDataObj, (uint8_t**)&signData, &signDataLen);
|
||||
}
|
||||
|
||||
void UnitCommon::setData(se::Object* jsData)
|
||||
{
|
||||
set(&dataObj, (uint8_t**)&data, &dataLen, jsData);
|
||||
}
|
||||
|
||||
void UnitCommon::setSignData(se::Object* jsSignData)
|
||||
{
|
||||
set(&signDataObj, (uint8_t**)&signData, &signDataLen, jsSignData);
|
||||
}
|
||||
|
||||
MemPool::MemPool()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MemPool::~MemPool()
|
||||
{
|
||||
for(auto it = _commonPool.begin(); it != _commonPool.end(); it++)
|
||||
{
|
||||
delete (*it);
|
||||
}
|
||||
_commonPool.clear();
|
||||
}
|
||||
|
||||
void MemPool::updateCommonData(std::size_t unitID, se_object_ptr dataObj, se_object_ptr signDataObj)
|
||||
{
|
||||
CCASSERT(unitID <= _commonPool.size(), "MemPool updateData unitID can not be rather than pool size");
|
||||
|
||||
UnitCommon* unit = nullptr;
|
||||
if (unitID == _commonPool.size())
|
||||
{
|
||||
unit = new UnitCommon;
|
||||
_commonPool.push_back(unit);
|
||||
}
|
||||
else if (unitID < _commonPool.size())
|
||||
{
|
||||
unit = _commonPool[unitID];
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unit->setData(dataObj);
|
||||
unit->setSignData(signDataObj);
|
||||
}
|
||||
|
||||
const std::vector<UnitCommon*>& MemPool::getCommonPool() const
|
||||
{
|
||||
return _commonPool;
|
||||
}
|
||||
|
||||
UnitCommon& MemPool::getCommonUnit(std::size_t unitID)
|
||||
{
|
||||
CCASSERT(unitID < _commonPool.size(), "MemPool getCommonUnit unitID can not be rather than pool size");
|
||||
return *_commonPool[unitID];
|
||||
}
|
||||
|
||||
RENDERER_END
|
||||
@@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../Macro.h"
|
||||
#include <vector>
|
||||
#include "scripting/js-bindings/jswrapper/Object.hpp"
|
||||
|
||||
RENDERER_BEGIN
|
||||
|
||||
class UnitBase
|
||||
{
|
||||
public:
|
||||
UnitBase();
|
||||
virtual ~UnitBase();
|
||||
|
||||
void set(se::Object** dataObj, uint8_t** data, std::size_t* dataLen, se::Object* jsData);
|
||||
void unset(se::Object** dataObj, uint8_t** data, std::size_t* dataLen);
|
||||
};
|
||||
|
||||
struct Sign
|
||||
{
|
||||
uint16_t nextFreeIndex;
|
||||
uint16_t freeFlag;
|
||||
};
|
||||
|
||||
class UnitCommon: public UnitBase
|
||||
{
|
||||
public:
|
||||
UnitCommon();
|
||||
virtual ~UnitCommon();
|
||||
|
||||
void setData(se::Object* jsData);
|
||||
void setSignData(se::Object* jsSignData);
|
||||
|
||||
uint16_t getUsingNum()
|
||||
{
|
||||
return data[1];
|
||||
}
|
||||
|
||||
Sign* getSignData(std::size_t index)
|
||||
{
|
||||
return (Sign*)signData + index;
|
||||
}
|
||||
|
||||
std::size_t getContentNum()
|
||||
{
|
||||
return signDataLen / (sizeof(uint16_t) * 2);
|
||||
}
|
||||
protected:
|
||||
se::Object* dataObj = nullptr;
|
||||
uint16_t* data = nullptr;
|
||||
std::size_t dataLen = 0;
|
||||
|
||||
se::Object* signDataObj = nullptr;
|
||||
uint16_t* signData = nullptr;
|
||||
std::size_t signDataLen = 0;
|
||||
};
|
||||
|
||||
class MemPool {
|
||||
public:
|
||||
MemPool();
|
||||
virtual ~MemPool();
|
||||
|
||||
void updateCommonData(std::size_t unitID, se_object_ptr dataObj, se_object_ptr signDataObj);
|
||||
UnitCommon& getCommonUnit(std::size_t unitID);
|
||||
const std::vector<UnitCommon*>& getCommonPool() const;
|
||||
private:
|
||||
std::vector<UnitCommon*> _commonPool;
|
||||
};
|
||||
|
||||
RENDERER_END
|
||||
@@ -125,6 +125,8 @@ void ModelBatcher::commit(NodeProxy* node, Assembler* assembler)
|
||||
|
||||
for (std::size_t i = 0, l = assembler->getIACount(); i < l; ++i)
|
||||
{
|
||||
assembler->beforeFillBuffers(i);
|
||||
|
||||
Effect* effect = assembler->getEffect((uint32_t)i);
|
||||
if (!effect) continue;
|
||||
int cullingMask = node->getCullingMask();
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
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 "NodeMemPool.hpp"
|
||||
#include "base/ccMacros.h"
|
||||
|
||||
RENDERER_BEGIN
|
||||
|
||||
UnitNode::UnitNode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UnitNode::~UnitNode()
|
||||
{
|
||||
unset(&dirty, (uint8_t**)&dirtyData, &dirtyLen);
|
||||
unset(&trs, (uint8_t**)&trsData, &trsLen);
|
||||
unset(&localMat, (uint8_t**)&localMatData, &localMatLen);
|
||||
unset(&worldMat, (uint8_t**)&worldMatData, &worldMatLen);
|
||||
unset(&parent, (uint8_t**)&parentData, &parentLen);
|
||||
unset(&zOrder, (uint8_t**)&zOrderData, &zOrderLen);
|
||||
unset(&cullingMask, (uint8_t**)&cullingMaskData, &cullingMaskLen);
|
||||
unset(&opacity, (uint8_t**)&opacityData, &opacityLen);
|
||||
unset(&is3D, (uint8_t**)&is3DData, &is3DLen);
|
||||
unset(&node, (uint8_t**)&nodeData, &nodeLen);
|
||||
}
|
||||
|
||||
void UnitNode::setDirty(se::Object* jsData)
|
||||
{
|
||||
set(&dirty, (uint8_t**)&dirtyData, &dirtyLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setTRS(se::Object* jsData)
|
||||
{
|
||||
set(&trs, (uint8_t**)&trsData, &trsLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setLocalMat(se::Object* jsData)
|
||||
{
|
||||
set(&localMat, (uint8_t**)&localMatData, &localMatLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setWorldMat(se::Object* jsData)
|
||||
{
|
||||
set(&worldMat, (uint8_t**)&worldMatData, &worldMatLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setParent(se::Object* jsData)
|
||||
{
|
||||
set(&parent, (uint8_t**)&parentData, &parentLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setZOrder(se::Object* jsData)
|
||||
{
|
||||
set(&zOrder, (uint8_t**)&zOrderData, &zOrderLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setCullingMask(se::Object* jsData)
|
||||
{
|
||||
set(&cullingMask, (uint8_t**)&cullingMaskData, &cullingMaskLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setOpacity(se::Object* jsData)
|
||||
{
|
||||
set(&opacity, (uint8_t**)&opacityData, &opacityLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setIs3D(se::Object* jsData)
|
||||
{
|
||||
set(&is3D, (uint8_t**)&is3DData, &is3DLen, jsData);
|
||||
}
|
||||
|
||||
void UnitNode::setNode(se::Object *jsData)
|
||||
{
|
||||
set(&node, (uint8_t**)&nodeData, &nodeLen, jsData);
|
||||
}
|
||||
|
||||
NodeMemPool* NodeMemPool::_instance = nullptr;
|
||||
|
||||
const std::vector<UnitNode*>& NodeMemPool::getNodePool() const
|
||||
{
|
||||
return _nodePool;
|
||||
}
|
||||
|
||||
UnitNode& NodeMemPool::getUnit(std::size_t unitID) const
|
||||
{
|
||||
CCASSERT(unitID < _nodePool.size(), "NodeMemPool getUnit unitID can not be rather than pool size");
|
||||
return *_nodePool[unitID];
|
||||
}
|
||||
|
||||
void NodeMemPool::updateNodeData(std::size_t unitID, se_object_ptr dirty, se_object_ptr trs, se_object_ptr localMat, se_object_ptr worldMat, se_object_ptr parent, se_object_ptr zOrder, se_object_ptr cullingMask, se_object_ptr opacity, se_object_ptr is3D, se_object_ptr node)
|
||||
{
|
||||
// UnitID may equal to node pool size, then node pool must increase size.
|
||||
CCASSERT(unitID <= _nodePool.size(), "NodeMemPool updateNodeData unitID can not be rather than pool size");
|
||||
|
||||
UnitNode* unit = nullptr;
|
||||
if (unitID == _nodePool.size())
|
||||
{
|
||||
unit = new UnitNode;
|
||||
_nodePool.push_back(unit);
|
||||
}
|
||||
else if (unitID < _nodePool.size())
|
||||
{
|
||||
unit = _nodePool[unitID];
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unit->setDirty(dirty);
|
||||
unit->setTRS(trs);
|
||||
unit->setLocalMat(localMat);
|
||||
unit->setWorldMat(worldMat);
|
||||
unit->setParent(parent);
|
||||
unit->setZOrder(zOrder);
|
||||
unit->setCullingMask(cullingMask);
|
||||
unit->setOpacity(opacity);
|
||||
unit->setIs3D(is3D);
|
||||
unit->setNode(node);
|
||||
}
|
||||
|
||||
RENDERER_END
|
||||
@@ -0,0 +1,185 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MemPool.hpp"
|
||||
#include "math/Mat4.h"
|
||||
|
||||
RENDERER_BEGIN
|
||||
|
||||
class NodeProxy;
|
||||
|
||||
struct TRS {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float qx;
|
||||
float qy;
|
||||
float qz;
|
||||
float qw;
|
||||
float sx;
|
||||
float sy;
|
||||
float sz;
|
||||
};
|
||||
|
||||
struct ParentInfo {
|
||||
uint32_t unitID;
|
||||
uint32_t index;
|
||||
};
|
||||
|
||||
class UnitNode: public UnitBase {
|
||||
public:
|
||||
UnitNode();
|
||||
virtual ~UnitNode();
|
||||
void setDirty(se::Object* jsData);
|
||||
void setTRS(se::Object* jsData);
|
||||
void setLocalMat(se::Object* jsData);
|
||||
void setWorldMat(se::Object* jsData);
|
||||
void setParent(se::Object* jsData);
|
||||
void setZOrder(se::Object* jsData);
|
||||
void setCullingMask(se::Object* jsData);
|
||||
void setOpacity(se::Object* jsData);
|
||||
void setIs3D(se::Object* jsData);
|
||||
void setNode(se::Object* jsData);
|
||||
void setLevel(se::Object* jsData);
|
||||
|
||||
uint32_t* getDirty(std::size_t index)
|
||||
{
|
||||
return dirtyData + index;
|
||||
}
|
||||
|
||||
TRS* getTRS(std::size_t index)
|
||||
{
|
||||
return (TRS*)trsData + index;
|
||||
}
|
||||
|
||||
cocos2d::Mat4* getLocalMat(std::size_t index)
|
||||
{
|
||||
return (cocos2d::Mat4*)localMatData + index;
|
||||
}
|
||||
|
||||
cocos2d::Mat4* getWorldMat(std::size_t index)
|
||||
{
|
||||
return (cocos2d::Mat4*)worldMatData + index;
|
||||
}
|
||||
|
||||
ParentInfo* getParent(std::size_t index)
|
||||
{
|
||||
return (ParentInfo*)parentData + index;
|
||||
}
|
||||
|
||||
uint32_t* getZOrder(std::size_t index)
|
||||
{
|
||||
return zOrderData + index;
|
||||
}
|
||||
|
||||
int32_t* getCullingMask(std::size_t index)
|
||||
{
|
||||
return cullingMaskData + index;
|
||||
}
|
||||
|
||||
uint8_t* getOpacity(std::size_t index)
|
||||
{
|
||||
return opacityData + index;
|
||||
}
|
||||
|
||||
uint8_t* getIs3D(std::size_t index)
|
||||
{
|
||||
return is3DData + index;
|
||||
}
|
||||
|
||||
uint64_t* getNode(std::size_t index)
|
||||
{
|
||||
return nodeData + index;
|
||||
}
|
||||
protected:
|
||||
se::Object* dirty = nullptr;
|
||||
uint32_t* dirtyData = nullptr;
|
||||
std::size_t dirtyLen = 0;
|
||||
|
||||
se::Object* trs = nullptr;
|
||||
float_t* trsData = nullptr;
|
||||
std::size_t trsLen = 0;
|
||||
|
||||
se::Object* localMat = nullptr;
|
||||
float_t* localMatData = nullptr;
|
||||
std::size_t localMatLen = 0;
|
||||
|
||||
se::Object* worldMat = nullptr;
|
||||
float_t* worldMatData = nullptr;
|
||||
std::size_t worldMatLen = 0;
|
||||
|
||||
se::Object* parent = nullptr;
|
||||
uint32_t* parentData = nullptr;
|
||||
std::size_t parentLen = 0;
|
||||
|
||||
se::Object* zOrder = nullptr;
|
||||
uint32_t* zOrderData = nullptr;
|
||||
std::size_t zOrderLen = 0;
|
||||
|
||||
se::Object* cullingMask = nullptr;
|
||||
int32_t* cullingMaskData = nullptr;
|
||||
std::size_t cullingMaskLen = 0;
|
||||
|
||||
se::Object* opacity = nullptr;
|
||||
uint8_t* opacityData = nullptr;
|
||||
std::size_t opacityLen = 0;
|
||||
|
||||
se::Object* is3D = nullptr;
|
||||
uint8_t* is3DData = nullptr;
|
||||
std::size_t is3DLen = 0;
|
||||
|
||||
se::Object* node = nullptr;
|
||||
uint64_t* nodeData = nullptr;
|
||||
std::size_t nodeLen = 0;
|
||||
};
|
||||
|
||||
class NodeMemPool: public MemPool {
|
||||
public:
|
||||
NodeMemPool()
|
||||
{
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
virtual ~NodeMemPool()
|
||||
{
|
||||
_instance = nullptr;
|
||||
}
|
||||
|
||||
static NodeMemPool* getInstance()
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
|
||||
void updateNodeData(std::size_t unitID, se_object_ptr dirty, se_object_ptr trs, se_object_ptr localMat, se_object_ptr worldMat, se_object_ptr parent, se_object_ptr zOrder, se_object_ptr cullingMask, se_object_ptr opacity, se_object_ptr is3D, se_object_ptr node);
|
||||
|
||||
UnitNode& getUnit(std::size_t unitID) const;
|
||||
const std::vector<UnitNode*>& getNodePool() const;
|
||||
private:
|
||||
static NodeMemPool* _instance;
|
||||
std::vector<UnitNode*> _nodePool;
|
||||
};
|
||||
|
||||
RENDERER_END
|
||||
@@ -32,52 +32,66 @@
|
||||
#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 "NodeMemPool.hpp"
|
||||
#include <math.h>
|
||||
#include "RenderFlow.hpp"
|
||||
|
||||
RENDERER_BEGIN
|
||||
|
||||
int NodeProxy::_parentOpacityDirty = 0;
|
||||
int NodeProxy::_worldMatDirty = 0;
|
||||
|
||||
NodeProxy::NodeProxy()
|
||||
: _jsTRS(nullptr)
|
||||
, _jsTRSData(nullptr)
|
||||
, _parent(nullptr)
|
||||
NodeProxy::NodeProxy(std::size_t unitID, std::size_t index, std::string id)
|
||||
{
|
||||
_localMat = Mat4::IDENTITY;
|
||||
_worldMat = Mat4::IDENTITY;
|
||||
_id = id;
|
||||
_unitID = unitID;
|
||||
_index = index;
|
||||
|
||||
NodeMemPool* pool = NodeMemPool::getInstance();
|
||||
CCASSERT(pool, "NodeProxy constructor NodeMemPool is null");
|
||||
UnitNode& unit = pool->getUnit(unitID);
|
||||
|
||||
_dirty = unit.getDirty(index);
|
||||
_trs = unit.getTRS(index);
|
||||
_localMat = unit.getLocalMat(index);
|
||||
_worldMat = unit.getWorldMat(index);
|
||||
_parentInfo = unit.getParent(index);
|
||||
_parentInfo->unitID = 0xffffffff;
|
||||
_parentInfo->index = 0xffffffff;
|
||||
_localZOrder = unit.getZOrder(index);
|
||||
_cullingMask = unit.getCullingMask(index);
|
||||
_opacity = unit.getOpacity(index);
|
||||
_is3DNode = unit.getOpacity(index);
|
||||
|
||||
uint64_t* self = unit.getNode(index);
|
||||
*self = (uint64_t)this;
|
||||
}
|
||||
|
||||
NodeProxy::~NodeProxy()
|
||||
{
|
||||
CCLOGINFO( "deallocing NodeProxy: %p", this );
|
||||
|
||||
for (auto& child : _children)
|
||||
{
|
||||
child->_parent = nullptr;
|
||||
}
|
||||
|
||||
if (_jsTRS != nullptr)
|
||||
{
|
||||
_jsTRS->unroot();
|
||||
_jsTRS->decRef();
|
||||
_jsTRS = nullptr;
|
||||
}
|
||||
_jsTRSData = nullptr;
|
||||
}
|
||||
|
||||
void NodeProxy::reset()
|
||||
void NodeProxy::destroyImmediately()
|
||||
{
|
||||
if (_parent)
|
||||
{
|
||||
_parent->removeChild(this);
|
||||
}
|
||||
removeAllChildren();
|
||||
_localZOrder = 0;
|
||||
_childrenOrderDirty = false;
|
||||
_cullingMask = -1;
|
||||
_localMat.setIdentity();
|
||||
_worldMat.setIdentity();
|
||||
RenderFlow::getInstance()->removeNodeLevel(_level, _worldMat);
|
||||
_level = 0xffffffff;
|
||||
_dirty = nullptr;
|
||||
_trs = nullptr;
|
||||
_localMat = nullptr;
|
||||
_worldMat = nullptr;
|
||||
_parentInfo = nullptr;
|
||||
_localZOrder = nullptr;
|
||||
_cullingMask = nullptr;
|
||||
_opacity = nullptr;
|
||||
_is3DNode = nullptr;
|
||||
}
|
||||
|
||||
// lazy allocs
|
||||
@@ -121,7 +135,7 @@ void NodeProxy::addChild(NodeProxy* child)
|
||||
this->childrenAlloc();
|
||||
}
|
||||
_children.pushBack(child);
|
||||
_childrenOrderDirty = true;
|
||||
*_dirty |= RenderFlow::REORDER_CHILDREN;
|
||||
child->setParent(this);
|
||||
child->updateRealOpacity();
|
||||
}
|
||||
@@ -162,7 +176,6 @@ NodeProxy* NodeProxy::getChildByName(std::string childName)
|
||||
{
|
||||
for (auto child : _children)
|
||||
{
|
||||
// set parent nil at the end
|
||||
if (child->_name == childName)
|
||||
{
|
||||
return child;
|
||||
@@ -171,29 +184,101 @@ NodeProxy* NodeProxy::getChildByName(std::string childName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NodeProxy* NodeProxy::getChildByID(std::string id)
|
||||
{
|
||||
for (auto child : _children)
|
||||
{
|
||||
if (child->_id == id)
|
||||
{
|
||||
return child;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void NodeProxy::notifyUpdateParent()
|
||||
{
|
||||
if (_parentInfo->index == 0xffffffff)
|
||||
{
|
||||
if (_parent)
|
||||
{
|
||||
_parent->removeChild(this);
|
||||
}
|
||||
updateLevel();
|
||||
return;
|
||||
}
|
||||
|
||||
NodeMemPool* pool = NodeMemPool::getInstance();
|
||||
CCASSERT(pool, "NodeProxy updateParent NodeMemPool is null");
|
||||
UnitNode& unit = pool->getUnit(_parentInfo->unitID);
|
||||
uint64_t* parentAddrs = unit.getNode(_parentInfo->index);
|
||||
NodeProxy* parent = (NodeProxy*)*parentAddrs;
|
||||
CCASSERT(parent, "NodeProxy updateParent parent is null");
|
||||
|
||||
if (parent != _parent) {
|
||||
if (_parent)
|
||||
{
|
||||
_parent->removeChild(this);
|
||||
}
|
||||
parent->addChild(this);
|
||||
updateLevel();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeProxy::updateLevel()
|
||||
{
|
||||
auto renderFlow = RenderFlow::getInstance();
|
||||
static RenderFlow::LevelInfo levelInfo;
|
||||
|
||||
renderFlow->removeNodeLevel(_level, _worldMat);
|
||||
|
||||
levelInfo.dirty = _dirty;
|
||||
levelInfo.localMat = _localMat;
|
||||
levelInfo.worldMat = _worldMat;
|
||||
|
||||
if (_parent)
|
||||
{
|
||||
_level = _parent->_level + 1;
|
||||
levelInfo.parentWorldMat = _parent->_worldMat;
|
||||
levelInfo.parentDirty = _parent->_dirty;
|
||||
}
|
||||
else
|
||||
{
|
||||
_level = 0;
|
||||
levelInfo.parentWorldMat = nullptr;
|
||||
levelInfo.parentDirty = nullptr;
|
||||
}
|
||||
renderFlow->insertNodeLevel(_level, levelInfo);
|
||||
|
||||
for (auto it = _children.begin(); it != _children.end(); it++)
|
||||
{
|
||||
(*it)->updateLevel();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeProxy::setLocalZOrder(int zOrder)
|
||||
{
|
||||
_localZOrder = zOrder;
|
||||
*_localZOrder = zOrder;
|
||||
if (_parent != nullptr)
|
||||
{
|
||||
_parent->setChildrenOrderDirty();
|
||||
*_parent->_dirty |= RenderFlow::REORDER_CHILDREN;
|
||||
}
|
||||
}
|
||||
|
||||
void NodeProxy::reorderChildren()
|
||||
{
|
||||
if (_childrenOrderDirty)
|
||||
if (*_dirty & RenderFlow::REORDER_CHILDREN)
|
||||
{
|
||||
#if CC_64BITS
|
||||
std::sort(std::begin(_children), std::end(_children), [](NodeProxy* n1, NodeProxy* n2) {
|
||||
return (n1->_localZOrder < n2->_localZOrder);
|
||||
return (*n1->_localZOrder < *n2->_localZOrder);
|
||||
});
|
||||
#else
|
||||
std::stable_sort(std::begin(_children), std::end(_children), [](NodeProxy* n1, NodeProxy* n2) {
|
||||
return n1->_localZOrder < n2->_localZOrder;
|
||||
return *n1->_localZOrder < *n2->_localZOrder;
|
||||
});
|
||||
#endif
|
||||
_childrenOrderDirty = false;
|
||||
*_dirty &= ~RenderFlow::REORDER_CHILDREN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,167 +308,144 @@ AssemblerBase* NodeProxy::getAssembler(const std::string& assemblerName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void NodeProxy::updateJSTRS(se::Object* trs)
|
||||
{
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
se::AutoHandleScope hs;
|
||||
|
||||
if (_jsTRS != nullptr)
|
||||
{
|
||||
_jsTRS->unroot();
|
||||
_jsTRS->decRef();
|
||||
}
|
||||
|
||||
trs->root();
|
||||
trs->incRef();
|
||||
_jsTRS = trs;
|
||||
_jsTRSData = nullptr;
|
||||
size_t length;
|
||||
trs->getTypedArrayData((uint8_t**)(&_jsTRSData), &length);
|
||||
}
|
||||
|
||||
void NodeProxy::getPosition(cocos2d::Vec3* out) const
|
||||
{
|
||||
out->x = _jsTRSData[1];
|
||||
out->y = _jsTRSData[2];
|
||||
out->z = _jsTRSData[3];
|
||||
out->x = _trs->x;
|
||||
out->y = _trs->y;
|
||||
out->z = _trs->z;
|
||||
}
|
||||
|
||||
void NodeProxy::getRotation(cocos2d::Quaternion* out) const
|
||||
{
|
||||
out->x = _jsTRSData[4];
|
||||
out->y = _jsTRSData[5];
|
||||
out->z = _jsTRSData[6];
|
||||
out->w = _jsTRSData[7];
|
||||
out->x = _trs->qx;
|
||||
out->y = _trs->qy;
|
||||
out->z = _trs->qz;
|
||||
out->w = _trs->qw;
|
||||
}
|
||||
|
||||
void NodeProxy::getScale(cocos2d::Vec3* out) const
|
||||
{
|
||||
out->x = _jsTRSData[8];
|
||||
out->y = _jsTRSData[9];
|
||||
out->z = _jsTRSData[10];
|
||||
out->x = _trs->sx;
|
||||
out->y = _trs->sy;
|
||||
out->z = _trs->sz;
|
||||
}
|
||||
|
||||
void NodeProxy::getWorldPosition(cocos2d::Vec3* out) const
|
||||
{
|
||||
if (_jsTRSData != nullptr)
|
||||
getPosition(out);
|
||||
|
||||
cocos2d::Vec3 pos;
|
||||
cocos2d::Quaternion rot;
|
||||
cocos2d::Vec3 scale;
|
||||
NodeProxy* curr = _parent;
|
||||
while (curr != nullptr)
|
||||
{
|
||||
getPosition(out);
|
||||
curr->getPosition(&pos);
|
||||
curr->getRotation(&rot);
|
||||
curr->getScale(&scale);
|
||||
|
||||
cocos2d::Vec3 pos;
|
||||
cocos2d::Quaternion rot;
|
||||
cocos2d::Vec3 scale;
|
||||
NodeProxy* curr = _parent;
|
||||
while (curr != nullptr)
|
||||
{
|
||||
curr->getPosition(&pos);
|
||||
curr->getRotation(&rot);
|
||||
curr->getScale(&scale);
|
||||
|
||||
out->multiply(scale);
|
||||
out->transformQuat(rot);
|
||||
out->add(pos);
|
||||
curr = curr->getParent();
|
||||
}
|
||||
out->multiply(scale);
|
||||
out->transformQuat(rot);
|
||||
out->add(pos);
|
||||
curr = curr->getParent();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeProxy::getWorldRT(cocos2d::Mat4* out) const
|
||||
{
|
||||
if (_jsTRSData != nullptr)
|
||||
cocos2d::Vec3 opos(_trs->x, _trs->y, _trs->z);
|
||||
cocos2d::Quaternion orot(_trs->qx, _trs->qy, _trs->qz, _trs->qw);
|
||||
|
||||
cocos2d::Vec3 pos;
|
||||
cocos2d::Quaternion rot;
|
||||
cocos2d::Vec3 scale;
|
||||
NodeProxy* curr = _parent;
|
||||
while (curr != nullptr)
|
||||
{
|
||||
cocos2d::Vec3 opos(_jsTRSData[1], _jsTRSData[2], _jsTRSData[3]);
|
||||
cocos2d::Quaternion orot(_jsTRSData[4], _jsTRSData[5], _jsTRSData[6], _jsTRSData[7]);
|
||||
curr->getPosition(&pos);
|
||||
curr->getRotation(&rot);
|
||||
curr->getScale(&scale);
|
||||
|
||||
cocos2d::Vec3 pos;
|
||||
cocos2d::Quaternion rot;
|
||||
cocos2d::Vec3 scale;
|
||||
NodeProxy* curr = _parent;
|
||||
while (curr != nullptr)
|
||||
{
|
||||
curr->getPosition(&pos);
|
||||
curr->getRotation(&rot);
|
||||
curr->getScale(&scale);
|
||||
|
||||
opos.multiply(scale);
|
||||
opos.transformQuat(rot);
|
||||
opos.add(pos);
|
||||
orot.multiply(rot);
|
||||
curr = curr->getParent();
|
||||
}
|
||||
out->setIdentity();
|
||||
out->translate(opos);
|
||||
cocos2d::Mat4 quatMat;
|
||||
cocos2d::Mat4::createRotation(orot, &quatMat);
|
||||
out->multiply(quatMat);
|
||||
opos.multiply(scale);
|
||||
opos.transformQuat(rot);
|
||||
opos.add(pos);
|
||||
orot.multiply(rot);
|
||||
curr = curr->getParent();
|
||||
}
|
||||
out->setIdentity();
|
||||
out->translate(opos);
|
||||
cocos2d::Mat4 quatMat;
|
||||
cocos2d::Mat4::createRotation(orot, &quatMat);
|
||||
out->multiply(quatMat);
|
||||
}
|
||||
|
||||
void NodeProxy::setOpacity(uint8_t opacity)
|
||||
{
|
||||
if (_opacity != opacity)
|
||||
if (*_opacity != opacity)
|
||||
{
|
||||
_opacity = opacity;
|
||||
updateRealOpacity();
|
||||
*_opacity = opacity;
|
||||
*_dirty |= RenderFlow::OPACITY;
|
||||
}
|
||||
}
|
||||
|
||||
void NodeProxy::updateRealOpacity()
|
||||
{
|
||||
float parentOpacity = _parent ? _parent->getRealOpacity() / 255.0f : 1.0f;
|
||||
float opacity = (uint8_t)(_opacity * parentOpacity);
|
||||
_realOpacity = opacity;
|
||||
_opacityUpdated = true;
|
||||
|
||||
auto assembler = getAssembler("render");
|
||||
if (assembler)
|
||||
if (_parent && (_parentOpacityDirty > 0 || *_dirty & RenderFlow::OPACITY))
|
||||
{
|
||||
assembler->notifyDirty(AssemblerBase::OPACITY);
|
||||
float parentOpacity = _parent ? _parent->getRealOpacity() / 255.0f : 1.0f;
|
||||
float opacity = (uint8_t)(*_opacity * parentOpacity);
|
||||
_realOpacity = opacity;
|
||||
_opacityUpdated = true;
|
||||
*_dirty &= ~RenderFlow::OPACITY;
|
||||
|
||||
auto assembler = getAssembler("render");
|
||||
if (assembler)
|
||||
{
|
||||
assembler->notifyDirty(AssemblerBase::OPACITY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeProxy::updateMatrix()
|
||||
void NodeProxy::updateWorldMatrix()
|
||||
{
|
||||
if (_updateWorldMatrix && (_matrixUpdated || _worldMatDirty > 0))
|
||||
if (_updateWorldMatrix && (*_dirty & RenderFlow::WORLD_TRANSFORM || _worldMatDirty > 0))
|
||||
{
|
||||
// Update world matrix
|
||||
const cocos2d::Mat4& parentMat = _parent == nullptr ? cocos2d::Mat4::IDENTITY : _parent->getWorldMatrix();
|
||||
_worldMat.multiply(parentMat, _localMat, &_worldMat);
|
||||
_matrixUpdated = false;
|
||||
updateWorldMatrix(parentMat);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeProxy::updateMatrix(const cocos2d::Mat4& parentMatrix)
|
||||
void NodeProxy::updateWorldMatrix(const cocos2d::Mat4& parentMatrix)
|
||||
{
|
||||
_worldMat.multiply(parentMatrix, _localMat, &_worldMat);
|
||||
_matrixUpdated = false;
|
||||
_worldMat->multiply(parentMatrix, *_localMat, _worldMat);
|
||||
*_dirty &= ~RenderFlow::WORLD_TRANSFORM;
|
||||
_matrixUpdated = true;
|
||||
}
|
||||
|
||||
void NodeProxy::updateFromJS()
|
||||
void NodeProxy::updateLocalMatrix()
|
||||
{
|
||||
uint32_t flag = _jsTRSData[0];
|
||||
if (flag & _TRANSFORM)
|
||||
if (*_dirty & RenderFlow::LOCAL_TRANSFORM)
|
||||
{
|
||||
_localMat.setIdentity();
|
||||
_localMat->setIdentity();
|
||||
|
||||
// Transform = Translate * Rotation * Scale;
|
||||
cocos2d::Quaternion q(_jsTRSData[4], _jsTRSData[5], _jsTRSData[6], _jsTRSData[7]);
|
||||
if (_is3DNode)
|
||||
cocos2d::Quaternion q(_trs->qx, _trs->qy, _trs->qz, _trs->qw);
|
||||
if (*_is3DNode)
|
||||
{
|
||||
_localMat.translate(_jsTRSData[1], _jsTRSData[2], _jsTRSData[3]);
|
||||
_localMat.rotate(q);
|
||||
_localMat.scale(_jsTRSData[8], _jsTRSData[9], _jsTRSData[10]);
|
||||
_localMat->translate(_trs->x, _trs->y, _trs->z);
|
||||
_localMat->rotate(q);
|
||||
_localMat->scale(_trs->sx, _trs->sy, _trs->sz);
|
||||
}
|
||||
else
|
||||
{
|
||||
_localMat.translate(_jsTRSData[1], _jsTRSData[2], 0);
|
||||
_localMat.rotate(q);
|
||||
_localMat.scale(_jsTRSData[8], _jsTRSData[9], 1);
|
||||
_localMat->translate(_trs->x, _trs->y, 0);
|
||||
_localMat->rotate(q);
|
||||
_localMat->scale(_trs->sx, _trs->sy, 1);
|
||||
}
|
||||
|
||||
_jsTRSData[0] = 0;
|
||||
|
||||
_matrixUpdated = true;
|
||||
*_dirty &= ~RenderFlow::LOCAL_TRANSFORM;
|
||||
*_dirty |= RenderFlow::WORLD_TRANSFORM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,30 +459,16 @@ void NodeProxy::visitAsRoot(ModelBatcher* batcher, Scene* scene)
|
||||
void NodeProxy::visit(ModelBatcher* batcher, Scene* scene)
|
||||
{
|
||||
if (!_needVisit) return;
|
||||
|
||||
bool worldMatUpdated = false;
|
||||
bool parentOpacityUpdated = false;
|
||||
|
||||
if (_parent != nullptr && _parentOpacityDirty > 0)
|
||||
{
|
||||
updateRealOpacity();
|
||||
}
|
||||
updateRealOpacity();
|
||||
|
||||
if (_realOpacity == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
reorderChildren();
|
||||
|
||||
updateFromJS();
|
||||
|
||||
if (_matrixUpdated)
|
||||
{
|
||||
_worldMatDirty++;
|
||||
worldMatUpdated = true;
|
||||
}
|
||||
updateMatrix();
|
||||
updateLocalMatrix();
|
||||
updateWorldMatrix();
|
||||
|
||||
for (auto it = _assemblers.begin(); it != _assemblers.end(); it++)
|
||||
{
|
||||
@@ -430,6 +478,20 @@ void NodeProxy::visit(ModelBatcher* batcher, Scene* scene)
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// begin visit children
|
||||
/////////////////////////////////////////
|
||||
|
||||
bool parentWorldMatUpdated = false;
|
||||
bool parentOpacityUpdated = false;
|
||||
|
||||
if (_matrixUpdated)
|
||||
{
|
||||
_worldMatDirty++;
|
||||
_matrixUpdated = false;
|
||||
parentWorldMatUpdated = true;
|
||||
}
|
||||
|
||||
if (_opacityUpdated)
|
||||
{
|
||||
_parentOpacityDirty++;
|
||||
@@ -437,11 +499,26 @@ void NodeProxy::visit(ModelBatcher* batcher, Scene* scene)
|
||||
parentOpacityUpdated = true;
|
||||
}
|
||||
|
||||
reorderChildren();
|
||||
for (const auto& child : _children)
|
||||
{
|
||||
child->visit(batcher, scene);
|
||||
}
|
||||
|
||||
if (parentWorldMatUpdated)
|
||||
{
|
||||
_worldMatDirty--;
|
||||
}
|
||||
|
||||
if (parentOpacityUpdated)
|
||||
{
|
||||
_parentOpacityDirty--;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// end visit children
|
||||
/////////////////////////////////////////
|
||||
|
||||
for (auto it = _assemblers.begin(); it != _assemblers.end(); it++)
|
||||
{
|
||||
if (it->second->enabled())
|
||||
@@ -449,15 +526,6 @@ void NodeProxy::visit(ModelBatcher* batcher, Scene* scene)
|
||||
it->second->postHandle(this, batcher, scene);
|
||||
}
|
||||
}
|
||||
|
||||
if (worldMatUpdated)
|
||||
{
|
||||
_worldMatDirty--;
|
||||
}
|
||||
if (parentOpacityUpdated)
|
||||
{
|
||||
_parentOpacityDirty--;
|
||||
}
|
||||
}
|
||||
|
||||
RENDERER_END
|
||||
|
||||
@@ -43,6 +43,8 @@ RENDERER_BEGIN
|
||||
|
||||
class ModelBatcher;
|
||||
class Scene;
|
||||
struct TRS;
|
||||
struct ParentInfo;
|
||||
|
||||
/**
|
||||
* @addtogroup scene
|
||||
@@ -69,17 +71,16 @@ public:
|
||||
/*
|
||||
* @brief The default constructor.
|
||||
*/
|
||||
NodeProxy();
|
||||
NodeProxy(std::size_t unitID, std::size_t index, std::string id);
|
||||
/*
|
||||
* @brief The destructor.
|
||||
*/
|
||||
~NodeProxy();
|
||||
|
||||
/**
|
||||
* @brief Resets all states.
|
||||
/*
|
||||
* @brief destroy node data immediately .
|
||||
*/
|
||||
void reset();
|
||||
|
||||
void destroyImmediately();
|
||||
|
||||
/// @{
|
||||
/// @name Hierarchy
|
||||
|
||||
@@ -97,6 +98,10 @@ public:
|
||||
* @brief Removes all child node proxies from the current one.
|
||||
*/
|
||||
void removeAllChildren();
|
||||
/**
|
||||
* @brief Update parent by parent unitId and index.
|
||||
*/
|
||||
void notifyUpdateParent();
|
||||
|
||||
/**
|
||||
* @brief Sets the node proxy parent.
|
||||
@@ -123,28 +128,24 @@ public:
|
||||
* @return Child node.
|
||||
*/
|
||||
NodeProxy* getChildByName(std::string childName);
|
||||
/**
|
||||
* @brief Gets a child node by runtime id.
|
||||
* @return Child node.
|
||||
*/
|
||||
NodeProxy* getChildByID(std::string id);
|
||||
/**
|
||||
* @brief Sets the node proxy's local zorder.
|
||||
* @param[in] zOrder The value of zorder.
|
||||
*/
|
||||
void setLocalZOrder(int zOrder);
|
||||
/**
|
||||
* @brief Sets children order dirty, then children will get sorted during visit process.
|
||||
*/
|
||||
inline void setChildrenOrderDirty() { _childrenOrderDirty = true; };
|
||||
|
||||
/// @} end of Hierarchy
|
||||
|
||||
/**
|
||||
* @brief Update the TypedArray contains translation, rotation and scale data.
|
||||
* @param[in] trs JS TypedArray object
|
||||
*/
|
||||
void updateJSTRS(se::Object* trs);
|
||||
/*
|
||||
* @brief Gets the world matrix.
|
||||
* @return World matrix.
|
||||
*/
|
||||
inline const cocos2d::Mat4& getWorldMatrix() const { return _worldMat; };
|
||||
inline const cocos2d::Mat4& getWorldMatrix() const { return *_worldMat; };
|
||||
/*
|
||||
* @brief Gets the position.
|
||||
* @param[out] out The position vector
|
||||
@@ -174,7 +175,7 @@ public:
|
||||
/**
|
||||
* @brief Gets the node's opacity.
|
||||
*/
|
||||
inline uint8_t getOpacity() const { return _opacity; };
|
||||
inline uint8_t getOpacity() const { return *_opacity; };
|
||||
/**
|
||||
* @brief Sets the node's opacity.
|
||||
*/
|
||||
@@ -186,17 +187,16 @@ public:
|
||||
/**
|
||||
* @brief Gets the node's realOpacity.
|
||||
*/
|
||||
|
||||
inline const uint8_t getRealOpacity() const {return _realOpacity;};
|
||||
/**
|
||||
* @brief Gets the node's group id, this controls which camera can see the node.
|
||||
*/
|
||||
inline int getCullingMask() const { return _cullingMask; };
|
||||
inline int getCullingMask() const { return *_cullingMask; };
|
||||
/**
|
||||
* @brief Sets the node's group id.
|
||||
* @param[in] groupID The group id
|
||||
*/
|
||||
inline void setCullingMask(int cullingMask) { _cullingMask = cullingMask; };
|
||||
inline void setCullingMask(int cullingMask) { *_cullingMask = cullingMask; };
|
||||
|
||||
/**
|
||||
* @brief Gets the node's name.
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
* @brief Sets the node's 3D state.
|
||||
* @param[in] is3DNode
|
||||
*/
|
||||
inline void set3DNode(bool is3DNode) { _is3DNode = is3DNode; };
|
||||
inline void set3DNode(bool is3DNode) { *_is3DNode = is3DNode ? 0x1 : 0x0; };
|
||||
|
||||
/**
|
||||
* @brief Adds a system handle to the node proxy, system handle will be invoked during node's visit process.
|
||||
@@ -256,15 +256,15 @@ public:
|
||||
/*
|
||||
* @brief Updates local matrix.
|
||||
*/
|
||||
void updateFromJS();
|
||||
void updateLocalMatrix();
|
||||
/*
|
||||
* @brief Updates world matrix.
|
||||
*/
|
||||
void updateMatrix();
|
||||
void updateWorldMatrix();
|
||||
/*
|
||||
* @brief Updates the world matrix with parent matrix.
|
||||
*/
|
||||
void updateMatrix(const cocos2d::Mat4& parentMatrix);
|
||||
void updateWorldMatrix(const cocos2d::Mat4& parentMatrix);
|
||||
/*
|
||||
* @brief Enables calc world matrix.
|
||||
*/
|
||||
@@ -272,41 +272,54 @@ public:
|
||||
/*
|
||||
* @brief Disables calc world matrix.
|
||||
*/
|
||||
void disaleUpdateWorldMatrix() { _updateWorldMatrix = true; }
|
||||
void disaleUpdateWorldMatrix() { _updateWorldMatrix = false; }
|
||||
|
||||
/*
|
||||
* @brief Gets node runtime id
|
||||
*/
|
||||
std::string getID() { return _id; }
|
||||
|
||||
/*
|
||||
* @brief Adds world matrix dirty count
|
||||
*/
|
||||
void addWorldMatDirty() { _worldMatDirty++; }
|
||||
/*
|
||||
* @brief Subs world matrix dirty count
|
||||
*/
|
||||
void subWorldMatDirty() { _worldMatDirty--; }
|
||||
|
||||
protected:
|
||||
void updateLevel();
|
||||
void childrenAlloc();
|
||||
void detachChild(NodeProxy* child, ssize_t childIndex);
|
||||
void reorderChildren();
|
||||
private:
|
||||
static int _worldMatDirty;
|
||||
static int _parentOpacityDirty;
|
||||
static const int _TRANSFORM = 1 << 0;
|
||||
static const int _UPDATE_RENDER_DATA = 1 << 1;
|
||||
static const int _OPACITY = 1 << 2;
|
||||
static const int _COLOR = 1 << 3;
|
||||
static const int _CHILDREN = 1 << 4;
|
||||
static const int _POST_UPDATE_RENDER_DATA = 1 << 5;
|
||||
|
||||
bool _childrenOrderDirty = true;
|
||||
bool _matrixUpdated = false;
|
||||
bool _opacityUpdated = false;
|
||||
bool _is3DNode = false;
|
||||
bool _needVisit = true;
|
||||
bool _updateWorldMatrix = true;
|
||||
|
||||
uint8_t _opacity = 255;
|
||||
uint8_t _realOpacity = 255;
|
||||
int _localZOrder = 0;
|
||||
int _cullingMask = 1;
|
||||
|
||||
cocos2d::Mat4 _localMat;
|
||||
cocos2d::Mat4 _worldMat;
|
||||
std::string _id = "";
|
||||
std::string _name = "";
|
||||
uint32_t _level = 0;
|
||||
|
||||
std::string _name;
|
||||
|
||||
float* _jsTRSData;
|
||||
se::Object* _jsTRS;
|
||||
NodeProxy* _parent; ///< weak reference to parent node
|
||||
uint32_t* _dirty = nullptr;
|
||||
TRS* _trs = nullptr;
|
||||
cocos2d::Mat4* _localMat = nullptr;
|
||||
cocos2d::Mat4* _worldMat = nullptr;
|
||||
ParentInfo* _parentInfo = nullptr;
|
||||
uint32_t* _localZOrder = nullptr;
|
||||
int32_t* _cullingMask = nullptr;
|
||||
uint8_t* _opacity = nullptr;
|
||||
uint8_t* _is3DNode = nullptr;
|
||||
std::size_t _unitID = 0;
|
||||
std::size_t _index = 0;
|
||||
|
||||
NodeProxy* _parent = nullptr; ///< weak reference to parent node
|
||||
cocos2d::Vector<NodeProxy*> _children; ///< array of children nodes
|
||||
|
||||
cocos2d::Map<std::string, AssemblerBase*> _assemblers;
|
||||
|
||||
@@ -23,15 +23,29 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "RenderFlow.hpp"
|
||||
#include "NodeMemPool.hpp"
|
||||
|
||||
RENDERER_BEGIN
|
||||
|
||||
const uint32_t InitLevelCount = 3;
|
||||
const uint32_t InitLevelNodeCount = 100;
|
||||
|
||||
RenderFlow* RenderFlow::_instance = nullptr;
|
||||
|
||||
RenderFlow::RenderFlow(DeviceGraphics* device, Scene* scene, ForwardRenderer* forward)
|
||||
: _device(device)
|
||||
, _scene(scene)
|
||||
, _forward(forward)
|
||||
{
|
||||
_instance = this;
|
||||
|
||||
_batcher = new ModelBatcher(this);
|
||||
|
||||
_levelInfoArr.resize(InitLevelCount);
|
||||
for (auto i = 0; i < InitLevelCount; i++)
|
||||
{
|
||||
_levelInfoArr[i].reserve(InitLevelNodeCount);
|
||||
}
|
||||
}
|
||||
|
||||
RenderFlow::~RenderFlow()
|
||||
@@ -39,10 +53,111 @@ RenderFlow::~RenderFlow()
|
||||
CC_SAFE_DELETE(_batcher);
|
||||
}
|
||||
|
||||
void RenderFlow::removeNodeLevel(uint32_t level, cocos2d::Mat4* worldMat)
|
||||
{
|
||||
if (level >= _levelInfoArr.size()) return;
|
||||
auto& levelInfos = _levelInfoArr[level];
|
||||
for(auto it = levelInfos.begin(); it != levelInfos.end(); it++)
|
||||
{
|
||||
if (it->worldMat == worldMat)
|
||||
{
|
||||
levelInfos.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderFlow::insertNodeLevel(uint32_t level, const LevelInfo& levelInfo)
|
||||
{
|
||||
if (level >= _levelInfoArr.size())
|
||||
{
|
||||
_levelInfoArr.resize(level + 1);
|
||||
}
|
||||
auto& levelInfos = _levelInfoArr[level];
|
||||
levelInfos.push_back(levelInfo);
|
||||
}
|
||||
|
||||
void RenderFlow::calculateLocalMatrix()
|
||||
{
|
||||
const uint16_t SPACE_FREE_FLAG = 0x0;
|
||||
static cocos2d::Mat4 matTemp;
|
||||
|
||||
NodeMemPool* instance = NodeMemPool::getInstance();
|
||||
CCASSERT(instance, "RenderFlow calculateLocalMatrix NodeMemPool is null");
|
||||
auto& commonPool = instance->getCommonPool();
|
||||
auto& nodePool = instance->getNodePool();
|
||||
for(auto i = 0; i < commonPool.size(); i++)
|
||||
{
|
||||
UnitCommon* commonUnit = commonPool[i];
|
||||
uint16_t usingNum = commonUnit->getUsingNum();
|
||||
if (usingNum == 0) continue;
|
||||
|
||||
std::size_t contentNum = commonUnit->getContentNum();
|
||||
Sign* signData = commonUnit->getSignData(0);
|
||||
|
||||
UnitNode* nodeUnit = nodePool[i];
|
||||
uint32_t* dirty = nodeUnit->getDirty(0);
|
||||
cocos2d::Mat4* localMat = nodeUnit->getLocalMat(0);
|
||||
TRS* trs = nodeUnit->getTRS(0);
|
||||
uint8_t* is3D = nodeUnit->getIs3D(0);
|
||||
cocos2d::Quaternion* quat = nullptr;
|
||||
float trsZ = 0.0f, trsSZ = 0.0f;
|
||||
|
||||
for (auto j = 0; j < contentNum; j++, localMat ++, trs ++, is3D ++, signData++, dirty++)
|
||||
{
|
||||
if (signData->freeFlag == SPACE_FREE_FLAG) continue;
|
||||
// reset world transform changed flag
|
||||
*dirty &= ~WORLD_TRANSFORM_CHANGED;
|
||||
if (!(*dirty & LOCAL_TRANSFORM)) continue;
|
||||
|
||||
localMat->setIdentity();
|
||||
trsZ = *is3D ? trs->z : 0;
|
||||
localMat->translate(trs->x, trs->y, trsZ);
|
||||
|
||||
quat = (cocos2d::Quaternion*)&(trs->qx);
|
||||
cocos2d::Mat4::createRotation(*quat, &matTemp);
|
||||
cocos2d::Mat4::multiply(*localMat, matTemp, localMat);
|
||||
|
||||
trsSZ = *is3D ? trs->sz : 1;
|
||||
cocos2d::Mat4::createScale(trs->sx, trs->sy, trsSZ, &matTemp);
|
||||
cocos2d::Mat4::multiply(*localMat, matTemp, localMat);
|
||||
|
||||
*dirty &= ~LOCAL_TRANSFORM;
|
||||
*dirty |= WORLD_TRANSFORM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderFlow::calculateWorldMatrix()
|
||||
{
|
||||
for(std::size_t level = 0, n = _levelInfoArr.size(); level < n; level++)
|
||||
{
|
||||
auto& levelInfos = _levelInfoArr[level];
|
||||
for(auto it = levelInfos.begin(); it != levelInfos.end(); it++)
|
||||
{
|
||||
auto selfDirty = *it->dirty & WORLD_TRANSFORM;
|
||||
if (it->parentDirty != nullptr && ((*it->parentDirty & WORLD_TRANSFORM_CHANGED) || selfDirty))
|
||||
{
|
||||
it->worldMat->multiply(*it->parentWorldMat, *it->localMat, it->worldMat);
|
||||
*it->dirty |= WORLD_TRANSFORM_CHANGED;
|
||||
}
|
||||
else if (selfDirty)
|
||||
{
|
||||
*it->worldMat = *it->localMat;
|
||||
*it->dirty |= WORLD_TRANSFORM_CHANGED;
|
||||
}
|
||||
*it->dirty &= ~WORLD_TRANSFORM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderFlow::render(NodeProxy* scene)
|
||||
{
|
||||
if (scene != nullptr)
|
||||
{
|
||||
calculateLocalMatrix();
|
||||
calculateWorldMatrix();
|
||||
|
||||
_batcher->startBatch();
|
||||
scene->visitAsRoot(_batcher, _scene);
|
||||
_batcher->terminateBatch();
|
||||
|
||||
@@ -50,6 +50,54 @@ RENDERER_BEGIN
|
||||
class RenderFlow
|
||||
{
|
||||
public:
|
||||
|
||||
enum RenderFlowFlag {
|
||||
// sync js render flag
|
||||
|
||||
BREAK_FLOW = 1 << 0,
|
||||
LOCAL_TRANSFORM = 1 << 1,
|
||||
WORLD_TRANSFORM = 1 << 2,
|
||||
TRANSFORM = LOCAL_TRANSFORM | WORLD_TRANSFORM,
|
||||
UPDATE_RENDER_DATA = 1 << 3,
|
||||
OPACITY = 1 << 4,
|
||||
RENDER = 1 << 5,
|
||||
CUSTOM_IA_RENDER = 1 << 6,
|
||||
CHILDREN = 1 << 7,
|
||||
POST_UPDATE_RENDER_DATA = 1 << 8,
|
||||
POST_RENDER = 1 << 9,
|
||||
FINAL = 1 << 10,
|
||||
|
||||
// native render flag
|
||||
REORDER_CHILDREN = 1 << 11,
|
||||
// world matrix changed
|
||||
WORLD_TRANSFORM_CHANGED = 1 << 12
|
||||
};
|
||||
|
||||
struct LevelInfo{
|
||||
uint32_t* dirty = nullptr;
|
||||
cocos2d::Mat4* localMat = nullptr;
|
||||
cocos2d::Mat4* worldMat = nullptr;
|
||||
cocos2d::Mat4* parentWorldMat = nullptr;
|
||||
uint32_t* parentDirty = nullptr;
|
||||
};
|
||||
|
||||
static RenderFlow *getInstance()
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief The constructor.
|
||||
* @param[in] device
|
||||
* @param[in] scene
|
||||
* @param[in] forward
|
||||
*/
|
||||
RenderFlow(DeviceGraphics* device, Scene* scene, ForwardRenderer* forward);
|
||||
/*
|
||||
* @brief The destructor.
|
||||
*/
|
||||
~RenderFlow();
|
||||
|
||||
/*
|
||||
* @brief Gets the ModelBatcher which is responsible for collecting render Models.
|
||||
*/
|
||||
@@ -71,22 +119,31 @@ public:
|
||||
* @brief Visit a node tree.
|
||||
*/
|
||||
void visit(NodeProxy* rootNode);
|
||||
/*
|
||||
* @brief The constructor.
|
||||
* @param[in] device
|
||||
* @param[in] scene
|
||||
* @param[in] forward
|
||||
/**
|
||||
* @brief Calculate local matrix.
|
||||
*/
|
||||
RenderFlow(DeviceGraphics* device, Scene* scene, ForwardRenderer* forward);
|
||||
/*
|
||||
* @brief The destructor.
|
||||
void calculateLocalMatrix();
|
||||
/**
|
||||
* @brief Calculate world matrix.
|
||||
*/
|
||||
~RenderFlow();
|
||||
void calculateWorldMatrix();
|
||||
/**
|
||||
* @brief remove node level
|
||||
*/
|
||||
void removeNodeLevel(uint32_t level, cocos2d::Mat4* worldMat);
|
||||
/**
|
||||
* @brief insert node level
|
||||
*/
|
||||
void insertNodeLevel(uint32_t level, const LevelInfo& levelInfo);
|
||||
private:
|
||||
|
||||
static RenderFlow *_instance;
|
||||
|
||||
ModelBatcher* _batcher;
|
||||
Scene* _scene;
|
||||
DeviceGraphics* _device;
|
||||
ForwardRenderer* _forward;
|
||||
std::vector<std::vector<LevelInfo>> _levelInfoArr;
|
||||
};
|
||||
|
||||
// end of scene group
|
||||
|
||||
@@ -120,6 +120,10 @@ public:
|
||||
* @brief Do nothing
|
||||
*/
|
||||
virtual void postHandle(NodeProxy *node, ModelBatcher* batcher, Scene* scene) override {}
|
||||
/*
|
||||
* @brief before fill buffers handle
|
||||
*/
|
||||
virtual void beforeFillBuffers(std::size_t index) {}
|
||||
/*
|
||||
* @brief Fills render data in given index to the MeshBuffer
|
||||
* @param[in] buffer The shared mesh buffer
|
||||
|
||||
@@ -122,10 +122,7 @@ public:
|
||||
*/
|
||||
virtual void reset() {};
|
||||
public:
|
||||
static const int TRANSFORM = 1 << 0;
|
||||
static const int OPACITY = 1 << 1;
|
||||
static const int COLOR = 1 << 2;
|
||||
static const int CHILDREN = 1 << 3;
|
||||
static const int OPACITY = 1;
|
||||
protected:
|
||||
uint32_t _dirtyFlag = 0;
|
||||
bool _enabled = false;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
RENDERER_BEGIN
|
||||
|
||||
void RenderDataList::updateMesh(std::size_t index, se::Object* vertices, se::Object* indices)
|
||||
void RenderDataList::updateMesh(std::size_t index, se_object_ptr vertices, se_object_ptr indices)
|
||||
{
|
||||
if (index >= _datas.size())
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "base/CCRef.h"
|
||||
#include <vector>
|
||||
#include "RenderData.hpp"
|
||||
#include "scripting/js-bindings/jswrapper/Object.hpp"
|
||||
|
||||
namespace se {
|
||||
class Object;
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
* @param[in] vertices Vertex data.
|
||||
* @param[in] indices Index data.
|
||||
*/
|
||||
void updateMesh(std::size_t index, se::Object* vertices, se::Object* indices);
|
||||
void updateMesh(std::size_t index, se_object_ptr vertices, se_object_ptr indices);
|
||||
/**
|
||||
* @brief Gets the count of render datas
|
||||
* @return Count.
|
||||
|
||||
@@ -39,14 +39,14 @@ TiledMapAssembler::~TiledMapAssembler()
|
||||
|
||||
}
|
||||
|
||||
void TiledMapAssembler::updateNodes(std::size_t meshIndex, std::vector<std::string> nodes)
|
||||
void TiledMapAssembler::updateNodes(std::size_t iaIndex, const std::vector<std::string>& nodes)
|
||||
{
|
||||
_nodesMap[meshIndex] = nodes;
|
||||
_nodesMap[iaIndex] = nodes;
|
||||
}
|
||||
|
||||
void TiledMapAssembler::clearNodes(std::size_t meshIndex)
|
||||
void TiledMapAssembler::clearNodes(std::size_t iaIndex)
|
||||
{
|
||||
_nodesMap.erase(meshIndex);
|
||||
_nodesMap.erase(iaIndex);
|
||||
}
|
||||
|
||||
void TiledMapAssembler::handle(NodeProxy *node, ModelBatcher* batcher, Scene* scene)
|
||||
@@ -59,26 +59,32 @@ void TiledMapAssembler::handle(NodeProxy *node, ModelBatcher* batcher, Scene* sc
|
||||
Assembler::handle(node, batcher, scene);
|
||||
}
|
||||
|
||||
void TiledMapAssembler::fillBuffers(MeshBuffer* buffer, std::size_t index, const Mat4& worldMat)
|
||||
void TiledMapAssembler::beforeFillBuffers(std::size_t index)
|
||||
{
|
||||
auto it = _nodesMap.find(index);
|
||||
if (it != _nodesMap.end())
|
||||
{
|
||||
auto flow = _batcher->getFlow();
|
||||
for (auto& childName : it->second) {
|
||||
auto child = _node->getChildByName(childName);
|
||||
for (auto& id : it->second) {
|
||||
auto child = _node->getChildByID(id);
|
||||
if (child)
|
||||
{
|
||||
child->enableVisit();
|
||||
child->disaleUpdateWorldMatrix();
|
||||
child->updateFromJS();
|
||||
child->updateMatrix(_tileMapWorldMat);
|
||||
child->updateLocalMatrix();
|
||||
child->updateWorldMatrix(_tileMapWorldMat);
|
||||
child->addWorldMatDirty();
|
||||
flow->visit(child);
|
||||
child->subWorldMatDirty();
|
||||
child->enableUpdateWorldMatrix();
|
||||
child->disableVisit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TiledMapAssembler::fillBuffers(MeshBuffer* buffer, std::size_t index, const Mat4& worldMat)
|
||||
{
|
||||
Assembler::fillBuffers(buffer, index, worldMat);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,14 +36,15 @@ public:
|
||||
TiledMapAssembler();
|
||||
virtual ~TiledMapAssembler();
|
||||
virtual void handle(NodeProxy *node, ModelBatcher* batcher, Scene* scene) override;
|
||||
virtual void beforeFillBuffers(std::size_t index) override;
|
||||
virtual void fillBuffers(MeshBuffer* buffer, std::size_t index, const Mat4& worldMat) override;
|
||||
void setLayerMoveXY(float moveX, float moveY)
|
||||
{
|
||||
_moveX = moveX;
|
||||
_moveY = moveY;
|
||||
}
|
||||
void updateNodes(std::size_t meshIndex, std::vector<std::string> nodes);
|
||||
void clearNodes(std::size_t meshIndex);
|
||||
void updateNodes(std::size_t iaIndex, const std::vector<std::string>& nodes);
|
||||
void clearNodes(std::size_t iaIndex);
|
||||
private:
|
||||
std::map<std::size_t, std::vector<std::string>> _nodesMap;
|
||||
NodeProxy* _node = nullptr;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MemPool.hpp"
|
||||
#include "NodeMemPool.hpp"
|
||||
#include "NodeProxy.hpp"
|
||||
#include "ModelBatcher.hpp"
|
||||
#include "RenderFlow.hpp"
|
||||
|
||||
@@ -477,19 +477,19 @@ AssemblerBase : function (
|
||||
renderer.NodeProxy = {
|
||||
|
||||
/**
|
||||
* @method addChild
|
||||
* @param {cc.renderer::NodeProxy} arg0
|
||||
* @method updateLocalMatrix
|
||||
*/
|
||||
addChild : function (
|
||||
nodeproxy
|
||||
updateLocalMatrix : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method removeAllChildren
|
||||
*/
|
||||
removeAllChildren : function (
|
||||
* @method updateWorldMatrix
|
||||
* @param {mat4_object} mat4
|
||||
*/
|
||||
updateWorldMatrix : function(
|
||||
mat4
|
||||
)
|
||||
{
|
||||
},
|
||||
@@ -504,6 +504,14 @@ getChildren : function (
|
||||
return new Array();
|
||||
},
|
||||
|
||||
/**
|
||||
* @method subWorldMatDirty
|
||||
*/
|
||||
subWorldMatDirty : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method disableVisit
|
||||
*/
|
||||
@@ -522,6 +530,14 @@ int
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method addWorldMatDirty
|
||||
*/
|
||||
addWorldMatDirty : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method addAssembler
|
||||
* @param {String} arg0
|
||||
@@ -534,14 +550,6 @@ assemblerbase
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setChildrenOrderDirty
|
||||
*/
|
||||
setChildrenOrderDirty : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getAssembler
|
||||
* @param {String} arg0
|
||||
@@ -567,25 +575,13 @@ str
|
||||
},
|
||||
|
||||
/**
|
||||
* @method setParent
|
||||
* @param {cc.renderer::NodeProxy} arg0
|
||||
* @method notifyUpdateParent
|
||||
*/
|
||||
setParent : function (
|
||||
nodeproxy
|
||||
notifyUpdateParent : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getName
|
||||
* @return {String}
|
||||
*/
|
||||
getName : function (
|
||||
)
|
||||
{
|
||||
return ;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method visit
|
||||
* @param {cc.renderer::ModelBatcher} arg0
|
||||
@@ -608,6 +604,14 @@ char
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method destroyImmediately
|
||||
*/
|
||||
destroyImmediately : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getRealOpacity
|
||||
* @return {unsigned char}
|
||||
@@ -618,16 +622,6 @@ getRealOpacity : function (
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method updateMatrix
|
||||
* @param {mat4_object} mat4
|
||||
*/
|
||||
updateMatrix : function(
|
||||
mat4
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getOpacity
|
||||
* @return {unsigned char}
|
||||
@@ -683,19 +677,13 @@ getCullingMask : function (
|
||||
},
|
||||
|
||||
/**
|
||||
* @method updateFromJS
|
||||
* @method getID
|
||||
* @return {String}
|
||||
*/
|
||||
updateFromJS : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method reset
|
||||
*/
|
||||
reset : function (
|
||||
getID : function (
|
||||
)
|
||||
{
|
||||
return ;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -709,13 +697,15 @@ getParent : function (
|
||||
},
|
||||
|
||||
/**
|
||||
* @method removeChild
|
||||
* @param {cc.renderer::NodeProxy} arg0
|
||||
* @method getChildByID
|
||||
* @param {String} arg0
|
||||
* @return {cc.renderer::NodeProxy}
|
||||
*/
|
||||
removeChild : function (
|
||||
nodeproxy
|
||||
getChildByID : function (
|
||||
str
|
||||
)
|
||||
{
|
||||
return cc.renderer::NodeProxy;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -746,6 +736,16 @@ int
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getName
|
||||
* @return {String}
|
||||
*/
|
||||
getName : function (
|
||||
)
|
||||
{
|
||||
return ;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getChildrenCount
|
||||
* @return {unsigned int}
|
||||
@@ -769,8 +769,14 @@ str
|
||||
/**
|
||||
* @method NodeProxy
|
||||
* @constructor
|
||||
* @param {unsigned int} arg0
|
||||
* @param {unsigned int} arg1
|
||||
* @param {String} arg2
|
||||
*/
|
||||
NodeProxy : function (
|
||||
int,
|
||||
int,
|
||||
str
|
||||
)
|
||||
{
|
||||
},
|
||||
@@ -1649,6 +1655,92 @@ Scene : function (
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class MemPool
|
||||
*/
|
||||
renderer.MemPool = {
|
||||
|
||||
/**
|
||||
* @method updateCommonData
|
||||
* @param {unsigned int} arg0
|
||||
* @param {se::Object} arg1
|
||||
* @param {se::Object} arg2
|
||||
*/
|
||||
updateCommonData : function (
|
||||
int,
|
||||
object,
|
||||
object
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method MemPool
|
||||
* @constructor
|
||||
*/
|
||||
MemPool : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class NodeMemPool
|
||||
*/
|
||||
renderer.NodeMemPool = {
|
||||
|
||||
/**
|
||||
* @method updateNodeData
|
||||
* @param {unsigned int} arg0
|
||||
* @param {se::Object} arg1
|
||||
* @param {se::Object} arg2
|
||||
* @param {se::Object} arg3
|
||||
* @param {se::Object} arg4
|
||||
* @param {se::Object} arg5
|
||||
* @param {se::Object} arg6
|
||||
* @param {se::Object} arg7
|
||||
* @param {se::Object} arg8
|
||||
* @param {se::Object} arg9
|
||||
* @param {se::Object} arg10
|
||||
*/
|
||||
updateNodeData : function (
|
||||
int,
|
||||
object,
|
||||
object,
|
||||
object,
|
||||
object,
|
||||
object,
|
||||
object,
|
||||
object,
|
||||
object,
|
||||
object,
|
||||
object
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getInstance
|
||||
* @return {cc.renderer::NodeMemPool}
|
||||
*/
|
||||
getInstance : function (
|
||||
)
|
||||
{
|
||||
return cc.renderer::NodeMemPool;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method NodeMemPool
|
||||
* @constructor
|
||||
*/
|
||||
NodeMemPool : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class RenderDataList
|
||||
*/
|
||||
@@ -1666,6 +1758,20 @@ int
|
||||
return cc.renderer::RenderData;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method updateMesh
|
||||
* @param {unsigned int} arg0
|
||||
* @param {se::Object} arg1
|
||||
* @param {se::Object} arg2
|
||||
*/
|
||||
updateMesh : function (
|
||||
int,
|
||||
object,
|
||||
object
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getMeshCount
|
||||
* @return {unsigned int}
|
||||
@@ -1830,6 +1936,16 @@ enableOpacityAlwaysDirty : function (
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method beforeFillBuffers
|
||||
* @param {unsigned int} arg0
|
||||
*/
|
||||
beforeFillBuffers : function (
|
||||
int
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method updateIndicesRange
|
||||
* @param {unsigned int} arg0
|
||||
@@ -2004,6 +2120,26 @@ nodeproxy
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method calculateWorldMatrix
|
||||
*/
|
||||
calculateWorldMatrix : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method insertNodeLevel
|
||||
* @param {unsigned int} arg0
|
||||
* @param {cc.renderer::RenderFlow::LevelInfo} arg1
|
||||
*/
|
||||
insertNodeLevel : function (
|
||||
int,
|
||||
levelinfo
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method visit
|
||||
* @param {cc.renderer::NodeProxy} arg0
|
||||
@@ -2014,6 +2150,26 @@ nodeproxy
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method calculateLocalMatrix
|
||||
*/
|
||||
calculateLocalMatrix : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method removeNodeLevel
|
||||
* @param {unsigned int} arg0
|
||||
* @param {mat4_object} arg1
|
||||
*/
|
||||
removeNodeLevel : function (
|
||||
int,
|
||||
mat4
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getRenderScene
|
||||
* @return {cc.renderer::Scene}
|
||||
@@ -2044,6 +2200,16 @@ getDevice : function (
|
||||
return cc.renderer::DeviceGraphics;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method getInstance
|
||||
* @return {cc.renderer::RenderFlow}
|
||||
*/
|
||||
getInstance : function (
|
||||
)
|
||||
{
|
||||
return cc.renderer::RenderFlow;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method RenderFlow
|
||||
* @constructor
|
||||
|
||||
@@ -1486,39 +1486,49 @@ 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_addChild(se::State& s)
|
||||
static bool js_renderer_NodeProxy_updateLocalMatrix(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_addChild : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::renderer::NodeProxy* arg0 = nullptr;
|
||||
ok &= seval_to_native_ptr(args[0], &arg0);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_addChild : Error processing arguments");
|
||||
cobj->addChild(arg0);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_addChild)
|
||||
|
||||
static bool js_renderer_NodeProxy_removeAllChildren(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_removeAllChildren : Invalid Native Object");
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_updateLocalMatrix : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->removeAllChildren();
|
||||
cobj->updateLocalMatrix();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_removeAllChildren)
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_updateLocalMatrix)
|
||||
|
||||
static bool js_renderer_NodeProxy_updateWorldMatrix(se::State& s)
|
||||
{
|
||||
CC_UNUSED bool ok = true;
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2( cobj, false, "js_renderer_NodeProxy_updateWorldMatrix : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
do {
|
||||
if (argc == 1) {
|
||||
cocos2d::Mat4 arg0;
|
||||
ok &= seval_to_Mat4(args[0], &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
cobj->updateWorldMatrix(arg0);
|
||||
return true;
|
||||
}
|
||||
} while(false);
|
||||
|
||||
do {
|
||||
if (argc == 0) {
|
||||
cobj->updateWorldMatrix();
|
||||
return true;
|
||||
}
|
||||
} while(false);
|
||||
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_updateWorldMatrix)
|
||||
|
||||
static bool js_renderer_NodeProxy_getChildren(se::State& s)
|
||||
{
|
||||
@@ -1538,6 +1548,21 @@ 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();
|
||||
@@ -1572,6 +1597,21 @@ 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_addAssembler(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
@@ -1593,21 +1633,6 @@ static bool js_renderer_NodeProxy_addAssembler(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_addAssembler)
|
||||
|
||||
static bool js_renderer_NodeProxy_setChildrenOrderDirty(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_setChildrenOrderDirty : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->setChildrenOrderDirty();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_setChildrenOrderDirty)
|
||||
|
||||
static bool js_renderer_NodeProxy_getAssembler(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
@@ -1650,42 +1675,20 @@ static bool js_renderer_NodeProxy_getChildByName(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_getChildByName)
|
||||
|
||||
static bool js_renderer_NodeProxy_setParent(se::State& s)
|
||||
static bool js_renderer_NodeProxy_notifyUpdateParent(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_setParent : Invalid Native Object");
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_notifyUpdateParent : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::renderer::NodeProxy* arg0 = nullptr;
|
||||
ok &= seval_to_native_ptr(args[0], &arg0);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_setParent : Error processing arguments");
|
||||
cobj->setParent(arg0);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_setParent)
|
||||
|
||||
static bool js_renderer_NodeProxy_getName(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_getName : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
const std::string& result = cobj->getName();
|
||||
ok &= std_string_to_seval(result, &s.rval());
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_getName : Error processing arguments");
|
||||
cobj->notifyUpdateParent();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_getName)
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_notifyUpdateParent)
|
||||
|
||||
static bool js_renderer_NodeProxy_visit(se::State& s)
|
||||
{
|
||||
@@ -1727,6 +1730,21 @@ static bool js_renderer_NodeProxy_setOpacity(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_setOpacity)
|
||||
|
||||
static bool js_renderer_NodeProxy_destroyImmediately(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_destroyImmediately : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->destroyImmediately();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_destroyImmediately)
|
||||
|
||||
static bool js_renderer_NodeProxy_getRealOpacity(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
@@ -1745,35 +1763,6 @@ static bool js_renderer_NodeProxy_getRealOpacity(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_getRealOpacity)
|
||||
|
||||
static bool js_renderer_NodeProxy_updateMatrix(se::State& s)
|
||||
{
|
||||
CC_UNUSED bool ok = true;
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2( cobj, false, "js_renderer_NodeProxy_updateMatrix : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
do {
|
||||
if (argc == 1) {
|
||||
cocos2d::Mat4 arg0;
|
||||
ok &= seval_to_Mat4(args[0], &arg0);
|
||||
if (!ok) { ok = true; break; }
|
||||
cobj->updateMatrix(arg0);
|
||||
return true;
|
||||
}
|
||||
} while(false);
|
||||
|
||||
do {
|
||||
if (argc == 0) {
|
||||
cobj->updateMatrix();
|
||||
return true;
|
||||
}
|
||||
} while(false);
|
||||
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d", (int)argc);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_updateMatrix)
|
||||
|
||||
static bool js_renderer_NodeProxy_getOpacity(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
@@ -1874,35 +1863,23 @@ static bool js_renderer_NodeProxy_getCullingMask(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_getCullingMask)
|
||||
|
||||
static bool js_renderer_NodeProxy_updateFromJS(se::State& s)
|
||||
static bool js_renderer_NodeProxy_getID(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_updateFromJS : Invalid Native Object");
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_getID : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cobj->updateFromJS();
|
||||
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;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_updateFromJS)
|
||||
|
||||
static bool js_renderer_NodeProxy_reset(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_reset : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->reset();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_reset)
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_getID)
|
||||
|
||||
static bool js_renderer_NodeProxy_getParent(se::State& s)
|
||||
{
|
||||
@@ -1922,24 +1899,26 @@ static bool js_renderer_NodeProxy_getParent(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_getParent)
|
||||
|
||||
static bool js_renderer_NodeProxy_removeChild(se::State& s)
|
||||
static bool js_renderer_NodeProxy_getChildByID(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_removeChild : Invalid Native Object");
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_getChildByID : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
cocos2d::renderer::NodeProxy* arg0 = nullptr;
|
||||
ok &= seval_to_native_ptr(args[0], &arg0);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_removeChild : Error processing arguments");
|
||||
cobj->removeChild(arg0);
|
||||
std::string arg0;
|
||||
ok &= seval_to_std_string(args[0], &arg0);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_getChildByID : Error processing arguments");
|
||||
cocos2d::renderer::NodeProxy* result = cobj->getChildByID(arg0);
|
||||
ok &= native_ptr_to_seval<cocos2d::renderer::NodeProxy>((cocos2d::renderer::NodeProxy*)result, &s.rval());
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_getChildByID : Error processing arguments");
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_removeChild)
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_getChildByID)
|
||||
|
||||
static bool js_renderer_NodeProxy_disaleUpdateWorldMatrix(se::State& s)
|
||||
{
|
||||
@@ -1994,6 +1973,24 @@ static bool js_renderer_NodeProxy_setLocalZOrder(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_setLocalZOrder)
|
||||
|
||||
static bool js_renderer_NodeProxy_getName(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeProxy_getName : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
const std::string& result = cobj->getName();
|
||||
ok &= std_string_to_seval(result, &s.rval());
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_getName : 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_getName)
|
||||
|
||||
static bool js_renderer_NodeProxy_getChildrenCount(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
@@ -2035,7 +2032,16 @@ SE_DECLARE_FINALIZE_FUNC(js_cocos2d_renderer_NodeProxy_finalize)
|
||||
|
||||
static bool js_renderer_NodeProxy_constructor(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = new (std::nothrow) cocos2d::renderer::NodeProxy();
|
||||
CC_UNUSED bool ok = true;
|
||||
const auto& args = s.args();
|
||||
size_t arg0 = 0;
|
||||
size_t arg1 = 0;
|
||||
std::string arg2;
|
||||
ok &= seval_to_size(args[0], &arg0);
|
||||
ok &= seval_to_size(args[1], &arg1);
|
||||
ok &= seval_to_std_string(args[2], &arg2);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_constructor : Error processing arguments");
|
||||
cocos2d::renderer::NodeProxy* cobj = new (std::nothrow) cocos2d::renderer::NodeProxy(arg0, arg1, arg2);
|
||||
s.thisObject()->setPrivateData(cobj);
|
||||
return true;
|
||||
}
|
||||
@@ -2057,34 +2063,34 @@ bool js_register_renderer_NodeProxy(se::Object* obj)
|
||||
{
|
||||
auto cls = se::Class::create("NodeProxy", obj, nullptr, _SE(js_renderer_NodeProxy_constructor));
|
||||
|
||||
cls->defineFunction("addChild", _SE(js_renderer_NodeProxy_addChild));
|
||||
cls->defineFunction("removeAllChildren", _SE(js_renderer_NodeProxy_removeAllChildren));
|
||||
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("addAssembler", _SE(js_renderer_NodeProxy_addAssembler));
|
||||
cls->defineFunction("setChildrenOrderDirty", _SE(js_renderer_NodeProxy_setChildrenOrderDirty));
|
||||
cls->defineFunction("getAssembler", _SE(js_renderer_NodeProxy_getAssembler));
|
||||
cls->defineFunction("getChildByName", _SE(js_renderer_NodeProxy_getChildByName));
|
||||
cls->defineFunction("setParent", _SE(js_renderer_NodeProxy_setParent));
|
||||
cls->defineFunction("getName", _SE(js_renderer_NodeProxy_getName));
|
||||
cls->defineFunction("notifyUpdateParent", _SE(js_renderer_NodeProxy_notifyUpdateParent));
|
||||
cls->defineFunction("visit", _SE(js_renderer_NodeProxy_visit));
|
||||
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("updateMatrix", _SE(js_renderer_NodeProxy_updateMatrix));
|
||||
cls->defineFunction("getOpacity", _SE(js_renderer_NodeProxy_getOpacity));
|
||||
cls->defineFunction("enableVisit", _SE(js_renderer_NodeProxy_enableVisit));
|
||||
cls->defineFunction("enableUpdateWorldMatrix", _SE(js_renderer_NodeProxy_enableUpdateWorldMatrix));
|
||||
cls->defineFunction("setName", _SE(js_renderer_NodeProxy_setName));
|
||||
cls->defineFunction("updateRealOpacity", _SE(js_renderer_NodeProxy_updateRealOpacity));
|
||||
cls->defineFunction("getCullingMask", _SE(js_renderer_NodeProxy_getCullingMask));
|
||||
cls->defineFunction("updateFromJS", _SE(js_renderer_NodeProxy_updateFromJS));
|
||||
cls->defineFunction("reset", _SE(js_renderer_NodeProxy_reset));
|
||||
cls->defineFunction("getID", _SE(js_renderer_NodeProxy_getID));
|
||||
cls->defineFunction("getParent", _SE(js_renderer_NodeProxy_getParent));
|
||||
cls->defineFunction("removeChild", _SE(js_renderer_NodeProxy_removeChild));
|
||||
cls->defineFunction("getChildByID", _SE(js_renderer_NodeProxy_getChildByID));
|
||||
cls->defineFunction("disaleUpdateWorldMatrix", _SE(js_renderer_NodeProxy_disaleUpdateWorldMatrix));
|
||||
cls->defineFunction("set3DNode", _SE(js_renderer_NodeProxy_set3DNode));
|
||||
cls->defineFunction("setLocalZOrder", _SE(js_renderer_NodeProxy_setLocalZOrder));
|
||||
cls->defineFunction("getName", _SE(js_renderer_NodeProxy_getName));
|
||||
cls->defineFunction("getChildrenCount", _SE(js_renderer_NodeProxy_getChildrenCount));
|
||||
cls->defineFunction("removeAssembler", _SE(js_renderer_NodeProxy_removeAssembler));
|
||||
cls->defineFinalizeFunction(_SE(js_cocos2d_renderer_NodeProxy_finalize));
|
||||
@@ -3816,6 +3822,180 @@ bool js_register_renderer_Scene(se::Object* obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
se::Object* __jsb_cocos2d_renderer_MemPool_proto = nullptr;
|
||||
se::Class* __jsb_cocos2d_renderer_MemPool_class = nullptr;
|
||||
|
||||
static bool js_renderer_MemPool_updateCommonData(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::MemPool* cobj = (cocos2d::renderer::MemPool*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_MemPool_updateCommonData : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 3) {
|
||||
size_t arg0 = 0;
|
||||
se_object_ptr arg1 = nullptr;
|
||||
se_object_ptr arg2 = nullptr;
|
||||
ok &= seval_to_size(args[0], &arg0);
|
||||
ok &= seval_to_native_ptr(args[1], &arg1);
|
||||
ok &= seval_to_native_ptr(args[2], &arg2);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_MemPool_updateCommonData : Error processing arguments");
|
||||
cobj->updateCommonData(arg0, arg1, arg2);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_MemPool_updateCommonData)
|
||||
|
||||
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_renderer_MemPool_finalize)
|
||||
|
||||
static bool js_renderer_MemPool_constructor(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::MemPool* cobj = new (std::nothrow) cocos2d::renderer::MemPool();
|
||||
s.thisObject()->setPrivateData(cobj);
|
||||
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
|
||||
return true;
|
||||
}
|
||||
SE_BIND_CTOR(js_renderer_MemPool_constructor, __jsb_cocos2d_renderer_MemPool_class, js_cocos2d_renderer_MemPool_finalize)
|
||||
|
||||
|
||||
|
||||
|
||||
static bool js_cocos2d_renderer_MemPool_finalize(se::State& s)
|
||||
{
|
||||
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::renderer::MemPool)", s.nativeThisObject());
|
||||
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject());
|
||||
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
|
||||
{
|
||||
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
|
||||
cocos2d::renderer::MemPool* cobj = (cocos2d::renderer::MemPool*)s.nativeThisObject();
|
||||
delete cobj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FINALIZE_FUNC(js_cocos2d_renderer_MemPool_finalize)
|
||||
|
||||
bool js_register_renderer_MemPool(se::Object* obj)
|
||||
{
|
||||
auto cls = se::Class::create("MemPool", obj, nullptr, _SE(js_renderer_MemPool_constructor));
|
||||
|
||||
cls->defineFunction("updateCommonData", _SE(js_renderer_MemPool_updateCommonData));
|
||||
cls->defineFinalizeFunction(_SE(js_cocos2d_renderer_MemPool_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cocos2d::renderer::MemPool>(cls);
|
||||
|
||||
__jsb_cocos2d_renderer_MemPool_proto = cls->getProto();
|
||||
__jsb_cocos2d_renderer_MemPool_class = cls;
|
||||
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
return true;
|
||||
}
|
||||
|
||||
se::Object* __jsb_cocos2d_renderer_NodeMemPool_proto = nullptr;
|
||||
se::Class* __jsb_cocos2d_renderer_NodeMemPool_class = nullptr;
|
||||
|
||||
static bool js_renderer_NodeMemPool_updateNodeData(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeMemPool* cobj = (cocos2d::renderer::NodeMemPool*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_NodeMemPool_updateNodeData : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 11) {
|
||||
size_t arg0 = 0;
|
||||
se_object_ptr arg1 = nullptr;
|
||||
se_object_ptr arg2 = nullptr;
|
||||
se_object_ptr arg3 = nullptr;
|
||||
se_object_ptr arg4 = nullptr;
|
||||
se_object_ptr arg5 = nullptr;
|
||||
se_object_ptr arg6 = nullptr;
|
||||
se_object_ptr arg7 = nullptr;
|
||||
se_object_ptr arg8 = nullptr;
|
||||
se_object_ptr arg9 = nullptr;
|
||||
se_object_ptr arg10 = nullptr;
|
||||
ok &= seval_to_size(args[0], &arg0);
|
||||
ok &= seval_to_native_ptr(args[1], &arg1);
|
||||
ok &= seval_to_native_ptr(args[2], &arg2);
|
||||
ok &= seval_to_native_ptr(args[3], &arg3);
|
||||
ok &= seval_to_native_ptr(args[4], &arg4);
|
||||
ok &= seval_to_native_ptr(args[5], &arg5);
|
||||
ok &= seval_to_native_ptr(args[6], &arg6);
|
||||
ok &= seval_to_native_ptr(args[7], &arg7);
|
||||
ok &= seval_to_native_ptr(args[8], &arg8);
|
||||
ok &= seval_to_native_ptr(args[9], &arg9);
|
||||
ok &= seval_to_native_ptr(args[10], &arg10);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeMemPool_updateNodeData : Error processing arguments");
|
||||
cobj->updateNodeData(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 11);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeMemPool_updateNodeData)
|
||||
|
||||
static bool js_renderer_NodeMemPool_getInstance(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cocos2d::renderer::NodeMemPool* result = cocos2d::renderer::NodeMemPool::getInstance();
|
||||
ok &= native_ptr_to_seval<cocos2d::renderer::NodeMemPool>((cocos2d::renderer::NodeMemPool*)result, &s.rval());
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeMemPool_getInstance : 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_NodeMemPool_getInstance)
|
||||
|
||||
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_renderer_NodeMemPool_finalize)
|
||||
|
||||
static bool js_renderer_NodeMemPool_constructor(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeMemPool* cobj = new (std::nothrow) cocos2d::renderer::NodeMemPool();
|
||||
s.thisObject()->setPrivateData(cobj);
|
||||
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
|
||||
return true;
|
||||
}
|
||||
SE_BIND_CTOR(js_renderer_NodeMemPool_constructor, __jsb_cocos2d_renderer_NodeMemPool_class, js_cocos2d_renderer_NodeMemPool_finalize)
|
||||
|
||||
|
||||
|
||||
extern se::Object* __jsb_cocos2d_renderer_MemPool_proto;
|
||||
|
||||
static bool js_cocos2d_renderer_NodeMemPool_finalize(se::State& s)
|
||||
{
|
||||
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::renderer::NodeMemPool)", s.nativeThisObject());
|
||||
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject());
|
||||
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
|
||||
{
|
||||
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
|
||||
cocos2d::renderer::NodeMemPool* cobj = (cocos2d::renderer::NodeMemPool*)s.nativeThisObject();
|
||||
delete cobj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FINALIZE_FUNC(js_cocos2d_renderer_NodeMemPool_finalize)
|
||||
|
||||
bool js_register_renderer_NodeMemPool(se::Object* obj)
|
||||
{
|
||||
auto cls = se::Class::create("NodeMemPool", obj, __jsb_cocos2d_renderer_MemPool_proto, _SE(js_renderer_NodeMemPool_constructor));
|
||||
|
||||
cls->defineFunction("updateNodeData", _SE(js_renderer_NodeMemPool_updateNodeData));
|
||||
cls->defineStaticFunction("getInstance", _SE(js_renderer_NodeMemPool_getInstance));
|
||||
cls->defineFinalizeFunction(_SE(js_cocos2d_renderer_NodeMemPool_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cocos2d::renderer::NodeMemPool>(cls);
|
||||
|
||||
__jsb_cocos2d_renderer_NodeMemPool_proto = cls->getProto();
|
||||
__jsb_cocos2d_renderer_NodeMemPool_class = cls;
|
||||
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
return true;
|
||||
}
|
||||
|
||||
se::Object* __jsb_cocos2d_renderer_RenderDataList_proto = nullptr;
|
||||
se::Class* __jsb_cocos2d_renderer_RenderDataList_class = nullptr;
|
||||
|
||||
@@ -3840,6 +4020,29 @@ static bool js_renderer_RenderDataList_getRenderData(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_RenderDataList_getRenderData)
|
||||
|
||||
static bool js_renderer_RenderDataList_updateMesh(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderDataList* cobj = (cocos2d::renderer::RenderDataList*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_RenderDataList_updateMesh : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 3) {
|
||||
size_t arg0 = 0;
|
||||
se_object_ptr arg1 = nullptr;
|
||||
se_object_ptr arg2 = nullptr;
|
||||
ok &= seval_to_size(args[0], &arg0);
|
||||
ok &= seval_to_native_ptr(args[1], &arg1);
|
||||
ok &= seval_to_native_ptr(args[2], &arg2);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_RenderDataList_updateMesh : Error processing arguments");
|
||||
cobj->updateMesh(arg0, arg1, arg2);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 3);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_RenderDataList_updateMesh)
|
||||
|
||||
static bool js_renderer_RenderDataList_getMeshCount(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderDataList* cobj = (cocos2d::renderer::RenderDataList*)s.nativeThisObject();
|
||||
@@ -3900,6 +4103,7 @@ bool js_register_renderer_RenderDataList(se::Object* obj)
|
||||
auto cls = se::Class::create("RenderDataList", obj, nullptr, _SE(js_renderer_RenderDataList_constructor));
|
||||
|
||||
cls->defineFunction("getRenderData", _SE(js_renderer_RenderDataList_getRenderData));
|
||||
cls->defineFunction("updateMesh", _SE(js_renderer_RenderDataList_updateMesh));
|
||||
cls->defineFunction("getMeshCount", _SE(js_renderer_RenderDataList_getMeshCount));
|
||||
cls->defineFunction("clear", _SE(js_renderer_RenderDataList_clear));
|
||||
cls->defineFinalizeFunction(_SE(js_cocos2d_renderer_RenderDataList_finalize));
|
||||
@@ -4147,6 +4351,25 @@ static bool js_renderer_Assembler_enableOpacityAlwaysDirty(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_Assembler_enableOpacityAlwaysDirty)
|
||||
|
||||
static bool js_renderer_Assembler_beforeFillBuffers(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::Assembler* cobj = (cocos2d::renderer::Assembler*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_Assembler_beforeFillBuffers : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
size_t arg0 = 0;
|
||||
ok &= seval_to_size(args[0], &arg0);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_Assembler_beforeFillBuffers : Error processing arguments");
|
||||
cobj->beforeFillBuffers(arg0);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_Assembler_beforeFillBuffers)
|
||||
|
||||
static bool js_renderer_Assembler_updateIndicesRange(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::Assembler* cobj = (cocos2d::renderer::Assembler*)s.nativeThisObject();
|
||||
@@ -4257,6 +4480,7 @@ bool js_register_renderer_Assembler(se::Object* obj)
|
||||
cls->defineFunction("updateMeshIndex", _SE(js_renderer_Assembler_updateMeshIndex));
|
||||
cls->defineFunction("updateEffect", _SE(js_renderer_Assembler_updateEffect));
|
||||
cls->defineFunction("enableOpacityAlwaysDirty", _SE(js_renderer_Assembler_enableOpacityAlwaysDirty));
|
||||
cls->defineFunction("beforeFillBuffers", _SE(js_renderer_Assembler_beforeFillBuffers));
|
||||
cls->defineFunction("updateIndicesRange", _SE(js_renderer_Assembler_updateIndicesRange));
|
||||
cls->defineFunction("getVertexFormat", _SE(js_renderer_Assembler_getVertexFormat));
|
||||
cls->defineFunction("getEffect", _SE(js_renderer_Assembler_getEffect));
|
||||
@@ -4520,6 +4744,43 @@ static bool js_renderer_RenderFlow_render(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_RenderFlow_render)
|
||||
|
||||
static bool js_renderer_RenderFlow_calculateWorldMatrix(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderFlow* cobj = (cocos2d::renderer::RenderFlow*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_RenderFlow_calculateWorldMatrix : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->calculateWorldMatrix();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_RenderFlow_calculateWorldMatrix)
|
||||
|
||||
static bool js_renderer_RenderFlow_insertNodeLevel(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderFlow* cobj = (cocos2d::renderer::RenderFlow*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_RenderFlow_insertNodeLevel : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
unsigned int arg0 = 0;
|
||||
cocos2d::renderer::RenderFlow::LevelInfo arg1;
|
||||
ok &= seval_to_uint32(args[0], (uint32_t*)&arg0);
|
||||
#pragma warning NO CONVERSION TO NATIVE FOR LevelInfo
|
||||
ok = false;
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_RenderFlow_insertNodeLevel : Error processing arguments");
|
||||
cobj->insertNodeLevel(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_RenderFlow_insertNodeLevel)
|
||||
|
||||
static bool js_renderer_RenderFlow_visit(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderFlow* cobj = (cocos2d::renderer::RenderFlow*)s.nativeThisObject();
|
||||
@@ -4539,6 +4800,42 @@ static bool js_renderer_RenderFlow_visit(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_RenderFlow_visit)
|
||||
|
||||
static bool js_renderer_RenderFlow_calculateLocalMatrix(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderFlow* cobj = (cocos2d::renderer::RenderFlow*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_RenderFlow_calculateLocalMatrix : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
if (argc == 0) {
|
||||
cobj->calculateLocalMatrix();
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_RenderFlow_calculateLocalMatrix)
|
||||
|
||||
static bool js_renderer_RenderFlow_removeNodeLevel(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderFlow* cobj = (cocos2d::renderer::RenderFlow*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_renderer_RenderFlow_removeNodeLevel : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
unsigned int arg0 = 0;
|
||||
cocos2d::Mat4* arg1 = nullptr;
|
||||
ok &= seval_to_uint32(args[0], (uint32_t*)&arg0);
|
||||
ok &= seval_to_native_ptr(args[1], &arg1);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_RenderFlow_removeNodeLevel : Error processing arguments");
|
||||
cobj->removeNodeLevel(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_RenderFlow_removeNodeLevel)
|
||||
|
||||
static bool js_renderer_RenderFlow_getRenderScene(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderFlow* cobj = (cocos2d::renderer::RenderFlow*)s.nativeThisObject();
|
||||
@@ -4593,6 +4890,22 @@ static bool js_renderer_RenderFlow_getDevice(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_RenderFlow_getDevice)
|
||||
|
||||
static bool js_renderer_RenderFlow_getInstance(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 0) {
|
||||
cocos2d::renderer::RenderFlow* result = cocos2d::renderer::RenderFlow::getInstance();
|
||||
ok &= native_ptr_to_seval<cocos2d::renderer::RenderFlow>((cocos2d::renderer::RenderFlow*)result, &s.rval());
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_RenderFlow_getInstance : 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_RenderFlow_getInstance)
|
||||
|
||||
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_renderer_RenderFlow_finalize)
|
||||
|
||||
static bool js_renderer_RenderFlow_constructor(se::State& s)
|
||||
@@ -4635,10 +4948,15 @@ bool js_register_renderer_RenderFlow(se::Object* obj)
|
||||
auto cls = se::Class::create("RenderFlow", obj, nullptr, _SE(js_renderer_RenderFlow_constructor));
|
||||
|
||||
cls->defineFunction("render", _SE(js_renderer_RenderFlow_render));
|
||||
cls->defineFunction("calculateWorldMatrix", _SE(js_renderer_RenderFlow_calculateWorldMatrix));
|
||||
cls->defineFunction("insertNodeLevel", _SE(js_renderer_RenderFlow_insertNodeLevel));
|
||||
cls->defineFunction("visit", _SE(js_renderer_RenderFlow_visit));
|
||||
cls->defineFunction("calculateLocalMatrix", _SE(js_renderer_RenderFlow_calculateLocalMatrix));
|
||||
cls->defineFunction("removeNodeLevel", _SE(js_renderer_RenderFlow_removeNodeLevel));
|
||||
cls->defineFunction("getRenderScene", _SE(js_renderer_RenderFlow_getRenderScene));
|
||||
cls->defineFunction("getModelBatcher", _SE(js_renderer_RenderFlow_getModelBatcher));
|
||||
cls->defineFunction("getDevice", _SE(js_renderer_RenderFlow_getDevice));
|
||||
cls->defineStaticFunction("getInstance", _SE(js_renderer_RenderFlow_getInstance));
|
||||
cls->defineFinalizeFunction(_SE(js_cocos2d_renderer_RenderFlow_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cocos2d::renderer::RenderFlow>(cls);
|
||||
@@ -4929,11 +5247,13 @@ bool register_all_renderer(se::Object* obj)
|
||||
}
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_renderer_RenderFlow(ns);
|
||||
js_register_renderer_MemPool(ns);
|
||||
js_register_renderer_NodeMemPool(ns);
|
||||
js_register_renderer_ProgramLib(ns);
|
||||
js_register_renderer_AssemblerBase(ns);
|
||||
js_register_renderer_Assembler(ns);
|
||||
js_register_renderer_MaskAssembler(ns);
|
||||
js_register_renderer_RenderFlow(ns);
|
||||
js_register_renderer_ProgramLib(ns);
|
||||
js_register_renderer_Light(ns);
|
||||
js_register_renderer_Scene(ns);
|
||||
js_register_renderer_Effect(ns);
|
||||
|
||||
@@ -86,34 +86,34 @@ 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_addChild);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_removeAllChildren);
|
||||
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_addAssembler);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_setChildrenOrderDirty);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getAssembler);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getChildByName);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_setParent);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getName);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_notifyUpdateParent);
|
||||
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_updateMatrix);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getOpacity);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_enableVisit);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_enableUpdateWorldMatrix);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_setName);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_updateRealOpacity);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getCullingMask);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_updateFromJS);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_reset);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getID);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getParent);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_removeChild);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getChildByID);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_disaleUpdateWorldMatrix);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_set3DNode);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_setLocalZOrder);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getName);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_getChildrenCount);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_removeAssembler);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeProxy_NodeProxy);
|
||||
@@ -224,12 +224,30 @@ SE_DECLARE_FUNC(js_renderer_Scene_addLight);
|
||||
SE_DECLARE_FUNC(js_renderer_Scene_removeLight);
|
||||
SE_DECLARE_FUNC(js_renderer_Scene_Scene);
|
||||
|
||||
extern se::Object* __jsb_cocos2d_renderer_MemPool_proto;
|
||||
extern se::Class* __jsb_cocos2d_renderer_MemPool_class;
|
||||
|
||||
bool js_register_cocos2d_renderer_MemPool(se::Object* obj);
|
||||
bool register_all_renderer(se::Object* obj);
|
||||
SE_DECLARE_FUNC(js_renderer_MemPool_updateCommonData);
|
||||
SE_DECLARE_FUNC(js_renderer_MemPool_MemPool);
|
||||
|
||||
extern se::Object* __jsb_cocos2d_renderer_NodeMemPool_proto;
|
||||
extern se::Class* __jsb_cocos2d_renderer_NodeMemPool_class;
|
||||
|
||||
bool js_register_cocos2d_renderer_NodeMemPool(se::Object* obj);
|
||||
bool register_all_renderer(se::Object* obj);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeMemPool_updateNodeData);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeMemPool_getInstance);
|
||||
SE_DECLARE_FUNC(js_renderer_NodeMemPool_NodeMemPool);
|
||||
|
||||
extern se::Object* __jsb_cocos2d_renderer_RenderDataList_proto;
|
||||
extern se::Class* __jsb_cocos2d_renderer_RenderDataList_class;
|
||||
|
||||
bool js_register_cocos2d_renderer_RenderDataList(se::Object* obj);
|
||||
bool register_all_renderer(se::Object* obj);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderDataList_getRenderData);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderDataList_updateMesh);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderDataList_getMeshCount);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderDataList_clear);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderDataList_RenderDataList);
|
||||
@@ -251,6 +269,7 @@ SE_DECLARE_FUNC(js_renderer_Assembler_setRenderDataList);
|
||||
SE_DECLARE_FUNC(js_renderer_Assembler_updateMeshIndex);
|
||||
SE_DECLARE_FUNC(js_renderer_Assembler_updateEffect);
|
||||
SE_DECLARE_FUNC(js_renderer_Assembler_enableOpacityAlwaysDirty);
|
||||
SE_DECLARE_FUNC(js_renderer_Assembler_beforeFillBuffers);
|
||||
SE_DECLARE_FUNC(js_renderer_Assembler_updateIndicesRange);
|
||||
SE_DECLARE_FUNC(js_renderer_Assembler_getVertexFormat);
|
||||
SE_DECLARE_FUNC(js_renderer_Assembler_getEffect);
|
||||
@@ -277,10 +296,15 @@ extern se::Class* __jsb_cocos2d_renderer_RenderFlow_class;
|
||||
bool js_register_cocos2d_renderer_RenderFlow(se::Object* obj);
|
||||
bool register_all_renderer(se::Object* obj);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_render);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_calculateWorldMatrix);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_insertNodeLevel);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_visit);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_calculateLocalMatrix);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_removeNodeLevel);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_getRenderScene);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_getModelBatcher);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_getDevice);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_getInstance);
|
||||
SE_DECLARE_FUNC(js_renderer_RenderFlow_RenderFlow);
|
||||
|
||||
extern se::Object* __jsb_cocos2d_renderer_MaskAssembler_proto;
|
||||
|
||||
@@ -560,30 +560,6 @@ static bool js_renderer_Effect_init(se::State& s)
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_Effect_init);
|
||||
|
||||
static bool js_renderer_RenderDataList_updateMesh(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::RenderDataList* cobj = (cocos2d::renderer::RenderDataList*)s.nativeThisObject();
|
||||
CC_UNUSED bool ok = true;
|
||||
const auto& args = s.args();
|
||||
uint32_t index = 0;
|
||||
ok = seval_to_uint32(args[0], &index);
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_RenderDataList_updateMesh: Convert index failed!");
|
||||
cobj->updateMesh(index, args[1].toObject(), args[2].toObject());
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_RenderDataList_updateMesh);
|
||||
|
||||
static bool js_renderer_NodeProxy_updateJSTRS(se::State& s)
|
||||
{
|
||||
cocos2d::renderer::NodeProxy* cobj = (cocos2d::renderer::NodeProxy*)s.nativeThisObject();
|
||||
const auto& args = s.args();
|
||||
bool ok = args[0].isObject() && args[0].toObject()->isTypedArray();
|
||||
SE_PRECONDITION2(ok, false, "js_renderer_NodeProxy_updateJSTRS : Invalid JS TRS Object");
|
||||
cobj->updateJSTRS(args[0].toObject());
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FUNC(js_renderer_NodeProxy_updateJSTRS);
|
||||
|
||||
bool jsb_register_renderer_manual(se::Object* global)
|
||||
{
|
||||
// Get the ns
|
||||
@@ -627,12 +603,6 @@ bool jsb_register_renderer_manual(se::Object* global)
|
||||
// Effect
|
||||
__jsb_cocos2d_renderer_Effect_proto->defineFunction("init", _SE(js_renderer_Effect_init));
|
||||
|
||||
// RenderDataList
|
||||
__jsb_cocos2d_renderer_RenderDataList_proto->defineFunction("updateMesh", _SE(js_renderer_RenderDataList_updateMesh));
|
||||
|
||||
// NodeProxy
|
||||
__jsb_cocos2d_renderer_NodeProxy_proto->defineFunction("updateJSTRS", _SE(js_renderer_NodeProxy_updateJSTRS));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ macro_judgement = #if (USE_GFX_RENDERER > 0) && (CC_TARGET_PLATFORM == CC_PLATF
|
||||
|
||||
android_headers =
|
||||
|
||||
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
|
||||
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include -I%(cocosdir)s/external/android/arm64-v8a/include/v8
|
||||
|
||||
clang_headers =
|
||||
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
|
||||
@@ -32,7 +32,7 @@ replace_headers =
|
||||
# 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 = ForwardRenderer BaseRenderer Camera Light Scene View ProgramLib Effect Pass Mesh NodeProxy Assembler RenderFlow CustomAssembler MaskAssembler RenderDataList AssemblerBase TiledMapAssembler
|
||||
classes = ForwardRenderer BaseRenderer Camera Light Scene View ProgramLib Effect Pass Mesh NodeProxy Assembler RenderFlow CustomAssembler MaskAssembler RenderDataList AssemblerBase TiledMapAssembler NodeMemPool MemPool
|
||||
|
||||
classes_need_extend = Assembler CustomAssembler MaskAssembler AssemblerBase TiledMapAssembler
|
||||
|
||||
@@ -49,10 +49,11 @@ skip = BaseRenderer::[registerStage],
|
||||
View::[getForward getPosition],
|
||||
Scene::[getModel removeModel addModel removeModels],
|
||||
Effect::[getProperties setProperty getDefines getDefinesKey extractDefines getTechniques init copy],
|
||||
NodeProxy::[getWorldMatrix updateJSTRS getWorldPosition getWorldRT getPosition getScale getRotation visitAsRoot],
|
||||
RenderDataList::[updateMesh],
|
||||
NodeProxy::[getWorldMatrix updateJSTRS getWorldPosition getWorldRT getPosition getScale getRotation visitAsRoot addChild removeChild removeAllChildren setParent],
|
||||
Pass::[setStencilTest copy],
|
||||
Technique::[setPass getParameters getPasses getStageIDs copy]
|
||||
Technique::[setPass getParameters getPasses getStageIDs copy],
|
||||
MemPool::[getCommonPool getCommonUnit],
|
||||
NodeMemPool::[getUnit getNodePool]
|
||||
|
||||
rename_classes = BaseRenderer::Base,
|
||||
Effect::EffectNative,
|
||||
|
||||
Reference in New Issue
Block a user