Exemple #1
0
        public static void UploadUnpackedMesh(IntPtr meshPtr)
        {
            MarshalledMesh marshalled         = (MarshalledMesh)Marshal.PtrToStructure(meshPtr, typeof(MarshalledMesh));
            GCHandle       unpackedMeshHandle = GCHandle.FromIntPtr(marshalled.unpackedMeshHandle);
            var            result             = unpackedMeshHandle.Target as UnpackedMesh;

            result.FreeTrackedHandles();

            // this is one of the points where we could create an identifier that we could use to delete the mesh (other than the string name)
            m_preparedMeshes.AddPreparedMeshRecord(CreatePreparedMeshRecordFromUnpackedMesh(result));
        }
Exemple #2
0
            // Create a MarshalledMesh whose IntPtrs point at the (pinned) data arrays in this mesh
            public IntPtr CreatePointerToMarshalledMesh()
            {
                var marshalledMesh = new MarshalledMesh();

                marshalledMesh.vertices = PinAndTrackHandle(vertices);
                marshalledMesh.uvs      = PinAndTrackHandle(uvs);

                if (uv2s != null)
                {
                    marshalledMesh.uv2s = PinAndTrackHandle(uv2s);
                }

                marshalledMesh.indices    = PinAndTrackHandle(indices);
                marshalledMesh.originEcef = PinAndTrackHandle(originECEF);

                GCHandle handle = GCHandle.Alloc(this);

                marshalledMesh.unpackedMeshHandle = GCHandle.ToIntPtr(handle);
                gcHandles.Add(handle);

                return(PinAndTrackHandle(marshalledMesh));
            }