| | 1 | | // <copyright file="ObjVertex.cs" company="Jérémy Ansel"> |
| | 2 | | // Copyright (c) 2017, 2019 Jérémy Ansel |
| | 3 | | // </copyright> |
| | 4 | | // <license> |
| | 5 | | // Licensed under the MIT license. See LICENSE.txt |
| | 6 | | // </license> |
| | 7 | |
|
| | 8 | | using Equatable.Attributes; |
| | 9 | |
|
| | 10 | | namespace JeremyAnsel.Media.WavefrontObj |
| | 11 | | { |
| | 12 | | [System.Diagnostics.DebuggerDisplay("Vertex Position:{Position} Color:{Color}")] |
| | 13 | | [Equatable] |
| | 14 | | public partial struct ObjVertex |
| | 15 | | { |
| | 16 | | private ObjVector4 position; |
| | 17 | |
|
| | 18 | | private ObjVector4? color; |
| | 19 | |
|
| | 20 | | public ObjVertex(float x, float y, float z) |
| | 21 | | { |
| 88 | 22 | | this.position = new ObjVector4(x, y, z, 1.0f); |
| 88 | 23 | | this.color = null; |
| 88 | 24 | | } |
| | 25 | |
|
| | 26 | | public ObjVertex(float x, float y, float z, float w) |
| | 27 | | { |
| 20 | 28 | | this.position = new ObjVector4(x, y, z, w); |
| 20 | 29 | | this.color = null; |
| 20 | 30 | | } |
| | 31 | |
|
| | 32 | | public ObjVertex(float x, float y, float z, float r, float g, float b) |
| | 33 | | { |
| 4 | 34 | | this.position = new ObjVector4(x, y, z, 1.0f); |
| 4 | 35 | | this.color = new ObjVector4(r, g, b, 1.0f); |
| 4 | 36 | | } |
| | 37 | |
|
| | 38 | | public ObjVertex(float x, float y, float z, float r, float g, float b, float a) |
| | 39 | | { |
| 32 | 40 | | this.position = new ObjVector4(x, y, z, 1.0f); |
| 32 | 41 | | this.color = new ObjVector4(r, g, b, a); |
| 32 | 42 | | } |
| | 43 | |
|
| | 44 | | public ObjVector4 Position |
| | 45 | | { |
| 380 | 46 | | get { return this.position; } |
| 1312 | 47 | | set { this.position = value; } |
| | 48 | | } |
| | 49 | |
|
| | 50 | | public ObjVector4? Color |
| | 51 | | { |
| 284 | 52 | | get { return this.color; } |
| 24 | 53 | | set { this.color = value; } |
| | 54 | | } |
| | 55 | | } |
| | 56 | | } |
| | 57 | |
|