-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension implementation can inject texture loading strategy to ImporterContext #986
Changes from 3 commits
02e5134
6b6a219
44bced7
7c9be3c
de55fd4
9d05920
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
using UnityEngine; | ||
using VRMShaders; | ||
using ColorSpace = VRMShaders.ColorSpace; | ||
|
||
namespace UniGLTF | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using UnityEngine; | ||
using VRMShaders; | ||
|
||
using ColorSpace = VRMShaders.ColorSpace; | ||
|
||
namespace UniGLTF | ||
{ | ||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
namespace UniGLTF | ||
namespace VRMShaders | ||
{ | ||
public enum ColorSpace | ||
{ | ||
sRGB, | ||
Linear, | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace VRMShaders | ||
{ | ||
/// <summary> | ||
/// 単純に Texture2D アセットを生成する機能 | ||
/// </summary> | ||
public interface ITextureDeserializer | ||
{ | ||
/// <summary> | ||
/// imageData をもとに Texture2D を生成する | ||
/// </summary> | ||
/// <param name="imageData">データ</param> | ||
/// <param name="useMipmap">Texture2D の mipmap が生成されるべきか否か</param> | ||
/// <param name="colorSpace">Texture2D の色空間</param> | ||
/// <returns></returns> | ||
Task<Texture2D> LoadTextureAsync(byte[] imageData, bool useMipmap, ColorSpace colorSpace); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😄 |
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using UnityEngine; | ||
|
||
namespace UniGLTF | ||
namespace VRMShaders | ||
{ | ||
/// <summary> | ||
/// Texture2D を入力として byte[] を得る機能 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
using UnityEngine; | ||
using ColorSpace = UniGLTF.ColorSpace; | ||
|
||
|
||
namespace VRMShaders | ||
{ | ||
|
@@ -19,28 +17,13 @@ private static Material Decoder | |
} | ||
} | ||
|
||
private static Material m_encoder; | ||
private static Material Encoder | ||
{ | ||
get | ||
{ | ||
if (m_encoder == null) | ||
{ | ||
m_encoder = new Material(Shader.Find("UniGLTF/NormalMapEncoder")); | ||
} | ||
return m_encoder; | ||
} | ||
} | ||
|
||
// GLTF data to Unity texture | ||
// ConvertToNormalValueFromRawColorWhenCompressionIsRequired | ||
public static Texture2D Import(Texture2D texture) | ||
{ | ||
return TextureConverter.CopyTexture(texture, ColorSpace.Linear, false, Encoder); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😄 |
||
return texture; | ||
} | ||
|
||
// Unity texture to GLTF data | ||
// ConvertToRawColorWhenNormalValueIsCompressed | ||
public static Texture2D Export(Texture texture) | ||
{ | ||
return TextureConverter.CopyTexture(texture, ColorSpace.Linear, false, Decoder); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