feat(角色): 添加角色阴影渲染功能
新增 CharacterShadowActor 类用于处理角色阴影的渲染 在 CharacterObject 中实现阴影的同步和渲染逻辑 移除 GameDebugActor 中不再使用的合成纹理预览代码 添加 EnsureCompositeTextureReady 方法确保纹理准备就绪
This commit is contained in:
32
Game/include/character/CharacterShadowActor.h
Normal file
32
Game/include/character/CharacterShadowActor.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <frostbite2D/2d/sprite.h>
|
||||
|
||||
namespace frostbite2D {
|
||||
|
||||
struct CharacterShadowFrameSnapshot {
|
||||
bool visible = false;
|
||||
Ptr<Texture> texture = nullptr;
|
||||
Vec2 textureSize = Vec2::Zero();
|
||||
Vec2 groundAnchorInTexture = Vec2::Zero();
|
||||
Vec2 groundScreenPosition = Vec2::Zero();
|
||||
int zOrder = 0;
|
||||
uint64 textureVersion = 0;
|
||||
};
|
||||
|
||||
class CharacterShadowActor : public Sprite {
|
||||
public:
|
||||
CharacterShadowActor();
|
||||
|
||||
void ApplyFrameSnapshot(const CharacterShadowFrameSnapshot& snapshot);
|
||||
|
||||
private:
|
||||
void ApplyTextureState(const CharacterShadowFrameSnapshot& snapshot);
|
||||
|
||||
Ptr<Texture> appliedTexture_ = nullptr;
|
||||
Vec2 appliedTextureSize_ = Vec2::Zero();
|
||||
Vec2 appliedGroundAnchorInTexture_ = Vec2::Zero();
|
||||
uint64 appliedTextureVersion_ = 0;
|
||||
};
|
||||
|
||||
} // namespace frostbite2D
|
||||
Reference in New Issue
Block a user