Skip to content

Commit

Permalink
major performance boost
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCake committed May 4, 2020
1 parent aaad402 commit 3d90497
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Code/DQ skinning/DualQuaternionSkinner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ rtSkinnedData_3 float2 tangent.zw
RenderTexture rtSkinnedData_2;
RenderTexture rtSkinnedData_3;

Material[] materials;

int kernelHandleComputeBoneDQ;
int kernelHandleDQBlend;
int kernelHandleApplyMorph;
Expand Down Expand Up @@ -349,9 +347,11 @@ void GrabMeshFromSkinnedMeshRenderer()
this.arrBufMorphDeltas[i].SetData(deltaVertInfos);
}

this.mr.materials = this.materials; // bug workaround
this.materials = this.mr.materials; // bug workaround

this.mr.materials = new Material[this.smr.materials.Length];
for (int i = 0; i < this.mr.materials.Length; i++)
{
this.mr.materials[i] = this.smr.materials[i];
}
foreach (Material m in this.mr.materials)
{
m.SetInt("_DoSkinning", 1);
Expand Down Expand Up @@ -545,7 +545,6 @@ void ReleaseBuffers()
}
}
}

void OnDestroy()
{
this.ReleaseBuffers();
Expand All @@ -564,7 +563,6 @@ void Start()
this.kernelHandleDQBlend = this.shaderDQBlend.FindKernel("CSMain");
this.kernelHandleApplyMorph = this.shaderApplyMorph.FindKernel("CSMain");

this.materials = this.smr.materials;
this.bones = this.smr.bones;

this.started = true;
Expand Down

0 comments on commit 3d90497

Please sign in to comment.