public void Unlock() { if (d3dLock) { d3dIndexBuffer.Unlock(); d3dLock = false; } }
/// <summary> /// Reloads the IndexBuffer for the vertices of the TerrainPage. /// </summary> public void RefreshIndexBuffer_Vertices() { if (_page != null) { GraphicsStream stream; short[] indices = new short[_page.TerrainPatch.NumVertices * 6]; short vertCount = 0; for (int i = 0; i < indices.Length; i += 6, vertCount += 4) { indices[i] = vertCount; indices[i + 1] = (short)(vertCount + 1); indices[i + 2] = (short)(vertCount + 2); indices[i + 3] = (short)(vertCount + 2); indices[i + 4] = (short)(vertCount + 3); indices[i + 5] = vertCount; } if (_ibVerts != null) { _ibVerts.Dispose(); _ibVerts = null; } _ibVerts = new D3D.IndexBuffer(typeof(short), indices.Length, _viewport.Device, D3D.Usage.WriteOnly, D3D.Pool.Managed); stream = _ibVerts.Lock(0, 0, D3D.LockFlags.None); stream.Write(indices); _ibVerts.Unlock(); _ibVertSize = indices.Length; } else if (_ibVerts != null) { if (!_ibVerts.Disposed) { _ibVerts.Dispose(); } _ibVerts = null; _ibVertSize = 0; } }
/// <summary> /// Reloads the IndexBuffer for the TerrainPage. /// </summary> public void RefreshIndexBuffer_Page() { if (_page != null) { GraphicsStream stream; short[] indices = new short[_page.TerrainPatch.Indices.Length]; for (int i = 0; i < indices.Length; i++) { indices[i] = _page.TerrainPatch.Indices[i]; } if (_ib != null) { _ib.Dispose(); _ib = null; } _ib = new D3D.IndexBuffer(typeof(short), indices.Length, _viewport.Device, D3D.Usage.WriteOnly, D3D.Pool.Managed); stream = _ib.Lock(0, 0, D3D.LockFlags.None); stream.Write(indices); _ib.Unlock(); _ibSize = indices.Length; } else if (_ib != null) { if (!_ib.Disposed) { _ib.Dispose(); } _ib = null; _ibSize = 0; } }
/// <summary> /// /// </summary> /// DOC public override void UnlockImpl() { // unlock the buffer d3dBuffer.Unlock(); }
/// <summary> /// Reloads the IndexBuffer for the vertices of the TerrainPage. /// </summary> public void RefreshIndexBuffer_Vertices() { if ( _page != null ) { GraphicsStream stream; short[] indices = new short[_page.TerrainPatch.NumVertices * 6]; short vertCount = 0; for ( int i = 0; i < indices.Length; i += 6, vertCount += 4 ) { indices[i] = vertCount; indices[i + 1] = (short) ( vertCount + 1 ); indices[i + 2] = (short) ( vertCount + 2 ); indices[i + 3] = (short) ( vertCount + 2 ); indices[i + 4] = (short) ( vertCount + 3 ); indices[i + 5] = vertCount; } if ( _ibVerts != null ) { _ibVerts.Dispose(); _ibVerts = null; } _ibVerts = new D3D.IndexBuffer( typeof( short ), indices.Length, _viewport.Device, D3D.Usage.WriteOnly, D3D.Pool.Managed ); stream = _ibVerts.Lock( 0, 0, D3D.LockFlags.None ); stream.Write( indices ); _ibVerts.Unlock(); _ibVertSize = indices.Length; } else if ( _ibVerts != null ) { if ( !_ibVerts.Disposed ) _ibVerts.Dispose(); _ibVerts = null; _ibVertSize = 0; } }
/// <summary> /// Reloads the IndexBuffer for the TerrainPage. /// </summary> public void RefreshIndexBuffer_Page() { if ( _page != null ) { GraphicsStream stream; short[] indices = new short[_page.TerrainPatch.Indices.Length]; for ( int i = 0; i < indices.Length; i++ ) indices[i] = _page.TerrainPatch.Indices[i]; if ( _ib != null ) { _ib.Dispose(); _ib = null; } _ib = new D3D.IndexBuffer( typeof( short ), indices.Length, _viewport.Device, D3D.Usage.WriteOnly, D3D.Pool.Managed ); stream = _ib.Lock( 0, 0, D3D.LockFlags.None ); stream.Write( indices ); _ib.Unlock(); _ibSize = indices.Length; } else if ( _ib != null ) { if ( !_ib.Disposed ) _ib.Dispose(); _ib = null; _ibSize = 0; } }