public void UpdateRenderPropertyArray() { if (m_isDataChange) { GenerateRenderPropertyArray(); } int index = 0; foreach (KeyValuePair <int, InstancingObjData> item in m_instancingObjDic) { GpuSkinAnimator animator = item.Value.Animator; int x = index / GpuInstancingMgr.InstancingSizePerBatch; int y = index % GpuInstancingMgr.InstancingSizePerBatch; m_tempMatrixArray[x][y] = animator.transform.localToWorldMatrix; m_tempFrameIndexArray[x][y] = animator.FrameIndex; m_tempAddColorArray[x][y] = item.Value.AdditiveColor; m_tempBscArray[x][y] = item.Value.Bsc; m_tempGroupColorArray[x][y] = item.Value.GroupColor; //alphaValueArray[x][y] = item.Value.AlphaVal; m_tempOpenIceArray[x][y] = item.Value.OpenIce; index++; } }
public void Dispose() { if (null != Animator) { UnityEngine.Object.Destroy(Animator); Animator = null; } }
public InstancingObjData(GpuSkinAnimator animator, Color addColor, Vector4 bsc, Color groupColor) { Animator = animator; m_additiveColor = addColor; m_bsc = bsc; m_groupColor = groupColor; //m_alphaVal = alphaVal; m_openIce = 0; }
/// <summary> /// 实际上GpuSkinAnimator也充当GpuSkinRenderer的角色 /// </summary> /// <returns></returns> public bool AddGpuInstancingObjData(int skinId, GpuSkinAnimator animator, Color addColor, Vector4 bsc, Color groupColor) { InstancingBatchData batchData; if (TryGetInstancingBatchData(skinId, out batchData)) { return(batchData.AddInstancingObj(animator, addColor, bsc, groupColor)); } else { return(false); } }
public bool AddInstancingObj(GpuSkinAnimator animator, Color addColor, Vector4 bsc, Color groupColor) { if (null == animator) { return(false); } int instanceId = animator.GetInstanceID(); if (m_instancingObjDic.ContainsKey(instanceId)) { return(false); } m_instancingObjDic.Add(instanceId, new InstancingObjData(animator, addColor, bsc, groupColor)); m_isDataChange = true; return(true); }
public InstancingObjData() { Animator = null; }