-
Notifications
You must be signed in to change notification settings - Fork 45
/
VKSFile.h
130 lines (110 loc) · 3.05 KB
/
VKSFile.h
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
/*
* Copyright (c) 2014-2024, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-FileCopyrightText: Copyright (c) 2014-2024 NVIDIA CORPORATION
* SPDX-License-Identifier: Apache-2.0
*/
/* Contact chebert@nvidia.com (Chris Hebert) for feedback */
#pragma once
#include "MeshUtils.h"
#include <vector>
/**************************************/
/*structures***************************/
/**************************************/
struct VKSFileHeader
{
uint32_t meshCount;
uint32_t materialCount;
uint32_t nodeCount;
uint32_t animationCount;
uint32_t textureCount;
};
struct VKSNodeRecord
{
uint32_t childCount; //4
uint32_t index; //8
glm::vec3 position; //20
glm::quat rotation; //36
glm::vec3 scale; //48
char name[32]; //70
uint8_t meshCount; //71
uint8_t meshIndices[8]; //79
};
struct VKSTextureRecord
{
uint8_t type;
uint8_t count;
char filePaths[8][128];
};
struct VKSMeshRecord
{
uint32_t vertexCount;
uint32_t indexCount;
uint32_t firstVertex;
uint32_t firstIndex;
uint32_t materialID;
};
struct VKSMaterialRecord
{
glm::vec4 diffuseColor;
glm::vec4 ambientColor;
glm::vec4 specularColor;
float opacity;
float shininess;
float reflectivity;
uint32_t textureCount;
uint32_t firstTexture;
};
struct VKSAnimationRecord
{
uint32_t firstNode;
uint32_t nodecount;
};
struct VKSAnimationNodeRecord
{
uint32_t firstPosition;
uint32_t firstRotation;
uint32_t firstScale;
uint32_t positionCount;
uint32_t rotationCount;
uint32_t scaleCount;
char name[32];
};
struct VKSAnimationKeyRecord
{
glm::vec4 key{0.f, 0.f, 0.f, 0.f};
double time = 0.;
};
struct VKSFile
{
std::string inputFile;
std::string outputFile;
int fileHandle = 0;
VKSFileHeader header{};
std::vector<VKSNodeRecord> nodes;
std::vector<VKSMeshRecord> meshes;
std::vector<VKSMaterialRecord> materials;
std::vector<VKSAnimationRecord> animations;
std::vector<VKSTextureRecord> textures;
std::vector<float> vertices;
std::vector<uint32_t> indices;
uint32_t indexCount = 0;
uint32_t vertexCount = 0;
std::vector<VKSAnimationNodeRecord> animationNodes;
std::vector<VKSAnimationKeyRecord> animationKeys;
uint32_t animationNodeCount = 0;
uint32_t animationKeyCount = 0;
};
void readVKSFile(VKSFile* inFile);