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
52005c96
Commit
52005c96
authored
3 years ago
by
Trevor Hollmann
Browse files
Options
Downloads
Patches
Plain Diff
[
#79
] Fix error handling in accessor type component counter.
parent
ed16003f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!69
Resolve "Rework Asset Loader API"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
+10
-16
10 additions, 16 deletions
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
with
10 additions
and
16 deletions
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
+
10
−
16
View file @
52005c96
...
...
@@ -14,17 +14,13 @@
namespace
vkcv
::
asset
{
/**
* convert the accessor type from the fx-gltf library to an unsigned int
* @param type
* @return unsigned integer representation
*/
// TODO Return proper error code (we need to define those as macros or enums,
// will discuss during the next core meeting if that should happen on the scope
// of the vkcv framework or just this module)
uint8_t
convertTypeToInt
(
const
fx
::
gltf
::
Accessor
::
Type
type
)
{
* Computes the component count for an accessor type of the fx-gltf library.
* @param type The accessor type
* @return An unsigned integer count
*/
// TODO add cases for matrices (or maybe change the type in the struct itself)
uint8_t
getCompCount
(
const
fx
::
gltf
::
Accessor
::
Type
type
)
{
switch
(
type
)
{
case
fx
::
gltf
::
Accessor
::
Type
::
None
:
return
0
;
case
fx
::
gltf
::
Accessor
::
Type
::
Scalar
:
return
1
;
case
fx
::
gltf
::
Accessor
::
Type
::
Vec2
:
...
...
@@ -33,7 +29,8 @@ uint8_t convertTypeToInt(const fx::gltf::Accessor::Type type) {
return
3
;
case
fx
::
gltf
::
Accessor
::
Type
::
Vec4
:
return
4
;
default:
return
10
;
// TODO add cases for matrices (or maybe change the type in the struct itself)
case
fx
::
gltf
::
Accessor
::
Type
::
None
:
default:
return
ASSET_ERROR
;
}
}
...
...
@@ -250,11 +247,8 @@ int loadScene(const std::string &path, Scene &scene){
attribute
.
stride
=
sceneObjects
.
bufferViews
[
accessor
.
bufferView
].
byteStride
;
attribute
.
componentType
=
static_cast
<
ComponentType
>
(
accessor
.
componentType
);
if
(
convertTypeToInt
(
accessor
.
type
)
!=
10
)
{
attribute
.
componentCount
=
convertTypeToInt
(
accessor
.
type
);
}
else
{
return
ASSET_ERROR
;
}
if
((
attribute
.
componentCount
=
getCompCount
(
accessor
.
type
)
==
ASSET_ERROR
))
return
ASSET_ERROR
;
vertexAttributes
.
push_back
(
attribute
);
}
...
...
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