mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 18:42:40 +08:00
The base version of sorting priority add (#11599)
* sorting Priority add * fix CI * name change * binding add * name change to priority * bind remove Co-authored-by: ChiaNing <sun.clooud.mo@gmail.com>
This commit is contained in:
@@ -65,6 +65,7 @@ struct CC_DLL RenderTargetInfo {
|
||||
};
|
||||
|
||||
struct CC_DLL RenderPass {
|
||||
uint32_t priority = 0;
|
||||
uint32_t hash = 0;
|
||||
float depth = 0.0F;
|
||||
uint32_t shaderID = 0;
|
||||
@@ -175,6 +176,10 @@ inline bool opaqueCompareFn(const RenderPass &a, const RenderPass &b) {
|
||||
}
|
||||
|
||||
inline bool transparentCompareFn(const RenderPass &a, const RenderPass &b) {
|
||||
if (a.priority != b.priority) {
|
||||
return a.priority < b.priority;
|
||||
}
|
||||
|
||||
if (a.hash != b.hash) {
|
||||
return a.hash < b.hash;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ bool RenderQueue::insertRenderPass(const RenderObject &renderObj, uint32_t subMo
|
||||
auto modelPriority = static_cast<uint32_t>(subModel->getPriority());
|
||||
auto shaderId = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(subModel->getShader(passIdx)));
|
||||
const auto hash = (0 << 30) | (passPriority << 16) | (modelPriority << 8) | passIdx;
|
||||
RenderPass renderPass = {hash, renderObj.depth, shaderId, passIdx, subModel};
|
||||
const auto priority = renderObj.model->getPriority();
|
||||
RenderPass renderPass = {priority, hash, renderObj.depth, shaderId, passIdx, subModel};
|
||||
_queue.emplace_back(renderPass);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -164,6 +164,8 @@ public:
|
||||
inline bool isDynamicBatching() const { return _isDynamicBatching; }
|
||||
inline float getShadowBias() const { return _shadowBias; }
|
||||
inline float getShadowNormalBias() const { return _shadowNormalBias; }
|
||||
inline uint32_t getPriority() const { return _priority; }
|
||||
inline void setPriority(uint32_t value) { _priority = value; }
|
||||
|
||||
void initLocalDescriptors(index_t subModelIndex);
|
||||
void initWorldBoundDescriptors(index_t subModelIndex);
|
||||
@@ -227,6 +229,8 @@ protected:
|
||||
IntrusivePtr<Texture2D> _lightmap;
|
||||
Vec4 _lightmapUVParam;
|
||||
|
||||
uint32_t _priority{0};
|
||||
|
||||
// For JS
|
||||
CallbacksInvoker _eventProcessor;
|
||||
bool _isCalledFromJS{false};
|
||||
|
||||
@@ -106,7 +106,7 @@ getter_setter = Root::[device:_device mainWindow curWindow tempWindow windows sc
|
||||
RenderScene::[name cameras? mainLight? sphereLights? spotLights? models],
|
||||
Skybox::[model enabled/isEnabled/setEnabled useHDR/isUseHDR/setUseHDR useIBL/isUseIBL/setUseIBL useDiffuseMap/isUseDiffuseMap/setUseDiffuseMap isRGBE/isRGBE/setRGBE envmap diffuseMap],
|
||||
Fog::[enabled/isEnabled/setEnabled accurate/isAccurate/setAccurate fogColor type fogDensity fogStart fogEnd fogAtten fogTop fogRange fogRange colorArray],
|
||||
Model::[scene _subModels:subModels/getSubModels inited/isInited _localDataUpdated/isLocalDataUpdated/setLocalDataUpdated _worldBounds:worldBounds/getWorldBounds/setWorldBounds _modelBounds:modelBounds/getModelBounds/setModelBounds worldBoundBuffer localBuffer updateStamp isInstancingEnabled/isInstancingEnabled receiveShadow/isReceiveShadow/setReceiveShadow castShadow/isCastShadow/setCastShadow node transform visFlags enabled/isEnabled/setEnabled type instancedAttributes/getInstancedAttributeBlock/setInstancedAttributeBlock isDynamicBatching/isDynamicBatching/setDynamicBatching],
|
||||
Model::[scene _subModels:subModels/getSubModels inited/isInited _localDataUpdated/isLocalDataUpdated/setLocalDataUpdated _worldBounds:worldBounds/getWorldBounds/setWorldBounds _modelBounds:modelBounds/getModelBounds/setModelBounds worldBoundBuffer localBuffer updateStamp isInstancingEnabled/isInstancingEnabled receiveShadow/isReceiveShadow/setReceiveShadow castShadow/isCastShadow/setCastShadow node transform visFlags enabled/isEnabled/setEnabled type instancedAttributes/getInstancedAttributeBlock/setInstancedAttributeBlock isDynamicBatching/isDynamicBatching/setDynamicBatching priority],
|
||||
SubModel::[passes shaders subMesh priority inputAssembler descriptorSet patches planarInstanceShader planarShader],
|
||||
ShadowsInfo::[enabled/isEnabled/setEnabled type planeDirection planeHeight shadowColor maxReceived shadowMapSize],
|
||||
Shadows::[enabled/isEnabled/setEnabled type normal distance shadowColor maxReceived size shadowMapDirty/isShadowMapDirty/setShadowMapDirty matLight material instancingMaterial],
|
||||
|
||||
Reference in New Issue
Block a user