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
cfc8eee1
Commit
cfc8eee1
authored
3 years ago
by
Susanne Dötsch
Browse files
Options
Downloads
Patches
Plain Diff
[
#79
]
Finished some of the ToDos
parent
7b86534f
No related branches found
No related tags found
1 merge request
!69
Resolve "Rework Asset Loader API"
Pipeline
#26037
passed
3 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/asset_loader/include/vkcv/asset/asset_loader.hpp
+3
-48
3 additions, 48 deletions
modules/asset_loader/include/vkcv/asset/asset_loader.hpp
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
+278
-168
278 additions, 168 deletions
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
with
281 additions
and
216 deletions
modules/asset_loader/include/vkcv/asset/asset_loader.hpp
+
3
−
48
View file @
cfc8eee1
...
...
@@ -9,6 +9,7 @@
#include
<vector>
#include
<array>
#include
<cstdint>
#include
<filesystem>
/** These macros define limits of the following structs. Implementations can
* test against these limits when performing sanity checks. The main constraint
...
...
@@ -64,52 +65,6 @@ enum class IndexType : uint8_t { UNDEFINED=0, UINT8=1, UINT16=2, UINT32=3 };
* directly translated to Vulkan. The vkcv::asset::Sampler struct defined here
* adheres to the Vulkan spec, having alerady translated the flags from glTF to
* Vulkan. All values here can directly be passed to VkSamplerCreateInfo.
* If the glTF doesn't define samplers, we use the defaults defined by fx-gltf.
* The following are details about the glTF/OpenGL to Vulkan translation.
* magFilter (VkFilter?):
* GL_NEAREST -> VK_FILTER_NEAREST
* GL_LINEAR -> VK_FILTER_LINEAR
* minFilter (VkFilter?):
* mipmapMode (VkSamplerMipmapMode?):
* Vulkans minFilter and mipmapMode combined correspond to OpenGLs
* GL_minFilter_MIPMAP_mipmapMode:
* GL_NEAREST_MIPMAP_NEAREST:
* minFilter=VK_FILTER_NEAREST
* mipmapMode=VK_SAMPLER_MIPMAP_MODE_NEAREST
* GL_LINEAR_MIPMAP_NEAREST:
* minFilter=VK_FILTER_LINEAR
* mipmapMode=VK_SAMPLER_MIPMAP_MODE_NEAREST
* GL_NEAREST_MIPMAP_LINEAR:
* minFilter=VK_FILTER_NEAREST
* mipmapMode=VK_SAMPLER_MIPMAP_MODE_LINEAR
* GL_LINEAR_MIPMAP_LINEAR:
* minFilter=VK_FILTER_LINEAR
* mipmapMode=VK_SAMPLER_MIPMAP_MODE_LINEAR
* The modes of GL_LINEAR and GL_NEAREST have to be emulated using
* mipmapMode=VK_SAMPLER_MIPMAP_MODE_NEAREST with specific minLOD and maxLOD:
* GL_LINEAR:
* minFilter=VK_FILTER_LINEAR
* mipmapMode=VK_SAMPLER_MIPMAP_MODE_NEAREST
* minLOD=0, maxLOD=0.25
* GL_NEAREST:
* minFilter=VK_FILTER_NEAREST
* mipmapMode=VK_SAMPLER_MIPMAP_MODE_NEAREST
* minLOD=0, maxLOD=0.25
* Setting maxLOD=0 causes magnification to always be performed (using
* the defined magFilter), this may be valid if the min- and magFilter
* are equal, otherwise it won't be the expected behaviour from OpenGL
* and glTF; instead using maxLod=0.25 allows the minFilter to be
* performed while still always rounding to the base level.
* With other modes, minLOD and maxLOD default to:
* minLOD=0
* maxLOD=VK_LOD_CLAMP_NONE
* wrapping:
* gltf has wrapS, wrapT with {clampToEdge, MirroredRepeat, Repeat} while
* Vulkan has addressModeU, addressModeV, addressModeW with values
* VK_SAMPLER_ADDRESS_MODE_{REPEAT,MIRRORED_REPEAT,CLAMP_TO_EDGE,
* CAMP_TO_BORDER,MIRROR_CLAMP_TO_EDGE}
* Translation from glTF to Vulkan is straight forward for the 3 existing
* modes, default is repeat, the other modes aren't available.
* */
typedef
struct
{
int
minFilter
,
magFilter
;
...
...
@@ -130,7 +85,7 @@ typedef struct {
* materials.*/
typedef
struct
{
uint16_t
textureMask
;
// bit mask with active texture targets
// Indices into the
Array
.textures
array
// Indices into the
Scene
.textures
vector
int
baseColor
,
metalRough
,
normal
,
occlusion
,
emissive
;
// Scaling factors for each texture target
struct
{
float
r
,
g
,
b
,
a
;
}
baseColorFactor
;
...
...
@@ -246,7 +201,7 @@ typedef struct {
* @param scene is a reference to a Scene struct that will be filled with the
* content of the glTF file being loaded.
* */
int
loadScene
(
const
std
::
string
&
path
,
Scene
&
scene
);
int
loadScene
(
const
std
::
filesystem
::
path
&
path
,
Scene
&
scene
);
}
This diff is collapsed.
Click to expand it.
modules/asset_loader/src/vkcv/asset/asset_loader.cpp
+
278
−
168
View file @
cfc8eee1
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