Пример #1
0
        public void Load(IntPtr handle)
        {
            faceMode = (FaceMode)BrowserInterop.vtsGetMeshFaceMode(handle);
            Util.CheckError();
            IntPtr bufPtr;
            uint   bufSize;

            BrowserInterop.vtsGetMeshIndices(handle, out bufPtr, out bufSize, out indicesCount);
            Util.CheckError();
            if (indicesCount > 0)
            {
                short[] tmp = new short[indicesCount];
                Marshal.Copy(bufPtr, tmp, 0, (int)indicesCount);
                indices = new ushort[indicesCount];
                Buffer.BlockCopy(tmp, 0, indices, 0, (int)indicesCount * 2);
            }
            BrowserInterop.vtsGetMeshVertices(handle, out bufPtr, out bufSize, out verticesCount);
            Util.CheckError();
            vertices = new byte[bufSize];
            Marshal.Copy(bufPtr, vertices, 0, (int)bufSize);
            attributes = new List <VertexAttribute>(4);
            for (uint i = 0; i < 4; i++)
            {
                VertexAttribute a;
                uint            type;
                BrowserInterop.vtsGetMeshAttribute(handle, i, out a.offset, out a.stride, out a.components, out type, out a.enable, out a.normalized);
                Util.CheckError();
                a.type = (GpuType)type;
                attributes.Add(a);
            }
        }