-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #780 from ousttrue/fix/roughness_smooth_conversion
MetallicRoughnessOcclusion テクスチャーの取り廻しを中心に改修
- Loading branch information
Showing
68 changed files
with
1,243 additions
and
1,101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
Assets/UniGLTF/Editor/UniGLTF/TextureImporterConfigurator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace UniGLTF | ||
{ | ||
public static class TextureImporterConfigurator | ||
{ | ||
public static void ConfigureNormalMap(Texture2D texture) | ||
{ | ||
var path = UnityPath.FromAsset(texture); | ||
if (AssetImporter.GetAtPath(path.Value) is TextureImporter textureImporter) | ||
{ | ||
#if VRM_DEVELOP | ||
Debug.Log($"{path} => normalmap"); | ||
#endif | ||
textureImporter.textureType = TextureImporterType.NormalMap; | ||
textureImporter.SaveAndReimport(); | ||
} | ||
else | ||
{ | ||
throw new System.IO.FileNotFoundException($"{path}"); | ||
} | ||
} | ||
|
||
public static void ConfigureLinear(Texture2D texture) | ||
{ | ||
var path = UnityPath.FromAsset(texture); | ||
if (AssetImporter.GetAtPath(path.Value) is TextureImporter textureImporter) | ||
{ | ||
#if VRM_DEVELOP | ||
Debug.Log($"{path} => linear"); | ||
#endif | ||
textureImporter.sRGBTexture = false; | ||
textureImporter.SaveAndReimport(); | ||
} | ||
else | ||
{ | ||
throw new System.IO.FileNotFoundException($"{path}"); | ||
} | ||
} | ||
|
||
public static void Configure(GetTextureParam textureInfo, IDictionary<string, Texture2D> ExternalMap) | ||
{ | ||
switch (textureInfo.TextureType) | ||
{ | ||
case GetTextureParam.TextureTypes.NormalMap: | ||
{ | ||
if (ExternalMap.TryGetValue(textureInfo.GltflName, out Texture2D external)) | ||
{ | ||
ConfigureNormalMap(external); | ||
} | ||
} | ||
break; | ||
|
||
case GetTextureParam.TextureTypes.StandardMap: | ||
{ | ||
if (ExternalMap.TryGetValue(textureInfo.ConvertedName, out Texture2D external)) | ||
{ | ||
ConfigureLinear(external); | ||
} | ||
} | ||
break; | ||
|
||
case GetTextureParam.TextureTypes.sRGB: | ||
break; | ||
|
||
default: | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...extureConverter/ITextureConverter.cs.meta → ...iGLTF/TextureImporterConfigurator.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialExporter.cs.meta
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../Runtime/UniGLTF/IO/TextureConverter.meta → ...niGLTF/Runtime/UniGLTF/IO/MaterialIO.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.