Fixed UV anim clips assignment to use geometry's ShaderID for the lookup.

This commit is contained in:
dexy 2019-11-02 22:53:54 +11:00
parent 68a028dc0b
commit 3462513e27
3 changed files with 6 additions and 4 deletions

View File

@ -1291,6 +1291,7 @@ namespace CodeWalker.GameFiles
public ushort[] BoneIds { get; set; } public ushort[] BoneIds { get; set; }
public VertexData VertexData { get; set; } public VertexData VertexData { get; set; }
public ShaderFX Shader { get; set; } public ShaderFX Shader { get; set; }
public ushort ShaderID { get; set; }
private ResourceSystemStructBlock<ushort> BoneIdsBlock = null;//for saving only private ResourceSystemStructBlock<ushort> BoneIdsBlock = null;//for saving only
@ -2371,6 +2372,7 @@ namespace CodeWalker.GameFiles
var geom = model.Geometries.data_items[i]; var geom = model.Geometries.data_items[i];
ushort sid = (i < model.ShaderMapping.Length) ? model.ShaderMapping[i] : (ushort)0; ushort sid = (i < model.ShaderMapping.Length) ? model.ShaderMapping[i] : (ushort)0;
geom.Shader = (sid < shaders.Length) ? shaders[sid] : null; geom.Shader = (sid < shaders.Length) ? shaders[sid] : null;
geom.ShaderID = sid;
} }
} }
} }

View File

@ -405,8 +405,6 @@ namespace CodeWalker.Rendering
if (bones == null) if (bones == null)
{ return; } { return; }
//TODO: fragments! see eg. p_oil_pjack_03_s
for (int i = 0; i < anim.BoneIds.data_items.Length; i++) for (int i = 0; i < anim.BoneIds.data_items.Length; i++)
{ {
var boneiditem = anim.BoneIds.data_items[i]; var boneiditem = anim.BoneIds.data_items[i];
@ -453,6 +451,9 @@ namespace CodeWalker.Rendering
if (bmodel == null) if (bmodel == null)
{ continue; } { continue; }
if (((bmodel.SkeletonBinding >> 8) & 0xFF) > 0) //skin mesh? //TODO: see eg. p_oil_pjack_03_s
{ continue; }
//update model's transform from animated bone //update model's transform from animated bone
var pos = bone.AnimTranslation; var pos = bone.AnimTranslation;

View File

@ -2795,7 +2795,6 @@ namespace CodeWalker.Rendering
MetaHash ahash = arche.Hash; MetaHash ahash = arche.Hash;
if (ycd.ClipMap.TryGetValue(ahash, out rndbl.ClipMapEntry)) rndbl.HasAnims = true; if (ycd.ClipMap.TryGetValue(ahash, out rndbl.ClipMapEntry)) rndbl.HasAnims = true;
uint cmeindex = 1;
foreach (var model in rndbl.HDModels) foreach (var model in rndbl.HDModels)
{ {
if (model == null) continue; if (model == null) continue;
@ -2804,9 +2803,9 @@ namespace CodeWalker.Rendering
if (geom == null) continue; if (geom == null) continue;
if (geom.globalAnimUVEnable) if (geom.globalAnimUVEnable)
{ {
uint cmeindex = geom.DrawableGeom.ShaderID + 1u;
MetaHash cmehash = ahash + cmeindex; //this goes to at least uv5! (from uv0) - see hw1_09.ycd MetaHash cmehash = ahash + cmeindex; //this goes to at least uv5! (from uv0) - see hw1_09.ycd
if (ycd.ClipMap.TryGetValue(cmehash, out geom.ClipMapEntryUV)) rndbl.HasAnims = true; if (ycd.ClipMap.TryGetValue(cmehash, out geom.ClipMapEntryUV)) rndbl.HasAnims = true;
cmeindex++;
} }
} }
} }