1 /* 2 ******************************************************************************************* 3 * Dgame (a D game framework) - Copyright (c) Randy Schütt 4 * 5 * This software is provided 'as-is', without any express or implied warranty. 6 * In no event will the authors be held liable for any damages arising from 7 * the use of this software. 8 * 9 * Permission is granted to anyone to use this software for any purpose, 10 * including commercial applications, and to alter it and redistribute it 11 * freely, subject to the following restrictions: 12 * 13 * 1. The origin of this software must not be misrepresented; you must not claim 14 * that you wrote the original software. If you use this software in a product, 15 * an acknowledgment in the product documentation would be appreciated but is 16 * not required. 17 * 18 * 2. Altered source versions must be plainly marked as such, and must not be 19 * misrepresented as being the original software. 20 * 21 * 3. This notice may not be removed or altered from any source distribution. 22 ******************************************************************************************* 23 */ 24 module Dgame.Math.Vertex; 25 26 private: 27 28 import Dgame.Graphic.Color; 29 import Dgame.Math.Vector2; 30 31 public: 32 33 /** 34 * A Vertex is a coordinate, a color and a coordinate to the Texture 35 * 36 * Author: Randy Schuett (rswhite4@googlemail.com) 37 */ 38 struct Vertex { 39 /** 40 * The position 41 */ 42 Vector2f position; 43 /** 44 * The Texture coordinates, if any 45 */ 46 Vector2f texCoord; 47 /** 48 * The current Color. Default is Color4f.Black 49 */ 50 Color4f color = Color4f.Black; 51 52 /** 53 * CTor 54 */ 55 @nogc 56 this(const Vector2f pos, const Vector2f coords, const Color4b col) pure nothrow { 57 this(pos, coords); 58 59 this.color = col; 60 } 61 62 /** 63 * CTor 64 */ 65 @nogc 66 this(const Vector2f pos, const Vector2f coords) pure nothrow { 67 this.position = pos; 68 this.texCoord = coords; 69 } 70 71 /** 72 * CTor 73 */ 74 @nogc 75 this(const Vector2f pos) pure nothrow { 76 this.position = pos; 77 } 78 79 /** 80 * CTor 81 */ 82 @nogc 83 this(float x, float y) pure nothrow { 84 this.position.x = x; 85 this.position.y = y; 86 } 87 }