mirror of
https://github.com/LazyDuchess/OpenTS2.git
synced 2025-01-22 16:21:47 -05:00
Fix bug with morphs with missing normal deltas
This commit is contained in:
parent
c980bea304
commit
66dd166834
5 changed files with 17 additions and 3 deletions
|
@ -223,7 +223,6 @@ namespace OpenTS2.Content.DBPF.Scenegraph
|
|||
// 3rd delta map.
|
||||
var deltaMapIdx = (3 - byteIdx);
|
||||
Debug.Assert(deltaMapIdx < vertexPosDeltas.Length);
|
||||
Debug.Assert(deltaMapIdx < vertexNormDeltas.Length);
|
||||
var morphTarget = morphTargets[(int)vertexMapByte];
|
||||
|
||||
if (animations[vertexMapByte] == null)
|
||||
|
@ -232,7 +231,11 @@ namespace OpenTS2.Content.DBPF.Scenegraph
|
|||
}
|
||||
|
||||
animations[vertexMapByte].VertexPositionDeltas[i] = vertexPosDeltas[deltaMapIdx].Data[i];
|
||||
animations[vertexMapByte].VertexNormalDeltas[i] = vertexNormDeltas[deltaMapIdx].Data[i];
|
||||
// Optionally the normal morph might be defined.
|
||||
if (deltaMapIdx < vertexNormDeltas.Length)
|
||||
{
|
||||
animations[vertexMapByte].VertexNormalDeltas[i] = vertexNormDeltas[deltaMapIdx].Data[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public class ScenegraphGMDCTest : MonoBehaviour
|
|||
Filesystem.GetPackagesInDirectory(Filesystem.GetDataPathForProduct(ProductFlags.BaseGame) + "/Res/Sims3D"));
|
||||
|
||||
var resource = contentProvider.GetAsset<ScenegraphResourceAsset>(
|
||||
new ResourceKey("chairReclinerPuffy_cres", GroupIDs.Scenegraph, TypeIDs.SCENEGRAPH_CRES));
|
||||
new ResourceKey("puFace_cres", GroupIDs.Scenegraph, TypeIDs.SCENEGRAPH_CRES));
|
||||
|
||||
Debug.Log($"scenegraphModel: {resource.GlobalTGI}");
|
||||
var gameObject = resource.CreateRootGameObject();
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace OpenTS2.Rendering
|
|||
RegisterMaterial<PhongTextureMaterial>();
|
||||
|
||||
RegisterMaterial<SimSkinMaterial>();
|
||||
RegisterMaterial<SimStandardMaterial>();
|
||||
|
||||
// Ideally we'd just disable the mesh renderer to save a draw call but Maxis had to make it weird of course.
|
||||
// Could maybe have an ApplyToRenderer(MeshRenderer, MaterialDef) function that does just that if the material def is Null instead.
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace OpenTS2.Rendering.Materials
|
||||
{
|
||||
public class SimStandardMaterial : StandardMaterial
|
||||
{
|
||||
public override string Name => "SimStandardMaterial";
|
||||
}
|
||||
}
|
3
Assets/Scripts/OpenTS2/Rendering/Materials/SimStandardMaterial.cs.meta
generated
Normal file
3
Assets/Scripts/OpenTS2/Rendering/Materials/SimStandardMaterial.cs.meta
generated
Normal file
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4b25adaa292949a5a9ae02a93159de09
|
||||
timeCreated: 1691541379
|
Loading…
Reference in a new issue