Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Game Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Game Development
Game Library
Commits
daa97196
Commit
daa97196
authored
2 years ago
by
Joseph Walton-Rivers
Browse files
Options
Downloads
Patches
Plain Diff
fix issues with assimp loader in release mode
parent
c9553fb4
No related branches found
No related tags found
No related merge requests found
Pipeline
#3632
failed
2 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fggl/data/assimp/module.cpp
+7
-6
7 additions, 6 deletions
fggl/data/assimp/module.cpp
include/fggl/data/assimp/module.hpp
+12
-0
12 additions, 0 deletions
include/fggl/data/assimp/module.hpp
with
19 additions
and
6 deletions
fggl/data/assimp/module.cpp
+
7
−
6
View file @
daa97196
...
...
@@ -139,7 +139,7 @@ namespace fggl::data::models {
}
static
assets
::
AssetRefRaw
load_assimp_model
(
assets
::
Loader
*
loader
,
const
assets
::
AssetID
&
guid
,
const
assets
::
LoaderContext
&
data
,
void
*
userPtr
)
{
assets
::
AssetRefRaw
load_assimp_model
(
assets
::
Loader
*
loader
,
const
assets
::
AssetID
&
guid
,
const
assets
::
LoaderContext
&
data
,
void
*
userPtr
)
{
// auto *filePath = std::get<assets::AssetPath *>(data);
assets
::
AssetManager
*
manager
=
(
assets
::
AssetManager
*
)
userPtr
;
auto
filePath
=
data
.
assetPath
;
...
...
@@ -191,7 +191,7 @@ namespace fggl::data::models {
return
nullptr
;
}
static
assets
::
AssetRefRaw
load_assimp_texture
(
assets
::
Loader
*
loader
,
const
assets
::
AssetID
&
guid
,
const
assets
::
LoaderContext
&
data
,
void
*
userPtr
)
{
assets
::
AssetRefRaw
load_assimp_texture
(
assets
::
Loader
*
loader
,
const
assets
::
AssetID
&
guid
,
const
assets
::
LoaderContext
&
data
,
void
*
userPtr
)
{
assets
::
AssetManager
*
manager
=
(
assets
::
AssetManager
*
)
userPtr
;
if
(
manager
->
has
(
guid
)
)
{
...
...
@@ -217,7 +217,7 @@ namespace fggl::data::models {
return
nullptr
;
}
static
bool
load_tex_stb
(
std
::
filesystem
::
path
filePath
,
assets
::
MemoryBlock
&
block
)
{
bool
load_tex_stb
(
std
::
filesystem
::
path
filePath
,
assets
::
MemoryBlock
&
block
)
{
stbi_set_flip_vertically_on_load
(
true
);
//load the texture data into memory
...
...
@@ -238,7 +238,7 @@ namespace fggl::data::models {
}
}
static
assets
::
AssetTypeID
is_tex_stb
(
std
::
filesystem
::
path
filePath
)
{
assets
::
AssetTypeID
is_tex_stb
(
std
::
filesystem
::
path
filePath
)
{
// detect jpgs
if
(
filePath
.
extension
()
==
".jpg"
||
filePath
.
extension
()
==
".jpeg"
)
{
return
TEXTURE_RGBA
;
...
...
@@ -252,7 +252,7 @@ namespace fggl::data::models {
return
assets
::
INVALID_ASSET_TYPE
;
}
static
assets
::
AssetTypeID
is_model_assimp
(
std
::
filesystem
::
path
filePath
)
{
assets
::
AssetTypeID
is_model_assimp
(
std
::
filesystem
::
path
filePath
)
{
if
(
filePath
.
extension
()
==
".obj"
){
return
MODEL_MULTI3D
;
}
...
...
@@ -260,7 +260,7 @@ namespace fggl::data::models {
return
assets
::
INVALID_ASSET_TYPE
;
}
static
bool
extract_requirements
(
const
std
::
string
&
packName
,
std
::
filesystem
::
path
packRoot
,
assets
::
ResourceRecord
&
rr
)
{
bool
extract_requirements
(
const
std
::
string
&
packName
,
std
::
filesystem
::
path
packRoot
,
assets
::
ResourceRecord
&
rr
)
{
Assimp
::
Importer
importer
;
const
aiScene
*
scene
=
importer
.
ReadFile
(
rr
.
m_path
,
aiProcess_Triangulate
|
aiProcess_FlipUVs
);
if
(
!
scene
||
scene
->
mFlags
&
AI_SCENE_FLAGS_INCOMPLETE
||
!
scene
->
mRootNode
)
{
...
...
@@ -304,6 +304,7 @@ namespace fggl::data::models {
checkin
->
setLoader
(
MIME_OBJ
,
assets
::
NEEDS_CHECKIN
,
is_model_assimp
);
checkin
->
setProcessor
(
MIME_OBJ
,
extract_requirements
);
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
include/fggl/data/assimp/module.hpp
+
12
−
0
View file @
daa97196
...
...
@@ -36,6 +36,18 @@ namespace fggl::data::models {
constexpr
auto
MODEL_MULTI3D
=
assets
::
make_asset_type
(
"model/multi3D"
);
constexpr
auto
TEXTURE_RGBA
=
assets
::
make_asset_type
(
"texture/rgba"
);
// old-style loaders
assets
::
AssetRefRaw
load_assimp_model
(
assets
::
Loader
*
loader
,
const
assets
::
AssetID
&
guid
,
const
assets
::
LoaderContext
&
data
,
void
*
userPtr
);
assets
::
AssetRefRaw
load_assimp_texture
(
assets
::
Loader
*
loader
,
const
assets
::
AssetID
&
guid
,
const
assets
::
LoaderContext
&
data
,
void
*
userPtr
);
// new style loaders (textures)
bool
load_tex_stb
(
std
::
filesystem
::
path
filePath
,
assets
::
MemoryBlock
&
block
);
static
assets
::
AssetTypeID
is_tex_stb
(
std
::
filesystem
::
path
filePath
);
// new style loaders (models)
assets
::
AssetTypeID
is_model_assimp
(
std
::
filesystem
::
path
filePath
);
bool
extract_requirements
(
const
std
::
string
&
packName
,
std
::
filesystem
::
path
packRoot
,
assets
::
ResourceRecord
&
rr
);
struct
AssimpModule
{
constexpr
static
const
char
*
name
=
"fggl::data::Assimp"
;
constexpr
static
const
std
::
array
<
modules
::
ModuleService
,
1
>
provides
=
{
...
...
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