public BulletImmediateWorldDebugRenderer(DX11RenderContext context) { if (context == null) { throw new ArgumentNullException("context"); } this.context = context; this.solidColorShader = new SolidColorTransformed(context); this.box = context.Primitives.Box(new FeralTic.DX11.Geometry.Box()); this.sphere = context.Primitives.Sphere(new FeralTic.DX11.Geometry.Sphere() { Radius = 1.0f }); this.cylinder = context.Primitives.Cylinder(new Cylinder() { Length = 2.0f, Radius1 = 1.0f, Radius2 = 1.0f, }); this.box.ValidateLayout(this.solidColorShader.EffectPass, out this.boxSphereColorLayout); this.dynamicLine = new DX11VertexGeometry(context); this.dynamicLine.InputLayout = Pos3Vertex.Layout; this.dynamicLine.Topology = PrimitiveTopology.LineList; this.dynamicLine.VertexBuffer = BufferHelper.CreateDynamicVertexBuffer(context, 12 * 2); this.dynamicLine.VertexSize = Pos3Vertex.VertexSize; this.dynamicLine.VerticesCount = 2; this.dynamicLineTriangle = new DX11VertexGeometry(context); this.dynamicLineTriangle.InputLayout = Pos3Vertex.Layout; this.dynamicLineTriangle.Topology = PrimitiveTopology.LineStrip; this.dynamicLineTriangle.VertexBuffer = BufferHelper.CreateDynamicVertexBuffer(context, 12 * 3); this.dynamicLineTriangle.VertexSize = Pos3Vertex.VertexSize; this.dynamicLineTriangle.VerticesCount = 3; this.arcLine = new DX11VertexGeometry(context); this.arcLine.InputLayout = Pos3Vertex.Layout; this.arcLine.Topology = PrimitiveTopology.LineStrip; this.arcLine.VertexBuffer = BufferHelper.CreateDynamicVertexBuffer(context, 12 * 2048); this.arcLine.VertexSize = Pos3Vertex.VertexSize; this.arcLine.VerticesCount = 2048; this.dynamicLine.ValidateLayout(this.solidColorShader.EffectPass, out this.lineLayout); }
public void Dispose() { if (this.solidColorShader != null) { this.solidColorShader.Dispose(); this.solidColorShader = null; } if (this.dynamicLine != null) { this.dynamicLine.Dispose(); this.dynamicLine = null; } if (this.dynamicLineTriangle != null) { this.dynamicLineTriangle.Dispose(); this.dynamicLineTriangle = null; } if (this.boxSphereColorLayout != null) { this.boxSphereColorLayout.Dispose(); this.boxSphereColorLayout = null; } if (this.box != null) { this.box.Dispose(); this.box = null; } if (this.sphere != null) { this.sphere.Dispose(); this.sphere = null; } if (this.cylinder != null) { this.cylinder.Dispose(); this.cylinder = null; } }