FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
DirectXTK/Inc/VertexTypes.h at main · microsoft/DirectXTK · GitHub
microsoft
/
DirectXTK
Public
Notifications
You must be signed in to change notification settings
Fork
537
Star
2.9k
Code
Issues
34
Pull requests
0
Actions
Projects
Wiki
Security and quality
2
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
DirectXTK
/
Inc
/
VertexTypes.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
497 lines (405 loc) · 22 KB
Breadcrumbs
DirectXTK
/
Inc
/
VertexTypes.h
Copy path
File metadata and controls
497 lines (405 loc) · 22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
//
--------------------------------------------------------------------------------------
//
File: VertexTypes.h
//
//
Copyright (c) Microsoft Corporation.
//
Licensed under the MIT License.
//
//
https://go.microsoft.com/fwlink/?LinkId=248929
//
--------------------------------------------------------------------------------------
#
pragma
once
#
if
defined(_XBOX_ONE) && defined(_TITLE)
#
include
<
d3d11_x.h
>
#
else
#
include
<
d3d11_1.h
>
#
endif
#
include
<
cstdint
>
#
include
<
DirectXMath.h
>
#
ifndef
DIRECTX_TOOLKIT_API
#
ifdef
DIRECTX_TOOLKIT_EXPORT
#
ifdef
__GNUC__
#
define
DIRECTX_TOOLKIT_API
__attribute__
((dllexport))
#
else
#
define
DIRECTX_TOOLKIT_API
__declspec
(dllexport)
#endif
#
elif
defined(DIRECTX_TOOLKIT_IMPORT)
#
ifdef
__GNUC__
#
define
DIRECTX_TOOLKIT_API
__attribute__
((dllimport))
#
else
#
define
DIRECTX_TOOLKIT_API
__declspec
(dllimport)
#endif
#
else
#
define
DIRECTX_TOOLKIT_API
#
endif
#
endif
#
if
defined(DIRECTX_TOOLKIT_IMPORT) && defined(_MSC_VER)
#
pragma
warning(push)
#
pragma
warning(disable : 4251)
#
endif
namespace
DirectX
{
inline
namespace
DX11
{
//
Vertex struct holding position information.
struct
DIRECTX_TOOLKIT_API
VertexPosition
{
VertexPosition
() =
default
;
VertexPosition
(
const
VertexPosition&) =
default
;
VertexPosition&
operator
=(
const
VertexPosition&) =
default
;
VertexPosition
(VertexPosition&&) =
default
;
VertexPosition&
operator
=(VertexPosition&&) =
default
;
VertexPosition
(
XMFLOAT3
const
& iposition)
noexcept
: position(iposition)
{}
VertexPosition
(
FXMVECTOR
iposition)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition); }
XMFLOAT3
position;
static
constexpr
unsigned
int
InputElementCount =
1
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct holding position and color information.
struct
DIRECTX_TOOLKIT_API
VertexPositionColor
{
VertexPositionColor
() =
default
;
VertexPositionColor
(
const
VertexPositionColor&) =
default
;
VertexPositionColor&
operator
=(
const
VertexPositionColor&) =
default
;
VertexPositionColor
(VertexPositionColor&&) =
default
;
VertexPositionColor&
operator
=(VertexPositionColor&&) =
default
;
VertexPositionColor
(
XMFLOAT3
const
& iposition,
XMFLOAT4
const
& icolor)
noexcept
: position(iposition),
color
(icolor)
{}
VertexPositionColor
(
FXMVECTOR
iposition,
FXMVECTOR
icolor)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat4
(&
this
->
color
, icolor);
}
XMFLOAT3
position;
XMFLOAT4
color;
static
constexpr
unsigned
int
InputElementCount =
2
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct holding position and texture mapping information.
struct
DIRECTX_TOOLKIT_API
VertexPositionTexture
{
VertexPositionTexture
() =
default
;
VertexPositionTexture
(
const
VertexPositionTexture&) =
default
;
VertexPositionTexture&
operator
=(
const
VertexPositionTexture&) =
default
;
VertexPositionTexture
(VertexPositionTexture&&) =
default
;
VertexPositionTexture&
operator
=(VertexPositionTexture&&) =
default
;
VertexPositionTexture
(
XMFLOAT3
const
& iposition,
XMFLOAT2
const
& itextureCoordinate)
noexcept
: position(iposition),
textureCoordinate
(itextureCoordinate)
{}
VertexPositionTexture
(
FXMVECTOR
iposition,
FXMVECTOR
itextureCoordinate)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat2
(&
this
->
textureCoordinate
, itextureCoordinate);
}
XMFLOAT3
position;
XMFLOAT2
textureCoordinate;
static
constexpr
unsigned
int
InputElementCount =
2
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct holding position and dual texture mapping information.
struct
DIRECTX_TOOLKIT_API
VertexPositionDualTexture
{
VertexPositionDualTexture
() =
default
;
VertexPositionDualTexture
(
const
VertexPositionDualTexture&) =
default
;
VertexPositionDualTexture&
operator
=(
const
VertexPositionDualTexture&) =
default
;
VertexPositionDualTexture
(VertexPositionDualTexture&&) =
default
;
VertexPositionDualTexture&
operator
=(VertexPositionDualTexture&&) =
default
;
VertexPositionDualTexture
(
XMFLOAT3
const
& iposition,
XMFLOAT2
const
& itextureCoordinate0,
XMFLOAT2
const
& itextureCoordinate1)
noexcept
: position(iposition),
textureCoordinate0
(itextureCoordinate0),
textureCoordinate1(itextureCoordinate1)
{}
VertexPositionDualTexture
(
FXMVECTOR
iposition,
FXMVECTOR
itextureCoordinate0,
FXMVECTOR
itextureCoordinate1)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat2
(&
this
->
textureCoordinate0
, itextureCoordinate0);
XMStoreFloat2
(&
this
->
textureCoordinate1
, itextureCoordinate1);
}
XMFLOAT3
position;
XMFLOAT2
textureCoordinate0;
XMFLOAT2
textureCoordinate1;
static
constexpr
unsigned
int
InputElementCount =
3
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct holding position and normal vector.
struct
DIRECTX_TOOLKIT_API
VertexPositionNormal
{
VertexPositionNormal
() =
default
;
VertexPositionNormal
(
const
VertexPositionNormal&) =
default
;
VertexPositionNormal&
operator
=(
const
VertexPositionNormal&) =
default
;
VertexPositionNormal
(VertexPositionNormal&&) =
default
;
VertexPositionNormal&
operator
=(VertexPositionNormal&&) =
default
;
VertexPositionNormal
(
XMFLOAT3
const
& iposition,
XMFLOAT3
const
& inormal)
noexcept
: position(iposition),
normal
(inormal)
{}
VertexPositionNormal
(
FXMVECTOR
iposition,
FXMVECTOR
inormal)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat3
(&
this
->
normal
, inormal);
}
XMFLOAT3
position;
XMFLOAT3
normal;
static
constexpr
unsigned
int
InputElementCount =
2
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct holding position, color, and texture mapping information.
struct
DIRECTX_TOOLKIT_API
VertexPositionColorTexture
{
VertexPositionColorTexture
() =
default
;
VertexPositionColorTexture
(
const
VertexPositionColorTexture&) =
default
;
VertexPositionColorTexture&
operator
=(
const
VertexPositionColorTexture&) =
default
;
VertexPositionColorTexture
(VertexPositionColorTexture&&) =
default
;
VertexPositionColorTexture&
operator
=(VertexPositionColorTexture&&) =
default
;
VertexPositionColorTexture
(
XMFLOAT3
const
& iposition,
XMFLOAT4
const
& icolor,
XMFLOAT2
const
& itextureCoordinate)
noexcept
: position(iposition),
color
(icolor),
textureCoordinate(itextureCoordinate)
{}
VertexPositionColorTexture
(
FXMVECTOR
iposition,
FXMVECTOR
icolor,
FXMVECTOR
itextureCoordinate)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat4
(&
this
->
color
, icolor);
XMStoreFloat2
(&
this
->
textureCoordinate
, itextureCoordinate);
}
XMFLOAT3
position;
XMFLOAT4
color;
XMFLOAT2
textureCoordinate;
static
constexpr
unsigned
int
InputElementCount =
3
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct holding position, normal vector, and color information.
struct
DIRECTX_TOOLKIT_API
VertexPositionNormalColor
{
VertexPositionNormalColor
() =
default
;
VertexPositionNormalColor
(
const
VertexPositionNormalColor&) =
default
;
VertexPositionNormalColor&
operator
=(
const
VertexPositionNormalColor&) =
default
;
VertexPositionNormalColor
(VertexPositionNormalColor&&) =
default
;
VertexPositionNormalColor&
operator
=(VertexPositionNormalColor&&) =
default
;
VertexPositionNormalColor
(
XMFLOAT3
const
& iposition,
XMFLOAT3
const
& inormal,
XMFLOAT4
const
& icolor)
noexcept
: position(iposition),
normal
(inormal),
color(icolor)
{}
VertexPositionNormalColor
(
FXMVECTOR
iposition,
FXMVECTOR
inormal,
FXMVECTOR
icolor)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat3
(&
this
->
normal
, inormal);
XMStoreFloat4
(&
this
->
color
, icolor);
}
XMFLOAT3
position;
XMFLOAT3
normal;
XMFLOAT4
color;
static
constexpr
unsigned
int
InputElementCount =
3
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct holding position, normal vector, and texture mapping information.
struct
DIRECTX_TOOLKIT_API
VertexPositionNormalTexture
{
VertexPositionNormalTexture
() =
default
;
VertexPositionNormalTexture
(
const
VertexPositionNormalTexture&) =
default
;
VertexPositionNormalTexture&
operator
=(
const
VertexPositionNormalTexture&) =
default
;
VertexPositionNormalTexture
(VertexPositionNormalTexture&&) =
default
;
VertexPositionNormalTexture&
operator
=(VertexPositionNormalTexture&&) =
default
;
VertexPositionNormalTexture
(
XMFLOAT3
const
& iposition,
XMFLOAT3
const
& inormal,
XMFLOAT2
const
& itextureCoordinate)
noexcept
: position(iposition),
normal
(inormal),
textureCoordinate(itextureCoordinate)
{}
VertexPositionNormalTexture
(
FXMVECTOR
iposition,
FXMVECTOR
inormal,
FXMVECTOR
itextureCoordinate)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat3
(&
this
->
normal
, inormal);
XMStoreFloat2
(&
this
->
textureCoordinate
, itextureCoordinate);
}
XMFLOAT3
position;
XMFLOAT3
normal;
XMFLOAT2
textureCoordinate;
static
constexpr
unsigned
int
InputElementCount =
3
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct holding position, normal vector, color, and texture mapping information.
struct
DIRECTX_TOOLKIT_API
VertexPositionNormalColorTexture
{
VertexPositionNormalColorTexture
() =
default
;
VertexPositionNormalColorTexture
(
const
VertexPositionNormalColorTexture&) =
default
;
VertexPositionNormalColorTexture&
operator
=(
const
VertexPositionNormalColorTexture&) =
default
;
VertexPositionNormalColorTexture
(VertexPositionNormalColorTexture&&) =
default
;
VertexPositionNormalColorTexture&
operator
=(VertexPositionNormalColorTexture&&) =
default
;
VertexPositionNormalColorTexture
(
XMFLOAT3
const
& iposition,
XMFLOAT3
const
& inormal,
XMFLOAT4
const
& icolor,
XMFLOAT2
const
& itextureCoordinate)
noexcept
: position(iposition),
normal
(inormal),
color(icolor),
textureCoordinate(itextureCoordinate)
{}
VertexPositionNormalColorTexture
(
FXMVECTOR
iposition,
FXMVECTOR
inormal,
FXMVECTOR
icolor,
CXMVECTOR
itextureCoordinate)
noexcept
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat3
(&
this
->
normal
, inormal);
XMStoreFloat4
(&
this
->
color
, icolor);
XMStoreFloat2
(&
this
->
textureCoordinate
, itextureCoordinate);
}
XMFLOAT3
position;
XMFLOAT3
normal;
XMFLOAT4
color;
XMFLOAT2
textureCoordinate;
static
constexpr
unsigned
int
InputElementCount =
4
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct for Visual Studio Shader Designer (DGSL) holding position, normal,
//
tangent, color (RGBA), and texture mapping information
struct
DIRECTX_TOOLKIT_API
VertexPositionNormalTangentColorTexture
{
VertexPositionNormalTangentColorTexture
() =
default
;
VertexPositionNormalTangentColorTexture
(
const
VertexPositionNormalTangentColorTexture&) =
default
;
VertexPositionNormalTangentColorTexture&
operator
=(
const
VertexPositionNormalTangentColorTexture&) =
default
;
VertexPositionNormalTangentColorTexture
(VertexPositionNormalTangentColorTexture&&) =
default
;
VertexPositionNormalTangentColorTexture&
operator
=(VertexPositionNormalTangentColorTexture&&) =
default
;
XMFLOAT3
position;
XMFLOAT3
normal;
XMFLOAT4
tangent;
uint32_t
color;
XMFLOAT2
textureCoordinate;
VertexPositionNormalTangentColorTexture
(
XMFLOAT3
const
& iposition,
XMFLOAT3
const
& inormal,
XMFLOAT4
const
& itangent,
uint32_t
irgba,
XMFLOAT2
const
& itextureCoordinate)
noexcept
: position(iposition),
normal
(inormal),
tangent(itangent),
color(irgba),
textureCoordinate(itextureCoordinate)
{}
VertexPositionNormalTangentColorTexture
(
FXMVECTOR
iposition,
FXMVECTOR
inormal,
FXMVECTOR
itangent,
uint32_t
irgba,
CXMVECTOR
itextureCoordinate)
noexcept
: color(irgba)
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat3
(&
this
->
normal
, inormal);
XMStoreFloat4
(&
this
->
tangent
, itangent);
XMStoreFloat2
(&
this
->
textureCoordinate
, itextureCoordinate);
}
VertexPositionNormalTangentColorTexture
(
XMFLOAT3
const
& iposition,
XMFLOAT3
const
& inormal,
XMFLOAT4
const
& itangent,
XMFLOAT4
const
& icolor,
XMFLOAT2
const
& itextureCoordinate)
noexcept
: position(iposition),
normal(inormal),
tangent(itangent),
color{},
textureCoordinate
(itextureCoordinate)
{
SetColor
(icolor);
}
VertexPositionNormalTangentColorTexture
(
FXMVECTOR
iposition,
FXMVECTOR
inormal,
FXMVECTOR
itangent,
CXMVECTOR
icolor,
CXMVECTOR
itextureCoordinate)
noexcept
: color{}
{
XMStoreFloat3
(&
this
->
position
, iposition);
XMStoreFloat3
(&
this
->
normal
, inormal);
XMStoreFloat4
(&
this
->
tangent
, itangent);
XMStoreFloat2
(&
this
->
textureCoordinate
, itextureCoordinate);
SetColor
(icolor);
}
void
__cdecl
SetColor
(
XMFLOAT4
const
& icolor)
noexcept
{
SetColor
(
XMLoadFloat4
(&icolor)); }
void
XM_CALLCONV
SetColor
(
FXMVECTOR
icolor)
noexcept
;
static
constexpr
unsigned
int
InputElementCount =
5
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
//
Vertex struct for Visual Studio Shader Designer (DGSL) holding position, normal,
//
tangent, color (RGBA), texture mapping information, and skinning weights
struct
DIRECTX_TOOLKIT_API
VertexPositionNormalTangentColorTextureSkinning : public VertexPositionNormalTangentColorTexture
{
VertexPositionNormalTangentColorTextureSkinning
() =
default
;
VertexPositionNormalTangentColorTextureSkinning
(
const
VertexPositionNormalTangentColorTextureSkinning&) =
default
;
VertexPositionNormalTangentColorTextureSkinning&
operator
=(
const
VertexPositionNormalTangentColorTextureSkinning&) =
default
;
VertexPositionNormalTangentColorTextureSkinning
(VertexPositionNormalTangentColorTextureSkinning&&) =
default
;
VertexPositionNormalTangentColorTextureSkinning&
operator
=(VertexPositionNormalTangentColorTextureSkinning&&) =
default
;
uint32_t
indices;
uint32_t
weights;
VertexPositionNormalTangentColorTextureSkinning
(
XMFLOAT3
const
& iposition,
XMFLOAT3
const
& inormal,
XMFLOAT4
const
& itangent,
uint32_t
irgba,
XMFLOAT2
const
& itextureCoordinate,
XMUINT4
const
& iindices,
XMFLOAT4
const
& iweights)
noexcept
: VertexPositionNormalTangentColorTexture(iposition, inormal, itangent, irgba, itextureCoordinate),
indices{},
weights{}
{
SetBlendIndices
(iindices);
SetBlendWeights
(iweights);
}
VertexPositionNormalTangentColorTextureSkinning
(
FXMVECTOR
iposition,
FXMVECTOR
inormal,
FXMVECTOR
itangent,
uint32_t
irgba,
CXMVECTOR
itextureCoordinate,
XMUINT4
const
& iindices,
CXMVECTOR
iweights)
noexcept
: VertexPositionNormalTangentColorTexture(iposition, inormal, itangent, irgba, itextureCoordinate),
indices{},
weights{}
{
SetBlendIndices
(iindices);
SetBlendWeights
(iweights);
}
VertexPositionNormalTangentColorTextureSkinning
(
XMFLOAT3
const
& iposition,
XMFLOAT3
const
& inormal,
XMFLOAT4
const
& itangent,
XMFLOAT4
const
& icolor,
XMFLOAT2
const
& itextureCoordinate,
XMUINT4
const
& iindices,
XMFLOAT4
const
& iweights)
noexcept
: VertexPositionNormalTangentColorTexture(iposition, inormal, itangent, icolor, itextureCoordinate),
indices{},
weights{}
{
SetBlendIndices
(iindices);
SetBlendWeights
(iweights);
}
VertexPositionNormalTangentColorTextureSkinning
(
FXMVECTOR
iposition,
FXMVECTOR
inormal,
FXMVECTOR
itangent,
CXMVECTOR
icolor,
CXMVECTOR
itextureCoordinate,
XMUINT4
const
& iindices,
CXMVECTOR
iweights)
noexcept
: VertexPositionNormalTangentColorTexture(iposition, inormal, itangent, icolor, itextureCoordinate),
indices{},
weights{}
{
SetBlendIndices
(iindices);
SetBlendWeights
(iweights);
}
void
__cdecl
SetBlendIndices
(
XMUINT4
const
& iindices)
noexcept
;
void
__cdecl
SetBlendWeights
(
XMFLOAT4
const
& iweights)
noexcept
{
SetBlendWeights
(
XMLoadFloat4
(&iweights)); }
void
XM_CALLCONV
SetBlendWeights
(
FXMVECTOR
iweights)
noexcept
;
static
constexpr
unsigned
int
InputElementCount =
7
;
static
const
D3D11_INPUT_ELEMENT_DESC
InputElements[InputElementCount];
};
}
//
namespace DX11
}
//
namespace DirectX
#
if
defined(DIRECTX_TOOLKIT_IMPORT) && defined(_MSC_VER)
#
pragma
warning(pop)
#
endif
Back
|
FazBrowse Home
|
New Git URL