1 module nudsfml.graphics.vertex; 2 3 4 import nudsfml.graphics.color; 5 import nudsfml.system.vector2; 6 7 /** 8 * Define a point with color and texture coordinates. 9 */ 10 struct Vertex { 11 /// 2D position of the vertex 12 Vector2f position = Vector2f(0,0); 13 /// Color of the vertex. Default is White. 14 Color color = Color.White; 15 /// 2D coordinates of the texture's pixel map to the vertex. 16 Vector2f texCoords = Vector2f(0,0); 17 18 /** 19 * Construct the vertex from its position 20 * 21 * The vertex color is white and texture coordinates are (0, 0). 22 * 23 * Params: 24 * thePosition = Vertex position 25 */ 26 this(Vector2f thePosition) { 27 position = thePosition; 28 } 29 30 /** 31 * Construct the vertex from its position and color 32 * 33 * The texture coordinates are (0, 0). 34 * 35 * Params: 36 * thePosition = Vertex position 37 * theColor = Vertex color 38 */ 39 this(Vector2f thePosition, Color theColor){ 40 position = thePosition; 41 color = theColor; 42 } 43 44 /** 45 * Construct the vertex from its position and texture coordinates 46 * 47 * The vertex color is white. 48 * 49 * Params: 50 * thePosition = Vertex position 51 * theTexCoords = Vertex texture coordinates 52 */ 53 this(Vector2f thePosition, Vector2f theTexCoords) { 54 position = thePosition; 55 texCoords = theTexCoords; 56 } 57 58 /** 59 * Construct the vertex from its position, color and texture coordinates 60 * 61 * Params: 62 * thePosition = Vertex position 63 * theColor = Vertex color 64 * theTexCoords = Vertex texture coordinates 65 */ 66 this(Vector2f thePosition, Color theColor, Vector2f theTexCoords){ 67 position = thePosition; 68 color = theColor; 69 texCoords = theTexCoords; 70 } 71 }