Beispiel #1
0
        private void SyncLoad()
        {
            if (mVertices == null || mIndices == null || Groups == null)
                return;

            mVertexBuffer = new VertexBuffer(WorldFrame.Instance.GraphicsContext);
            mIndexBuffer = new IndexBuffer(WorldFrame.Instance.GraphicsContext)
            {
                IndexFormat = SharpDX.DXGI.Format.R32_UInt
            };

            if (mVertices.Length != 0 && mIndices.Length != 0)
            {
                mVertexBuffer.UpdateData(mVertices);
                mIndexBuffer.UpdateData(mIndices);
            }

            foreach (var group in Groups)
                group.SyncLoad();

            mSyncLoaded = true;
        }
Beispiel #2
0
        private void SyncLoad()
        {
            mIsSyncLoaded = true;

            if (mModel.Vertices.Length == 0 || mModel.Indices.Length == 0 || mModel.Passes.Count == 0)
            {
                mSkipRendering = true;
                return;
            }

            var ctx = WorldFrame.Instance.GraphicsContext;
            mVertexBuffer = new VertexBuffer(ctx);
            mIndexBuffer = new IndexBuffer(ctx);

            mVertexBuffer.UpdateData(mModel.Vertices);
            mIndexBuffer.UpdateData(mModel.Indices);

            mAnimBuffer = new ConstantBuffer(ctx);
            mAnimBuffer.UpdateData(mAnimationMatrices);

            mPerPassBuffer = new ConstantBuffer(ctx);
            mPerPassBuffer.UpdateData(new PerModelPassBuffer()
            {
                uvAnimMatrix = Matrix.Identity,
                modelPassParams = Vector4.Zero
            });
        }