Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
4ccf3731
Commit
4ccf3731
authored
3 years ago
by
Trevor Hollmann
Browse files
Options
Downloads
Patches
Plain Diff
[
#26
] Add indexBuffer struct and improve documentation.
parent
6f588a05
No related branches found
No related tags found
1 merge request
!19
Resolve "Asset Loading"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/asset_loader/asset_loader.hpp
+19
-2
19 additions, 2 deletions
include/asset_loader/asset_loader.hpp
with
19 additions
and
2 deletions
include/asset_loader/asset_loader.hpp
+
19
−
2
View file @
4ccf3731
...
@@ -52,6 +52,7 @@ typedef struct {
...
@@ -52,6 +52,7 @@ typedef struct {
// TODO not yet needed for the first (unlit) triangle
// TODO not yet needed for the first (unlit) triangle
}
Material
;
}
Material
;
/* This struct describes one vertex attribute of a vertex buffer. */
typedef
struct
{
typedef
struct
{
PrimitiveType
type
;
// POSITION, NORMAL, ...
PrimitiveType
type
;
// POSITION, NORMAL, ...
uint32_t
offset
;
// offset in bytes
uint32_t
offset
;
// offset in bytes
...
@@ -61,10 +62,25 @@ typedef struct {
...
@@ -61,10 +62,25 @@ typedef struct {
uint8_t
componentCount
;
// eg. 3 for vec3
uint8_t
componentCount
;
// eg. 3 for vec3
}
VertexAttribute
;
}
VertexAttribute
;
/* This struct represents one (possibly the only) part of a mesh. There is
* always one vertexBuffer and zero or one indexBuffer (indexed rendering is
* common but not always used). If there is no indexBuffer, this is indicated
* by indexBuffer.data being NULL.
* Each vertex buffer can have one or more vertex attributes.
* Note that the indexBuffer and vertexBuffer might be pointing to the same
* block of memory.
*
* TODO For now, the caller of loadMesh() has to free this memory when they are
* done, but since this is not generally good practice in C++, this behaviour
* will likely be changed later. */
typedef
struct
{
typedef
struct
{
enum
PrimitiveMode
mode
;
// draw as points, lines or triangle?
enum
PrimitiveMode
mode
;
// draw as points, lines or triangle?
size_t
numIndices
,
numVertices
;
size_t
numIndices
,
numVertices
;
uint32_t
*
indexBuffer
;
// array of indices for indexed rendering
struct
{
void
*
data
;
// binary data of the index buffer
size_t
byteLength
;
// length of the index buffer
uint32_t
byteOffset
;
// offset into the buffer in bytes
}
indexBuffer
;
struct
{
struct
{
void
*
data
;
// the binary data of the buffer
void
*
data
;
// the binary data of the buffer
size_t
byteLength
;
// the length of the entire buffer in bytes
size_t
byteLength
;
// the length of the entire buffer in bytes
...
@@ -75,7 +91,8 @@ typedef struct {
...
@@ -75,7 +91,8 @@ typedef struct {
uint8_t
materialIndex
;
// index to one of the meshes materials
uint8_t
materialIndex
;
// index to one of the meshes materials
}
VertexGroup
;
}
VertexGroup
;
/* This struct represents a single mesh loaded from a glTF file. */
/* This struct represents a single mesh loaded from a glTF file. It consists of
* at least one VertexVroup and any number of Materials. */
typedef
struct
{
typedef
struct
{
std
::
string
name
;
std
::
string
name
;
std
::
vector
<
VertexGroup
>
vertexGroups
;
std
::
vector
<
VertexGroup
>
vertexGroups
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment