public override void Initialize( ) { if (pointBuffer != null) { pointBuffer.Dispose(); } //Create the vertex buffer pointBuffer = new AutoVertexBuffer(d3d, typeof(CustomVertex.PositionNormalColored), positions.Count, Usage.Dynamic, CustomVertex.PositionNormalColored.Format, Pool.Default); CustomVertex.PositionNormalColored[] verts = new CustomVertex.PositionNormalColored[positions.Count]; int index = 0; foreach (CustomVertex.PositionColored vertex in positions) { verts[index].Position = vertex.Position; verts[index].Color = vertex.Color; verts[index].Normal = new Vector3(0, 0, 1); index++; } pointBuffer.VB.SetData(verts, 0, LockFlags.None); }
public override void Initialize( ) { if (gridVertexBuffer != null) { gridVertexBuffer.Dispose( ); vertexCount = 0; } switch (gridPlane) { case GridPlane.XY: GenerateXYGrid( ); break; case GridPlane.XZ: GenerateXZGrid( ); break; case GridPlane.YZ: GenerateYZGrid( ); break; default: break; } }
public override void Initialize( ) { if (pointBuffer != null) { pointBuffer.Dispose(); } model = source as PointModel; //Create the vertex buffer pointBuffer = new AutoVertexBuffer(d3d, typeof(CustomVertex.PositionNormal), 1, Usage.Dynamic, CustomVertex.PositionNormal.Format, Pool.Default); CustomVertex.PositionNormal[] verts = new CustomVertex.PositionNormal[1]; verts[0].Position = model.Position; verts[0].Normal = Direct3dRender.DefaultVertexNormal; pointBuffer.VB.SetData(verts, 0, LockFlags.None); }