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
b66c95e4
Commit
b66c95e4
authored
2 years ago
by
Cosmic Linden
Browse files
Options
Downloads
Patches
Plain Diff
SL-19121: Add some override tests
parent
0dd4efea
No related branches found
No related tags found
2 merge requests
!3
Update to main branch
,
!2
Rebase onto current main branch
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llprimitive/tests/llgltfmaterial_test.cpp
+87
-0
87 additions, 0 deletions
indra/llprimitive/tests/llgltfmaterial_test.cpp
with
87 additions
and
0 deletions
indra/llprimitive/tests/llgltfmaterial_test.cpp
+
87
−
0
View file @
b66c95e4
...
@@ -253,4 +253,91 @@ namespace tut
...
@@ -253,4 +253,91 @@ namespace tut
ensure_gltf_material_serialize
(
"material with scaling/tint factors only"
,
factors_only_material
);
ensure_gltf_material_serialize
(
"material with scaling/tint factors only"
,
factors_only_material
);
}
}
}
}
// Test that sDefault is a no-op override
template
<
>
template
<
>
void
llgltfmaterial_object_t
::
test
<
7
>
()
{
const
LLGLTFMaterial
material_asset
=
create_test_material
();
LLGLTFMaterial
render_material
=
material_asset
;
render_material
.
applyOverride
(
LLGLTFMaterial
::
sDefault
);
ensure
(
"LLGLTFMaterial: sDefault is a no-op override"
,
material_asset
==
render_material
);
}
// Test application of transform overrides
template
<
>
template
<
>
void
llgltfmaterial_object_t
::
test
<
8
>
()
{
LLGLTFMaterial
override_material
;
apply_test_material_texture_transforms
(
override_material
);
LLGLTFMaterial
render_material
;
render_material
.
applyOverride
(
override_material
);
ensure
(
"LLGLTFMaterial: transform overrides"
,
render_material
==
override_material
);
}
// Test application of flag-based overrides
template
<
>
template
<
>
void
llgltfmaterial_object_t
::
test
<
9
>
()
{
{
LLGLTFMaterial
override_material
;
override_material
.
setAlphaMode
(
LLGLTFMaterial
::
ALPHA_MODE_BLEND
,
true
);
override_material
.
setDoubleSided
(
true
,
true
);
LLGLTFMaterial
render_material
;
render_material
.
applyOverride
(
override_material
);
ensure
(
"LLGLTFMaterial: extra overrides with non-default values applied over default"
,
render_material
==
override_material
);
}
{
LLGLTFMaterial
override_material
;
override_material
.
setAlphaMode
(
LLGLTFMaterial
::
ALPHA_MODE_OPAQUE
,
true
);
override_material
.
setDoubleSided
(
false
,
true
);
LLGLTFMaterial
render_material
;
override_material
.
setAlphaMode
(
LLGLTFMaterial
::
ALPHA_MODE_BLEND
,
false
);
override_material
.
setDoubleSided
(
true
,
false
);
render_material
.
applyOverride
(
override_material
);
// Not interested in these flags for equality comparison
override_material
.
mOverrideDoubleSided
=
false
;
override_material
.
mOverrideAlphaMode
=
false
;
ensure
(
"LLGLTFMaterial: extra overrides with default values applied over non-default"
,
render_material
==
override_material
);
}
}
// Test application of texture overrides
template
<
>
template
<
>
void
llgltfmaterial_object_t
::
test
<
10
>
()
{
const
U32
texture_count
=
2
;
const
LLUUID
override_textures
[
texture_count
]
=
{
LLUUID
::
null
,
LLUUID
::
generateNewID
()
};
const
LLUUID
asset_textures
[
texture_count
]
=
{
LLUUID
::
generateNewID
(),
LLUUID
::
null
};
for
(
U32
i
=
0
;
i
<
texture_count
;
++
i
)
{
LLGLTFMaterial
override_material
;
const
LLUUID
&
override_texture
=
override_textures
[
i
];
for
(
LLGLTFMaterial
::
TextureInfo
j
=
LLGLTFMaterial
::
TextureInfo
(
0
);
j
<
LLGLTFMaterial
::
GLTF_TEXTURE_INFO_COUNT
;
j
=
LLGLTFMaterial
::
TextureInfo
(
U32
(
j
)
+
1
))
{
override_material
.
setTextureId
(
j
,
override_texture
,
true
);
}
LLGLTFMaterial
render_material
;
const
LLUUID
&
asset_texture
=
asset_textures
[
i
];
for
(
LLGLTFMaterial
::
TextureInfo
j
=
LLGLTFMaterial
::
TextureInfo
(
0
);
j
<
LLGLTFMaterial
::
GLTF_TEXTURE_INFO_COUNT
;
j
=
LLGLTFMaterial
::
TextureInfo
(
U32
(
j
)
+
1
))
{
render_material
.
setTextureId
(
j
,
asset_texture
,
false
);
}
render_material
.
applyOverride
(
override_material
);
for
(
LLGLTFMaterial
::
TextureInfo
j
=
LLGLTFMaterial
::
TextureInfo
(
0
);
j
<
LLGLTFMaterial
::
GLTF_TEXTURE_INFO_COUNT
;
j
=
LLGLTFMaterial
::
TextureInfo
(
U32
(
j
)
+
1
))
{
const
LLUUID
&
render_texture
=
render_material
.
mTextureId
[
j
];
ensure_equals
(
"LLGLTFMaterial: Override texture ID "
+
override_texture
.
asString
()
+
" replaces underlying texture ID "
+
asset_texture
.
asString
(),
render_texture
,
override_texture
);
}
}
}
}
}
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