Skip to content

Commit

Permalink
Pull request KhronosGroup#2: ARES-1784 force wrapMode and filterMode …
Browse files Browse the repository at this point in the history
…if different.

Merge in ARES/ares.unity_gltf from bugfix/ARES-1784-fix-hl2-darkness to ares

Squashed commit of the following:

commit 1c086288fd2f2da821e1e291a95de5f808fcc218
Author: Jason Schutz <[email protected]>
Date:   Wed Aug 5 13:59:18 2020 -0400

    ARES-1784 force wrapMode and filterMode if different.  Use the isLinear parameter for BasisTexture.LoadFromBytes
  • Loading branch information
js-dignitas committed Aug 18, 2020
1 parent 252bb11 commit e419859
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions UnityGLTF/Assets/UnityGLTF/Scripts/GLTFSceneImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ async Task<Texture2D> LoadBASIS(byte[] buffer, int offset, int length, bool mark
{
sem.Wait();
// This will spawn a coroutine and then call our handler
basisTex.LoadFromBytes(na, _asyncCoroutineHelper);
basisTex.LoadFromBytes(na, _asyncCoroutineHelper, isLinear);

// wait for our handler to get called so the semaphore will be released.
bool success = await sem.WaitAsync(3000);
Expand Down Expand Up @@ -2472,11 +2472,13 @@ protected virtual async Task ConstructTexture(GLTFTexture texture, int textureIn
var matchSamplerState = source.filterMode == desiredFilterMode && source.wrapMode == desiredWrapMode;
if (matchSamplerState || markGpuOnly)
{
source.wrapMode = desiredWrapMode;
source.filterMode = desiredFilterMode;
_assetCache.TextureCache[textureIndex].Texture = source;

if (!matchSamplerState)
{
Debug.LogWarning($"Ignoring sampler; filter mode: source {source.filterMode}, desired {desiredFilterMode}; wrap mode: source {source.wrapMode}, desired {desiredWrapMode}");
//Debug.LogWarning($"Ignoring sampler; filter mode: source {source.filterMode}, desired {desiredFilterMode}; wrap mode: source {source.wrapMode}, desired {desiredWrapMode}");
}
}
else
Expand Down

0 comments on commit e419859

Please sign in to comment.