mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 19:42:39 +08:00
12072ffc62
* support asset property preview (#11017) (cherry picked from commit 85769cf8f81459b5ad98ccab4138420009572a32) * show mesh asset thumbnail (#10981) * V3.5.1 noise particle (#11003) * add cpu & gpu noise for particle * add some params & change particle noise shader * change shader * add cpu noise particle * add noise preview * run generation when preview * revert shaders * remove unused statements * add particle noise module * change noise preview interface * add invisible to remap * remove get deltaTime * set noiseModule private * fix eslint * feat: add noise preview (#11260) * [Optimize] asset editing undo (#10779) * edit render-pipeline * support renderpipeline undo * optimize material editing undo * reset last record data * temporary not support animation-mask undo * support animation-mask edit undo * animation mask remove _jointMasks * Animation clip embedded players (#11320) * Animation clip subregions * Log * Test * Eval * Update * Update * No longer use animation state to implement clip motion * Clear subregions * Fix * Mark subregion as editor extendable * Animation clip subregion player path * fix isnan(0.0) with webgl1.0 (#11262) * fix isinf(0.0)==true with webgl1.0 * code style * fix specular params with surface toon (#11265) * code format and add sliders for parameters (#11266) * Broadcasting of animation state\'s speed * Fix * Rename * Update * Fix * Revert "No longer use animation state to implement clip motion" This reverts commit 20755f9ec525b27b5b9a515c8dd687349aa4c637. * Revert some exotic changes * Update docs Co-authored-by: jk20012001 <jkregister@163.com> Co-authored-by: 徐兵 <49358166+xubing0906@users.noreply.github.com> * fix skinning model split (#11378) * fix skinning model split * rename function _resizeMaxJointForDS Co-authored-by: zhakesi <zhakesi@foxmail.com> * [ci skip][AUTO]: Automated genbindings update: d823cbba1f7ce8284da28458c26534da2e033961 (#11378) (#11383) Co-authored-by: cocos-robot <cocos-robot@cocos.com> * use stop emitting instead (#11381) * add stop emitting api * use stop emitting instead * Update cocos/particle/particle-system.ts Co-authored-by: Leslie Leigh (李的序) <leslieleigh@outlook.com> Co-authored-by: Leslie Leigh (李的序) <leslieleigh@outlook.com> * fix: imageData fault tolerance (#11374) * fix: imageData fault tolerance * chore: when data is an empty array,stop the function * material undo updating effects list (#11409) * modify noise module ui (#11433) * use visible decorator to control the visibility of property (#11438) * fix joints data with value nan (#11489) * V3.5.2 CI Android NDK set version to 21 (#11448) (#11492) * Minor improvement * Fix format * Fix particle culler * Improve particle culler * Manually migrate joint data upload with texture in skinning model * Update shaders for skinning model based on joint texture * fis native skinning model with realtime-texture mode (#45) Co-authored-by: zhakesi <zhakesi@foxmail.com> * fix clangtidy (#46) * Small tweaks * modify code struct for skinning model (#47) * modify code struct for skinning model * update skinning chunk Co-authored-by: 黄森斌 <arsen2010@126.com> Co-authored-by: zxx43 <zxx43@hotmail.com> Co-authored-by: 袁炜海 <35713518+dogodo-cc@users.noreply.github.com> Co-authored-by: Leslie Leigh (李的序) <leslieleigh@outlook.com> Co-authored-by: jk20012001 <jkregister@163.com> Co-authored-by: 徐兵 <49358166+xubing0906@users.noreply.github.com> Co-authored-by: zhakesi <liqiao@cocos.com> Co-authored-by: zhakesi <zhakesi@foxmail.com> Co-authored-by: Cocos Robot <48829427+cocos-robot@users.noreply.github.com> Co-authored-by: cocos-robot <cocos-robot@cocos.com> Co-authored-by: Santy-Wang <wh19930829@qq.com> Co-authored-by: zhangxin <59186205+chichinohaha@users.noreply.github.com> Co-authored-by: 江战 <40414978+PatriceJiang@users.noreply.github.com>
87 lines
3.3 KiB
C++
87 lines
3.3 KiB
C++
/****************************************************************************
|
|
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 "3d/models/MorphModel.h"
|
|
#include "base/std/container/array.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;
|
|
IntrusivePtr<IJointTransform> transform;
|
|
ccstd::vector<index_t> buffers;
|
|
ccstd::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;
|
|
ccstd::vector<scene::IMacroPatch> getMacroPatches(index_t subModelIndex) override;
|
|
void updateInstancedAttributes(const ccstd::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(uint32_t count);
|
|
void updateRealTimeJointTextureBuffer();
|
|
void initRealTimeJointTexture();
|
|
void bindRealTimeJointTexture(uint32_t idx, gfx::DescriptorSet *descriptorset);
|
|
void releaseData();
|
|
|
|
ccstd::vector<index_t> _bufferIndices;
|
|
ccstd::vector<IntrusivePtr<gfx::Buffer>> _buffers;
|
|
ccstd::vector<JointInfo> _joints;
|
|
ccstd::vector<float *> _dataArray;
|
|
bool _realTimeTextureMode = false;
|
|
RealTimeJointTexture *_realTimeJointTexture = nullptr;
|
|
|
|
CC_DISALLOW_COPY_MOVE_ASSIGN(SkinningModel);
|
|
};
|
|
|
|
} // namespace cc
|