示例#1
0
 public Mesh(GxContext context)
 {
     mContext = context;
     VertexBuffer = new VertexBuffer(context);
     IndexBuffer = new IndexBuffer(context);
     DepthState = new DepthState(context);
     RasterizerState = new RasterState(context);
     BlendState = new BlendState(context);
 }
示例#2
0
 public void UpdateIndexBuffer(IndexBuffer ib)
 {
     mContext.Context.InputAssembler.SetIndexBuffer(ib.Native, ib.IndexFormat, 0);
 }
示例#3
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
            });
        }
示例#4
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;
        }
示例#5
0
 public void UpdateIndexBuffer(IndexBuffer ib)
 {
     mContext.Context.InputAssembler.SetIndexBuffer(ib.Native, ib.IndexFormat, 0);
 }