Beispiel #1
0
        public void Awake()
        {
            #if UNITY_WEBGL
            if (workerThreadMode == WorkerThreadMode.Asynchronous)
            {
                Debug.LogWarning("Turbo Slicer will run synchronously because WebGL does not support threads.", this);
                workerThreadMode = WorkerThreadMode.Synchronous;
            }
            #endif

            if (preloadMeshes != null)
            {
                for (int i = 0; i < preloadMeshes.Length; i++)
                {
                    var mesh    = preloadMeshes[i];
                    var indices = new int[mesh.subMeshCount][];
                    for (int j = 0; j < mesh.subMeshCount; j++)
                    {
                        indices[j] = mesh.GetIndices(j);
                    }

                    //Note that this is NOT a usable mesh snapshot. It will need to be combined with live data at runtime.
                    var rom = new MeshSnapshot(null, mesh.vertices, mesh.normals, mesh.uv, mesh.tangents, mesh.boneWeights, new Material[0], new BoneMetadata[0], null, indices);
                    preloadedMeshes[mesh.GetInstanceID()] = rom;
                }
            }
        }
Beispiel #2
0
        public void Awake()
        {
                        #if UNITY_WEBGL
            if (workerThreadMode == WorkerThreadMode.Asynchronous)
            {
                Debug.LogWarning("Turbo Slicer will run synchronously because WebGL does not support threads.", this);
                workerThreadMode = WorkerThreadMode.Synchronous;
            }
                        #endif

            if (preloadMeshes != null)
            {
                for (int i = 0; i < preloadMeshes.Length; i++)
                {
                    var mesh    = preloadMeshes [i];
                    var indices = new int[mesh.subMeshCount][];
                    for (int j = 0; j < mesh.subMeshCount; j++)
                    {
                        indices [j] = mesh.GetIndices(j);
                    }
                    //Not that we don't pull the tangents at all.
                    var rom = new MeshSnapshot(null, mesh.vertices, mesh.normals, mesh.uv, mesh.uv2, mesh.tangents, indices, null, Matrix4x4.identity);
                    preloadedMeshes [mesh.GetInstanceID()] = rom;
                }
            }
        }