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
cfe370e8
Commit
cfe370e8
authored
3 years ago
by
Trevor Hollmann
Browse files
Options
Downloads
Patches
Plain Diff
[
#79
] Update documentation of asset loader.
parent
f85a24e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!69
Resolve "Rework Asset Loader API"
Pipeline
#26613
passed
3 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/asset_loader/include/vkcv/asset/asset_loader.hpp
+10
-7
10 additions, 7 deletions
modules/asset_loader/include/vkcv/asset/asset_loader.hpp
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
+10
-1
10 additions, 1 deletion
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
with
20 additions
and
8 deletions
modules/asset_loader/include/vkcv/asset/asset_loader.hpp
+
10
−
7
View file @
cfe370e8
...
@@ -84,20 +84,23 @@ struct Sampler {
...
@@ -84,20 +84,23 @@ struct Sampler {
};
};
/**
/**
* This struct describes a loaded texture.
* This struct describes a (partially) loaded texture.
* Note that textures are currently always loaded with 4 channels as RGBA, even
* The data member is not populated after calling probeScene() but only when
* if the image has just RGB or is grayscale.
* calling loadMesh(), loadScene() or loadTexture(). Note that textures are
* currently always loaded with 4 channels as RGBA, even if the image has just
* RGB or is grayscale. In the case where the glTF-file does not provide a URI
* but references a buffer view for the raw data, the path member will be empty
* even though the rest is initialized properly.
*/
*/
struct
Texture
{
struct
Texture
{
std
::
filesystem
::
path
path
;
//
file path of
the encoded texture data
std
::
filesystem
::
path
path
;
//
URI to
the encoded texture data
int
sampler
;
// index into the sampler array of the Scene
int
sampler
;
// index into the sampler array of the Scene
union
{
int
width
;
int
w
;
};
union
{
int
width
;
int
w
;
};
union
{
int
height
;
int
h
;
};
union
{
int
height
;
int
h
;
};
int
channels
;
int
channels
;
// binary data of the decoded texture
std
::
vector
<
char
*>
data
;
// binary data of the decoded texture
std
::
vector
<
char
*>
data
;
};
};
/**
/**
...
...
This diff is collapsed.
Click to expand it.
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
+
10
−
1
View file @
cfe370e8
...
@@ -453,7 +453,10 @@ namespace vkcv::asset {
...
@@ -453,7 +453,10 @@ namespace vkcv::asset {
}
}
/**
/**
* TODO document
* Returns an integer with specific bits set corresponding to the
* textures that appear in the given material. This mask is used in the
* vkcv::asset::Material struct and can be tested via the hasTexture
* method.
*/
*/
static
uint16_t
generateTextureMask
(
fx
::
gltf
::
Material
&
material
)
{
static
uint16_t
generateTextureMask
(
fx
::
gltf
::
Material
&
material
)
{
uint16_t
textureMask
=
0
;
uint16_t
textureMask
=
0
;
...
@@ -621,6 +624,12 @@ namespace vkcv::asset {
...
@@ -621,6 +624,12 @@ namespace vkcv::asset {
return
ASSET_SUCCESS
;
return
ASSET_SUCCESS
;
}
}
/**
* Loads and decodes the textures data based on the textures file path.
* The path member is the only one that has to be initialized before
* calling this function, the others (width, height, channels, data)
* are set by this function and the sampler is of no concern here.
*/
static
int
loadTextureData
(
Texture
&
texture
)
{
static
int
loadTextureData
(
Texture
&
texture
)
{
if
((
texture
.
width
>
0
)
&&
(
texture
.
height
>
0
)
&&
(
texture
.
channels
>
0
)
&&
if
((
texture
.
width
>
0
)
&&
(
texture
.
height
>
0
)
&&
(
texture
.
channels
>
0
)
&&
(
!
texture
.
data
.
empty
()))
{
(
!
texture
.
data
.
empty
()))
{
...
...
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