Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
75e743be
Commit
75e743be
authored
2 years ago
by
David Parks
Browse files
Options
Downloads
Patches
Plain Diff
SL-18442 Port of Caladbolg's fix for emissive overrides not taking. Remove unused function.
parent
94afae5b
No related branches found
Branches containing commit
No related tags found
2 merge requests
!3
Update to main branch
,
!2
Rebase onto current main branch
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llprimitive/llgltfmaterial.cpp
+7
-60
7 additions, 60 deletions
indra/llprimitive/llgltfmaterial.cpp
indra/llprimitive/llgltfmaterial.h
+0
-3
0 additions, 3 deletions
indra/llprimitive/llgltfmaterial.h
with
7 additions
and
63 deletions
indra/llprimitive/llgltfmaterial.cpp
+
7
−
60
View file @
75e743be
...
...
@@ -241,8 +241,14 @@ void LLGLTFMaterial::writeToModel(tinygltf::Model& model, S32 mat_index) const
material_out
.
alphaCutoff
=
mAlphaCutoff
;
mBaseColor
.
write
(
material_out
.
pbrMetallicRoughness
.
baseColorFactor
);
material_out
.
emissiveFactor
.
resize
(
3
);
// 0 size by default
mEmissiveColor
.
write
(
material_out
.
emissiveFactor
);
if
(
mEmissiveColor
!=
LLGLTFMaterial
::
getDefaultEmissiveColor
())
{
material_out
.
emissiveFactor
.
resize
(
3
);
mEmissiveColor
.
write
(
material_out
.
emissiveFactor
);
}
material_out
.
pbrMetallicRoughness
.
metallicFactor
=
mMetallicFactor
;
material_out
.
pbrMetallicRoughness
.
roughnessFactor
=
mRoughnessFactor
;
...
...
@@ -439,65 +445,6 @@ F32 LLGLTFMaterial::getDefaultTextureRotation()
return
0.
f
;
}
void
LLGLTFMaterial
::
writeOverridesToModel
(
tinygltf
::
Model
&
model
,
S32
mat_index
,
LLGLTFMaterial
const
*
base_material
)
const
{
if
(
model
.
materials
.
size
()
<
mat_index
+
1
)
{
model
.
materials
.
resize
(
mat_index
+
1
);
}
tinygltf
::
Material
&
material_out
=
model
.
materials
[
mat_index
];
// TODO - fix handling of resetting to null/default values
constexpr
bool
is_override
=
true
;
// set base color texture
writeToTexture
(
model
,
material_out
.
pbrMetallicRoughness
.
baseColorTexture
,
GLTF_TEXTURE_INFO_BASE_COLOR
,
mBaseColorId
,
is_override
,
base_material
->
mBaseColorId
);
// set normal texture
writeToTexture
(
model
,
material_out
.
normalTexture
,
GLTF_TEXTURE_INFO_NORMAL
,
mNormalId
,
is_override
,
base_material
->
mNormalId
);
// set metallic-roughness texture
writeToTexture
(
model
,
material_out
.
pbrMetallicRoughness
.
metallicRoughnessTexture
,
GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS
,
mMetallicRoughnessId
,
is_override
,
base_material
->
mMetallicRoughnessId
);
// set emissive texture
writeToTexture
(
model
,
material_out
.
emissiveTexture
,
GLTF_TEXTURE_INFO_EMISSIVE
,
mEmissiveId
,
is_override
,
base_material
->
mEmissiveId
);
if
(
mAlphaMode
!=
base_material
->
mAlphaMode
)
{
material_out
.
alphaMode
=
getAlphaMode
();
}
if
(
mAlphaCutoff
!=
base_material
->
mAlphaCutoff
)
{
material_out
.
alphaCutoff
=
mAlphaCutoff
;
}
if
(
mBaseColor
!=
base_material
->
mBaseColor
)
{
mBaseColor
.
write
(
material_out
.
pbrMetallicRoughness
.
baseColorFactor
);
}
if
(
mEmissiveColor
!=
base_material
->
mEmissiveColor
)
{
material_out
.
emissiveFactor
.
resize
(
3
);
// 0 size by default
mEmissiveColor
.
write
(
material_out
.
emissiveFactor
);
}
if
(
mMetallicFactor
!=
base_material
->
mMetallicFactor
)
{
material_out
.
pbrMetallicRoughness
.
metallicFactor
=
mMetallicFactor
;
}
if
(
mRoughnessFactor
!=
base_material
->
mRoughnessFactor
)
{
material_out
.
pbrMetallicRoughness
.
roughnessFactor
=
mRoughnessFactor
;
}
if
(
mDoubleSided
!=
base_material
->
mDoubleSided
)
{
material_out
.
doubleSided
=
mDoubleSided
;
}
}
void
LLGLTFMaterial
::
applyOverride
(
const
LLGLTFMaterial
&
override_mat
)
{
// TODO: potentially reimplement this with a more general purpose JSON merge
...
...
This diff is collapsed.
Click to expand it.
indra/llprimitive/llgltfmaterial.h
+
0
−
3
View file @
75e743be
...
...
@@ -185,9 +185,6 @@ class LLGLTFMaterial : public LLRefCount
// write to given tinygltf::Model
void
writeToModel
(
tinygltf
::
Model
&
model
,
S32
mat_index
)
const
;
// calculate the fields in this material that differ from a base material and write them out to a given tinygltf::Model
void
writeOverridesToModel
(
tinygltf
::
Model
&
model
,
S32
mat_index
,
LLGLTFMaterial
const
*
base_material
)
const
;
void
applyOverride
(
const
LLGLTFMaterial
&
override_mat
);
private
:
...
...
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