mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-11 13:04:17 -05:00
Implement Material.textureOffset & Material.textureScaling read/write
This commit is contained in:
parent
670c95d30a
commit
2f8fbb4f59
|
|
@ -127,8 +127,18 @@ namespace VRM
|
|||
}
|
||||
foreach (var kv in item.vectorProperties)
|
||||
{
|
||||
var v = new Vector4(kv.Value[0], kv.Value[1], kv.Value[2], kv.Value[3]);
|
||||
material.SetVector(kv.Key, v);
|
||||
if (item.textureProperties.ContainsKey(kv.Key))
|
||||
{
|
||||
// texture offset & scale
|
||||
material.SetTextureOffset(kv.Key, new Vector2(kv.Value[0], kv.Value[1]));
|
||||
material.SetTextureScale(kv.Key, new Vector2(kv.Value[2], kv.Value[3]));
|
||||
}
|
||||
else
|
||||
{
|
||||
// vector4
|
||||
var v = new Vector4(kv.Value[0], kv.Value[1], kv.Value[2], kv.Value[3]);
|
||||
material.SetVector(kv.Key, v);
|
||||
}
|
||||
}
|
||||
foreach (var kv in item.textureProperties)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ namespace VRM
|
|||
public Dictionary<string, float> floatProperties = new Dictionary<string, float>();
|
||||
public Dictionary<string, float[]> vectorProperties = new Dictionary<string, float[]>();
|
||||
public Dictionary<string, int> textureProperties = new Dictionary<string, int>();
|
||||
|
||||
public Dictionary<string, bool> keywordMap = new Dictionary<string, bool>();
|
||||
public Dictionary<string, string> tagMap = new Dictionary<string, string>();
|
||||
|
||||
|
|
@ -145,6 +144,12 @@ namespace VRM
|
|||
material.textureProperties.Add(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
// offset & scaling
|
||||
var offset = m.GetTextureOffset(name);
|
||||
var scaling = m.GetTextureScale(name);
|
||||
material.vectorProperties.Add(name,
|
||||
new float[] { offset.x, offset.y, scaling.x, scaling.y });
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user