Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // **** before instancing **** //
- layout(std430, set = 1, binding = 0) readonly buffer JointMatrices {
- mat4 finalBonesMatrices[];
- };
- struct PlayerBoneIndex{
- int playerIndex;
- int playerBoneCount;
- };
- layout(push_constant) uniform Push {
- mat4 modelMatrix;
- int index_boneCount;
- } push;
- void main(){
- mat4 skinMat = finalBonesMatrices[boneIds[0] + push.index_boneCount] * weights[0]
- + finalBonesMatrices[boneIds[1] + push.index_boneCount] * weights[1]
- + finalBonesMatrices[boneIds[2] + push.index_boneCount] * weights[2]
- + finalBonesMatrices[boneIds[3] + push.index_boneCount] * weights[3];
- //modelMatrix = push.modelMatrix
- // **** After instancing **** //
- #define DEER_BONE_COUNT 22
- layout (set = 1, binding = 0) readonly buffer ModelMatrices {
- mat4 modelMatrix[4096];
- };
- layout (set = 1, binding = 1) readonly buffer JointMatrices {
- mat4 finalBonesMatrices[];
- };
- void main(){
- int boneIndex = gl_InstanceIndex * DEER_BONE_COUNT;
- mat4 skinMat = finalBonesMatrices[boneIds[0] + boneIndex] * weights[0]
- + finalBonesMatrices[boneIds[1] + boneIndex] * weights[1]
- + finalBonesMatrices[boneIds[2] + boneIndex] * weights[2]
- + finalBonesMatrices[boneIds[3] + boneIndex] * weights[3];
- //modelMatrix = modelMatrix[gl_InstanceIndex]
Add Comment
Please, Sign In to add comment