Esempio n. 1
0
 public virtual int u0921u0928u0921u091Du0924u0928u091Fu0925u0928u0922u0925(FastList <T> u0922u0927u091Cu0928u0922u0922u0921u091Fu0924u091Eu0926, bool u0928u091Du0928u0926u091Bu0923u0928u0928u0929u0923u0921 = false /* Metadata: 0x00655AE2 */) => default;
Esempio n. 2
0
 public virtual void u0927u0922u0926u091Bu0925u0920u091Fu0928u0923u0928u091F(FastList <T> u0920u0928u091Eu091Fu091Cu091Eu0924u091Du091Eu0922u091E)
 {
 }
Esempio n. 3
0
 public FastList(FastList <T> list)
 {
 }
Esempio n. 4
0
        static public bool Create(Transform parentT, LayerMask overlapLayerMask, int lodGroupLayer, ref GameObject overlapCollidersGO, bool removeSamePositionTriangles)
        {
            colliderScaleMulti = (removeSamePositionTriangles ? 1.001f : 1f);

            lookupOrigCollider.Clear();
            lookupColliderOrig.Clear();
            lodInfoLookup.Clear();
            lodGroupMeshes.Clear();
            lodInfos.Clear();

            SaveCollidersState(overlapLayerMask);

            int layerMaskValue = overlapLayerMask.value;

            if (layerMaskValue == 0)
            {
                return(false);
            }
            overlapLayer = Methods.GetFirstLayerInLayerMask(layerMaskValue);

            overlapCollidersGO = new GameObject("Overlap Colliders");
            newT        = overlapCollidersGO.transform;
            newT.parent = parentT;

            var lodGroups = Methods.SearchAllScenes <LODGroup>(false);

            for (int i = 0; i < lodGroups.Count; i++)
            {
                LODGroup   lodGroup = lodGroups.items[i];
                GameObject go       = lodGroup.gameObject;

                if (!go.activeInHierarchy || !Methods.LayerMaskContainsLayer(layerMaskValue, go.layer))
                {
                    lodGroups.RemoveAt(i--);
                    continue;
                }

                LodInfo lodInfo = new LodInfo();
                lodInfo.CreateLodGroupColliders(lodGroup, newT);
            }

            if (lodInfos.Count > 0)
            {
                foundLodGroup = true;
            }

            var mrs = Methods.SearchAllScenes <MeshRenderer>(false);
            FastList <MeshFilter> mfs = new FastList <MeshFilter>();

            for (int i = 0; i < mrs.Count; i++)
            {
                MeshRenderer mr = mrs.items[i];
                GameObject   go = mr.gameObject;

                if (mr.enabled && go.activeInHierarchy && Methods.LayerMaskContainsLayer(layerMaskValue, go.layer))
                {
                    MeshFilter mf = mr.GetComponent <MeshFilter>();
                    if (mf == null)
                    {
                        continue;
                    }

                    Mesh mesh = mf.sharedMesh;
                    if (mesh == null || lodGroupMeshes.Contains(mesh))
                    {
                        continue;
                    }

                    mfs.Add(mf);
                }
            }

            for (int i = 0; i < mfs.Count; i++)
            {
                MeshFilter mf = mfs.items[i];
                CreateMeshCollider(mf, newT, "_");
            }

#if !UNITY_2017
            Physics.SyncTransforms();
#endif

            return(true);
        }
