-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'improvement/tablet-ui' into develop
- Loading branch information
Showing
84 changed files
with
8,184 additions
and
1,307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
Assets/Code/Tablet/Count/TabletCountingMarkerRenderState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using FieldDay.Animation; | ||
using FieldDay.SharedState; | ||
using UnityEngine; | ||
|
||
namespace Pennycook.Tablet { | ||
public sealed class TabletCountingMarkerRenderState : SharedStateComponent { | ||
public Camera RenderCamera; | ||
public Mesh RenderMesh; | ||
public Material RenderMaterial; | ||
public float RenderScale; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Code/Tablet/Count/TabletCountingMarkerRenderState.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using BeauUtil; | ||
using FieldDay; | ||
using FieldDay.Animation; | ||
using FieldDay.Rendering; | ||
using FieldDay.SharedState; | ||
using FieldDay.Systems; | ||
using UnityEngine; | ||
using UnityEngine.Rendering; | ||
|
||
namespace Pennycook.Tablet { | ||
[SysUpdate(GameLoopPhase.UnscaledLateUpdate, 20000)] | ||
public sealed class TabletCountingMarkerRenderer : SharedStateSystemBehaviour<TabletCountingMarkerRenderState, TabletToolState, TabletControlState> { | ||
public override bool HasWork() { | ||
return base.HasWork() | ||
&& m_StateA.RenderCamera.isActiveAndEnabled | ||
&& m_StateB.CurrentTool == TabletTool.Count; | ||
} | ||
|
||
public unsafe override void ProcessWork(float deltaTime) { | ||
RenderParams renderParms = new RenderParams(m_StateA.RenderMaterial); | ||
renderParms.camera = m_StateA.RenderCamera; | ||
renderParms.layer = LayerMasks.Default_Index; | ||
renderParms.renderingLayerMask = GraphicsSettings.defaultRenderingLayerMask; | ||
|
||
DefaultInstancedMeshParams* instanceData = stackalloc DefaultInstancedMeshParams[64]; | ||
InstancedMeshBuffer<DefaultInstancedMeshParams> instanceBuff = new InstancedMeshBuffer<DefaultInstancedMeshParams>(instanceData, 64, renderParms, m_StateA.RenderMesh); | ||
|
||
Matrix4x4 billboardMat, scaledBillboardMat; | ||
CameraUtility.GetBillboardingMatrix(m_StateA.RenderCamera, out billboardMat); | ||
scaledBillboardMat = billboardMat * Matrix4x4.Scale(Vector3.one * m_StateA.RenderScale); | ||
|
||
DefaultInstancedMeshParams instParms = default; | ||
|
||
foreach (var c in Find.Components<TabletCountable>()) { | ||
if (!c.IsCounted) { | ||
continue; | ||
} | ||
|
||
if (c.Group.State != TabletCountingGroupState.InProgress) { | ||
continue; | ||
} | ||
|
||
Vector3 worldPos = c.transform.position; | ||
worldPos.y += 2.5f; | ||
|
||
// TODO: scale this | ||
|
||
Geom.SetTranslation(ref scaledBillboardMat, worldPos); | ||
instParms.objectToWorld = scaledBillboardMat; | ||
instanceBuff.Queue(ref instParms); | ||
} | ||
|
||
instanceBuff.Flush(); | ||
instanceBuff.Dispose(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Code/Tablet/Count/TabletCountingMarkerRenderer.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using FieldDay.Animation; | ||
using UnityEngine; | ||
|
||
namespace Pennycook.Tablet { | ||
public sealed class TabletCountingVisuals : MonoBehaviour { | ||
public RectTransform RotatingRing; | ||
|
||
private void LateUpdate() { | ||
RotatingRing.Rotate(0, 0, 2f * Time.deltaTime); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.