mirror of https://github.com/axmolengine/axmol.git
Merge: f02410f81b
f15dc098e6
Merge pull request #730 from DelinWorks/migrate-engine-name Fix engine setup files.
This commit is contained in:
parent
5fdd3d6bc2
commit
20900f2065
|
@ -5,16 +5,9 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/android-ci.yml
|
||||
- tools/unix-ci/**/*
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
GH_OS_NAME: linux
|
||||
|
|
|
@ -4,12 +4,9 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tools/tolua/*
|
||||
- .github/workflows/genbindings-ci.yml
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
|
|
@ -5,15 +5,9 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/ios-ci.yml
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
GH_OS_NAME: osx
|
||||
|
|
|
@ -5,14 +5,9 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/linux-ci.yml
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
|
|
|
@ -5,14 +5,9 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/osx-ci.yml
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
|
|
|
@ -3,7 +3,7 @@ name: pull_request
|
|||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/README.md'
|
||||
- '**.md'
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
|
|
|
@ -5,15 +5,9 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/windows-ci.yml
|
||||
- tools/win-ci/build.ps1
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2022 Bytedance Inc.
|
||||
|
||||
https://adxeproject.github.io/
|
||||
|
||||
|
@ -43,8 +44,13 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
using uint16_index_format = std::integral_constant<int, 1>;
|
||||
using uint32_index_format = std::integral_constant<int, 2>;
|
||||
using ilist_u16_t = std::initializer_list<uint16_t>;
|
||||
using ilist_u32_t = std::initializer_list<uint32_t>;
|
||||
|
||||
// The underlaying GL driver support U_INT8, U_SHORT, U_INT32, but we support U_SHORT and U_INT32 only
|
||||
template <typename _T>
|
||||
inline constexpr bool is_index_format_type_v = std::is_integral_v<_T> &&
|
||||
(std::is_same_v<_T, uint16_t> || std::is_same_v<_T, uint32_t>);
|
||||
|
||||
class IndexArray
|
||||
{
|
||||
|
@ -58,11 +64,8 @@ public:
|
|||
IndexArray() : _stride(formatToStride(backend::IndexFormat::U_SHORT)) {}
|
||||
IndexArray(backend::IndexFormat indexFormat) : _stride(formatToStride(indexFormat)) {}
|
||||
|
||||
IndexArray(std::initializer_list<uint16_t> rhs, uint16_index_format /*U_SHORT*/)
|
||||
: _stride(formatToStride(backend::IndexFormat::U_SHORT)), _buffer(rhs)
|
||||
{}
|
||||
IndexArray(std::initializer_list<uint32_t> rhs, uint32_index_format /*U_INT*/)
|
||||
: _stride(formatToStride(backend::IndexFormat::U_INT)), _buffer(rhs)
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
IndexArray(std::initializer_list<_Ty> rhs) : _stride(sizeof(_Ty)), _buffer(rhs)
|
||||
{}
|
||||
|
||||
IndexArray(const IndexArray& rhs) : _stride(rhs._stride), _buffer(rhs._buffer) {}
|
||||
|
@ -86,43 +89,99 @@ public:
|
|||
_buffer.swap(rhs._buffer);
|
||||
}
|
||||
|
||||
/** Returns the format of the index array. */
|
||||
backend::IndexFormat format() const { return strideToFormat(_stride); }
|
||||
|
||||
/** Clears the internal byte buffer. */
|
||||
void clear() { _buffer.clear(); }
|
||||
|
||||
/** Pushes back a value. */
|
||||
void push_back(uint32_t val)
|
||||
/** Clears the internal byte buffer and sets the format specified. */
|
||||
void clear(backend::IndexFormat format)
|
||||
{
|
||||
assert(_stride == 2 || _stride == 4);
|
||||
clear();
|
||||
_stride = formatToStride(format);
|
||||
}
|
||||
|
||||
/** Pushes back a value. */
|
||||
template <typename _Ty, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
void push_back(const _Ty& val)
|
||||
{
|
||||
assert(_stride == sizeof(_Ty));
|
||||
_buffer.append_n((uint8_t*)&val, _stride);
|
||||
}
|
||||
|
||||
/** Inserts a list containing unsigned short (uint16_t) data. */
|
||||
void insert(size_t offset, std::initializer_list<uint16_t> ilist, uint16_index_format /*U_SHORT*/)
|
||||
/** Inserts a list containing unsigned int (uint16_t/uint32_t) data. */
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
void insert(_Ty* position, std::initializer_list<_Ty> ilist)
|
||||
{
|
||||
assert(_stride == 2);
|
||||
binsert(offset * _stride, ilist.begin(), ilist.end());
|
||||
insert(position, ilist.begin(), ilist.end());
|
||||
}
|
||||
|
||||
/** Inserts a list containing unsigned int (uint32_t) data. */
|
||||
void insert(size_t offset, std::initializer_list<uint32_t> ilist, uint32_index_format /*U_INT*/)
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
void insert(_Ty* position, _Ty* first, _Ty* last)
|
||||
{
|
||||
assert(_stride == 4);
|
||||
binsert(offset * _stride, ilist.begin(), ilist.end());
|
||||
assert(_stride == sizeof(_Ty));
|
||||
binsert(position, first, last);
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
void insert(size_t offset, std::initializer_list<_Ty> ilist)
|
||||
{
|
||||
assert(_stride == sizeof(_Ty));
|
||||
binsert(begin<_Ty>() + offset, ilist.begin(), ilist.end());
|
||||
}
|
||||
|
||||
/** Inserts range data based on an offset in bytes. */
|
||||
void binsert(size_t offset, const void* first, const void* last)
|
||||
void binsert(uint8_t* position, const void* first, const void* last)
|
||||
{
|
||||
_buffer.insert(offset, (const uint8_t*)first, (const uint8_t*)last);
|
||||
_buffer.insert(position, (const uint8_t*)first, (const uint8_t*)last);
|
||||
}
|
||||
|
||||
template <typename _Ty>
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
const _Ty* begin() const
|
||||
{
|
||||
return (const _Ty*)_buffer.begin();
|
||||
}
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty* begin()
|
||||
{
|
||||
return (_Ty*)_buffer.begin();
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
const _Ty* end() const
|
||||
{
|
||||
return (const _Ty*)_buffer.end();
|
||||
}
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty* end()
|
||||
{
|
||||
return (_Ty*)_buffer.end();
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty* erase(_Ty* position)
|
||||
{
|
||||
return (_Ty*)_buffer.erase((uint8_t*)position);
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty* erase(_Ty* first, _Ty* last)
|
||||
{
|
||||
return (_Ty*)_buffer.erase((uint8_t*)first, (uint8_t*)last);
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty& at(size_t idx)
|
||||
{
|
||||
assert(sizeof(_Ty) == _stride);
|
||||
if (idx < this->size())
|
||||
return (_Ty&)_buffer[idx * sizeof(_Ty)];
|
||||
throw std::out_of_range("IndexArray: out of range!");
|
||||
return (_Ty&)_buffer[idx * sizeof(_Ty)];
|
||||
}
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
const _Ty& at(size_t idx) const
|
||||
{
|
||||
assert(sizeof(_Ty) == _stride);
|
||||
return (const _Ty&)_buffer[idx * sizeof(_Ty)];
|
||||
}
|
||||
|
||||
uint8_t* data() noexcept { return _buffer.data(); }
|
||||
|
@ -141,16 +200,6 @@ public:
|
|||
/** Returns true if the container is empty. Otherwise, false. */
|
||||
bool empty() const { return _buffer.empty(); }
|
||||
|
||||
/** Returns the format of the index array. */
|
||||
backend::IndexFormat format() const { return strideToFormat(_stride); }
|
||||
|
||||
/** Clears the internal byte buffer and sets the format specified. */
|
||||
void clear(backend::IndexFormat format)
|
||||
{
|
||||
clear();
|
||||
_stride = formatToStride(format);
|
||||
}
|
||||
|
||||
template <typename _Fty>
|
||||
void for_each(_Fty cb) const
|
||||
{
|
||||
|
@ -255,7 +304,6 @@ struct NodeDatas
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/**mesh data
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
|
Loading…
Reference in New Issue