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
0e6d223c
Commit
0e6d223c
authored
3 years ago
by
Trevor Hollmann
Browse files
Options
Downloads
Patches
Plain Diff
[
#79
] Change function signatures for consistency.
parent
fd4f55ec
No related branches found
No related tags found
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
+12
-8
12 additions, 8 deletions
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
with
12 additions
and
8 deletions
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
+
12
−
8
View file @
0e6d223c
...
@@ -81,7 +81,7 @@ enum IndexType getIndexType(const enum fx::gltf::Accessor::ComponentType &type)
...
@@ -81,7 +81,7 @@ enum IndexType getIndexType(const enum fx::gltf::Accessor::ComponentType &type)
* @return ASSET_ERROR if at least one texture could not be constructed
* @return ASSET_ERROR if at least one texture could not be constructed
* properly, otherwise ASSET_SUCCESS
* properly, otherwise ASSET_SUCCESS
*/
*/
int
load
Textures
(
const
std
::
vector
<
fx
::
gltf
::
Texture
>
&
tex_src
,
int
create
Textures
(
const
std
::
vector
<
fx
::
gltf
::
Texture
>
&
tex_src
,
const
std
::
vector
<
fx
::
gltf
::
Image
>
&
img_src
,
const
std
::
vector
<
fx
::
gltf
::
Image
>
&
img_src
,
const
std
::
string
&
dir
,
std
::
vector
<
Texture
>
&
dst
)
const
std
::
string
&
dir
,
std
::
vector
<
Texture
>
&
dst
)
{
{
...
@@ -131,14 +131,15 @@ int loadTextures(const std::vector<fx::gltf::Texture> &tex_src,
...
@@ -131,14 +131,15 @@ int loadTextures(const std::vector<fx::gltf::Texture> &tex_src,
* @return ASSET_ERROR when at least one VertexAttribute could not be
* @return ASSET_ERROR when at least one VertexAttribute could not be
* constructed properly, otherwise ASSET_SUCCESS
* constructed properly, otherwise ASSET_SUCCESS
*/
*/
int
getVertexAttributes
(
const
fx
::
gltf
::
Attributes
&
src
,
int
createVertexAttributes
(
const
fx
::
gltf
::
Attributes
&
src
,
const
fx
::
gltf
::
Document
&
gltf
,
const
std
::
vector
<
fx
::
gltf
::
Accessor
>
&
accessors
,
const
std
::
vector
<
fx
::
gltf
::
BufferView
>
&
bufferViews
,
std
::
vector
<
VertexAttribute
>
&
dst
)
std
::
vector
<
VertexAttribute
>
&
dst
)
{
{
dst
.
clear
();
dst
.
clear
();
dst
.
reserve
(
src
.
size
());
dst
.
reserve
(
src
.
size
());
for
(
const
auto
&
attrib
:
src
)
{
for
(
const
auto
&
attrib
:
src
)
{
const
fx
::
gltf
::
Accessor
&
accessor
=
gltf
.
accessors
[
attrib
.
second
];
const
fx
::
gltf
::
Accessor
&
accessor
=
accessors
[
attrib
.
second
];
dst
.
push_back
({});
dst
.
push_back
({});
VertexAttribute
&
att
=
dst
.
back
();
VertexAttribute
&
att
=
dst
.
back
();
...
@@ -162,7 +163,7 @@ int getVertexAttributes(const fx::gltf::Attributes &src,
...
@@ -162,7 +163,7 @@ int getVertexAttributes(const fx::gltf::Attributes &src,
att
.
type
=
PrimitiveType
::
UNDEFINED
;
att
.
type
=
PrimitiveType
::
UNDEFINED
;
return
ASSET_ERROR
;
return
ASSET_ERROR
;
}
}
const
fx
::
gltf
::
BufferView
&
buf
=
gltf
.
bufferViews
[
accessor
.
bufferView
];
const
fx
::
gltf
::
BufferView
&
buf
=
bufferViews
[
accessor
.
bufferView
];
att
.
offset
=
buf
.
byteOffset
;
att
.
offset
=
buf
.
byteOffset
;
att
.
length
=
buf
.
byteLength
;
att
.
length
=
buf
.
byteLength
;
att
.
stride
=
buf
.
byteStride
;
att
.
stride
=
buf
.
byteStride
;
...
@@ -334,8 +335,11 @@ int loadScene(const std::string &path, Scene &scene){
...
@@ -334,8 +335,11 @@ int loadScene(const std::string &path, Scene &scene){
vertexAttributes
.
clear
();
vertexAttributes
.
clear
();
vertexAttributes
.
reserve
(
objectPrimitive
.
attributes
.
size
());
vertexAttributes
.
reserve
(
objectPrimitive
.
attributes
.
size
());
if
(
getVertexAttributes
(
objectPrimitive
.
attributes
,
sceneObjects
,
if
(
createVertexAttributes
(
objectPrimitive
.
attributes
,
vertexAttributes
)
!=
ASSET_SUCCESS
)
{
sceneObjects
.
accessors
,
sceneObjects
.
bufferViews
,
vertexAttributes
)
!=
ASSET_SUCCESS
)
{
vkcv_log
(
LogLevel
::
ERROR
,
"Failed to get vertex attributes"
);
vkcv_log
(
LogLevel
::
ERROR
,
"Failed to get vertex attributes"
);
return
ASSET_ERROR
;
return
ASSET_ERROR
;
}
}
...
@@ -430,7 +434,7 @@ int loadScene(const std::string &path, Scene &scene){
...
@@ -430,7 +434,7 @@ int loadScene(const std::string &path, Scene &scene){
sceneObjects
.
nodes
[
m
].
matrix
);
sceneObjects
.
nodes
[
m
].
matrix
);
}
}
if
(
load
Textures
(
sceneObjects
.
textures
,
sceneObjects
.
images
,
dir
,
textures
)
!=
ASSET_SUCCESS
)
{
if
(
create
Textures
(
sceneObjects
.
textures
,
sceneObjects
.
images
,
dir
,
textures
)
!=
ASSET_SUCCESS
)
{
size_t
missing
=
sceneObjects
.
textures
.
size
()
-
textures
.
size
();
size_t
missing
=
sceneObjects
.
textures
.
size
()
-
textures
.
size
();
vkcv_log
(
LogLevel
::
ERROR
,
"Failed to get %lu textures from glTF source '%s'"
,
vkcv_log
(
LogLevel
::
ERROR
,
"Failed to get %lu textures from glTF source '%s'"
,
missing
,
path
.
c_str
());
missing
,
path
.
c_str
());
...
...
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