mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-26 08:52:52 +08:00
Minor improvement to UV anims
This commit is contained in:
parent
d0eabc095a
commit
68a028dc0b
@ -75,9 +75,6 @@ namespace CodeWalker.Rendering
|
|||||||
public double CurrentAnimTime = 0;
|
public double CurrentAnimTime = 0;
|
||||||
public YcdFile ClipDict;
|
public YcdFile ClipDict;
|
||||||
public ClipMapEntry ClipMapEntry;
|
public ClipMapEntry ClipMapEntry;
|
||||||
public ClipMapEntry ClipMapEntryUV0;
|
|
||||||
public ClipMapEntry ClipMapEntryUV1;
|
|
||||||
|
|
||||||
public Dictionary<ushort, RenderableModel> ModelBoneLinks;
|
public Dictionary<ushort, RenderableModel> ModelBoneLinks;
|
||||||
|
|
||||||
|
|
||||||
@ -359,16 +356,23 @@ namespace CodeWalker.Rendering
|
|||||||
|
|
||||||
if (ClipMapEntry != null)
|
if (ClipMapEntry != null)
|
||||||
{
|
{
|
||||||
UpdateAnim(ClipMapEntry); //animate skeleton/models here
|
UpdateAnim(ClipMapEntry); //animate skeleton/models
|
||||||
}
|
}
|
||||||
if (ClipMapEntryUV0 != null)
|
|
||||||
|
foreach (var model in HDModels)
|
||||||
{
|
{
|
||||||
UpdateAnimUV(ClipMapEntryUV0); //animate UVs
|
if (model == null) continue;
|
||||||
}
|
foreach (var geom in model.Geometries)
|
||||||
if (ClipMapEntryUV1 != null)
|
{
|
||||||
{
|
if (geom == null) continue;
|
||||||
UpdateAnimUV(ClipMapEntryUV1); //animate UVs
|
if (geom.ClipMapEntryUV != null)
|
||||||
|
{
|
||||||
|
UpdateAnimUV(geom.ClipMapEntryUV, geom); //animate UVs
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void UpdateAnim(ClipMapEntry cme)
|
private void UpdateAnim(ClipMapEntry cme)
|
||||||
{
|
{
|
||||||
@ -401,6 +405,8 @@ 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];
|
||||||
@ -465,7 +471,7 @@ namespace CodeWalker.Rendering
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void UpdateAnimUV(ClipMapEntry cme)
|
private void UpdateAnimUV(ClipMapEntry cme, RenderableGeometry rgeom = null)
|
||||||
{
|
{
|
||||||
if (cme.Next != null) //is this a "chain" of clips to play..?
|
if (cme.Next != null) //is this a "chain" of clips to play..?
|
||||||
{
|
{
|
||||||
@ -520,16 +526,24 @@ namespace CodeWalker.Rendering
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var model in HDModels) //TODO: figure out which models/geometries this should be applying to!
|
if (rgeom != null)
|
||||||
{
|
{
|
||||||
if (model == null) continue;
|
rgeom.globalAnimUV0 = globalAnimUV0;
|
||||||
foreach (var geom in model.Geometries)
|
rgeom.globalAnimUV1 = globalAnimUV1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var model in HDModels) //TODO: figure out which models/geometries this should be applying to!
|
||||||
{
|
{
|
||||||
if (geom == null) continue;
|
if (model == null) continue;
|
||||||
if (geom.globalAnimUVEnable)
|
foreach (var geom in model.Geometries)
|
||||||
{
|
{
|
||||||
geom.globalAnimUV0 = globalAnimUV0;
|
if (geom == null) continue;
|
||||||
geom.globalAnimUV1 = globalAnimUV1;
|
if (geom.globalAnimUVEnable)
|
||||||
|
{
|
||||||
|
geom.globalAnimUV0 = globalAnimUV0;
|
||||||
|
geom.globalAnimUV1 = globalAnimUV1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -640,7 +654,7 @@ namespace CodeWalker.Rendering
|
|||||||
public float HeightOpacity { get; set; } = 0; //for terrainfoam
|
public float HeightOpacity { get; set; } = 0; //for terrainfoam
|
||||||
public bool HDTextureEnable = true;
|
public bool HDTextureEnable = true;
|
||||||
public bool globalAnimUVEnable = false;
|
public bool globalAnimUVEnable = false;
|
||||||
|
public ClipMapEntry ClipMapEntryUV = null;
|
||||||
|
|
||||||
public static ShaderParamNames[] GetTextureSamplerList()
|
public static ShaderParamNames[] GetTextureSamplerList()
|
||||||
{
|
{
|
||||||
|
@ -2793,11 +2793,23 @@ namespace CodeWalker.Rendering
|
|||||||
{
|
{
|
||||||
rndbl.ClipDict = ycd;
|
rndbl.ClipDict = ycd;
|
||||||
MetaHash ahash = arche.Hash;
|
MetaHash ahash = arche.Hash;
|
||||||
MetaHash ahashuv0 = ahash + 1; //this goes to at least uv5! (from uv0) - see hw1_09.ycd
|
|
||||||
MetaHash ahashuv1 = ahash + 2;
|
|
||||||
if (ycd.ClipMap.TryGetValue(ahash, out rndbl.ClipMapEntry)) rndbl.HasAnims = true;
|
if (ycd.ClipMap.TryGetValue(ahash, out rndbl.ClipMapEntry)) rndbl.HasAnims = true;
|
||||||
if (ycd.ClipMap.TryGetValue(ahashuv0, out rndbl.ClipMapEntryUV0)) rndbl.HasAnims = true;
|
|
||||||
if (ycd.ClipMap.TryGetValue(ahashuv1, out rndbl.ClipMapEntryUV1)) rndbl.HasAnims = true;
|
uint cmeindex = 1;
|
||||||
|
foreach (var model in rndbl.HDModels)
|
||||||
|
{
|
||||||
|
if (model == null) continue;
|
||||||
|
foreach (var geom in model.Geometries)
|
||||||
|
{
|
||||||
|
if (geom == null) continue;
|
||||||
|
if (geom.globalAnimUVEnable)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
cmeindex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user