public virtual void InitializeRuntimeDataAndBuffers(bool forceNew = true)
        {
            GPUInstancerUtility.SetPlatformDependentVariables();
            if (forceNew || !isInitialized)
            {
                instancingBounds = new Bounds(Vector3.zero, Vector3.one * GPUInstancerConstants.gpuiSettings.instancingBoundsSize);

                GPUInstancerUtility.ReleaseInstanceBuffers(runtimeDataList);
                GPUInstancerUtility.ReleaseSPBuffers(spData);
                if (runtimeDataList != null)
                {
                    runtimeDataList.Clear();
                }
                else
                {
                    runtimeDataList = new List <GPUInstancerRuntimeData>();
                }

                if (runtimeDataDictionary != null)
                {
                    runtimeDataDictionary.Clear();
                }
                else
                {
                    runtimeDataDictionary = new Dictionary <GPUInstancerPrototype, GPUInstancerRuntimeData>();
                }

                if (prototypeList == null)
                {
                    prototypeList = new List <GPUInstancerPrototype>();
                }
            }
        }
Esempio n. 2
0
 public virtual void ClearInstancingData()
 {
     GPUInstancerUtility.ReleaseInstanceBuffers(runtimeDataList);
     GPUInstancerUtility.ReleaseSPBuffers(spData);
     if (runtimeDataList != null)
     {
         runtimeDataList.Clear();
     }
     spData = null;
     threadStartQueue.Clear();
     threadQueue.Clear();
     isInitialized = false;
 }
Esempio n. 3
0
        public virtual void InitializeRuntimeDataAndBuffers(bool forceNew = true)
        {
            if (forceNew || !isInitialized)
            {
                instancingBounds = new Bounds(Vector3.zero, Vector3.one * 10000f);

                GPUInstancerUtility.ReleaseInstanceBuffers(runtimeDataList);
                GPUInstancerUtility.ReleaseSPBuffers(spData);
                if (runtimeDataList != null)
                {
                    runtimeDataList.Clear();
                }
                else
                {
                    runtimeDataList = new List <GPUInstancerRuntimeData>();
                }

                if (prototypeList == null)
                {
                    prototypeList = new List <GPUInstancerPrototype>();
                }
            }
        }