// Token: 0x06001F91 RID: 8081 RVA: 0x00184E7C File Offset: 0x0018307C protected MotionState.MaterialDesc[] ProcessSharedMaterials(Material[] mats) { MotionState.MaterialDesc[] array = new MotionState.MaterialDesc[mats.Length]; for (int i = 0; i < mats.Length; i++) { array[i].material = mats[i]; bool flag = mats[i].GetTag("RenderType", false) == "TransparentCutout" || mats[i].IsKeywordEnabled("_ALPHATEST_ON"); array[i].propertyBlock = new MaterialPropertyBlock(); array[i].coverage = (mats[i].HasProperty("_MainTex") && flag); array[i].cutoff = mats[i].HasProperty("_Cutoff"); if (flag && !array[i].coverage && !MotionState.m_materialWarnings.Contains(array[i].material)) { Debug.LogWarning(string.Concat(new string[] { "[AmplifyMotion] TransparentCutout material \"", array[i].material.name, "\" {", array[i].material.shader.name, "} not using _MainTex standard property." })); MotionState.m_materialWarnings.Add(array[i].material); } } return(array); }
internal override void RenderVectors(Camera camera, CommandBuffer renderCB, float scale, Quality quality) { if (this.m_initialized && !this.m_error && this.m_renderer.isVisible) { bool flag = (this.m_owner.Instance.CullingMask & 1 << this.m_obj.gameObject.layer) != 0; int num = (!flag) ? 255 : this.m_owner.Instance.GenerateObjectId(this.m_obj.gameObject); Vector3[] vertices = this.m_cloth.vertices; for (int i = 0; i < this.m_targetVertexCount; i++) { this.m_currVertices[i] = vertices[this.m_targetRemap[i]]; } if (this.m_starting || !this.m_wasVisible) { Array.Copy(this.m_currVertices, this.m_prevVertices, this.m_targetVertexCount); } this.m_clonedMesh.vertices = this.m_currVertices; this.m_clonedMesh.normals = this.m_prevVertices; Matrix4x4 value; if (this.m_obj.FixedStep) { value = this.m_owner.PrevViewProjMatrixRT * this.m_currLocalToWorld; } else { value = this.m_owner.PrevViewProjMatrixRT * this.m_prevLocalToWorld; } renderCB.SetGlobalMatrix("_AM_MATRIX_PREV_MVP", value); renderCB.SetGlobalFloat("_AM_OBJECT_ID", (float)num * 0.003921569f); renderCB.SetGlobalFloat("_AM_MOTION_SCALE", (!flag) ? 0f : scale); int num2 = (quality != Quality.Mobile) ? 2 : 0; for (int j = 0; j < this.m_sharedMaterials.Length; j++) { MotionState.MaterialDesc materialDesc = this.m_sharedMaterials[j]; int shaderPass = num2 + ((!materialDesc.coverage) ? 0 : 1); if (materialDesc.coverage) { Texture mainTexture = materialDesc.material.mainTexture; if (mainTexture != null) { materialDesc.propertyBlock.SetTexture("_MainTex", mainTexture); } if (materialDesc.cutoff) { materialDesc.propertyBlock.SetFloat("_Cutoff", materialDesc.material.GetFloat("_Cutoff")); } } renderCB.DrawMesh(this.m_clonedMesh, this.m_currLocalToWorld, this.m_owner.Instance.ClothVectorsMaterial, j, shaderPass, materialDesc.propertyBlock); } } }
internal override void RenderVectors(Camera camera, CommandBuffer renderCB, float scale, Quality quality) { if (this.m_initialized && !this.m_error && this.m_meshRenderer.isVisible) { bool flag = (this.m_owner.Instance.CullingMask & 1 << this.m_obj.gameObject.layer) != 0; if (!flag || (flag && this.m_moved)) { int num = (!flag) ? 255 : this.m_owner.Instance.GenerateObjectId(this.m_obj.gameObject); Matrix4x4 value; if (this.m_obj.FixedStep) { value = this.m_owner.PrevViewProjMatrixRT * this.m_currLocalToWorld; } else { value = this.m_owner.PrevViewProjMatrixRT * this.m_prevLocalToWorld; } renderCB.SetGlobalMatrix("_AM_MATRIX_PREV_MVP", value); renderCB.SetGlobalFloat("_AM_OBJECT_ID", (float)num * 0.003921569f); renderCB.SetGlobalFloat("_AM_MOTION_SCALE", (!flag) ? 0f : scale); int num2 = (quality != Quality.Mobile) ? 2 : 0; for (int i = 0; i < this.m_sharedMaterials.Length; i++) { MotionState.MaterialDesc materialDesc = this.m_sharedMaterials[i]; int shaderPass = num2 + ((!materialDesc.coverage) ? 0 : 1); if (materialDesc.coverage) { Texture mainTexture = materialDesc.material.mainTexture; if (mainTexture != null) { materialDesc.propertyBlock.SetTexture("_MainTex", mainTexture); } if (materialDesc.cutoff) { materialDesc.propertyBlock.SetFloat("_Cutoff", materialDesc.material.GetFloat("_Cutoff")); } } renderCB.DrawMesh(this.m_mesh, this.m_transform.localToWorldMatrix, this.m_owner.Instance.SolidVectorsMaterial, i, shaderPass, materialDesc.propertyBlock); } } } }
// Token: 0x06001FA5 RID: 8101 RVA: 0x001860B8 File Offset: 0x001842B8 internal override void RenderVectors(Camera camera, CommandBuffer renderCB, float scale, Quality quality) { if (this.m_initialized && !this.m_error && this.m_renderer.isVisible) { bool flag = (this.m_owner.Instance.CullingMask & 1 << this.m_obj.gameObject.layer) != 0; if (!flag || (flag && this.m_moved)) { int num = flag ? this.m_owner.Instance.GenerateObjectId(this.m_obj.gameObject) : 255; renderCB.SetGlobalFloat("_AM_OBJECT_ID", (float)num * 0.003921569f); renderCB.SetGlobalFloat("_AM_MOTION_SCALE", flag ? scale : 0f); int num2 = (quality == Quality.Mobile) ? 0 : 2; for (int i = 0; i < this.m_sharedMaterials.Length; i++) { MotionState.MaterialDesc materialDesc = this.m_sharedMaterials[i]; int shaderPass = num2 + (materialDesc.coverage ? 1 : 0); if (materialDesc.coverage) { Texture mainTexture = materialDesc.material.mainTexture; if (mainTexture != null) { materialDesc.propertyBlock.SetTexture("_MainTex", mainTexture); } if (materialDesc.cutoff) { materialDesc.propertyBlock.SetFloat("_Cutoff", materialDesc.material.GetFloat("_Cutoff")); } } foreach (KeyValuePair <uint, ParticleState.Particle> keyValuePair in this.m_particleDict) { Matrix4x4 value = this.m_owner.PrevViewProjMatrixRT * keyValuePair.Value.prevLocalToWorld; renderCB.SetGlobalMatrix("_AM_MATRIX_PREV_MVP", value); renderCB.DrawMesh(this.m_mesh, keyValuePair.Value.currLocalToWorld, this.m_owner.Instance.SolidVectorsMaterial, i, shaderPass, materialDesc.propertyBlock); } } } } }
// Token: 0x06001FC4 RID: 8132 RVA: 0x001879B0 File Offset: 0x00185BB0 internal override void RenderVectors(Camera camera, CommandBuffer renderCB, float scale, Quality quality) { if (this.m_initialized && !this.m_error && this.m_renderer.isVisible) { if (!this.m_useFallback && !this.m_useGPU) { this.WaitForAsyncUpdate(); } if (!this.m_useGPU) { if (!this.m_useFallback) { this.m_clonedMesh.vertices = this.m_currVertices; } this.m_clonedMesh.normals = this.m_prevVertices; } bool flag = (this.m_owner.Instance.CullingMask & 1 << this.m_obj.gameObject.layer) != 0; int num = flag ? this.m_owner.Instance.GenerateObjectId(this.m_obj.gameObject) : 255; Matrix4x4 value; if (this.m_obj.FixedStep) { value = this.m_owner.PrevViewProjMatrixRT * this.m_currLocalToWorld; } else { value = this.m_owner.PrevViewProjMatrixRT * this.m_prevLocalToWorld; } renderCB.SetGlobalMatrix("_AM_MATRIX_PREV_MVP", value); renderCB.SetGlobalFloat("_AM_OBJECT_ID", (float)num * 0.003921569f); renderCB.SetGlobalFloat("_AM_MOTION_SCALE", flag ? scale : 0f); if (this.m_useGPU) { Vector4 vector = new Vector4(1f / (float)this.m_gpuVertexTexWidth, 1f / (float)this.m_gpuVertexTexHeight, (float)this.m_gpuVertexTexWidth, (float)this.m_gpuVertexTexHeight); renderCB.SetGlobalVector("_AM_VERTEX_TEXEL_SIZE", vector); renderCB.SetGlobalVector("_AM_VERTEX_TEXEL_HALFSIZE", vector * 0.5f); renderCB.SetGlobalTexture("_AM_PREV_VERTEX_TEX", this.m_gpuPrevVertices); renderCB.SetGlobalTexture("_AM_CURR_VERTEX_TEX", this.m_gpuCurrVertices); } int num2 = this.m_useGPU ? 4 : 0; int num3 = (quality == Quality.Mobile) ? 0 : 2; int num4 = num2 + num3; for (int i = 0; i < this.m_sharedMaterials.Length; i++) { MotionState.MaterialDesc materialDesc = this.m_sharedMaterials[i]; int shaderPass = num4 + (materialDesc.coverage ? 1 : 0); if (materialDesc.coverage) { Texture mainTexture = materialDesc.material.mainTexture; if (mainTexture != null) { materialDesc.propertyBlock.SetTexture("_MainTex", mainTexture); } if (materialDesc.cutoff) { materialDesc.propertyBlock.SetFloat("_Cutoff", materialDesc.material.GetFloat("_Cutoff")); } } renderCB.DrawMesh(this.m_clonedMesh, this.m_currLocalToWorld, this.m_owner.Instance.SkinnedVectorsMaterial, i, shaderPass, materialDesc.propertyBlock); } } }