Fillwave  10.0.0
Vertex.h
1 #pragma once
2 
3 /*
4  * The MIT License (MIT)
5  *
6  * Copyright (c) 2018 Filip Wasil and Fillwave community members
7  *
8  * Permission is hereby granted, free of charge, to any person
9  * obtaining a copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
12  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 #include <flw/OpenGL.h>
25 
26 #include <type_traits>
27 #include <iostream>
28 
29 #include <stddef.h>
30 
31 namespace flw {
32 namespace flc {
33 
34 //template <class... Ts>
35 //struct Vertex {
36 //
37 //};
38 //
39 //template <class T, class... Ts>
40 //struct Vertex<T, Ts...> : Vertex<Ts...> {
41 // Vertex(T t, Ts... ts) : Vertex<Ts...>(ts...), mAttribute(t) {}
42 //
43 // T mAttribute;
44 //};
45 //
46 //template <size_t k, class T,class... Ts>
47 //struct AttributeTypeHolder {};
48 //
49 //template <class T, class... Ts>
50 //struct AttributeTypeHolder<0, Vertex<T, Ts...> > {
51 // typedef T type;
52 //};
53 //
54 //template <size_t k, class T, class... Ts>
55 //struct AttributeTypeHolder<k, Vertex<T, Ts...> > {
56 // typedef typename AttributeTypeHolder<k - 1, Vertex<Ts...>>::type type;
57 //};
58 //
59 //template <size_t k = 0, class... Ts>
60 //typename std::enable_if<
61 // k == 0, typename AttributeTypeHolder<0, Vertex<Ts...>>::type&>::type
62 //getVertex(Vertex<Ts...>& t) {
63 // return t.mAttribute;
64 //}
65 //
66 //template <size_t k = 0, class T, class... Ts>
67 //typename std::enable_if<
68 // k != 0, typename AttributeTypeHolder<k, Vertex<T, Ts...>>::type&>::type
69 //getVertex(Vertex<T, Ts...>& t) {
70 // Vertex<Ts...>& base = t;
71 // return getVertex<k - 1>(base);
72 //}
73 //
74 //template <int k = 0, class... Ts>
75 //typename std::enable_if<
76 // k == 0, int>::type
77 //getAttributeOffset(Vertex<Ts...>& t, int size = 0) {
78 // return size;
79 //}
80 //
81 //template <int k = 0, class T, class... Ts>
82 //typename std::enable_if<
83 // k != 0, int>::type
84 //getAttributeOffset(Vertex<T, Ts...>& t, int size = 0) {
85 // Vertex<Ts...>& base = t;
86 // if (sizeof(base) == 1) {
87 // return size + sizeof(t);
88 // } else {
89 // return getAttributeOffset<k - 1>(base, size + sizeof(t) - sizeof(base));
90 // }
91 //}
92 
93 /*
94  * How to:
95  *
96  * Vertex<int, float, char, glmL::mat4> vertexTuple;
97  *
98  * ------------- VALUES ---------------
99  *
100  * int integer = get<0>(vertexTuple);
101  *
102  * float floatingPoint = get<1>(vertexTuple);
103  *
104  * get<2>(vertexTuple) = 'a';
105  *
106  * get<3>(vertexTuple) = glm::mat4(1.0);
107  *
108  * ------------- OFFSETS --------------
109  *
110  * int offsetInt = getOffset<0>(vertexTuple);
111  *
112  * int offsetFloat = getOffset<1>(vertexTuple);
113  *
114  * int offsetChar = getOffset<2>(vertexTuple);
115  *
116  * int offsetMatrix = getOffset<3>(vertexTuple);
117  *
118  */
119 
120 } /* flc */
121 } /* flw */
Definition: Aliases.h:30