Merge pull request #10067 from dumganhar/v3.6.0-merge-native

V3.6.0 merge engine-native code
This commit is contained in:
minggo
2022-02-10 14:05:09 +08:00
committed by GitHub
701 changed files with 100192 additions and 25809 deletions
+6
View File
@@ -16,3 +16,9 @@ SpacesBeforeTrailingComments: 1
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
---
Language: Cpp
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Right
+3 -2
View File
@@ -139,6 +139,7 @@ jobs:
touch build-mac/proj/cfg.cmake
echo "set(CC_USE_VULKAN OFF)" >> build-mac/proj/cfg.cmake
echo "set(CC_USE_GLES2 OFF)" >> build-mac/proj/cfg.cmake
echo "set(CC_USE_GLES3 OFF)" >> build-mac/proj/cfg.cmake
echo "set(CC_USE_METAL ON)" >> build-mac/proj/cfg.cmake
echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-mac/proj/cfg.cmake
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-mac/proj/cfg.cmake
@@ -146,7 +147,7 @@ jobs:
RES_DIR=$COCOS2DX_ROOT/templates/mac/build-mac
cd build-mac
cmake ../ -GXcode -DCC_USE_GLES3=ON -DCMAKE_OSX_ARCHITECTURES=x86_64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS2DX_ROOT
cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS2DX_ROOT
set +e
cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch x86_64
retcode=$?
@@ -162,7 +163,7 @@ jobs:
cd ..
mkdir build-mac-apple-silicon
cd build-mac-apple-silicon
cmake ../ -GXcode -DCC_USE_GLES3=OFF -DCMAKE_OSX_ARCHITECTURES=arm64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS2DX_ROOT
cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=arm64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS2DX_ROOT
cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch arm64
echo "Compile MacOSX ARM64 Release Done!"
+3
View File
@@ -54,6 +54,9 @@ jobs:
- exclude: 'cocos/base/etc1.*'
- exclude: 'cocos/base/etc2.*'
- exclude: 'cocos/bindings/manual/jsb_global.cpp'
- exclude: 'cocos/bindings/manual/jsb_dragonbones_manual.cpp'
- exclude: 'cocos/bindings/manual/jsb_spine_manual.cpp'
- exclude: 'cocos/bindings/manual/jsb_socketio.cpp'
- exclude: 'cocos/bindings/manual/jsb_conversions.*'
- exclude: 'cocos/bindings/jswrapper/v8/debugger/**'
- exclude: 'cocos/audio/android/audio_utils/**'
+7 -6
View File
@@ -30,9 +30,10 @@ jobs:
cmake -B tests/unit-test/build -S tests/unit-test -G"Visual Studio 16 2019" -A win32
cmake --build tests/unit-test/build --config Release
./tests/unit-test/build/src/Release/CocosTest.exe
- name: Run Module Tests
shell: bash
run: |
cd tests/module-tests
bash run-test-windows.sh
#### TODO(PatriceJiang): model split
# - name: Run Module Tests
# shell: bash
# run: |
# cd tests/module-tests
# bash run-test-windows.sh
+2
View File
@@ -55,6 +55,8 @@ bin/
obj/
gen/
assets/
!/cocos/core/assets
!/cocos/3d/assets
local.properties
# Ignore python compiled files
+605 -116
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -99,9 +99,8 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if("$ENV{COCOS_ENGINE_DEV}" EQUAL "1")
set(WERROR_FLAGS "-Werror")
set(WERROR_FLAGS "-Werror") # -Wshorten-64-to-32 -Werror=return-type
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(WERROR_FLAGS "/WX")
endif()
@@ -135,7 +134,7 @@ macro(cocos_source_files)
set(list_var "${ARGN}")
set(TWAE ON)
set(ACCEPT_MN OFF)
set(MODULE_NAME "COCOS2D")
set(MODULE_NAME "COCOS")
foreach(src IN LISTS list_var)
if(ACCEPT_MN)
set(MODULE_NAME "${src}")
@@ -187,3 +186,7 @@ function(cc_win32_definations target)
SE_ENABLE_INSPECTOR
)
endfunction()
find_program(NODE_EXECUTABLE NAMES node)
find_program(TSC_EXECUTABLE NAMES tsc)
+34
View File
@@ -0,0 +1,34 @@
const zlib = require('zlib');
const fs = require('fs');
const process = require('process');
const writeIfDifferent = require('./utils').writeIfDifferent;
if (process.argv.length !== 6) {
console.error('bad argument');
console.error(' - input file');
console.error(' - export var');
console.error(' - template file');
console.error(' - output file');
process.exit(-1);
}
const inputFile = process.argv[2];
const exportVar = process.argv[3];
const template = process.argv[4];
const outputFile = process.argv[5];
let data = require(inputFile)[exportVar];
let encoded = zlib.gzipSync(JSON.stringify(data, null, 2)).toString("base64");
let array = [];
let start = 0, last = encoded.length;
const charPerRow = 118;
while (start < last) {
array.push(`"${encoded.substr(start, charPerRow)}"`);
start += charPerRow;
}
encoded = array.join("\n");
let replaceData = fs.readFileSync(template).toString('utf-8').replace("${PLACE_HOLDER}", encoded);
writeIfDifferent(outputFile, replaceData, { encoding: 'utf-8' });
process.exit(0);
+55
View File
@@ -0,0 +1,55 @@
const zlib = require('zlib');
const fs = require('fs');
const process = require('process');
const writeIfDifferent = require('./utils').writeIfDifferent;
const VERBOSE = false;
if (process.argv.length !== 6) {
console.error('bad argument');
console.error(' - input file');
console.error(' - export var');
console.error(' - template file');
console.error(' - output file');
process.exit(-1);
}
const inputFile = process.argv[2];
const exportVar = process.argv[3];
const template = process.argv[4];
const outputFile = process.argv[5];
if(VERBOSE) {
console.log(`--processing ${inputFile} : ${exportVar}`);
}
const shaders = require(inputFile)[exportVar];
let newShaders = shaders.map((eff)=> '{' + eff.map(s => {
let o = {...s};
let arr = ['{\n'];
let shaders = [];
for(let i in o) {
let gziped = zlib.gzipSync(o[i]).toString("base64");
shaders.push(` {"${i}", GzipedString("${gziped}")}`);
}
arr.push(shaders.join(",\n"));
arr.push('\n}');
return arr.join("");
}).join("\n,") + '}');
let encoded = newShaders.join(',\n');
if(VERBOSE) {
console.log(`--gen ${outputFile} : ${exportVar}`);
}
let replaceData = fs.readFileSync(template).toString('utf-8').replace("${PLACE_HOLDER}", encoded);
writeIfDifferent(outputFile, replaceData, {encoding: 'utf-8'});
if(VERBOSE) {
console.log(`--done ${outputFile} : ${exportVar}`);
}
process.exit(0);
+38
View File
@@ -0,0 +1,38 @@
const fs = require('fs');
function all_eql(a, b) {
if (a.length !== b.length) {
return false;
}
const l = a.length;
for (let i = 0; i < l; i++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
function equals_ignore_spaces(a, b) {
const lines_a = a.split('\n').map(x => x.trim());
const lines_b = b.split('\n').map(x => x.trim());
return all_eql(lines_a, lines_b);
}
function writeIfDifferent(file, data, args) {
if (fs.existsSync(file)) {
let content = fs.readFileSync(file, args).toString(args.encoding);
if (equals_ignore_spaces(content, data)) {
console.log(`Skip update ${file}`);
return;
}
}
fs.writeFileSync(file, data, args);
console.log(` write to file ${file}`);
}
exports.writeIfDifferent = writeIfDifferent;
+955
View File
@@ -0,0 +1,955 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/assets/Mesh.h"
#include "3d/assets/Morph.h"
#include "3d/assets/Skeleton.h"
#include "3d/misc/BufferBlob.h"
#include "core/DataView.h"
#include "core/assets/RenderingSubMesh.h"
#include "math/Quaternion.h"
#include "boost/container_hash/hash.hpp"
#include "renderer/gfx-base/GFXDevice.h"
namespace cc {
namespace {
uint32_t getOffset(const gfx::AttributeList &attributes, index_t attributeIndex) {
uint32_t result = 0;
for (index_t i = 0; i < attributeIndex; ++i) {
const auto &attribute = attributes[i];
result += gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attribute.format)].size;
}
return result;
}
//
uint32_t getComponentByteLength(gfx::Format format) {
const auto &info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(format)];
return info.size / info.count;
}
using DataReaderCallback = std::function<TypedArrayElementType(uint32_t)>;
DataReaderCallback getReader(const DataView &dataView, gfx::Format format) {
const auto & info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(format)];
const uint32_t stride = info.size / info.count;
switch (info.type) {
case gfx::FormatType::UNORM: {
switch (stride) {
case 1: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getUint8(offset); };
case 2: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getUint16(offset); };
case 4: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getUint32(offset); };
default:
break;
}
break;
}
case gfx::FormatType::SNORM: {
switch (stride) {
case 1: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getInt8(offset); };
case 2: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getInt16(offset); };
case 4: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getInt32(offset); };
default:
break;
}
break;
}
case gfx::FormatType::INT: {
switch (stride) {
case 1: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getInt8(offset); };
case 2: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getInt16(offset); };
case 4: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getInt32(offset); };
default:
break;
}
break;
}
case gfx::FormatType::UINT: {
switch (stride) {
case 1: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getUint8(offset); };
case 2: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getUint16(offset); };
case 4: return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getUint32(offset); };
default:
break;
}
break;
}
case gfx::FormatType::FLOAT: {
return [&](uint32_t offset) -> TypedArrayElementType { return dataView.getFloat32(offset); };
}
default:
break;
}
return nullptr;
}
using DataWritterCallback = std::function<void(uint32_t, TypedArrayElementType)>;
DataWritterCallback getWriter(DataView &dataView, gfx::Format format) {
const auto & info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(format)];
const uint32_t stride = info.size / info.count;
switch (info.type) {
case gfx::FormatType::UNORM: {
switch (stride) {
case 1: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setUint8(offset, cc::get<uint8_t>(value)); };
case 2: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setUint16(offset, cc::get<uint16_t>(value)); };
case 4: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setUint32(offset, cc::get<uint32_t>(value)); };
default:
break;
}
break;
}
case gfx::FormatType::SNORM: {
switch (stride) {
case 1: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setInt8(offset, cc::get<int8_t>(value)); };
case 2: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setInt16(offset, cc::get<int8_t>(value)); };
case 4: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setInt32(offset, cc::get<int8_t>(value)); };
default:
break;
}
break;
}
case gfx::FormatType::INT: {
switch (stride) {
case 1: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setInt8(offset, cc::get<int8_t>(value)); };
case 2: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setInt16(offset, cc::get<int16_t>(value)); };
case 4: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setInt32(offset, cc::get<int32_t>(value)); };
default:
break;
}
break;
}
case gfx::FormatType::UINT: {
switch (stride) {
case 1: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setUint8(offset, cc::get<uint8_t>(value)); };
case 2: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setUint16(offset, cc::get<uint16_t>(value)); };
case 4: return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setUint32(offset, cc::get<uint32_t>(value)); };
default:
break;
}
break;
}
case gfx::FormatType::FLOAT: {
return [&](uint32_t offset, const TypedArrayElementType &value) { dataView.setFloat32(offset, cc::get<float>(value)); };
}
default:
break;
}
return nullptr;
}
} // namespace
Mesh::~Mesh() = default;
cc::any Mesh::getNativeAsset() const {
return _data; //cjh FIXME: need copy? could be _data pointer?
}
void Mesh::setNativeAsset(const cc::any &obj) {
auto *p = cc::any_cast<ArrayBuffer *>(obj);
if (p != nullptr) {
_data = Uint8Array(p);
}
}
uint32_t Mesh::getSubMeshCount() const {
return static_cast<uint32_t>(_renderingSubMeshes.size());
}
const Vec3 &Mesh::getMinPosition() const {
return _struct.minPosition.has_value() ? _struct.minPosition.value() : Vec3::ZERO;
}
const Vec3 &Mesh::getMaxPosition() const {
return _struct.maxPosition.has_value() ? _struct.maxPosition.value() : Vec3::ZERO;
}
uint64_t Mesh::getHash() {
if (_hash == 0) {
std::size_t seed = 666;
boost::hash_range(seed, _data.buffer()->getData(), _data.buffer()->getData() + _data.length());
_hash = static_cast<uint32_t>(seed);
}
return _hash;
}
const Mesh::JointBufferIndicesType &Mesh::getJointBufferIndices() {
if (!_jointBufferIndices.empty()) {
return _jointBufferIndices;
}
_jointBufferIndices.reserve(_struct.primitives.size());
for (auto &p : _struct.primitives) {
_jointBufferIndices.emplace_back(p.jointMapIndex.has_value() ? p.jointMapIndex.value() : 0);
}
return _jointBufferIndices;
}
void Mesh::initialize() {
if (_initialized) {
return;
}
if (!_data.buffer()) {
return;
}
_initialized = true;
auto & buffer = _data;
gfx::Device * gfxDevice = gfx::Device::getInstance();
auto vertexBuffers = createVertexBuffers(gfxDevice, buffer.buffer());
gfx::BufferList indexBuffers;
std::vector<IntrusivePtr<RenderingSubMesh>> subMeshes;
for (size_t i = 0; i < _struct.primitives.size(); i++) {
auto &prim = _struct.primitives[i];
if (prim.vertexBundelIndices.empty()) {
continue;
}
gfx::Buffer *indexBuffer = nullptr;
if (prim.indexView.has_value()) {
const auto &idxView = prim.indexView.value();
uint32_t dstStride = idxView.stride;
uint32_t dstSize = idxView.length;
if (dstStride == 4 && !gfxDevice->hasFeature(gfx::Feature::ELEMENT_INDEX_UINT)) {
uint32_t vertexCount = _struct.vertexBundles[prim.vertexBundelIndices[0]].view.count;
if (vertexCount >= 65536) {
//cjh warnID(10001, vertexCount, 65536);
continue; // Ignore this primitive
}
dstStride >>= 1; // Reduce to short.
dstSize >>= 1;
}
indexBuffer = gfxDevice->createBuffer(gfx::BufferInfo{
gfx::BufferUsageBit::INDEX,
gfx::MemoryUsageBit::DEVICE,
dstSize,
dstStride,
});
indexBuffers.emplace_back(indexBuffer);
const uint8_t *ib = buffer.buffer()->getData() + idxView.offset;
// ib = new (getIndexStrideCtor(idxView.stride))(buffer, idxView.offset, idxView.count);
if (idxView.stride != dstStride) {
//cjh need in c++? ib = getIndexStrideCtor(dstStride).from(ib);
}
indexBuffer->update(ib);
}
gfx::BufferList vbReference;
vbReference.reserve(prim.vertexBundelIndices.size());
for (const auto &idx : prim.vertexBundelIndices) {
vbReference.emplace_back(vertexBuffers[idx]);
}
gfx::AttributeList gfxAttributes;
if (!prim.vertexBundelIndices.empty()) {
uint32_t idx = prim.vertexBundelIndices[0];
const IVertexBundle & vertexBundle = _struct.vertexBundles[idx];
const gfx::AttributeList &attrs = vertexBundle.attributes;
gfxAttributes.resize(attrs.size());
for (size_t j = 0; j < attrs.size(); ++j) {
const auto &attr = attrs[j];
gfxAttributes[j] = gfx::Attribute{attr.name, attr.format, attr.isNormalized, attr.stream, attr.isInstanced, attr.location};
}
}
auto *subMesh = new RenderingSubMesh(vbReference, gfxAttributes, prim.primitiveMode, indexBuffer);
subMesh->setMesh(this);
subMesh->setSubMeshIdx(static_cast<uint32_t>(i));
subMeshes.emplace_back(subMesh);
}
_renderingSubMeshes = subMeshes;
if (_struct.morph.has_value()) {
morphRendering = createMorphRendering(this, gfxDevice);
}
}
void Mesh::destroyRenderingMesh() {
if (!_renderingSubMeshes.empty()) {
for (auto &submesh : _renderingSubMeshes) {
submesh->destroy();
}
_renderingSubMeshes.clear();
_initialized = false;
}
}
void Mesh::assign(const IStruct &structInfo, const Uint8Array &data) {
reset({structInfo, data});
}
void Mesh::reset(ICreateInfo &&info) {
destroyRenderingMesh();
_struct = std::move(info.structInfo);
_data = std::move(info.data);
_hash = 0;
}
Mesh::BoneSpaceBounds Mesh::getBoneSpaceBounds(Skeleton *skeleton) {
auto iter = _boneSpaceBounds.find(skeleton->getHash());
if (iter != _boneSpaceBounds.end()) {
return iter->second;
}
Vec3 v32;
BoneSpaceBounds & bounds = _boneSpaceBounds[skeleton->getHash()];
std::vector<bool> valid;
const auto & bindposes = skeleton->getBindposes();
valid.reserve(bindposes.size());
for (size_t i = 0; i < bindposes.size(); i++) {
bounds.emplace_back(new geometry::AABB{
std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity(),
-std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity()});
valid.emplace_back(false);
}
const auto &primitives = _struct.primitives;
for (index_t p = 0; p < primitives.size(); p++) {
const auto joints = readAttribute(p, gfx::ATTR_NAME_JOINTS);
const auto weights = readAttribute(p, gfx::ATTR_NAME_WEIGHTS);
const auto positions = readAttribute(p, gfx::ATTR_NAME_POSITION);
if (joints.index() == 0 || weights.index() == 0 || positions.index() == 0) {
continue;
}
uint32_t vertCount = std::min({getTypedArrayLength(joints) / 4,
getTypedArrayLength(weights) / 4,
getTypedArrayLength(positions) / 3});
for (uint32_t i = 0; i < vertCount; i++) {
Vec3 v31{
getTypedArrayValue<float>(positions, 3 * i + 0),
getTypedArrayValue<float>(positions, 3 * i + 1),
getTypedArrayValue<float>(positions, 3 * i + 2)};
for (uint32_t j = 0; j < 4; ++j) {
const uint32_t idx = 4 * i + j;
const auto joint = getTypedArrayValue<int32_t>(joints, idx);
if (std::fabs(getTypedArrayValue<float>(weights, idx)) < FLT_EPSILON || joint >= bindposes.size()) {
continue;
}
Vec3::transformMat4(v31, bindposes[joint], &v32);
valid[joint] = true;
auto &b = bounds[joint];
Vec3::min(b->center, v32, &b->center);
Vec3::max(b->halfExtents, v32, &b->halfExtents);
}
}
}
for (size_t i = 0; i < bindposes.size(); i++) {
auto &b = bounds[i];
if (!valid[i]) {
bounds[i] = {};
} else {
geometry::AABB::fromPoints(b->center, b->halfExtents, b);
}
}
return bounds;
}
bool Mesh::merge(Mesh *mesh, const Mat4 *worldMatrix /* = nullptr */, bool validate /* = false*/) {
if (validate) {
if (!validateMergingMesh(mesh)) {
return false;
}
}
Vec3 vec3Temp;
Quaternion rotate;
geometry::AABB boundingBox;
if (worldMatrix != nullptr) {
worldMatrix->getRotation(&rotate);
}
if (!_initialized) {
auto structInfo = mesh->_struct; //NOTE: Need copy struct, so don't use referece
Uint8Array data{mesh->_data.slice()};
if (worldMatrix != nullptr) {
if (structInfo.maxPosition.has_value() && structInfo.minPosition.has_value()) {
Vec3::add(structInfo.maxPosition.value(), structInfo.minPosition.value(), &boundingBox.center);
boundingBox.center.scale(0.5F);
Vec3::subtract(structInfo.maxPosition.value(), structInfo.minPosition.value(), &boundingBox.halfExtents);
boundingBox.halfExtents.scale(0.5F);
boundingBox.transform(*worldMatrix, &boundingBox);
Vec3::add(boundingBox.center, boundingBox.halfExtents, &structInfo.maxPosition.value());
Vec3::subtract(boundingBox.center, boundingBox.halfExtents, &structInfo.minPosition.value());
}
for (auto &vtxBdl : structInfo.vertexBundles) {
for (int j = 0; j < vtxBdl.attributes.size(); j++) {
if (vtxBdl.attributes[j].name == gfx::ATTR_NAME_POSITION || vtxBdl.attributes[j].name == gfx::ATTR_NAME_NORMAL) {
const gfx::Format format = vtxBdl.attributes[j].format;
DataView inputView(data.buffer(), vtxBdl.view.offset + getOffset(vtxBdl.attributes, j));
auto reader = getReader(inputView, format);
if (reader == nullptr) {
continue;
}
auto writer = getWriter(inputView, format);
if (writer == nullptr) {
continue;
}
const uint32_t vertexCount = vtxBdl.view.count;
const uint32_t vertexStride = vtxBdl.view.stride;
const uint32_t attrComponentByteLength = getComponentByteLength(format);
for (uint32_t vtxIdx = 0; vtxIdx < vertexCount; vtxIdx++) {
const uint32_t xOffset = vtxIdx * vertexStride;
const uint32_t yOffset = xOffset + attrComponentByteLength;
const uint32_t zOffset = yOffset + attrComponentByteLength;
vec3Temp.set(
getTypedArrayElementValue<float>(reader(xOffset)),
getTypedArrayElementValue<float>(reader(yOffset)),
getTypedArrayElementValue<float>(reader(zOffset)));
const auto &attrName = vtxBdl.attributes[j].name;
if (attrName == gfx::ATTR_NAME_POSITION) {
vec3Temp.transformMat4(vec3Temp, *worldMatrix);
} else if (attrName == gfx::ATTR_NAME_NORMAL) {
vec3Temp.transformQuat(rotate);
}
writer(xOffset, vec3Temp.x);
writer(yOffset, vec3Temp.y);
writer(zOffset, vec3Temp.z);
}
}
}
}
}
reset({structInfo, data});
initialize();
return true;
}
// merge buffer
BufferBlob bufferBlob;
// merge vertex buffer
uint32_t vertCount = 0;
uint32_t vertStride = 0;
uint32_t srcOffset = 0;
uint32_t dstOffset = 0;
uint32_t srcAttrOffset = 0;
uint32_t srcVBOffset = 0;
uint32_t dstVBOffset = 0;
uint32_t attrSize = 0;
bool hasAttr = false;
std::vector<Mesh::IVertexBundle> vertexBundles;
vertexBundles.resize(_struct.vertexBundles.size());
for (size_t i = 0; i < _struct.vertexBundles.size(); ++i) {
Uint8Array dstAttrView;
const auto &bundle = _struct.vertexBundles[i];
auto & dstBundle = mesh->_struct.vertexBundles[i];
srcOffset = bundle.view.offset;
dstOffset = dstBundle.view.offset;
vertStride = bundle.view.stride;
vertCount = bundle.view.count + dstBundle.view.count;
auto * vb = new ArrayBuffer(vertCount * vertStride);
Uint8Array vbView(vb);
Uint8Array srcVBView = _data.subarray(srcOffset, srcOffset + bundle.view.length);
srcOffset += srcVBView.length();
Uint8Array dstVBView = mesh->_data.subarray(dstOffset, dstOffset + dstBundle.view.length);
dstOffset += dstVBView.length();
vbView.set(srcVBView);
srcAttrOffset = 0;
for (const auto &attr : bundle.attributes) {
dstVBOffset = 0;
hasAttr = false;
for (const auto &dstAttr : dstBundle.attributes) {
if (attr.name == dstAttr.name && attr.format == dstAttr.format) {
hasAttr = true;
break;
}
dstVBOffset += gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(dstAttr.format)].size;
}
if (hasAttr) {
attrSize = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attr.format)].size;
srcVBOffset = bundle.view.length + srcAttrOffset;
for (uint32_t v = 0; v < dstBundle.view.count; ++v) {
dstAttrView = dstVBView.subarray(dstVBOffset, dstVBOffset + attrSize);
vbView.set(dstAttrView, srcVBOffset);
if ((attr.name == gfx::ATTR_NAME_POSITION || attr.name == gfx::ATTR_NAME_NORMAL) && worldMatrix != nullptr) {
Float32Array f32Temp(vbView.buffer(), srcVBOffset, 3);
vec3Temp.set(f32Temp[0], f32Temp[1], f32Temp[2]);
if (attr.name == gfx::ATTR_NAME_POSITION) {
vec3Temp.transformMat4(vec3Temp, *worldMatrix);
} else if (attr.name == gfx::ATTR_NAME_NORMAL) {
vec3Temp.transformQuat(rotate);
}
f32Temp[0] = vec3Temp.x;
f32Temp[1] = vec3Temp.y;
f32Temp[2] = vec3Temp.z;
}
srcVBOffset += bundle.view.stride;
dstVBOffset += dstBundle.view.stride;
}
}
srcAttrOffset += gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attr.format)].size;
}
auto &vertexBundle = vertexBundles[i];
vertexBundle.attributes = bundle.attributes,
vertexBundle.view.offset = bufferBlob.getLength();
vertexBundle.view.length = vb->byteLength();
vertexBundle.view.count = vertCount;
vertexBundle.view.stride = vertStride;
bufferBlob.addBuffer(vb);
}
// merge index buffer
uint32_t idxCount = 0;
uint32_t idxStride = 2;
uint32_t vertBatchCount = 0;
std::vector<Mesh::ISubMesh> primitives;
primitives.resize(_struct.primitives.size());
for (size_t i = 0; i < _struct.primitives.size(); ++i) {
const auto &prim = _struct.primitives[i];
auto & dstPrim = mesh->_struct.primitives[i];
primitives[i].primitiveMode = prim.primitiveMode;
primitives[i].vertexBundelIndices = prim.vertexBundelIndices;
for (const uint32_t bundleIdx : prim.vertexBundelIndices) {
vertBatchCount = std::max(vertBatchCount, _struct.vertexBundles[bundleIdx].view.count);
}
if (prim.indexView.has_value() && dstPrim.indexView.has_value()) {
idxCount = prim.indexView.value().count;
idxCount += dstPrim.indexView.value().count;
srcOffset = prim.indexView.value().offset;
dstOffset = dstPrim.indexView.value().offset;
if (idxCount < 256) {
idxStride = 1;
} else if (idxCount < 65536) {
idxStride = 2;
} else {
idxStride = 4;
}
auto *ib = new ArrayBuffer(idxCount * idxStride);
TypedArray ibView;
TypedArray srcIBView;
TypedArray dstIBView;
if (idxStride == 2) {
ibView = Uint16Array(ib);
} else if (idxStride == 1) {
ibView = Uint8Array(ib);
} else { // Uint32
ibView = Uint32Array(ib);
}
// merge src indices
if (prim.indexView.value().stride == 2) {
srcIBView = Uint16Array(_data.buffer(), srcOffset, prim.indexView.value().count);
} else if (prim.indexView.value().stride == 1) {
srcIBView = Uint8Array(_data.buffer(), srcOffset, prim.indexView.value().count);
} else { // Uint32
srcIBView = Uint32Array(_data.buffer(), srcOffset, prim.indexView.value().count);
}
//
if (idxStride == prim.indexView.value().stride) {
switch (idxStride) {
case 2:
cc::get<Uint16Array>(ibView).set(cc::get<Uint16Array>(srcIBView));
break;
case 1:
cc::get<Uint8Array>(ibView).set(cc::get<Uint8Array>(srcIBView));
break;
default:
cc::get<Uint32Array>(ibView).set(cc::get<Uint32Array>(srcIBView));
break;
}
} else {
for (uint32_t n = 0; n < prim.indexView.value().count; ++n) {
if (idxStride == 2) {
cc::get<Uint16Array>(ibView)[n] = static_cast<uint16_t>(getTypedArrayValue<uint32_t>(srcIBView, n));
} else if (idxStride == 1) {
cc::get<Uint8Array>(ibView)[n] = static_cast<uint8_t>(getTypedArrayValue<uint32_t>(srcIBView, n));
} else {
cc::get<Uint32Array>(ibView)[n] = getTypedArrayValue<uint32_t>(srcIBView, n);
}
}
}
srcOffset += prim.indexView.value().length;
// merge dst indices
uint32_t indexViewStride = dstPrim.indexView.value().stride;
if (indexViewStride == 2) {
dstIBView = Uint16Array(mesh->_data.buffer(), dstOffset, dstPrim.indexView->count);
} else if (indexViewStride == 1) {
dstIBView = Uint8Array(mesh->_data.buffer(), dstOffset, dstPrim.indexView->count);
} else { // Uint32
dstIBView = Uint32Array(mesh->_data.buffer(), dstOffset, dstPrim.indexView->count);
}
for (uint32_t n = 0; n < dstPrim.indexView.value().count; ++n) {
if (idxStride == 2) {
cc::get<Uint16Array>(ibView)[prim.indexView->count + n] =
vertBatchCount + static_cast<uint16_t>(getTypedArrayValue<uint32_t>(dstIBView, n));
} else if (idxStride == 1) {
cc::get<Uint8Array>(ibView)[prim.indexView->count + n] =
vertBatchCount + static_cast<uint8_t>(getTypedArrayValue<uint32_t>(dstIBView, n));
} else {
cc::get<Uint32Array>(ibView)[prim.indexView->count + n] =
vertBatchCount + getTypedArrayValue<uint32_t>(dstIBView, n);
}
}
dstOffset += dstPrim.indexView.value().length;
IBufferView indexView;
indexView.offset = bufferBlob.getLength();
indexView.length = ib->byteLength();
indexView.count = idxCount;
indexView.stride = idxStride;
primitives[i].indexView = indexView;
bufferBlob.setNextAlignment(idxStride);
bufferBlob.addBuffer(ib);
}
}
// Create mesh struct.
Mesh::IStruct meshStruct;
meshStruct.vertexBundles = vertexBundles;
meshStruct.primitives = primitives;
meshStruct.minPosition = _struct.minPosition;
meshStruct.maxPosition = _struct.maxPosition;
if (meshStruct.minPosition && mesh->_struct.minPosition && meshStruct.maxPosition && mesh->_struct.maxPosition) {
if (worldMatrix != nullptr) {
if (mesh->_struct.maxPosition.has_value() && mesh->_struct.minPosition.has_value()) {
Vec3::add(mesh->_struct.maxPosition.value(), mesh->_struct.minPosition.value(), &boundingBox.center);
}
boundingBox.center.scale(0.5F);
if (mesh->_struct.maxPosition.has_value() && mesh->_struct.minPosition.has_value()) {
Vec3::subtract(mesh->_struct.maxPosition.value(), mesh->_struct.minPosition.value(), &boundingBox.halfExtents);
}
boundingBox.halfExtents.scale(0.5F);
boundingBox.transform(*worldMatrix, &boundingBox);
Vec3::add(boundingBox.center, boundingBox.halfExtents, &vec3Temp);
Vec3::max(meshStruct.maxPosition.value(), vec3Temp, &meshStruct.maxPosition.value());
Vec3::subtract(boundingBox.center, boundingBox.halfExtents, &vec3Temp);
Vec3::min(meshStruct.minPosition.value(), vec3Temp, &meshStruct.minPosition.value());
} else {
Vec3::min(meshStruct.minPosition.value(), mesh->_struct.minPosition.value(), &meshStruct.minPosition.value());
Vec3::max(meshStruct.maxPosition.value(), mesh->_struct.maxPosition.value(), &meshStruct.maxPosition.value());
}
}
// Create mesh.
reset({std::move(meshStruct),
std::move(Uint8Array(bufferBlob.getCombined()))});
initialize();
return true;
}
bool Mesh::validateMergingMesh(Mesh *mesh) {
// validate vertex bundles
if (_struct.vertexBundles.size() != mesh->_struct.vertexBundles.size()) {
return false;
}
for (size_t i = 0; i < _struct.vertexBundles.size(); ++i) {
const auto &bundle = _struct.vertexBundles[i];
auto & dstBundle = mesh->_struct.vertexBundles[i];
if (bundle.attributes.size() != dstBundle.attributes.size()) {
return false;
}
for (size_t j = 0; j < bundle.attributes.size(); ++j) {
if (bundle.attributes[j].format != dstBundle.attributes[j].format) {
return false;
}
}
}
// validate primitives
if (_struct.primitives.size() != mesh->_struct.primitives.size()) {
return false;
}
for (size_t i = 0; i < _struct.primitives.size(); ++i) {
const auto &prim = _struct.primitives[i];
auto & dstPrim = mesh->_struct.primitives[i];
if (prim.vertexBundelIndices.size() != dstPrim.vertexBundelIndices.size()) {
return false;
}
for (size_t j = 0; j < prim.vertexBundelIndices.size(); ++j) {
if (prim.vertexBundelIndices[j] != dstPrim.vertexBundelIndices[j]) {
return false;
}
}
if (prim.primitiveMode != dstPrim.primitiveMode) {
return false;
}
if (prim.indexView.has_value()) {
if (!dstPrim.indexView.has_value()) {
return false;
}
} else if (dstPrim.indexView.has_value()) {
return false;
}
}
return true;
}
TypedArray Mesh::readAttribute(index_t primitiveIndex, const char *attributeName) {
TypedArray result;
accessAttribute(primitiveIndex, attributeName, [&](const IVertexBundle &vertexBundle, uint32_t iAttribute) {
const uint32_t vertexCount = vertexBundle.view.count;
const gfx::Format format = vertexBundle.attributes[iAttribute].format;
if (vertexCount == 0) {
return;
}
DataView inputView(_data.buffer(), vertexBundle.view.offset + getOffset(vertexBundle.attributes, static_cast<index_t>(iAttribute)));
const auto &formatInfo = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(format)];
auto reader = getReader(inputView, format);
if (reader == nullptr) {
return;
}
const uint32_t componentCount = formatInfo.count;
result = createTypedArrayWithGFXFormat(format, vertexCount * componentCount);
const uint32_t inputStride = vertexBundle.view.stride;
for (uint32_t iVertex = 0; iVertex < vertexCount; ++iVertex) {
for (uint32_t iComponent = 0; iComponent < componentCount; ++iComponent) {
TypedArrayElementType element = reader(inputStride * iVertex + getTypedArrayBytesPerElement(result) * iComponent);
setTypedArrayValue(result, componentCount * iVertex + iComponent, element);
}
}
});
return result;
}
bool Mesh::copyAttribute(index_t primitiveIndex, const char *attributeName, ArrayBuffer *buffer, uint32_t stride, uint32_t offset) {
bool written = false;
accessAttribute(primitiveIndex, attributeName, [&](const IVertexBundle &vertexBundle, uint32_t iAttribute) {
const uint32_t vertexCount = vertexBundle.view.count;
if (vertexCount == 0) {
written = true;
return;
}
const gfx::Format format = vertexBundle.attributes[iAttribute].format;
DataView inputView(_data.buffer(), vertexBundle.view.offset + getOffset(vertexBundle.attributes, static_cast<index_t>(iAttribute)));
DataView outputView(buffer, offset);
const auto &formatInfo = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(format)];
auto reader = getReader(inputView, format);
if (reader == nullptr) {
return;
}
auto writer = getWriter(outputView, format);
if (writer == nullptr) {
return;
}
const uint32_t componentCount = formatInfo.count;
const uint32_t inputStride = vertexBundle.view.stride;
const uint32_t inputComponentByteLength = getComponentByteLength(format);
const uint32_t outputStride = stride;
const uint32_t outputComponentByteLength = inputComponentByteLength;
for (uint32_t iVertex = 0; iVertex < vertexCount; ++iVertex) {
for (uint32_t iComponent = 0; iComponent < componentCount; ++iComponent) {
const uint32_t inputOffset = inputStride * iVertex + inputComponentByteLength * iComponent;
const uint32_t outputOffset = outputStride * iVertex + outputComponentByteLength * iComponent;
writer(outputOffset, reader(inputOffset));
}
}
written = true;
});
return written;
}
IBArray Mesh::readIndices(index_t primitiveIndex) {
if (primitiveIndex >= _struct.primitives.size()) {
return {};
}
const auto &primitive = _struct.primitives[primitiveIndex];
if (!primitive.indexView.has_value()) {
return {};
}
const uint32_t stride = primitive.indexView.value().stride;
const uint32_t count = primitive.indexView.value().count;
const uint32_t byteOffset = primitive.indexView.value().offset;
IBArray ret;
if (stride == 1) {
ret = Uint8Array(_data.buffer(), byteOffset, count);
} else if (stride == 2) {
ret = Uint16Array(_data.buffer(), byteOffset, count);
} else {
ret = Uint32Array(_data.buffer(), byteOffset, count);
}
return ret;
}
bool Mesh::copyIndices(index_t primitiveIndex, TypedArray &outputArray) {
if (primitiveIndex >= _struct.primitives.size()) {
return false;
}
const auto &primitive = _struct.primitives[primitiveIndex];
if (!primitive.indexView.has_value()) {
return false;
}
const uint32_t indexCount = primitive.indexView.value().count;
const gfx::Format indexFormat = primitive.indexView.value().stride == 1 ? gfx::Format::R8UI
: (primitive.indexView.value().stride == 2 ? gfx::Format::R16UI
: gfx::Format::R32UI);
DataView view(_data.buffer());
auto reader = getReader(view, indexFormat);
for (uint32_t i = 0; i < indexCount; ++i) {
TypedArrayElementType element = reader(primitive.indexView.value().offset + gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(indexFormat)].size * i);
setTypedArrayValue(outputArray, i, element);
}
return true;
}
void Mesh::accessAttribute(index_t primitiveIndex, const char *attributeName, const AccessorType &accessor) {
if (primitiveIndex >= _struct.primitives.size()) {
return;
}
auto &primitive = _struct.primitives[primitiveIndex];
for (const auto &vertexBundleIndex : primitive.vertexBundelIndices) {
const auto &vertexBundle = _struct.vertexBundles[vertexBundleIndex];
auto iter = std::find_if(vertexBundle.attributes.begin(), vertexBundle.attributes.end(), [&](const auto &a) -> bool { return a.name == attributeName; });
if (iter == vertexBundle.attributes.end()) {
continue;
}
accessor(vertexBundle, static_cast<int>(iter - vertexBundle.attributes.begin()));
break;
}
}
/* static */
gfx::BufferList Mesh::createVertexBuffers(gfx::Device *gfxDevice, ArrayBuffer *data) {
gfx::BufferList buffers;
for (const auto &vertexBundle : _struct.vertexBundles) {
auto *vertexBuffer = gfxDevice->createBuffer({gfx::BufferUsageBit::VERTEX,
gfx::MemoryUsageBit::DEVICE,
vertexBundle.view.length,
vertexBundle.view.stride});
vertexBuffer->update(data->getData() + vertexBundle.view.offset, vertexBundle.view.length);
buffers.emplace_back(vertexBuffer);
}
return buffers;
}
void Mesh::initDefault(const cc::optional<std::string> &uuid) {
Super::initDefault(uuid);
reset({});
}
bool Mesh::validate() const {
return !_renderingSubMeshes.empty() && !_data.empty();
}
TypedArray Mesh::createTypedArrayWithGFXFormat(gfx::Format format, uint32_t count) {
const auto & info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(format)];
const uint32_t stride = info.size / info.count;
switch (info.type) {
case gfx::FormatType::UNORM:
case gfx::FormatType::UINT: {
switch (stride) {
case 1: return Uint8Array(count);
case 2: return Uint16Array(count);
case 4: return Uint32Array(count);
default:
break;
}
break;
}
case gfx::FormatType::SNORM:
case gfx::FormatType::INT: {
switch (stride) {
case 1: return Int8Array(count);
case 2: return Int16Array(count);
case 4: return Int32Array(count);
default:
break;
}
break;
}
case gfx::FormatType::FLOAT: {
return Float32Array(count);
}
default:
break;
}
return Float32Array(count);
}
} // namespace cc
+402
View File
@@ -0,0 +1,402 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include "3d/assets/MorphRendering.h"
#include "3d/assets/Types.h"
#include "cocos/base/Optional.h"
#include "core/assets/Asset.h"
#include "core/geometry/AABB.h"
#include "math/Mat4.h"
#include "math/Vec3.h"
#include "renderer/gfx-base/GFXDef.h"
namespace cc {
class Skeleton;
class RenderingSubMesh;
/**
* @en Mesh asset
* @zh 网格资源。
*/
class Mesh : public Asset {
public:
using Super = Asset;
using IBufferView = IMeshBufferView;
/**
* @en Vertex bundle, it describes a set of interleaved vertex attributes and their values.
* @zh 顶点块。顶点块描述了一组**交错排列**(interleaved)的顶点属性并存储了顶点属性的实际数据。<br>
* 交错排列是指在实际数据的缓冲区中,每个顶点的所有属性总是依次排列,并总是出现在下一个顶点的所有属性之前。
*/
struct IVertexBundle {
cc::optional<uint8_t> _padding; // NOTE: avoid jsb cache map
/**
* @en The actual value for all vertex attributes.
* You must use DataView to access the data.
* @zh 所有顶点属性的实际数据块。
* 你必须使用 DataView 来读取数据。
* 因为不能保证所有属性的起始偏移都按 TypedArray 要求的字节对齐。
*/
IBufferView view;
/**
* @en All attributes included in the bundle
* @zh 包含的所有顶点属性。
*/
gfx::AttributeList attributes;
};
/**
* @en Sub mesh contains a list of primitives with the same type (Point, Line or Triangle)
* @zh 子网格。子网格由一系列相同类型的图元组成(例如点、线、面等)。
*/
struct ISubMesh {
/**
* @en The vertex bundle references used by the sub mesh.
* @zh 此子网格引用的顶点块,索引至网格的顶点块数组。
*/
std::vector<uint32_t> vertexBundelIndices;
/**
* @en The primitive mode of the sub mesh
* @zh 此子网格的图元类型。
*/
gfx::PrimitiveMode primitiveMode;
/**
* @en The index data of the sub mesh
* @zh 此子网格使用的索引数据。
*/
cc::optional<IBufferView> indexView;
/**
* @en The joint map index in [[IStruct.jointMaps]]. Could be absent
* @zh 此子网格使用的关节索引映射表在 [[IStruct.jointMaps]] 中的索引。
* 如未定义或指向的映射表不存在,则默认 VB 内所有关节索引数据直接对应骨骼资源数据。
*/
cc::optional<uint32_t> jointMapIndex;
};
/**
* @en The structure of the mesh
* @zh 描述了网格的结构。
*/
struct IStruct {
/**
* @en All vertex bundles of the mesh
* @zh 此网格所有的顶点块。
*/
std::vector<IVertexBundle> vertexBundles;
/**
* @en All sub meshes
* @zh 此网格的所有子网格。
*/
std::vector<ISubMesh> primitives;
/**
* @en The minimum position of all vertices in the mesh
* @zh (各分量都)小于等于此网格任何顶点位置的最大位置。
*/
cc::optional<Vec3> minPosition;
/**
* @en The maximum position of all vertices in the mesh
* @zh (各分量都)大于等于此网格任何顶点位置的最小位置。
*/
cc::optional<Vec3> maxPosition;
/**
* @en The joint index map list.
* @zh 此网格使用的关节索引映射关系列表,数组长度应为子模型中实际使用到的所有关节,
* 每个元素都对应一个原骨骼资源里的索引,按子模型 VB 内的实际索引排列。
*/
cc::optional<std::vector<std::vector<index_t>>> jointMaps;
/**
* @en The morph information of the mesh
* @zh 网格的形变数据
*/
cc::optional<Morph> morph;
};
struct ICreateInfo {
/**
* @en Mesh structure
* @zh 网格结构。
*/
IStruct structInfo;
/**
* @en Mesh binary data
* @zh 网格二进制数据。
*/
Uint8Array data;
};
Mesh() = default;
~Mesh() override;
cc::any getNativeAsset() const override;
void setNativeAsset(const cc::any &obj) override;
void setAssetData(cc::ArrayBuffer *data) {
_data = Uint8Array(data);
}
const Uint8Array &getAssetData() {
return _data;
}
/**
* @en The sub meshes count of the mesh.
* @zh 此网格的子网格数量。
* @deprecated Please use [[renderingSubMeshes.length]] instead
*/
uint32_t getSubMeshCount() const;
/**
* @en The minimum position of all vertices in the mesh
* @zh (各分量都)小于等于此网格任何顶点位置的最大位置。
* @deprecated Please use [[struct.minPosition]] instead
*/
const Vec3 &getMinPosition() const;
/**
* @en The maximum position of all vertices in the mesh
* @zh (各分量都)大于等于此网格任何顶点位置的最大位置。
* @deprecated Please use [[struct.maxPosition]] instead
*/
const Vec3 &getMaxPosition() const;
/**
* @en The struct of the mesh
* @zh 此网格的结构。
*/
inline const IStruct &getStruct() const {
return _struct;
}
inline void setStruct(const IStruct &input) {
_struct = input;
}
inline Uint8Array &getData() {
return _data;
}
inline void setData(const Uint8Array &data) {
_data = data;
}
/**
* @en The hash of the mesh
* @zh 此网格的哈希值。
*/
uint64_t getHash();
inline double getHashForJS() {
return static_cast<double>(getHash());
}
/**
* @en Set the hash of the mesh
* @zh 设置此网格的哈希值。
*/
void setHash(uint64_t hash) { _hash = hash; }
using JointBufferIndicesType = std::vector<index_t>;
/**
* The index of the joint buffer of all sub meshes in the joint map buffers
*/
const JointBufferIndicesType &getJointBufferIndices();
using RenderingSubMeshList = std::vector<IntrusivePtr<RenderingSubMesh>>;
/**
* @en The sub meshes for rendering. Mesh could be split into different sub meshes for rendering.
* @zh 此网格创建的渲染网格。
*/
inline const RenderingSubMeshList &getRenderingSubMeshes() {
initialize();
return _renderingSubMeshes;
}
void onLoaded() override {
initialize();
}
void initialize();
/**
* @en Destroy the mesh and release all related GPU resources
* @zh 销毁此网格,并释放它占有的所有 GPU 资源。
*/
bool destroy() override {
destroyRenderingMesh();
return Super::destroy();
}
/**
* @en Release all related GPU resources
* @zh 释放此网格占有的所有 GPU 资源。
*/
void destroyRenderingMesh();
/**
* @en Reset the struct and data of the mesh
* @zh 重置此网格的结构和数据。
* @param struct The new struct
* @param data The new data
* @deprecated Will be removed in v3.0.0, please use [[reset]] instead
*/
void assign(const IStruct &structInfo, const Uint8Array &data);
/**
* @en Reset the mesh with mesh creation information
* @zh 重置此网格。
* @param info Mesh creation information including struct and data
*/
void reset(ICreateInfo &&info);
using BoneSpaceBounds = std::vector<IntrusivePtr<geometry::AABB>>;
/**
* @en Get [[AABB]] bounds in the skeleton's bone space
* @zh 获取骨骼变换空间内下的 [[AABB]] 包围盒
* @param skeleton
*/
BoneSpaceBounds getBoneSpaceBounds(Skeleton *skeleton);
/**
* @en Merge the given mesh into the current mesh
* @zh 合并指定的网格到此网格中。
* @param mesh The mesh to be merged
* @param worldMatrix The world matrix of the given mesh
* @param [validate=false] Whether to validate the mesh
* @returns Check the mesh state and return the validation result.
*/
bool merge(Mesh *mesh, const Mat4 *worldMatrix = nullptr, bool validate = false);
/**
* @en Validation for whether the given mesh can be merged into the current mesh.
* To pass the validation, it must satisfy either of these two requirements:
* - When the current mesh have no data
* - When the two mesh have the same vertex bundle count, the same sub meshes count, and the same sub mesh layout.
*
* Same mesh layout means:
* - They have the same primitive type and reference to the same amount vertex bundle with the same indices.
* - And they all have or don't have index view
* @zh 验证指定网格是否可以合并至当前网格。
*
* 当满足以下条件之一时,指定网格可以合并至当前网格:
* - 当前网格无数据而待合并网格有数据;
* - 它们的顶点块数目相同且对应顶点块的布局一致,并且它们的子网格数目相同且对应子网格的布局一致。
*
* 两个顶点块布局一致当且仅当:
* - 它们具有相同数量的顶点属性且对应的顶点属性具有相同的属性格式。
*
* 两个子网格布局一致,当且仅当:
* - 它们具有相同的图元类型并且引用相同数量、相同索引的顶点块;并且,
* - 要么都需要索引绘制,要么都不需要索引绘制。
* @param mesh The other mesh to be validated
*/
bool validateMergingMesh(Mesh *mesh);
/**
* @en Read the requested attribute of the given sub mesh
* @zh 读取子网格的指定属性。
* @param primitiveIndex Sub mesh index
* @param attributeName Attribute name
* @returns Return null if not found or can't read, otherwise, will create a large enough typed array to contain all data of the attribute,
* the array type will match the data type of the attribute.
*/
TypedArray readAttribute(index_t primitiveIndex, const char *attributeName);
/**
* @en Read the requested attribute of the given sub mesh and fill into the given buffer.
* @zh 读取子网格的指定属性到目标缓冲区中。
* @param primitiveIndex Sub mesh index
* @param attributeName Attribute name
* @param buffer The target array buffer
* @param stride Byte distance between two attributes in the target buffer
* @param offset The offset of the first attribute in the target buffer
* @returns Return false if failed to access attribute, return true otherwise.
*/
bool copyAttribute(index_t primitiveIndex, const char *attributeName, ArrayBuffer *buffer, uint32_t stride, uint32_t offset);
/**
* @en Read the indices data of the given sub mesh
* @zh 读取子网格的索引数据。
* @param primitiveIndex Sub mesh index
* @returns Return null if not found or can't read, otherwise, will create a large enough typed array to contain all indices data,
* the array type will use the corresponding stride size.
*/
IBArray readIndices(index_t primitiveIndex);
/**
* @en Read the indices data of the given sub mesh and fill into the given array
* @zh 读取子网格的索引数据到目标数组中。
* @param primitiveIndex Sub mesh index
* @param outputArray The target output array
* @returns Return false if failed to access the indices data, return true otherwise.
*/
bool copyIndices(index_t primitiveIndex, TypedArray &outputArray);
private:
using AccessorType = std::function<void(const IVertexBundle &vertexBundle, int32_t iAttribute)>;
void accessAttribute(index_t primitiveIndex, const char *attributeName, const AccessorType &accessor);
gfx::BufferList createVertexBuffers(gfx::Device *gfxDevice, ArrayBuffer *data);
void initDefault(const cc::optional<std::string> &uuid) override;
bool validate() const override;
static TypedArray createTypedArrayWithGFXFormat(gfx::Format format, uint32_t count);
public:
IntrusivePtr<MorphRendering> morphRendering;
private:
IStruct _struct;
uint64_t _hash{0};
Uint8Array _data;
bool _initialized{false};
RenderingSubMeshList _renderingSubMeshes;
std::unordered_map<uint64_t, BoneSpaceBounds> _boneSpaceBounds;
JointBufferIndicesType _jointBufferIndices;
friend class MeshDeserializer;
CC_DISALLOW_COPY_MOVE_ASSIGN(Mesh);
};
} // namespace cc
+35
View File
@@ -0,0 +1,35 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/assets/Morph.h"
#include "3d/assets/MorphRendering.h"
namespace cc {
MorphRendering *createMorphRendering(Mesh *mesh, gfx::Device *gfxDevice) {
return new StdMorphRendering(mesh, gfxDevice);
}
} // namespace cc
+83
View File
@@ -0,0 +1,83 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include "3d/assets/Types.h"
#include "base/RefCounted.h"
#include "base/TypeDef.h"
#include "scene/Define.h"
namespace cc {
class Mesh;
class MorphRendering;
class MorphRenderingInstance;
namespace gfx {
class Device;
class DescriptorSet;
} // namespace gfx
MorphRendering *createMorphRendering(Mesh *mesh, gfx::Device *gfxDevice);
/**
* Class which control rendering of a morph resource.
*/
class MorphRendering : public RefCounted {
public:
~MorphRendering() override = default;
virtual MorphRenderingInstance *createInstance() = 0;
};
/**
* This rendering instance of a morph resource.
*/
class MorphRenderingInstance : public RefCounted {
public:
~MorphRenderingInstance() override = default;
/**
* Sets weights of targets of specified sub mesh.
* @param subMeshIndex
* @param weights
*/
virtual void setWeights(index_t subMeshIndex, const MeshWeightsType &weights) = 0;
/**
* Adapts pipeline state to do the rendering.
* @param subMeshIndex
* @param pipelineState
*/
virtual void adaptPipelineState(index_t subMeshIndex, gfx::DescriptorSet *descriptorSet) = 0;
virtual std::vector<scene::IMacroPatch> requiredPatches(index_t subMeshIndex) = 0;
/**
* Destroy the rendering instance.
*/
virtual void destroy() = 0;
};
} // namespace cc
+727
View File
@@ -0,0 +1,727 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/assets/MorphRendering.h"
#include <memory>
#include "3d/assets/Mesh.h"
#include "3d/assets/Morph.h"
#include "base/RefCounted.h"
#include "core/DataView.h"
#include "core/TypedArray.h"
#include "core/assets/RenderingSubMesh.h"
#include "core/assets/Texture2D.h"
#include "platform/Image.h"
#include "renderer/pipeline/Define.h"
#include "scene/Pass.h"
namespace cc {
/**
* The instance of once sub-mesh morph rendering.
*/
class SubMeshMorphRenderingInstance : public RefCounted {
public:
~SubMeshMorphRenderingInstance() override = default;
/**
* Set weights of each morph target.
* @param weights The weights.
*/
virtual void setWeights(const std::vector<float> &weights) = 0;
/**
* Asks the define overrides needed to do the rendering.
*/
virtual std::vector<scene::IMacroPatch> requiredPatches() = 0;
/**
* Adapts the pipelineState to apply the rendering.
* @param pipelineState
*/
virtual void adaptPipelineState(gfx::DescriptorSet *descriptorSet) = 0;
/**
* Destroy this instance.
*/
virtual void destroy() = 0;
};
/**
* Describes how to render a sub-mesh morph.
*/
class SubMeshMorphRendering : public RefCounted {
public:
~SubMeshMorphRendering() override = default;
/**
* Creates a rendering instance.
*/
virtual SubMeshMorphRenderingInstance *createInstance() = 0;
};
namespace {
/**
* True if force to use cpu computing based sub-mesh rendering.
*/
const bool PREFER_CPU_COMPUTING = false;
class MorphTexture final : public RefCounted {
public:
MorphTexture() = default;
~MorphTexture() override = default;
/**
* Gets the GFX texture.
*/
gfx::Texture *getTexture() {
return _textureAsset->getGFXTexture();
}
/**
* Gets the GFX sampler.
*/
gfx::Sampler *getSampler() {
return _sampler;
}
/**
* Value view.
*/
Float32Array &getValueView() {
return _valueView;
}
/**
* Destroy the texture. Release its GPU resources.
*/
void destroy() {
_textureAsset->destroy();
// Samplers allocated from `samplerLib` are not required and
// should not be destroyed.
// _sampler.destroy();
}
/**
* Update the pixels content to `valueView`.
*/
void updatePixels() {
_textureAsset->uploadData(_arrayBuffer->getData());
}
void initialize(gfx::Device *gfxDevice, uint32_t width, uint32_t height, uint32_t pixelBytes, bool /*useFloat32Array*/, PixelFormat pixelFormat) {
_arrayBuffer = new ArrayBuffer(width * height * pixelBytes);
_valueView = Float32Array(_arrayBuffer);
auto * imageAsset = new ImageAsset();
IMemoryImageSource source{_arrayBuffer, false, width, height, pixelFormat};
imageAsset->setNativeAsset(source);
_textureAsset = new Texture2D();
_textureAsset->setFilters(Texture2D::Filter::NEAREST, Texture2D::Filter::NEAREST);
_textureAsset->setMipFilter(Texture2D::Filter::NONE);
_textureAsset->setWrapMode(Texture2D::WrapMode::CLAMP_TO_EDGE, Texture2D::WrapMode::CLAMP_TO_EDGE, Texture2D::WrapMode::CLAMP_TO_EDGE);
_textureAsset->setImage(imageAsset);
if (nullptr == _textureAsset->getGFXTexture()) {
CC_LOG_WARNING("Unexpected: failed to create morph texture?");
}
_sampler = gfxDevice->getSampler(_textureAsset->getSamplerInfo());
}
private:
IntrusivePtr<Texture2D> _textureAsset;
gfx::Sampler * _sampler{nullptr};
ArrayBuffer::Ptr _arrayBuffer;
Float32Array _valueView;
CC_DISALLOW_COPY_MOVE_ASSIGN(MorphTexture);
};
struct GpuMorphAttribute {
std::string attributeName;
IntrusivePtr<MorphTexture> morphTexture;
};
struct CpuMorphAttributeTarget {
Float32Array displacements;
};
using CpuMorphAttributeTargetList = std::vector<CpuMorphAttributeTarget>;
struct CpuMorphAttribute {
std::string name;
CpuMorphAttributeTargetList targets;
};
struct Vec4TextureFactory {
uint32_t width{0};
uint32_t height{0};
std::function<MorphTexture *()> create{nullptr};
};
/**
* Decides a best texture size to have the specified pixel capacity at least.
* The decided width and height has the following characteristics:
* - the width and height are both power of 2;
* - if the width and height are different, the width would be set to the larger once;
* - the width is ensured to be multiple of 4.
* @param nPixels Least pixel capacity.
*/
bool bestSizeToHavePixels(uint32_t nPixels, uint32_t *pWidth, uint32_t *pHeight) {
if (pWidth == nullptr || pHeight == nullptr) {
if (pWidth != nullptr) {
*pWidth = 0;
}
if (pHeight != nullptr) {
*pHeight = 0;
}
return false;
}
if (nPixels < 5) {
nPixels = 5;
}
const uint32_t aligned = pipeline::nextPow2(nPixels);
const auto epxSum = static_cast<uint32_t>(std::log2(aligned));
const uint32_t h = epxSum >> 1;
const uint32_t w = (epxSum & 1) ? (h + 1) : h;
*pWidth = 1 << w;
*pHeight = 1 << h;
return true;
}
/**
* When use vertex-texture-fetch technique, we do need
* `gl_vertexId` when we sample per-vertex data.
* WebGL 1.0 does not have `gl_vertexId`; WebGL 2.0, however, does.
* @param mesh
* @param subMeshIndex
* @param gfxDevice
*/
void enableVertexId(Mesh *mesh, uint32_t subMeshIndex, gfx::Device *gfxDevice) {
mesh->getRenderingSubMeshes()[subMeshIndex]->enableVertexIdChannel(gfxDevice);
}
/**
*
* @param gfxDevice
* @param vec4Capacity Capacity of vec4.
*/
Vec4TextureFactory createVec4TextureFactory(gfx::Device *gfxDevice, uint32_t vec4Capacity) {
bool hasFeatureFloatTexture = static_cast<uint32_t>(gfxDevice->getFormatFeatures(gfx::Format::RGBA32F) & gfx::FormatFeature::SAMPLED_TEXTURE) != 0;
uint32_t pixelRequired = 0;
PixelFormat pixelFormat = PixelFormat::RGBA8888;
uint32_t pixelBytes = 4;
bool useFloat32Array = false;
if (hasFeatureFloatTexture) {
pixelRequired = vec4Capacity;
pixelBytes = 16;
pixelFormat = Texture2D::PixelFormat::RGBA32F;
useFloat32Array = true;
} else {
pixelRequired = 4 * vec4Capacity;
pixelBytes = 4;
pixelFormat = Texture2D::PixelFormat::RGBA8888;
useFloat32Array = false;
}
uint32_t width = 0;
uint32_t height = 0;
bestSizeToHavePixels(pixelRequired, &width, &height);
CC_ASSERT(width * height >= pixelRequired);
Vec4TextureFactory ret;
ret.width = width;
ret.height = height;
ret.create = [=]() -> MorphTexture * {
auto *texture = new MorphTexture(); // texture will be held by IntrusivePtr in GpuMorphAttribute
texture->initialize(gfxDevice, width, height, pixelBytes, useFloat32Array, pixelFormat);
return texture;
};
return ret;
}
/**
* Provides the access to morph related uniforms.
*/
class MorphUniforms final : public RefCounted {
public:
MorphUniforms(gfx::Device *gfxDevice, uint32_t targetCount) {
_targetCount = targetCount;
_localBuffer = new DataView(new ArrayBuffer(pipeline::UBOMorph::SIZE));
_remoteBuffer = gfxDevice->createBuffer(gfx::BufferInfo{
gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST,
gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE,
pipeline::UBOMorph::SIZE,
pipeline::UBOMorph::SIZE,
});
}
~MorphUniforms() override {
delete _localBuffer;
}
void destroy() {
_remoteBuffer->destroy();
}
gfx::Buffer *getBuffer() const {
return _remoteBuffer;
}
void setWeights(const std::vector<float> &weights) {
CC_ASSERT(weights.size() == _targetCount);
for (size_t iWeight = 0; iWeight < weights.size(); ++iWeight) {
_localBuffer->setFloat32(static_cast<uint32_t>(pipeline::UBOMorph::OFFSET_OF_WEIGHTS + 4 * iWeight), weights[iWeight]);
}
}
void setMorphTextureInfo(float width, float height) {
_localBuffer->setFloat32(pipeline::UBOMorph::OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH, width);
_localBuffer->setFloat32(pipeline::UBOMorph::OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT, height);
}
void setVerticesCount(uint32_t count) {
_localBuffer->setFloat32(pipeline::UBOMorph::OFFSET_OF_VERTICES_COUNT, static_cast<float>(count));
}
void commit() {
ArrayBuffer *buffer = _localBuffer->buffer();
_remoteBuffer->update(buffer->getData(), buffer->byteLength());
}
private:
uint32_t _targetCount{0};
DataView * _localBuffer{nullptr};
IntrusivePtr<gfx::Buffer> _remoteBuffer;
};
class CpuComputing final : public SubMeshMorphRendering {
public:
explicit CpuComputing(Mesh *mesh, uint32_t subMeshIndex, const Morph *morph, gfx::Device *gfxDevice);
SubMeshMorphRenderingInstance * createInstance() override;
const std::vector<CpuMorphAttribute> &getData() const;
private:
std::vector<CpuMorphAttribute> _attributes;
gfx::Device * _gfxDevice{nullptr};
};
class GpuComputing final : public SubMeshMorphRendering {
public:
explicit GpuComputing(Mesh *mesh, uint32_t subMeshIndex, const Morph *morph, gfx::Device *gfxDevice);
SubMeshMorphRenderingInstance *createInstance() override;
void destroy();
private:
gfx::Device * _gfxDevice{nullptr};
const SubMeshMorph * _subMeshMorph{nullptr};
uint32_t _textureWidth{0};
uint32_t _textureHeight{0};
std::vector<GpuMorphAttribute> _attributes;
uint32_t _verticesCount{0};
friend class GpuComputingRenderingInstance;
};
class CpuComputingRenderingInstance final : public SubMeshMorphRenderingInstance {
public:
explicit CpuComputingRenderingInstance(CpuComputing *owner, uint32_t nVertices, gfx::Device *gfxDevice) {
_owner = owner; //NOTE: release by mesh`s destroy, it`ll call current instance`s destroy method
_morphUniforms = new MorphUniforms(gfxDevice, 0 /* TODO? */);
auto vec4TextureFactory = createVec4TextureFactory(gfxDevice, nVertices);
_morphUniforms->setMorphTextureInfo(static_cast<float>(vec4TextureFactory.width), static_cast<float>(vec4TextureFactory.height));
_morphUniforms->commit();
for (const auto &attributeMorph : _owner->getData()) {
auto *morphTexture = vec4TextureFactory.create();
_attributes.emplace_back(GpuMorphAttribute{attributeMorph.name, morphTexture});
}
}
void setWeights(const std::vector<float> &weights) override {
for (size_t iAttribute = 0; iAttribute < _attributes.size(); ++iAttribute) {
const auto & myAttribute = _attributes[iAttribute];
Float32Array &valueView = myAttribute.morphTexture->getValueView();
const auto & attributeMorph = _owner->getData()[iAttribute];
CC_ASSERT(weights.size() == attributeMorph.targets.size());
for (size_t iTarget = 0; iTarget < attributeMorph.targets.size(); ++iTarget) {
const auto & targetDisplacements = attributeMorph.targets[iTarget].displacements;
const float weight = weights[iTarget];
const uint32_t nVertices = targetDisplacements.length() / 3;
if (iTarget == 0) {
for (uint32_t iVertex = 0; iVertex < nVertices; ++iVertex) {
valueView[4 * iVertex + 0] = targetDisplacements[3 * iVertex + 0] * weight;
valueView[4 * iVertex + 1] = targetDisplacements[3 * iVertex + 1] * weight;
valueView[4 * iVertex + 2] = targetDisplacements[3 * iVertex + 2] * weight;
}
} else if (std::fabs(weight) >= std::numeric_limits<float>::epsilon()) {
for (uint32_t iVertex = 0; iVertex < nVertices; ++iVertex) {
valueView[4 * iVertex + 0] += targetDisplacements[3 * iVertex + 0] * weight;
valueView[4 * iVertex + 1] += targetDisplacements[3 * iVertex + 1] * weight;
valueView[4 * iVertex + 2] += targetDisplacements[3 * iVertex + 2] * weight;
}
}
}
myAttribute.morphTexture->updatePixels();
}
}
std::vector<scene::IMacroPatch> requiredPatches() override {
return {
{"CC_MORPH_TARGET_USE_TEXTURE", true},
{"CC_MORPH_PRECOMPUTED", true},
};
}
void adaptPipelineState(gfx::DescriptorSet *descriptorSet) override {
for (const auto &attribute : _attributes) {
const auto & attributeName = attribute.attributeName;
cc::optional<uint32_t> binding;
if (attributeName == gfx::ATTR_NAME_POSITION) {
binding = uint32_t{pipeline::POSITIONMORPH::BINDING};
} else if (attributeName == gfx::ATTR_NAME_NORMAL) {
binding = uint32_t{pipeline::NORMALMORPH::BINDING};
} else if (attributeName == gfx::ATTR_NAME_TANGENT) {
binding = uint32_t{pipeline::TANGENTMORPH::BINDING};
} else {
CC_LOG_WARNING("Unexpected attribute!");
}
if (binding.has_value()) {
descriptorSet->bindSampler(binding.value(), attribute.morphTexture->getSampler());
descriptorSet->bindTexture(binding.value(), attribute.morphTexture->getTexture());
}
}
descriptorSet->bindBuffer(pipeline::UBOMorph::BINDING, _morphUniforms->getBuffer());
descriptorSet->update();
}
void destroy() override {
CC_SAFE_DESTROY(_morphUniforms);
for (auto &myAttribute : _attributes) {
CC_SAFE_DESTROY(myAttribute.morphTexture);
}
}
private:
std::vector<GpuMorphAttribute> _attributes;
IntrusivePtr<CpuComputing> _owner;
IntrusivePtr<MorphUniforms> _morphUniforms;
};
class GpuComputingRenderingInstance final : public SubMeshMorphRenderingInstance {
public:
explicit GpuComputingRenderingInstance(GpuComputing *owner, gfx::Device *gfxDevice) {
_owner = owner;
_morphUniforms = new MorphUniforms(gfxDevice, static_cast<uint32_t>(_owner->_subMeshMorph->targets.size()));
_morphUniforms->setMorphTextureInfo(static_cast<float>(_owner->_textureWidth), static_cast<float>(_owner->_textureHeight));
_morphUniforms->setVerticesCount(_owner->_verticesCount);
_morphUniforms->commit();
_attributes = &_owner->_attributes;
}
void setWeights(const std::vector<float> &weights) override {
_morphUniforms->setWeights(weights);
_morphUniforms->commit();
}
std::vector<scene::IMacroPatch> requiredPatches() override {
return {
{"CC_MORPH_TARGET_USE_TEXTURE", true},
};
}
void adaptPipelineState(gfx::DescriptorSet *descriptorSet) override {
for (const auto &attribute : *_attributes) {
const auto & attributeName = attribute.attributeName;
cc::optional<uint32_t> binding;
if (attributeName == gfx::ATTR_NAME_POSITION) {
binding = uint32_t{pipeline::POSITIONMORPH::BINDING};
} else if (attributeName == gfx::ATTR_NAME_NORMAL) {
binding = uint32_t{pipeline::NORMALMORPH::BINDING};
} else if (attributeName == gfx::ATTR_NAME_TANGENT) {
binding = uint32_t{pipeline::TANGENTMORPH::BINDING};
} else {
CC_LOG_WARNING("Unexpected attribute!");
}
if (binding.has_value()) {
descriptorSet->bindSampler(binding.value(), attribute.morphTexture->getSampler());
descriptorSet->bindTexture(binding.value(), attribute.morphTexture->getTexture());
}
}
descriptorSet->bindBuffer(pipeline::UBOMorph::BINDING, _morphUniforms->getBuffer());
descriptorSet->update();
}
void destroy() override {
}
private:
std::vector<GpuMorphAttribute> *_attributes{nullptr};
IntrusivePtr<GpuComputing> _owner;
IntrusivePtr<MorphUniforms> _morphUniforms;
};
CpuComputing::CpuComputing(Mesh *mesh, uint32_t subMeshIndex, const Morph *morph, gfx::Device *gfxDevice) {
_gfxDevice = gfxDevice;
const auto &subMeshMorph = morph->subMeshMorphs[subMeshIndex].value();
enableVertexId(mesh, subMeshIndex, gfxDevice);
for (size_t attributeIndex = 0, len = subMeshMorph.attributes.size(); attributeIndex < len; ++attributeIndex) {
const auto &attributeName = subMeshMorph.attributes[attributeIndex];
CpuMorphAttribute attr;
attr.name = attributeName;
attr.targets.resize(subMeshMorph.targets.size());
uint32_t i = 0;
for (const auto &attributeDisplacement : subMeshMorph.targets) {
const Mesh::IBufferView &displacementsView = attributeDisplacement.displacements[attributeIndex];
attr.targets[i].displacements = Float32Array(mesh->getData().buffer(),
mesh->getData().byteOffset() + displacementsView.offset,
attributeDisplacement.displacements[attributeIndex].count);
++i;
}
_attributes.emplace_back(attr);
}
}
SubMeshMorphRenderingInstance *CpuComputing::createInstance() {
return new CpuComputingRenderingInstance(
this,
_attributes[0].targets[0].displacements.length() / 3,
_gfxDevice);
}
const std::vector<CpuMorphAttribute> &CpuComputing::getData() const {
return _attributes;
}
GpuComputing::GpuComputing(Mesh *mesh, uint32_t subMeshIndex, const Morph *morph, gfx::Device *gfxDevice) {
_gfxDevice = gfxDevice;
const auto &subMeshMorph = morph->subMeshMorphs[subMeshIndex].value();
_subMeshMorph = &subMeshMorph;
// assertIsNonNullable(subMeshMorph);
enableVertexId(mesh, subMeshIndex, gfxDevice);
uint32_t nVertices = mesh->getStruct().vertexBundles[mesh->getStruct().primitives[subMeshIndex].vertexBundelIndices[0]].view.count;
_verticesCount = nVertices;
auto nTargets = static_cast<uint32_t>(subMeshMorph.targets.size());
uint32_t vec4Required = nVertices * nTargets;
auto vec4TextureFactory = createVec4TextureFactory(gfxDevice, vec4Required);
_textureWidth = vec4TextureFactory.width;
_textureHeight = vec4TextureFactory.height;
// Creates texture for each attribute.
uint32_t attributeIndex = 0;
_attributes.reserve(subMeshMorph.attributes.size());
for (const auto &attributeName : subMeshMorph.attributes) {
auto * vec4Tex = vec4TextureFactory.create();
Float32Array &valueView = vec4Tex->getValueView();
// if (DEV) { // Make it easy to view texture in profilers...
// for (let i = 0; i < valueView.length / 4; ++i) {
// valueView[i * 4 + 3] = 1.0;
// }
// }
uint32_t morphTargetIndex = 0;
for (const auto &morphTarget : subMeshMorph.targets) {
const auto & displacementsView = morphTarget.displacements[attributeIndex];
Float32Array displacements(mesh->getData().buffer(),
mesh->getData().byteOffset() + displacementsView.offset,
displacementsView.count);
const uint32_t displacementsOffset = (nVertices * morphTargetIndex) * 4;
for (uint32_t iVertex = 0; iVertex < nVertices; ++iVertex) {
valueView[displacementsOffset + 4 * iVertex + 0] = displacements[3 * iVertex + 0];
valueView[displacementsOffset + 4 * iVertex + 1] = displacements[3 * iVertex + 1];
valueView[displacementsOffset + 4 * iVertex + 2] = displacements[3 * iVertex + 2];
}
++morphTargetIndex;
}
vec4Tex->updatePixels();
_attributes.emplace_back(GpuMorphAttribute{attributeName, vec4Tex});
++attributeIndex;
}
}
SubMeshMorphRenderingInstance *GpuComputing::createInstance() {
return new GpuComputingRenderingInstance(this, _gfxDevice);
}
void GpuComputing::destroy() {
for (auto &attribute : _attributes) {
attribute.morphTexture->destroy();
}
}
} // namespace
class StdMorphRenderingInstance : public MorphRenderingInstance {
public:
explicit StdMorphRenderingInstance(StdMorphRendering *owner) {
_owner = owner;
size_t nSubMeshes = _owner->_mesh->getStruct().primitives.size();
_subMeshInstances.resize(nSubMeshes, nullptr);
for (size_t iSubMesh = 0; iSubMesh < nSubMeshes; ++iSubMesh) {
if (_owner->_subMeshRenderings[iSubMesh] != nullptr) {
_subMeshInstances[iSubMesh] = _owner->_subMeshRenderings[iSubMesh]->createInstance();
}
}
}
~StdMorphRenderingInstance() override = default;
void setWeights(index_t subMeshIndex, const MeshWeightsType &weights) override {
if (_subMeshInstances[subMeshIndex]) {
_subMeshInstances[subMeshIndex]->setWeights(weights);
}
}
void adaptPipelineState(index_t subMeshIndex, gfx::DescriptorSet *descriptorSet) override {
if (_subMeshInstances[subMeshIndex]) {
_subMeshInstances[subMeshIndex]->adaptPipelineState(descriptorSet);
}
}
std::vector<scene::IMacroPatch> requiredPatches(index_t subMeshIndex) override {
CC_ASSERT(_owner->_mesh->getStruct().morph.has_value());
const auto &subMeshMorphOpt = _owner->_mesh->getStruct().morph.value().subMeshMorphs[subMeshIndex];
auto * subMeshRenderingInstance = _subMeshInstances[subMeshIndex].get();
if (subMeshRenderingInstance == nullptr || !subMeshMorphOpt.has_value()) {
return {};
}
const auto &subMeshMorph = subMeshMorphOpt.value();
std::vector<scene::IMacroPatch> patches{
{"CC_USE_MORPH", true},
{"CC_MORPH_TARGET_COUNT", static_cast<int32_t>(subMeshMorph.targets.size())}};
auto posIter = std::find(subMeshMorph.attributes.begin(), subMeshMorph.attributes.end(), gfx::ATTR_NAME_POSITION);
if (posIter != subMeshMorph.attributes.end()) {
patches.emplace_back(scene::IMacroPatch{
"CC_MORPH_TARGET_HAS_POSITION",
true,
});
}
auto normalIter = std::find(subMeshMorph.attributes.begin(), subMeshMorph.attributes.end(), gfx::ATTR_NAME_NORMAL);
if (normalIter != subMeshMorph.attributes.end()) {
patches.emplace_back(scene::IMacroPatch{
"CC_MORPH_TARGET_HAS_NORMAL",
true,
});
}
auto tangentIter = std::find(subMeshMorph.attributes.begin(), subMeshMorph.attributes.end(), gfx::ATTR_NAME_TANGENT);
if (tangentIter != subMeshMorph.attributes.end()) {
patches.emplace_back(scene::IMacroPatch{
"CC_MORPH_TARGET_HAS_TANGENT",
true,
});
}
auto renderingInstancePatches = subMeshRenderingInstance->requiredPatches();
for (auto &renderingInstancePatch : renderingInstancePatches) {
patches.emplace_back(renderingInstancePatch);
}
return patches;
}
void destroy() override {
for (auto &subMeshInstance : _subMeshInstances) {
if (subMeshInstance != nullptr) {
subMeshInstance->destroy();
}
}
}
private:
IntrusivePtr<StdMorphRendering> _owner;
std::vector<IntrusivePtr<SubMeshMorphRenderingInstance>> _subMeshInstances;
};
StdMorphRendering::StdMorphRendering(Mesh *mesh, gfx::Device *gfxDevice) {
_mesh = mesh;
const auto &structInfo = _mesh->getStruct();
if (!structInfo.morph.has_value()) {
return;
}
const size_t nSubMeshes = structInfo.primitives.size();
_subMeshRenderings.resize(nSubMeshes, nullptr);
const auto &morph = structInfo.morph.value();
for (size_t iSubMesh = 0; iSubMesh < nSubMeshes; ++iSubMesh) {
const auto &subMeshMorphHolder = morph.subMeshMorphs[iSubMesh];
if (!subMeshMorphHolder.has_value()) {
continue;
}
const auto &subMeshMorph = subMeshMorphHolder.value();
if (PREFER_CPU_COMPUTING || subMeshMorph.targets.size() > pipeline::UBOMorph::MAX_MORPH_TARGET_COUNT) {
_subMeshRenderings[iSubMesh] = new CpuComputing(
_mesh,
static_cast<uint32_t>(iSubMesh),
&morph,
gfxDevice);
} else {
_subMeshRenderings[iSubMesh] = new GpuComputing(
_mesh,
static_cast<uint32_t>(iSubMesh),
&morph,
gfxDevice);
}
}
}
StdMorphRendering::~StdMorphRendering() = default;
MorphRenderingInstance *StdMorphRendering::createInstance() {
auto *ret = new StdMorphRenderingInstance(this);
return ret;
}
} // namespace cc
+55
View File
@@ -0,0 +1,55 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include "3d/assets/Morph.h"
#include "base/Ptr.h"
namespace cc {
class SubMeshMorphRendering;
/**
* Standard morph rendering.
* The standard morph rendering renders each of sub-mesh morph separately.
* Sub-mesh morph rendering may select different technique according sub-mesh morph itself.
*/
class StdMorphRendering final : public MorphRendering {
public:
explicit StdMorphRendering(Mesh *mesh, gfx::Device *gfxDevice);
~StdMorphRendering() override;
MorphRenderingInstance *createInstance() override;
private:
Mesh * _mesh{nullptr};
std::vector<IntrusivePtr<SubMeshMorphRendering>> _subMeshRenderings;
CC_DISALLOW_COPY_MOVE_ASSIGN(StdMorphRendering);
friend class StdMorphRenderingInstance;
};
} // namespace cc
+73
View File
@@ -0,0 +1,73 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/assets/Skeleton.h"
#include <iomanip>
#include <sstream>
#include "boost/container_hash/hash.hpp"
namespace cc {
const std::vector<Mat4> &Skeleton::getInverseBindposes() {
if (!_invBindposes.has_value()) {
_invBindposes = std::vector<Mat4>{};
for (const auto &bindpose : _bindposes) {
_invBindposes.value().emplace_back(bindpose.getInversed());
}
}
return *_invBindposes;
}
uint64_t Skeleton::getHash() {
// hashes should already be computed offline, but if not, make one
if (!_hash) {
std::stringstream sstr;
for (const auto &ibm : _bindposes) {
sstr << std::fixed << std::setprecision(2)
<< ibm.m[0] << " " << ibm.m[1] << " " << ibm.m[2] << " " << ibm.m[3] << " "
<< ibm.m[4] << " " << ibm.m[5] << " " << ibm.m[6] << " " << ibm.m[7] << " "
<< ibm.m[8] << " " << ibm.m[9] << " " << ibm.m[10] << " " << ibm.m[11] << " "
<< ibm.m[12] << " " << ibm.m[13] << " " << ibm.m[14] << " " << ibm.m[15] << "\n";
}
std::string str{sstr.str()};
std::size_t seed = 666;
boost::hash_range(seed, str.begin(), str.end());
_hash = static_cast<uint32_t>(seed);
}
return _hash;
}
bool Skeleton::destroy() {
//cjh TODO: (legacyCC.director.root?.dataPoolManager as DataPoolManager)?.releaseSkeleton(this);
return Super::destroy();
}
bool Skeleton::validate() const {
return !_joints.empty() && !_bindposes.empty();
}
} // namespace cc
+92
View File
@@ -0,0 +1,92 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include "core/assets/Asset.h"
namespace cc {
/**
* @en The skeleton asset. It stores the path related to [[SkinnedMeshRenderer.skinningRoot]] of all bones and its bind pose matrix.
* @zh 骨骼资源。骨骼资源记录了每个关节(相对于 [[SkinnedMeshRenderer.skinningRoot]])的路径以及它的绑定姿势矩阵。
*/
class Skeleton final : public Asset {
public:
using Super = Asset;
Skeleton() = default;
~Skeleton() override = default;
/**
* @en The path of all bones, the length always equals the length of [[bindposes]]
* @zh 所有关节的路径。该数组的长度始终与 [[bindposes]] 的长度相同。
*/
inline const std::vector<std::string> &getJoints() const {
return _joints;
}
inline void setJoints(const std::vector<std::string> &value) {
_joints = value;
}
/**
* @en The bind poses matrix of all bones, the length always equals the length of [[joints]]
* @zh 所有关节的绑定姿势矩阵。该数组的长度始终与 [[joints]] 的长度相同。
*/
const std::vector<Mat4> &getBindposes() const {
return _bindposes;
}
void setBindposes(const std::vector<Mat4> &value) {
_bindposes = value;
}
/**
* @en Gets the inverse bind poses matrix
* @zh 获取反向绑定姿势矩阵
*/
const std::vector<Mat4> &getInverseBindposes();
/**
* @en Gets the hash of the skeleton asset
* @zh 获取骨骼资源的哈希值
*/
uint64_t getHash();
void setHash(uint64_t hash) { _hash = hash; }
inline double getHashForJS() {
return static_cast<double>(getHash());
}
bool destroy() override;
bool validate() const override;
private:
std::vector<std::string> _joints;
std::vector<Mat4> _bindposes;
cc::optional<std::vector<Mat4>> _invBindposes;
uint64_t _hash{0};
};
} // namespace cc
+30
View File
@@ -0,0 +1,30 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/assets/Types.h"
namespace cc {
} // namespace cc
+111
View File
@@ -0,0 +1,111 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include "cocos/base/Optional.h"
#include "core/TypedArray.h"
namespace cc {
struct IMeshBufferView {
uint32_t offset{0};
uint32_t length{0};
uint32_t count{0};
uint32_t stride{0};
};
using MeshWeightsType = std::vector<float>;
/**
* @en Array views for index buffer
* @zh 允许存储索引的数组视图
*/
using IBArray = cc::variant<Uint8Array, Uint16Array, Uint32Array>;
template <typename T>
T getIBArrayValue(const IBArray &arr, uint32_t idx) {
#define IBARRAY_GET_VALUE(type) \
do { \
auto *p = cc::get_if<type>(&arr); \
if (p != nullptr) { \
return static_cast<T>((*p)[idx]); \
} \
} while (false)
IBARRAY_GET_VALUE(Uint16Array);
IBARRAY_GET_VALUE(Uint32Array);
IBARRAY_GET_VALUE(Uint8Array);
#undef IBARRAY_GET_VALUE
return 0;
}
struct MorphTarget {
/**
* Displacement of each target attribute.
*/
std::vector<IMeshBufferView> displacements;
};
struct SubMeshMorph {
/**
* Attributes to morph.
*/
std::vector<std::string> attributes;
/**
* Targets.
*/
std::vector<MorphTarget> targets;
/**
* Initial weights of each target.
*/
cc::optional<MeshWeightsType> weights;
};
struct Morph {
/**
* Morph data of each sub-mesh.
*/
std::vector<cc::optional<SubMeshMorph>> subMeshMorphs;
/**
* Common initial weights of each sub-mesh.
*/
cc::optional<MeshWeightsType> weights;
/**
* Name of each target of each sub-mesh morph.
* This field is only meaningful if every sub-mesh has the same number of targets.
*/
cc::optional<std::vector<std::string>> targetNames;
};
} // namespace cc
+116
View File
@@ -0,0 +1,116 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/misc/Buffer.h"
#include "cocos/base/Variant.h"
namespace cc {
namespace {
Record<gfx::FormatType, std::string> typeMap{
{gfx::FormatType::UNORM, "Uint"},
{gfx::FormatType::SNORM, "Int"},
{gfx::FormatType::UINT, "Uint"},
{gfx::FormatType::INT, "Int"},
{gfx::FormatType::UFLOAT, "Float"},
{gfx::FormatType::FLOAT, "Float"},
};
std::string getDataViewType(const gfx::FormatInfo &info) {
std::string type;
auto iter = typeMap.find(info.type);
if (iter != typeMap.end()) {
type = iter->second;
} else {
type = "Uint";
}
const uint32_t bytes = info.size / info.count * 8;
return type + std::to_string(bytes);
}
} // namespace
using DataVariant = cc::variant<int32_t, float>;
using MapBufferCallback = std::function<DataVariant(const DataVariant &cur, uint32_t idx, const DataView &view)>;
DataView mapBuffer(DataView & target,
const MapBufferCallback & callback,
cc::optional<gfx::Format> aFormat,
cc::optional<uint32_t> aOffset,
cc::optional<uint32_t> aLength,
cc::optional<uint32_t> aStride,
DataView * out) {
gfx::Format format = aFormat.has_value() ? aFormat.value() : gfx::Format::R32F;
uint32_t offset = aOffset.has_value() ? aOffset.value() : 0;
uint32_t length = aLength.has_value() ? aLength.value() : target.byteLength() - offset;
uint32_t stride = aStride.has_value() ? aStride.value() : 0;
DataView dataView;
if (out == nullptr) {
out = &dataView;
dataView.assign(target.buffer()->slice(target.byteOffset(), target.byteOffset() + target.byteLength()));
}
const auto &info = gfx::GFX_FORMAT_INFOS[static_cast<int32_t>(format)];
if (stride == 0) {
stride = info.size;
}
static const std::string SET_PREFIX{"set"};
static const std::string GET_PREFIX{"get"};
bool isFloat = info.type == gfx::FormatType::FLOAT || info.type == gfx::FormatType::UFLOAT;
DataView::IntWritter intWritter = nullptr;
if (!isFloat) {
intWritter = DataView::intWritterMap[SET_PREFIX + getDataViewType(info)];
}
DataView::ReaderVariant intReader;
if (!isFloat) {
intReader = DataView::intReaderMap[GET_PREFIX + getDataViewType(info)];
}
const uint32_t componentBytesLength = info.size / info.count;
const uint32_t nSeg = floor(length / stride);
for (uint32_t iSeg = 0; iSeg < nSeg; ++iSeg) {
const uint32_t x = offset + stride * iSeg;
for (uint32_t iComponent = 0; iComponent < info.count; ++iComponent) {
const uint32_t y = x + componentBytesLength * iComponent;
if (isFloat) {
float cur = target.getFloat32(y);
out->setFloat32(y, cc::get<1>(callback(cur, iComponent, target)));
} else {
int32_t cur = target.readInt(intReader, y);
// iComponent is usually more useful than y
(target.*intWritter)(y, cc::get<0>(callback(cur, iComponent, target)));
}
}
}
return dataView;
}
} // namespace cc
+126
View File
@@ -0,0 +1,126 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include <cmath>
#include "cocos/base/Optional.h"
#include "core/DataView.h"
#include "renderer/gfx-base/GFXDef.h"
namespace cc {
// default params behaviors just like on an plain, compact Float32Array
template <typename T>
void writeBuffer(DataView & target,
const std::vector<T> &data,
const gfx::Format & format = gfx::Format::R32F,
uint32_t offset = 0,
uint32_t stride = 0) {
const gfx::FormatInfo &info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(format)];
if (stride == 0) {
stride = info.size;
}
const uint32_t componentBytesLength = info.size / info.count;
const auto nSeg = static_cast<uint32_t>(floor(data.size() / info.count));
const uint32_t bytes = info.size / info.count * 8;
for (uint32_t iSeg = 0; iSeg < nSeg; ++iSeg) {
uint32_t x = offset + stride * iSeg;
for (uint32_t iComponent = 0; iComponent < info.count; ++iComponent) {
const uint32_t y = x + componentBytesLength * iComponent;
// default Little-Endian
switch (info.type) {
case gfx::FormatType::UINT:
case gfx::FormatType::UNORM:
switch (bytes) {
case 8:
target.setUint8(y, static_cast<uint8_t>(data[info.count * iSeg + iComponent]));
break;
case 16:
target.setUint16(y, static_cast<uint16_t>(data[info.count * iSeg + iComponent]));
break;
case 32:
target.setUint32(y, static_cast<uint32_t>(data[info.count * iSeg + iComponent]));
break;
default:
CC_ASSERT(false);
break;
}
break;
case gfx::FormatType::INT:
case gfx::FormatType::SNORM:
switch (bytes) {
case 8:
target.setInt8(y, static_cast<int8_t>(data[info.count * iSeg + iComponent]));
break;
case 16:
target.setInt16(y, static_cast<int16_t>(data[info.count * iSeg + iComponent]));
break;
case 32:
target.setInt32(y, static_cast<int32_t>(data[info.count * iSeg + iComponent]));
break;
default:
CC_ASSERT(false);
break;
}
break;
case gfx::FormatType::UFLOAT:
case gfx::FormatType::FLOAT:
switch (bytes) {
case 8:
target.setFloat32(y, static_cast<float>(data[info.count * iSeg + iComponent]));
break;
case 16:
target.setFloat32(y, static_cast<float>(data[info.count * iSeg + iComponent]));
break;
case 32:
target.setFloat32(y, static_cast<float>(data[info.count * iSeg + iComponent]));
break;
default:
CC_ASSERT(false);
break;
}
break;
default:
CC_ASSERT(false);
break;
}
}
}
}
using DataVariant = cc::variant<int32_t, float>;
using MapBufferCallback = std::function<DataVariant(const DataVariant &cur, uint32_t idx, const DataView &view)>;
DataView mapBuffer(DataView & target,
const MapBufferCallback & callback,
cc::optional<gfx::Format> aFormat,
cc::optional<uint32_t> aOffset,
cc::optional<uint32_t> aLength,
cc::optional<uint32_t> aStride,
DataView * out);
} // namespace cc
@@ -1,5 +1,5 @@
/****************************************************************************
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
@@ -22,43 +22,43 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include "math/Vec3.h"
#include "scene/AABB.h"
#include "scene/Frustum.h"
#include "3d/misc/BufferBlob.h"
#include "core/TypedArray.h"
namespace cc {
namespace scene {
class Sphere {
public:
Sphere() = default;
Sphere(const Sphere &) = delete;
Sphere(Sphere &&) = delete;
~Sphere() = default;
Sphere &operator=(const Sphere &) = delete;
Sphere &operator=(Sphere &&) = delete;
void BufferBlob::setNextAlignment(uint32_t align) {
if (align != 0) {
const uint32_t remainder = _length % align;
if (remainder != 0) {
const uint32_t padding = align - remainder;
_arrayBufferOrPaddings.emplace_back(padding);
_length += padding;
}
}
}
inline float getRadius() const { return _radius; }
inline const Vec3 &getCenter() const { return _center; }
inline void setCenter(const Vec3 &val) { _center = val; }
inline void setRadius(float val) { _radius = val; }
uint32_t BufferBlob::addBuffer(ArrayBuffer *arrayBuffer) {
const uint32_t result = _length;
_arrayBufferOrPaddings.emplace_back(arrayBuffer);
_length += arrayBuffer->byteLength();
return result;
}
void define(const AABB &aabb);
void merge(const AABB *aabb);
void merge(const Vec3 &point);
bool interset(const Frustum &frustum) const;
int interset(const Plane &plane) const;
int spherePlane(const Plane &plane);
bool sphereFrustum(const Frustum &frustum) const;
void merge(const Frustum &frustum);
ArrayBuffer::Ptr BufferBlob::getCombined() {
Int8Array result(_length);
uint32_t counter = 0;
private:
float _radius{-1.0F};
Vec3 _center;
};
for (const auto &arrayBufferOrPadding : _arrayBufferOrPaddings) {
if (const auto *p = cc::get_if<uint32_t>(&arrayBufferOrPadding)) {
counter += *p;
} else if (const auto *p = cc::get_if<ArrayBuffer::Ptr>(&arrayBufferOrPadding)) {
result.set(*p, counter);
counter += (*p)->byteLength();
}
}
return result.buffer();
}
} // namespace scene
} // namespace cc
+48
View File
@@ -0,0 +1,48 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include <vector>
#include "cocos/base/Variant.h"
#include "core/ArrayBuffer.h"
namespace cc {
class BufferBlob {
public:
void setNextAlignment(uint32_t align);
uint32_t addBuffer(ArrayBuffer *arrayBuffer);
inline uint32_t getLength() const { return _length; }
ArrayBuffer::Ptr getCombined();
private:
std::vector<cc::variant<ArrayBuffer::Ptr, uint32_t>> _arrayBufferOrPaddings;
uint32_t _length{0};
};
} // namespace cc
+247
View File
@@ -0,0 +1,247 @@
#include "3d/misc/CreateMesh.h"
#include <algorithm>
#include "3d/misc/Buffer.h"
#include "3d/misc/BufferBlob.h"
#include "core/ArrayBuffer.h"
#include "core/DataView.h"
#include "core/assets/RenderingSubMesh.h"
#include "renderer/gfx-base/GFXDef-common.h"
namespace cc {
namespace {
gfx::AttributeList defAttrs = {
gfx::Attribute{gfx::ATTR_NAME_POSITION, gfx::Format::RGB32F},
gfx::Attribute{gfx::ATTR_NAME_NORMAL, gfx::Format::RGB32F},
gfx::Attribute{gfx::ATTR_NAME_TEX_COORD, gfx::Format::RG32F},
gfx::Attribute{gfx::ATTR_NAME_TANGENT, gfx::Format::RGBA32F},
gfx::Attribute{gfx::ATTR_NAME_COLOR, gfx::Format::RGBA32F},
};
} // namespace
Mesh::ICreateInfo createMeshInfo(const IGeometry &geometry, const ICreateMeshOptions &options /* = {}*/) {
// Collect attributes and calculate length of result vertex buffer.
gfx::AttributeList attributes;
uint32_t stride = 0;
struct Channel {
uint32_t offset{0};
std::vector<float> data; // float?
gfx::Attribute attribute;
};
std::vector<Channel> channels;
uint32_t vertCount = 0;
const gfx::Attribute *attr = nullptr;
std::vector<float> positions(geometry.positions);
if (!positions.empty()) {
attr = nullptr;
if (geometry.attributes.has_value()) {
for (const auto &att : geometry.attributes.value()) {
if (att.name == gfx::ATTR_NAME_POSITION) {
attr = &att;
break;
}
}
}
if (attr == nullptr) {
attr = &defAttrs[0];
}
attributes.emplace_back(*attr);
const auto &info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attr->format)];
vertCount = std::max(vertCount, static_cast<uint32_t>(std::floor(positions.size() / info.count)));
channels.emplace_back(Channel{stride, positions, *attr});
stride += info.size;
}
if (geometry.normals.has_value() && !geometry.normals.value().empty()) {
attr = nullptr;
if (geometry.attributes.has_value()) {
for (const auto &att : geometry.attributes.value()) {
if (att.name == gfx::ATTR_NAME_NORMAL) {
attr = &att;
break;
}
}
}
if (attr == nullptr) {
attr = &defAttrs[1];
}
attributes.emplace_back(*attr);
const auto &info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attr->format)];
vertCount = std::max(vertCount, static_cast<uint32_t>(std::floor(geometry.normals->size() / info.count)));
channels.emplace_back(Channel{stride, geometry.normals.value(), *attr});
stride += info.size;
}
if (geometry.uvs.has_value() && !geometry.uvs.value().empty()) {
attr = nullptr;
if (geometry.attributes.has_value()) {
for (const auto &att : geometry.attributes.value()) {
if (att.name == gfx::ATTR_NAME_TEX_COORD) {
attr = &att;
break;
}
}
}
if (attr == nullptr) {
attr = &defAttrs[2];
}
attributes.emplace_back(*attr);
const auto &info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attr->format)];
vertCount = std::max(vertCount, static_cast<uint32_t>(std::floor(geometry.uvs->size() / info.count)));
channels.emplace_back(Channel{stride, geometry.uvs.value(), *attr});
stride += info.size;
}
if (geometry.tangents.has_value() && !geometry.tangents.value().empty()) {
attr = nullptr;
if (geometry.attributes.has_value()) {
for (const auto &att : geometry.attributes.value()) {
if (att.name == gfx::ATTR_NAME_TANGENT) {
attr = &att;
break;
}
}
}
if (attr == nullptr) {
attr = &defAttrs[3];
}
attributes.emplace_back(*attr);
const auto &info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attr->format)];
vertCount = std::max(vertCount, static_cast<uint32_t>(std::floor(geometry.tangents->size() / info.count)));
channels.emplace_back(Channel{stride, geometry.tangents.value(), *attr});
stride += info.size;
}
if (geometry.colors.has_value() && !geometry.colors.value().empty()) {
attr = nullptr;
if (geometry.attributes.has_value()) {
for (const auto &att : geometry.attributes.value()) {
if (att.name == gfx::ATTR_NAME_COLOR) {
attr = &att;
break;
}
}
}
if (attr == nullptr) {
attr = &defAttrs[4];
}
attributes.emplace_back(*attr);
const auto &info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attr->format)];
vertCount = std::max(vertCount, static_cast<uint32_t>(std::floor(geometry.colors->size() / info.count)));
channels.emplace_back(Channel{stride, geometry.colors.value(), *attr});
stride += info.size;
}
if (geometry.customAttributes.has_value()) {
for (const auto &ca : geometry.customAttributes.value()) {
const auto &info = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(attr->format)];
attributes.emplace_back(ca.attr);
vertCount = std::max(vertCount, static_cast<uint32_t>(std::floor(ca.values.size() / info.count)));
channels.emplace_back(Channel{stride, ca.values, ca.attr});
stride += info.size;
}
}
// Use this to generate final merged buffer.
BufferBlob bufferBlob;
// Fill vertex buffer.
auto * vertexBuffer = new ArrayBuffer(vertCount * stride);
DataView vertexBufferView(vertexBuffer);
for (const auto &channel : channels) {
writeBuffer(vertexBufferView, channel.data, channel.attribute.format, channel.offset, stride);
}
bufferBlob.setNextAlignment(0);
Mesh::IVertexBundle vertexBundle;
Mesh::IBufferView buffferView;
buffferView.offset = bufferBlob.getLength();
buffferView.length = static_cast<uint32_t>(vertexBuffer->byteLength());
buffferView.count = vertCount;
buffferView.stride = stride;
vertexBundle.attributes = attributes;
vertexBundle.view = buffferView;
bufferBlob.addBuffer(vertexBuffer);
// Fill index buffer.
ArrayBuffer::Ptr indexBuffer;
uint32_t idxCount = 0;
const uint32_t idxStride = 2;
if (geometry.indices.has_value()) {
const std::vector<uint32_t> &indices = geometry.indices.value();
idxCount = static_cast<uint32_t>(indices.size());
indexBuffer = new ArrayBuffer(idxStride * idxCount);
DataView indexBufferView(indexBuffer);
writeBuffer(indexBufferView, indices, gfx::Format::R16UI);
}
// Create primitive.
Mesh::ISubMesh primitive;
primitive.vertexBundelIndices = {0};
primitive.primitiveMode = geometry.primitiveMode.has_value() ? geometry.primitiveMode.value() : gfx::PrimitiveMode::TRIANGLE_LIST;
if (indexBuffer) {
bufferBlob.setNextAlignment(idxStride);
Mesh::IBufferView bufferView;
bufferView.offset = bufferBlob.getLength();
bufferView.length = indexBuffer->byteLength();
bufferView.count = idxCount;
bufferView.stride = idxStride;
primitive.indexView = bufferView;
bufferBlob.addBuffer(indexBuffer);
}
cc::optional<Vec3> minPosition = geometry.minPos;
if (minPosition.has_value() && options.calculateBounds.has_value() && options.calculateBounds.value()) {
minPosition = Vec3(std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity());
for (uint32_t iVertex = 0; iVertex < vertCount; ++iVertex) {
Vec3::min(minPosition.value(), Vec3(positions[iVertex * 3 + 0], positions[iVertex * 3 + 1], positions[iVertex * 3 + 2]), &minPosition.value());
}
}
cc::optional<Vec3> maxPosition = geometry.maxPos;
if (maxPosition.has_value() && options.calculateBounds.has_value() && options.calculateBounds.value()) {
maxPosition = Vec3(-std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity());
for (uint32_t iVertex = 0; iVertex < vertCount; ++iVertex) {
Vec3::max(maxPosition.value(), Vec3(positions[iVertex * 3 + 0], positions[iVertex * 3 + 1], positions[iVertex * 3 + 2]), &maxPosition.value());
}
}
// Create mesh struct
Mesh::IStruct meshStruct;
meshStruct.vertexBundles = {vertexBundle};
meshStruct.primitives = {primitive};
if (minPosition.has_value()) {
meshStruct.minPosition = minPosition.value();
}
if (maxPosition.has_value()) {
meshStruct.maxPosition = maxPosition.value();
}
Mesh::ICreateInfo createInfo;
createInfo.structInfo = std::move(meshStruct);
createInfo.data = Uint8Array(bufferBlob.getCombined());
return createInfo;
}
Mesh *createMesh(const IGeometry &geometry, const ICreateMeshOptions &options /* = {}*/) {
auto *out = new Mesh();
out->reset(createMeshInfo(geometry, options));
return out;
}
} // namespace cc
+41
View File
@@ -0,0 +1,41 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include "cocos/base/Optional.h"
#include "3d/assets/Mesh.h"
#include "primitive/PrimitiveDefine.h"
namespace cc {
struct ICreateMeshOptions {
cc::optional<bool> calculateBounds;
};
Mesh * createMesh(const IGeometry &geometry, const ICreateMeshOptions &options = {});
Mesh::ICreateInfo createMeshInfo(const IGeometry &geometry, const ICreateMeshOptions &options = {});
} // namespace cc
@@ -0,0 +1,245 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/models/BakedSkinningModel.h"
#include "3d/assets/Mesh.h"
//#include "3d/skeletal-animation/DataPoolManager.h"
#include "core/Root.h"
#include "scene/Model.h"
#include "scene/SubModel.h"
namespace {
const cc::gfx::SamplerInfo JOINT_TEXTURE_SAMPLER_INFO{
cc::gfx::Filter::POINT,
cc::gfx::Filter::POINT,
cc::gfx::Filter::NONE,
cc::gfx::Address::CLAMP,
cc::gfx::Address::CLAMP,
cc::gfx::Address::CLAMP,
};
std::vector<cc::scene::IMacroPatch> myPatches{
{"CC_USE_SKINNING", true},
{"CC_USE_BAKED_ANIMATION", true}};
const std::string INST_JOINT_ANIM_INFO = "a_jointAnimInfo";
} // namespace
namespace cc {
BakedSkinningModel::BakedSkinningModel()
//, _dataPoolManager(Root::getInstance()->getDataPoolManager())
{
_type = Model::Type::BAKED_SKINNING;
_jointMedium.jointTextureInfo.reset(4);
// JSB uses _dataPoolManager in JS and the data is synchronized by syncDataForJS & syncAnimInfoForJS
// _jointMedium.animInfo = _dataPoolManager->jointAnimationInfo->getData();
}
void BakedSkinningModel::destroy() {
// CC_SAFE_DELETE(uploadedAnim);
_jointMedium.boundsInfo.clear();
if (_jointMedium.buffer != nullptr) {
CC_SAFE_DESTROY(_jointMedium.buffer);
}
if (_jointMedium.texture.has_value()) {
CC_SAFE_DELETE(_jointMedium.texture.value());
}
applyJointTexture(cc::nullopt);
Super::destroy();
}
void BakedSkinningModel::bindSkeleton(Skeleton *skeleton, Node *skinningRoot, Mesh *mesh) {
_skeleton = skeleton;
_mesh = mesh;
if (skeleton == nullptr || skinningRoot == nullptr || mesh == nullptr) return;
setTransform(skinningRoot);
// JSB uses _dataPoolManager in JS and the data is synchronized by syncDataForJS & syncAnimInfoForJS
// _jointMedium.animInfo = _dataPoolManager->jointAnimationInfo->getData(skinningRoot->getUuid());
if (_jointMedium.buffer == nullptr) {
_jointMedium.buffer = _device->createBuffer({
gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST,
gfx::MemoryUsageBit::DEVICE,
pipeline::UBOSkinning::SIZE,
pipeline::UBOSkinning::SIZE,
});
}
}
void BakedSkinningModel::updateTransform(uint32_t stamp) {
Super::updateTransform(stamp);
if (!_isUploadedAnim) {
return;
}
IAnimInfo & animInfo = _jointMedium.animInfo;
geometry::AABB *skelBound = nullptr;
const float * curFrame = animInfo.curFrame;
// float curFrame = info.data[0];
auto index = static_cast<index_t>(std::roundf(*curFrame));
if (!_jointMedium.boundsInfo.empty() && index < _jointMedium.boundsInfo.size()) {
skelBound = &_jointMedium.boundsInfo[index].value();
}
if (_worldBounds && skelBound != nullptr) {
Node *node = getTransform();
skelBound->transform(node->getWorldMatrix(), _worldBounds);
}
}
void BakedSkinningModel::updateUBOs(uint32_t stamp) {
Super::updateUBOs(stamp);
IAnimInfo & info = _jointMedium.animInfo;
int idx = _instAnimInfoIdx;
const float *curFrame = info.curFrame;
uint32_t frameDataBytes = info.frameDataBytes;
// float curFrame = info.data[0];
// uint32_t curFrameDataBytes = info.data.byteLength();
if (idx >= 0) {
auto &views = getInstancedAttributeBlock()->views[idx];
setTypedArrayValue(views, 0, *curFrame);
} else if (*info.dirtyForJSB != 0) {
info.buffer->update(curFrame, frameDataBytes);
*info.dirtyForJSB = 0;
}
}
void BakedSkinningModel::applyJointTexture(const cc::optional<IJointTextureHandle *> &texture) {
auto oldTex = _jointMedium.texture;
if (oldTex.has_value() && texture.has_value() && (&oldTex.value() != &texture.value())) {
// _dataPoolManager->jointTexturePool->releaseHandle(oldTex.value());
}
_jointMedium.texture = texture;
if (!texture.has_value()) {
return;
}
auto *textureHandle = texture.value();
auto *buffer = _jointMedium.buffer.get();
auto &jointTextureInfo = _jointMedium.jointTextureInfo;
jointTextureInfo[0] = static_cast<float>(textureHandle->handle.texture->getWidth());
jointTextureInfo[1] = static_cast<float>(_skeleton->getJoints().size());
jointTextureInfo[2] = static_cast<float>(textureHandle->pixelOffset) + 0.1F; // guard against floor() underflow
jointTextureInfo[3] = 1 / jointTextureInfo[0];
updateInstancedJointTextureInfo();
if (buffer != nullptr) {
buffer->update(&jointTextureInfo[0], jointTextureInfo.byteLength());
}
auto *tex = textureHandle->handle.texture;
for (const auto &subModel : _subModels) {
auto *descriptorSet = subModel->getDescriptorSet();
descriptorSet->bindTexture(pipeline::JOINTTEXTURE::BINDING, tex);
}
}
std::vector<scene::IMacroPatch> &BakedSkinningModel::getMacroPatches(index_t subModelIndex) {
auto &patches = Super::getMacroPatches(subModelIndex);
patches.reserve(patches.size() + myPatches.size());
patches.insert(std::end(patches), std::begin(myPatches), std::end(myPatches));
return patches;
}
void BakedSkinningModel::updateLocalDescriptors(index_t subModelIndex, gfx::DescriptorSet *descriptorSet) {
Super::updateLocalDescriptors(subModelIndex, descriptorSet);
gfx::Buffer * buffer = _jointMedium.buffer;
auto & texture = _jointMedium.texture;
const IAnimInfo &animInfo = _jointMedium.animInfo;
descriptorSet->bindBuffer(pipeline::UBOSkinningTexture::BINDING, buffer);
descriptorSet->bindBuffer(pipeline::UBOSkinningAnimation::BINDING, animInfo.buffer);
if (texture.has_value()) {
auto *sampler = _device->getSampler(JOINT_TEXTURE_SAMPLER_INFO);
descriptorSet->bindTexture(pipeline::JOINTTEXTURE::BINDING, texture.value()->handle.texture);
descriptorSet->bindSampler(pipeline::JOINTTEXTURE::BINDING, sampler);
}
}
void BakedSkinningModel::updateInstancedAttributes(const std::vector<gfx::Attribute> &attributes, scene::Pass *pass) {
Super::updateInstancedAttributes(attributes, pass);
_instAnimInfoIdx = getInstancedAttributeIndex(INST_JOINT_ANIM_INFO);
updateInstancedJointTextureInfo();
}
void BakedSkinningModel::updateInstancedJointTextureInfo() {
const auto & jointTextureInfo = _jointMedium.jointTextureInfo;
const IAnimInfo &animInfo = _jointMedium.animInfo;
index_t idx = _instAnimInfoIdx;
if (idx >= 0) {
auto &view = getInstancedAttributeBlock()->views[idx];
setTypedArrayValue(view, 0, *animInfo.curFrame); //NOTE: curFrame is only used in JSB.
setTypedArrayValue(view, 1, jointTextureInfo[1]);
setTypedArrayValue(view, 2, jointTextureInfo[2]);
}
}
void BakedSkinningModel::syncAnimInfoForJS(gfx::Buffer *buffer, const Float32Array &data, Uint8Array &dirty) {
_jointMedium.animInfo.buffer = buffer;
_jointMedium.animInfo.curFrame = &data[0];
_jointMedium.animInfo.frameDataBytes = data.byteLength();
_jointMedium.animInfo.dirtyForJSB = &dirty[0];
}
void BakedSkinningModel::syncDataForJS(const std::vector<cc::optional<geometry::AABB>> &boundsInfo,
const cc::optional<geometry::AABB> & modelBound,
float jointTextureInfo0,
float jointTextureInfo1,
float jointTextureInfo2,
float jointTextureInfo3,
gfx::Texture * tex,
const Float32Array & animInfoData) {
_jointMedium.boundsInfo = boundsInfo;
if (modelBound.has_value()) {
const geometry::AABB &modelBounldValue = modelBound.value();
_modelBounds->set(modelBounldValue.center, modelBounldValue.halfExtents);
} else {
_modelBounds = nullptr;
}
_jointMedium.jointTextureInfo[0] = jointTextureInfo0;
_jointMedium.jointTextureInfo[1] = jointTextureInfo1;
_jointMedium.jointTextureInfo[2] = jointTextureInfo2;
_jointMedium.jointTextureInfo[3] = jointTextureInfo3;
_jointMedium.animInfo.curFrame = &animInfoData[0];
_jointMedium.animInfo.frameDataBytes = animInfoData.byteLength();
IJointTextureHandle *textureInfo = IJointTextureHandle::createJoinTextureHandle();
textureInfo->handle.texture = tex;
_jointMedium.texture = textureInfo;
updateInstancedJointTextureInfo();
auto *buffer = _jointMedium.buffer.get();
if (buffer != nullptr) {
buffer->update(&_jointMedium.jointTextureInfo[0], _jointMedium.jointTextureInfo.byteLength());
}
for (const auto &subModel : _subModels) {
auto *descriptorSet = subModel->getDescriptorSet();
descriptorSet->bindTexture(pipeline::JOINTTEXTURE::BINDING, tex);
}
}
} // namespace cc
+104
View File
@@ -0,0 +1,104 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include <utility>
#include "3d/assets/Skeleton.h"
#include "3d/models/MorphModel.h"
#include "3d/skeletal-animation/SkeletalAnimationUtils.h"
#include "gfx-base/GFXDef-common.h"
namespace cc {
namespace gfx {
class Texture;
}
class DataPoolManager;
struct BakedJointInfo {
IntrusivePtr<gfx::Buffer> buffer;
Float32Array jointTextureInfo;
cc::optional<IJointTextureHandle *> texture;
IAnimInfo animInfo;
std::vector<cc::optional<geometry::AABB>> boundsInfo;
};
class BakedSkinningModel final : public MorphModel {
public:
using Super = MorphModel;
BakedSkinningModel();
~BakedSkinningModel() override = default;
void destroy() override;
std::vector<scene::IMacroPatch> &getMacroPatches(index_t subModelIndex) override;
void updateLocalDescriptors(index_t subModelIndex, gfx::DescriptorSet *descriptorSet) override;
void updateTransform(uint32_t stamp) override;
void updateUBOs(uint32_t stamp) override;
void updateInstancedAttributes(const std::vector<gfx::Attribute> &attributes, scene::Pass *pass) override;
void updateInstancedJointTextureInfo();
// void uploadAnimation(AnimationClip *anim); // TODO(xwx): AnimationClip not define
void bindSkeleton(Skeleton *skeleton, Node *skinningRoot, Mesh *mesh);
inline void updateModelBounds(geometry::AABB *modelBounds) {
if (modelBounds == nullptr) {
return;
}
_modelBounds->setValid(true);
_modelBounds->set(modelBounds->getCenter(), modelBounds->getHalfExtents());
}
void syncAnimInfoForJS(gfx::Buffer *buffer, const Float32Array &data, Uint8Array &dirty);
void syncDataForJS(const std::vector<cc::optional<geometry::AABB>> &boundsInfo,
const cc::optional<geometry::AABB> & modelBound,
float jointTextureInfo0,
float jointTextureInfo1,
float jointTextureInfo2,
float jointTextureInfo3,
gfx::Texture * tex,
const Float32Array & animInfoData);
void setUploadedAnimForJS(bool value) { _isUploadedAnim = value; }
protected:
void applyJointTexture(const cc::optional<IJointTextureHandle *> &texture);
private:
BakedJointInfo _jointMedium;
index_t _instAnimInfoIdx{CC_INVALID_INDEX};
// IntrusivePtr<DataPoolManager> _dataPoolManager;
IntrusivePtr<Skeleton> _skeleton;
IntrusivePtr<Mesh> _mesh;
// AnimationClip* uploadedAnim;
bool _isUploadedAnim{false};
CC_DISALLOW_COPY_MOVE_ASSIGN(BakedSkinningModel);
};
} // namespace cc
+61
View File
@@ -0,0 +1,61 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/models/MorphModel.h"
#include "core/event/EventTypesToJS.h"
namespace cc {
std::vector<scene::IMacroPatch> &MorphModel::getMacroPatches(index_t subModelIndex) {
if (_morphRenderingInstance) {
_macroPatches = _morphRenderingInstance->requiredPatches(subModelIndex);
} else {
_macroPatches.clear();
}
return _macroPatches;
}
void MorphModel::initSubModel(index_t idx, RenderingSubMesh *subMeshData, Material *mat) {
Super::initSubModel(idx, subMeshData, launderMaterial(mat));
}
void MorphModel::destroy() {
Super::destroy();
_morphRenderingInstance = nullptr; //minggo: should delete it?
}
void MorphModel::setSubModelMaterial(index_t idx, Material *mat) {
Super::setSubModelMaterial(idx, launderMaterial(mat));
}
void MorphModel::updateLocalDescriptors(index_t subModelIndex, gfx::DescriptorSet *descriptorSet) {
Super::updateLocalDescriptors(subModelIndex, descriptorSet);
if (_morphRenderingInstance) {
_morphRenderingInstance->adaptPipelineState(subModelIndex, descriptorSet);
}
}
} // namespace cc
+59
View File
@@ -0,0 +1,59 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include <set>
#include <vector>
#include "3d/assets/Morph.h"
#include "scene/Define.h"
#include "scene/Model.h"
namespace cc {
class MorphModel : public scene::Model {
public:
using Super = scene::Model;
MorphModel() = default;
~MorphModel() override = default;
CC_DISALLOW_COPY_MOVE_ASSIGN(MorphModel);
std::vector<scene::IMacroPatch> &getMacroPatches(index_t subModelIndex) override;
void initSubModel(index_t idx, RenderingSubMesh *subMeshData, Material *mat) override;
void destroy() override;
void setSubModelMaterial(index_t idx, Material *mat) override;
inline void setMorphRendering(MorphRenderingInstance *morphRendering) { _morphRenderingInstance = morphRendering; }
protected:
void updateLocalDescriptors(index_t subModelIndex, gfx::DescriptorSet *descriptorSet) override;
private:
inline Material *launderMaterial(Material *material) { return material; } //NOLINT(readability-convert-member-functions-to-static)
IntrusivePtr<MorphRenderingInstance> _morphRenderingInstance;
};
} // namespace cc
+228
View File
@@ -0,0 +1,228 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/models/SkinningModel.h"
#include <array>
#include <utility>
#include "3d/assets/Mesh.h"
#include "3d/assets/Skeleton.h"
#include "core/scene-graph/Node.h"
#include "renderer/gfx-base/GFXBuffer.h"
#include "scene/Pass.h"
#include "scene/RenderScene.h"
namespace {
void getRelevantBuffers(std::vector<index_t> &outIndices, std::vector<int32_t> &outBuffers, const std::vector<std::vector<int32_t>> &jointMaps, int32_t targetJoint) {
for (int32_t i = 0; i < jointMaps.size(); i++) {
index_t index = CC_INVALID_INDEX;
for (int32_t j = 0; j < jointMaps[i].size(); j++) {
if (jointMaps[i][j] == targetJoint) {
index = j;
break;
}
}
if (index >= 0) {
outBuffers.emplace_back(i);
outIndices.emplace_back(index);
}
}
}
std::vector<cc::scene::IMacroPatch> myPatches{{"CC_USE_SKINNING", true}};
} // namespace
namespace cc {
SkinningModel::SkinningModel() {
_type = Model::Type::SKINNING;
}
SkinningModel::~SkinningModel() {
for (auto *curr : _dataArray) {
delete curr;
}
}
void SkinningModel::destroy() {
bindSkeleton(nullptr, nullptr, nullptr);
if (!_buffers.empty()) {
for (gfx::Buffer *buffer : _buffers) {
CC_SAFE_DESTROY(buffer);
}
_buffers.clear();
}
Super::destroy();
}
void SkinningModel::bindSkeleton(Skeleton *skeleton, Node *skinningRoot, Mesh *mesh) {
for (const JointInfo &joint : _joints) {
deleteTransform(joint.target);
}
_bufferIndices.clear();
_joints.clear();
if (!skeleton || !skinningRoot || !mesh) return;
setTransform(skinningRoot);
auto boneSpaceBounds = mesh->getBoneSpaceBounds(skeleton);
const auto &jointMaps = mesh->getStruct().jointMaps;
ensureEnoughBuffers((jointMaps.has_value() && !jointMaps->empty()) ? static_cast<int32_t>(jointMaps->size()) : 1);
_bufferIndices = mesh->getJointBufferIndices();
for (index_t index = 0; index < skeleton->getJoints().size(); ++index) {
geometry::AABB *bound = boneSpaceBounds[index];
auto * target = skinningRoot->getChildByPath(skeleton->getJoints()[index]);
if (!bound || !target) continue;
auto * transform = cc::getTransform(target, skinningRoot);
const Mat4 & bindPose = skeleton->getBindposes()[index];
std::vector<index_t> indices;
std::vector<index_t> buffers;
if (!jointMaps.has_value()) {
indices.emplace_back(index);
buffers.emplace_back(0);
} else {
getRelevantBuffers(indices, buffers, jointMaps.value(), index);
}
JointInfo jointInfo;
jointInfo.bound = bound;
jointInfo.target = target;
jointInfo.bindpose = bindPose;
jointInfo.transform = transform;
jointInfo.buffers = std::move(buffers);
jointInfo.indices = std::move(indices);
_joints.emplace_back(std::move(jointInfo));
}
}
void SkinningModel::updateTransform(uint32_t stamp) {
auto *root = getTransform();
if (root->getChangedFlags() || root->getDirtyFlag()) {
root->updateWorldTransform();
_localDataUpdated = true;
}
Vec3 v3Min{INFINITY, INFINITY, INFINITY};
Vec3 v3Max{-INFINITY, -INFINITY, -INFINITY};
geometry::AABB ab1;
Vec3 v31;
Vec3 v32;
for (JointInfo &jointInfo : _joints) {
const auto *bound = jointInfo.bound;
auto * transform = jointInfo.transform;
Mat4 worldMatrix = cc::getWorldMatrix(transform, static_cast<int32_t>(stamp));
jointInfo.bound->transform(worldMatrix, &ab1);
ab1.getBoundary(&v31, &v32);
Vec3::min(v3Min, v31, &v3Min);
Vec3::max(v3Max, v32, &v3Max);
}
if (_modelBounds->isValid() && _worldBounds) {
geometry::AABB::fromPoints(v3Min, v3Max, _modelBounds);
_modelBounds->transform(root->getWorldMatrix(), _worldBounds);
}
}
void SkinningModel::updateUBOs(uint32_t stamp) {
Super::updateUBOs(stamp);
uint32_t bIdx = 0;
Mat4 mat4;
for (const JointInfo &jointInfo : _joints) {
Mat4::multiply(jointInfo.transform->world, jointInfo.bindpose, &mat4);
for (uint32_t buffer : jointInfo.buffers) {
uploadJointData(jointInfo.indices[bIdx] * 12, mat4, _dataArray[buffer]->data());
bIdx++;
}
bIdx = 0;
}
bIdx = 0;
for (const auto &buffer : _buffers) {
buffer->update(_dataArray[bIdx]->data(), buffer->getSize());
bIdx++;
}
}
void SkinningModel::initSubModel(index_t idx, RenderingSubMesh *subMeshData, Material *mat) {
const auto &original = subMeshData->getVertexBuffers();
auto & iaInfo = subMeshData->getIaInfo();
iaInfo.vertexBuffers = subMeshData->getJointMappedBuffers();
Super::initSubModel(idx, subMeshData, mat);
iaInfo.vertexBuffers = original;
}
std::vector<scene::IMacroPatch> &SkinningModel::getMacroPatches(index_t subModelIndex) {
auto &patches = Super::getMacroPatches(subModelIndex);
patches.reserve(myPatches.size() + patches.size());
patches.insert(std::begin(patches), std::begin(myPatches), std::end(myPatches));
return patches;
}
void SkinningModel::uploadJointData(uint32_t base, const Mat4 &mat, float *dst) {
memcpy(reinterpret_cast<void *>(dst + base), mat.m, sizeof(float) * 12);
dst[base + 3] = mat.m[12];
dst[base + 7] = mat.m[13];
dst[base + 11] = mat.m[14];
}
void SkinningModel::updateLocalDescriptors(index_t submodelIdx, gfx::DescriptorSet *descriptorset) {
Super::updateLocalDescriptors(submodelIdx, descriptorset);
gfx::Buffer *buffer = _buffers[_bufferIndices[submodelIdx]];
if (buffer) {
descriptorset->bindBuffer(pipeline::UBOSkinning::BINDING, buffer);
}
}
void SkinningModel::updateInstancedAttributes(const std::vector<gfx::Attribute> &attributes, scene::Pass *pass) {
if (pass->getBatchingScheme() != scene::BatchingSchemes::NONE) {
// TODO(holycanvas): #9203 better to print the complete path instead of only the current node
// warnID(3936, this.node.name);
CC_LOG_WARNING("pass batchingScheme is none, %s", getNode()->getName().c_str());
}
Super::updateInstancedAttributes(attributes, pass);
}
void SkinningModel::ensureEnoughBuffers(index_t count) {
for (index_t i = 0; i < count; i++) {
if (i >= _buffers.size()) {
_buffers.resize(i + 1);
}
if (_buffers[i] == nullptr) {
_buffers[i] = _device->createBuffer({
gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST,
gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE,
pipeline::UBOSkinning::SIZE,
pipeline::UBOSkinning::SIZE,
});
}
if (i >= _dataArray.size()) {
_dataArray.resize(i + 1);
}
if (_dataArray[i] == nullptr) {
_dataArray[i] = new std::array<float, pipeline::UBOSkinning::COUNT>;
}
}
}
} // namespace cc
+80
View File
@@ -0,0 +1,80 @@
/****************************************************************************
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include <utility>
#include <vector>
#include "3d/models/MorphModel.h"
#include "core/animation/SkeletalAnimationUtils.h"
#include "math/Mat4.h"
#include "renderer/gfx-base/GFXDef-common.h"
#include "renderer/pipeline/Define.h"
namespace cc {
class Skeleton;
namespace geometry {
class AABB;
}
struct JointInfo {
geometry::AABB * bound{nullptr};
Node * target{nullptr};
Mat4 bindpose;
IJointTransform * transform{nullptr};
std::vector<index_t> buffers;
std::vector<index_t> indices;
};
class SkinningModel final : public MorphModel {
public:
using Super = MorphModel;
SkinningModel();
~SkinningModel() override;
void updateLocalDescriptors(index_t submodelIdx, gfx::DescriptorSet *descriptorset) override;
void updateTransform(uint32_t stamp) override;
void updateUBOs(uint32_t stamp) override;
void destroy() override;
void initSubModel(index_t idx, RenderingSubMesh *subMeshData, Material *mat) override;
std::vector<scene::IMacroPatch> &getMacroPatches(index_t subModelIndex) override;
void updateInstancedAttributes(const std::vector<gfx::Attribute> &attributes, scene::Pass *pass) override;
void bindSkeleton(Skeleton *skeleton, Node *skinningRoot, Mesh *mesh);
private:
static void uploadJointData(uint32_t base, const Mat4 &mat, float *dst);
void ensureEnoughBuffers(index_t count);
std::vector<index_t> _bufferIndices;
std::vector<IntrusivePtr<gfx::Buffer>> _buffers;
std::vector<JointInfo> _joints;
std::vector<std::array<float, pipeline::UBOSkinning::COUNT> *> _dataArray;
CC_DISALLOW_COPY_MOVE_ASSIGN(SkinningModel);
};
} // namespace cc
@@ -0,0 +1,505 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "3d/skeletal-animation/SkeletalAnimationUtils.h"
#include "3d/assets/Mesh.h"
#include "core/scene-graph/Node.h"
#include "renderer/pipeline/Define.h"
namespace {
const float INF = std::numeric_limits<float>::infinity();
cc::gfx::Format selectJointsMediumFormat(cc::gfx::Device *device) {
if (static_cast<uint32_t>(device->getFormatFeatures(cc::gfx::Format::RGBA32F) & cc::gfx::FormatFeature::SAMPLED_TEXTURE)) {
return cc::gfx::Format::RGBA32F;
}
return cc::gfx::Format::RGBA8;
}
// Linear Blending Skinning
void uploadJointDataLBS(cc::Float32Array out, uint32_t base, const cc::Mat4 &mat, bool /*firstBone*/) {
out[base + 0] = mat.m[0];
out[base + 1] = mat.m[1];
out[base + 2] = mat.m[2];
out[base + 3] = mat.m[12];
out[base + 4] = mat.m[4];
out[base + 5] = mat.m[5];
out[base + 6] = mat.m[6];
out[base + 7] = mat.m[13];
out[base + 8] = mat.m[8];
out[base + 9] = mat.m[9];
out[base + 10] = mat.m[10];
out[base + 11] = mat.m[14];
}
cc::Quaternion dq0;
cc::Quaternion dq1;
cc::Vec3 v31;
cc::Quaternion qt1;
cc::Vec3 v32;
float dot(const cc::Quaternion &a, const cc::Quaternion &b) {
return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
}
void multiplyScalar(const cc::Quaternion &a, float b, cc::Quaternion *out) {
out->x = a.x * b;
out->y = a.y * b;
out->z = a.z * b;
out->w = a.w * b;
}
// Dual Quaternion Skinning
void uploadJointDataDQS(cc::Float32Array out, uint32_t base, cc::Mat4 &mat, bool firstBone) {
cc::Mat4::toRTS(qt1, v31, v32, &mat);
// // sign consistency
if (firstBone) {
dq0 = qt1;
} else if (dot(dq0, qt1) < 0) {
multiplyScalar(qt1, -1, &qt1);
}
// conversion
dq1.x = v31.x;
dq1.y = v31.y;
dq1.z = v31.z;
dq1.w = 0;
multiplyScalar(dq1 * qt1, 0.5, &dq1);
// upload
out[base + 0] = qt1.x;
out[base + 1] = qt1.y;
out[base + 2] = qt1.z;
out[base + 3] = qt1.w;
out[base + 4] = dq1.x;
out[base + 5] = dq1.y;
out[base + 6] = dq1.z;
out[base + 7] = dq1.w;
out[base + 8] = v32.x;
out[base + 9] = v32.y;
out[base + 10] = v32.z;
}
// change here and cc-skinning.chunk to use other skinning algorithms
constexpr auto UPLOAD_JOINT_DATA = uploadJointDataLBS;
#ifdef CC_EDITOR
const uint32_t MINIMUM_JOINT_TEXTURE_SIZE = 2040;
#else
const uint32_t MINIMUM_JOINT_TEXTURE_SIZE = 480; // have to be multiples of 12
#endif
uint32_t roundUpTextureSize(uint32_t targetLength, uint32_t formatSize) {
double formatScale = 4 / std::sqrt(formatSize);
return static_cast<uint32_t>(std::ceil(std::max(MINIMUM_JOINT_TEXTURE_SIZE * formatScale, static_cast<double>(targetLength)) / 12) * 12);
}
const cc::gfx::SamplerInfo JOINT_TEXTURE_SAMPLER_INFO{
cc::gfx::Filter::POINT,
cc::gfx::Filter::POINT,
cc::gfx::Filter::NONE,
cc::gfx::Address::CLAMP,
cc::gfx::Address::CLAMP,
cc::gfx::Address::CLAMP,
};
cc::Mat4 *getWorldTransformUntilRoot(cc::Node *target, cc::Node *root, cc::Mat4 *outMatrix) {
outMatrix->setIdentity();
cc::Mat4 mat4;
while (target != root) {
cc::Mat4::fromRTS(target->getRotation(), target->getPosition(), target->getScale(), &mat4);
cc::Mat4::multiply(*outMatrix, mat4, outMatrix);
target = target->getParent();
}
return outMatrix;
}
} // namespace
namespace cc {
JointTexturePool::JointTexturePool(gfx::Device *device) {
_device = device;
const auto &format = selectJointsMediumFormat(_device);
_formatSize = gfx::GFX_FORMAT_INFOS[static_cast<uint32_t>(format)].size;
_pixelsPerJoint = 48 / _formatSize;
_pool = new TextureBufferPool(device);
ITextureBufferPoolInfo poolInfo;
poolInfo.format = format;
poolInfo.roundUpFn = roundUpType{roundUpTextureSize};
_pool->initialize(poolInfo);
_customPool = new TextureBufferPool(device);
ITextureBufferPoolInfo customPoolInfo;
customPoolInfo.format = format;
customPoolInfo.roundUpFn = roundUpType{roundUpTextureSize};
_customPool->initialize(customPoolInfo);
}
void JointTexturePool::clear() {
CC_SAFE_DESTROY(_pool);
_textureBuffers.clear();
}
void JointTexturePool::registerCustomTextureLayouts(const std::vector<ICustomJointTextureLayout> &layouts) {
for (const auto &layout : layouts) {
auto chunkIdx = static_cast<index_t>(_customPool->createChunk(layout.textureLength));
for (const auto &content : layout.contents) {
auto skeleton = content.skeleton;
_chunkIdxMap[skeleton] = chunkIdx; // include default pose too
for (const auto &clip : content.clips) {
_chunkIdxMap[skeleton ^ clip] = chunkIdx;
}
}
}
}
cc::optional<IJointTextureHandle *> JointTexturePool::getDefaultPoseTexture(Skeleton *skeleton, Mesh *mesh, Node *skinningRoot) {
uint64_t hash = skeleton->getHash() ^ 0; // may not equal to skeleton.hash
cc::optional<IJointTextureHandle *> texture;
if (_textureBuffers.find(hash) != _textureBuffers.end()) {
texture = _textureBuffers[hash];
}
const std::vector<std::string> &joints = skeleton->getJoints();
const std::vector<Mat4> & bindPoses = skeleton->getBindposes();
Float32Array textureBuffer;
bool buildTexture = false;
auto jointCount = static_cast<uint32_t>(joints.size());
if (!texture.has_value()) {
uint32_t bufSize = jointCount * 12;
ITextureBufferHandle handle;
if (_chunkIdxMap.find(hash) != _chunkIdxMap.end()) {
handle = _customPool->alloc(bufSize * Float32Array::BYTES_PER_ELEMENT, _chunkIdxMap[hash]);
} else {
handle = _pool->alloc(bufSize * Float32Array::BYTES_PER_ELEMENT);
return texture;
}
IJointTextureHandle *textureHandle = IJointTextureHandle::createJoinTextureHandle();
textureHandle->pixelOffset = handle.start / _formatSize;
textureHandle->refCount = 1;
textureHandle->clipHash = 0;
textureHandle->skeletonHash = skeleton->getHash();
textureHandle->readyToBeDeleted = false;
textureHandle->handle = handle;
texture = textureHandle;
textureBuffer = Float32Array(bufSize);
buildTexture = true;
} else {
texture.value()->refCount++;
}
geometry::AABB ab1;
Mat4 mat4;
Vec3 v34;
Vec3 v33;
Vec3 v3Min(-INF, -INF, -INF);
Vec3 v3Max(-INF, -INF, -INF);
auto boneSpaceBounds = mesh->getBoneSpaceBounds(skeleton);
for (uint32_t j = 0, offset = 0; j < jointCount; ++j, offset += 12) {
auto *node = skinningRoot->getChildByPath(joints[j]);
Mat4 mat = node ? *getWorldTransformUntilRoot(node, skinningRoot, &mat4) : skeleton->getInverseBindposes()[j];
if (j < boneSpaceBounds.size()) {
auto *bound = boneSpaceBounds[j].get();
bound->transform(mat, &ab1);
ab1.getBoundary(&v33, &v34);
Vec3::min(v3Min, v33, &v3Min);
Vec3::max(v3Max, v34, &v3Max);
}
if (buildTexture) {
if (node != nullptr) {
Mat4::multiply(mat, bindPoses[j], &mat);
}
uploadJointDataLBS(textureBuffer, offset, node ? mat : Mat4::IDENTITY, j == 0);
}
}
std::vector<geometry::AABB> bounds;
texture.value()->bounds[static_cast<uint32_t>(mesh->getHash())] = bounds;
geometry::AABB::fromPoints(v3Min, v3Max, &bounds[0]);
if (buildTexture) {
_pool->update(texture.value()->handle, textureBuffer.buffer());
_textureBuffers[hash] = texture.value();
}
return texture;
}
// TODO(xwx): need to implement this function after define AnimationClip
// cc::optional<IJointTextureHandle> JointTexturePool::getSequencePoseTexture(Skeleton *skeleton,AnimationClip *clip, Mesh *mesh, Node *skinningRoot) {
// uint64_t hash = skeleton->getHash() ^ clip->getHash();
// cc::optional<IJointTextureHandle> texture;
// if (_textureBuffers.find(hash) != _textureBuffers.end()) {
// texture = _textureBuffers[hash];
// if (texture->bounds.find(mesh->getHash()) != texture->bounds.end()) {
// texture->refCount++;
// return texture;
// }
// }
// const std::vector<std::string> &joints = skeleton->getJoints();
// const std::vector<Mat4> & bindPoses = skeleton->getBindposes();
// // const clipData = SkelAnimDataHub.getOrExtract(clip);
// // const { frames } = clipData;
// Float32Array textureBuffer;
// bool buildTexture = false;
// uint32_t jointCount = joints.size();
// if (!texture.has_value()) {
// uint32_t bufSize = jointCount * 12;
// ITextureBufferHandle handle;
// if (_chunkIdxMap.find(hash) != _chunkIdxMap.end()) {
// handle = _customPool->alloc(bufSize * sizeof(Float32Array), _chunkIdxMap[hash]); // TODO(xwx): Float32Array.BYTES_PER_ELEMENT == sizeof(Float32Array) ?
// } else {
// handle = _pool->alloc(bufSize * sizeof(Float32Array));
// return texture;
// }
// // auto animInfos = createAnimInfos(skeleton, clip, skinningRoot); // TODO(xwx): createAnimInfos not implement
// texture = IJointTextureHandle{
// .pixelOffset = handle.start / _formatSize,
// .refCount = 1,
// .clipHash = 0,
// .skeletonHash = skeleton->getHash(),
// .readyToBeDeleted = false,
// .handle = handle,
// // .animInfos = animInfos // TODO(xwx)
// };
// textureBuffer.resize(bufSize);
// buildTexture = true;
// } else {
// texture->refCount++;
// }
// auto boneSpaceBounds = mesh->getBoneSpaceBounds(skeleton);
// std::vector<geometry::AABB> bounds;
// texture->bounds[mesh->getHash()] = bounds;
// // for (uint32_t f = 0; f < frames; ++f) { // TODO(xwx): frames not define
// // bounds.emplace_back(geometry::AABB(INF, INF, INF, -INF, -INF, -INF));
// // }
// // TODO(xwx) : need to implement when define animInfos
// // for (uint32_t f = 0, offset = 0; f < frames; ++f) {
// // auto bound = bounds[f];
// // for (uint32_t j = 0; j < jointCount; ++j, offset += 12) {
// // const {
// // curveData,
// // downstream,
// // bindposeIdx,
// // bindposeCorrection,
// // } = texture.animInfos ![j];
// // let mat : Mat4;
// // let transformValid = true;
// // if (curveData && downstream) { // curve & static two-way combination
// // mat = Mat4.multiply(m4_1, curveData[f], downstream);
// // } else if (curveData) { // there is a curve directly controlling the joint
// // mat = curveData[f];
// // } else if (downstream) { // fallback to default pose if no animation curve can be found upstream
// // mat = downstream;
// // } else { // bottom line: render the original mesh as-is
// // mat = skeleton.inverseBindposes[bindposeIdx];
// // transformValid = false;
// // }
// // if (j < boneSpaceBounds.size()) {
// // auto bound = boneSpaceBounds[j];
// // auto tarnsform = bindposeCorrection ? Mat4::multiply(mat, bindposeCorrection, &m42) : mat; // TODO(xwx): mat not define
// // ab1.getBoundary(&v33, &v34);
// // Vec3::min(bound.center, v33, &bound.center);
// // Vec3::max(bound.halfExtents, v34, &bound.halfExtents);
// // }
// // if (buildTexture) {
// // if (transformValid) {
// // Mat4::multiply(mat, bindPoses[bindposIdx], &m41);
// // UPLOAD_JOINT_DATA(textureBuffer, offset, transformValid ? m41 : Mat4::IDENTITY, j == 0);
// // }
// // }
// // }
// // AABB::fromPoints(bound.center, bound.halfExtents, &bound);
// // }
// if (buildTexture) {
// // _pool->update(texture->handle, textureBuffer.buffer); // TODO(xwx): ArrayBuffer not implemented
// _textureBuffers[hash] = texture.value();
// }
// return texture;
// }
// }
void JointTexturePool::releaseHandle(IJointTextureHandle *handle) {
if (handle->refCount > 0) {
handle->refCount--;
}
if (!handle->refCount && handle->readyToBeDeleted) {
uint64_t hash = handle->skeletonHash ^ handle->clipHash;
if (_chunkIdxMap.find(hash) != _chunkIdxMap.end()) {
_customPool->free(handle->handle);
} else {
_pool->free(handle->handle);
}
if (_textureBuffers[hash] == handle) {
_textureBuffers.erase(hash);
CC_SAFE_DELETE(handle);
}
}
}
void JointTexturePool::releaseSkeleton(Skeleton *skeleton) {
for (const auto &texture : _textureBuffers) {
auto *handle = texture.second;
if (handle->skeletonHash == skeleton->getHash()) {
handle->readyToBeDeleted = true;
if (handle->refCount > 0) {
// delete handle record immediately so new allocations with the same asset could work
_textureBuffers.erase(handle->skeletonHash ^ handle->clipHash);
} else {
releaseHandle(handle);
}
}
}
}
// TODO(xwx): AnimationClip not define
// public releaseAnimationClip(clip: AnimationClip) {
// const it = this._textureBuffers.values();
// let res = it.next();
// while (!res.done) {
// const handle = res.value;
// if (handle.clipHash == = clip.hash) {
// handle.readyToBeDeleted = true;
// if (handle.refCount) {
// // delete handle record immediately so new allocations with the same asset could work
// this._textureBuffers.delete(handle.skeletonHash ^ handle.clipHash);
// } else {
// this.releaseHandle(handle);
// }
// }
// res = it.next();
// }
// }
// TODO(xwx): AnimationClip not define
// private _createAnimInfos (skeleton: Skeleton, clip: AnimationClip, skinningRoot: Node) {
// const animInfos: IInternalJointAnimInfo[] = [];
// const { joints, bindposes } = skeleton;
// const jointCount = joints.length;
// const clipData = SkelAnimDataHub.getOrExtract(clip);
// for (let j = 0; j < jointCount; j++) {
// let animPath = joints[j];
// let source = clipData.joints[animPath];
// let animNode = skinningRoot.getChildByPath(animPath);
// let downstream: Mat4 | undefined;
// let correctionPath: string | undefined;
// while (!source) {
// const idx = animPath.lastIndexOf('/');
// animPath = animPath.substring(0, idx);
// source = clipData.joints[animPath];
// if (animNode) {
// if (!downstream) { downstream = new Mat4(); }
// Mat4.fromRTS(m4_1, animNode.rotation, animNode.position, animNode.scale);
// Mat4.multiply(downstream, m4_1, downstream);
// animNode = animNode.parent;
// } else { // record the nearest curve path if no downstream pose is present
// correctionPath = animPath;
// }
// if (idx < 0) { break; }
// }
// // the default behavior, just use the bindpose for current joint directly
// let bindposeIdx = j;
// let bindposeCorrection: Mat4 | undefined;
// /**
// * It is regularly observed that developers may choose to delete the whole
// * skeleton node tree for skinning models that only use baked animations
// * as an effective optimization strategy (substantial improvements on both
// * package size and runtime efficiency).
// *
// * This becomes troublesome in some cases during baking though, e.g. when a
// * skeleton joint node is not directly controlled by any animation curve,
// * but its parent nodes are. Due to lack of proper downstream default pose,
// * the joint transform can not be calculated accurately.
// *
// * We address this issue by employing some pragmatic approximation.
// * Specifically, by multiplying the bindpose of the joint corresponding to
// * the nearest curve, instead of the actual target joint. This effectively
// * merges the skinning influence of the 'incomplete' joint into its nearest
// * parent with accurate transform data.
// * It gives more visually-plausible results compared to the naive approach
// * for most cases we've covered.
// */
// if (correctionPath !== undefined && source) {
// // just use the previous joint if the exact path is not found
// bindposeIdx = j - 1;
// for (let t = 0; t < jointCount; t++) {
// if (joints[t] === correctionPath) {
// bindposeIdx = t;
// bindposeCorrection = new Mat4();
// Mat4.multiply(bindposeCorrection, bindposes[t], skeleton.inverseBindposes[j]);
// break;
// }
// }
// }
// animInfos.push({
// curveData: source && source.transforms, downstream, bindposeIdx, bindposeCorrection,
// });
// }
// return animInfos;
// }
IAnimInfo JointAnimationInfo::getData(const std::string &nodeID) {
if (_pool.find(nodeID) != _pool.end()) {
return _pool[nodeID];
}
auto *buffer = _device->createBuffer(gfx::BufferInfo{
gfx::BufferUsageBit::UNIFORM | gfx::BufferUsageBit::TRANSFER_DST,
gfx::MemoryUsageBit::HOST | gfx::MemoryUsageBit::DEVICE,
pipeline::UBOSkinningAnimation::SIZE,
pipeline::UBOSkinningAnimation::SIZE,
});
Float32Array data;
buffer->update(data.buffer()->getData());
IAnimInfo info;
info.buffer = buffer;
info.data = data;
info.dirty = false;
_pool[nodeID] = info;
return info;
}
void JointAnimationInfo::destroy(const std::string &nodeID) {
if (_pool.find(nodeID) != _pool.end()) {
CC_SAFE_DESTROY_AND_DELETE(_pool[nodeID].buffer);
_pool.erase(nodeID);
}
}
const IAnimInfo &JointAnimationInfo::switchClip(IAnimInfo &info /*, AnimationClip *clip */) {
info.data[0] = 0;
info.buffer->update(info.data.buffer()->getData());
info.dirty = false;
return info;
}
void JointAnimationInfo::clear() {
for (auto pool : _pool) {
CC_SAFE_DESTROY_AND_DELETE(pool.second.buffer);
}
_pool.clear();
}
} // namespace cc
@@ -0,0 +1,155 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include <unordered_map>
#include "cocos/base/Optional.h"
#include "3d/assets/Skeleton.h"
#include "core/TypedArray.h"
#include "core/geometry/AABB.h"
#include "gfx-base/GFXDef-common.h"
#include "renderer/core/TextureBufferPool.h"
#include "renderer/gfx-base/GFXBuffer.h"
#include "renderer/gfx-base/GFXDevice.h"
namespace cc {
class Node;
class Mesh;
// _chunkIdxMap[key] = skeleton ^ clips[i]
struct IChunkContent {
uint64_t skeleton{0};
std::vector<uint64_t> clips;
};
struct ICustomJointTextureLayout {
uint32_t textureLength{0};
std::vector<IChunkContent> contents;
};
struct IInternalJointAnimInfo {
cc::optional<Mat4> downstream; // downstream default pose, if present
cc::optional<std::vector<Mat4>> curveData; // the nearest animation curve, if present
index_t bindposeIdx{0}; // index of the actual bindpose to use
cc::optional<Mat4> bindposeCorrection; // correction factor from the original bindpose
};
class IJointTextureHandle {
public:
uint32_t pixelOffset{0};
uint32_t refCount{0};
uint64_t clipHash{0};
uint64_t skeletonHash{0};
bool readyToBeDeleted{false};
ITextureBufferHandle handle;
std::unordered_map<uint32_t, std::vector<geometry::AABB>> bounds;
cc::optional<std::vector<IInternalJointAnimInfo>> animInfos;
static IJointTextureHandle *createJoinTextureHandle() {
return new IJointTextureHandle();
}
private:
IJointTextureHandle() = default;
};
class JointTexturePool : public RefCounted {
public:
JointTexturePool() = default;
explicit JointTexturePool(gfx::Device *device);
~JointTexturePool() override = default;
inline uint32_t getPixelsPerJoint() const { return _pixelsPerJoint; }
void clear();
void registerCustomTextureLayouts(const std::vector<ICustomJointTextureLayout> &layouts);
/**
* @en
* Get joint texture for the default pose.
* @zh
* 获取默认姿势的骨骼贴图。
*/
cc::optional<IJointTextureHandle *> getDefaultPoseTexture(Skeleton *skeleton, Mesh *mesh, Node *skinningRoot);
/**
* @en
* Get joint texture for the specified animation clip.
* @zh
* 获取指定动画片段的骨骼贴图。
*/
// cc::optional<IJointTextureHandle> getSequencePoseTexture(Skeleton *skeleton, AnimationClip *clip, Mesh *mesh, Node *skinningRoot);
void releaseHandle(IJointTextureHandle *handle);
void releaseSkeleton(Skeleton *skeleton);
// void releaseAnimationClip (AnimationClip* clip); // TODO(xwx): AnimationClip not define
private:
// const IInternalJointAnimInfo &createAnimInfos(Skeleton *skeleton, AnimationClip *clip, Node *skinningRoot); // TODO(xwx): AnimationClip not define
gfx::Device * _device{nullptr};
IntrusivePtr<TextureBufferPool> _pool;
std::unordered_map<uint64_t, IJointTextureHandle *> _textureBuffers;
uint32_t _formatSize{0};
uint32_t _pixelsPerJoint{0};
IntrusivePtr<TextureBufferPool> _customPool;
std::unordered_map<uint64_t, index_t> _chunkIdxMap; // hash -> chunkIdx
CC_DISALLOW_COPY_MOVE_ASSIGN(JointTexturePool);
};
struct IAnimInfo {
gfx::Buffer *buffer{nullptr};
Float32Array data;
const float *curFrame{nullptr}; // Only used in JSB
uint32_t frameDataBytes{0}; // Only used in JSB
uint8_t * dirtyForJSB{nullptr}; // Only used in JSB
bool dirty{false};
};
class JointAnimationInfo : public RefCounted {
public:
JointAnimationInfo();
explicit JointAnimationInfo(gfx::Device *device);
~JointAnimationInfo() override = default;
IAnimInfo getData(const std::string &nodeID = "-1");
void destroy(const std::string &nodeID);
static const IAnimInfo &switchClip(IAnimInfo &info /*, AnimationClip *clip */);
void clear();
private:
std::unordered_map<std::string, IAnimInfo> _pool; // pre node
gfx::Device * _device{nullptr};
CC_DISALLOW_COPY_MOVE_ASSIGN(JointAnimationInfo);
};
} // namespace cc
@@ -28,7 +28,7 @@
namespace cc {
// static
ApplicationManager* ApplicationManager::getInstance() {
ApplicationManager *ApplicationManager::getInstance() {
static ApplicationManager mgr;
return &mgr;
}
@@ -33,7 +33,7 @@
namespace cc {
class ApplicationManager {
public:
static ApplicationManager* getInstance();
static ApplicationManager *getInstance();
using ApplicationPtr = std::shared_ptr<BaseApplication>;
@@ -88,6 +88,6 @@ private:
} while (0)
#define CC_APPLICATION_MAIN(className) \
int cocos_main(int argc, const char** argv) { \
int cocos_main(int argc, const char **argv) { \
CC_START_APPLICATION(className); \
}
+1 -1
View File
@@ -41,7 +41,7 @@ public:
* @brief Application main business logic.
*/
virtual int32_t run(int argc,
const char** argv) = 0;
const char **argv) = 0;
/**
* @brief Pause the application.
*/
+8 -8
View File
@@ -44,7 +44,7 @@ public:
/**
* @brief Application main business logic.
*/
int32_t run(int argc, const char** argv) override;
int32_t run(int argc, const char **argv) override;
/**
* @brief Pause the application.
*/
@@ -87,7 +87,7 @@ public:
* @param h: Window height
* @param flags: Window flag
*/
virtual void createWindow(const char* title,
virtual void createWindow(const char *title,
int32_t x, int32_t y, int32_t w,
int32_t h, int32_t flags);
/**
@@ -96,25 +96,25 @@ public:
* @param port:Server port.
* @param isWaitForConnect:Is Wait for connect.
*/
virtual void setJsDebugIpAndPort(const std::string& serverAddr, uint32_t port, bool isWaitForConnect);
virtual void setJsDebugIpAndPort(const std::string &serverAddr, uint32_t port, bool isWaitForConnect);
/**
* @brief Run the js code file
* @param filePath:Js file path.
*/
virtual void runJsScript(const std::string& filePath);
virtual void runJsScript(const std::string &filePath);
/**
* @brief Js exception handling
* @param location,Exception location
* @param message,Exception message
* @param stack,Exception stack
*/
virtual void handleException(const char* location, const char* message, const char* stack);
virtual void setXXTeaKey(const std::string& key);
virtual void handleException(const char *location, const char *message, const char *stack);
virtual void setXXTeaKey(const std::string &key);
private:
void handleAppEvent(const OSEvent& ev);
void handleAppEvent(const OSEvent &ev);
ISystemWindow* _systemWidow{nullptr};
ISystemWindow * _systemWidow{nullptr};
BaseEngine::Ptr _engine{nullptr};
};
} // namespace cc
+23 -24
View File
@@ -27,16 +27,15 @@ THE SOFTWARE.
#include "audio/android/AudioDecoder.h"
#include "audio/android/AudioResampler.h"
#include "audio/android/PcmBufferProvider.h"
#include "audio/android/AudioResampler.h"
#include <thread>
#include <chrono>
#include <thread>
namespace cc {
size_t AudioDecoder::fileRead(void *ptr, size_t size, size_t nmemb, void *datasource) {
AudioDecoder *thiz = (AudioDecoder *)datasource;
ssize_t toReadBytes = std::min((ssize_t)(thiz->_fileData.getSize() - thiz->_fileCurrPos), (ssize_t)(nmemb * size));
AudioDecoder *thiz = (AudioDecoder *)datasource;
ssize_t toReadBytes = std::min((ssize_t)(thiz->_fileData.getSize() - thiz->_fileCurrPos), (ssize_t)(nmemb * size));
if (toReadBytes > 0) {
memcpy(ptr, (unsigned char *)thiz->_fileData.getBytes() + thiz->_fileCurrPos, toReadBytes);
thiz->_fileCurrPos += toReadBytes;
@@ -48,11 +47,11 @@ size_t AudioDecoder::fileRead(void *ptr, size_t size, size_t nmemb, void *dataso
int AudioDecoder::fileSeek(void *datasource, int64_t offset, int whence) {
AudioDecoder *thiz = (AudioDecoder *)datasource;
if (whence == SEEK_SET)
thiz->_fileCurrPos = offset;
thiz->_fileCurrPos = static_cast<size_t>(offset);
else if (whence == SEEK_CUR)
thiz->_fileCurrPos = thiz->_fileCurrPos + offset;
thiz->_fileCurrPos = static_cast<size_t>(thiz->_fileCurrPos + offset);
else if (whence == SEEK_END)
thiz->_fileCurrPos = thiz->_fileData.getSize();
thiz->_fileCurrPos = static_cast<size_t>(thiz->_fileData.getSize());
return 0;
}
@@ -77,7 +76,7 @@ AudioDecoder::~AudioDecoder() {
}
bool AudioDecoder::init(const std::string &url, int sampleRate) {
_url = url;
_url = url;
_sampleRate = sampleRate;
return true;
}
@@ -131,16 +130,16 @@ bool AudioDecoder::resample() {
ALOGV("Resample: %d --> %d", _result.sampleRate, _sampleRate);
auto r = _result;
auto r = _result;
PcmBufferProvider provider;
provider.init(r.pcmBuffer->data(), r.numFrames, r.pcmBuffer->size() / r.numFrames);
const int outFrameRate = _sampleRate;
int outputChannels = 2;
size_t outputFrameSize = outputChannels * sizeof(int32_t);
size_t outputFrames = ((int64_t)r.numFrames * outFrameRate) / r.sampleRate;
size_t outputSize = outputFrames * outputFrameSize;
void *outputVAddr = malloc(outputSize);
const int outFrameRate = _sampleRate;
int outputChannels = 2;
size_t outputFrameSize = outputChannels * sizeof(int32_t);
auto outputFrames = static_cast<size_t>(((int64_t)r.numFrames * outFrameRate) / r.sampleRate);
size_t outputSize = outputFrames * outputFrameSize;
void * outputVAddr = malloc(outputSize);
auto resampler = AudioResampler::create(AUDIO_FORMAT_PCM_16_BIT, r.numChannels, outFrameRate,
AudioResampler::MED_QUALITY);
@@ -154,7 +153,7 @@ bool AudioDecoder::resample() {
std::vector<int> Ovalues;
if (Ovalues.empty()) {
Ovalues.push_back(outputFrames);
Ovalues.push_back(static_cast<int>(outputFrames));
}
for (size_t i = 0, j = 0; i < outputFrames;) {
size_t thisFrames = Ovalues[j++];
@@ -164,8 +163,8 @@ bool AudioDecoder::resample() {
if (thisFrames == 0 || thisFrames > outputFrames - i) {
thisFrames = outputFrames - i;
}
int outFrames = resampler->resample((int *)outputVAddr + outputChannels * i, thisFrames,
&provider);
int outFrames = static_cast<int>(resampler->resample(static_cast<int32_t *>(outputVAddr) + outputChannels * i, thisFrames,
&provider));
ALOGV("outFrames: %d", outFrames);
i += thisFrames;
}
@@ -182,9 +181,9 @@ bool AudioDecoder::resample() {
// mono takes left channel only (out of stereo output pair)
// stereo and multichannel preserve all channels.
int channels = r.numChannels;
int32_t *out = (int32_t *)outputVAddr;
int16_t *convert = (int16_t *)malloc(outputFrames * channels * sizeof(int16_t));
int channels = r.numChannels;
int32_t *out = (int32_t *)outputVAddr;
int16_t *convert = (int16_t *)malloc(outputFrames * channels * sizeof(int16_t));
const int volumeShift = 12; // shift requirement for Q4.27 to Q.15
// round to half towards zero and saturate at int16 (non-dithered)
@@ -209,7 +208,7 @@ bool AudioDecoder::resample() {
}
// Reset result
_result.numFrames = outputFrames;
_result.numFrames = static_cast<int>(outputFrames);
_result.sampleRate = outFrameRate;
auto buffer = std::make_shared<std::vector<char>>();
@@ -233,7 +232,7 @@ bool AudioDecoder::interleave() {
} else if (_result.numChannels == 1) {
// If it's a mono audio, try to compose a fake stereo buffer
size_t newBufferSize = _result.pcmBuffer->size() * 2;
auto newBuffer = std::make_shared<std::vector<char>>();
auto newBuffer = std::make_shared<std::vector<char>>();
newBuffer->reserve(newBufferSize);
size_t totalFrameSizeInBytes = (size_t)(_result.numFrames * _result.bitsPerSample / 8);
@@ -250,7 +249,7 @@ bool AudioDecoder::interleave() {
}
_result.numChannels = 2;
_result.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
_result.pcmBuffer = newBuffer;
_result.pcmBuffer = newBuffer;
return true;
}
+2 -2
View File
@@ -30,7 +30,7 @@
#include <string>
#include <unordered_map>
#include "base/Ref.h"
#include "base/RefCounted.h"
#include "base/Utils.h"
#define MAX_AUDIOINSTANCES 13
@@ -46,7 +46,7 @@ class AudioPlayerProvider;
class AudioEngineImpl;
class AudioEngineImpl : public cc::Ref {
class AudioEngineImpl : public RefCounted {
public:
AudioEngineImpl();
~AudioEngineImpl() override;
+16 -16
View File
@@ -16,10 +16,10 @@
#pragma once
#include <stdint.h>
#include <sys/types.h>
#include <android/log.h>
#include <stdint.h>
#include <sys/system_properties.h>
#include <sys/types.h>
#include "audio/android/AudioBufferProvider.h"
@@ -43,10 +43,10 @@ public:
// certain fixed rate conversions. Sample rate cannot be
// changed dynamically.
enum src_quality {
DEFAULT_QUALITY = 0,
LOW_QUALITY = 1,
MED_QUALITY = 2,
HIGH_QUALITY = 3,
DEFAULT_QUALITY = 0,
LOW_QUALITY = 1,
MED_QUALITY = 2,
HIGH_QUALITY = 3,
VERY_HIGH_QUALITY = 4,
};
@@ -82,7 +82,7 @@ public:
virtual size_t resample(int32_t *out, size_t outFrameCount,
AudioBufferProvider *provider) = 0;
virtual void reset();
virtual void reset();
virtual size_t getUnreleasedFrames() const { return mInputIndex; }
// called from destructor, so must not be virtual
@@ -106,20 +106,20 @@ protected:
int64_t calculateOutputPTS(int outputFrameIndex);
const int32_t mChannelCount;
const int32_t mSampleRate;
int32_t mInSampleRate;
const int32_t mChannelCount;
const int32_t mSampleRate;
int32_t mInSampleRate;
AudioBufferProvider::Buffer mBuffer;
union {
int16_t mVolume[2];
int16_t mVolume[2];
uint32_t mVolumeRL;
};
int16_t mTargetVolume[2];
size_t mInputIndex;
int32_t mPhaseIncrement;
int16_t mTargetVolume[2];
size_t mInputIndex;
int32_t mPhaseIncrement;
uint32_t mPhaseFraction;
uint64_t mLocalTimeFreq;
int64_t mPTS;
int64_t mPTS;
// returns the inFrameCount required to generate outFrameCount frames.
//
@@ -149,7 +149,7 @@ protected:
// phaseWrapLimit is the wraparound (1 << kNumPhaseBits), if not specified explicitly.
//
inline size_t getInFrameCountRequired(size_t outFrameCount) {
return (static_cast<uint64_t>(outFrameCount) * mInSampleRate + (mSampleRate - 1)) / mSampleRate;
return (static_cast<size_t>(outFrameCount) * mInSampleRate + (mSampleRate - 1)) / mSampleRate;
}
inline float clampFloatVol(float volume) {
@@ -19,7 +19,6 @@
#include <math.h>
#include <stdint.h>
namespace cc {
// AUDIO_RESAMPLER_DOWN_RATIO_MAX is the maximum ratio between the original
@@ -145,7 +144,7 @@ static inline size_t destinationFramesPossible(size_t srcFrames, uint32_t srcSam
return srcFrames;
}
uint64_t dstFrames = (uint64_t)srcFrames * dstSampleRate / srcSampleRate;
return dstFrames > 2 ? dstFrames - 2 : 0;
return dstFrames > 2 ? static_cast<size_t>(dstFrames - 2) : 0;
}
static inline size_t sourceFramesNeededWithTimestretch(
+2 -2
View File
@@ -32,14 +32,14 @@
#include "audio/apple/AudioCache.h"
#include "audio/apple/AudioPlayer.h"
#include "base/Ref.h"
#include "base/RefCounted.h"
namespace cc {
class Scheduler;
#define MAX_AUDIOINSTANCES 24
class AudioEngineImpl : public cc::Ref {
class AudioEngineImpl : public cc::RefCounted {
public:
AudioEngineImpl();
~AudioEngineImpl();
@@ -30,7 +30,7 @@
#include "audio/oalsoft/AudioCache.h"
#include "audio/oalsoft/AudioPlayer.h"
#include "base/Ref.h"
#include "cocos/base/RefCounted.h"
namespace cc {
@@ -38,7 +38,7 @@ class Scheduler;
#define MAX_AUDIOINSTANCES 32
class CC_DLL AudioEngineImpl : public cc::Ref {
class CC_DLL AudioEngineImpl : public RefCounted {
public:
AudioEngineImpl();
~AudioEngineImpl() override;
+103
View File
@@ -0,0 +1,103 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#ifdef USE_CXX_17
#include <any>
namespace cc {
using any = std::any;
template <typename ValueType>
inline ValueType *any_cast(any *operand) noexcept {
return std::any_cast<ValueType>(operand);
}
template <typename ValueType>
inline const ValueType *any_cast(const any *operand) noexcept {
return std::any_cast<ValueType>(operand);
}
template <typename ValueType>
inline ValueType any_cast(any &operand) {
return std::any_cast<ValueType>(operand);
}
template <typename ValueType>
inline ValueType any_cast(const any &operand) {
return std::any_cast<ValueType>(operand);
}
template <typename ValueType>
inline ValueType any_cast(any &&operand) {
return std::any_cast<ValueType>(operand);
}
} // namespace cc
#else
#include "boost/any.hpp"
namespace cc {
class any : public boost::any { // NOLINT // use std style
public:
using boost::any::any;
inline bool has_value() const noexcept { // NOLINT // use std style
return !this->empty();
}
};
template <typename ValueType>
inline ValueType *any_cast(any *operand) noexcept { // NOLINT // use std style
return boost::any_cast<ValueType>(operand);
}
template <typename ValueType>
inline const ValueType *any_cast(const any *operand) noexcept { // NOLINT // use std style
return boost::any_cast<ValueType>(operand);
}
template <typename ValueType>
inline ValueType any_cast(any &operand) { // NOLINT // use std style
return boost::any_cast<ValueType>(operand);
}
template <typename ValueType>
inline ValueType any_cast(const any &operand) { // NOLINT // use std style
return boost::any_cast<ValueType>(operand);
}
template <typename ValueType>
inline ValueType any_cast(any &&operand) { // NOLINT // use std style
return boost::any_cast<ValueType>(operand);
}
} // namespace cc
#endif
-156
View File
@@ -1,156 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "base/AutoreleasePool.h"
#include "base/Log.h"
namespace cc {
LegacyAutoreleasePool::LegacyAutoreleasePool() //NOLINT(misc-no-recursion)
#if defined(CC_DEBUG) && (CC_DEBUG > 0)
: _isClearing(false)
#endif
{
_managedObjectArray.reserve(150);
PoolManager::getInstance()->push(this);
}
LegacyAutoreleasePool::LegacyAutoreleasePool(std::string name)
: _name(std::move(name))
#if defined(CC_DEBUG) && (CC_DEBUG > 0)
,
_isClearing(false)
#endif
{
_managedObjectArray.reserve(150);
PoolManager::getInstance()->push(this);
}
LegacyAutoreleasePool::~LegacyAutoreleasePool() {
CC_LOG_INFO("deallocing AutoreleasePool: %p", this);
clear();
PoolManager::getInstance()->pop();
}
void LegacyAutoreleasePool::addObject(Ref *object) {
_managedObjectArray.emplace_back(object);
}
void LegacyAutoreleasePool::clear() {
#if defined(CC_DEBUG) && (CC_DEBUG > 0)
_isClearing = true;
#endif
std::vector<Ref *> releasings;
releasings.swap(_managedObjectArray);
for (const auto &obj : releasings) {
obj->release();
}
#if defined(CC_DEBUG) && (CC_DEBUG > 0)
_isClearing = false;
#endif
}
bool LegacyAutoreleasePool::contains(Ref *object) const {
for (const auto &obj : _managedObjectArray) { //NOLINT(readability-use-anyofallof)
if (obj == object) {
return true;
}
}
return false;
}
void LegacyAutoreleasePool::dump() {
CC_LOG_DEBUG("autorelease pool: %s, number of managed object %d\n", _name.c_str(), static_cast<int>(_managedObjectArray.size()));
CC_LOG_DEBUG("%20s%20s%20s", "Object pointer", "Object id", "reference count");
for (const auto &obj : _managedObjectArray) {
CC_UNUSED_PARAM(obj);
CC_LOG_DEBUG("%20p%20u\n", obj, obj->getReferenceCount());
}
}
//--------------------------------------------------------------------
//
// PoolManager
//
//--------------------------------------------------------------------
PoolManager *PoolManager::_singleInstance = nullptr;
PoolManager *PoolManager::getInstance() { //NOLINT(misc-no-recursion)
if (_singleInstance == nullptr) {
_singleInstance = new (std::nothrow) PoolManager();
_singleInstance->push(new LegacyAutoreleasePool());
}
return _singleInstance;
}
void PoolManager::destroyInstance() {
delete _singleInstance;
_singleInstance = nullptr;
}
PoolManager::PoolManager() {
_releasePoolStack.reserve(10);
}
PoolManager::~PoolManager() {
CC_LOG_INFO("deallocing PoolManager: %p", this);
while (!_releasePoolStack.empty()) {
LegacyAutoreleasePool *pool = _releasePoolStack.back();
delete pool;
}
}
LegacyAutoreleasePool *PoolManager::getCurrentPool() const {
if (_releasePoolStack.empty()) {
return nullptr;
}
return _releasePoolStack.back();
}
bool PoolManager::isObjectInPools(Ref *obj) const {
for (const auto &pool : _releasePoolStack) { //NOLINT(readability-use-anyofallof)
if (pool->contains(obj)) {
return true;
}
}
return false;
}
void PoolManager::push(LegacyAutoreleasePool *pool) {
_releasePoolStack.emplace_back(pool);
}
void PoolManager::pop() {
CC_ASSERT(!_releasePoolStack.empty());
_releasePoolStack.pop_back();
}
} // namespace cc
-148
View File
@@ -1,148 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include <string>
#include <vector>
#include "base/Ref.h"
namespace cc {
/**
* A pool for managing autorelease objects.
*/
class CC_DLL LegacyAutoreleasePool {
public:
/**
* @warning Don't create an autorelease pool in heap, create it in stack.
*/
LegacyAutoreleasePool();
/**
* Create an autorelease pool with specific name. This name is useful for debugging.
* @warning Don't create an autorelease pool in heap, create it in stack.
*
* @param name The name of created autorelease pool.
*/
explicit LegacyAutoreleasePool(std::string name);
~LegacyAutoreleasePool();
/**
* Add a given object to this autorelease pool.
*
* The same object may be added several times to an autorelease pool. When the
* pool is destructed, the object's `Ref::release()` method will be called
* the same times as it was added.
*
* @param object The object to be added into the autorelease pool.
*/
void addObject(Ref *object);
/**
* Clear the autorelease pool.
*
* It will invoke each element's `release()` function.
*/
void clear();
#if defined(CC_DEBUG) && (CC_DEBUG > 0)
/**
* Whether the autorelease pool is doing `clear` operation.
*
* @return True if autorelease pool is clearing, false if not.
*/
bool isClearing() const { return _isClearing; };
#endif
/**
* Checks whether the autorelease pool contains the specified object.
*
* @param object The object to be checked.
* @return True if the autorelease pool contains the object, false if not
*/
bool contains(Ref *object) const;
/**
* Dump the objects that are put into the autorelease pool. It is used for debugging.
*
* The result will look like:
* Object pointer address object id reference count
*/
void dump();
private:
/**
* The underlying array of object managed by the pool.
*
* Although Array retains the object once when an object is added, proper
* Ref::release() is called outside the array to make sure that the pool
* does not affect the managed object's reference count. So an object can
* be destructed properly by calling Ref::release() even if the object
* is in the pool.
*/
std::vector<Ref *> _managedObjectArray;
std::string _name;
#if defined(CC_DEBUG) && (CC_DEBUG > 0)
/**
* The flag for checking whether the pool is doing `clear` operation.
*/
bool _isClearing;
#endif
};
class CC_DLL PoolManager {
public:
static PoolManager *getInstance();
static void destroyInstance();
/**
* Get current auto release pool, there is at least one auto release pool that created by engine.
* You can create your own auto release pool at demand, which will be put into auto release pool stack.
*/
LegacyAutoreleasePool *getCurrentPool() const;
bool isObjectInPools(Ref *obj) const;
friend class LegacyAutoreleasePool;
private:
PoolManager();
~PoolManager();
void push(LegacyAutoreleasePool *pool);
void pop();
static PoolManager *_singleInstance;
std::vector<LegacyAutoreleasePool *> _releasePoolStack;
};
} // namespace cc
@@ -1,5 +1,7 @@
/****************************************************************************
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
@@ -23,41 +25,40 @@
THE SOFTWARE.
****************************************************************************/
#include "scene/BakedSkinningModel.h"
#include "scene/RenderScene.h"
#include "base/DeferredReleasePool.h"
#include <vector>
#include "base/Log.h"
namespace cc {
namespace scene {
void BakedSkinningModel::updateTransform(uint32_t stamp) {
Model::updateTransform(stamp);
if (!_isUploadAnim) {
return;
}
BakedAnimInfo& animInfo = _jointMedium.animInfo;
AABB* skelBound = !_jointMedium.boundsInfo.empty() ? _jointMedium.boundsInfo[*animInfo.data] : nullptr;
if (_worldBounds && skelBound) {
Node* node = getTransform();
skelBound->transform(node->getWorldMatrix(), _worldBounds);
}
// Fix me: update twice
if (_scene) {
_scene->updateOctree(this);
std::vector<RefCounted *> DeferredReleasePool::managedObjectArray{};
void DeferredReleasePool::add(RefCounted *object) {
DeferredReleasePool::managedObjectArray.push_back(object);
}
void DeferredReleasePool::clear() {
for (const auto &obj : DeferredReleasePool::managedObjectArray) {
obj->release();
}
DeferredReleasePool::managedObjectArray.clear();
}
bool DeferredReleasePool::contains(RefCounted *object) {
for (const auto &obj : DeferredReleasePool::managedObjectArray) { // NOLINT(readability-use-anyofallof) // remove after using C++20
if (obj == object) {
return true;
}
}
return false;
}
void DeferredReleasePool::dump() {
CC_LOG_DEBUG("number of managed object %ul\n", DeferredReleasePool::managedObjectArray.size());
CC_LOG_DEBUG("%20s%20s%20s", "Object pointer", "Object id", "reference count");
for (const auto &obj : DeferredReleasePool::managedObjectArray) {
CC_UNUSED_PARAM(obj);
CC_LOG_DEBUG("%20p%20u\n", obj, obj->getRefCount());
}
}
void BakedSkinningModel::updateUBOs(uint32_t stamp) {
Model::updateUBOs(stamp);
BakedAnimInfo& info = _jointMedium.animInfo;
int idx = _instAnimInfoIdx;
if (idx >= 0) {
std::vector<uint8_t*>& views = getInstancedAttributeBlock()->views;
*reinterpret_cast<float*>(views[0]) = *reinterpret_cast<float*>(info.data);
} else if (info.getDirty()) {
info.buffer->update(info.data, info.buffer->getSize());
*info.dirty = 0;
}
}
} // namespace scene
} // namespace cc
@@ -1,5 +1,7 @@
/****************************************************************************
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
@@ -25,46 +27,44 @@
#pragma once
#include <array>
#include "math/Vec3.h"
#include <string>
#include <vector>
#include "base/RefCounted.h"
namespace cc {
namespace scene {
enum class ShapeEnums {
SHAPE_RAY = (1 << 0),
SHAPE_LINE = (1 << 1),
SHAPE_SPHERE = (1 << 2),
SHAPE_AABB = (1 << 3),
SHAPE_OBB = (1 << 4),
SHAPE_PLANE = (1 << 5),
SHAPE_TRIANGLE = (1 << 6),
SHAPE_FRUSTUM = (1 << 7),
SHAPE_FRUSTUM_ACCURATE = (1 << 8),
SHAPE_CAPSULE = (1 << 9),
class CC_DLL DeferredReleasePool {
public:
static void add(RefCounted *object);
static void clear();
/**
* Checks whether the autorelease pool contains the specified object.
*
* @param object The object to be checked.
* @return True if the autorelease pool contains the object, false if not
*/
static bool contains(RefCounted *object);
/**
* Dump the objects that are put into the autorelease pool. It is used for debugging.
*
* The result will look like:
* Object pointer address object id reference count
*/
static void dump();
private:
/**
* The underlying array of object managed by the pool.
*
* Although Array retains the object once when an object is added, proper
* Ref::release() is called outside the array to make sure that the pool
* does not affect the managed object's reference count. So an object can
* be destructed properly by calling Ref::release() even if the object
* is in the pool.
*/
static std::vector<RefCounted *> managedObjectArray;
};
struct Plane final {
float d{0.F};
Vec3 n;
void define(const Vec3 &v0, const Vec3 &v1, const Vec3 &v2);
void define(const Vec3 &normal, const Vec3 &point);
float distance(const Vec3 &point) const;
Plane clone() const;
};
struct Frustum final {
std::array<Vec3, 8> vertices;
std::array<Plane, 6> planes;
void createOrtho(float width, float height, float near, float far, const Mat4 &transform);
void split(float start, float end, float aspect, float fov, const Mat4 &transform);
void updatePlanes();
void update(const Mat4 &m, const Mat4 &inv);
Frustum clone();
void transform(const Mat4 &transform);
ShapeEnums type{ShapeEnums::SHAPE_FRUSTUM};
};
} // namespace scene
} // namespace cc
+27 -72
View File
@@ -106,6 +106,9 @@ typedef SSIZE_T ssize_t;
#define FLT_EPSILON 1.192092896e-07F
#endif // FLT_EPSILON
#define CC_MIN(a, b) (((a) < (b)) ? (a) : (b))
#define CC_MAX(a, b) (((a) < (b)) ? (b) : (a))
/**
Helper macros which converts 4-byte little/big endian
integral number to the machine native number representation
@@ -162,10 +165,10 @@ It should work same as apples CFSwapInt32LittleToHost(..)
(p) = nullptr; \
} \
} while (0)
#define CC_SAFE_RETAIN(p) \
#define CC_SAFE_ADD_REF(p) \
do { \
if (p) { \
(p)->retain(); \
(p)->addRef(); \
} \
} while (0)
#define CC_BREAK_IF(cond) \
@@ -239,18 +242,6 @@ It should work same as apples CFSwapInt32LittleToHost(..)
#define CC_CPU_ARCH_32 1
#define CC_CPU_ARCH_64 2
// Endian
#define CC_ENDIAN_LITTLE 1
#define CC_ENDIAN_BIG 2
// Charset
#define CC_CHARSET_UNICODE 1
#define CC_CHARSET_MULTIBYTE 2
// Precision
#define CC_PRECISION_FLOAT 1
#define CC_PRECISION_DOUBLE 2
// Mode
#define CC_MODE_DEBUG 1
#define CC_MODE_RELEASE 2
@@ -292,28 +283,6 @@ It should work same as apples CFSwapInt32LittleToHost(..)
#error "Unknown compiler. Abort!"
#endif
#if (CC_PLATFORM == CC_PLATFORM_WINDOWS)
#define CC_ENDIAN CC_ENDIAN_LITTLE
#else
#if (CC_PLATFORM == CC_PLATFORM_MAC_OSX)
#include <machine/endian.h>
#elif (CC_PLATFORM == CC_PLATFORM_MAC_IOS)
#include <Endian.h>
#else
#if !defined(__QNX__)
#include <endian.h>
#else
#define CC_ENDIAN CC_ENDIAN_LITTLE
#endif
#endif // (CC_PLATFORM == CC_PLATFORM_MAC_OSX)
#
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define CC_ENDIAN CC_ENDIAN_LITTLE
#else
#define CC_ENDIAN CC_ENDIAN_BIG
#endif //__BYTE_ORDER == __LITTLE_ENDIAN
#endif
// CPU architecture type recognition
#if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
#define CC_CPU CC_CPU_X86
@@ -337,17 +306,6 @@ It should work same as apples CFSwapInt32LittleToHost(..)
#define CC_CPU_ARCH CC_CPU_ARCH_64
#endif
// C11 features
#if (CC_COMPILER == CC_COMPILER_MSVC)
#if (_MSC_VER >= 1700)
#define CC_C11_TYPED_ENUMS
#endif
#elif (CC_COMPILER == CC_COMPILER_GNUC)
#if (__GNUC_MINOR__ >= 4)
#define CC_C11_TYPED_ENUMS
#endif
#endif
// Disable MSVC warning
#if (CC_COMPILER == CC_COMPILER_MSVC)
#pragma warning(disable : 4251 4275 4819)
@@ -359,22 +317,6 @@ It should work same as apples CFSwapInt32LittleToHost(..)
#endif
#endif
// Charset Settings
#if defined(_UNICODE) || defined(UNICODE)
#define CC_CHARSET CC_CHARSET_UNICODE
#else
#define CC_CHARSET CC_CHARSET_MULTIBYTE
#endif
// Asserts expression is true at compile-time
#define CC_COMPILER_ASSERT(x) typedef int COMPILER_ASSERT_[!!(x)]
#if (CC_COMPILER == CC_COMPILER_MSVC)
#define CC_RESTRICT __restrict //MSVC
#else
#define CC_RESTRICT __restrict__ //GCC... and others?
#endif
#define CC_CACHELINE_SIZE 64
#if (CC_COMPILER == CC_COMPILER_MSVC)
@@ -406,6 +348,15 @@ It should work same as apples CFSwapInt32LittleToHost(..)
_Pragma("clang diagnostic pop")
#endif
#define CC_DISALLOW_ASSIGN(TypeName) \
TypeName &operator=(const TypeName &) = delete; \
TypeName &operator=(TypeName &&) = delete
#define CC_DISALLOW_COPY_MOVE_ASSIGN(TypeName) \
TypeName(const TypeName &) = delete; \
TypeName(TypeName &&) = delete; \
CC_DISALLOW_ASSIGN(TypeName)
#define CC_ENABLE_COPY_SEMANTICS(cls) \
cls(const cls &) = default; \
cls &operator=(const cls &) = default;
@@ -605,18 +556,22 @@ It should work same as apples CFSwapInt32LittleToHost(..)
#define CC_TOSTR(s) #s
#define ENABLE_IF_T(t1) std::enable_if_t<std::is_same<t1, T>::value, T>
#define ENABLE_IF_T2(t1, t2) std::enable_if_t<std::is_same<t1, T>::value || std::is_same<t2, T>::value, T>
#define ENABLE_IF_T3(t1, t2, t3) std::enable_if_t<std::is_same<t1, T>::value || std::is_same<t2, T>::value || std::is_same<t3, T>::value, T>
#define ENABLE_IF_T_RET(t1) std::enable_if_t<std::is_same<t1, T>::value, RET>
#define ENABLE_IF_T2_RET(t1, t2) std::enable_if_t<std::is_same<t1, T>::value || std::is_same<t2, T>::value, RET>
#define ENABLE_IF_T3_RET(t1, t2, t3) std::enable_if_t<std::is_same<t1, T>::value || std::is_same<t2, T>::value || std::is_same<t3, T>::value, void>
#if defined(__GNUC__) && __GNUC__ >= 4
#define CC_PREDICT_TRUE(x) __builtin_expect(!!(x), 1)
#define CC_PREDICT_FALSE(x) __builtin_expect(!!(x), 0)
#else
#define CC_PREDICT_TRUE(x) (x)
#define CC_PREDICT_FALSE(x) (x)
#endif
#endif
#if defined(_MSC_VER)
#define CC_FORCE_INLINE __forceinline
#elif defined(__GNUC__) || defined(__clang__)
#define CC_FORCE_INLINE inline __attribute__((always_inline))
#else
#if defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
#define CC_FORCE_INLINE static inline
#elif
#define CC_FORCE_INLINE inline
#endif
#endif
+7 -7
View File
@@ -38,7 +38,7 @@
#include "base/Log.h"
#include "base/Random.h"
#include "base/Ref.h"
#include "base/RefCounted.h"
namespace cc {
@@ -85,26 +85,26 @@ public:
/** Default constructor */
Map<K, V>()
: _data() {
static_assert(std::is_convertible<V, Ref *>::value, "Invalid Type for cc::Map<K, V>!");
static_assert(std::is_convertible<V, RefCounted *>::value, "Invalid Type for cc::Map<K, V>!");
}
/** Constructor with capacity. */
explicit Map<K, V>(ssize_t capacity)
: _data() {
static_assert(std::is_convertible<V, Ref *>::value, "Invalid Type for cc::Map<K, V>!");
static_assert(std::is_convertible<V, RefCounted *>::value, "Invalid Type for cc::Map<K, V>!");
_data.reserve(capacity);
}
/** Copy constructor. */
Map<K, V>(const Map<K, V> &other) {
static_assert(std::is_convertible<V, Ref *>::value, "Invalid Type for cc::Map<K, V>!");
static_assert(std::is_convertible<V, RefCounted *>::value, "Invalid Type for cc::Map<K, V>!");
_data = other._data;
addRefForAllObjects();
}
/** Move constructor. */
Map<K, V>(Map<K, V> &&other) noexcept {
static_assert(std::is_convertible<V, Ref *>::value, "Invalid Type for cc::Map<K, V>!");
static_assert(std::is_convertible<V, RefCounted *>::value, "Invalid Type for cc::Map<K, V>!");
_data = std::move(other._data);
}
@@ -237,7 +237,7 @@ public:
*/
void insert(const K &key, V object) {
CCASSERT(object != nullptr, "Object is nullptr!");
object->retain();
object->addRef();
erase(key);
_data.insert(std::make_pair(key, object));
}
@@ -332,7 +332,7 @@ protected:
/** Retains all the objects in the map */
void addRefForAllObjects() {
for (auto iter = _data.begin(); iter != _data.end(); ++iter) {
iter->second->retain();
iter->second->addRef();
}
}
+57
View File
@@ -0,0 +1,57 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#ifdef USE_CXX_17
#include <optional>
namespace cc {
template <class T>
using optional = std::optional<T>;
using nullopt_t = std::nullopt_t;
inline constexpr nullopt_t nullopt{nullopt_t::__secret_tag{}, nullopt_t::__secret_tag{}};
}; // namespace cc
#else
#include <string>
#include "boost/none.hpp"
#include "boost/optional.hpp"
namespace cc {
template <typename T>
using optional = boost::optional<T>;
using nullopt_t = boost::none_t;
const nullopt_t nullopt((boost::none_t::init_tag())); // NOLINT // use std style
}; // namespace cc
#endif
+204
View File
@@ -0,0 +1,204 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// Originally the class is from WebRTC.
// https://chromium.googlesource.com/external/webrtc/+/master/api/scoped_refptr.h
//
// A smart pointer class for reference counted objects. Use this class instead
// of calling addRef and Release manually on a reference counted object to
// avoid common memory leaks caused by forgetting to Release an object
// reference. Sample usage:
//
// class MyFoo : public RefCounted<MyFoo> {
// ...
// };
//
// void some_function() {
// IntrusivePtr<MyFoo> foo = new MyFoo();
// foo->Method(param);
// // `foo` is released when this function returns
// }
//
// void some_other_function() {
// IntrusivePtr<MyFoo> foo = new MyFoo();
// ...
// foo = nullptr; // explicitly releases `foo`
// ...
// if (foo)
// foo->Method(param);
// }
//
// The above examples show how IntrusivePtr<T> acts like a pointer to T.
// Given two IntrusivePtr<T> classes, it is also possible to exchange
// references between the two objects, like so:
//
// {
// IntrusivePtr<MyFoo> a = new MyFoo();
// IntrusivePtr<MyFoo> b;
//
// b.swap(a);
// // now, `b` references the MyFoo object, and `a` references null.
// }
//
// To make both `a` and `b` in the above example reference the same MyFoo
// object, simply use the assignment operator:
//
// {
// IntrusivePtr<MyFoo> a = new MyFoo();
// IntrusivePtr<MyFoo> b;
//
// b = a;
// // now, `a` and `b` each own a reference to the same MyFoo object.
// }
//
#pragma once
#include <utility>
namespace cc {
template <class T>
class IntrusivePtr {
public:
using element_type = T;
IntrusivePtr() {
}
IntrusivePtr(T *p) : _ptr(p) { // NOLINT
if (_ptr) {
_ptr->addRef();
}
}
IntrusivePtr(const IntrusivePtr<T> &r) : _ptr(r._ptr) {
if (_ptr) {
_ptr->addRef();
}
}
template <typename U>
IntrusivePtr(const IntrusivePtr<U> &r) : _ptr(r.get()) { // NOLINT
if (_ptr) {
_ptr->addRef();
}
}
// Move constructors.
IntrusivePtr(IntrusivePtr<T> &&r) noexcept : _ptr(r.release()) {
}
template <typename U>
IntrusivePtr(IntrusivePtr<U> &&r) noexcept : _ptr(r.release()) { // NOLINT
}
~IntrusivePtr() {
if (_ptr) {
_ptr->release();
}
}
T *get() const { return _ptr; }
operator T *() const { return _ptr; } // NOLINT
T &operator*() const { return *_ptr; }
T *operator->() const { return _ptr; }
// As reference count is 1 after creating a RefCounted object, so do not have to
// invoke p->addRef();
IntrusivePtr<T> &operator=(T *p) {
// AddRef first so that self assignment should work
if (p) {
p->addRef();
}
if (_ptr) {
_ptr->release();
}
_ptr = p;
return *this;
}
IntrusivePtr<T> &operator=(const IntrusivePtr<T> &r) { // NOLINT
return *this = r._ptr; // NOLINT
}
template <typename U>
IntrusivePtr<T> &operator=(const IntrusivePtr<U> &r) {
return *this = r.get(); // NOLINT
}
IntrusivePtr<T> &operator=(IntrusivePtr<T> &&r) noexcept {
IntrusivePtr<T>(std::move(r)).swap(*this);
return *this;
}
template <typename U>
IntrusivePtr<T> &operator=(IntrusivePtr<U> &&r) noexcept {
IntrusivePtr<T>(std::move(r)).swap(*this);
return *this;
}
bool operator==(std::nullptr_t) {
return _ptr == nullptr;
}
bool operator==(T *r) {
return _ptr == r;
}
bool operator!=(std::nullptr_t) {
return _ptr != nullptr;
}
bool operator!=(T *r) {
return _ptr != r;
}
void swap(T **pp) noexcept {
T *p = _ptr;
_ptr = *pp;
*pp = p;
}
void swap(IntrusivePtr<T> &r) noexcept { swap(&r._ptr); }
private:
// Returns the (possibly null) raw pointer, and makes the scoped_refptr hold a
// null pointer, all without touching the reference count of the underlying
// pointed-to object. The object is still reference counted, and the caller of
// release() is now the proud owner of one reference, so it is responsible for
// calling Release() once on the object when no longer using it.
T *release() {
T *retVal = _ptr;
_ptr = nullptr;
return retVal;
}
protected:
T *_ptr{nullptr};
};
} // namespace cc
-157
View File
@@ -1,157 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "base/Ref.h"
#include "base/AutoreleasePool.h"
#include "base/Macros.h"
#if CC_REF_LEAK_DETECTION
#include <algorithm> // std::find
#endif
namespace cc {
#if CC_REF_LEAK_DETECTION
static void trackRef(Ref *ref);
static void untrackRef(Ref *ref);
#endif
Ref::Ref()
: _referenceCount(1) // when the Ref is created, the reference count of it is 1
{
#if CC_REF_LEAK_DETECTION
trackRef(this);
#endif
}
Ref::~Ref() {
#if CC_REF_LEAK_DETECTION
if (_referenceCount != 0)
untrackRef(this);
#endif
}
void Ref::retain() {
CCASSERT(_referenceCount > 0, "reference count should be greater than 0");
++_referenceCount;
}
void Ref::release() {
CCASSERT(_referenceCount > 0, "reference count should be greater than 0");
--_referenceCount;
if (_referenceCount == 0) {
#if defined(CC_DEBUG) && (CC_DEBUG > 0)
auto *poolManager = PoolManager::getInstance();
auto *currentPool = poolManager->getCurrentPool();
if (currentPool && !currentPool->isClearing() && poolManager->isObjectInPools(this)) {
// Trigger an assert if the reference count is 0 but the Ref is still in autorelease pool.
// This happens when 'autorelease/release' were not used in pairs with 'new/retain'.
//
// Wrong usage (1):
//
// auto obj = Node::create(); // Ref = 1, but it's an autorelease Ref which means it was in the autorelease pool.
// obj->autorelease(); // Wrong: If you wish to invoke autorelease several times, you should retain `obj` first.
//
// Wrong usage (2):
//
// auto obj = Node::create();
// obj->release(); // Wrong: obj is an autorelease Ref, it will be released when clearing current pool.
//
// Correct usage (1):
//
// auto obj = Node::create();
// |- new Node(); // `new` is the pair of the `autorelease` of next line
// |- autorelease(); // The pair of `new Node`.
//
// obj->retain();
// obj->autorelease(); // This `autorelease` is the pair of `retain` of previous line.
//
// Correct usage (2):
//
// auto obj = Node::create();
// obj->retain();
// obj->release(); // This `release` is the pair of `retain` of previous line.
CCASSERT(false, "The reference shouldn't be 0 because it is still in autorelease pool.");
}
#endif
#if CC_REF_LEAK_DETECTION
untrackRef(this);
#endif
delete this;
}
}
Ref *Ref::autorelease() {
PoolManager::getInstance()->getCurrentPool()->addObject(this);
return this;
}
unsigned int Ref::getReferenceCount() const {
return _referenceCount;
}
#if CC_REF_LEAK_DETECTION
static std::list<Ref *> __refAllocationList;
void Ref::printLeaks() {
// Dump Ref object memory leaks
if (__refAllocationList.empty()) {
log("[memory] All Ref objects successfully cleaned up (no leaks detected).\n");
} else {
log("[memory] WARNING: %d Ref objects still active in memory.\n", (int)__refAllocationList.size());
for (const auto &ref : __refAllocationList) {
CC_ASSERT(ref);
const char *type = typeid(*ref).name();
log("[memory] LEAK: Ref object '%s' still active with reference count %d.\n", (type ? type : ""), ref->getReferenceCount());
}
}
}
static void trackRef(Ref *ref) {
CCASSERT(ref, "Invalid parameter, ref should not be null!");
// Create memory allocation record.
__refAllocationList.push_back(ref);
}
static void untrackRef(Ref *ref) {
auto iter = std::find(__refAllocationList.begin(), __refAllocationList.end(), ref);
if (iter == __refAllocationList.end()) {
log("[memory] CORRUPTION: Attempting to free (%s) with invalid ref tracking record.\n", typeid(*ref).name());
return;
}
__refAllocationList.erase(iter);
}
#endif // #if CC_REF_LEAK_DETECTION
} // namespace cc
+110
View File
@@ -0,0 +1,110 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "base/RefCounted.h"
#if CC_REF_LEAK_DETECTION
#include <algorithm> // std::find
#include <list>
#include "base/Log.h"
#endif
namespace cc {
#if CC_REF_LEAK_DETECTION
static void trackRef(RefCounted *ref);
static void untrackRef(RefCounted *ref);
#endif
RefCounted::RefCounted() { // NOLINT(modernize-use-equals-default)
#if CC_REF_LEAK_DETECTION
trackRef(this);
#endif
}
RefCounted::~RefCounted() { // NOLINT(modernize-use-equals-default)
#if CC_REF_LEAK_DETECTION
untrackRef(this);
#endif
}
void RefCounted::addRef() {
++_referenceCount;
}
void RefCounted::release() {
CC_ASSERT(_referenceCount > 0);
--_referenceCount;
if (_referenceCount == 0) {
delete this;
}
}
unsigned int RefCounted::getRefCount() const {
return _referenceCount;
}
#if CC_REF_LEAK_DETECTION
static std::list<RefCounted *> __refAllocationList;
void RefCounted::printLeaks() {
// Dump Ref object memory leaks
if (__refAllocationList.empty()) {
CC_LOG_INFO("[memory] All Ref objects successfully cleaned up (no leaks detected).\n");
} else {
CC_LOG_INFO("[memory] WARNING: %d Ref objects still active in memory.\n", (int)__refAllocationList.size());
for (const auto &ref : __refAllocationList) {
CC_ASSERT(ref);
const char *type = typeid(*ref).name();
CC_LOG_INFO("[memory] LEAK: Ref object '%s' still active with reference count %d.\n", (type ? type : ""), ref->getRefCount());
}
}
}
static void trackRef(RefCounted *ref) {
CC_ASSERT(ref);
// Create memory allocation record.
__refAllocationList.push_back(ref);
}
static void untrackRef(RefCounted *ref) {
auto iter = std::find(__refAllocationList.begin(), __refAllocationList.end(), ref);
if (iter == __refAllocationList.end()) {
CC_LOG_INFO("[memory] CORRUPTION: Attempting to free (%s) with invalid ref tracking record.\n", typeid(*ref).name());
return;
}
__refAllocationList.erase(iter);
}
#endif // #if CC_REF_LEAK_DETECTION
} // namespace cc
@@ -34,7 +34,7 @@
namespace cc {
class Ref;
class RefCounted;
/**
* Interface that defines how to clone an Ref.
@@ -51,8 +51,10 @@ public:
* Ref is used for reference count management. If a class inherits from Ref,
* then it is easy to be shared in different places.
*/
class CC_DLL Ref {
class CC_DLL RefCounted {
public:
virtual ~RefCounted();
/**
* Retains the ownership.
*
@@ -60,7 +62,7 @@ public:
*
* @see release, autorelease
*/
void retain();
void addRef();
/**
* Releases the ownership immediately.
@@ -74,27 +76,12 @@ public:
*/
void release();
/**
* Releases the ownership sometime soon automatically.
*
* This decrements the Ref's reference count at the end of current
* autorelease pool block.
*
* If the reference count reaches 0 after the decrement, this Ref is
* destructed.
*
* @returns The Ref itself.
*
* @see AutoreleasePool, retain, release
*/
Ref *autorelease();
/**
* Returns the Ref's current reference count.
*
* @returns The Ref's reference count.
*/
unsigned int getReferenceCount() const;
unsigned int getRefCount() const;
protected:
/**
@@ -102,15 +89,10 @@ protected:
*
* The Ref's reference count is 1 after construction.
*/
Ref();
RefCounted();
virtual ~Ref();
protected:
/// count of references
unsigned int _referenceCount;
friend class AutoreleasePool;
unsigned int _referenceCount{0};
// Memory leak diagnostic data (only included when CC_REF_LEAK_DETECTION is defined and its value isn't zero)
#if CC_REF_LEAK_DETECTION
@@ -119,4 +101,7 @@ public:
#endif
};
using SCHEDULE_CB = void (RefCounted::*)(float);
#define CC_SCHEDULE_CALLBACK(cb) static_cast<cc::SCHEDULE_CB>(&cb)
} // namespace cc
+6 -6
View File
@@ -30,9 +30,8 @@
#include "base/Scheduler.h"
#include <algorithm>
#include <vector>
#include <climits>
#include <vector>
#include "base/Log.h"
#include "base/Macros.h"
@@ -183,8 +182,9 @@ void Scheduler::schedule(const ccSchedulerFunc &callback, void *target, float in
}
auto *timer = new (std::nothrow) TimerTargetCallback();
timer->addRef();
timer->initWithCallback(this, callback, target, key, interval, repeat, delay);
element->timers.push_back(timer);
element->timers.emplace_back(timer);
}
void Scheduler::unschedule(const std::string &key, void *target) {
@@ -204,7 +204,7 @@ void Scheduler::unschedule(const std::string &key, void *target) {
if (timer && key == timer->getKey()) {
if (timer == element->currentTimer && (!element->currentTimerSalvaged)) {
element->currentTimer->retain();
element->currentTimer->addRef();
element->currentTimerSalvaged = true;
}
@@ -273,7 +273,7 @@ void Scheduler::unscheduleAllForTarget(void *target) {
auto & timers = element->timers;
if (std::find(timers.begin(), timers.end(), element->currentTimer) != timers.end() &&
(!element->currentTimerSalvaged)) {
element->currentTimer->retain();
element->currentTimer->addRef();
element->currentTimerSalvaged = true;
}
@@ -347,7 +347,7 @@ void Scheduler::update(float dt) {
if (!_currentTarget->paused) {
// The 'timers' array may change while inside this loop
for (elt->timerIndex = 0; elt->timerIndex < static_cast<int>(elt->timers.size()); ++(elt->timerIndex)) {
elt->currentTimer = elt->timers[elt->timerIndex];
elt->currentTimer = elt->timers.at(elt->timerIndex);
elt->currentTimerSalvaged = false;
elt->currentTimer->update(dt);
+5 -7
View File
@@ -35,8 +35,7 @@
#include <unordered_map>
#include <vector>
#include "base/Ref.h"
//#include "base/Vector.h"
#include "base/RefCounted.h"
namespace cc {
@@ -47,7 +46,7 @@ using ccSchedulerFunc = std::function<void(float)>;
/**
* @cond
*/
class CC_DLL Timer : public Ref {
class CC_DLL Timer : public RefCounted {
public:
/** get interval in seconds */
inline float getInterval() const { return _interval; };
@@ -65,15 +64,14 @@ public:
protected:
Timer() = default;
protected:
Scheduler * _scheduler = nullptr;
float _elapsed = 0.f;
float _elapsed = 0.F;
bool _runForever = false;
bool _useDelay = false;
unsigned int _timesExecuted = 0;
unsigned int _repeat = 0; //0 = once, 1 is 2 x executed
float _delay = 0.f;
float _interval = 0.f;
float _delay = 0.F;
float _interval = 0.F;
};
class CC_DLL TimerTargetCallback final : public Timer {
+52 -2
View File
@@ -24,8 +24,13 @@
****************************************************************************/
#include "StringUtil.h"
#include <algorithm>
#include <cctype>
#include <cstdarg>
#include <string>
#include "base/ZipUtils.h"
#include "base/base64.h"
#include "memory/Memory.h"
#if (CC_PLATFORM == CC_PLATFORM_WINDOWS)
@@ -59,8 +64,8 @@ int StringUtil::vprintf(char *buf, const char *last, const char *fmt, va_list ar
return 0;
}
int count = static_cast<int>(last - buf);
int ret = vsnprintf(buf, count, fmt, args);
auto count = static_cast<int>(last - buf);
int ret = vsnprintf(buf, count, fmt, args);
if (ret >= count - 1) {
return count - 1;
}
@@ -125,4 +130,49 @@ StringArray StringUtil::split(const String &str, const String &delims, uint maxS
return strs;
}
String &StringUtil::replace(String &str, const String &findStr, const String &replaceStr) {
size_t startPos = str.find(findStr);
if (startPos == std::string::npos) {
return str;
}
str.replace(startPos, findStr.length(), replaceStr);
return str;
}
String &StringUtil::replaceAll(String &str, const String &findStr, const String &replaceStr) {
if (findStr.empty()) {
return str;
}
size_t startPos = 0;
while ((startPos = str.find(findStr, startPos)) != std::string::npos) {
str.replace(startPos, findStr.length(), replaceStr);
startPos += replaceStr.length();
}
return str;
}
String &StringUtil::tolower(String &str) {
std::transform(str.begin(), str.end(), str.begin(),
[](unsigned char c) { return std::tolower(c); });
return str;
}
String &StringUtil::toupper(String &str) {
std::transform(str.begin(), str.end(), str.begin(),
[](unsigned char c) { return std::toupper(c); });
return str;
}
std::string GzipedString::value() const { // NOLINT(readability-convert-member-functions-to-static)
uint8_t * outGzip{nullptr};
uint8_t * outBase64{nullptr};
auto * input = reinterpret_cast<unsigned char *>(const_cast<char *>(_str.c_str()));
auto lenOfBase64 = base64Decode(input, static_cast<unsigned int>(_str.size()), &outBase64);
auto lenofUnzip = ZipUtils::inflateMemory(outBase64, static_cast<ssize_t>(lenOfBase64), &outGzip);
std::string ret(outGzip, outGzip + lenofUnzip);
free(outGzip);
free(outBase64);
return ret;
}
} // namespace cc
+36
View File
@@ -26,6 +26,7 @@
#pragma once
#include <cstdarg>
#include <cstddef>
#include "Macros.h"
#include "TypeDef.h"
#include "memory/Memory.h"
@@ -38,6 +39,41 @@ public:
static int printf(char *buf, const char *last, const char *fmt, ...);
static String format(const char *fmt, ...);
static StringArray split(const String &str, const String &delims, uint maxSplits = 0);
static String & replace(String &str, const String &findStr, const String &replaceStr);
static String & replaceAll(String &str, const String &findStr, const String &replaceStr);
static String & tolower(String &str);
static String & toupper(String &str);
};
/**
* Store compressed text which compressed with gzip & base64
* fetch plain-text with `value()`.
*/
class CC_DLL GzipedString {
public:
explicit GzipedString(std::string &&dat) : _str(dat) {}
explicit GzipedString(const char *dat) : _str(dat) {}
GzipedString(const GzipedString &o) = default;
GzipedString &operator=(const GzipedString &d) = default;
GzipedString(GzipedString &&o) noexcept {
_str = std::move(o._str);
}
GzipedString &operator=(std::string &&d) {
_str = std::move(d);
return *this;
}
GzipedString &operator=(GzipedString &&d) noexcept {
_str = std::move(d._str);
return *this;
}
/**
* return text decompress with base64decode | un-gzip
*/
std::string value() const;
private:
std::string _str{};
};
} // namespace cc
+8
View File
@@ -26,6 +26,8 @@
#pragma once
#include <cstdint>
#include <unordered_map>
#include "base/Macros.h"
using uint = std::uint32_t;
using ushort = std::uint16_t;
@@ -35,10 +37,16 @@ using ulong = std::uint32_t;
#endif
using FlagBits = std::uint32_t;
using index_t = int32_t;
#define CC_INVALID_INDEX (-1)
#define Record std::unordered_map // NOLINT(readability-identifier-naming)
#define CC_ENUM_CONVERSION_OPERATOR(T) \
inline std::underlying_type<T>::type toNumber(const T v) { return static_cast<std::underlying_type<T>::type>(v); }
#define CC_ENUM_BITWISE_OPERATORS(T) \
inline bool operator!(const T v) { return !static_cast<std::underlying_type<T>::type>(v); } \
inline T operator~(const T v) { return static_cast<T>(~static_cast<std::underlying_type<T>::type>(v)); } \
inline bool operator||(const T lhs, const T rhs) { return (static_cast<std::underlying_type<T>::type>(lhs) || static_cast<std::underlying_type<T>::type>(rhs)); } \
inline bool operator&&(const T lhs, const T rhs) { return (static_cast<std::underlying_type<T>::type>(lhs) && static_cast<std::underlying_type<T>::type>(rhs)); } \
+91
View File
@@ -27,6 +27,7 @@
#pragma once
#include <algorithm>
#include <bitset>
#include <cerrno>
#include <climits>
@@ -123,5 +124,95 @@ inline uint toUint(T value) {
return static_cast<uint>(value);
}
template <typename Map>
Map &mergeToMap(Map &outMap, const Map &inMap) {
for (const auto &e : inMap) {
outMap.emplace(e.first, e.second);
}
return outMap;
}
namespace array {
/**
* @zh
* 移除首个指定的数组元素。判定元素相等时相当于于使用了 `Array.prototype.indexOf`。
* @en
* Removes the first occurrence of a specific object from the array.
* Decision of the equality of elements is similar to `Array.prototype.indexOf`.
* @param array 数组。
* @param value 待移除元素。
*/
template <typename T>
bool remove(std::vector<T> &array, T value) {
auto iter = std::find(array.begin(), array.end(), value);
if (iter != array.end()) {
array.erase(iter);
return true;
}
return false;
}
/**
* @zh
* 移除指定索引的数组元素。
* @en
* Removes the array item at the specified index.
* @param array 数组。
* @param index 待移除元素的索引。
*/
template <typename T>
bool removeAt(std::vector<T> &array, int32_t index) {
if (index >= 0 && index < static_cast<int32_t>(array.size())) {
array.erase(array.begin() + index);
return true;
}
return false;
}
/**
* @zh
* 移除指定索引的数组元素。
* 此函数十分高效,但会改变数组的元素次序。
* @en
* Removes the array item at the specified index.
* It's faster but the order of the array will be changed.
* @param array 数组。
* @param index 待移除元素的索引。
*/
template <typename T>
bool fastRemoveAt(std::vector<T> &array, int32_t index) {
const auto length = static_cast<int32_t>(array.size());
if (index < 0 || index >= length) {
return false;
}
array[index] = array[length - 1];
array.resize(length - 1);
return true;
}
/**
* @zh
* 移除首个指定的数组元素。判定元素相等时相当于于使用了 `Array.prototype.indexOf`。
* 此函数十分高效,但会改变数组的元素次序。
* @en
* Removes the first occurrence of a specific object from the array.
* Decision of the equality of elements is similar to `Array.prototype.indexOf`.
* It's faster but the order of the array will be changed.
* @param array 数组。
* @param value 待移除元素。
*/
template <typename T>
bool fastRemove(std::vector<T> &array, T value) {
auto iter = std::find(array.begin(), array.end(), value);
if (iter != array.end()) {
*iter = array[array.size() - 1];
array.resize(array.size() - 1);
return true;
}
return false;
}
} // namespace array
} // namespace utils
} // namespace cc
+212
View File
@@ -0,0 +1,212 @@
/****************************************************************************
Copyright (c) 2021 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#ifdef USE_CXX_17
#include <variant>
namespace cc {
template <class... T>
using variant = std::variant<T...>;
using monostate = std::monostate;
template <class U, class... T>
inline constexpr bool holds_alternative(variant<T...> const &v) noexcept {
return std::holds_alternative<U, T...>(v);
}
// get_if
template <std::size_t I, class... T>
inline constexpr typename std::add_pointer<std::variant_alternative_t<I, variant<T...>>>::type get_if(variant<T...> *v) noexcept {
return std::get_if<I, T...>(v);
}
template <std::size_t I, class... T>
inline constexpr typename std::add_pointer<const std::variant_alternative_t<I, variant<T...>>>::type get_if(variant<T...> const *v) noexcept {
return std::get_if<I, T...>(v);
}
template <class U, class... T>
inline constexpr typename std::add_pointer<U>::type get_if(variant<T...> *v) noexcept {
return std::get_if<U, T...>(v);
}
template <class U, class... T>
inline constexpr typename std::add_pointer<U const>::type get_if(variant<T...> const *v) noexcept {
return std::get_if<U, T...>(v);
}
// get (index)
template <std::size_t I, class... T>
inline constexpr std::variant_alternative_t<I, variant<T...>> &get(variant<T...> &v) {
return std::get<I, T...>(v);
}
template <std::size_t I, class... T>
inline constexpr std::variant_alternative_t<I, variant<T...>> &&get(variant<T...> &&v) {
return std::get<I, T...>(std::forward<variant<T...>>(v));
}
template <std::size_t I, class... T>
inline constexpr std::variant_alternative_t<I, variant<T...>> const &get(variant<T...> const &v) {
return std::get<I, T...>(v);
}
template <std::size_t I, class... T>
inline constexpr std::variant_alternative_t<I, variant<T...>> const &&get(variant<T...> const &&v) {
return std::get<I, T...>(v);
}
// get (type)
template <class U, class... T>
inline constexpr U &get(variant<T...> &v) {
return std::get<U, T...>(v);
}
template <class U, class... T>
inline constexpr U &&get(variant<T...> &&v) {
return std::get<U, T...>(v);
}
template <class U, class... T>
inline constexpr U const &get(variant<T...> const &v) {
return std::get<U, T...>(v);
}
template <class U, class... T>
inline constexpr U const &&get(variant<T...> const &&v) {
return std::get<U, T...>(v);
}
// visit
template <class _Visitor, class... _Vs>
inline constexpr decltype(auto) visit(_Visitor &&__visitor, _Vs &&...__vs) {
return std::visit(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...);
}
}; // namespace cc
#else
#include "boost/variant2/variant.hpp"
namespace cc {
template <class... T>
using variant = boost::variant2::variant<T...>;
using monostate = boost::variant2::monostate;
template <class U, class... T>
inline constexpr bool holds_alternative(variant<T...> const &v) noexcept { // NOLINT // use std style
return boost::variant2::holds_alternative<U, T...>(v);
}
// get_if
template <std::size_t I, class... T>
inline constexpr typename std::add_pointer<boost::variant2::variant_alternative_t<I, variant<T...>>>::type get_if(variant<T...> *v) noexcept { // NOLINT // use std style
return boost::variant2::get_if<I, T...>(v);
}
template <std::size_t I, class... T>
inline constexpr typename std::add_pointer<const boost::variant2::variant_alternative_t<I, variant<T...>>>::type get_if(variant<T...> const *v) noexcept { // NOLINT // use std style
return boost::variant2::get_if<I, T...>(v);
}
template <class U, class... T>
inline constexpr typename std::add_pointer<U>::type get_if(variant<T...> *v) noexcept { // NOLINT // use std style
return boost::variant2::get_if<U, T...>(v);
}
template <class U, class... T>
inline constexpr typename std::add_pointer<U const>::type get_if(variant<T...> const *v) noexcept { // NOLINT // use std style
return boost::variant2::get_if<U, T...>(v);
}
// get (index)
template <std::size_t I, class... T>
inline constexpr boost::variant2::variant_alternative_t<I, variant<T...>> &get(variant<T...> &v) {
return boost::variant2::get<I, T...>(v);
}
template <std::size_t I, class... T>
inline constexpr boost::variant2::variant_alternative_t<I, variant<T...>> &&get(variant<T...> &&v) {
return boost::variant2::get<I, T...>(std::forward<variant<T...>>(v));
}
template <std::size_t I, class... T>
inline constexpr boost::variant2::variant_alternative_t<I, variant<T...>> const &get(variant<T...> const &v) {
return boost::variant2::get<I, T...>(v);
}
template <std::size_t I, class... T>
inline constexpr boost::variant2::variant_alternative_t<I, variant<T...>> const &&get(variant<T...> const &&v) {
return boost::variant2::get<I, T...>(v);
}
// get (type)
template <class U, class... T>
inline constexpr U &get(variant<T...> &v) {
return boost::variant2::get<U, T...>(v);
}
template <class U, class... T>
inline constexpr U &&get(variant<T...> &&v) {
return boost::variant2::get<U, T...>(v);
}
template <class U, class... T>
inline constexpr U const &get(variant<T...> const &v) {
return boost::variant2::get<U, T...>(v);
}
template <class U, class... T>
inline constexpr U const &&get(variant<T...> const &&v) {
return boost::variant2::get<U, T...>(v);
}
// visit
template <class R = boost::variant2::detail::deduced, class F, class V1>
inline constexpr auto visit(F &&f, V1 &&v1) -> boost::variant2::detail::Vret<R, F, V1> {
return boost::variant2::visit<R, F, V1>(std::forward<F>(f), std::forward<V1>(v1));
}
template <class R = boost::variant2::detail::deduced, class F, class V1, class V2, class... V>
inline constexpr auto visit(F &&f, V1 &&v1, V2 &&v2, V &&...v) -> boost::variant2::detail::Vret<R, F, V1, V2, V...> {
return boost::variant2::visit<R, F, V1, V2, V...>(std::forward<F>(f), std::forward<V1>(v1), std::forward<V2>(v2), std::forward<V>(v)...);
}
}; // namespace cc
#endif
+78 -52
View File
@@ -28,21 +28,25 @@
#pragma once
#include <sys/types.h>
#include <algorithm> // for std::find
#include <cstdint>
#include <functional>
#include <vector>
#include "base/Log.h"
#include "base/Macros.h"
#include "base/Random.h"
#include "base/Ref.h"
#include "base/RefCounted.h"
#include "base/TypeDef.h"
#include "core/TypedArray.h"
namespace cc {
/*
* Similar to std::vector, but it will manage reference count automatically internally.
* Which means it will invoke Ref::retain() when adding an element, and invoke Ref::release() when removing an element.
* @warn The element should be `Ref` or its sub-class.
* Which means it will invoke RefCounted::addRef() when adding an element, and invoke RefCounted::release() when removing an element.
* @warn The element should be `RefCounted` or its sub-class.
*/
template <class T>
class Vector {
@@ -108,17 +112,17 @@ public:
/** Constructor. */
Vector<T>()
: _data() {
static_assert(std::is_convertible<T, Ref *>::value, "Invalid Type for cc::Vector<T>!");
static_assert(std::is_convertible<T, RefCounted *>::value, "Invalid Type for cc::Vector<T>!");
}
/**
* Constructor with a capacity.
* @param capacity Capacity of the Vector.
*/
explicit Vector<T>(ssize_t capacity)
explicit Vector<T>(uint32_t capacity)
: _data() {
static_assert(std::is_convertible<T, Ref *>::value, "Invalid Type for cc::Vector<T>!");
CC_LOG_INFO("In the default constructor with capacity of Vector.");
static_assert(std::is_convertible<T, RefCounted *>::value, "Invalid Type for cc::Vector<T>!");
// CC_LOG_INFO("In the default constructor with capacity of Vector.");
reserve(capacity);
}
@@ -131,29 +135,44 @@ public:
/** Destructor. */
~Vector<T>() {
CC_LOG_INFO("In the destructor of Vector.");
// CC_LOG_INFO("In the destructor of Vector.");
clear();
}
/** Copy constructor. */
Vector<T>(const Vector<T> &other) {
static_assert(std::is_convertible<T, Ref *>::value, "Invalid Type for cc::Vector<T>!");
CC_LOG_INFO("In the copy constructor!");
static_assert(std::is_convertible<T, RefCounted *>::value, "Invalid Type for cc::Vector<T>!");
// CC_LOG_INFO("In the copy constructor!");
_data = other._data;
addRefForAllObjects();
}
/** Copy constructor. */
explicit Vector<T>(const std::vector<T> &other) {
static_assert(std::is_convertible<T, RefCounted *>::value, "Invalid Type for cc::Vector<T>!");
// CC_LOG_INFO("In the copy constructor!");
_data = other;
addRefForAllObjects();
}
/** Constructor with std::move semantic. */
Vector<T>(Vector<T> &&other) noexcept {
static_assert(std::is_convertible<T, Ref *>::value, "Invalid Type for cc::Vector<T>!");
CC_LOG_INFO("In the move constructor of Vector!");
static_assert(std::is_convertible<T, RefCounted *>::value, "Invalid Type for cc::Vector<T>!");
// CC_LOG_INFO("In the move constructor of Vector!");
_data = std::move(other._data);
}
/** Constructor with std::move semantic. */
explicit Vector<T>(std::vector<T> &&other) noexcept {
static_assert(std::is_convertible<T, RefCounted *>::value, "Invalid Type for cc::Vector<T>!");
// CC_LOG_INFO("In the move constructor of Vector!");
_data = std::move(other);
}
/** Copy assignment operator. */
Vector<T> &operator=(const Vector<T> &other) {
if (this != &other) {
CC_LOG_INFO("In the copy assignment operator!");
// CC_LOG_INFO("In the copy assignment operator!");
clear();
_data = other._data;
addRefForAllObjects();
@@ -164,7 +183,7 @@ public:
/** Copy assignment operator with std::move semantic. */
Vector<T> &operator=(Vector<T> &&other) noexcept {
if (this != &other) {
CC_LOG_INFO("In the move assignment operator!");
// CC_LOG_INFO("In the move assignment operator!");
clear();
_data = std::move(other._data);
}
@@ -175,7 +194,7 @@ public:
* Requests that the vector capacity be at least enough to contain n elements.
* @param capacity Minimum capacity requested of the Vector.
*/
void reserve(ssize_t n) {
void reserve(uint32_t n) {
_data.reserve(n);
}
@@ -184,7 +203,7 @@ public:
* It can be equal or greater, with the extra space allowing to accommodate for growth without the need to reallocate on each insertion.
* @return The size of the currently allocated storage capacity in the Vector, measured in terms of the number elements it can hold.
*/
ssize_t capacity() const {
uint32_t capacity() const {
return _data.capacity();
}
@@ -192,8 +211,8 @@ public:
* @note This is the number of actual objects held in the Vector, which is not necessarily equal to its storage capacity.
* @return The number of elements in the Vector.
*/
ssize_t size() const {
return _data.size();
uint32_t size() const {
return static_cast<uint32_t>(_data.size());
}
/** @brief Returns whether the Vector is empty (i.e. whether its size is 0).
@@ -204,12 +223,12 @@ public:
}
/** Returns the maximum number of elements that the Vector can hold. */
ssize_t maxSize() const {
uint32_t maxSize() const {
return _data.max_size();
}
/** Returns index of a certain object, return UINT_MAX if doesn't contain the object */
ssize_t getIndex(T object) const {
uint32_t getIndex(T object) const {
auto iter = std::find(_data.begin(), _data.end(), object);
if (iter != _data.end()) {
return iter - _data.begin();
@@ -237,8 +256,8 @@ public:
}
/** Returns the element at position 'index' in the Vector. */
T at(ssize_t index) const {
CCASSERT(index >= 0 && index < size(), "index out of range in getObjectAtIndex()");
T at(uint32_t index) const {
CC_ASSERT(index < size());
return _data[index];
}
@@ -255,7 +274,7 @@ public:
/** Returns a random element of the Vector. */
T getRandomObject() const {
if (!_data.empty()) {
auto randIdx = static_cast<ssize_t>(RandomHelper::randomInt<int>(0, static_cast<int>(_data.size()) - 1));
auto randIdx = RandomHelper::randomInt<int>(0, static_cast<int>(_data.size()) - 1);
return *(_data.begin() + randIdx);
}
return nullptr;
@@ -276,12 +295,12 @@ public:
* @return True if two vectors are equal, false if not.
*/
bool equals(const Vector<T> &other) const {
ssize_t s = this->size();
uint32_t s = this->size();
if (s != other.size()) {
return false;
}
for (ssize_t i = 0; i < s; i++) {
for (uint32_t i = 0; i < s; i++) {
if (this->at(i) != other.at(i)) {
return false;
}
@@ -293,16 +312,16 @@ public:
/** Adds a new element at the end of the Vector. */
void pushBack(T object) {
CCASSERT(object != nullptr, "The object should not be nullptr");
CC_ASSERT(object != nullptr);
_data.push_back(object);
object->retain();
object->addRef();
}
/** Push all elements of an existing Vector to the end of current Vector. */
void pushBack(const Vector<T> &other) {
for (const auto &obj : other) {
_data.push_back(obj);
obj->retain();
obj->addRef();
}
}
@@ -311,18 +330,18 @@ public:
* @param index The index to be inserted at.
* @param object The object to be inserted.
*/
void insert(ssize_t index, T object) {
CCASSERT(index >= 0 && index <= size(), "Invalid index!");
CCASSERT(object != nullptr, "The object should not be nullptr");
void insert(uint32_t index, T object) {
CC_ASSERT(index <= size());
CC_ASSERT(object != nullptr);
_data.insert((std::begin(_data) + index), object);
object->retain();
object->addRef();
}
// Removes Objects
/** Removes the last element in the Vector. */
void popBack() {
CCASSERT(!_data.empty(), "no objects added");
CC_ASSERT(!_data.empty());
auto last = _data.back();
_data.pop_back();
last->release();
@@ -334,7 +353,7 @@ public:
* If its value is 'false', it will just erase the first occurrence.
*/
void eraseObject(T object, bool removeAll = false) {
CCASSERT(object != nullptr, "The object should not be nullptr");
CC_ASSERT(object != nullptr);
if (removeAll) {
for (auto iter = _data.begin(); iter != _data.end();) {
@@ -360,7 +379,7 @@ public:
* This is the container end if the operation erased the last element in the sequence.
*/
iterator erase(iterator position) {
CCASSERT(position >= _data.begin() && position < _data.end(), "Invalid position!");
CC_ASSERT(position >= _data.begin() && position < _data.end());
(*position)->release();
return _data.erase(position);
}
@@ -383,8 +402,8 @@ public:
* @param index The index of the element to be removed from the Vector.
* @return An iterator pointing to the successor of Vector[index].
*/
iterator erase(ssize_t index) {
CCASSERT(!_data.empty() && index >= 0 && index < size(), "Invalid index!");
iterator erase(uint32_t index) {
CC_ASSERT(!_data.empty() && index < size());
auto it = std::next(begin(), index);
(*it)->release();
return _data.erase(it);
@@ -395,7 +414,10 @@ public:
*/
void clear() {
for (auto it = std::begin(_data); it != std::end(_data); ++it) {
(*it)->release();
auto *ptr = *it;
if (ptr) {
ptr->release();
}
}
_data.clear();
}
@@ -404,29 +426,25 @@ public:
/** Swap the values object1 and object2. */
void swap(T object1, T object2) {
ssize_t idx1 = getIndex(object1);
ssize_t idx2 = getIndex(object2);
CCASSERT(idx1 >= 0 && idx2 >= 0, "invalid object index");
uint32_t idx1 = getIndex(object1);
uint32_t idx2 = getIndex(object2);
std::swap(_data[idx1], _data[idx2]);
}
/** Swap two elements by indexes. */
void swap(ssize_t index1, ssize_t index2) {
CCASSERT(index1 >= 0 && index1 < size() && index2 >= 0 && index2 < size(), "Invalid indices");
void swap(uint32_t index1, uint32_t index2) {
CC_ASSERT(index1 < size() && index2 < size());
std::swap(_data[index1], _data[index2]);
}
/** Replace value at index with given object. */
void replace(ssize_t index, T object) {
CCASSERT(index >= 0 && index < size(), "Invalid index!");
CCASSERT(object != nullptr, "The object should not be nullptr");
void replace(uint32_t index, T object) {
CC_ASSERT(index < size());
CC_ASSERT(object != nullptr);
_data[index]->release();
CC_SAFE_RELEASE(_data[index]);
_data[index] = object;
object->retain();
CC_SAFE_ADD_REF(object);
}
/** Reverses the Vector. */
@@ -439,11 +457,19 @@ public:
_data.shrink_to_fit();
}
const std::vector<T> &get() const {
return _data;
}
void resize(uint32_t size) {
_data.resize(size);
}
protected:
/** Retains all the objects in the vector */
void addRefForAllObjects() {
for (const auto &obj : _data) {
obj->retain();
obj->addRef();
}
}
+5 -4
View File
@@ -26,8 +26,9 @@ THE SOFTWARE.
#pragma once
#include "../Macros.h"
#include <cstddef>
#include "../Macros.h"
#include "base/RefCounted.h"
// Anything that has done a #define new <blah> will screw operator new definitions up
// so undefine
@@ -46,10 +47,10 @@ namespace cc {
to use (e.g. see StdAllocPolicy).
*/
template <class Alloc>
class CC_DLL AllocatedObject {
class CC_DLL AllocatedObject : public RefCounted {
public:
explicit AllocatedObject() = default;
virtual ~AllocatedObject() = default;
explicit AllocatedObject() = default;
~AllocatedObject() override = default;
// operator new, with debug line info
void *operator new(size_t sz, const char *file, int line, const char *func) {
+19 -19
View File
@@ -76,7 +76,7 @@ std::string StackFrame::toString() {
#if CC_PLATFORM == CC_PLATFORM_ANDROID
struct ThreadStack {
void* stack[MAX_STACK_FRAMES];
void *stack[MAX_STACK_FRAMES];
int current;
int overflow;
};
@@ -91,14 +91,14 @@ init_once(void) {
pthread_key_create(&s_threadStackKey, NULL);
}
static ThreadStack* __attribute__((no_instrument_function))
static ThreadStack *__attribute__((no_instrument_function))
getThreadStack() {
ThreadStack* ptr = (ThreadStack*)pthread_getspecific(s_threadStackKey);
ThreadStack *ptr = (ThreadStack *)pthread_getspecific(s_threadStackKey);
if (ptr) {
return ptr;
}
ptr = (ThreadStack*)calloc(1, sizeof(ThreadStack));
ptr = (ThreadStack *)calloc(1, sizeof(ThreadStack));
ptr->current = 0;
ptr->overflow = 0;
pthread_setspecific(s_threadStackKey, ptr);
@@ -106,9 +106,9 @@ getThreadStack() {
}
void __attribute__((no_instrument_function))
__cyg_profile_func_enter(void* this_fn, void* call_site) {
__cyg_profile_func_enter(void *this_fn, void *call_site) {
pthread_once(&s_once, init_once);
ThreadStack* ptr = getThreadStack();
ThreadStack *ptr = getThreadStack();
if (ptr->current < MAX_STACK_FRAMES) {
ptr->stack[ptr->current++] = this_fn;
ptr->overflow = 0;
@@ -118,9 +118,9 @@ __cyg_profile_func_enter(void* this_fn, void* call_site) {
}
void __attribute__((no_instrument_function))
__cyg_profile_func_exit(void* this_fn, void* call_site) {
__cyg_profile_func_exit(void *this_fn, void *call_site) {
pthread_once(&s_once, init_once);
ThreadStack* ptr = getThreadStack();
ThreadStack *ptr = getThreadStack();
if (ptr->overflow == 0 && ptr->current > 0) {
ptr->current--;
@@ -134,7 +134,7 @@ __cyg_profile_func_exit(void* this_fn, void* call_site) {
#endif
std::string CallStack::basename(const std::string& path) {
std::string CallStack::basename(const std::string &path) {
size_t found = path.find_last_of("/\\");
if (std::string::npos != found) {
@@ -144,13 +144,13 @@ std::string CallStack::basename(const std::string& path) {
}
}
std::vector<void*> CallStack::backtrace() {
std::vector<void *> CallStack::backtrace() {
#if CC_PLATFORM == CC_PLATFORM_ANDROID
std::vector<void*> callstack;
std::vector<void *> callstack;
callstack.reserve(MAX_STACK_FRAMES);
pthread_once(&s_once, init_once);
ThreadStack* ptr = getThreadStack();
ThreadStack *ptr = getThreadStack();
for (int i = ptr->current - 1; i >= 0; i--) {
callstack.push_back(ptr->stack[i]);
}
@@ -158,10 +158,10 @@ std::vector<void*> CallStack::backtrace() {
return callstack;
#elif CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_MAC_OSX
std::vector<void*> callstack;
std::vector<void *> callstack;
callstack.reserve(MAX_STACK_FRAMES);
void* array[MAX_STACK_FRAMES];
void *array[MAX_STACK_FRAMES];
int count = ::backtrace(array, MAX_STACK_FRAMES);
for (auto i = 0; i < count; i++) {
callstack.push_back(array[i]);
@@ -169,10 +169,10 @@ std::vector<void*> CallStack::backtrace() {
return callstack;
#elif CC_PLATFORM == CC_PLATFORM_WINDOWS
std::vector<void*> callstack;
std::vector<void *> callstack;
callstack.reserve(MAX_STACK_FRAMES);
void* array[MAX_STACK_FRAMES];
void *array[MAX_STACK_FRAMES];
int count = CaptureStackBackTrace(0, MAX_STACK_FRAMES, array, NULL);
for (auto i = 0; i < count; i++) {
callstack.push_back(array[i]);
@@ -184,7 +184,7 @@ std::vector<void*> CallStack::backtrace() {
#endif
}
std::vector<StackFrame> CallStack::backtraceSymbols(const std::vector<void*>& callstack) {
std::vector<StackFrame> CallStack::backtraceSymbols(const std::vector<void *> &callstack) {
#if CC_PLATFORM == CC_PLATFORM_ANDROID
std::vector<StackFrame> frames;
size_t size = callstack.size();
@@ -197,7 +197,7 @@ std::vector<StackFrame> CallStack::backtraceSymbols(const std::vector<void*>& ca
}
if (info.dli_sname && strlen(info.dli_sname) > 0) {
char* real_name = abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, nullptr);
char *real_name = abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, nullptr);
if (real_name) {
frame.function = real_name;
free(real_name);
@@ -218,7 +218,7 @@ std::vector<StackFrame> CallStack::backtraceSymbols(const std::vector<void*>& ca
}
std::vector<StackFrame> frames;
char** strs = ::backtrace_symbols(&callstack[0], size);
char ** strs = ::backtrace_symbols(&callstack[0], size);
for (size_t i = 0; i < size; i++) {
StackFrame frame;
frame.file = strs[i];
+3 -3
View File
@@ -58,10 +58,10 @@ struct CC_DLL StackFrame {
*/
class CC_DLL CallStack {
public:
static std::string basename(const std::string& path);
static std::string basename(const std::string &path);
static std::vector<void*> backtrace();
static std::vector<StackFrame> backtraceSymbols(const std::vector<void*>& callstack);
static std::vector<void *> backtrace();
static std::vector<StackFrame> backtraceSymbols(const std::vector<void *> &callstack);
#if CC_PLATFORM == CC_PLATFORM_WINDOWS
static void initSym();
+13 -7
View File
@@ -117,18 +117,24 @@
#define CC_DESTROY(ptr) \
{ \
(ptr)->destroy(); \
CC_DELETE(ptr); \
}
#define CC_SAFE_DESTROY(ptr) \
if (ptr) { \
(ptr)->destroy(); \
CC_DELETE(ptr); \
ptr = nullptr; \
}
#define CC_UNSAFE_DESTROY(ptr) \
if (ptr) { \
(ptr)->destroy(); \
CC_DELETE(ptr); \
#define CC_SAFE_DESTROY_AND_DELETE(ptr) \
if (ptr) { \
(ptr)->destroy(); \
CC_DELETE(ptr); \
ptr = nullptr; \
}
#define CC_SAFE_DESTROY_NULL(ptr) \
if (ptr) { \
(ptr)->destroy(); \
(ptr) = nullptr; \
}
#define CC_SAFE_RELEASE_REF(ptr) \
+18 -18
View File
@@ -37,17 +37,17 @@ static DeleteHookType g_delete_hooker = nullptr;
extern "C" {
void* malloc(size_t size) __attribute__((weak));
void free(void* ptr) __attribute__((weak));
void *malloc(size_t size) __attribute__((weak));
void free(void *ptr) __attribute__((weak));
// Use strong symbol to overwrite the weak one.
void* malloc(size_t size) {
void *malloc(size_t size) {
static MallocType system_malloc = nullptr;
if (CC_PREDICT_FALSE(system_malloc == nullptr)) {
system_malloc = (MallocType)dlsym(RTLD_NEXT, "malloc");
}
void* ptr = system_malloc(size);
void *ptr = system_malloc(size);
if (CC_PREDICT_TRUE(g_new_hooker != nullptr)) {
g_new_hooker(ptr, size);
}
@@ -55,7 +55,7 @@ void* malloc(size_t size) {
return ptr;
}
void free(void* ptr) {
void free(void *ptr) {
static FreeType system_free = nullptr;
if (CC_PREDICT_FALSE(system_free == nullptr)) {
system_free = (FreeType)dlsym(RTLD_NEXT, "free");
@@ -73,8 +73,8 @@ typedef void malloc_logger_t(uint32_t aType,
uintptr_t aArg1, uintptr_t aArg2, uintptr_t aArg3,
uintptr_t aResult, uint32_t aNumHotFramesToSkip);
extern malloc_logger_t* malloc_logger;
static malloc_logger_t* g_system_malloc_logger = nullptr;
extern malloc_logger_t *malloc_logger;
static malloc_logger_t *g_system_malloc_logger = nullptr;
static NewHookType g_new_hooker = nullptr;
static DeleteHookType g_delete_hooker = nullptr;
@@ -87,18 +87,18 @@ cc_malloc_logger(uint32_t aType,
if (new_size != 0) {
// realloc
if (CC_PREDICT_TRUE(g_delete_hooker != nullptr)) {
const void* ptr = reinterpret_cast<const void*>(aArg2);
const void *ptr = reinterpret_cast<const void *>(aArg2);
g_delete_hooker(ptr);
}
if (CC_PREDICT_TRUE(g_new_hooker != nullptr)) {
const void* new_ptr = reinterpret_cast<const void*>(aResult);
const void *new_ptr = reinterpret_cast<const void *>(aResult);
g_new_hooker(new_ptr, new_size);
}
} else {
// malloc/calloc/valloc
if (CC_PREDICT_TRUE(g_new_hooker != nullptr)) {
const void* ptr = reinterpret_cast<const void*>(aResult);
const void *ptr = reinterpret_cast<const void *>(aResult);
size_t size = reinterpret_cast<size_t>(aArg2);
g_new_hooker(ptr, size);
}
@@ -106,7 +106,7 @@ cc_malloc_logger(uint32_t aType,
} else {
// free
if (CC_PREDICT_TRUE(g_delete_hooker != nullptr)) {
const void* ptr = reinterpret_cast<const void*>(aArg2);
const void *ptr = reinterpret_cast<const void *>(aArg2);
g_delete_hooker(ptr);
}
}
@@ -116,8 +116,8 @@ cc_malloc_logger(uint32_t aType,
#include <Windows.h>
extern "C" {
typedef void (*MallocHook_NewHook)(const void* ptr, size_t size);
typedef void (*MallocHook_DeleteHook)(const void* ptr);
typedef void (*MallocHook_NewHook)(const void *ptr, size_t size);
typedef void (*MallocHook_DeleteHook)(const void *ptr);
int MallocHook_AddNewHook(MallocHook_NewHook hook);
int MallocHook_RemoveNewHook(MallocHook_NewHook hook);
@@ -129,12 +129,12 @@ int MallocHook_RemoveDeleteHook(MallocHook_DeleteHook hook);
namespace cc {
static void newHook(const void* ptr, size_t size) {
static void newHook(const void *ptr, size_t size) {
uint64_t address = reinterpret_cast<uint64_t>(ptr);
GMemoryHook.addRecord(address, size);
}
static void deleteHook(const void* ptr) {
static void deleteHook(const void *ptr) {
uint64_t address = reinterpret_cast<uint64_t>(ptr);
GMemoryHook.removeRecord(address);
}
@@ -209,7 +209,7 @@ void MemoryHook::dumpMemoryLeak() {
int i = 0;
size_t total = 0;
for (const auto& iter : _records) {
for (const auto &iter : _records) {
std::stringstream stream;
int k = 0;
total += iter.second.size;
@@ -219,7 +219,7 @@ void MemoryHook::dumpMemoryLeak() {
<< "leak " << iter.second.size << " bytes at 0x" << std::hex << iter.second.address << std::dec << std::endl;
stream << "\tcallstack:" << std::endl;
auto frames = CallStack::backtraceSymbols(iter.second.callstack);
for (auto& frame : frames) {
for (auto &frame : frames) {
stream << "\t[" << ++k << "]:" << frame.toString() << std::endl;
}
@@ -239,7 +239,7 @@ void MemoryHook::dumpMemoryLeak() {
#endif
}
void MemoryHook::log(const std::string& msg) {
void MemoryHook::log(const std::string &msg) {
#if (CC_PLATFORM == CC_PLATFORM_ANDROID)
__android_log_write(ANDROID_LOG_WARN, "Cocos", msg.c_str());
#elif CC_PLATFORM == CC_PLATFORM_MAC_IOS || CC_PLATFORM == CC_PLATFORM_MAC_OSX
+8 -8
View File
@@ -35,18 +35,18 @@
#include <unordered_map>
#include <vector>
typedef void* (*MallocType)(size_t size);
typedef void (*FreeType)(void* ptr);
typedef void *(*MallocType)(size_t size);
typedef void (*FreeType)(void *ptr);
typedef void (*NewHookType)(const void* ptr, size_t size);
typedef void (*DeleteHookType)(const void* ptr);
typedef void (*NewHookType)(const void *ptr, size_t size);
typedef void (*DeleteHookType)(const void *ptr);
namespace cc {
struct CC_DLL MemoryRecord {
uint64_t address{0};
size_t size{0};
std::vector<void*> callstack;
uint64_t address{0};
size_t size{0};
std::vector<void *> callstack;
};
class CC_DLL MemoryHook {
@@ -68,7 +68,7 @@ private:
*/
void dumpMemoryLeak();
static void log(const std::string& msg);
static void log(const std::string &msg);
/**
* Register all malloc hooks
+1
View File
@@ -0,0 +1 @@
*.json
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,687 @@
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
#include "cocos/bindings/jswrapper/SeApi.h"
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/auto/jsb_gfx_auto.h"
#include "cocos/bindings/auto/jsb_pipeline_auto.h"
#include "cocos/core/assets/AssetsModuleHeader.h"
#include "cocos/core/builtin/BuiltinResMgr.h"
#include "cocos/3d/assets/Mesh.h"
#include "cocos/3d/assets/Morph.h"
#include "cocos/3d/assets/MorphRendering.h"
#include "cocos/3d/assets/Skeleton.h"
bool register_all_assets(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::Error);
JSB_REGISTER_OBJECT_TYPE(cc::BoundingBox);
JSB_REGISTER_OBJECT_TYPE(cc::VertexIdChannel);
JSB_REGISTER_OBJECT_TYPE(cc::Asset);
JSB_REGISTER_OBJECT_TYPE(cc::BufferAsset);
JSB_REGISTER_OBJECT_TYPE(cc::TextureBase);
JSB_REGISTER_OBJECT_TYPE(cc::IPropertyInfo);
JSB_REGISTER_OBJECT_TYPE(cc::RasterizerStateInfo);
JSB_REGISTER_OBJECT_TYPE(cc::DepthStencilStateInfo);
JSB_REGISTER_OBJECT_TYPE(cc::BlendTargetInfo);
JSB_REGISTER_OBJECT_TYPE(cc::BlendStateInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IPassStates);
JSB_REGISTER_OBJECT_TYPE(cc::IPassInfoFull);
JSB_REGISTER_OBJECT_TYPE(cc::ITechniqueInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IBlockInfo);
JSB_REGISTER_OBJECT_TYPE(cc::ISamplerTextureInfo);
JSB_REGISTER_OBJECT_TYPE(cc::ITextureInfo);
JSB_REGISTER_OBJECT_TYPE(cc::ISamplerInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IBufferInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IImageInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IInputAttachmentInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IAttributeInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IDefineInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IBuiltin);
JSB_REGISTER_OBJECT_TYPE(cc::IBuiltinInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IBuiltins);
JSB_REGISTER_OBJECT_TYPE(cc::IShaderSource);
JSB_REGISTER_OBJECT_TYPE(cc::IShaderInfo);
JSB_REGISTER_OBJECT_TYPE(cc::EffectAsset);
JSB_REGISTER_OBJECT_TYPE(cc::IMemoryImageSource);
JSB_REGISTER_OBJECT_TYPE(cc::ImageAsset);
JSB_REGISTER_OBJECT_TYPE(cc::IMaterialInfo);
JSB_REGISTER_OBJECT_TYPE(cc::Material);
JSB_REGISTER_OBJECT_TYPE(cc::IRenderTextureCreateInfo);
JSB_REGISTER_OBJECT_TYPE(cc::RenderTexture);
JSB_REGISTER_OBJECT_TYPE(cc::IMeshBufferView);
JSB_REGISTER_OBJECT_TYPE(cc::MorphTarget);
JSB_REGISTER_OBJECT_TYPE(cc::SubMeshMorph);
JSB_REGISTER_OBJECT_TYPE(cc::Morph);
JSB_REGISTER_OBJECT_TYPE(cc::IGeometricInfo);
JSB_REGISTER_OBJECT_TYPE(cc::IFlatBuffer);
JSB_REGISTER_OBJECT_TYPE(cc::RenderingSubMesh);
JSB_REGISTER_OBJECT_TYPE(cc::SceneAsset);
JSB_REGISTER_OBJECT_TYPE(cc::TextAsset);
JSB_REGISTER_OBJECT_TYPE(cc::SimpleTexture);
JSB_REGISTER_OBJECT_TYPE(cc::ITexture2DSerializeData);
JSB_REGISTER_OBJECT_TYPE(cc::ITexture2DCreateInfo);
JSB_REGISTER_OBJECT_TYPE(cc::Texture2D);
JSB_REGISTER_OBJECT_TYPE(cc::ITextureCubeMipmap);
JSB_REGISTER_OBJECT_TYPE(cc::ITextureCubeSerializeMipmapData);
JSB_REGISTER_OBJECT_TYPE(cc::ITextureCubeSerializeData);
JSB_REGISTER_OBJECT_TYPE(cc::TextureCube);
JSB_REGISTER_OBJECT_TYPE(cc::BuiltinResMgr);
JSB_REGISTER_OBJECT_TYPE(cc::MorphRendering);
JSB_REGISTER_OBJECT_TYPE(cc::MorphRenderingInstance);
JSB_REGISTER_OBJECT_TYPE(cc::StdMorphRendering);
JSB_REGISTER_OBJECT_TYPE(cc::Mesh::IVertexBundle);
JSB_REGISTER_OBJECT_TYPE(cc::Mesh::ISubMesh);
JSB_REGISTER_OBJECT_TYPE(cc::Mesh::IStruct);
JSB_REGISTER_OBJECT_TYPE(cc::Mesh::ICreateInfo);
JSB_REGISTER_OBJECT_TYPE(cc::Mesh);
JSB_REGISTER_OBJECT_TYPE(cc::Skeleton);
extern se::Object *__jsb_cc_Error_proto; // NOLINT
extern se::Class * __jsb_cc_Error_class; // NOLINT
bool js_register_cc_Error(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::Error *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_BoundingBox_proto; // NOLINT
extern se::Class * __jsb_cc_BoundingBox_class; // NOLINT
bool js_register_cc_BoundingBox(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::BoundingBox *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_VertexIdChannel_proto; // NOLINT
extern se::Class * __jsb_cc_VertexIdChannel_class; // NOLINT
bool js_register_cc_VertexIdChannel(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::VertexIdChannel *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_Asset_proto; // NOLINT
extern se::Class * __jsb_cc_Asset_class; // NOLINT
bool js_register_cc_Asset(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_Asset_addAssetRef);
SE_DECLARE_FUNC(js_assets_Asset_createNode);
SE_DECLARE_FUNC(js_assets_Asset_decAssetRef);
SE_DECLARE_FUNC(js_assets_Asset_deserialize);
SE_DECLARE_FUNC(js_assets_Asset_getAssetRefCount);
SE_DECLARE_FUNC(js_assets_Asset_getNativeAsset);
SE_DECLARE_FUNC(js_assets_Asset_initDefault);
SE_DECLARE_FUNC(js_assets_Asset_onLoaded);
SE_DECLARE_FUNC(js_assets_Asset_serialize);
SE_DECLARE_FUNC(js_assets_Asset_setNativeAsset);
SE_DECLARE_FUNC(js_assets_Asset_validate);
SE_DECLARE_FUNC(js_assets_Asset_Asset);
extern se::Object *__jsb_cc_BufferAsset_proto; // NOLINT
extern se::Class * __jsb_cc_BufferAsset_class; // NOLINT
bool js_register_cc_BufferAsset(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_BufferAsset_BufferAsset);
extern se::Object *__jsb_cc_TextureBase_proto; // NOLINT
extern se::Class * __jsb_cc_TextureBase_class; // NOLINT
bool js_register_cc_TextureBase(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_TextureBase_getAnisotropy);
SE_DECLARE_FUNC(js_assets_TextureBase_getGFXSampler);
SE_DECLARE_FUNC(js_assets_TextureBase_getGFXTexture);
SE_DECLARE_FUNC(js_assets_TextureBase_getHashForJS);
SE_DECLARE_FUNC(js_assets_TextureBase_getId);
SE_DECLARE_FUNC(js_assets_TextureBase_getPixelFormat);
SE_DECLARE_FUNC(js_assets_TextureBase_getSamplerInfo);
SE_DECLARE_FUNC(js_assets_TextureBase_setAnisotropy);
SE_DECLARE_FUNC(js_assets_TextureBase_setFilters);
SE_DECLARE_FUNC(js_assets_TextureBase_setMipFilter);
SE_DECLARE_FUNC(js_assets_TextureBase_setWrapMode);
SE_DECLARE_FUNC(js_assets_TextureBase_TextureBase);
extern se::Object *__jsb_cc_IPropertyInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IPropertyInfo_class; // NOLINT
bool js_register_cc_IPropertyInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IPropertyInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_RasterizerStateInfo_proto; // NOLINT
extern se::Class * __jsb_cc_RasterizerStateInfo_class; // NOLINT
bool js_register_cc_RasterizerStateInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::RasterizerStateInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_DepthStencilStateInfo_proto; // NOLINT
extern se::Class * __jsb_cc_DepthStencilStateInfo_class; // NOLINT
bool js_register_cc_DepthStencilStateInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::DepthStencilStateInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_BlendTargetInfo_proto; // NOLINT
extern se::Class * __jsb_cc_BlendTargetInfo_class; // NOLINT
bool js_register_cc_BlendTargetInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::BlendTargetInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_BlendStateInfo_proto; // NOLINT
extern se::Class * __jsb_cc_BlendStateInfo_class; // NOLINT
bool js_register_cc_BlendStateInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::BlendStateInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IPassStates_proto; // NOLINT
extern se::Class * __jsb_cc_IPassStates_class; // NOLINT
bool js_register_cc_IPassStates(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IPassStates *, se::Object *ctx); //NOLINT
SE_DECLARE_FUNC(js_assets_IPassStates_overrides);
extern se::Object *__jsb_cc_IPassInfoFull_proto; // NOLINT
extern se::Class * __jsb_cc_IPassInfoFull_class; // NOLINT
bool js_register_cc_IPassInfoFull(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IPassInfoFull *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_ITechniqueInfo_proto; // NOLINT
extern se::Class * __jsb_cc_ITechniqueInfo_class; // NOLINT
bool js_register_cc_ITechniqueInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ITechniqueInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IBlockInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IBlockInfo_class; // NOLINT
bool js_register_cc_IBlockInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IBlockInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_ISamplerTextureInfo_proto; // NOLINT
extern se::Class * __jsb_cc_ISamplerTextureInfo_class; // NOLINT
bool js_register_cc_ISamplerTextureInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ISamplerTextureInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_ITextureInfo_proto; // NOLINT
extern se::Class * __jsb_cc_ITextureInfo_class; // NOLINT
bool js_register_cc_ITextureInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ITextureInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_ISamplerInfo_proto; // NOLINT
extern se::Class * __jsb_cc_ISamplerInfo_class; // NOLINT
bool js_register_cc_ISamplerInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ISamplerInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IBufferInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IBufferInfo_class; // NOLINT
bool js_register_cc_IBufferInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IBufferInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IImageInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IImageInfo_class; // NOLINT
bool js_register_cc_IImageInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IImageInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IInputAttachmentInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IInputAttachmentInfo_class; // NOLINT
bool js_register_cc_IInputAttachmentInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IInputAttachmentInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IAttributeInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IAttributeInfo_class; // NOLINT
bool js_register_cc_IAttributeInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IAttributeInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IDefineInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IDefineInfo_class; // NOLINT
bool js_register_cc_IDefineInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IDefineInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IBuiltin_proto; // NOLINT
extern se::Class * __jsb_cc_IBuiltin_class; // NOLINT
bool js_register_cc_IBuiltin(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IBuiltin *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IBuiltinInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IBuiltinInfo_class; // NOLINT
bool js_register_cc_IBuiltinInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IBuiltinInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IBuiltins_proto; // NOLINT
extern se::Class * __jsb_cc_IBuiltins_class; // NOLINT
bool js_register_cc_IBuiltins(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IBuiltins *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IShaderSource_proto; // NOLINT
extern se::Class * __jsb_cc_IShaderSource_class; // NOLINT
bool js_register_cc_IShaderSource(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IShaderSource *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IShaderInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IShaderInfo_class; // NOLINT
bool js_register_cc_IShaderInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IShaderInfo *, se::Object *ctx); //NOLINT
SE_DECLARE_FUNC(js_assets_IShaderInfo_getSource);
extern se::Object *__jsb_cc_EffectAsset_proto; // NOLINT
extern se::Class * __jsb_cc_EffectAsset_class; // NOLINT
bool js_register_cc_EffectAsset(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_EffectAsset_get);
SE_DECLARE_FUNC(js_assets_EffectAsset_getAll);
SE_DECLARE_FUNC(js_assets_EffectAsset_registerAsset);
SE_DECLARE_FUNC(js_assets_EffectAsset_remove);
SE_DECLARE_FUNC(js_assets_EffectAsset_EffectAsset);
extern se::Object *__jsb_cc_IMemoryImageSource_proto; // NOLINT
extern se::Class * __jsb_cc_IMemoryImageSource_class; // NOLINT
bool js_register_cc_IMemoryImageSource(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IMemoryImageSource *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_ImageAsset_proto; // NOLINT
extern se::Class * __jsb_cc_ImageAsset_class; // NOLINT
bool js_register_cc_ImageAsset(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_ImageAsset_getData);
SE_DECLARE_FUNC(js_assets_ImageAsset_getHeight);
SE_DECLARE_FUNC(js_assets_ImageAsset_getWidth);
SE_DECLARE_FUNC(js_assets_ImageAsset_isCompressed);
SE_DECLARE_FUNC(js_assets_ImageAsset_setHeight);
SE_DECLARE_FUNC(js_assets_ImageAsset_setWidth);
SE_DECLARE_FUNC(js_assets_ImageAsset_ImageAsset);
extern se::Object *__jsb_cc_IMaterialInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IMaterialInfo_class; // NOLINT
bool js_register_cc_IMaterialInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IMaterialInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_Material_proto; // NOLINT
extern se::Class * __jsb_cc_Material_class; // NOLINT
bool js_register_cc_Material(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_Material_copy);
SE_DECLARE_FUNC(js_assets_Material_getPasses);
SE_DECLARE_FUNC(js_assets_Material_getProperty);
SE_DECLARE_FUNC(js_assets_Material_initialize);
SE_DECLARE_FUNC(js_assets_Material_overridePipelineStates);
SE_DECLARE_FUNC(js_assets_Material_recompileShaders);
SE_DECLARE_FUNC(js_assets_Material_reset);
SE_DECLARE_FUNC(js_assets_Material_resetUniforms);
SE_DECLARE_FUNC(js_assets_Material_setPropertyColor);
SE_DECLARE_FUNC(js_assets_Material_setPropertyColorArray);
SE_DECLARE_FUNC(js_assets_Material_setPropertyFloat32);
SE_DECLARE_FUNC(js_assets_Material_setPropertyFloat32Array);
SE_DECLARE_FUNC(js_assets_Material_setPropertyGFXTexture);
SE_DECLARE_FUNC(js_assets_Material_setPropertyGFXTextureArray);
SE_DECLARE_FUNC(js_assets_Material_setPropertyInt32);
SE_DECLARE_FUNC(js_assets_Material_setPropertyInt32Array);
SE_DECLARE_FUNC(js_assets_Material_setPropertyMat3);
SE_DECLARE_FUNC(js_assets_Material_setPropertyMat3Array);
SE_DECLARE_FUNC(js_assets_Material_setPropertyMat4);
SE_DECLARE_FUNC(js_assets_Material_setPropertyMat4Array);
SE_DECLARE_FUNC(js_assets_Material_setPropertyQuaternion);
SE_DECLARE_FUNC(js_assets_Material_setPropertyQuaternionArray);
SE_DECLARE_FUNC(js_assets_Material_setPropertyTextureBase);
SE_DECLARE_FUNC(js_assets_Material_setPropertyTextureBaseArray);
SE_DECLARE_FUNC(js_assets_Material_setPropertyVec2);
SE_DECLARE_FUNC(js_assets_Material_setPropertyVec2Array);
SE_DECLARE_FUNC(js_assets_Material_setPropertyVec3);
SE_DECLARE_FUNC(js_assets_Material_setPropertyVec3Array);
SE_DECLARE_FUNC(js_assets_Material_setPropertyVec4);
SE_DECLARE_FUNC(js_assets_Material_setPropertyVec4Array);
SE_DECLARE_FUNC(js_assets_Material_getHashForMaterialForJS);
SE_DECLARE_FUNC(js_assets_Material_Material);
extern se::Object *__jsb_cc_IRenderTextureCreateInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IRenderTextureCreateInfo_class; // NOLINT
bool js_register_cc_IRenderTextureCreateInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IRenderTextureCreateInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_RenderTexture_proto; // NOLINT
extern se::Class * __jsb_cc_RenderTexture_class; // NOLINT
bool js_register_cc_RenderTexture(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_RenderTexture_initWindow);
SE_DECLARE_FUNC(js_assets_RenderTexture_initialize);
SE_DECLARE_FUNC(js_assets_RenderTexture_readPixels);
SE_DECLARE_FUNC(js_assets_RenderTexture_reset);
SE_DECLARE_FUNC(js_assets_RenderTexture_resize);
SE_DECLARE_FUNC(js_assets_RenderTexture_RenderTexture);
extern se::Object *__jsb_cc_IMeshBufferView_proto; // NOLINT
extern se::Class * __jsb_cc_IMeshBufferView_class; // NOLINT
bool js_register_cc_IMeshBufferView(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IMeshBufferView *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_MorphTarget_proto; // NOLINT
extern se::Class * __jsb_cc_MorphTarget_class; // NOLINT
bool js_register_cc_MorphTarget(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::MorphTarget *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_SubMeshMorph_proto; // NOLINT
extern se::Class * __jsb_cc_SubMeshMorph_class; // NOLINT
bool js_register_cc_SubMeshMorph(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::SubMeshMorph *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_Morph_proto; // NOLINT
extern se::Class * __jsb_cc_Morph_class; // NOLINT
bool js_register_cc_Morph(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::Morph *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IGeometricInfo_proto; // NOLINT
extern se::Class * __jsb_cc_IGeometricInfo_class; // NOLINT
bool js_register_cc_IGeometricInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IGeometricInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_IFlatBuffer_proto; // NOLINT
extern se::Class * __jsb_cc_IFlatBuffer_class; // NOLINT
bool js_register_cc_IFlatBuffer(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::IFlatBuffer *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_RenderingSubMesh_proto; // NOLINT
extern se::Class * __jsb_cc_RenderingSubMesh_class; // NOLINT
bool js_register_cc_RenderingSubMesh(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_RenderingSubMesh_enableVertexIdChannel);
SE_DECLARE_FUNC(js_assets_RenderingSubMesh_genFlatBuffers);
SE_DECLARE_FUNC(js_assets_RenderingSubMesh_getAttributes);
SE_DECLARE_FUNC(js_assets_RenderingSubMesh_getGeometricInfo);
SE_DECLARE_FUNC(js_assets_RenderingSubMesh_getIndexBuffer);
SE_DECLARE_FUNC(js_assets_RenderingSubMesh_getVertexBuffers);
SE_DECLARE_FUNC(js_assets_RenderingSubMesh_indirectBuffer);
SE_DECLARE_FUNC(js_assets_RenderingSubMesh_RenderingSubMesh);
extern se::Object *__jsb_cc_SceneAsset_proto; // NOLINT
extern se::Class * __jsb_cc_SceneAsset_class; // NOLINT
bool js_register_cc_SceneAsset(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_SceneAsset_getScene);
SE_DECLARE_FUNC(js_assets_SceneAsset_setScene);
SE_DECLARE_FUNC(js_assets_SceneAsset_SceneAsset);
extern se::Object *__jsb_cc_TextAsset_proto; // NOLINT
extern se::Class * __jsb_cc_TextAsset_class; // NOLINT
bool js_register_cc_TextAsset(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_TextAsset_TextAsset);
extern se::Object *__jsb_cc_SimpleTexture_proto; // NOLINT
extern se::Class * __jsb_cc_SimpleTexture_class; // NOLINT
bool js_register_cc_SimpleTexture(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_SimpleTexture_assignImage);
SE_DECLARE_FUNC(js_assets_SimpleTexture_checkTextureLoaded);
SE_DECLARE_FUNC(js_assets_SimpleTexture_updateImage);
SE_DECLARE_FUNC(js_assets_SimpleTexture_updateMipmaps);
SE_DECLARE_FUNC(js_assets_SimpleTexture_uploadData);
extern se::Object *__jsb_cc_ITexture2DSerializeData_proto; // NOLINT
extern se::Class * __jsb_cc_ITexture2DSerializeData_class; // NOLINT
bool js_register_cc_ITexture2DSerializeData(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ITexture2DSerializeData *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_ITexture2DCreateInfo_proto; // NOLINT
extern se::Class * __jsb_cc_ITexture2DCreateInfo_class; // NOLINT
bool js_register_cc_ITexture2DCreateInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ITexture2DCreateInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_Texture2D_proto; // NOLINT
extern se::Class * __jsb_cc_Texture2D_class; // NOLINT
bool js_register_cc_Texture2D(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_Texture2D_create);
SE_DECLARE_FUNC(js_assets_Texture2D_description);
SE_DECLARE_FUNC(js_assets_Texture2D_getGfxTextureCreateInfo);
SE_DECLARE_FUNC(js_assets_Texture2D_getHtmlElementObj);
SE_DECLARE_FUNC(js_assets_Texture2D_getImage);
SE_DECLARE_FUNC(js_assets_Texture2D_getMipmaps);
SE_DECLARE_FUNC(js_assets_Texture2D_getMipmapsUuids);
SE_DECLARE_FUNC(js_assets_Texture2D_initialize);
SE_DECLARE_FUNC(js_assets_Texture2D_releaseTexture);
SE_DECLARE_FUNC(js_assets_Texture2D_reset);
SE_DECLARE_FUNC(js_assets_Texture2D_setImage);
SE_DECLARE_FUNC(js_assets_Texture2D_setMipmaps);
SE_DECLARE_FUNC(js_assets_Texture2D_syncMipmapsForJS);
SE_DECLARE_FUNC(js_assets_Texture2D_Texture2D);
extern se::Object *__jsb_cc_ITextureCubeMipmap_proto; // NOLINT
extern se::Class * __jsb_cc_ITextureCubeMipmap_class; // NOLINT
bool js_register_cc_ITextureCubeMipmap(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ITextureCubeMipmap *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_ITextureCubeSerializeMipmapData_proto; // NOLINT
extern se::Class * __jsb_cc_ITextureCubeSerializeMipmapData_class; // NOLINT
bool js_register_cc_ITextureCubeSerializeMipmapData(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ITextureCubeSerializeMipmapData *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_ITextureCubeSerializeData_proto; // NOLINT
extern se::Class * __jsb_cc_ITextureCubeSerializeData_class; // NOLINT
bool js_register_cc_ITextureCubeSerializeData(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::ITextureCubeSerializeData *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_TextureCube_proto; // NOLINT
extern se::Class * __jsb_cc_TextureCube_class; // NOLINT
bool js_register_cc_TextureCube(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_TextureCube_getGfxTextureCreateInfo);
SE_DECLARE_FUNC(js_assets_TextureCube_getImage);
SE_DECLARE_FUNC(js_assets_TextureCube_getMipmaps);
SE_DECLARE_FUNC(js_assets_TextureCube_initialize);
SE_DECLARE_FUNC(js_assets_TextureCube_releaseTexture);
SE_DECLARE_FUNC(js_assets_TextureCube_reset);
SE_DECLARE_FUNC(js_assets_TextureCube_setImage);
SE_DECLARE_FUNC(js_assets_TextureCube_setMipmaps);
SE_DECLARE_FUNC(js_assets_TextureCube_setMipmapsForJS);
SE_DECLARE_FUNC(js_assets_TextureCube_fromTexture2DArray);
SE_DECLARE_FUNC(js_assets_TextureCube_TextureCube);
extern se::Object *__jsb_cc_BuiltinResMgr_proto; // NOLINT
extern se::Class * __jsb_cc_BuiltinResMgr_class; // NOLINT
bool js_register_cc_BuiltinResMgr(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_BuiltinResMgr_getAsset);
SE_DECLARE_FUNC(js_assets_BuiltinResMgr_initBuiltinRes);
SE_DECLARE_FUNC(js_assets_BuiltinResMgr_isInitialized);
SE_DECLARE_FUNC(js_assets_BuiltinResMgr_destroyInstance);
SE_DECLARE_FUNC(js_assets_BuiltinResMgr_getInstance);
extern se::Object *__jsb_cc_MorphRendering_proto; // NOLINT
extern se::Class * __jsb_cc_MorphRendering_class; // NOLINT
bool js_register_cc_MorphRendering(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_MorphRendering_createInstance);
extern se::Object *__jsb_cc_MorphRenderingInstance_proto; // NOLINT
extern se::Class * __jsb_cc_MorphRenderingInstance_class; // NOLINT
bool js_register_cc_MorphRenderingInstance(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_MorphRenderingInstance_adaptPipelineState);
SE_DECLARE_FUNC(js_assets_MorphRenderingInstance_destroy);
SE_DECLARE_FUNC(js_assets_MorphRenderingInstance_requiredPatches);
SE_DECLARE_FUNC(js_assets_MorphRenderingInstance_setWeights);
extern se::Object *__jsb_cc_StdMorphRendering_proto; // NOLINT
extern se::Class * __jsb_cc_StdMorphRendering_class; // NOLINT
bool js_register_cc_StdMorphRendering(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_StdMorphRendering_StdMorphRendering);
extern se::Object *__jsb_cc_Mesh_IVertexBundle_proto; // NOLINT
extern se::Class * __jsb_cc_Mesh_IVertexBundle_class; // NOLINT
bool js_register_cc_Mesh_IVertexBundle(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::Mesh::IVertexBundle *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_Mesh_ISubMesh_proto; // NOLINT
extern se::Class * __jsb_cc_Mesh_ISubMesh_class; // NOLINT
bool js_register_cc_Mesh_ISubMesh(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::Mesh::ISubMesh *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_Mesh_IStruct_proto; // NOLINT
extern se::Class * __jsb_cc_Mesh_IStruct_class; // NOLINT
bool js_register_cc_Mesh_IStruct(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::Mesh::IStruct *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_Mesh_ICreateInfo_proto; // NOLINT
extern se::Class * __jsb_cc_Mesh_ICreateInfo_class; // NOLINT
bool js_register_cc_Mesh_ICreateInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::Mesh::ICreateInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_Mesh_proto; // NOLINT
extern se::Class * __jsb_cc_Mesh_class; // NOLINT
bool js_register_cc_Mesh(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_Mesh_assign);
SE_DECLARE_FUNC(js_assets_Mesh_copyAttribute);
SE_DECLARE_FUNC(js_assets_Mesh_copyIndices);
SE_DECLARE_FUNC(js_assets_Mesh_destroyRenderingMesh);
SE_DECLARE_FUNC(js_assets_Mesh_getBoneSpaceBounds);
SE_DECLARE_FUNC(js_assets_Mesh_getStruct);
SE_DECLARE_FUNC(js_assets_Mesh_initialize);
SE_DECLARE_FUNC(js_assets_Mesh_merge);
SE_DECLARE_FUNC(js_assets_Mesh_readAttribute);
SE_DECLARE_FUNC(js_assets_Mesh_readIndices);
SE_DECLARE_FUNC(js_assets_Mesh_reset);
SE_DECLARE_FUNC(js_assets_Mesh_setStruct);
SE_DECLARE_FUNC(js_assets_Mesh_validateMergingMesh);
SE_DECLARE_FUNC(js_assets_Mesh_Mesh);
extern se::Object *__jsb_cc_Skeleton_proto; // NOLINT
extern se::Class * __jsb_cc_Skeleton_class; // NOLINT
bool js_register_cc_Skeleton(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_assets_Skeleton_getBindposes);
SE_DECLARE_FUNC(js_assets_Skeleton_getInverseBindposes);
SE_DECLARE_FUNC(js_assets_Skeleton_setBindposes);
SE_DECLARE_FUNC(js_assets_Skeleton_Skeleton);
// clang-format on
File diff suppressed because it is too large Load Diff
+35 -57
View File
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#if (USE_AUDIO > 0)
@@ -31,50 +7,52 @@
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/audio/include/AudioEngine.h"
extern se::Object* __jsb_cc_AudioProfile_proto;
extern se::Class* __jsb_cc_AudioProfile_class;
bool js_register_cc_AudioProfile(se::Object* obj);
bool register_all_audio(se::Object* obj);
bool register_all_audio(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::AudioProfile);
JSB_REGISTER_OBJECT_TYPE(cc::AudioEngine);
extern se::Object *__jsb_cc_AudioProfile_proto; // NOLINT
extern se::Class * __jsb_cc_AudioProfile_class; // NOLINT
bool js_register_cc_AudioProfile(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_audio_AudioProfile_AudioProfile);
extern se::Object* __jsb_cc_AudioEngine_proto;
extern se::Class* __jsb_cc_AudioEngine_class;
extern se::Object *__jsb_cc_AudioEngine_proto; // NOLINT
extern se::Class * __jsb_cc_AudioEngine_class; // NOLINT
bool js_register_cc_AudioEngine(se::Object* obj);
bool register_all_audio(se::Object* obj);
bool js_register_cc_AudioEngine(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::AudioEngine);
SE_DECLARE_FUNC(js_audio_AudioEngine_lazyInit);
SE_DECLARE_FUNC(js_audio_AudioEngine_end);
SE_DECLARE_FUNC(js_audio_AudioEngine_getDefaultProfile);
SE_DECLARE_FUNC(js_audio_AudioEngine_play2d);
SE_DECLARE_FUNC(js_audio_AudioEngine_setLoop);
SE_DECLARE_FUNC(js_audio_AudioEngine_isLoop);
SE_DECLARE_FUNC(js_audio_AudioEngine_setVolume);
SE_DECLARE_FUNC(js_audio_AudioEngine_getVolume);
SE_DECLARE_FUNC(js_audio_AudioEngine_pause);
SE_DECLARE_FUNC(js_audio_AudioEngine_pauseAll);
SE_DECLARE_FUNC(js_audio_AudioEngine_resume);
SE_DECLARE_FUNC(js_audio_AudioEngine_resumeAll);
SE_DECLARE_FUNC(js_audio_AudioEngine_stop);
SE_DECLARE_FUNC(js_audio_AudioEngine_stopAll);
SE_DECLARE_FUNC(js_audio_AudioEngine_setCurrentTime);
SE_DECLARE_FUNC(js_audio_AudioEngine_getCurrentTime);
SE_DECLARE_FUNC(js_audio_AudioEngine_getDefaultProfile);
SE_DECLARE_FUNC(js_audio_AudioEngine_getDuration);
SE_DECLARE_FUNC(js_audio_AudioEngine_getDurationFromFile);
SE_DECLARE_FUNC(js_audio_AudioEngine_getState);
SE_DECLARE_FUNC(js_audio_AudioEngine_setFinishCallback);
SE_DECLARE_FUNC(js_audio_AudioEngine_getMaxAudioInstance);
SE_DECLARE_FUNC(js_audio_AudioEngine_getPlayingAudioCount);
SE_DECLARE_FUNC(js_audio_AudioEngine_getProfile);
SE_DECLARE_FUNC(js_audio_AudioEngine_getState);
SE_DECLARE_FUNC(js_audio_AudioEngine_getVolume);
SE_DECLARE_FUNC(js_audio_AudioEngine_isEnabled);
SE_DECLARE_FUNC(js_audio_AudioEngine_isLoop);
SE_DECLARE_FUNC(js_audio_AudioEngine_lazyInit);
SE_DECLARE_FUNC(js_audio_AudioEngine_pause);
SE_DECLARE_FUNC(js_audio_AudioEngine_pauseAll);
SE_DECLARE_FUNC(js_audio_AudioEngine_play2d);
SE_DECLARE_FUNC(js_audio_AudioEngine_preload);
SE_DECLARE_FUNC(js_audio_AudioEngine_resume);
SE_DECLARE_FUNC(js_audio_AudioEngine_resumeAll);
SE_DECLARE_FUNC(js_audio_AudioEngine_setCurrentTime);
SE_DECLARE_FUNC(js_audio_AudioEngine_setEnabled);
SE_DECLARE_FUNC(js_audio_AudioEngine_setFinishCallback);
SE_DECLARE_FUNC(js_audio_AudioEngine_setLoop);
SE_DECLARE_FUNC(js_audio_AudioEngine_setMaxAudioInstance);
SE_DECLARE_FUNC(js_audio_AudioEngine_setVolume);
SE_DECLARE_FUNC(js_audio_AudioEngine_stop);
SE_DECLARE_FUNC(js_audio_AudioEngine_stopAll);
SE_DECLARE_FUNC(js_audio_AudioEngine_uncache);
SE_DECLARE_FUNC(js_audio_AudioEngine_uncacheAll);
SE_DECLARE_FUNC(js_audio_AudioEngine_getProfile);
SE_DECLARE_FUNC(js_audio_AudioEngine_preload);
SE_DECLARE_FUNC(js_audio_AudioEngine_getPlayingAudioCount);
SE_DECLARE_FUNC(js_audio_AudioEngine_setEnabled);
SE_DECLARE_FUNC(js_audio_AudioEngine_isEnabled);
#endif //#if (USE_AUDIO > 0)
// clang-format on
File diff suppressed because it is too large Load Diff
+79 -76
View File
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
@@ -33,14 +9,32 @@
#include "cocos/platform/interfaces/modules/canvas/CanvasRenderingContext2D.h"
#include "cocos/platform/interfaces/modules/Device.h"
#include "cocos/platform/SAXParser.h"
#include "cocos/math/Vec2.h"
#include "cocos/math/Vec3.h"
#include "cocos/math/Quaternion.h"
#include "cocos/math/Color.h"
#include "cocos/core/data/Object.h"
extern se::Object* __jsb_cc_FileUtils_proto;
extern se::Class* __jsb_cc_FileUtils_class;
bool js_register_cc_FileUtils(se::Object* obj);
bool register_all_engine(se::Object* obj);
bool register_all_engine(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::FileUtils);
JSB_REGISTER_OBJECT_TYPE(cc::OSInterface);
JSB_REGISTER_OBJECT_TYPE(cc::Vec2);
JSB_REGISTER_OBJECT_TYPE(cc::ICanvasGradient);
JSB_REGISTER_OBJECT_TYPE(cc::ICanvasRenderingContext2D);
JSB_REGISTER_OBJECT_TYPE(cc::CanvasGradient);
JSB_REGISTER_OBJECT_TYPE(cc::CanvasRenderingContext2D);
JSB_REGISTER_OBJECT_TYPE(cc::Device);
JSB_REGISTER_OBJECT_TYPE(cc::SAXParser);
JSB_REGISTER_OBJECT_TYPE(cc::Color);
JSB_REGISTER_OBJECT_TYPE(cc::CCObject);
extern se::Object *__jsb_cc_FileUtils_proto; // NOLINT
extern se::Class * __jsb_cc_FileUtils_class; // NOLINT
bool js_register_cc_FileUtils(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_engine_FileUtils_addSearchPath);
SE_DECLARE_FUNC(js_engine_FileUtils_createDirectory);
SE_DECLARE_FUNC(js_engine_FileUtils_fullPathForFilename);
@@ -73,35 +67,35 @@ SE_DECLARE_FUNC(js_engine_FileUtils_writeStringToFile);
SE_DECLARE_FUNC(js_engine_FileUtils_writeToFile);
SE_DECLARE_FUNC(js_engine_FileUtils_writeValueMapToFile);
SE_DECLARE_FUNC(js_engine_FileUtils_writeValueVectorToFile);
SE_DECLARE_FUNC(js_engine_FileUtils_getInstance);
SE_DECLARE_FUNC(js_engine_FileUtils_setDelegate);
SE_DECLARE_FUNC(js_engine_FileUtils_normalizePath);
SE_DECLARE_FUNC(js_engine_FileUtils_getFileDir);
SE_DECLARE_FUNC(js_engine_FileUtils_getInstance);
SE_DECLARE_FUNC(js_engine_FileUtils_normalizePath);
extern se::Object* __jsb_cc_OSInterface_proto;
extern se::Class* __jsb_cc_OSInterface_class;
extern se::Object *__jsb_cc_OSInterface_proto; // NOLINT
extern se::Class * __jsb_cc_OSInterface_class; // NOLINT
bool js_register_cc_OSInterface(se::Object* obj);
bool register_all_engine(se::Object* obj);
bool js_register_cc_OSInterface(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::OSInterface);
extern se::Object* __jsb_cc_ICanvasGradient_proto;
extern se::Class* __jsb_cc_ICanvasGradient_class;
extern se::Object *__jsb_cc_Vec2_proto; // NOLINT
extern se::Class * __jsb_cc_Vec2_class; // NOLINT
bool js_register_cc_ICanvasGradient(se::Object* obj);
bool register_all_engine(se::Object* obj);
bool js_register_cc_Vec2(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_engine_Vec2_Vec2);
extern se::Object *__jsb_cc_ICanvasGradient_proto; // NOLINT
extern se::Class * __jsb_cc_ICanvasGradient_class; // NOLINT
bool js_register_cc_ICanvasGradient(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::ICanvasGradient);
SE_DECLARE_FUNC(js_engine_ICanvasGradient_addColorStop);
extern se::Object* __jsb_cc_ICanvasRenderingContext2D_proto;
extern se::Class* __jsb_cc_ICanvasRenderingContext2D_class;
extern se::Object *__jsb_cc_ICanvasRenderingContext2D_proto; // NOLINT
extern se::Class * __jsb_cc_ICanvasRenderingContext2D_class; // NOLINT
bool js_register_cc_ICanvasRenderingContext2D(se::Object* obj);
bool register_all_engine(se::Object* obj);
bool js_register_cc_ICanvasRenderingContext2D(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::ICanvasRenderingContext2D);
SE_DECLARE_FUNC(js_engine_ICanvasRenderingContext2D_beginPath);
SE_DECLARE_FUNC(js_engine_ICanvasRenderingContext2D_clearRect);
SE_DECLARE_FUNC(js_engine_ICanvasRenderingContext2D_closePath);
@@ -125,49 +119,58 @@ SE_DECLARE_FUNC(js_engine_ICanvasRenderingContext2D_strokeText);
SE_DECLARE_FUNC(js_engine_ICanvasRenderingContext2D_transform);
SE_DECLARE_FUNC(js_engine_ICanvasRenderingContext2D_translate);
extern se::Object* __jsb_cc_CanvasGradient_proto;
extern se::Class* __jsb_cc_CanvasGradient_class;
extern se::Object *__jsb_cc_CanvasGradient_proto; // NOLINT
extern se::Class * __jsb_cc_CanvasGradient_class; // NOLINT
bool js_register_cc_CanvasGradient(se::Object* obj);
bool register_all_engine(se::Object* obj);
bool js_register_cc_CanvasGradient(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::CanvasGradient);
SE_DECLARE_FUNC(js_engine_CanvasGradient_CanvasGradient);
extern se::Object* __jsb_cc_CanvasRenderingContext2D_proto;
extern se::Class* __jsb_cc_CanvasRenderingContext2D_class;
extern se::Object *__jsb_cc_CanvasRenderingContext2D_proto; // NOLINT
extern se::Class * __jsb_cc_CanvasRenderingContext2D_class; // NOLINT
bool js_register_cc_CanvasRenderingContext2D(se::Object* obj);
bool register_all_engine(se::Object* obj);
bool js_register_cc_CanvasRenderingContext2D(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::CanvasRenderingContext2D);
SE_DECLARE_FUNC(js_engine_CanvasRenderingContext2D_CanvasRenderingContext2D);
extern se::Object* __jsb_cc_Device_proto;
extern se::Class* __jsb_cc_Device_class;
extern se::Object *__jsb_cc_Device_proto; // NOLINT
extern se::Class * __jsb_cc_Device_class; // NOLINT
bool js_register_cc_Device(se::Object* obj);
bool register_all_engine(se::Object* obj);
bool js_register_cc_Device(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::Device);
SE_DECLARE_FUNC(js_engine_Device_getDPI);
SE_DECLARE_FUNC(js_engine_Device_getDevicePixelRatio);
SE_DECLARE_FUNC(js_engine_Device_setAccelerometerEnabled);
SE_DECLARE_FUNC(js_engine_Device_setAccelerometerInterval);
SE_DECLARE_FUNC(js_engine_Device_getDeviceOrientation);
SE_DECLARE_FUNC(js_engine_Device_getDeviceModel);
SE_DECLARE_FUNC(js_engine_Device_setKeepScreenOn);
SE_DECLARE_FUNC(js_engine_Device_vibrate);
SE_DECLARE_FUNC(js_engine_Device_getBatteryLevel);
SE_DECLARE_FUNC(js_engine_Device_getDPI);
SE_DECLARE_FUNC(js_engine_Device_getDeviceModel);
SE_DECLARE_FUNC(js_engine_Device_getDeviceOrientation);
SE_DECLARE_FUNC(js_engine_Device_getDevicePixelRatio);
SE_DECLARE_FUNC(js_engine_Device_getNetworkType);
SE_DECLARE_FUNC(js_engine_Device_getSafeAreaEdge);
SE_DECLARE_FUNC(js_engine_Device_setAccelerometerEnabled);
SE_DECLARE_FUNC(js_engine_Device_setAccelerometerInterval);
SE_DECLARE_FUNC(js_engine_Device_setKeepScreenOn);
SE_DECLARE_FUNC(js_engine_Device_vibrate);
extern se::Object* __jsb_cc_SAXParser_proto;
extern se::Class* __jsb_cc_SAXParser_class;
extern se::Object *__jsb_cc_SAXParser_proto; // NOLINT
extern se::Class * __jsb_cc_SAXParser_class; // NOLINT
bool js_register_cc_SAXParser(se::Object* obj);
bool register_all_engine(se::Object* obj);
bool js_register_cc_SAXParser(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::SAXParser);
SE_DECLARE_FUNC(js_engine_SAXParser_init);
extern se::Object *__jsb_cc_Color_proto; // NOLINT
extern se::Class * __jsb_cc_Color_class; // NOLINT
bool js_register_cc_Color(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_engine_Color_Color);
extern se::Object *__jsb_cc_CCObject_proto; // NOLINT
extern se::Class * __jsb_cc_CCObject_class; // NOLINT
bool js_register_cc_CCObject(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_engine_CCObject_destroy);
SE_DECLARE_FUNC(js_engine_CCObject_destroyImmediate);
SE_DECLARE_FUNC(js_engine_CCObject_toString);
SE_DECLARE_FUNC(js_engine_CCObject_deferredDestroy);
// clang-format on
File diff suppressed because it is too large Load Diff
+129 -176
View File
@@ -1,92 +1,89 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#if USE_DRAGONBONES > 0
#include <type_traits>
#include "cocos/bindings/jswrapper/SeApi.h"
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/auto/jsb_cocos_auto.h"
#include "cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h"
extern se::Object* __jsb_dragonBones_BaseObject_proto;
extern se::Class* __jsb_dragonBones_BaseObject_class;
bool js_register_dragonBones_BaseObject(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool register_all_dragonbones(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::BaseObject);
SE_DECLARE_FUNC(js_dragonbones_BaseObject_returnToPool);
SE_DECLARE_FUNC(js_dragonbones_BaseObject_setMaxCount);
SE_DECLARE_FUNC(js_dragonbones_BaseObject_clearPool);
extern se::Object* __jsb_dragonBones_Rectangle_proto;
extern se::Class* __jsb_dragonBones_Rectangle_class;
bool js_register_dragonBones_Rectangle(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
JSB_REGISTER_OBJECT_TYPE(dragonBones::Rectangle);
JSB_REGISTER_OBJECT_TYPE(dragonBones::Matrix);
JSB_REGISTER_OBJECT_TYPE(dragonBones::Transform);
JSB_REGISTER_OBJECT_TYPE(dragonBones::TextureAtlasData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::TextureData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::ArmatureData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::BoneData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::SlotData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::DragonBonesData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::SkinData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::AnimationData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::Armature);
JSB_REGISTER_OBJECT_TYPE(dragonBones::TransformObject);
JSB_REGISTER_OBJECT_TYPE(dragonBones::AnimationState);
JSB_REGISTER_OBJECT_TYPE(dragonBones::Bone);
JSB_REGISTER_OBJECT_TYPE(dragonBones::Slot);
JSB_REGISTER_OBJECT_TYPE(dragonBones::WorldClock);
JSB_REGISTER_OBJECT_TYPE(dragonBones::Animation);
JSB_REGISTER_OBJECT_TYPE(dragonBones::EventObject);
JSB_REGISTER_OBJECT_TYPE(dragonBones::BaseFactory);
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCSlot);
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCArmatureDisplay);
JSB_REGISTER_OBJECT_TYPE(dragonBones::ArmatureCacheMgr);
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCArmatureCacheDisplay);
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCFactory);
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCTextureAtlasData);
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCTextureData);
extern se::Object *__jsb_dragonBones_BaseObject_proto; // NOLINT
extern se::Class * __jsb_dragonBones_BaseObject_class; // NOLINT
bool js_register_dragonBones_BaseObject(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_dragonbones_BaseObject_returnToPool);
SE_DECLARE_FUNC(js_dragonbones_BaseObject_clearPool);
SE_DECLARE_FUNC(js_dragonbones_BaseObject_setMaxCount);
extern se::Object *__jsb_dragonBones_Rectangle_proto; // NOLINT
extern se::Class * __jsb_dragonBones_Rectangle_class; // NOLINT
bool js_register_dragonBones_Rectangle(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_dragonbones_Rectangle_clear);
SE_DECLARE_FUNC(js_dragonbones_Rectangle_Rectangle);
extern se::Object* __jsb_dragonBones_Matrix_proto;
extern se::Class* __jsb_dragonBones_Matrix_class;
extern se::Object *__jsb_dragonBones_Matrix_proto; // NOLINT
extern se::Class * __jsb_dragonBones_Matrix_class; // NOLINT
bool js_register_dragonBones_Matrix(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_Matrix(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::Matrix);
extern se::Object* __jsb_dragonBones_Transform_proto;
extern se::Class* __jsb_dragonBones_Transform_class;
extern se::Object *__jsb_dragonBones_Transform_proto; // NOLINT
extern se::Class * __jsb_dragonBones_Transform_class; // NOLINT
bool js_register_dragonBones_Transform(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_Transform(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::Transform);
SE_DECLARE_FUNC(js_dragonbones_Transform_normalizeRadian);
extern se::Object* __jsb_dragonBones_TextureAtlasData_proto;
extern se::Class* __jsb_dragonBones_TextureAtlasData_class;
extern se::Object *__jsb_dragonBones_TextureAtlasData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_TextureAtlasData_class; // NOLINT
bool js_register_dragonBones_TextureAtlasData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_TextureAtlasData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::TextureAtlasData);
SE_DECLARE_FUNC(js_dragonbones_TextureAtlasData_addTexture);
SE_DECLARE_FUNC(js_dragonbones_TextureAtlasData_createTexture);
SE_DECLARE_FUNC(js_dragonbones_TextureAtlasData_getTexture);
extern se::Object* __jsb_dragonBones_TextureData_proto;
extern se::Class* __jsb_dragonBones_TextureData_class;
extern se::Object *__jsb_dragonBones_TextureData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_TextureData_class; // NOLINT
bool js_register_dragonBones_TextureData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_TextureData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::TextureData);
SE_DECLARE_FUNC(js_dragonbones_TextureData_getFrame);
SE_DECLARE_FUNC(js_dragonbones_TextureData_getParent);
SE_DECLARE_FUNC(js_dragonbones_TextureData_getRegion);
@@ -94,13 +91,11 @@ SE_DECLARE_FUNC(js_dragonbones_TextureData_setFrame);
SE_DECLARE_FUNC(js_dragonbones_TextureData_setParent);
SE_DECLARE_FUNC(js_dragonbones_TextureData_createRectangle);
extern se::Object* __jsb_dragonBones_ArmatureData_proto;
extern se::Class* __jsb_dragonBones_ArmatureData_class;
extern se::Object *__jsb_dragonBones_ArmatureData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_ArmatureData_class; // NOLINT
bool js_register_dragonBones_ArmatureData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_ArmatureData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::ArmatureData);
SE_DECLARE_FUNC(js_dragonbones_ArmatureData_getAABB);
SE_DECLARE_FUNC(js_dragonbones_ArmatureData_getAnimation);
SE_DECLARE_FUNC(js_dragonbones_ArmatureData_getAnimationNames);
@@ -118,69 +113,57 @@ SE_DECLARE_FUNC(js_dragonbones_ArmatureData_setParent);
SE_DECLARE_FUNC(js_dragonbones_ArmatureData_setType);
SE_DECLARE_FUNC(js_dragonbones_ArmatureData_sortBones);
extern se::Object* __jsb_dragonBones_BoneData_proto;
extern se::Class* __jsb_dragonBones_BoneData_class;
extern se::Object *__jsb_dragonBones_BoneData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_BoneData_class; // NOLINT
bool js_register_dragonBones_BoneData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_BoneData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::BoneData);
SE_DECLARE_FUNC(js_dragonbones_BoneData_getParent);
SE_DECLARE_FUNC(js_dragonbones_BoneData_getTransfrom);
SE_DECLARE_FUNC(js_dragonbones_BoneData_setParent);
extern se::Object* __jsb_dragonBones_SlotData_proto;
extern se::Class* __jsb_dragonBones_SlotData_class;
extern se::Object *__jsb_dragonBones_SlotData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_SlotData_class; // NOLINT
bool js_register_dragonBones_SlotData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_SlotData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::SlotData);
SE_DECLARE_FUNC(js_dragonbones_SlotData_getBlendMode);
SE_DECLARE_FUNC(js_dragonbones_SlotData_getParent);
SE_DECLARE_FUNC(js_dragonbones_SlotData_setBlendMode);
SE_DECLARE_FUNC(js_dragonbones_SlotData_setParent);
extern se::Object* __jsb_dragonBones_DragonBonesData_proto;
extern se::Class* __jsb_dragonBones_DragonBonesData_class;
extern se::Object *__jsb_dragonBones_DragonBonesData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_DragonBonesData_class; // NOLINT
bool js_register_dragonBones_DragonBonesData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_DragonBonesData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::DragonBonesData);
SE_DECLARE_FUNC(js_dragonbones_DragonBonesData_addArmature);
SE_DECLARE_FUNC(js_dragonbones_DragonBonesData_getArmature);
SE_DECLARE_FUNC(js_dragonbones_DragonBonesData_getArmatureNames);
SE_DECLARE_FUNC(js_dragonbones_DragonBonesData_getFrameIndices);
extern se::Object* __jsb_dragonBones_SkinData_proto;
extern se::Class* __jsb_dragonBones_SkinData_class;
extern se::Object *__jsb_dragonBones_SkinData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_SkinData_class; // NOLINT
bool js_register_dragonBones_SkinData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_SkinData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::SkinData);
extern se::Object* __jsb_dragonBones_AnimationData_proto;
extern se::Class* __jsb_dragonBones_AnimationData_class;
extern se::Object *__jsb_dragonBones_AnimationData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_AnimationData_class; // NOLINT
bool js_register_dragonBones_AnimationData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_AnimationData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::AnimationData);
SE_DECLARE_FUNC(js_dragonbones_AnimationData_getBoneCachedFrameIndices);
SE_DECLARE_FUNC(js_dragonbones_AnimationData_getParent);
SE_DECLARE_FUNC(js_dragonbones_AnimationData_getSlotCachedFrameIndices);
SE_DECLARE_FUNC(js_dragonbones_AnimationData_getZOrderTimeline);
SE_DECLARE_FUNC(js_dragonbones_AnimationData_setParent);
extern se::Object* __jsb_dragonBones_Armature_proto;
extern se::Class* __jsb_dragonBones_Armature_class;
extern se::Object *__jsb_dragonBones_Armature_proto; // NOLINT
extern se::Class * __jsb_dragonBones_Armature_class; // NOLINT
bool js_register_dragonBones_Armature(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_Armature(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::Armature);
SE_DECLARE_FUNC(js_dragonbones_Armature__addBone);
SE_DECLARE_FUNC(js_dragonbones_Armature__addSlot);
SE_DECLARE_FUNC(js_dragonbones_Armature__bufferAction);
@@ -206,13 +189,11 @@ SE_DECLARE_FUNC(js_dragonbones_Armature_setClock);
SE_DECLARE_FUNC(js_dragonbones_Armature_setFlipX);
SE_DECLARE_FUNC(js_dragonbones_Armature_setFlipY);
extern se::Object* __jsb_dragonBones_TransformObject_proto;
extern se::Class* __jsb_dragonBones_TransformObject_class;
extern se::Object *__jsb_dragonBones_TransformObject_proto; // NOLINT
extern se::Class * __jsb_dragonBones_TransformObject_class; // NOLINT
bool js_register_dragonBones_TransformObject(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_TransformObject(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::TransformObject);
SE_DECLARE_FUNC(js_dragonbones_TransformObject_getArmature);
SE_DECLARE_FUNC(js_dragonbones_TransformObject_getGlobal);
SE_DECLARE_FUNC(js_dragonbones_TransformObject_getGlobalTransformMatrix);
@@ -220,13 +201,11 @@ SE_DECLARE_FUNC(js_dragonbones_TransformObject_getOffset);
SE_DECLARE_FUNC(js_dragonbones_TransformObject_getOrigin);
SE_DECLARE_FUNC(js_dragonbones_TransformObject_updateGlobalTransform);
extern se::Object* __jsb_dragonBones_AnimationState_proto;
extern se::Class* __jsb_dragonBones_AnimationState_class;
extern se::Object *__jsb_dragonBones_AnimationState_proto; // NOLINT
extern se::Class * __jsb_dragonBones_AnimationState_class; // NOLINT
bool js_register_dragonBones_AnimationState(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_AnimationState(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::AnimationState);
SE_DECLARE_FUNC(js_dragonbones_AnimationState_addBoneMask);
SE_DECLARE_FUNC(js_dragonbones_AnimationState_advanceTime);
SE_DECLARE_FUNC(js_dragonbones_AnimationState_containsBoneMask);
@@ -247,13 +226,11 @@ SE_DECLARE_FUNC(js_dragonbones_AnimationState_removeBoneMask);
SE_DECLARE_FUNC(js_dragonbones_AnimationState_setCurrentTime);
SE_DECLARE_FUNC(js_dragonbones_AnimationState_stop);
extern se::Object* __jsb_dragonBones_Bone_proto;
extern se::Class* __jsb_dragonBones_Bone_class;
extern se::Object *__jsb_dragonBones_Bone_proto; // NOLINT
extern se::Class * __jsb_dragonBones_Bone_class; // NOLINT
bool js_register_dragonBones_Bone(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_Bone(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::Bone);
SE_DECLARE_FUNC(js_dragonbones_Bone_contains);
SE_DECLARE_FUNC(js_dragonbones_Bone_getBoneData);
SE_DECLARE_FUNC(js_dragonbones_Bone_getName);
@@ -267,13 +244,11 @@ SE_DECLARE_FUNC(js_dragonbones_Bone_setVisible);
SE_DECLARE_FUNC(js_dragonbones_Bone_update);
SE_DECLARE_FUNC(js_dragonbones_Bone_updateByConstraint);
extern se::Object* __jsb_dragonBones_Slot_proto;
extern se::Class* __jsb_dragonBones_Slot_class;
extern se::Object *__jsb_dragonBones_Slot_proto; // NOLINT
extern se::Class * __jsb_dragonBones_Slot_class; // NOLINT
bool js_register_dragonBones_Slot(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_Slot(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::Slot);
SE_DECLARE_FUNC(js_dragonbones_Slot__setZorder);
SE_DECLARE_FUNC(js_dragonbones_Slot__updateColor);
SE_DECLARE_FUNC(js_dragonbones_Slot_containsPoint);
@@ -289,13 +264,11 @@ SE_DECLARE_FUNC(js_dragonbones_Slot_setVisible);
SE_DECLARE_FUNC(js_dragonbones_Slot_update);
SE_DECLARE_FUNC(js_dragonbones_Slot_updateTransformAndMatrix);
extern se::Object* __jsb_dragonBones_WorldClock_proto;
extern se::Class* __jsb_dragonBones_WorldClock_class;
extern se::Object *__jsb_dragonBones_WorldClock_proto; // NOLINT
extern se::Class * __jsb_dragonBones_WorldClock_class; // NOLINT
bool js_register_dragonBones_WorldClock(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_WorldClock(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::WorldClock);
SE_DECLARE_FUNC(js_dragonbones_WorldClock_advanceTime);
SE_DECLARE_FUNC(js_dragonbones_WorldClock_clear);
SE_DECLARE_FUNC(js_dragonbones_WorldClock_getClock);
@@ -303,13 +276,11 @@ SE_DECLARE_FUNC(js_dragonbones_WorldClock_render);
SE_DECLARE_FUNC(js_dragonbones_WorldClock_setClock);
SE_DECLARE_FUNC(js_dragonbones_WorldClock_getStaticClock);
extern se::Object* __jsb_dragonBones_Animation_proto;
extern se::Class* __jsb_dragonBones_Animation_class;
extern se::Object *__jsb_dragonBones_Animation_proto; // NOLINT
extern se::Class * __jsb_dragonBones_Animation_class; // NOLINT
bool js_register_dragonBones_Animation(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_Animation(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::Animation);
SE_DECLARE_FUNC(js_dragonbones_Animation_advanceTime);
SE_DECLARE_FUNC(js_dragonbones_Animation_fadeIn);
SE_DECLARE_FUNC(js_dragonbones_Animation_getAnimationNames);
@@ -330,25 +301,21 @@ SE_DECLARE_FUNC(js_dragonbones_Animation_play);
SE_DECLARE_FUNC(js_dragonbones_Animation_reset);
SE_DECLARE_FUNC(js_dragonbones_Animation_stop);
extern se::Object* __jsb_dragonBones_EventObject_proto;
extern se::Class* __jsb_dragonBones_EventObject_class;
extern se::Object *__jsb_dragonBones_EventObject_proto; // NOLINT
extern se::Class * __jsb_dragonBones_EventObject_class; // NOLINT
bool js_register_dragonBones_EventObject(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_EventObject(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::EventObject);
SE_DECLARE_FUNC(js_dragonbones_EventObject_getAnimationState);
SE_DECLARE_FUNC(js_dragonbones_EventObject_getArmature);
SE_DECLARE_FUNC(js_dragonbones_EventObject_getBone);
SE_DECLARE_FUNC(js_dragonbones_EventObject_getSlot);
extern se::Object* __jsb_dragonBones_BaseFactory_proto;
extern se::Class* __jsb_dragonBones_BaseFactory_class;
extern se::Object *__jsb_dragonBones_BaseFactory_proto; // NOLINT
extern se::Class * __jsb_dragonBones_BaseFactory_class; // NOLINT
bool js_register_dragonBones_BaseFactory(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_BaseFactory(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::BaseFactory);
SE_DECLARE_FUNC(js_dragonbones_BaseFactory_addDragonBonesData);
SE_DECLARE_FUNC(js_dragonbones_BaseFactory_addTextureAtlasData);
SE_DECLARE_FUNC(js_dragonbones_BaseFactory_buildArmature);
@@ -364,24 +331,19 @@ SE_DECLARE_FUNC(js_dragonbones_BaseFactory_replaceAnimation);
SE_DECLARE_FUNC(js_dragonbones_BaseFactory_replaceSkin);
SE_DECLARE_FUNC(js_dragonbones_BaseFactory_replaceSlotDisplay);
extern se::Object* __jsb_dragonBones_CCSlot_proto;
extern se::Class* __jsb_dragonBones_CCSlot_class;
extern se::Object *__jsb_dragonBones_CCSlot_proto; // NOLINT
extern se::Class * __jsb_dragonBones_CCSlot_class; // NOLINT
bool js_register_dragonBones_CCSlot(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_CCSlot(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCSlot);
SE_DECLARE_FUNC(js_dragonbones_CCSlot_updateWorldMatrix);
extern se::Object* __jsb_dragonBones_CCArmatureDisplay_proto;
extern se::Class* __jsb_dragonBones_CCArmatureDisplay_class;
extern se::Object *__jsb_dragonBones_CCArmatureDisplay_proto; // NOLINT
extern se::Class * __jsb_dragonBones_CCArmatureDisplay_class; // NOLINT
bool js_register_dragonBones_CCArmatureDisplay(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_CCArmatureDisplay(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCArmatureDisplay);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_addDBEventListener);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_getArmature);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_convertToRootSpace);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_dbClear);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_dbInit);
@@ -390,6 +352,7 @@ SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_dbUpdate);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_dispatchDBEvent);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_dispose);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_getAnimation);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_getArmature);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_getDebugData);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_getParamsBuffer);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_getRootDisplay);
@@ -405,31 +368,27 @@ SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_setOpacityModifyRGB);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_create);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureDisplay_CCArmatureDisplay);
extern se::Object* __jsb_dragonBones_ArmatureCacheMgr_proto;
extern se::Class* __jsb_dragonBones_ArmatureCacheMgr_class;
extern se::Object *__jsb_dragonBones_ArmatureCacheMgr_proto; // NOLINT
extern se::Class * __jsb_dragonBones_ArmatureCacheMgr_class; // NOLINT
bool js_register_dragonBones_ArmatureCacheMgr(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_ArmatureCacheMgr(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::ArmatureCacheMgr);
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_buildArmatureCache);
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_removeArmatureCache);
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_getInstance);
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_destroyInstance);
SE_DECLARE_FUNC(js_dragonbones_ArmatureCacheMgr_getInstance);
extern se::Object* __jsb_dragonBones_CCArmatureCacheDisplay_proto;
extern se::Class* __jsb_dragonBones_CCArmatureCacheDisplay_class;
extern se::Object *__jsb_dragonBones_CCArmatureCacheDisplay_proto; // NOLINT
extern se::Class * __jsb_dragonBones_CCArmatureCacheDisplay_class; // NOLINT
bool js_register_dragonBones_CCArmatureCacheDisplay(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_CCArmatureCacheDisplay(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCArmatureCacheDisplay);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_addDBEventListener);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_getArmature);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_beginSchedule);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_dispatchDBEvent);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_dispose);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_getAnimation);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_getArmature);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_getParamsBuffer);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_getSharedBufferOffset);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_getTimeScale);
@@ -450,13 +409,11 @@ SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_updateAllAnimationCache);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_updateAnimationCache);
SE_DECLARE_FUNC(js_dragonbones_CCArmatureCacheDisplay_CCArmatureCacheDisplay);
extern se::Object* __jsb_dragonBones_CCFactory_proto;
extern se::Class* __jsb_dragonBones_CCFactory_class;
extern se::Object *__jsb_dragonBones_CCFactory_proto; // NOLINT
extern se::Class * __jsb_dragonBones_CCFactory_class; // NOLINT
bool js_register_dragonBones_CCFactory(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_CCFactory(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCFactory);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_add);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_buildArmatureDisplay);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_getDragonBones);
@@ -471,26 +428,22 @@ SE_DECLARE_FUNC(js_dragonbones_CCFactory_render);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_setTimeScale);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_stopSchedule);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_update);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_isInit);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_getFactory);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_destroyFactory);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_getClock);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_getFactory);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_isInit);
SE_DECLARE_FUNC(js_dragonbones_CCFactory_CCFactory);
extern se::Object* __jsb_dragonBones_CCTextureAtlasData_proto;
extern se::Class* __jsb_dragonBones_CCTextureAtlasData_class;
extern se::Object *__jsb_dragonBones_CCTextureAtlasData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_CCTextureAtlasData_class; // NOLINT
bool js_register_dragonBones_CCTextureAtlasData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
bool js_register_dragonBones_CCTextureAtlasData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCTextureAtlasData);
extern se::Object* __jsb_dragonBones_CCTextureData_proto;
extern se::Class* __jsb_dragonBones_CCTextureData_class;
extern se::Object *__jsb_dragonBones_CCTextureData_proto; // NOLINT
extern se::Class * __jsb_dragonBones_CCTextureData_class; // NOLINT
bool js_register_dragonBones_CCTextureData(se::Object* obj);
bool register_all_dragonbones(se::Object* obj);
JSB_REGISTER_OBJECT_TYPE(dragonBones::CCTextureData);
bool js_register_dragonBones_CCTextureData(se::Object *obj); // NOLINT
#endif //#if USE_DRAGONBONES > 0
// clang-format on
@@ -1,28 +1,5 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#include "cocos/bindings/auto/jsb_editor_support_auto.h"
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/manual/jsb_global.h"
@@ -37,8 +14,8 @@
#ifndef JSB_FREE
#define JSB_FREE(ptr) delete ptr
#endif
se::Object* __jsb_cc_middleware_Texture2D_proto = nullptr;
se::Class* __jsb_cc_middleware_Texture2D_class = nullptr;
se::Object* __jsb_cc_middleware_Texture2D_proto = nullptr; // NOLINT
se::Class* __jsb_cc_middleware_Texture2D_class = nullptr; // NOLINT
static bool js_editor_support_Texture2D_getPixelsHigh(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -169,6 +146,7 @@ static bool js_editor_support_Texture2D_setTexParamCallback(se::State& s) // NOL
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](int larg0, unsigned int larg1, unsigned int larg2, unsigned int larg3, unsigned int larg4) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -182,7 +160,6 @@ static bool js_editor_support_Texture2D_setTexParamCallback(se::State& s) // NOL
ok &= nativevalue_to_se(larg3, args[3], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg4, args[4], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -210,18 +187,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_middleware_Texture2D_finalize)
static bool js_editor_support_Texture2D_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::middleware::Texture2D* cobj = JSB_ALLOC(cc::middleware::Texture2D);
s.thisObject()->setPrivateData(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::middleware::Texture2D);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_editor_support_Texture2D_constructor, __jsb_cc_middleware_Texture2D_class, js_cc_middleware_Texture2D_finalize)
static bool js_cc_middleware_Texture2D_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto* cobj =SE_THIS_OBJECT<cc::middleware::Texture2D>(s);
cobj->release();
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_middleware_Texture2D_finalize)
@@ -244,11 +217,12 @@ bool js_register_editor_support_Texture2D(se::Object* obj) // NOLINT(readability
__jsb_cc_middleware_Texture2D_proto = cls->getProto();
__jsb_cc_middleware_Texture2D_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_middleware_SharedBufferManager_proto = nullptr;
se::Class* __jsb_cc_middleware_SharedBufferManager_class = nullptr;
se::Object* __jsb_cc_middleware_SharedBufferManager_proto = nullptr; // NOLINT
se::Class* __jsb_cc_middleware_SharedBufferManager_class = nullptr; // NOLINT
static bool js_editor_support_SharedBufferManager_getSharedBuffer(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -284,12 +258,12 @@ static bool js_editor_support_SharedBufferManager_setResizeCallback(se::State& s
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=]() -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(se::EmptyValueArray, thisObj, &rval);
if (!succeed) {
@@ -322,24 +296,14 @@ static bool js_editor_support_SharedBufferManager_constructor(se::State& s) // N
se::Object::TypedArrayType arg0;
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_editor_support_SharedBufferManager_constructor : Error processing arguments");
cc::middleware::SharedBufferManager* cobj = JSB_ALLOC(cc::middleware::SharedBufferManager, arg0);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::middleware::SharedBufferManager, arg0);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_editor_support_SharedBufferManager_constructor, __jsb_cc_middleware_SharedBufferManager_class, js_cc_middleware_SharedBufferManager_finalize)
static bool js_cc_middleware_SharedBufferManager_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::middleware::SharedBufferManager>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::middleware::SharedBufferManager>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_middleware_SharedBufferManager_finalize)
@@ -357,11 +321,12 @@ bool js_register_editor_support_SharedBufferManager(se::Object* obj) // NOLINT(r
__jsb_cc_middleware_SharedBufferManager_proto = cls->getProto();
__jsb_cc_middleware_SharedBufferManager_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_middleware_MiddlewareManager_proto = nullptr;
se::Class* __jsb_cc_middleware_MiddlewareManager_class = nullptr;
se::Object* __jsb_cc_middleware_MiddlewareManager_proto = nullptr; // NOLINT
se::Class* __jsb_cc_middleware_MiddlewareManager_class = nullptr; // NOLINT
static bool js_editor_support_MiddlewareManager_getAttachInfoMgr(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -557,24 +522,7 @@ static bool js_editor_support_MiddlewareManager_update(se::State& s) // NOLINT(r
}
SE_BIND_FUNC(js_editor_support_MiddlewareManager_update)
static bool js_editor_support_MiddlewareManager_getInstance(se::State& s) // NOLINT(readability-identifier-naming)
{
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::middleware::MiddlewareManager* result = cc::middleware::MiddlewareManager::getInstance();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_editor_support_MiddlewareManager_getInstance : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_editor_support_MiddlewareManager_getInstance)
static bool js_editor_support_MiddlewareManager_destroyInstance(se::State& s) // NOLINT(readability-identifier-naming)
static bool js_editor_support_MiddlewareManager_destroyInstance_static(se::State& s) // NOLINT(readability-identifier-naming)
{
const auto& args = s.args();
size_t argc = args.size();
@@ -585,9 +533,9 @@ static bool js_editor_support_MiddlewareManager_destroyInstance(se::State& s) //
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_editor_support_MiddlewareManager_destroyInstance)
SE_BIND_FUNC(js_editor_support_MiddlewareManager_destroyInstance_static)
static bool js_editor_support_MiddlewareManager_generateModuleID(se::State& s) // NOLINT(readability-identifier-naming)
static bool js_editor_support_MiddlewareManager_generateModuleID_static(se::State& s) // NOLINT(readability-identifier-naming)
{
const auto& args = s.args();
size_t argc = args.size();
@@ -595,37 +543,44 @@ static bool js_editor_support_MiddlewareManager_generateModuleID(se::State& s) /
if (argc == 0) {
uint8_t result = cc::middleware::MiddlewareManager::generateModuleID();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_editor_support_MiddlewareManager_generateModuleID : Error processing arguments");
SE_PRECONDITION2(ok, false, "js_editor_support_MiddlewareManager_generateModuleID_static : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_editor_support_MiddlewareManager_generateModuleID)
SE_BIND_FUNC(js_editor_support_MiddlewareManager_generateModuleID_static)
static bool js_editor_support_MiddlewareManager_getInstance_static(se::State& s) // NOLINT(readability-identifier-naming)
{
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::middleware::MiddlewareManager* result = cc::middleware::MiddlewareManager::getInstance();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_editor_support_MiddlewareManager_getInstance_static : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_editor_support_MiddlewareManager_getInstance_static)
SE_DECLARE_FINALIZE_FUNC(js_cc_middleware_MiddlewareManager_finalize)
static bool js_editor_support_MiddlewareManager_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::middleware::MiddlewareManager* cobj = JSB_ALLOC(cc::middleware::MiddlewareManager);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::middleware::MiddlewareManager);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_editor_support_MiddlewareManager_constructor, __jsb_cc_middleware_MiddlewareManager_class, js_cc_middleware_MiddlewareManager_finalize)
static bool js_cc_middleware_MiddlewareManager_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::middleware::MiddlewareManager>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::middleware::MiddlewareManager>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_middleware_MiddlewareManager_finalize)
@@ -643,9 +598,9 @@ bool js_register_editor_support_MiddlewareManager(se::Object* obj) // NOLINT(rea
cls->defineFunction("getVBTypedArrayLength", _SE(js_editor_support_MiddlewareManager_getVBTypedArrayLength));
cls->defineFunction("render", _SE(js_editor_support_MiddlewareManager_render));
cls->defineFunction("update", _SE(js_editor_support_MiddlewareManager_update));
cls->defineStaticFunction("getInstance", _SE(js_editor_support_MiddlewareManager_getInstance));
cls->defineStaticFunction("destroyInstance", _SE(js_editor_support_MiddlewareManager_destroyInstance));
cls->defineStaticFunction("generateModuleID", _SE(js_editor_support_MiddlewareManager_generateModuleID));
cls->defineStaticFunction("destroyInstance", _SE(js_editor_support_MiddlewareManager_destroyInstance_static));
cls->defineStaticFunction("generateModuleID", _SE(js_editor_support_MiddlewareManager_generateModuleID_static));
cls->defineStaticFunction("getInstance", _SE(js_editor_support_MiddlewareManager_getInstance_static));
cls->defineFinalizeFunction(_SE(js_cc_middleware_MiddlewareManager_finalize));
cls->install();
JSBClassType::registerClass<cc::middleware::MiddlewareManager>(cls);
@@ -653,14 +608,15 @@ bool js_register_editor_support_MiddlewareManager(se::Object* obj) // NOLINT(rea
__jsb_cc_middleware_MiddlewareManager_proto = cls->getProto();
__jsb_cc_middleware_MiddlewareManager_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_editor_support(se::Object* obj)
bool register_all_editor_support(se::Object* obj) // NOLINT
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("middleware", &nsVal))
if (!obj->getProperty("middleware", &nsVal, true))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
@@ -668,9 +624,10 @@ bool register_all_editor_support(se::Object* obj)
}
se::Object* ns = nsVal.toObject();
js_register_editor_support_Texture2D(ns);
js_register_editor_support_SharedBufferManager(ns);
js_register_editor_support_MiddlewareManager(ns);
js_register_editor_support_SharedBufferManager(ns);
js_register_editor_support_Texture2D(ns);
return true;
}
// clang-format on
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
@@ -32,13 +8,18 @@
#include "cocos/editor-support/MiddlewareManager.h"
#include "cocos/editor-support/SharedBufferManager.h"
extern se::Object* __jsb_cc_middleware_Texture2D_proto;
extern se::Class* __jsb_cc_middleware_Texture2D_class;
bool js_register_cc_middleware_Texture2D(se::Object* obj);
bool register_all_editor_support(se::Object* obj);
bool register_all_editor_support(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::middleware::Texture2D);
JSB_REGISTER_OBJECT_TYPE(cc::middleware::SharedBufferManager);
JSB_REGISTER_OBJECT_TYPE(cc::middleware::MiddlewareManager);
extern se::Object *__jsb_cc_middleware_Texture2D_proto; // NOLINT
extern se::Class * __jsb_cc_middleware_Texture2D_class; // NOLINT
bool js_register_cc_middleware_Texture2D(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_editor_support_Texture2D_getPixelsHigh);
SE_DECLARE_FUNC(js_editor_support_Texture2D_getPixelsWide);
SE_DECLARE_FUNC(js_editor_support_Texture2D_getRealTextureIndex);
@@ -48,24 +29,20 @@ SE_DECLARE_FUNC(js_editor_support_Texture2D_setRealTextureIndex);
SE_DECLARE_FUNC(js_editor_support_Texture2D_setTexParamCallback);
SE_DECLARE_FUNC(js_editor_support_Texture2D_Texture2D);
extern se::Object* __jsb_cc_middleware_SharedBufferManager_proto;
extern se::Class* __jsb_cc_middleware_SharedBufferManager_class;
extern se::Object *__jsb_cc_middleware_SharedBufferManager_proto; // NOLINT
extern se::Class * __jsb_cc_middleware_SharedBufferManager_class; // NOLINT
bool js_register_cc_middleware_SharedBufferManager(se::Object* obj);
bool register_all_editor_support(se::Object* obj);
bool js_register_cc_middleware_SharedBufferManager(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::middleware::SharedBufferManager);
SE_DECLARE_FUNC(js_editor_support_SharedBufferManager_getSharedBuffer);
SE_DECLARE_FUNC(js_editor_support_SharedBufferManager_setResizeCallback);
SE_DECLARE_FUNC(js_editor_support_SharedBufferManager_SharedBufferManager);
extern se::Object* __jsb_cc_middleware_MiddlewareManager_proto;
extern se::Class* __jsb_cc_middleware_MiddlewareManager_class;
extern se::Object *__jsb_cc_middleware_MiddlewareManager_proto; // NOLINT
extern se::Class * __jsb_cc_middleware_MiddlewareManager_class; // NOLINT
bool js_register_cc_middleware_MiddlewareManager(se::Object* obj);
bool register_all_editor_support(se::Object* obj);
bool js_register_cc_middleware_MiddlewareManager(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::middleware::MiddlewareManager);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getAttachInfoMgr);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getBufferCount);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getIBTypedArray);
@@ -75,8 +52,8 @@ SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getVBTypedArray);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getVBTypedArrayLength);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_render);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_update);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getInstance);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_destroyInstance);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_generateModuleID);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_getInstance);
SE_DECLARE_FUNC(js_editor_support_MiddlewareManager_MiddlewareManager);
// clang-format on
@@ -1,28 +1,5 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#include "cocos/bindings/auto/jsb_extension_auto.h"
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/manual/jsb_global.h"
@@ -35,8 +12,8 @@
#ifndef JSB_FREE
#define JSB_FREE(ptr) delete ptr
#endif
se::Object* __jsb_cc_extension_EventAssetsManagerEx_proto = nullptr;
se::Class* __jsb_cc_extension_EventAssetsManagerEx_class = nullptr;
se::Object* __jsb_cc_extension_EventAssetsManagerEx_proto = nullptr; // NOLINT
se::Class* __jsb_cc_extension_EventAssetsManagerEx_class = nullptr; // NOLINT
static bool js_extension_EventAssetsManagerEx_getAssetId(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -298,18 +275,14 @@ static bool js_extension_EventAssetsManagerEx_constructor(se::State& s) // NOLIN
ok &= sevalue_to_native(args[1], &arg1, s.thisObject());
ok &= sevalue_to_native(args[2], &arg2, s.thisObject());
SE_PRECONDITION2(ok, false, "js_extension_EventAssetsManagerEx_constructor : Error processing arguments");
cc::extension::EventAssetsManagerEx* cobj = JSB_ALLOC(cc::extension::EventAssetsManagerEx, arg0, arg1, arg2);
s.thisObject()->setPrivateData(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::extension::EventAssetsManagerEx, arg0, arg1, arg2);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_extension_EventAssetsManagerEx_constructor, __jsb_cc_extension_EventAssetsManagerEx_class, js_cc_extension_EventAssetsManagerEx_finalize)
static bool js_cc_extension_EventAssetsManagerEx_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto* cobj =SE_THIS_OBJECT<cc::extension::EventAssetsManagerEx>(s);
cobj->release();
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_extension_EventAssetsManagerEx_finalize)
@@ -338,11 +311,12 @@ bool js_register_extension_EventAssetsManagerEx(se::Object* obj) // NOLINT(reada
__jsb_cc_extension_EventAssetsManagerEx_proto = cls->getProto();
__jsb_cc_extension_EventAssetsManagerEx_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_extension_Manifest_proto = nullptr;
se::Class* __jsb_cc_extension_Manifest_class = nullptr;
se::Object* __jsb_cc_extension_Manifest_proto = nullptr; // NOLINT
se::Class* __jsb_cc_extension_Manifest_class = nullptr; // NOLINT
static bool js_extension_Manifest_getManifestFileUrl(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -589,15 +563,15 @@ static bool js_extension_Manifest_constructor(se::State& s) // NOLINT(readabilit
HolderType<std::string, true> arg1 = {};
ok &= sevalue_to_native(args[1], &arg1, s.thisObject());
if (!ok) { ok = true; break; }
cc::extension::Manifest* cobj = JSB_ALLOC(cc::extension::Manifest, arg0.value(), arg1.value());
s.thisObject()->setPrivateData(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::extension::Manifest, arg0.value(), arg1.value());
s.thisObject()->setPrivateObject(ptr);
return true;
}
} while(false);
do {
if (argc == 0) {
cc::extension::Manifest* cobj = JSB_ALLOC(cc::extension::Manifest);
s.thisObject()->setPrivateData(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::extension::Manifest);
s.thisObject()->setPrivateObject(ptr);
return true;
}
} while(false);
@@ -606,8 +580,8 @@ static bool js_extension_Manifest_constructor(se::State& s) // NOLINT(readabilit
HolderType<std::string, true> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
if (!ok) { ok = true; break; }
cc::extension::Manifest* cobj = JSB_ALLOC(cc::extension::Manifest, arg0.value());
s.thisObject()->setPrivateData(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::extension::Manifest, arg0.value());
s.thisObject()->setPrivateObject(ptr);
return true;
}
} while(false);
@@ -616,12 +590,8 @@ static bool js_extension_Manifest_constructor(se::State& s) // NOLINT(readabilit
}
SE_BIND_CTOR(js_extension_Manifest_constructor, __jsb_cc_extension_Manifest_class, js_cc_extension_Manifest_finalize)
static bool js_cc_extension_Manifest_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto* cobj =SE_THIS_OBJECT<cc::extension::Manifest>(s);
cobj->release();
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_extension_Manifest_finalize)
@@ -649,11 +619,12 @@ bool js_register_extension_Manifest(se::Object* obj) // NOLINT(readability-ident
__jsb_cc_extension_Manifest_proto = cls->getProto();
__jsb_cc_extension_Manifest_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_extension_AssetsManagerEx_proto = nullptr;
se::Class* __jsb_cc_extension_AssetsManagerEx_class = nullptr;
se::Object* __jsb_cc_extension_AssetsManagerEx_proto = nullptr; // NOLINT
se::Class* __jsb_cc_extension_AssetsManagerEx_class = nullptr; // NOLINT
static bool js_extension_AssetsManagerEx_checkUpdate(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -750,7 +721,7 @@ static bool js_extension_AssetsManagerEx_getMaxConcurrentTask(se::State& s) // N
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
const int result = cobj->getMaxConcurrentTask();
int result = cobj->getMaxConcurrentTask();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_extension_AssetsManagerEx_getMaxConcurrentTask : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -970,6 +941,7 @@ static bool js_extension_AssetsManagerEx_setEventCallback(se::State& s) // NOLIN
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](cc::extension::EventAssetsManagerEx* larg0) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -979,7 +951,6 @@ static bool js_extension_AssetsManagerEx_setEventCallback(se::State& s) // NOLIN
args.resize(1);
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -1037,6 +1008,7 @@ static bool js_extension_AssetsManagerEx_setVerifyCallback(se::State& s) // NOLI
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](const std::string larg0, cc::extension::ManifestAsset larg1) -> bool {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -1047,7 +1019,6 @@ static bool js_extension_AssetsManagerEx_setVerifyCallback(se::State& s) // NOLI
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg1, args[1], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -1090,6 +1061,7 @@ static bool js_extension_AssetsManagerEx_setVersionCompareHandle(se::State& s) /
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](const std::string larg0, const std::string larg1) -> int {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -1100,7 +1072,6 @@ static bool js_extension_AssetsManagerEx_setVersionCompareHandle(se::State& s) /
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg1, args[1], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -1143,7 +1114,7 @@ static bool js_extension_AssetsManagerEx_update(se::State& s) // NOLINT(readabil
}
SE_BIND_FUNC(js_extension_AssetsManagerEx_update)
static bool js_extension_AssetsManagerEx_create(se::State& s) // NOLINT(readability-identifier-naming)
static bool js_extension_AssetsManagerEx_create_static(se::State& s) // NOLINT(readability-identifier-naming)
{
const auto& args = s.args();
size_t argc = args.size();
@@ -1153,18 +1124,17 @@ static bool js_extension_AssetsManagerEx_create(se::State& s) // NOLINT(readabil
HolderType<std::string, true> arg1 = {};
ok &= sevalue_to_native(args[0], &arg0, nullptr);
ok &= sevalue_to_native(args[1], &arg1, nullptr);
SE_PRECONDITION2(ok, false, "js_extension_AssetsManagerEx_create : Error processing arguments");
auto result = cc::extension::AssetsManagerEx::create(arg0.value(), arg1.value());
result->retain();
auto obj = se::Object::createObjectWithClass(__jsb_cc_extension_AssetsManagerEx_class);
obj->setPrivateData(result);
s.rval().setObject(obj);
SE_PRECONDITION2(ok, false, "js_extension_AssetsManagerEx_create_static : Error processing arguments");
cc::extension::AssetsManagerEx* result = cc::extension::AssetsManagerEx::create(arg0.value(), arg1.value());
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_extension_AssetsManagerEx_create_static : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
return false;
}
SE_BIND_FUNC(js_extension_AssetsManagerEx_create)
SE_BIND_FUNC(js_extension_AssetsManagerEx_create_static)
SE_DECLARE_FINALIZE_FUNC(js_cc_extension_AssetsManagerEx_finalize)
@@ -1181,13 +1151,14 @@ static bool js_extension_AssetsManagerEx_constructor(se::State& s) // NOLINT(rea
HolderType<std::string, true> arg1 = {};
ok &= sevalue_to_native(args[1], &arg1, s.thisObject());
if (!ok) { ok = true; break; }
HolderType<std::function<int (const std::string, const std::string)>, true> arg2 = {};
HolderType<std::function<int (const std::string, const std::string)>, false> arg2 = {};
do {
if (args[2].isObject() && args[2].toObject()->isFunction())
{
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[2]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](const std::string larg0, const std::string larg1) -> int {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -1198,7 +1169,6 @@ static bool js_extension_AssetsManagerEx_constructor(se::State& s) // NOLINT(rea
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg1, args[1], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -1218,8 +1188,8 @@ static bool js_extension_AssetsManagerEx_constructor(se::State& s) // NOLINT(rea
} while(false)
;
if (!ok) { ok = true; break; }
cc::extension::AssetsManagerEx* cobj = JSB_ALLOC(cc::extension::AssetsManagerEx, arg0.value(), arg1.value(), arg2.value());
s.thisObject()->setPrivateData(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::extension::AssetsManagerEx, arg0.value(), arg1.value(), arg2.value());
s.thisObject()->setPrivateObject(ptr);
return true;
}
} while(false);
@@ -1231,8 +1201,8 @@ static bool js_extension_AssetsManagerEx_constructor(se::State& s) // NOLINT(rea
HolderType<std::string, true> arg1 = {};
ok &= sevalue_to_native(args[1], &arg1, s.thisObject());
if (!ok) { ok = true; break; }
cc::extension::AssetsManagerEx* cobj = JSB_ALLOC(cc::extension::AssetsManagerEx, arg0.value(), arg1.value());
s.thisObject()->setPrivateData(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::extension::AssetsManagerEx, arg0.value(), arg1.value());
s.thisObject()->setPrivateObject(ptr);
return true;
}
} while(false);
@@ -1241,12 +1211,8 @@ static bool js_extension_AssetsManagerEx_constructor(se::State& s) // NOLINT(rea
}
SE_BIND_CTOR(js_extension_AssetsManagerEx_constructor, __jsb_cc_extension_AssetsManagerEx_class, js_cc_extension_AssetsManagerEx_finalize)
static bool js_cc_extension_AssetsManagerEx_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto* cobj =SE_THIS_OBJECT<cc::extension::AssetsManagerEx>(s);
cobj->release();
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_extension_AssetsManagerEx_finalize)
@@ -1275,7 +1241,7 @@ bool js_register_extension_AssetsManagerEx(se::Object* obj) // NOLINT(readabilit
cls->defineFunction("setVerifyCallback", _SE(js_extension_AssetsManagerEx_setVerifyCallback));
cls->defineFunction("setVersionCompareHandle", _SE(js_extension_AssetsManagerEx_setVersionCompareHandle));
cls->defineFunction("update", _SE(js_extension_AssetsManagerEx_update));
cls->defineStaticFunction("create", _SE(js_extension_AssetsManagerEx_create));
cls->defineStaticFunction("create", _SE(js_extension_AssetsManagerEx_create_static));
cls->defineFinalizeFunction(_SE(js_cc_extension_AssetsManagerEx_finalize));
cls->install();
JSBClassType::registerClass<cc::extension::AssetsManagerEx>(cls);
@@ -1283,14 +1249,15 @@ bool js_register_extension_AssetsManagerEx(se::Object* obj) // NOLINT(readabilit
__jsb_cc_extension_AssetsManagerEx_proto = cls->getProto();
__jsb_cc_extension_AssetsManagerEx_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_extension(se::Object* obj)
bool register_all_extension(se::Object* obj) // NOLINT
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("jsb", &nsVal))
if (!obj->getProperty("jsb", &nsVal, true))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
@@ -1298,9 +1265,10 @@ bool register_all_extension(se::Object* obj)
}
se::Object* ns = nsVal.toObject();
js_register_extension_AssetsManagerEx(ns);
js_register_extension_EventAssetsManagerEx(ns);
js_register_extension_Manifest(ns);
js_register_extension_AssetsManagerEx(ns);
return true;
}
// clang-format on
+18 -41
View File
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
@@ -30,13 +6,18 @@
#include "cocos/bindings/manual/jsb_conversions.h"
#include "extensions/cocos-ext.h"
extern se::Object* __jsb_cc_extension_EventAssetsManagerEx_proto;
extern se::Class* __jsb_cc_extension_EventAssetsManagerEx_class;
bool js_register_cc_extension_EventAssetsManagerEx(se::Object* obj);
bool register_all_extension(se::Object* obj);
bool register_all_extension(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::extension::EventAssetsManagerEx);
JSB_REGISTER_OBJECT_TYPE(cc::extension::Manifest);
JSB_REGISTER_OBJECT_TYPE(cc::extension::AssetsManagerEx);
extern se::Object *__jsb_cc_extension_EventAssetsManagerEx_proto; // NOLINT
extern se::Class * __jsb_cc_extension_EventAssetsManagerEx_class; // NOLINT
bool js_register_cc_extension_EventAssetsManagerEx(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_extension_EventAssetsManagerEx_getAssetId);
SE_DECLARE_FUNC(js_extension_EventAssetsManagerEx_getAssetsManagerEx);
SE_DECLARE_FUNC(js_extension_EventAssetsManagerEx_getCURLECode);
@@ -52,13 +33,11 @@ SE_DECLARE_FUNC(js_extension_EventAssetsManagerEx_getTotalFiles);
SE_DECLARE_FUNC(js_extension_EventAssetsManagerEx_isResuming);
SE_DECLARE_FUNC(js_extension_EventAssetsManagerEx_EventAssetsManagerEx);
extern se::Object* __jsb_cc_extension_Manifest_proto;
extern se::Class* __jsb_cc_extension_Manifest_class;
extern se::Object *__jsb_cc_extension_Manifest_proto; // NOLINT
extern se::Class * __jsb_cc_extension_Manifest_class; // NOLINT
bool js_register_cc_extension_Manifest(se::Object* obj);
bool register_all_extension(se::Object* obj);
bool js_register_cc_extension_Manifest(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::extension::Manifest);
SE_DECLARE_FUNC(js_extension_Manifest_getManifestFileUrl);
SE_DECLARE_FUNC(js_extension_Manifest_getManifestRoot);
SE_DECLARE_FUNC(js_extension_Manifest_getPackageUrl);
@@ -73,13 +52,11 @@ SE_DECLARE_FUNC(js_extension_Manifest_parseJSONString);
SE_DECLARE_FUNC(js_extension_Manifest_setUpdating);
SE_DECLARE_FUNC(js_extension_Manifest_Manifest);
extern se::Object* __jsb_cc_extension_AssetsManagerEx_proto;
extern se::Class* __jsb_cc_extension_AssetsManagerEx_class;
extern se::Object *__jsb_cc_extension_AssetsManagerEx_proto; // NOLINT
extern se::Class * __jsb_cc_extension_AssetsManagerEx_class; // NOLINT
bool js_register_cc_extension_AssetsManagerEx(se::Object* obj);
bool register_all_extension(se::Object* obj);
bool js_register_cc_extension_AssetsManagerEx(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::extension::AssetsManagerEx);
SE_DECLARE_FUNC(js_extension_AssetsManagerEx_checkUpdate);
SE_DECLARE_FUNC(js_extension_AssetsManagerEx_downloadFailedAssets);
SE_DECLARE_FUNC(js_extension_AssetsManagerEx_getDownloadedBytes);
@@ -102,4 +79,4 @@ SE_DECLARE_FUNC(js_extension_AssetsManagerEx_setVersionCompareHandle);
SE_DECLARE_FUNC(js_extension_AssetsManagerEx_update);
SE_DECLARE_FUNC(js_extension_AssetsManagerEx_create);
SE_DECLARE_FUNC(js_extension_AssetsManagerEx_AssetsManagerEx);
// clang-format on
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,146 @@
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
#include "cocos/bindings/jswrapper/SeApi.h"
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/auto/jsb_cocos_auto.h"
#include "cocos/core/geometry/Geometry.h"
bool register_all_geometry(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::geometry::ShapeBase);
JSB_REGISTER_OBJECT_TYPE(cc::geometry::AABB);
JSB_REGISTER_OBJECT_TYPE(cc::geometry::Capsule);
JSB_REGISTER_OBJECT_TYPE(cc::geometry::Plane);
JSB_REGISTER_OBJECT_TYPE(cc::geometry::Frustum);
JSB_REGISTER_OBJECT_TYPE(cc::geometry::Line);
JSB_REGISTER_OBJECT_TYPE(cc::geometry::Ray);
JSB_REGISTER_OBJECT_TYPE(cc::geometry::Sphere);
JSB_REGISTER_OBJECT_TYPE(cc::geometry::Triangle);
extern se::Object *__jsb_cc_geometry_ShapeBase_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_ShapeBase_class; // NOLINT
bool js_register_cc_geometry_ShapeBase(se::Object *obj); // NOLINT
extern se::Object *__jsb_cc_geometry_AABB_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_AABB_class; // NOLINT
bool js_register_cc_geometry_AABB(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_geometry_AABB_contain);
SE_DECLARE_FUNC(js_geometry_AABB_create);
SE_DECLARE_FUNC(js_geometry_AABB_toBoundingSphere);
SE_DECLARE_FUNC(js_geometry_AABB_AABB);
extern se::Object *__jsb_cc_geometry_Capsule_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_Capsule_class; // NOLINT
bool js_register_cc_geometry_Capsule(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_geometry_Capsule_transform);
SE_DECLARE_FUNC(js_geometry_Capsule_Capsule);
extern se::Object *__jsb_cc_geometry_Plane_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_Plane_class; // NOLINT
bool js_register_cc_geometry_Plane(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_geometry_Plane_define);
SE_DECLARE_FUNC(js_geometry_Plane_distance);
SE_DECLARE_FUNC(js_geometry_Plane_getW);
SE_DECLARE_FUNC(js_geometry_Plane_getX);
SE_DECLARE_FUNC(js_geometry_Plane_getY);
SE_DECLARE_FUNC(js_geometry_Plane_getZ);
SE_DECLARE_FUNC(js_geometry_Plane_transform);
SE_DECLARE_FUNC(js_geometry_Plane_create);
SE_DECLARE_FUNC(js_geometry_Plane_Plane);
extern se::Object *__jsb_cc_geometry_Frustum_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_Frustum_class; // NOLINT
bool js_register_cc_geometry_Frustum(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_geometry_Frustum_clone);
SE_DECLARE_FUNC(js_geometry_Frustum_createOrtho);
SE_DECLARE_FUNC(js_geometry_Frustum_setAccurate);
SE_DECLARE_FUNC(js_geometry_Frustum_transform);
SE_DECLARE_FUNC(js_geometry_Frustum_clone);
SE_DECLARE_FUNC(js_geometry_Frustum_copy);
SE_DECLARE_FUNC(js_geometry_Frustum_create);
SE_DECLARE_FUNC(js_geometry_Frustum_createFromAABB);
SE_DECLARE_FUNC(js_geometry_Frustum_createOrtho);
SE_DECLARE_FUNC(js_geometry_Frustum_Frustum);
extern se::Object *__jsb_cc_geometry_Line_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_Line_class; // NOLINT
bool js_register_cc_geometry_Line(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_geometry_Line_length);
SE_DECLARE_FUNC(js_geometry_Line_clone);
SE_DECLARE_FUNC(js_geometry_Line_copy);
SE_DECLARE_FUNC(js_geometry_Line_create);
SE_DECLARE_FUNC(js_geometry_Line_fromPoints);
SE_DECLARE_FUNC(js_geometry_Line_len);
SE_DECLARE_FUNC(js_geometry_Line_set);
SE_DECLARE_FUNC(js_geometry_Line_Line);
extern se::Object *__jsb_cc_geometry_Ray_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_Ray_class; // NOLINT
bool js_register_cc_geometry_Ray(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_geometry_Ray_clone);
SE_DECLARE_FUNC(js_geometry_Ray_copy);
SE_DECLARE_FUNC(js_geometry_Ray_create);
SE_DECLARE_FUNC(js_geometry_Ray_fromPoints);
SE_DECLARE_FUNC(js_geometry_Ray_set);
SE_DECLARE_FUNC(js_geometry_Ray_Ray);
extern se::Object *__jsb_cc_geometry_Sphere_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_Sphere_class; // NOLINT
bool js_register_cc_geometry_Sphere(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_geometry_Sphere_clone);
SE_DECLARE_FUNC(js_geometry_Sphere_copy);
SE_DECLARE_FUNC(js_geometry_Sphere_define);
SE_DECLARE_FUNC(js_geometry_Sphere_getCenter);
SE_DECLARE_FUNC(js_geometry_Sphere_getRadius);
SE_DECLARE_FUNC(js_geometry_Sphere_interset);
SE_DECLARE_FUNC(js_geometry_Sphere_merge);
SE_DECLARE_FUNC(js_geometry_Sphere_mergeAABB);
SE_DECLARE_FUNC(js_geometry_Sphere_mergeFrustum);
SE_DECLARE_FUNC(js_geometry_Sphere_mergePoint);
SE_DECLARE_FUNC(js_geometry_Sphere_setCenter);
SE_DECLARE_FUNC(js_geometry_Sphere_setRadius);
SE_DECLARE_FUNC(js_geometry_Sphere_setScale);
SE_DECLARE_FUNC(js_geometry_Sphere_sphereFrustum);
SE_DECLARE_FUNC(js_geometry_Sphere_spherePlane);
SE_DECLARE_FUNC(js_geometry_Sphere_transform);
SE_DECLARE_FUNC(js_geometry_Sphere_translateAndRotate);
SE_DECLARE_FUNC(js_geometry_Sphere_clone);
SE_DECLARE_FUNC(js_geometry_Sphere_copy);
SE_DECLARE_FUNC(js_geometry_Sphere_create);
SE_DECLARE_FUNC(js_geometry_Sphere_fromPoints);
SE_DECLARE_FUNC(js_geometry_Sphere_mergeAABB);
SE_DECLARE_FUNC(js_geometry_Sphere_mergePoint);
SE_DECLARE_FUNC(js_geometry_Sphere_set);
SE_DECLARE_FUNC(js_geometry_Sphere_Sphere);
extern se::Object *__jsb_cc_geometry_Triangle_proto; // NOLINT
extern se::Class * __jsb_cc_geometry_Triangle_class; // NOLINT
bool js_register_cc_geometry_Triangle(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_geometry_Triangle_clone);
SE_DECLARE_FUNC(js_geometry_Triangle_copy);
SE_DECLARE_FUNC(js_geometry_Triangle_create);
SE_DECLARE_FUNC(js_geometry_Triangle_fromPoints);
SE_DECLARE_FUNC(js_geometry_Triangle_set);
SE_DECLARE_FUNC(js_geometry_Triangle_Triangle);
// clang-format on
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+29 -74
View File
@@ -1,28 +1,5 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#include "cocos/bindings/auto/jsb_network_auto.h"
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/manual/jsb_global.h"
@@ -35,8 +12,8 @@
#ifndef JSB_FREE
#define JSB_FREE(ptr) delete ptr
#endif
se::Object* __jsb_cc_network_DownloaderHints_proto = nullptr;
se::Class* __jsb_cc_network_DownloaderHints_class = nullptr;
se::Object* __jsb_cc_network_DownloaderHints_proto = nullptr; // NOLINT
se::Class* __jsb_cc_network_DownloaderHints_class = nullptr; // NOLINT
static bool js_network_DownloaderHints_get_countOfMaxProcessingTasks(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -132,15 +109,15 @@ bool sevalue_to_native(const se::Value &from, cc::network::DownloaderHints * to,
}
se::Value field;
bool ok = true;
json->getProperty("countOfMaxProcessingTasks", &field);
json->getProperty("countOfMaxProcessingTasks", &field, true);
if(!field.isNullOrUndefined()) {
ok &= sevalue_to_native(field, &(to->countOfMaxProcessingTasks), ctx);
}
json->getProperty("timeoutInSeconds", &field);
json->getProperty("timeoutInSeconds", &field, true);
if(!field.isNullOrUndefined()) {
ok &= sevalue_to_native(field, &(to->timeoutInSeconds), ctx);
}
json->getProperty("tempFileNameSuffix", &field);
json->getProperty("tempFileNameSuffix", &field, true);
if(!field.isNullOrUndefined()) {
ok &= sevalue_to_native(field, &(to->tempFileNameSuffix), ctx);
}
@@ -157,9 +134,8 @@ static bool js_network_DownloaderHints_constructor(se::State& s) // NOLINT(reada
if(argc == 0)
{
cc::network::DownloaderHints* cobj = JSB_ALLOC(cc::network::DownloaderHints);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::network::DownloaderHints);
s.thisObject()->setPrivateObject(ptr);
return true;
}
@@ -167,21 +143,19 @@ static bool js_network_DownloaderHints_constructor(se::State& s) // NOLINT(reada
{
se::Object *json = args[0].toObject();
se::Value field;
cc::network::DownloaderHints* cobj = JSB_ALLOC(cc::network::DownloaderHints);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::network::DownloaderHints);
auto cobj = ptr->get<cc::network::DownloaderHints>();
ok &= sevalue_to_native(args[0], cobj, s.thisObject());
if(!ok) {
JSB_FREE(cobj);
delete ptr;
SE_REPORT_ERROR("argument convertion error");
return false;
}
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
s.thisObject()->setPrivateObject(ptr);
return true;
}
cc::network::DownloaderHints* cobj = JSB_ALLOC(cc::network::DownloaderHints);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::network::DownloaderHints);
auto cobj = ptr->get<cc::network::DownloaderHints>();
if (argc > 0 && !args[0].isUndefined()) {
ok &= sevalue_to_native(args[0], &(cobj->countOfMaxProcessingTasks), nullptr);
}
@@ -193,28 +167,17 @@ static bool js_network_DownloaderHints_constructor(se::State& s) // NOLINT(reada
}
if(!ok) {
JSB_FREE(cobj);
delete ptr;
SE_REPORT_ERROR("Argument convertion error");
return false;
}
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_network_DownloaderHints_constructor, __jsb_cc_network_DownloaderHints_class, js_cc_network_DownloaderHints_finalize)
static bool js_cc_network_DownloaderHints_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::network::DownloaderHints>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::network::DownloaderHints>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_network_DownloaderHints_finalize)
@@ -233,11 +196,12 @@ bool js_register_network_DownloaderHints(se::Object* obj) // NOLINT(readability-
__jsb_cc_network_DownloaderHints_proto = cls->getProto();
__jsb_cc_network_DownloaderHints_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_network_Downloader_proto = nullptr;
se::Class* __jsb_cc_network_Downloader_class = nullptr;
se::Object* __jsb_cc_network_Downloader_proto = nullptr; // NOLINT
se::Class* __jsb_cc_network_Downloader_class = nullptr; // NOLINT
static bool js_network_Downloader_setOnTaskProgress(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -254,6 +218,7 @@ static bool js_network_Downloader_setOnTaskProgress(se::State& s) // NOLINT(read
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](const cc::network::DownloadTask & larg0, int64_t larg1, int64_t larg2, int64_t larg3) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -266,7 +231,6 @@ static bool js_network_Downloader_setOnTaskProgress(se::State& s) // NOLINT(read
ok &= nativevalue_to_se(larg2, args[2], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg3, args[3], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -302,17 +266,15 @@ static bool js_network_Downloader_constructor(se::State& s) // NOLINT(readabilit
HolderType<cc::network::DownloaderHints, true> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
if (!ok) { ok = true; break; }
cc::network::Downloader* cobj = JSB_ALLOC(cc::network::Downloader, arg0.value());
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::network::Downloader, arg0.value());
s.thisObject()->setPrivateObject(ptr);
return true;
}
} while(false);
do {
if (argc == 0) {
cc::network::Downloader* cobj = JSB_ALLOC(cc::network::Downloader);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::network::Downloader);
s.thisObject()->setPrivateObject(ptr);
return true;
}
} while(false);
@@ -321,17 +283,8 @@ static bool js_network_Downloader_constructor(se::State& s) // NOLINT(readabilit
}
SE_BIND_CTOR(js_network_Downloader_constructor, __jsb_cc_network_Downloader_class, js_cc_network_Downloader_finalize)
static bool js_cc_network_Downloader_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::network::Downloader>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::network::Downloader>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_network_Downloader_finalize)
@@ -348,14 +301,15 @@ bool js_register_network_Downloader(se::Object* obj) // NOLINT(readability-ident
__jsb_cc_network_Downloader_proto = cls->getProto();
__jsb_cc_network_Downloader_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_network(se::Object* obj)
bool register_all_network(se::Object* obj) // NOLINT
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("jsb", &nsVal))
if (!obj->getProperty("jsb", &nsVal, true))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
@@ -363,8 +317,9 @@ bool register_all_network(se::Object* obj)
}
se::Object* ns = nsVal.toObject();
js_register_network_DownloaderHints(ns);
js_register_network_Downloader(ns);
js_register_network_DownloaderHints(ns);
return true;
}
// clang-format on
+18 -40
View File
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
@@ -30,23 +6,25 @@
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/network/Downloader.h"
extern se::Object* __jsb_cc_network_DownloaderHints_proto;
extern se::Class* __jsb_cc_network_DownloaderHints_class;
bool register_all_network(se::Object *obj); // NOLINT
bool js_register_cc_network_DownloaderHints(se::Object* obj);
bool register_all_network(se::Object* obj);
template<>
bool sevalue_to_native(const se::Value &, cc::network::DownloaderHints *, se::Object *ctx);
JSB_REGISTER_OBJECT_TYPE(cc::network::DownloaderHints);
extern se::Object* __jsb_cc_network_Downloader_proto;
extern se::Class* __jsb_cc_network_Downloader_class;
bool js_register_cc_network_Downloader(se::Object* obj);
bool register_all_network(se::Object* obj);
JSB_REGISTER_OBJECT_TYPE(cc::network::Downloader);
extern se::Object *__jsb_cc_network_DownloaderHints_proto; // NOLINT
extern se::Class * __jsb_cc_network_DownloaderHints_class; // NOLINT
bool js_register_cc_network_DownloaderHints(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::network::DownloaderHints *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_network_Downloader_proto; // NOLINT
extern se::Class * __jsb_cc_network_Downloader_class; // NOLINT
bool js_register_cc_network_Downloader(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_network_Downloader_setOnTaskProgress);
SE_DECLARE_FUNC(js_network_Downloader_Downloader);
// clang-format on
+98 -228
View File
@@ -1,28 +1,5 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#include "cocos/bindings/auto/jsb_physics_auto.h"
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/manual/jsb_global.h"
@@ -35,8 +12,8 @@
#ifndef JSB_FREE
#define JSB_FREE(ptr) delete ptr
#endif
se::Object* __jsb_cc_physics_RevoluteJoint_proto = nullptr;
se::Class* __jsb_cc_physics_RevoluteJoint_class = nullptr;
se::Object* __jsb_cc_physics_RevoluteJoint_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_RevoluteJoint_class = nullptr; // NOLINT
static bool js_physics_RevoluteJoint_getImpl(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -65,7 +42,7 @@ static bool js_physics_RevoluteJoint_initialize(se::State& s) // NOLINT(readabil
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_RevoluteJoint_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -232,24 +209,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_RevoluteJoint_finalize)
static bool js_physics_RevoluteJoint_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::RevoluteJoint* cobj = JSB_ALLOC(cc::physics::RevoluteJoint);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::RevoluteJoint);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_RevoluteJoint_constructor, __jsb_cc_physics_RevoluteJoint_class, js_cc_physics_RevoluteJoint_finalize)
static bool js_cc_physics_RevoluteJoint_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::RevoluteJoint>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::RevoluteJoint>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_RevoluteJoint_finalize)
@@ -275,11 +242,12 @@ bool js_register_physics_RevoluteJoint(se::Object* obj) // NOLINT(readability-id
__jsb_cc_physics_RevoluteJoint_proto = cls->getProto();
__jsb_cc_physics_RevoluteJoint_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_DistanceJoint_proto = nullptr;
se::Class* __jsb_cc_physics_DistanceJoint_class = nullptr;
se::Object* __jsb_cc_physics_DistanceJoint_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_DistanceJoint_class = nullptr; // NOLINT
static bool js_physics_DistanceJoint_getImpl(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -308,7 +276,7 @@ static bool js_physics_DistanceJoint_initialize(se::State& s) // NOLINT(readabil
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_DistanceJoint_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -452,24 +420,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_DistanceJoint_finalize)
static bool js_physics_DistanceJoint_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::DistanceJoint* cobj = JSB_ALLOC(cc::physics::DistanceJoint);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::DistanceJoint);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_DistanceJoint_constructor, __jsb_cc_physics_DistanceJoint_class, js_cc_physics_DistanceJoint_finalize)
static bool js_cc_physics_DistanceJoint_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::DistanceJoint>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::DistanceJoint>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_DistanceJoint_finalize)
@@ -494,11 +452,12 @@ bool js_register_physics_DistanceJoint(se::Object* obj) // NOLINT(readability-id
__jsb_cc_physics_DistanceJoint_proto = cls->getProto();
__jsb_cc_physics_DistanceJoint_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_RigidBody_proto = nullptr;
se::Class* __jsb_cc_physics_RigidBody_class = nullptr;
se::Object* __jsb_cc_physics_RigidBody_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_RigidBody_class = nullptr; // NOLINT
static bool js_physics_RigidBody_applyForce(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -848,7 +807,7 @@ static bool js_physics_RigidBody_initialize(se::State& s) // NOLINT(readability-
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 3) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
HolderType<cc::physics::ERigidBodyType, false> arg1 = {};
HolderType<unsigned int, false> arg2 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
@@ -1281,24 +1240,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_RigidBody_finalize)
static bool js_physics_RigidBody_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::RigidBody* cobj = JSB_ALLOC(cc::physics::RigidBody);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::RigidBody);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_RigidBody_constructor, __jsb_cc_physics_RigidBody_class, js_cc_physics_RigidBody_finalize)
static bool js_cc_physics_RigidBody_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::RigidBody>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::RigidBody>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_RigidBody_finalize)
@@ -1353,11 +1302,12 @@ bool js_register_physics_RigidBody(se::Object* obj) // NOLINT(readability-identi
__jsb_cc_physics_RigidBody_proto = cls->getProto();
__jsb_cc_physics_RigidBody_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_SphereShape_proto = nullptr;
se::Class* __jsb_cc_physics_SphereShape_class = nullptr;
se::Object* __jsb_cc_physics_SphereShape_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_SphereShape_class = nullptr; // NOLINT
static bool js_physics_SphereShape_getAABB(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -1367,7 +1317,7 @@ static bool js_physics_SphereShape_getAABB(se::State& s) // NOLINT(readability-i
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::AABB& result = cobj->getAABB();
cc::geometry::AABB& result = cobj->getAABB();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_SphereShape_getAABB : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -1386,7 +1336,7 @@ static bool js_physics_SphereShape_getBoundingSphere(se::State& s) // NOLINT(rea
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::Sphere& result = cobj->getBoundingSphere();
cc::geometry::Sphere& result = cobj->getBoundingSphere();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_SphereShape_getBoundingSphere : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -1462,7 +1412,7 @@ static bool js_physics_SphereShape_initialize(se::State& s) // NOLINT(readabilit
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_SphereShape_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -1669,24 +1619,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_SphereShape_finalize)
static bool js_physics_SphereShape_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::SphereShape* cobj = JSB_ALLOC(cc::physics::SphereShape);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::SphereShape);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_SphereShape_constructor, __jsb_cc_physics_SphereShape_class, js_cc_physics_SphereShape_finalize)
static bool js_cc_physics_SphereShape_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::SphereShape>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::SphereShape>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_SphereShape_finalize)
@@ -1718,11 +1658,12 @@ bool js_register_physics_SphereShape(se::Object* obj) // NOLINT(readability-iden
__jsb_cc_physics_SphereShape_proto = cls->getProto();
__jsb_cc_physics_SphereShape_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_BoxShape_proto = nullptr;
se::Class* __jsb_cc_physics_BoxShape_class = nullptr;
se::Object* __jsb_cc_physics_BoxShape_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_BoxShape_class = nullptr; // NOLINT
static bool js_physics_BoxShape_getAABB(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -1732,7 +1673,7 @@ static bool js_physics_BoxShape_getAABB(se::State& s) // NOLINT(readability-iden
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::AABB& result = cobj->getAABB();
cc::geometry::AABB& result = cobj->getAABB();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_BoxShape_getAABB : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -1751,7 +1692,7 @@ static bool js_physics_BoxShape_getBoundingSphere(se::State& s) // NOLINT(readab
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::Sphere& result = cobj->getBoundingSphere();
cc::geometry::Sphere& result = cobj->getBoundingSphere();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_BoxShape_getBoundingSphere : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -1827,7 +1768,7 @@ static bool js_physics_BoxShape_initialize(se::State& s) // NOLINT(readability-i
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_BoxShape_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -2038,24 +1979,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_BoxShape_finalize)
static bool js_physics_BoxShape_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::BoxShape* cobj = JSB_ALLOC(cc::physics::BoxShape);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::BoxShape);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_BoxShape_constructor, __jsb_cc_physics_BoxShape_class, js_cc_physics_BoxShape_finalize)
static bool js_cc_physics_BoxShape_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::BoxShape>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::BoxShape>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_BoxShape_finalize)
@@ -2087,11 +2018,12 @@ bool js_register_physics_BoxShape(se::Object* obj) // NOLINT(readability-identif
__jsb_cc_physics_BoxShape_proto = cls->getProto();
__jsb_cc_physics_BoxShape_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_CapsuleShape_proto = nullptr;
se::Class* __jsb_cc_physics_CapsuleShape_class = nullptr;
se::Object* __jsb_cc_physics_CapsuleShape_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_CapsuleShape_class = nullptr; // NOLINT
static bool js_physics_CapsuleShape_getAABB(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -2101,7 +2033,7 @@ static bool js_physics_CapsuleShape_getAABB(se::State& s) // NOLINT(readability-
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::AABB& result = cobj->getAABB();
cc::geometry::AABB& result = cobj->getAABB();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_getAABB : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -2120,7 +2052,7 @@ static bool js_physics_CapsuleShape_getBoundingSphere(se::State& s) // NOLINT(re
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::Sphere& result = cobj->getBoundingSphere();
cc::geometry::Sphere& result = cobj->getBoundingSphere();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_getBoundingSphere : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -2196,7 +2128,7 @@ static bool js_physics_CapsuleShape_initialize(se::State& s) // NOLINT(readabili
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_CapsuleShape_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -2441,24 +2373,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_CapsuleShape_finalize)
static bool js_physics_CapsuleShape_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::CapsuleShape* cobj = JSB_ALLOC(cc::physics::CapsuleShape);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::CapsuleShape);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_CapsuleShape_constructor, __jsb_cc_physics_CapsuleShape_class, js_cc_physics_CapsuleShape_finalize)
static bool js_cc_physics_CapsuleShape_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::CapsuleShape>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::CapsuleShape>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_CapsuleShape_finalize)
@@ -2492,11 +2414,12 @@ bool js_register_physics_CapsuleShape(se::Object* obj) // NOLINT(readability-ide
__jsb_cc_physics_CapsuleShape_proto = cls->getProto();
__jsb_cc_physics_CapsuleShape_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_PlaneShape_proto = nullptr;
se::Class* __jsb_cc_physics_PlaneShape_class = nullptr;
se::Object* __jsb_cc_physics_PlaneShape_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_PlaneShape_class = nullptr; // NOLINT
static bool js_physics_PlaneShape_getAABB(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -2506,7 +2429,7 @@ static bool js_physics_PlaneShape_getAABB(se::State& s) // NOLINT(readability-id
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::AABB& result = cobj->getAABB();
cc::geometry::AABB& result = cobj->getAABB();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_getAABB : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -2525,7 +2448,7 @@ static bool js_physics_PlaneShape_getBoundingSphere(se::State& s) // NOLINT(read
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::Sphere& result = cobj->getBoundingSphere();
cc::geometry::Sphere& result = cobj->getBoundingSphere();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_getBoundingSphere : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -2601,7 +2524,7 @@ static bool js_physics_PlaneShape_initialize(se::State& s) // NOLINT(readability
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_PlaneShape_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -2831,24 +2754,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_PlaneShape_finalize)
static bool js_physics_PlaneShape_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::PlaneShape* cobj = JSB_ALLOC(cc::physics::PlaneShape);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::PlaneShape);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_PlaneShape_constructor, __jsb_cc_physics_PlaneShape_class, js_cc_physics_PlaneShape_finalize)
static bool js_cc_physics_PlaneShape_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::PlaneShape>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::PlaneShape>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_PlaneShape_finalize)
@@ -2881,11 +2794,12 @@ bool js_register_physics_PlaneShape(se::Object* obj) // NOLINT(readability-ident
__jsb_cc_physics_PlaneShape_proto = cls->getProto();
__jsb_cc_physics_PlaneShape_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_TrimeshShape_proto = nullptr;
se::Class* __jsb_cc_physics_TrimeshShape_class = nullptr;
se::Object* __jsb_cc_physics_TrimeshShape_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_TrimeshShape_class = nullptr; // NOLINT
static bool js_physics_TrimeshShape_getAABB(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -2895,7 +2809,7 @@ static bool js_physics_TrimeshShape_getAABB(se::State& s) // NOLINT(readability-
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::AABB& result = cobj->getAABB();
cc::geometry::AABB& result = cobj->getAABB();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_getAABB : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -2914,7 +2828,7 @@ static bool js_physics_TrimeshShape_getBoundingSphere(se::State& s) // NOLINT(re
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::Sphere& result = cobj->getBoundingSphere();
cc::geometry::Sphere& result = cobj->getBoundingSphere();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_getBoundingSphere : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -2990,7 +2904,7 @@ static bool js_physics_TrimeshShape_initialize(se::State& s) // NOLINT(readabili
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_TrimeshShape_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -3216,24 +3130,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_TrimeshShape_finalize)
static bool js_physics_TrimeshShape_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::TrimeshShape* cobj = JSB_ALLOC(cc::physics::TrimeshShape);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::TrimeshShape);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_TrimeshShape_constructor, __jsb_cc_physics_TrimeshShape_class, js_cc_physics_TrimeshShape_finalize)
static bool js_cc_physics_TrimeshShape_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::TrimeshShape>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::TrimeshShape>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_TrimeshShape_finalize)
@@ -3266,11 +3170,12 @@ bool js_register_physics_TrimeshShape(se::Object* obj) // NOLINT(readability-ide
__jsb_cc_physics_TrimeshShape_proto = cls->getProto();
__jsb_cc_physics_TrimeshShape_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_CylinderShape_proto = nullptr;
se::Class* __jsb_cc_physics_CylinderShape_class = nullptr;
se::Object* __jsb_cc_physics_CylinderShape_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_CylinderShape_class = nullptr; // NOLINT
static bool js_physics_CylinderShape_getAABB(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -3280,7 +3185,7 @@ static bool js_physics_CylinderShape_getAABB(se::State& s) // NOLINT(readability
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::AABB& result = cobj->getAABB();
cc::geometry::AABB& result = cobj->getAABB();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_getAABB : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -3299,7 +3204,7 @@ static bool js_physics_CylinderShape_getBoundingSphere(se::State& s) // NOLINT(r
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::Sphere& result = cobj->getBoundingSphere();
cc::geometry::Sphere& result = cobj->getBoundingSphere();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_getBoundingSphere : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -3375,7 +3280,7 @@ static bool js_physics_CylinderShape_initialize(se::State& s) // NOLINT(readabil
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_CylinderShape_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -3605,24 +3510,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_CylinderShape_finalize)
static bool js_physics_CylinderShape_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::CylinderShape* cobj = JSB_ALLOC(cc::physics::CylinderShape);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::CylinderShape);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_CylinderShape_constructor, __jsb_cc_physics_CylinderShape_class, js_cc_physics_CylinderShape_finalize)
static bool js_cc_physics_CylinderShape_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::CylinderShape>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::CylinderShape>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_CylinderShape_finalize)
@@ -3655,11 +3550,12 @@ bool js_register_physics_CylinderShape(se::Object* obj) // NOLINT(readability-id
__jsb_cc_physics_CylinderShape_proto = cls->getProto();
__jsb_cc_physics_CylinderShape_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_ConeShape_proto = nullptr;
se::Class* __jsb_cc_physics_ConeShape_class = nullptr;
se::Object* __jsb_cc_physics_ConeShape_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_ConeShape_class = nullptr; // NOLINT
static bool js_physics_ConeShape_getAABB(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -3669,7 +3565,7 @@ static bool js_physics_ConeShape_getAABB(se::State& s) // NOLINT(readability-ide
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::AABB& result = cobj->getAABB();
cc::geometry::AABB& result = cobj->getAABB();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_ConeShape_getAABB : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -3688,7 +3584,7 @@ static bool js_physics_ConeShape_getBoundingSphere(se::State& s) // NOLINT(reada
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::Sphere& result = cobj->getBoundingSphere();
cc::geometry::Sphere& result = cobj->getBoundingSphere();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_ConeShape_getBoundingSphere : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -3764,7 +3660,7 @@ static bool js_physics_ConeShape_initialize(se::State& s) // NOLINT(readability-
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_ConeShape_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -3994,24 +3890,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_ConeShape_finalize)
static bool js_physics_ConeShape_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::ConeShape* cobj = JSB_ALLOC(cc::physics::ConeShape);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::ConeShape);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_ConeShape_constructor, __jsb_cc_physics_ConeShape_class, js_cc_physics_ConeShape_finalize)
static bool js_cc_physics_ConeShape_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::ConeShape>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::ConeShape>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_ConeShape_finalize)
@@ -4044,11 +3930,12 @@ bool js_register_physics_ConeShape(se::Object* obj) // NOLINT(readability-identi
__jsb_cc_physics_ConeShape_proto = cls->getProto();
__jsb_cc_physics_ConeShape_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_TerrainShape_proto = nullptr;
se::Class* __jsb_cc_physics_TerrainShape_class = nullptr;
se::Object* __jsb_cc_physics_TerrainShape_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_TerrainShape_class = nullptr; // NOLINT
static bool js_physics_TerrainShape_getAABB(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -4058,7 +3945,7 @@ static bool js_physics_TerrainShape_getAABB(se::State& s) // NOLINT(readability-
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::AABB& result = cobj->getAABB();
cc::geometry::AABB& result = cobj->getAABB();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_getAABB : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -4077,7 +3964,7 @@ static bool js_physics_TerrainShape_getBoundingSphere(se::State& s) // NOLINT(re
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
cc::scene::Sphere& result = cobj->getBoundingSphere();
cc::geometry::Sphere& result = cobj->getBoundingSphere();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_getBoundingSphere : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
@@ -4153,7 +4040,7 @@ static bool js_physics_TerrainShape_initialize(se::State& s) // NOLINT(readabili
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
HolderType<cc::scene::Node*, false> arg0 = {};
HolderType<cc::Node*, false> arg0 = {};
ok &= sevalue_to_native(args[0], &arg0, s.thisObject());
SE_PRECONDITION2(ok, false, "js_physics_TerrainShape_initialize : Error processing arguments");
cobj->initialize(arg0.value());
@@ -4366,24 +4253,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_TerrainShape_finalize)
static bool js_physics_TerrainShape_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::TerrainShape* cobj = JSB_ALLOC(cc::physics::TerrainShape);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::TerrainShape);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_TerrainShape_constructor, __jsb_cc_physics_TerrainShape_class, js_cc_physics_TerrainShape_finalize)
static bool js_cc_physics_TerrainShape_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::TerrainShape>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::TerrainShape>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_TerrainShape_finalize)
@@ -4415,11 +4292,12 @@ bool js_register_physics_TerrainShape(se::Object* obj) // NOLINT(readability-ide
__jsb_cc_physics_TerrainShape_proto = cls->getProto();
__jsb_cc_physics_TerrainShape_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
se::Object* __jsb_cc_physics_World_proto = nullptr;
se::Class* __jsb_cc_physics_World_class = nullptr;
se::Object* __jsb_cc_physics_World_proto = nullptr; // NOLINT
se::Class* __jsb_cc_physics_World_class = nullptr; // NOLINT
static bool js_physics_World_createConvex(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -4785,24 +4663,14 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_physics_World_finalize)
static bool js_physics_World_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::physics::World* cobj = JSB_ALLOC(cc::physics::World);
s.thisObject()->setPrivateData(cobj);
se::NonRefNativePtrCreatedByCtorMap::emplace(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::physics::World);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_physics_World_constructor, __jsb_cc_physics_World_class, js_cc_physics_World_finalize)
static bool js_cc_physics_World_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
auto iter = se::NonRefNativePtrCreatedByCtorMap::find(SE_THIS_OBJECT<cc::physics::World>(s));
if (iter != se::NonRefNativePtrCreatedByCtorMap::end())
{
se::NonRefNativePtrCreatedByCtorMap::erase(iter);
auto* cobj = SE_THIS_OBJECT<cc::physics::World>(s);
JSB_FREE(cobj);
}
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_physics_World_finalize)
@@ -4836,14 +4704,15 @@ bool js_register_physics_World(se::Object* obj) // NOLINT(readability-identifier
__jsb_cc_physics_World_proto = cls->getProto();
__jsb_cc_physics_World_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_physics(se::Object* obj)
bool register_all_physics(se::Object* obj) // NOLINT
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("jsb.physics", &nsVal))
if (!obj->getProperty("jsb.physics", &nsVal, true))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
@@ -4851,18 +4720,19 @@ bool register_all_physics(se::Object* obj)
}
se::Object* ns = nsVal.toObject();
js_register_physics_RevoluteJoint(ns);
js_register_physics_DistanceJoint(ns);
js_register_physics_RigidBody(ns);
js_register_physics_SphereShape(ns);
js_register_physics_BoxShape(ns);
js_register_physics_CapsuleShape(ns);
js_register_physics_PlaneShape(ns);
js_register_physics_TrimeshShape(ns);
js_register_physics_CylinderShape(ns);
js_register_physics_ConeShape(ns);
js_register_physics_CylinderShape(ns);
js_register_physics_DistanceJoint(ns);
js_register_physics_PlaneShape(ns);
js_register_physics_RevoluteJoint(ns);
js_register_physics_RigidBody(ns);
js_register_physics_SphereShape(ns);
js_register_physics_TerrainShape(ns);
js_register_physics_TrimeshShape(ns);
js_register_physics_World(ns);
return true;
}
// clang-format on
+54 -86
View File
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
@@ -32,13 +8,27 @@
#include "cocos/bindings/auto/jsb_scene_auto.h"
#include "cocos/physics/PhysicsSDK.h"
extern se::Object* __jsb_cc_physics_RevoluteJoint_proto;
extern se::Class* __jsb_cc_physics_RevoluteJoint_class;
bool js_register_cc_physics_RevoluteJoint(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool register_all_physics(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::RevoluteJoint);
JSB_REGISTER_OBJECT_TYPE(cc::physics::DistanceJoint);
JSB_REGISTER_OBJECT_TYPE(cc::physics::RigidBody);
JSB_REGISTER_OBJECT_TYPE(cc::physics::SphereShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::BoxShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::CapsuleShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::PlaneShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::TrimeshShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::CylinderShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::ConeShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::TerrainShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::World);
extern se::Object *__jsb_cc_physics_RevoluteJoint_proto; // NOLINT
extern se::Class * __jsb_cc_physics_RevoluteJoint_class; // NOLINT
bool js_register_cc_physics_RevoluteJoint(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_RevoluteJoint_getImpl);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_initialize);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_onDestroy);
@@ -51,13 +41,11 @@ SE_DECLARE_FUNC(js_physics_RevoluteJoint_setPivotA);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_setPivotB);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_RevoluteJoint);
extern se::Object* __jsb_cc_physics_DistanceJoint_proto;
extern se::Class* __jsb_cc_physics_DistanceJoint_class;
extern se::Object *__jsb_cc_physics_DistanceJoint_proto; // NOLINT
extern se::Class * __jsb_cc_physics_DistanceJoint_class; // NOLINT
bool js_register_cc_physics_DistanceJoint(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_DistanceJoint(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::DistanceJoint);
SE_DECLARE_FUNC(js_physics_DistanceJoint_getImpl);
SE_DECLARE_FUNC(js_physics_DistanceJoint_initialize);
SE_DECLARE_FUNC(js_physics_DistanceJoint_onDestroy);
@@ -69,13 +57,11 @@ SE_DECLARE_FUNC(js_physics_DistanceJoint_setPivotA);
SE_DECLARE_FUNC(js_physics_DistanceJoint_setPivotB);
SE_DECLARE_FUNC(js_physics_DistanceJoint_DistanceJoint);
extern se::Object* __jsb_cc_physics_RigidBody_proto;
extern se::Class* __jsb_cc_physics_RigidBody_class;
extern se::Object *__jsb_cc_physics_RigidBody_proto; // NOLINT
extern se::Class * __jsb_cc_physics_RigidBody_class; // NOLINT
bool js_register_cc_physics_RigidBody(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_RigidBody(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::RigidBody);
SE_DECLARE_FUNC(js_physics_RigidBody_applyForce);
SE_DECLARE_FUNC(js_physics_RigidBody_applyImpulse);
SE_DECLARE_FUNC(js_physics_RigidBody_applyLocalForce);
@@ -117,13 +103,11 @@ SE_DECLARE_FUNC(js_physics_RigidBody_useGravity);
SE_DECLARE_FUNC(js_physics_RigidBody_wakeUp);
SE_DECLARE_FUNC(js_physics_RigidBody_RigidBody);
extern se::Object* __jsb_cc_physics_SphereShape_proto;
extern se::Class* __jsb_cc_physics_SphereShape_class;
extern se::Object *__jsb_cc_physics_SphereShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_SphereShape_class; // NOLINT
bool js_register_cc_physics_SphereShape(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_SphereShape(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::SphereShape);
SE_DECLARE_FUNC(js_physics_SphereShape_getAABB);
SE_DECLARE_FUNC(js_physics_SphereShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_SphereShape_getGroup);
@@ -142,13 +126,11 @@ SE_DECLARE_FUNC(js_physics_SphereShape_setRadius);
SE_DECLARE_FUNC(js_physics_SphereShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_SphereShape_SphereShape);
extern se::Object* __jsb_cc_physics_BoxShape_proto;
extern se::Class* __jsb_cc_physics_BoxShape_class;
extern se::Object *__jsb_cc_physics_BoxShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_BoxShape_class; // NOLINT
bool js_register_cc_physics_BoxShape(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_BoxShape(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::BoxShape);
SE_DECLARE_FUNC(js_physics_BoxShape_getAABB);
SE_DECLARE_FUNC(js_physics_BoxShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_BoxShape_getGroup);
@@ -167,13 +149,11 @@ SE_DECLARE_FUNC(js_physics_BoxShape_setSize);
SE_DECLARE_FUNC(js_physics_BoxShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_BoxShape_BoxShape);
extern se::Object* __jsb_cc_physics_CapsuleShape_proto;
extern se::Class* __jsb_cc_physics_CapsuleShape_class;
extern se::Object *__jsb_cc_physics_CapsuleShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_CapsuleShape_class; // NOLINT
bool js_register_cc_physics_CapsuleShape(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_CapsuleShape(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::CapsuleShape);
SE_DECLARE_FUNC(js_physics_CapsuleShape_getAABB);
SE_DECLARE_FUNC(js_physics_CapsuleShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_CapsuleShape_getGroup);
@@ -194,13 +174,11 @@ SE_DECLARE_FUNC(js_physics_CapsuleShape_setRadius);
SE_DECLARE_FUNC(js_physics_CapsuleShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_CapsuleShape_CapsuleShape);
extern se::Object* __jsb_cc_physics_PlaneShape_proto;
extern se::Class* __jsb_cc_physics_PlaneShape_class;
extern se::Object *__jsb_cc_physics_PlaneShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_PlaneShape_class; // NOLINT
bool js_register_cc_physics_PlaneShape(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_PlaneShape(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::PlaneShape);
SE_DECLARE_FUNC(js_physics_PlaneShape_getAABB);
SE_DECLARE_FUNC(js_physics_PlaneShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_PlaneShape_getGroup);
@@ -220,13 +198,11 @@ SE_DECLARE_FUNC(js_physics_PlaneShape_setNormal);
SE_DECLARE_FUNC(js_physics_PlaneShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_PlaneShape_PlaneShape);
extern se::Object* __jsb_cc_physics_TrimeshShape_proto;
extern se::Class* __jsb_cc_physics_TrimeshShape_class;
extern se::Object *__jsb_cc_physics_TrimeshShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_TrimeshShape_class; // NOLINT
bool js_register_cc_physics_TrimeshShape(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_TrimeshShape(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::TrimeshShape);
SE_DECLARE_FUNC(js_physics_TrimeshShape_getAABB);
SE_DECLARE_FUNC(js_physics_TrimeshShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_TrimeshShape_getGroup);
@@ -246,13 +222,11 @@ SE_DECLARE_FUNC(js_physics_TrimeshShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_TrimeshShape_useConvex);
SE_DECLARE_FUNC(js_physics_TrimeshShape_TrimeshShape);
extern se::Object* __jsb_cc_physics_CylinderShape_proto;
extern se::Class* __jsb_cc_physics_CylinderShape_class;
extern se::Object *__jsb_cc_physics_CylinderShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_CylinderShape_class; // NOLINT
bool js_register_cc_physics_CylinderShape(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_CylinderShape(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::CylinderShape);
SE_DECLARE_FUNC(js_physics_CylinderShape_getAABB);
SE_DECLARE_FUNC(js_physics_CylinderShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_CylinderShape_getGroup);
@@ -272,13 +246,11 @@ SE_DECLARE_FUNC(js_physics_CylinderShape_setMaterial);
SE_DECLARE_FUNC(js_physics_CylinderShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_CylinderShape_CylinderShape);
extern se::Object* __jsb_cc_physics_ConeShape_proto;
extern se::Class* __jsb_cc_physics_ConeShape_class;
extern se::Object *__jsb_cc_physics_ConeShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_ConeShape_class; // NOLINT
bool js_register_cc_physics_ConeShape(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_ConeShape(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::ConeShape);
SE_DECLARE_FUNC(js_physics_ConeShape_getAABB);
SE_DECLARE_FUNC(js_physics_ConeShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_ConeShape_getGroup);
@@ -298,13 +270,11 @@ SE_DECLARE_FUNC(js_physics_ConeShape_setMaterial);
SE_DECLARE_FUNC(js_physics_ConeShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_ConeShape_ConeShape);
extern se::Object* __jsb_cc_physics_TerrainShape_proto;
extern se::Class* __jsb_cc_physics_TerrainShape_class;
extern se::Object *__jsb_cc_physics_TerrainShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_TerrainShape_class; // NOLINT
bool js_register_cc_physics_TerrainShape(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_TerrainShape(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::TerrainShape);
SE_DECLARE_FUNC(js_physics_TerrainShape_getAABB);
SE_DECLARE_FUNC(js_physics_TerrainShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_TerrainShape_getGroup);
@@ -323,13 +293,11 @@ SE_DECLARE_FUNC(js_physics_TerrainShape_setTerrain);
SE_DECLARE_FUNC(js_physics_TerrainShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_TerrainShape_TerrainShape);
extern se::Object* __jsb_cc_physics_World_proto;
extern se::Class* __jsb_cc_physics_World_class;
extern se::Object *__jsb_cc_physics_World_proto; // NOLINT
extern se::Class * __jsb_cc_physics_World_class; // NOLINT
bool js_register_cc_physics_World(se::Object* obj);
bool register_all_physics(se::Object* obj);
bool js_register_cc_physics_World(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::World);
SE_DECLARE_FUNC(js_physics_World_createConvex);
SE_DECLARE_FUNC(js_physics_World_createHeightField);
SE_DECLARE_FUNC(js_physics_World_createMaterial);
@@ -349,4 +317,4 @@ SE_DECLARE_FUNC(js_physics_World_step);
SE_DECLARE_FUNC(js_physics_World_syncSceneToPhysics);
SE_DECLARE_FUNC(js_physics_World_syncSceneWithCheck);
SE_DECLARE_FUNC(js_physics_World_World);
// clang-format on
File diff suppressed because it is too large Load Diff
+181 -149
View File
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
@@ -30,6 +6,7 @@
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/auto/jsb_gfx_auto.h"
#include "cocos/bindings/auto/jsb_scene_auto.h"
#include "cocos/bindings/auto/jsb_assets_auto.h"
#include "cocos/renderer/pipeline/forward/ForwardPipeline.h"
#include "cocos/renderer/pipeline/forward/ForwardFlow.h"
#include "cocos/renderer/pipeline/forward/ForwardStage.h"
@@ -47,25 +24,60 @@
#include "cocos/renderer/pipeline/deferred/LightingStage.h"
#include "cocos/renderer/pipeline/deferred/BloomStage.h"
#include "cocos/renderer/pipeline/deferred/PostProcessStage.h"
#include "cocos/renderer/pipeline/PipelineSceneData.h"
#include "cocos/renderer/pipeline/BatchedBuffer.h"
#include "cocos/renderer/pipeline/GeometryRenderer.h"
extern se::Object* __jsb_cc_pipeline_RenderQueueDesc_proto;
extern se::Class* __jsb_cc_pipeline_RenderQueueDesc_class;
bool register_all_pipeline(se::Object *obj); // NOLINT
bool js_register_cc_pipeline_RenderQueueDesc(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
template<>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderQueueDesc *, se::Object *ctx);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderObject);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderQueueDesc);
extern se::Object* __jsb_cc_pipeline_GlobalDSManager_proto;
extern se::Class* __jsb_cc_pipeline_GlobalDSManager_class;
bool js_register_cc_pipeline_GlobalDSManager(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::GlobalDSManager);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::PipelineSceneData);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderPipelineInfo);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderPipeline);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ForwardPipeline);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderFlowInfo);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderFlow);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ForwardFlow);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderStageInfo);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderStage);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ForwardStage);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ShadowFlow);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ShadowStage);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::InstancedBuffer);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::DeferredPipeline);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::MainFlow);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::GbufferStage);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::LightingStage);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::BloomStage);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::PostProcessStage);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::BatchedItem);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::BatchedBuffer);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::GeometryRenderer);
extern se::Object *__jsb_cc_pipeline_RenderObject_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_RenderObject_class; // NOLINT
bool js_register_cc_pipeline_RenderObject(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderObject *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_pipeline_RenderQueueDesc_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_RenderQueueDesc_class; // NOLINT
bool js_register_cc_pipeline_RenderQueueDesc(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderQueueDesc *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_pipeline_GlobalDSManager_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_GlobalDSManager_class; // NOLINT
bool js_register_cc_pipeline_GlobalDSManager(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_bindBuffer);
SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_bindSampler);
SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_bindTexture);
@@ -76,234 +88,254 @@ SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getLinearSampler);
SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getOrCreateDescriptorSet);
SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_getPointSampler);
SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_update);
SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_setDescriptorSetLayout);
SE_DECLARE_FUNC(js_pipeline_GlobalDSManager_GlobalDSManager);
extern se::Object* __jsb_cc_pipeline_RenderPipelineInfo_proto;
extern se::Class* __jsb_cc_pipeline_RenderPipelineInfo_class;
extern se::Object *__jsb_cc_pipeline_PipelineSceneData_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_PipelineSceneData_class; // NOLINT
bool js_register_cc_pipeline_RenderPipelineInfo(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_PipelineSceneData(se::Object *obj); // NOLINT
template<>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderPipelineInfo *, se::Object *ctx);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderPipelineInfo);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_activate);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_addRenderObject);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_addValidPunctualLight);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_clearRenderObjects);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_clearValidPunctualLights);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_destroy);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getDirShadowObjects);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getGeometryRendererMaterials);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getGeometryRendererPasses);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getGeometryRendererShaders);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getMatShadowProj);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getMatShadowView);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getMatShadowViewProj);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getOcclusionQueryInputAssembler);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getOcclusionQueryPass);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getOcclusionQueryShader);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getOctree);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getShadowCameraFar);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_getValidPunctualLights);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_isCastShadowObjects);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_onGlobalPipelineStateChanged);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_setCastShadowObjects);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_setDirShadowObjects);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_setMatShadowProj);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_setMatShadowView);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_setMatShadowViewProj);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_setShadowCameraFar);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_setShadowFramebuffer);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_setValidPunctualLights);
SE_DECLARE_FUNC(js_pipeline_PipelineSceneData_PipelineSceneData);
extern se::Object* __jsb_cc_pipeline_RenderPipeline_proto;
extern se::Class* __jsb_cc_pipeline_RenderPipeline_class;
extern se::Object *__jsb_cc_pipeline_RenderPipelineInfo_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_RenderPipelineInfo_class; // NOLINT
bool js_register_cc_pipeline_RenderPipeline(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_RenderPipelineInfo(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderPipelineInfo *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_pipeline_RenderPipeline_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_RenderPipeline_class; // NOLINT
bool js_register_cc_pipeline_RenderPipeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderPipeline);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_activate);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_createQuadInputAssembler);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_destroy);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_ensureEnoughSize);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_genQuadVertexData);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getClearcolor);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getDevice);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getFrameGraph);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getGeometryRenderer);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getHeight);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getIAByRenderArea);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getOcclusionQueryEnabled);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getProfiler);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getQueryPools);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getRenderstageByName);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getScissor);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getViewport);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getWidth);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_initialize);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_isBloomEnabled);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_isClusterEnabled);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_isEnvmapEnabled);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_isOccluded);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_isOcclusionQueryEnabled);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_render);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setGeometryRenderer);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setOcclusionQueryEnabled);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setPipelineSharedSceneData);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setProfiler);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_setValue);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_updateQuadVertexData);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getInstance);
SE_DECLARE_FUNC(js_pipeline_RenderPipeline_getRenderArea);
extern se::Object* __jsb_cc_pipeline_ForwardPipeline_proto;
extern se::Class* __jsb_cc_pipeline_ForwardPipeline_class;
extern se::Object *__jsb_cc_pipeline_ForwardPipeline_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_ForwardPipeline_class; // NOLINT
bool js_register_cc_pipeline_ForwardPipeline(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_ForwardPipeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ForwardPipeline);
SE_DECLARE_FUNC(js_pipeline_ForwardPipeline_ForwardPipeline);
extern se::Object* __jsb_cc_pipeline_RenderFlowInfo_proto;
extern se::Class* __jsb_cc_pipeline_RenderFlowInfo_class;
extern se::Object *__jsb_cc_pipeline_RenderFlowInfo_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_RenderFlowInfo_class; // NOLINT
bool js_register_cc_pipeline_RenderFlowInfo(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_RenderFlowInfo(se::Object *obj); // NOLINT
template<>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderFlowInfo *, se::Object *ctx);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderFlowInfo);
template <>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderFlowInfo *, se::Object *ctx); //NOLINT
extern se::Object* __jsb_cc_pipeline_RenderFlow_proto;
extern se::Class* __jsb_cc_pipeline_RenderFlow_class;
extern se::Object *__jsb_cc_pipeline_RenderFlow_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_RenderFlow_class; // NOLINT
bool js_register_cc_pipeline_RenderFlow(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_RenderFlow(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderFlow);
SE_DECLARE_FUNC(js_pipeline_RenderFlow_activate);
SE_DECLARE_FUNC(js_pipeline_RenderFlow_getRenderstageByName);
SE_DECLARE_FUNC(js_pipeline_RenderFlow_getTag);
SE_DECLARE_FUNC(js_pipeline_RenderFlow_initialize);
extern se::Object* __jsb_cc_pipeline_ForwardFlow_proto;
extern se::Class* __jsb_cc_pipeline_ForwardFlow_class;
extern se::Object *__jsb_cc_pipeline_ForwardFlow_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_ForwardFlow_class; // NOLINT
bool js_register_cc_pipeline_ForwardFlow(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_ForwardFlow(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ForwardFlow);
SE_DECLARE_FUNC(js_pipeline_ForwardFlow_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_ForwardFlow_ForwardFlow);
extern se::Object* __jsb_cc_pipeline_RenderStageInfo_proto;
extern se::Class* __jsb_cc_pipeline_RenderStageInfo_class;
extern se::Object *__jsb_cc_pipeline_RenderStageInfo_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_RenderStageInfo_class; // NOLINT
bool js_register_cc_pipeline_RenderStageInfo(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_RenderStageInfo(se::Object *obj); // NOLINT
template<>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderStageInfo *, se::Object *ctx);
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderStageInfo);
template <>
bool sevalue_to_native(const se::Value &, cc::pipeline::RenderStageInfo *, se::Object *ctx); //NOLINT
extern se::Object* __jsb_cc_pipeline_RenderStage_proto;
extern se::Class* __jsb_cc_pipeline_RenderStage_class;
extern se::Object *__jsb_cc_pipeline_RenderStage_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_RenderStage_class; // NOLINT
bool js_register_cc_pipeline_RenderStage(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_RenderStage(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::RenderStage);
SE_DECLARE_FUNC(js_pipeline_RenderStage_activate);
SE_DECLARE_FUNC(js_pipeline_RenderStage_getFlow);
SE_DECLARE_FUNC(js_pipeline_RenderStage_getTag);
SE_DECLARE_FUNC(js_pipeline_RenderStage_initialize);
extern se::Object* __jsb_cc_pipeline_ForwardStage_proto;
extern se::Class* __jsb_cc_pipeline_ForwardStage_class;
extern se::Object *__jsb_cc_pipeline_ForwardStage_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_ForwardStage_class; // NOLINT
bool js_register_cc_pipeline_ForwardStage(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_ForwardStage(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ForwardStage);
SE_DECLARE_FUNC(js_pipeline_ForwardStage_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_ForwardStage_ForwardStage);
extern se::Object* __jsb_cc_pipeline_ShadowFlow_proto;
extern se::Class* __jsb_cc_pipeline_ShadowFlow_class;
extern se::Object *__jsb_cc_pipeline_ShadowFlow_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_ShadowFlow_class; // NOLINT
bool js_register_cc_pipeline_ShadowFlow(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_ShadowFlow(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ShadowFlow);
SE_DECLARE_FUNC(js_pipeline_ShadowFlow_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_ShadowFlow_ShadowFlow);
extern se::Object* __jsb_cc_pipeline_ShadowStage_proto;
extern se::Class* __jsb_cc_pipeline_ShadowStage_class;
extern se::Object *__jsb_cc_pipeline_ShadowStage_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_ShadowStage_class; // NOLINT
bool js_register_cc_pipeline_ShadowStage(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_ShadowStage(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::ShadowStage);
SE_DECLARE_FUNC(js_pipeline_ShadowStage_setFramebuffer);
SE_DECLARE_FUNC(js_pipeline_ShadowStage_setUsage);
SE_DECLARE_FUNC(js_pipeline_ShadowStage_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_ShadowStage_ShadowStage);
extern se::Object* __jsb_cc_pipeline_InstancedBuffer_proto;
extern se::Class* __jsb_cc_pipeline_InstancedBuffer_class;
extern se::Object *__jsb_cc_pipeline_InstancedBuffer_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_InstancedBuffer_class; // NOLINT
bool js_register_cc_pipeline_InstancedBuffer(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_InstancedBuffer(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::InstancedBuffer);
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_destroy);
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_setDynamicOffset);
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_get);
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_destroyInstancedBuffer);
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_get);
SE_DECLARE_FUNC(js_pipeline_InstancedBuffer_InstancedBuffer);
extern se::Object* __jsb_cc_pipeline_DeferredPipeline_proto;
extern se::Class* __jsb_cc_pipeline_DeferredPipeline_class;
extern se::Object *__jsb_cc_pipeline_DeferredPipeline_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_DeferredPipeline_class; // NOLINT
bool js_register_cc_pipeline_DeferredPipeline(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_DeferredPipeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::DeferredPipeline);
SE_DECLARE_FUNC(js_pipeline_DeferredPipeline_DeferredPipeline);
extern se::Object* __jsb_cc_pipeline_MainFlow_proto;
extern se::Class* __jsb_cc_pipeline_MainFlow_class;
extern se::Object *__jsb_cc_pipeline_MainFlow_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_MainFlow_class; // NOLINT
bool js_register_cc_pipeline_MainFlow(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_MainFlow(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::MainFlow);
SE_DECLARE_FUNC(js_pipeline_MainFlow_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_MainFlow_MainFlow);
extern se::Object* __jsb_cc_pipeline_GbufferStage_proto;
extern se::Class* __jsb_cc_pipeline_GbufferStage_class;
extern se::Object *__jsb_cc_pipeline_GbufferStage_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_GbufferStage_class; // NOLINT
bool js_register_cc_pipeline_GbufferStage(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_GbufferStage(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::GbufferStage);
SE_DECLARE_FUNC(js_pipeline_GbufferStage_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_GbufferStage_GbufferStage);
extern se::Object* __jsb_cc_pipeline_LightingStage_proto;
extern se::Class* __jsb_cc_pipeline_LightingStage_class;
extern se::Object *__jsb_cc_pipeline_LightingStage_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_LightingStage_class; // NOLINT
bool js_register_cc_pipeline_LightingStage(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_LightingStage(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::LightingStage);
SE_DECLARE_FUNC(js_pipeline_LightingStage_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_LightingStage_LightingStage);
extern se::Object* __jsb_cc_pipeline_BloomStage_proto;
extern se::Class* __jsb_cc_pipeline_BloomStage_class;
extern se::Object *__jsb_cc_pipeline_BloomStage_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_BloomStage_class; // NOLINT
bool js_register_cc_pipeline_BloomStage(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_BloomStage(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::BloomStage);
SE_DECLARE_FUNC(js_pipeline_BloomStage_getCombineUBO);
SE_DECLARE_FUNC(js_pipeline_BloomStage_getDownsampelUBO);
SE_DECLARE_FUNC(js_pipeline_BloomStage_getDownsampleUBO);
SE_DECLARE_FUNC(js_pipeline_BloomStage_getPrefilterUBO);
SE_DECLARE_FUNC(js_pipeline_BloomStage_getSampler);
SE_DECLARE_FUNC(js_pipeline_BloomStage_getUpsampleUBO);
SE_DECLARE_FUNC(js_pipeline_BloomStage_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_BloomStage_BloomStage);
extern se::Object* __jsb_cc_pipeline_PostProcessStage_proto;
extern se::Class* __jsb_cc_pipeline_PostProcessStage_class;
extern se::Object *__jsb_cc_pipeline_PostProcessStage_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_PostProcessStage_class; // NOLINT
bool js_register_cc_pipeline_PostProcessStage(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_PostProcessStage(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::PostProcessStage);
SE_DECLARE_FUNC(js_pipeline_PostProcessStage_getInitializeInfo);
SE_DECLARE_FUNC(js_pipeline_PostProcessStage_PostProcessStage);
extern se::Object* __jsb_cc_pipeline_GeometryRenderer_proto;
extern se::Class* __jsb_cc_pipeline_GeometryRenderer_class;
extern se::Object *__jsb_cc_pipeline_BatchedItem_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_BatchedItem_class; // NOLINT
bool js_register_cc_pipeline_GeometryRenderer(se::Object* obj);
bool register_all_pipeline(se::Object* obj);
bool js_register_cc_pipeline_BatchedItem(se::Object *obj); // NOLINT
template <>
bool sevalue_to_native(const se::Value &, cc::pipeline::BatchedItem *, se::Object *ctx); //NOLINT
extern se::Object *__jsb_cc_pipeline_BatchedBuffer_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_BatchedBuffer_class; // NOLINT
bool js_register_cc_pipeline_BatchedBuffer(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_clear);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_destroy);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_getBatches);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_getDynamicOffset);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_getPass);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_merge);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_setDynamicOffset);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_destroyBatchedBuffer);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_get);
SE_DECLARE_FUNC(js_pipeline_BatchedBuffer_BatchedBuffer);
extern se::Object *__jsb_cc_pipeline_GeometryRenderer_proto; // NOLINT
extern se::Class * __jsb_cc_pipeline_GeometryRenderer_class; // NOLINT
bool js_register_cc_pipeline_GeometryRenderer(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::pipeline::GeometryRenderer);
SE_DECLARE_FUNC(js_pipeline_GeometryRenderer_GeometryRenderer);
// clang-format on
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+237 -314
View File
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#include <type_traits>
@@ -30,26 +6,83 @@
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/editor-support/spine-creator-support/spine-cocos2dx.h"
extern se::Object* __jsb_spine_Animation_proto;
extern se::Class* __jsb_spine_Animation_class;
bool js_register_spine_Animation(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool register_all_spine(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Animation);
JSB_REGISTER_OBJECT_TYPE(spine::TrackEntry);
JSB_REGISTER_OBJECT_TYPE(spine::AnimationState);
JSB_REGISTER_OBJECT_TYPE(spine::AnimationStateData);
JSB_REGISTER_OBJECT_TYPE(spine::Attachment);
JSB_REGISTER_OBJECT_TYPE(spine::Timeline);
JSB_REGISTER_OBJECT_TYPE(spine::AttachmentTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::Bone);
JSB_REGISTER_OBJECT_TYPE(spine::BoneData);
JSB_REGISTER_OBJECT_TYPE(spine::VertexAttachment);
JSB_REGISTER_OBJECT_TYPE(spine::BoundingBoxAttachment);
JSB_REGISTER_OBJECT_TYPE(spine::ClippingAttachment);
JSB_REGISTER_OBJECT_TYPE(spine::Color);
JSB_REGISTER_OBJECT_TYPE(spine::CurveTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::ColorTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::ConstraintData);
JSB_REGISTER_OBJECT_TYPE(spine::DeformTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::DrawOrderTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::Event);
JSB_REGISTER_OBJECT_TYPE(spine::EventData);
JSB_REGISTER_OBJECT_TYPE(spine::EventTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::IkConstraint);
JSB_REGISTER_OBJECT_TYPE(spine::IkConstraintData);
JSB_REGISTER_OBJECT_TYPE(spine::IkConstraintTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::MeshAttachment);
JSB_REGISTER_OBJECT_TYPE(spine::PathAttachment);
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraint);
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraintData);
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraintMixTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraintPositionTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraintSpacingTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::PointAttachment);
JSB_REGISTER_OBJECT_TYPE(spine::RegionAttachment);
JSB_REGISTER_OBJECT_TYPE(spine::RotateTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::TranslateTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::ScaleTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::ShearTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::Skeleton);
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonBounds);
JSB_REGISTER_OBJECT_TYPE(spine::Polygon);
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonData);
JSB_REGISTER_OBJECT_TYPE(spine::Skin);
JSB_REGISTER_OBJECT_TYPE(spine::Slot);
JSB_REGISTER_OBJECT_TYPE(spine::SlotData);
JSB_REGISTER_OBJECT_TYPE(spine::TransformConstraint);
JSB_REGISTER_OBJECT_TYPE(spine::TransformConstraintData);
JSB_REGISTER_OBJECT_TYPE(spine::TransformConstraintTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::TwoColorTimeline);
JSB_REGISTER_OBJECT_TYPE(spine::VertexEffect);
JSB_REGISTER_OBJECT_TYPE(spine::JitterVertexEffect);
JSB_REGISTER_OBJECT_TYPE(spine::SwirlVertexEffect);
JSB_REGISTER_OBJECT_TYPE(spine::VertexEffectDelegate);
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonRenderer);
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonAnimation);
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonCacheAnimation);
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonCacheMgr);
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonDataMgr);
extern se::Object *__jsb_spine_Animation_proto; // NOLINT
extern se::Class * __jsb_spine_Animation_class; // NOLINT
bool js_register_spine_Animation(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_spine_Animation_getDuration);
SE_DECLARE_FUNC(js_spine_Animation_getName);
SE_DECLARE_FUNC(js_spine_Animation_getTimelines);
SE_DECLARE_FUNC(js_spine_Animation_hasTimeline);
SE_DECLARE_FUNC(js_spine_Animation_setDuration);
extern se::Object* __jsb_spine_TrackEntry_proto;
extern se::Class* __jsb_spine_TrackEntry_class;
extern se::Object *__jsb_spine_TrackEntry_proto; // NOLINT
extern se::Class * __jsb_spine_TrackEntry_class; // NOLINT
bool js_register_spine_TrackEntry(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_TrackEntry(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::TrackEntry);
SE_DECLARE_FUNC(js_spine_TrackEntry_getAlpha);
SE_DECLARE_FUNC(js_spine_TrackEntry_getAnimation);
SE_DECLARE_FUNC(js_spine_TrackEntry_getAnimationEnd);
@@ -91,13 +124,11 @@ SE_DECLARE_FUNC(js_spine_TrackEntry_setTimeScale);
SE_DECLARE_FUNC(js_spine_TrackEntry_setTrackEnd);
SE_DECLARE_FUNC(js_spine_TrackEntry_setTrackTime);
extern se::Object* __jsb_spine_AnimationState_proto;
extern se::Class* __jsb_spine_AnimationState_class;
extern se::Object *__jsb_spine_AnimationState_proto; // NOLINT
extern se::Class * __jsb_spine_AnimationState_class; // NOLINT
bool js_register_spine_AnimationState(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_AnimationState(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::AnimationState);
SE_DECLARE_FUNC(js_spine_AnimationState_addAnimation);
SE_DECLARE_FUNC(js_spine_AnimationState_addEmptyAnimation);
SE_DECLARE_FUNC(js_spine_AnimationState_clearTrack);
@@ -114,48 +145,40 @@ SE_DECLARE_FUNC(js_spine_AnimationState_setEmptyAnimations);
SE_DECLARE_FUNC(js_spine_AnimationState_setTimeScale);
SE_DECLARE_FUNC(js_spine_AnimationState_update);
extern se::Object* __jsb_spine_AnimationStateData_proto;
extern se::Class* __jsb_spine_AnimationStateData_class;
extern se::Object *__jsb_spine_AnimationStateData_proto; // NOLINT
extern se::Class * __jsb_spine_AnimationStateData_class; // NOLINT
bool js_register_spine_AnimationStateData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_AnimationStateData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::AnimationStateData);
SE_DECLARE_FUNC(js_spine_AnimationStateData_getDefaultMix);
SE_DECLARE_FUNC(js_spine_AnimationStateData_getMix);
SE_DECLARE_FUNC(js_spine_AnimationStateData_getSkeletonData);
SE_DECLARE_FUNC(js_spine_AnimationStateData_setDefaultMix);
SE_DECLARE_FUNC(js_spine_AnimationStateData_setMix);
extern se::Object* __jsb_spine_Attachment_proto;
extern se::Class* __jsb_spine_Attachment_class;
extern se::Object *__jsb_spine_Attachment_proto; // NOLINT
extern se::Class * __jsb_spine_Attachment_class; // NOLINT
bool js_register_spine_Attachment(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Attachment(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Attachment);
SE_DECLARE_FUNC(js_spine_Attachment_copy);
SE_DECLARE_FUNC(js_spine_Attachment_dereference);
SE_DECLARE_FUNC(js_spine_Attachment_getName);
SE_DECLARE_FUNC(js_spine_Attachment_getRefCount);
SE_DECLARE_FUNC(js_spine_Attachment_reference);
extern se::Object* __jsb_spine_Timeline_proto;
extern se::Class* __jsb_spine_Timeline_class;
extern se::Object *__jsb_spine_Timeline_proto; // NOLINT
extern se::Class * __jsb_spine_Timeline_class; // NOLINT
bool js_register_spine_Timeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Timeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Timeline);
SE_DECLARE_FUNC(js_spine_Timeline_getPropertyId);
extern se::Object* __jsb_spine_AttachmentTimeline_proto;
extern se::Class* __jsb_spine_AttachmentTimeline_class;
extern se::Object *__jsb_spine_AttachmentTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_AttachmentTimeline_class; // NOLINT
bool js_register_spine_AttachmentTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_AttachmentTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::AttachmentTimeline);
SE_DECLARE_FUNC(js_spine_AttachmentTimeline_getAttachmentNames);
SE_DECLARE_FUNC(js_spine_AttachmentTimeline_getFrameCount);
SE_DECLARE_FUNC(js_spine_AttachmentTimeline_getFrames);
@@ -164,13 +187,11 @@ SE_DECLARE_FUNC(js_spine_AttachmentTimeline_getSlotIndex);
SE_DECLARE_FUNC(js_spine_AttachmentTimeline_setFrame);
SE_DECLARE_FUNC(js_spine_AttachmentTimeline_setSlotIndex);
extern se::Object* __jsb_spine_Bone_proto;
extern se::Class* __jsb_spine_Bone_class;
extern se::Object *__jsb_spine_Bone_proto; // NOLINT
extern se::Class * __jsb_spine_Bone_class; // NOLINT
bool js_register_spine_Bone(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Bone(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Bone);
SE_DECLARE_FUNC(js_spine_Bone_getA);
SE_DECLARE_FUNC(js_spine_Bone_getAScaleX);
SE_DECLARE_FUNC(js_spine_Bone_getAScaleY);
@@ -229,16 +250,14 @@ SE_DECLARE_FUNC(js_spine_Bone_setX);
SE_DECLARE_FUNC(js_spine_Bone_setY);
SE_DECLARE_FUNC(js_spine_Bone_update);
SE_DECLARE_FUNC(js_spine_Bone_updateWorldTransform);
SE_DECLARE_FUNC(js_spine_Bone_setYDown);
SE_DECLARE_FUNC(js_spine_Bone_isYDown);
SE_DECLARE_FUNC(js_spine_Bone_setYDown);
extern se::Object* __jsb_spine_BoneData_proto;
extern se::Class* __jsb_spine_BoneData_class;
extern se::Object *__jsb_spine_BoneData_proto; // NOLINT
extern se::Class * __jsb_spine_BoneData_class; // NOLINT
bool js_register_spine_BoneData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_BoneData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::BoneData);
SE_DECLARE_FUNC(js_spine_BoneData_getIndex);
SE_DECLARE_FUNC(js_spine_BoneData_getLength);
SE_DECLARE_FUNC(js_spine_BoneData_getName);
@@ -263,13 +282,11 @@ SE_DECLARE_FUNC(js_spine_BoneData_setTransformMode);
SE_DECLARE_FUNC(js_spine_BoneData_setX);
SE_DECLARE_FUNC(js_spine_BoneData_setY);
extern se::Object* __jsb_spine_VertexAttachment_proto;
extern se::Class* __jsb_spine_VertexAttachment_class;
extern se::Object *__jsb_spine_VertexAttachment_proto; // NOLINT
extern se::Class * __jsb_spine_VertexAttachment_class; // NOLINT
bool js_register_spine_VertexAttachment(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_VertexAttachment(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::VertexAttachment);
SE_DECLARE_FUNC(js_spine_VertexAttachment_copyTo);
SE_DECLARE_FUNC(js_spine_VertexAttachment_getDeformAttachment);
SE_DECLARE_FUNC(js_spine_VertexAttachment_getId);
@@ -278,42 +295,34 @@ SE_DECLARE_FUNC(js_spine_VertexAttachment_getWorldVerticesLength);
SE_DECLARE_FUNC(js_spine_VertexAttachment_setDeformAttachment);
SE_DECLARE_FUNC(js_spine_VertexAttachment_setWorldVerticesLength);
extern se::Object* __jsb_spine_BoundingBoxAttachment_proto;
extern se::Class* __jsb_spine_BoundingBoxAttachment_class;
extern se::Object *__jsb_spine_BoundingBoxAttachment_proto; // NOLINT
extern se::Class * __jsb_spine_BoundingBoxAttachment_class; // NOLINT
bool js_register_spine_BoundingBoxAttachment(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_BoundingBoxAttachment(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::BoundingBoxAttachment);
SE_DECLARE_FUNC(js_spine_BoundingBoxAttachment_copy);
extern se::Object* __jsb_spine_ClippingAttachment_proto;
extern se::Class* __jsb_spine_ClippingAttachment_class;
extern se::Object *__jsb_spine_ClippingAttachment_proto; // NOLINT
extern se::Class * __jsb_spine_ClippingAttachment_class; // NOLINT
bool js_register_spine_ClippingAttachment(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_ClippingAttachment(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::ClippingAttachment);
SE_DECLARE_FUNC(js_spine_ClippingAttachment_copy);
SE_DECLARE_FUNC(js_spine_ClippingAttachment_getEndSlot);
SE_DECLARE_FUNC(js_spine_ClippingAttachment_setEndSlot);
extern se::Object* __jsb_spine_Color_proto;
extern se::Class* __jsb_spine_Color_class;
extern se::Object *__jsb_spine_Color_proto; // NOLINT
extern se::Class * __jsb_spine_Color_class; // NOLINT
bool js_register_spine_Color(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Color(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Color);
SE_DECLARE_FUNC(js_spine_Color_clamp);
extern se::Object* __jsb_spine_CurveTimeline_proto;
extern se::Class* __jsb_spine_CurveTimeline_class;
extern se::Object *__jsb_spine_CurveTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_CurveTimeline_class; // NOLINT
bool js_register_spine_CurveTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_CurveTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::CurveTimeline);
SE_DECLARE_FUNC(js_spine_CurveTimeline_getCurvePercent);
SE_DECLARE_FUNC(js_spine_CurveTimeline_getCurveType);
SE_DECLARE_FUNC(js_spine_CurveTimeline_getFrameCount);
@@ -322,39 +331,33 @@ SE_DECLARE_FUNC(js_spine_CurveTimeline_setCurve);
SE_DECLARE_FUNC(js_spine_CurveTimeline_setLinear);
SE_DECLARE_FUNC(js_spine_CurveTimeline_setStepped);
extern se::Object* __jsb_spine_ColorTimeline_proto;
extern se::Class* __jsb_spine_ColorTimeline_class;
extern se::Object *__jsb_spine_ColorTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_ColorTimeline_class; // NOLINT
bool js_register_spine_ColorTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_ColorTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::ColorTimeline);
SE_DECLARE_FUNC(js_spine_ColorTimeline_getFrames);
SE_DECLARE_FUNC(js_spine_ColorTimeline_getPropertyId);
SE_DECLARE_FUNC(js_spine_ColorTimeline_getSlotIndex);
SE_DECLARE_FUNC(js_spine_ColorTimeline_setFrame);
SE_DECLARE_FUNC(js_spine_ColorTimeline_setSlotIndex);
extern se::Object* __jsb_spine_ConstraintData_proto;
extern se::Class* __jsb_spine_ConstraintData_class;
extern se::Object *__jsb_spine_ConstraintData_proto; // NOLINT
extern se::Class * __jsb_spine_ConstraintData_class; // NOLINT
bool js_register_spine_ConstraintData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_ConstraintData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::ConstraintData);
SE_DECLARE_FUNC(js_spine_ConstraintData_getName);
SE_DECLARE_FUNC(js_spine_ConstraintData_getOrder);
SE_DECLARE_FUNC(js_spine_ConstraintData_isSkinRequired);
SE_DECLARE_FUNC(js_spine_ConstraintData_setOrder);
SE_DECLARE_FUNC(js_spine_ConstraintData_setSkinRequired);
extern se::Object* __jsb_spine_DeformTimeline_proto;
extern se::Class* __jsb_spine_DeformTimeline_class;
extern se::Object *__jsb_spine_DeformTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_DeformTimeline_class; // NOLINT
bool js_register_spine_DeformTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_DeformTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::DeformTimeline);
SE_DECLARE_FUNC(js_spine_DeformTimeline_getAttachment);
SE_DECLARE_FUNC(js_spine_DeformTimeline_getFrames);
SE_DECLARE_FUNC(js_spine_DeformTimeline_getPropertyId);
@@ -362,24 +365,20 @@ SE_DECLARE_FUNC(js_spine_DeformTimeline_getSlotIndex);
SE_DECLARE_FUNC(js_spine_DeformTimeline_setAttachment);
SE_DECLARE_FUNC(js_spine_DeformTimeline_setSlotIndex);
extern se::Object* __jsb_spine_DrawOrderTimeline_proto;
extern se::Class* __jsb_spine_DrawOrderTimeline_class;
extern se::Object *__jsb_spine_DrawOrderTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_DrawOrderTimeline_class; // NOLINT
bool js_register_spine_DrawOrderTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_DrawOrderTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::DrawOrderTimeline);
SE_DECLARE_FUNC(js_spine_DrawOrderTimeline_getFrameCount);
SE_DECLARE_FUNC(js_spine_DrawOrderTimeline_getFrames);
SE_DECLARE_FUNC(js_spine_DrawOrderTimeline_getPropertyId);
extern se::Object* __jsb_spine_Event_proto;
extern se::Class* __jsb_spine_Event_class;
extern se::Object *__jsb_spine_Event_proto; // NOLINT
extern se::Class * __jsb_spine_Event_class; // NOLINT
bool js_register_spine_Event(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Event(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Event);
SE_DECLARE_FUNC(js_spine_Event_getBalance);
SE_DECLARE_FUNC(js_spine_Event_getData);
SE_DECLARE_FUNC(js_spine_Event_getFloatValue);
@@ -393,13 +392,11 @@ SE_DECLARE_FUNC(js_spine_Event_setIntValue);
SE_DECLARE_FUNC(js_spine_Event_setStringValue);
SE_DECLARE_FUNC(js_spine_Event_setVolume);
extern se::Object* __jsb_spine_EventData_proto;
extern se::Class* __jsb_spine_EventData_class;
extern se::Object *__jsb_spine_EventData_proto; // NOLINT
extern se::Class * __jsb_spine_EventData_class; // NOLINT
bool js_register_spine_EventData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_EventData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::EventData);
SE_DECLARE_FUNC(js_spine_EventData_getAudioPath);
SE_DECLARE_FUNC(js_spine_EventData_getBalance);
SE_DECLARE_FUNC(js_spine_EventData_getFloatValue);
@@ -414,26 +411,22 @@ SE_DECLARE_FUNC(js_spine_EventData_setIntValue);
SE_DECLARE_FUNC(js_spine_EventData_setStringValue);
SE_DECLARE_FUNC(js_spine_EventData_setVolume);
extern se::Object* __jsb_spine_EventTimeline_proto;
extern se::Class* __jsb_spine_EventTimeline_class;
extern se::Object *__jsb_spine_EventTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_EventTimeline_class; // NOLINT
bool js_register_spine_EventTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_EventTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::EventTimeline);
SE_DECLARE_FUNC(js_spine_EventTimeline_getEvents);
SE_DECLARE_FUNC(js_spine_EventTimeline_getFrameCount);
SE_DECLARE_FUNC(js_spine_EventTimeline_getFrames);
SE_DECLARE_FUNC(js_spine_EventTimeline_getPropertyId);
SE_DECLARE_FUNC(js_spine_EventTimeline_setFrame);
extern se::Object* __jsb_spine_IkConstraint_proto;
extern se::Class* __jsb_spine_IkConstraint_class;
extern se::Object *__jsb_spine_IkConstraint_proto; // NOLINT
extern se::Class * __jsb_spine_IkConstraint_class; // NOLINT
bool js_register_spine_IkConstraint(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_IkConstraint(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::IkConstraint);
SE_DECLARE_FUNC(js_spine_IkConstraint_getBendDirection);
SE_DECLARE_FUNC(js_spine_IkConstraint_getBones);
SE_DECLARE_FUNC(js_spine_IkConstraint_getCompress);
@@ -453,13 +446,11 @@ SE_DECLARE_FUNC(js_spine_IkConstraint_setStretch);
SE_DECLARE_FUNC(js_spine_IkConstraint_setTarget);
SE_DECLARE_FUNC(js_spine_IkConstraint_update);
extern se::Object* __jsb_spine_IkConstraintData_proto;
extern se::Class* __jsb_spine_IkConstraintData_class;
extern se::Object *__jsb_spine_IkConstraintData_proto; // NOLINT
extern se::Class * __jsb_spine_IkConstraintData_class; // NOLINT
bool js_register_spine_IkConstraintData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_IkConstraintData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::IkConstraintData);
SE_DECLARE_FUNC(js_spine_IkConstraintData_getBendDirection);
SE_DECLARE_FUNC(js_spine_IkConstraintData_getBones);
SE_DECLARE_FUNC(js_spine_IkConstraintData_getCompress);
@@ -476,23 +467,19 @@ SE_DECLARE_FUNC(js_spine_IkConstraintData_setStretch);
SE_DECLARE_FUNC(js_spine_IkConstraintData_setTarget);
SE_DECLARE_FUNC(js_spine_IkConstraintData_setUniform);
extern se::Object* __jsb_spine_IkConstraintTimeline_proto;
extern se::Class* __jsb_spine_IkConstraintTimeline_class;
extern se::Object *__jsb_spine_IkConstraintTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_IkConstraintTimeline_class; // NOLINT
bool js_register_spine_IkConstraintTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_IkConstraintTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::IkConstraintTimeline);
SE_DECLARE_FUNC(js_spine_IkConstraintTimeline_getPropertyId);
SE_DECLARE_FUNC(js_spine_IkConstraintTimeline_setFrame);
extern se::Object* __jsb_spine_MeshAttachment_proto;
extern se::Class* __jsb_spine_MeshAttachment_class;
extern se::Object *__jsb_spine_MeshAttachment_proto; // NOLINT
extern se::Class * __jsb_spine_MeshAttachment_class; // NOLINT
bool js_register_spine_MeshAttachment(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_MeshAttachment(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::MeshAttachment);
SE_DECLARE_FUNC(js_spine_MeshAttachment_copy);
SE_DECLARE_FUNC(js_spine_MeshAttachment_getColor);
SE_DECLARE_FUNC(js_spine_MeshAttachment_getEdges);
@@ -536,13 +523,11 @@ SE_DECLARE_FUNC(js_spine_MeshAttachment_setRegionWidth);
SE_DECLARE_FUNC(js_spine_MeshAttachment_setWidth);
SE_DECLARE_FUNC(js_spine_MeshAttachment_updateUVs);
extern se::Object* __jsb_spine_PathAttachment_proto;
extern se::Class* __jsb_spine_PathAttachment_class;
extern se::Object *__jsb_spine_PathAttachment_proto; // NOLINT
extern se::Class * __jsb_spine_PathAttachment_class; // NOLINT
bool js_register_spine_PathAttachment(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_PathAttachment(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::PathAttachment);
SE_DECLARE_FUNC(js_spine_PathAttachment_copy);
SE_DECLARE_FUNC(js_spine_PathAttachment_getLengths);
SE_DECLARE_FUNC(js_spine_PathAttachment_isClosed);
@@ -550,13 +535,11 @@ SE_DECLARE_FUNC(js_spine_PathAttachment_isConstantSpeed);
SE_DECLARE_FUNC(js_spine_PathAttachment_setClosed);
SE_DECLARE_FUNC(js_spine_PathAttachment_setConstantSpeed);
extern se::Object* __jsb_spine_PathConstraint_proto;
extern se::Class* __jsb_spine_PathConstraint_class;
extern se::Object *__jsb_spine_PathConstraint_proto; // NOLINT
extern se::Class * __jsb_spine_PathConstraint_class; // NOLINT
bool js_register_spine_PathConstraint(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_PathConstraint(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraint);
SE_DECLARE_FUNC(js_spine_PathConstraint_apply);
SE_DECLARE_FUNC(js_spine_PathConstraint_getBones);
SE_DECLARE_FUNC(js_spine_PathConstraint_getData);
@@ -575,13 +558,11 @@ SE_DECLARE_FUNC(js_spine_PathConstraint_setTarget);
SE_DECLARE_FUNC(js_spine_PathConstraint_setTranslateMix);
SE_DECLARE_FUNC(js_spine_PathConstraint_update);
extern se::Object* __jsb_spine_PathConstraintData_proto;
extern se::Class* __jsb_spine_PathConstraintData_class;
extern se::Object *__jsb_spine_PathConstraintData_proto; // NOLINT
extern se::Class * __jsb_spine_PathConstraintData_class; // NOLINT
bool js_register_spine_PathConstraintData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_PathConstraintData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraintData);
SE_DECLARE_FUNC(js_spine_PathConstraintData_getBones);
SE_DECLARE_FUNC(js_spine_PathConstraintData_getOffsetRotation);
SE_DECLARE_FUNC(js_spine_PathConstraintData_getPosition);
@@ -602,41 +583,33 @@ SE_DECLARE_FUNC(js_spine_PathConstraintData_setSpacingMode);
SE_DECLARE_FUNC(js_spine_PathConstraintData_setTarget);
SE_DECLARE_FUNC(js_spine_PathConstraintData_setTranslateMix);
extern se::Object* __jsb_spine_PathConstraintMixTimeline_proto;
extern se::Class* __jsb_spine_PathConstraintMixTimeline_class;
extern se::Object *__jsb_spine_PathConstraintMixTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_PathConstraintMixTimeline_class; // NOLINT
bool js_register_spine_PathConstraintMixTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_PathConstraintMixTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraintMixTimeline);
SE_DECLARE_FUNC(js_spine_PathConstraintMixTimeline_getPropertyId);
extern se::Object* __jsb_spine_PathConstraintPositionTimeline_proto;
extern se::Class* __jsb_spine_PathConstraintPositionTimeline_class;
extern se::Object *__jsb_spine_PathConstraintPositionTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_PathConstraintPositionTimeline_class; // NOLINT
bool js_register_spine_PathConstraintPositionTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_PathConstraintPositionTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraintPositionTimeline);
SE_DECLARE_FUNC(js_spine_PathConstraintPositionTimeline_getPropertyId);
SE_DECLARE_FUNC(js_spine_PathConstraintPositionTimeline_setFrame);
extern se::Object* __jsb_spine_PathConstraintSpacingTimeline_proto;
extern se::Class* __jsb_spine_PathConstraintSpacingTimeline_class;
extern se::Object *__jsb_spine_PathConstraintSpacingTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_PathConstraintSpacingTimeline_class; // NOLINT
bool js_register_spine_PathConstraintSpacingTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_PathConstraintSpacingTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::PathConstraintSpacingTimeline);
SE_DECLARE_FUNC(js_spine_PathConstraintSpacingTimeline_getPropertyId);
extern se::Object* __jsb_spine_PointAttachment_proto;
extern se::Class* __jsb_spine_PointAttachment_class;
extern se::Object *__jsb_spine_PointAttachment_proto; // NOLINT
extern se::Class * __jsb_spine_PointAttachment_class; // NOLINT
bool js_register_spine_PointAttachment(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_PointAttachment(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::PointAttachment);
SE_DECLARE_FUNC(js_spine_PointAttachment_copy);
SE_DECLARE_FUNC(js_spine_PointAttachment_getRotation);
SE_DECLARE_FUNC(js_spine_PointAttachment_getX);
@@ -645,13 +618,11 @@ SE_DECLARE_FUNC(js_spine_PointAttachment_setRotation);
SE_DECLARE_FUNC(js_spine_PointAttachment_setX);
SE_DECLARE_FUNC(js_spine_PointAttachment_setY);
extern se::Object* __jsb_spine_RegionAttachment_proto;
extern se::Class* __jsb_spine_RegionAttachment_class;
extern se::Object *__jsb_spine_RegionAttachment_proto; // NOLINT
extern se::Class * __jsb_spine_RegionAttachment_class; // NOLINT
bool js_register_spine_RegionAttachment(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_RegionAttachment(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::RegionAttachment);
SE_DECLARE_FUNC(js_spine_RegionAttachment_copy);
SE_DECLARE_FUNC(js_spine_RegionAttachment_getColor);
SE_DECLARE_FUNC(js_spine_RegionAttachment_getHeight);
@@ -687,54 +658,44 @@ SE_DECLARE_FUNC(js_spine_RegionAttachment_setX);
SE_DECLARE_FUNC(js_spine_RegionAttachment_setY);
SE_DECLARE_FUNC(js_spine_RegionAttachment_updateOffset);
extern se::Object* __jsb_spine_RotateTimeline_proto;
extern se::Class* __jsb_spine_RotateTimeline_class;
extern se::Object *__jsb_spine_RotateTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_RotateTimeline_class; // NOLINT
bool js_register_spine_RotateTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_RotateTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::RotateTimeline);
SE_DECLARE_FUNC(js_spine_RotateTimeline_getBoneIndex);
SE_DECLARE_FUNC(js_spine_RotateTimeline_getFrames);
SE_DECLARE_FUNC(js_spine_RotateTimeline_getPropertyId);
SE_DECLARE_FUNC(js_spine_RotateTimeline_setBoneIndex);
SE_DECLARE_FUNC(js_spine_RotateTimeline_setFrame);
extern se::Object* __jsb_spine_TranslateTimeline_proto;
extern se::Class* __jsb_spine_TranslateTimeline_class;
extern se::Object *__jsb_spine_TranslateTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_TranslateTimeline_class; // NOLINT
bool js_register_spine_TranslateTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_TranslateTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::TranslateTimeline);
SE_DECLARE_FUNC(js_spine_TranslateTimeline_getPropertyId);
SE_DECLARE_FUNC(js_spine_TranslateTimeline_setFrame);
extern se::Object* __jsb_spine_ScaleTimeline_proto;
extern se::Class* __jsb_spine_ScaleTimeline_class;
extern se::Object *__jsb_spine_ScaleTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_ScaleTimeline_class; // NOLINT
bool js_register_spine_ScaleTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_ScaleTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::ScaleTimeline);
SE_DECLARE_FUNC(js_spine_ScaleTimeline_getPropertyId);
extern se::Object* __jsb_spine_ShearTimeline_proto;
extern se::Class* __jsb_spine_ShearTimeline_class;
extern se::Object *__jsb_spine_ShearTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_ShearTimeline_class; // NOLINT
bool js_register_spine_ShearTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_ShearTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::ShearTimeline);
SE_DECLARE_FUNC(js_spine_ShearTimeline_getPropertyId);
extern se::Object* __jsb_spine_Skeleton_proto;
extern se::Class* __jsb_spine_Skeleton_class;
extern se::Object *__jsb_spine_Skeleton_proto; // NOLINT
extern se::Class * __jsb_spine_Skeleton_class; // NOLINT
bool js_register_spine_Skeleton(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Skeleton(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Skeleton);
SE_DECLARE_FUNC(js_spine_Skeleton_findBone);
SE_DECLARE_FUNC(js_spine_Skeleton_findBoneIndex);
SE_DECLARE_FUNC(js_spine_Skeleton_findIkConstraint);
@@ -775,13 +736,11 @@ SE_DECLARE_FUNC(js_spine_Skeleton_update);
SE_DECLARE_FUNC(js_spine_Skeleton_updateCache);
SE_DECLARE_FUNC(js_spine_Skeleton_updateWorldTransform);
extern se::Object* __jsb_spine_SkeletonBounds_proto;
extern se::Class* __jsb_spine_SkeletonBounds_class;
extern se::Object *__jsb_spine_SkeletonBounds_proto; // NOLINT
extern se::Class * __jsb_spine_SkeletonBounds_class; // NOLINT
bool js_register_spine_SkeletonBounds(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SkeletonBounds(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonBounds);
SE_DECLARE_FUNC(js_spine_SkeletonBounds_aabbcontainsPoint);
SE_DECLARE_FUNC(js_spine_SkeletonBounds_aabbintersectsSegment);
SE_DECLARE_FUNC(js_spine_SkeletonBounds_containsPoint);
@@ -790,21 +749,17 @@ SE_DECLARE_FUNC(js_spine_SkeletonBounds_getPolygon);
SE_DECLARE_FUNC(js_spine_SkeletonBounds_getWidth);
SE_DECLARE_FUNC(js_spine_SkeletonBounds_intersectsSegment);
extern se::Object* __jsb_spine_Polygon_proto;
extern se::Class* __jsb_spine_Polygon_class;
extern se::Object *__jsb_spine_Polygon_proto; // NOLINT
extern se::Class * __jsb_spine_Polygon_class; // NOLINT
bool js_register_spine_Polygon(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Polygon(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Polygon);
extern se::Object* __jsb_spine_SkeletonData_proto;
extern se::Class* __jsb_spine_SkeletonData_class;
extern se::Object *__jsb_spine_SkeletonData_proto; // NOLINT
extern se::Class * __jsb_spine_SkeletonData_class; // NOLINT
bool js_register_spine_SkeletonData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SkeletonData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonData);
SE_DECLARE_FUNC(js_spine_SkeletonData_findAnimation);
SE_DECLARE_FUNC(js_spine_SkeletonData_findBone);
SE_DECLARE_FUNC(js_spine_SkeletonData_findBoneIndex);
@@ -847,13 +802,11 @@ SE_DECLARE_FUNC(js_spine_SkeletonData_setWidth);
SE_DECLARE_FUNC(js_spine_SkeletonData_setX);
SE_DECLARE_FUNC(js_spine_SkeletonData_setY);
extern se::Object* __jsb_spine_Skin_proto;
extern se::Class* __jsb_spine_Skin_class;
extern se::Object *__jsb_spine_Skin_proto; // NOLINT
extern se::Class * __jsb_spine_Skin_class; // NOLINT
bool js_register_spine_Skin(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Skin(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Skin);
SE_DECLARE_FUNC(js_spine_Skin_addSkin);
SE_DECLARE_FUNC(js_spine_Skin_copySkin);
SE_DECLARE_FUNC(js_spine_Skin_getAttachment);
@@ -863,13 +816,11 @@ SE_DECLARE_FUNC(js_spine_Skin_getName);
SE_DECLARE_FUNC(js_spine_Skin_removeAttachment);
SE_DECLARE_FUNC(js_spine_Skin_setAttachment);
extern se::Object* __jsb_spine_Slot_proto;
extern se::Class* __jsb_spine_Slot_class;
extern se::Object *__jsb_spine_Slot_proto; // NOLINT
extern se::Class * __jsb_spine_Slot_class; // NOLINT
bool js_register_spine_Slot(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_Slot(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::Slot);
SE_DECLARE_FUNC(js_spine_Slot_getAttachment);
SE_DECLARE_FUNC(js_spine_Slot_getAttachmentTime);
SE_DECLARE_FUNC(js_spine_Slot_getBone);
@@ -883,13 +834,11 @@ SE_DECLARE_FUNC(js_spine_Slot_setAttachment);
SE_DECLARE_FUNC(js_spine_Slot_setAttachmentTime);
SE_DECLARE_FUNC(js_spine_Slot_setToSetupPose);
extern se::Object* __jsb_spine_SlotData_proto;
extern se::Class* __jsb_spine_SlotData_class;
extern se::Object *__jsb_spine_SlotData_proto; // NOLINT
extern se::Class * __jsb_spine_SlotData_class; // NOLINT
bool js_register_spine_SlotData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SlotData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SlotData);
SE_DECLARE_FUNC(js_spine_SlotData_getAttachmentName);
SE_DECLARE_FUNC(js_spine_SlotData_getBlendMode);
SE_DECLARE_FUNC(js_spine_SlotData_getBoneData);
@@ -902,13 +851,11 @@ SE_DECLARE_FUNC(js_spine_SlotData_setAttachmentName);
SE_DECLARE_FUNC(js_spine_SlotData_setBlendMode);
SE_DECLARE_FUNC(js_spine_SlotData_setHasDarkColor);
extern se::Object* __jsb_spine_TransformConstraint_proto;
extern se::Class* __jsb_spine_TransformConstraint_class;
extern se::Object *__jsb_spine_TransformConstraint_proto; // NOLINT
extern se::Class * __jsb_spine_TransformConstraint_class; // NOLINT
bool js_register_spine_TransformConstraint(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_TransformConstraint(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::TransformConstraint);
SE_DECLARE_FUNC(js_spine_TransformConstraint_apply);
SE_DECLARE_FUNC(js_spine_TransformConstraint_getBones);
SE_DECLARE_FUNC(js_spine_TransformConstraint_getData);
@@ -927,13 +874,11 @@ SE_DECLARE_FUNC(js_spine_TransformConstraint_setTarget);
SE_DECLARE_FUNC(js_spine_TransformConstraint_setTranslateMix);
SE_DECLARE_FUNC(js_spine_TransformConstraint_update);
extern se::Object* __jsb_spine_TransformConstraintData_proto;
extern se::Class* __jsb_spine_TransformConstraintData_class;
extern se::Object *__jsb_spine_TransformConstraintData_proto; // NOLINT
extern se::Class * __jsb_spine_TransformConstraintData_class; // NOLINT
bool js_register_spine_TransformConstraintData(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_TransformConstraintData(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::TransformConstraintData);
SE_DECLARE_FUNC(js_spine_TransformConstraintData_getBones);
SE_DECLARE_FUNC(js_spine_TransformConstraintData_getOffsetRotation);
SE_DECLARE_FUNC(js_spine_TransformConstraintData_getOffsetScaleX);
@@ -949,55 +894,45 @@ SE_DECLARE_FUNC(js_spine_TransformConstraintData_getTranslateMix);
SE_DECLARE_FUNC(js_spine_TransformConstraintData_isLocal);
SE_DECLARE_FUNC(js_spine_TransformConstraintData_isRelative);
extern se::Object* __jsb_spine_TransformConstraintTimeline_proto;
extern se::Class* __jsb_spine_TransformConstraintTimeline_class;
extern se::Object *__jsb_spine_TransformConstraintTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_TransformConstraintTimeline_class; // NOLINT
bool js_register_spine_TransformConstraintTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_TransformConstraintTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::TransformConstraintTimeline);
SE_DECLARE_FUNC(js_spine_TransformConstraintTimeline_getPropertyId);
SE_DECLARE_FUNC(js_spine_TransformConstraintTimeline_setFrame);
extern se::Object* __jsb_spine_TwoColorTimeline_proto;
extern se::Class* __jsb_spine_TwoColorTimeline_class;
extern se::Object *__jsb_spine_TwoColorTimeline_proto; // NOLINT
extern se::Class * __jsb_spine_TwoColorTimeline_class; // NOLINT
bool js_register_spine_TwoColorTimeline(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_TwoColorTimeline(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::TwoColorTimeline);
SE_DECLARE_FUNC(js_spine_TwoColorTimeline_getPropertyId);
SE_DECLARE_FUNC(js_spine_TwoColorTimeline_getSlotIndex);
SE_DECLARE_FUNC(js_spine_TwoColorTimeline_setFrame);
SE_DECLARE_FUNC(js_spine_TwoColorTimeline_setSlotIndex);
extern se::Object* __jsb_spine_VertexEffect_proto;
extern se::Class* __jsb_spine_VertexEffect_class;
extern se::Object *__jsb_spine_VertexEffect_proto; // NOLINT
extern se::Class * __jsb_spine_VertexEffect_class; // NOLINT
bool js_register_spine_VertexEffect(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_VertexEffect(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::VertexEffect);
extern se::Object* __jsb_spine_JitterVertexEffect_proto;
extern se::Class* __jsb_spine_JitterVertexEffect_class;
extern se::Object *__jsb_spine_JitterVertexEffect_proto; // NOLINT
extern se::Class * __jsb_spine_JitterVertexEffect_class; // NOLINT
bool js_register_spine_JitterVertexEffect(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_JitterVertexEffect(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::JitterVertexEffect);
SE_DECLARE_FUNC(js_spine_JitterVertexEffect_getJitterX);
SE_DECLARE_FUNC(js_spine_JitterVertexEffect_getJitterY);
SE_DECLARE_FUNC(js_spine_JitterVertexEffect_setJitterX);
SE_DECLARE_FUNC(js_spine_JitterVertexEffect_setJitterY);
extern se::Object* __jsb_spine_SwirlVertexEffect_proto;
extern se::Class* __jsb_spine_SwirlVertexEffect_class;
extern se::Object *__jsb_spine_SwirlVertexEffect_proto; // NOLINT
extern se::Class * __jsb_spine_SwirlVertexEffect_class; // NOLINT
bool js_register_spine_SwirlVertexEffect(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SwirlVertexEffect(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SwirlVertexEffect);
SE_DECLARE_FUNC(js_spine_SwirlVertexEffect_getAngle);
SE_DECLARE_FUNC(js_spine_SwirlVertexEffect_getCenterX);
SE_DECLARE_FUNC(js_spine_SwirlVertexEffect_getCenterY);
@@ -1011,13 +946,11 @@ SE_DECLARE_FUNC(js_spine_SwirlVertexEffect_setRadius);
SE_DECLARE_FUNC(js_spine_SwirlVertexEffect_setWorldX);
SE_DECLARE_FUNC(js_spine_SwirlVertexEffect_setWorldY);
extern se::Object* __jsb_spine_VertexEffectDelegate_proto;
extern se::Class* __jsb_spine_VertexEffectDelegate_class;
extern se::Object *__jsb_spine_VertexEffectDelegate_proto; // NOLINT
extern se::Class * __jsb_spine_VertexEffectDelegate_class; // NOLINT
bool js_register_spine_VertexEffectDelegate(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_VertexEffectDelegate(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::VertexEffectDelegate);
SE_DECLARE_FUNC(js_spine_VertexEffectDelegate_clear);
SE_DECLARE_FUNC(js_spine_VertexEffectDelegate_getEffectType);
SE_DECLARE_FUNC(js_spine_VertexEffectDelegate_getJitterVertexEffect);
@@ -1028,13 +961,11 @@ SE_DECLARE_FUNC(js_spine_VertexEffectDelegate_initSwirlWithPow);
SE_DECLARE_FUNC(js_spine_VertexEffectDelegate_initSwirlWithPowOut);
SE_DECLARE_FUNC(js_spine_VertexEffectDelegate_VertexEffectDelegate);
extern se::Object* __jsb_spine_SkeletonRenderer_proto;
extern se::Class* __jsb_spine_SkeletonRenderer_class;
extern se::Object *__jsb_spine_SkeletonRenderer_proto; // NOLINT
extern se::Class * __jsb_spine_SkeletonRenderer_class; // NOLINT
bool js_register_spine_SkeletonRenderer(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SkeletonRenderer(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonRenderer);
SE_DECLARE_FUNC(js_spine_SkeletonRenderer_beginSchedule);
SE_DECLARE_FUNC(js_spine_SkeletonRenderer_findBone);
SE_DECLARE_FUNC(js_spine_SkeletonRenderer_findSlot);
@@ -1074,13 +1005,11 @@ SE_DECLARE_FUNC(js_spine_SkeletonRenderer_update);
SE_DECLARE_FUNC(js_spine_SkeletonRenderer_updateWorldTransform);
SE_DECLARE_FUNC(js_spine_SkeletonRenderer_SkeletonRenderer);
extern se::Object* __jsb_spine_SkeletonAnimation_proto;
extern se::Class* __jsb_spine_SkeletonAnimation_class;
extern se::Object *__jsb_spine_SkeletonAnimation_proto; // NOLINT
extern se::Class * __jsb_spine_SkeletonAnimation_class; // NOLINT
bool js_register_spine_SkeletonAnimation(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SkeletonAnimation(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonAnimation);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_addAnimation);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_addEmptyAnimation);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_clearTrack);
@@ -1106,18 +1035,16 @@ SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setTrackEventListener);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setTrackInterruptListener);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setTrackStartListener);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_create);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_createWithJsonFile);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_createWithBinaryFile);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_createWithJsonFile);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_setGlobalTimeScale);
SE_DECLARE_FUNC(js_spine_SkeletonAnimation_SkeletonAnimation);
extern se::Object* __jsb_spine_SkeletonCacheAnimation_proto;
extern se::Class* __jsb_spine_SkeletonCacheAnimation_class;
extern se::Object *__jsb_spine_SkeletonCacheAnimation_proto; // NOLINT
extern se::Class * __jsb_spine_SkeletonCacheAnimation_class; // NOLINT
bool js_register_spine_SkeletonCacheAnimation(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SkeletonCacheAnimation(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonCacheAnimation);
SE_DECLARE_FUNC(js_spine_SkeletonCacheAnimation_addAnimation);
SE_DECLARE_FUNC(js_spine_SkeletonCacheAnimation_beginSchedule);
SE_DECLARE_FUNC(js_spine_SkeletonCacheAnimation_findAnimation);
@@ -1153,26 +1080,22 @@ SE_DECLARE_FUNC(js_spine_SkeletonCacheAnimation_updateAllAnimationCache);
SE_DECLARE_FUNC(js_spine_SkeletonCacheAnimation_updateAnimationCache);
SE_DECLARE_FUNC(js_spine_SkeletonCacheAnimation_SkeletonCacheAnimation);
extern se::Object* __jsb_spine_SkeletonCacheMgr_proto;
extern se::Class* __jsb_spine_SkeletonCacheMgr_class;
extern se::Object *__jsb_spine_SkeletonCacheMgr_proto; // NOLINT
extern se::Class * __jsb_spine_SkeletonCacheMgr_class; // NOLINT
bool js_register_spine_SkeletonCacheMgr(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SkeletonCacheMgr(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonCacheMgr);
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_buildSkeletonCache);
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_removeSkeletonCache);
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_getInstance);
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_destroyInstance);
SE_DECLARE_FUNC(js_spine_SkeletonCacheMgr_getInstance);
extern se::Object* __jsb_spine_SkeletonDataMgr_proto;
extern se::Class* __jsb_spine_SkeletonDataMgr_class;
extern se::Object *__jsb_spine_SkeletonDataMgr_proto; // NOLINT
extern se::Class * __jsb_spine_SkeletonDataMgr_class; // NOLINT
bool js_register_spine_SkeletonDataMgr(se::Object* obj);
bool register_all_spine(se::Object* obj);
bool js_register_spine_SkeletonDataMgr(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(spine::SkeletonDataMgr);
SE_DECLARE_FUNC(js_spine_SkeletonDataMgr_setDestroyCallback);
SE_DECLARE_FUNC(js_spine_SkeletonDataMgr_getInstance);
SE_DECLARE_FUNC(js_spine_SkeletonDataMgr_SkeletonDataMgr);
// clang-format on
+11 -37
View File
@@ -1,28 +1,5 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#include "cocos/bindings/auto/jsb_video_auto.h"
#if (USE_VIDEO > 0)
#include "cocos/bindings/manual/jsb_conversions.h"
@@ -36,8 +13,8 @@
#ifndef JSB_FREE
#define JSB_FREE(ptr) delete ptr
#endif
se::Object* __jsb_cc_VideoPlayer_proto = nullptr;
se::Class* __jsb_cc_VideoPlayer_class = nullptr;
se::Object* __jsb_cc_VideoPlayer_proto = nullptr; // NOLINT
se::Class* __jsb_cc_VideoPlayer_class = nullptr; // NOLINT
static bool js_video_VideoPlayer_addEventListener(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -56,12 +33,12 @@ static bool js_video_VideoPlayer_addEventListener(se::State& s) // NOLINT(readab
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[1]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=]() -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(se::EmptyValueArray, thisObj, &rval);
if (!succeed) {
@@ -330,29 +307,24 @@ SE_DECLARE_FINALIZE_FUNC(js_cc_VideoPlayer_finalize)
static bool js_video_VideoPlayer_constructor(se::State& s) // NOLINT(readability-identifier-naming) constructor.c
{
cc::VideoPlayer* cobj = JSB_ALLOC(cc::VideoPlayer);
s.thisObject()->setPrivateData(cobj);
auto *ptr = JSB_MAKE_PRIVATE_OBJECT(cc::VideoPlayer);
s.thisObject()->setPrivateObject(ptr);
return true;
}
SE_BIND_CTOR(js_video_VideoPlayer_constructor, __jsb_cc_VideoPlayer_class, js_cc_VideoPlayer_finalize)
static bool js_cc_VideoPlayer_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
// destructor is skipped
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_VideoPlayer_finalize)
static bool js_cc_VideoPlayer_destroy(se::State& s) // NOLINT(readability-identifier-naming)
{
auto* cobj = SE_THIS_OBJECT<cc::VideoPlayer>(s);
cobj->release();
auto objIter = se::NativePtrToObjectMap::find(SE_THIS_OBJECT<cc::VideoPlayer>(s));
if(objIter != se::NativePtrToObjectMap::end())
{
objIter->second->clearPrivateData(true);
objIter->second->decRef();
}
return true;
}
@@ -384,14 +356,15 @@ bool js_register_video_VideoPlayer(se::Object* obj) // NOLINT(readability-identi
__jsb_cc_VideoPlayer_proto = cls->getProto();
__jsb_cc_VideoPlayer_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_video(se::Object* obj)
bool register_all_video(se::Object* obj) // NOLINT
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("jsb", &nsVal))
if (!obj->getProperty("jsb", &nsVal, true))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
@@ -404,3 +377,4 @@ bool register_all_video(se::Object* obj)
}
#endif //#if (USE_VIDEO > 0)
// clang-format on
+10 -31
View File
@@ -1,28 +1,4 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#pragma once
#include "base/Config.h"
#if (USE_VIDEO > 0)
@@ -31,13 +7,16 @@
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/ui/videoplayer/VideoPlayer.h"
extern se::Object* __jsb_cc_VideoPlayer_proto;
extern se::Class* __jsb_cc_VideoPlayer_class;
bool js_register_cc_VideoPlayer(se::Object* obj);
bool register_all_video(se::Object* obj);
bool register_all_video(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::VideoPlayer);
extern se::Object *__jsb_cc_VideoPlayer_proto; // NOLINT
extern se::Class * __jsb_cc_VideoPlayer_class; // NOLINT
bool js_register_cc_VideoPlayer(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_video_VideoPlayer_addEventListener);
SE_DECLARE_FUNC(js_video_VideoPlayer_currentTime);
SE_DECLARE_FUNC(js_video_VideoPlayer_duration);
@@ -53,5 +32,5 @@ SE_DECLARE_FUNC(js_video_VideoPlayer_setURL);
SE_DECLARE_FUNC(js_video_VideoPlayer_setVisible);
SE_DECLARE_FUNC(js_video_VideoPlayer_stop);
SE_DECLARE_FUNC(js_video_VideoPlayer_VideoPlayer);
#endif //#if (USE_VIDEO > 0)
// clang-format on
+19 -46
View File
@@ -1,28 +1,5 @@
/****************************************************************************
Copyright (c) 2019-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
// clang-format off
#include "cocos/bindings/auto/jsb_webview_auto.h"
#if USE_WEBVIEW > 0
#include "cocos/bindings/manual/jsb_conversions.h"
@@ -36,8 +13,8 @@
#ifndef JSB_FREE
#define JSB_FREE(ptr) delete ptr
#endif
se::Object* __jsb_cc_WebView_proto = nullptr;
se::Class* __jsb_cc_WebView_class = nullptr;
se::Object* __jsb_cc_WebView_proto = nullptr; // NOLINT
se::Class* __jsb_cc_WebView_class = nullptr; // NOLINT
static bool js_webview_WebView_canGoBack(se::State& s) // NOLINT(readability-identifier-naming)
{
@@ -405,6 +382,7 @@ static bool js_webview_WebView_setOnDidFailLoading(se::State& s) // NOLINT(reada
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](cc::WebView* larg0, const std::string larg1) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -415,7 +393,6 @@ static bool js_webview_WebView_setOnDidFailLoading(se::State& s) // NOLINT(reada
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg1, args[1], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -454,6 +431,7 @@ static bool js_webview_WebView_setOnDidFinishLoading(se::State& s) // NOLINT(rea
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](cc::WebView* larg0, const std::string larg1) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -464,7 +442,6 @@ static bool js_webview_WebView_setOnDidFinishLoading(se::State& s) // NOLINT(rea
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg1, args[1], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -503,6 +480,7 @@ static bool js_webview_WebView_setOnJSCallback(se::State& s) // NOLINT(readabili
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](cc::WebView* larg0, const std::string larg1) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -513,7 +491,6 @@ static bool js_webview_WebView_setOnJSCallback(se::State& s) // NOLINT(readabili
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg1, args[1], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -552,6 +529,7 @@ static bool js_webview_WebView_setOnShouldStartLoading(se::State& s) // NOLINT(r
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto * thisObj = s.thisObject();
auto lambda = [=](cc::WebView* larg0, const std::string larg1) -> bool {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
@@ -562,7 +540,6 @@ static bool js_webview_WebView_setOnShouldStartLoading(se::State& s) // NOLINT(r
ok &= nativevalue_to_se(larg0, args[0], nullptr /*ctx*/);
ok &= nativevalue_to_se(larg1, args[1], nullptr /*ctx*/);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
@@ -643,40 +620,34 @@ static bool js_webview_WebView_stopLoading(se::State& s) // NOLINT(readability-i
}
SE_BIND_FUNC(js_webview_WebView_stopLoading)
static bool js_webview_WebView_create(se::State& s) // NOLINT(readability-identifier-naming)
static bool js_webview_WebView_create_static(se::State& s) // NOLINT(readability-identifier-naming)
{
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
auto result = cc::WebView::create();
result->retain();
auto obj = se::Object::createObjectWithClass(__jsb_cc_WebView_class);
obj->setPrivateData(result);
s.rval().setObject(obj);
cc::WebView* result = cc::WebView::create();
ok &= nativevalue_to_se(result, s.rval(), nullptr /*ctx*/);
SE_PRECONDITION2(ok, false, "js_webview_WebView_create_static : Error processing arguments");
SE_HOLD_RETURN_VALUE(result, s.thisObject(), s.rval());
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_webview_WebView_create)
SE_BIND_FUNC(js_webview_WebView_create_static)
static bool js_cc_WebView_finalize(se::State& s) // NOLINT(readability-identifier-naming)
{
// destructor is skipped
return true;
}
SE_BIND_FINALIZE_FUNC(js_cc_WebView_finalize)
static bool js_cc_WebView_destroy(se::State& s) // NOLINT(readability-identifier-naming)
{
auto* cobj = SE_THIS_OBJECT<cc::WebView>(s);
cobj->release();
auto objIter = se::NativePtrToObjectMap::find(SE_THIS_OBJECT<cc::WebView>(s));
if(objIter != se::NativePtrToObjectMap::end())
{
objIter->second->clearPrivateData(true);
objIter->second->decRef();
}
return true;
}
@@ -712,7 +683,7 @@ bool js_register_webview_WebView(se::Object* obj) // NOLINT(readability-identifi
cls->defineFunction("setVisible", _SE(js_webview_WebView_setVisible));
cls->defineFunction("stopLoading", _SE(js_webview_WebView_stopLoading));
cls->defineFunction("destroy", _SE(js_cc_WebView_destroy));
cls->defineStaticFunction("create", _SE(js_webview_WebView_create));
cls->defineStaticFunction("create", _SE(js_webview_WebView_create_static));
cls->defineFinalizeFunction(_SE(js_cc_WebView_finalize));
cls->install();
JSBClassType::registerClass<cc::WebView>(cls);
@@ -720,14 +691,15 @@ bool js_register_webview_WebView(se::Object* obj) // NOLINT(readability-identifi
__jsb_cc_WebView_proto = cls->getProto();
__jsb_cc_WebView_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_webview(se::Object* obj)
bool register_all_webview(se::Object* obj) // NOLINT
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("jsb", &nsVal))
if (!obj->getProperty("jsb", &nsVal, true))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
@@ -740,3 +712,4 @@ bool register_all_webview(se::Object* obj)
}
#endif //#if USE_WEBVIEW > 0
// clang-format on

Some files were not shown because too many files have changed in this diff Show More