/// <summary> /// Called when [create index buffer]. /// </summary> /// <param name="context">The context.</param> /// <param name="buffer">The buffer.</param> /// <param name="geometry">The geometry.</param> /// <param name="deviceResources">The device resources.</param> protected override void OnCreateIndexBuffer(DeviceContextProxy context, IElementsBufferProxy buffer, Geometry3D geometry, IDeviceResources deviceResources) { if (geometry != null && geometry.Indices != null && geometry.Indices.Count > 0) { buffer.UploadDataToBuffer(context, geometry.Indices, geometry.Indices.Count); } else { buffer.DisposeAndClear(); } }
/// <summary> /// Called when [create vertex buffer]. /// </summary> /// <param name="context">The context.</param> /// <param name="buffer">The buffer.</param> /// <param name="geometry">The geometry.</param> /// <param name="deviceResources">The device resources.</param> /// <param name="bufferIndex"></param> protected override void OnCreateVertexBuffer(DeviceContextProxy context, IElementsBufferProxy buffer, int bufferIndex, Geometry3D geometry, IDeviceResources deviceResources) { // -- set geometry if given if (geometry != null && geometry.Positions != null && geometry.Positions.Count > 0) { // --- get geometry var mesh = geometry as LineGeometry3D; var data = OnBuildVertexArray(mesh); buffer.UploadDataToBuffer(context, data, geometry.Positions.Count); } else { buffer.DisposeAndClear(); } }
/// <summary> /// Called when [create vertex buffer]. /// </summary> /// <param name="context">The context.</param> /// <param name="buffer">The buffer.</param> /// <param name="geometry">The geometry.</param> /// <param name="deviceResources">The device resources.</param> /// <param name="bufferIndex"></param> protected override void OnCreateVertexBuffer(DeviceContextProxy context, IElementsBufferProxy buffer, int bufferIndex, Geometry3D geometry, IDeviceResources deviceResources) { var billboardGeometry = geometry as IBillboardText; billboardGeometry.DrawTexture(deviceResources); if (billboardGeometry != null && billboardGeometry.BillboardVertices != null && billboardGeometry.BillboardVertices.Count > 0) { Type = billboardGeometry.Type; var data = OnBuildVertexArray(billboardGeometry, deviceResources); buffer.UploadDataToBuffer(context, data, billboardGeometry.BillboardVertices.Count); RemoveAndDispose(ref textureView); if (billboardGeometry.Texture != null) { textureView = Collect(deviceResources.MaterialTextureManager.Register(billboardGeometry.Texture)); } } else { textureView = null; buffer.DisposeAndClear(); } }