-
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
Conversation
public ImporterContext( | ||
GltfParser parser, | ||
IReadOnlyDictionary<SubAssetKey, UnityEngine.Object> externalObjectMap = null, | ||
ITextureDeserializer textureDeserializer = null) |
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.
😄
/// <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 comment
The reason will be displayed to describe this comment to others. Learn more.
😄
// 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 comment
The reason will be displayed to describe this comment to others. Learn more.
😄
// > contrary to Unity’s usual convention of using Y as “up” | ||
// https://docs.unity3d.com/2018.4/Documentation/Manual/StandardShaderMaterialParameterNormalMap.html | ||
var data0 = await texDesc.Index0(); | ||
var rawTexture = await _textureDeserializer.LoadTextureAsync(data0, texDesc.Sampler.EnableMipMap, ColorSpace.Linear); |
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.
_textureDeserializer.LoadTextureAsync
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.
ITextureDeserializer
ITextureDeserializer
ImporterContext
can be injectedITextureDeserializer