Esempio n. 5
0
        // Token: 0x060024B0 RID: 9392 RVA: 0x000B388C File Offset: 0x000B1A8C
        public void RemoveTrianglesBelowSurface(Transform t, MeshCombineJobManager.MeshCombineJob meshCombineJob, MeshCache.SubMeshCache newMeshCache, ref byte[] vertexIsBelow)
        {
            if (vertexIsBelow == null)
            {
                vertexIsBelow = new byte[65534];
            }
            Vector3 vector        = Vector3.zero;
            int     collisionMask = meshCombineJob.meshCombiner.surfaceLayerMask;

            Vector3[]             vertices    = newMeshCache.vertices;
            int[]                 triangles   = newMeshCache.triangles;
            FastList <MeshObject> meshObjects = meshCombineJob.meshObjectsHolder.meshObjects;
            int startIndex = meshCombineJob.startIndex;
            int endIndex   = meshCombineJob.endIndex;

            for (int i = startIndex; i < endIndex; i++)
            {
                MeshObject meshObject = meshObjects.items[i];
                this.Capture(meshObject.cachedGO.mr.bounds, collisionMask, new Vector3(0f, -1f, 0f), new Int2(1024, 1024));
                int startNewTriangleIndex = meshObject.startNewTriangleIndex;
                int num = meshObject.newTriangleCount + startNewTriangleIndex;
                for (int j = startNewTriangleIndex; j < num; j += 3)
                {
                    bool flag = false;
                    for (int k = 0; k < 3; k++)
                    {
                        int num2 = triangles[j + k];
                        if (num2 != -1)
                        {
                            byte b = vertexIsBelow[num2];
                            if (b == 0)
                            {
                                vector = t.TransformPoint(vertices[num2]);
                                float height = this.GetHeight(vector);
                                b = ((vector.y < height) ? 1 : 2);
                                vertexIsBelow[num2] = b;
                                if (vector.y < height)
                                {
                                    b = (vertexIsBelow[num2] = 1);
                                }
                                else
                                {
                                    b = (vertexIsBelow[num2] = 2);
                                }
                            }
                            if (b != 1)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (!flag)
                    {
                        meshCombineJob.trianglesRemoved += 3;
                        triangles[j] = -1;
                    }
                }
            }
            Array.Clear(vertexIsBelow, 0, vertices.Length);
        }
        public void RemoveTrianglesBelowSurface(Transform t, MeshCombineJobManager.MeshCombineJob meshCombineJob, MeshCache.SubMeshCache newMeshCache, ref byte[] vertexIsBelow)
        {
            if (vertexIsBelow == null)
            {
                vertexIsBelow = new byte[65534];
            }

            Vector3 pos       = Vector3.zero;
            int     layerMask = meshCombineJob.meshCombiner.surfaceLayerMask;

            // float rayHeight = meshCombineJob.meshCombiner.maxSurfaceHeight;

            Vector3[] newVertices  = newMeshCache.vertices;
            int[]     newTriangles = newMeshCache.triangles;

            FastList <MeshObject> meshObjects = meshCombineJob.meshObjectsHolder.meshObjects;

            int startIndex = meshCombineJob.startIndex;
            int endIndex   = meshCombineJob.endIndex;

            const byte belowSurface = 1, aboveSurface = 2;

            for (int i = startIndex; i < endIndex; i++)
            {
                MeshObject meshObject = meshObjects.items[i];

                Capture(meshObject.cachedGO.mr.bounds, layerMask, new Vector3(0, -1, 0), new Int2(1024, 1024));

                int startTriangleIndex = meshObject.startNewTriangleIndex;
                int endTriangleIndex   = meshObject.newTriangleCount + startTriangleIndex;

                // Debug.Log("startIndex " + startIndex + " triangle " + startTriangleIndex + " - " + endTriangleIndex);

                for (int j = startTriangleIndex; j < endTriangleIndex; j += 3)
                {
                    bool isAboveSurface = false;

                    for (int k = 0; k < 3; k++)
                    {
                        int vertexIndex = newTriangles[j + k];
                        if (vertexIndex == -1)
                        {
                            continue;
                        }

                        byte isBelow = vertexIsBelow[vertexIndex];

                        if (isBelow == 0)
                        {
                            pos = t.TransformPoint(newVertices[vertexIndex]);

                            float height = GetHeight(pos);

                            isBelow = pos.y < height ? belowSurface : aboveSurface;
                            vertexIsBelow[vertexIndex] = isBelow;

                            if (pos.y < height)
                            {
                                vertexIsBelow[vertexIndex] = isBelow = belowSurface;
                            }
                            else
                            {
                                vertexIsBelow[vertexIndex] = isBelow = aboveSurface;
                            }
                        }

                        if (isBelow != belowSurface)
                        {
                            isAboveSurface = true; break;
                        }
                    }

                    if (!isAboveSurface)
                    {
                        meshCombineJob.trianglesRemoved += 3;
                        newTriangles[j] = -1;
                    }
                }
            }

            Array.Clear(vertexIsBelow, 0, newVertices.Length);
        }