Reorganize directory layout: editor panels/, grouped shaders, drop stale header
- App/editor: move 7 panels into panels/ (Editor core stays at root) - shaders/: group into pbr/ post/ debug/ env/ (runtime load paths updated) - Delete outdated duplicate Engine/src/Renderer/VulkanAssetUploader.h
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#version 450
|
||||
|
||||
// HitProxy 顶点:UE 式 GPU 拾取——Forward 同结构画一遍(无光照无纹理),
|
||||
// 输出 per-instance 实体 id。位置变换与 simple_shader.vert 完全同源
|
||||
//(模型矩阵 + 蒙皮),保证拾取像素与可见画面像素一致。
|
||||
//
|
||||
// Set0 与 simple_shader 共用同一 uboSetLayout(SceneGpu 契约);
|
||||
// 本 shader 只声明用到的绑定,描述符集合里未用的绑定合法。
|
||||
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 4) in uvec4 inBoneIds; // 骨骼槽(palette 下标)
|
||||
layout(location = 5) in vec4 inWeights; // 无骨骼顶点 = (1,0,0,0)
|
||||
|
||||
layout(location = 0) flat out uint outEntityId; // 整数 varying 必须 flat
|
||||
|
||||
layout(std430, set = 0, binding = 1) readonly buffer ObjectBuffer {
|
||||
mat4 models[];
|
||||
} objects;
|
||||
|
||||
layout(std430, set = 0, binding = 3) readonly buffer SkinOffsetBuffer {
|
||||
uint skinBases[];
|
||||
} skinOffsets;
|
||||
|
||||
layout(std430, set = 0, binding = 4) readonly buffer SkinPaletteBuffer {
|
||||
mat4 bones[];
|
||||
} skinPalettes;
|
||||
|
||||
// per-instance 实体 id(与 models 平行对齐,SceneRenderer 收集时写入)
|
||||
layout(std430, set = 0, binding = 5) readonly buffer EntityIdBuffer {
|
||||
uint ids[];
|
||||
} entityIds;
|
||||
|
||||
// 只用 view/proj:std140 前两个 mat4 与完整 UBO 的布局前缀一致
|
||||
layout(set = 0, binding = 0) uniform Ubo {
|
||||
mat4 view;
|
||||
mat4 proj;
|
||||
} ubo;
|
||||
|
||||
// 4 权重混合的蒙皮矩阵(与 simple_shader.vert 同逻辑)
|
||||
mat4 SkinMatrix() {
|
||||
uint base = skinOffsets.skinBases[gl_InstanceIndex];
|
||||
return skinPalettes.bones[base + inBoneIds.x] * inWeights.x +
|
||||
skinPalettes.bones[base + inBoneIds.y] * inWeights.y +
|
||||
skinPalettes.bones[base + inBoneIds.z] * inWeights.z +
|
||||
skinPalettes.bones[base + inBoneIds.w] * inWeights.w;
|
||||
}
|
||||
|
||||
void main() {
|
||||
mat4 model = objects.models[gl_InstanceIndex];
|
||||
mat4 skin = SkinMatrix();
|
||||
|
||||
vec3 skinnedPos = (skin * vec4(inPosition, 1.0)).xyz;
|
||||
vec4 worldPos = model * vec4(skinnedPos, 1.0);
|
||||
gl_Position = ubo.proj * ubo.view * worldPos;
|
||||
|
||||
outEntityId = entityIds.ids[gl_InstanceIndex];
|
||||
}
|
||||
Reference in New Issue
Block a user