Skip to content

Commit

Permalink
zzre: Add several backdrops (#329)
Browse files Browse the repository at this point in the history
* Add several backdrops

* Make clouds rotate
  • Loading branch information
AcipenserSturio authored Feb 25, 2024
1 parent 3d1aa3d commit c04893c
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions zzre/game/systems/model/BackdropLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,30 @@ private void HandleSceneLoaded(in messages.SceneLoaded message)
: null;
switch(dynBackdropId)
{
case 10: CreateStaticBackdrop("fbgsm01p", depthTest: false, depthWrite: false,
rotation: Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathF.PI / -2));
case 2: // Forest
CreateStaticBackdrop("ebg01h", depthTest: false, depthWrite: false);
break;
case 3: // Horizon
CreateStaticBackdrop("sbg01m", hasFog: false).Set(new components.behaviour.Rotate(Vector3.UnitY, 1f));
CreateStaticBackdrop("sbg02m", hasFog: false);
break;
case 5: // Swamp
CreateStaticBackdrop("bgsm01p", depthTest: false, depthWrite: false,
rotation: Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathF.PI / -2));
break;
case 7: // Mountain1
CreateStaticBackdrop("msk01f", depthTest: false, depthWrite: false, hasFog: false);
break;
case 10: // Garden
CreateStaticBackdrop("fbgsm01p", depthTest: false, depthWrite: false,
rotation: Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathF.PI / -2));
break;
case null: CreateStaticBackdrop(backdropName); break;
default: logger.Warning("Unsupported dynamic backdrop {Name}", backdropName); break;
}
}

private DefaultEcs.Entity CreateStaticBackdrop(string name, bool depthTest = true, bool depthWrite = true, Quaternion? rotation = null)
private DefaultEcs.Entity CreateStaticBackdrop(string name, bool depthTest = true, bool depthWrite = true, bool hasFog = true, Quaternion? rotation = null)
{
var entity = ecsWorld.CreateEntity();
entity.Set(new Location()
Expand All @@ -79,7 +94,8 @@ private DefaultEcs.Entity CreateStaticBackdrop(string name, bool depthTest = tru
var materialInfo = new resources.ClumpMaterialInfo(zzio.scn.FOModelRenderType.Solid, rwMaterial: null!)
{
DepthTest = depthTest,
DepthWrite = depthWrite
DepthWrite = depthWrite,
HasFog = hasFog
};
var clumpMesh = entity.Get<ClumpMesh>();
entity.Set(new List<materials.ModelMaterial>(clumpMesh.Materials.Count));
Expand Down

0 comments on commit c04893c

Please sign in to comment.