// Copyright (c) 2010-2011 SharpDX - Alexandre Mutel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using SharpDX.Mathematics.Interop; namespace SharpDX.Direct3D9 { public partial class Line { /// /// Instantiates a left-handed coordinate system to create a . /// /// Pointer to an interface, representing the device associated with the created box mesh. /// /// This function creates a mesh with the creation option and | Flexible Vertex Format (FVF). /// /// HRESULT D3DXCreateLine([In] IDirect3DDevice9* pDevice,[Out, Fast] ID3DXLine** ppLine) public Line(Device device) { D3DX9.CreateLine(device, this); } /// /// Draws a line strip in screen space. Input is in the form of an array that defines points (of ) on the line strip. /// /// No documentation. /// No documentation. /// HRESULT ID3DXLine::Draw([In] const void* pVertexList,[In] unsigned int dwVertexListCount,[In] D3DCOLOR Color) public void Draw(RawVector2[] vertices, RawColorBGRA color) { unsafe { fixed (void* pVertexListRef = vertices) Draw((IntPtr)pVertexListRef, vertices.Length, color); } } /// /// Draws a line strip in screen space. Input is in the form of an array that defines points (of ) on the line strip. /// /// No documentation. /// No documentation. /// HRESULT ID3DXLine::Draw([In] const void* pVertexList,[In] unsigned int dwVertexListCount,[In] D3DCOLOR Color) public void Draw(T[] vertices, RawColorBGRA color) where T : struct { unsafe { if (Utilities.SizeOf() != sizeof(RawVector2)) throw new ArgumentException("Invalid size for T. Must be 2 floats (8 bytes)"); Draw((IntPtr)Interop.Fixed(vertices), vertices.Length, color); } } /// /// Draws a line strip in screen space with a specified input transformation matrix. /// /// Array of vertices that make up the line. See . /// A scale, rotate, and translate (SRT) matrix for transforming the points. See . If this matrix is a projection matrix, any stippled lines will be drawn with a perspective-correct stippling pattern. Or, you can transform the vertices and use to draw the line with a nonperspective-correct stipple pattern. /// Color of the line. See . /// If the method succeeds, the return value is . If the method fails, the return value can be one of the following: , D3DXERR_INVALIDDATA. /// HRESULT ID3DXLine::DrawTransform([In] const void* pVertexList,[In] unsigned int dwVertexListCount,[In] const D3DXMATRIX* pTransform,[In] D3DCOLOR Color) public void DrawTransform(RawVector3[] vertices, RawMatrix transform, RawColorBGRA color) { unsafe { fixed (void* pVertexListRef = vertices) DrawTransform((IntPtr)pVertexListRef, vertices.Length, ref transform, color); } } /// /// Draws a line strip in screen space with a specified input transformation matrix. /// /// Array of vertices that make up the line. See . /// A scale, rotate, and translate (SRT) matrix for transforming the points. See . If this matrix is a projection matrix, any stippled lines will be drawn with a perspective-correct stippling pattern. Or, you can transform the vertices and use to draw the line with a nonperspective-correct stipple pattern. /// Color of the line. See . /// If the method succeeds, the return value is . If the method fails, the return value can be one of the following: , D3DXERR_INVALIDDATA. /// HRESULT ID3DXLine::DrawTransform([In] const void* pVertexList,[In] unsigned int dwVertexListCount,[In] const D3DXMATRIX* pTransform,[In] D3DCOLOR Color) public void DrawTransform(T[] vertices, RawMatrix transform, RawColorBGRA color) where T : struct { unsafe { if (Utilities.SizeOf() != sizeof(RawVector3)) throw new ArgumentException("Invalid size for T. Must be 3 floats (12 bytes)"); DrawTransform((IntPtr)Interop.Fixed(vertices), vertices.Length, ref transform, color); } } } }