浏览代码

Fix z/y swap for normal to decal space, unity is column major

/main
sebastienlagarde 7 年前
当前提交
1ad763a2
共有 1 个文件被更改,包括 10 次插入4 次删除
  1. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs

14
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs


m_CachedTransforms[decal.CullIndex] = decal.transform.localToWorldMatrix;
Matrix4x4 decalRotation = Matrix4x4.Rotate(decal.transform.rotation);
// z/y axis swap for normal to decal space
Vector4 row2 = decalRotation.GetRow(2);
decalRotation.SetRow(2, decalRotation.GetRow(1));
decalRotation.SetRow(1, row2);
// z/y axis swap for normal to decal space, Unity is column major
float y0 = decalRotation.m01;
float y1 = decalRotation.m11;
float y2 = decalRotation.m21;
decalRotation.m01 = decalRotation.m02;
decalRotation.m11 = decalRotation.m12;
decalRotation.m21 = decalRotation.m22;
decalRotation.m02 = y0;
decalRotation.m12 = y1;
decalRotation.m22 = y2;
m_CachedNormalToWorld[decal.CullIndex] = decalRotation;
m_BoundingSpheres[decal.CullIndex] = GetDecalProjectBoundingSphere(m_CachedTransforms[decal.CullIndex]);

正在加载...
取消
保存