-
Notifications
You must be signed in to change notification settings - Fork 126
Client distinguish between eye and mob for drawing, context menu, and verbs #2477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ruzihm
wants to merge
19
commits into
OpenDreamProject:master
Choose a base branch
from
Ruzihm:mob-sight
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
52ba508
notifies client of eye/mob changes via network message for determinin…
Ruzihm ed29795
feedback
Ruzihm d6a4560
Merge branch 'master' into mob-sight
Ruzihm 4a4b7fc
Update OpenDreamClient/Interface/DreamInterfaceManager.cs
Ruzihm fe4846e
Merge branch 'master' into mob-sight
Ruzihm 434d423
first attempt at supporting turf eye
Ruzihm 63d7ff7
some cleanup
Ruzihm b5b02bb
lint
Ruzihm af6dc0a
lint
Ruzihm 952497f
stop changing attached entity for eye changes, store eye reference in…
Ruzihm f57645d
lint
Ruzihm 2a1b4da
cleanup
Ruzihm 88d4457
makes null eye stop rendering. annoyingly it doesn't clear the screen…
Ruzihm 0cdcc18
lint
Ruzihm f0cac6d
null eye only shows certain screen elements
Ruzihm 2811882
lint
Ruzihm c16563c
lint
Ruzihm 20b94b3
lint
Ruzihm 355c938
Merge branch 'master' into mob-sight
Ruzihm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,101 @@ | ||
| using OpenDreamShared.Dream; | ||
| using Robust.Client.GameObjects; | ||
| using Robust.Shared.Graphics; | ||
| using Robust.Shared.Map; | ||
|
|
||
| namespace OpenDreamClient.Rendering; | ||
|
|
||
| public sealed class DreamClientEye: IEye { | ||
| private readonly ClientObjectReference _eyeRef; | ||
| private readonly IEntityManager _entityManager; | ||
| private readonly TransformSystem _transformSystem; | ||
|
|
||
| public DreamClientEye(IEye baseEye, ClientObjectReference eyeRef, IEntityManager entityManager, TransformSystem transformSystem) { | ||
| Rotation = baseEye.Rotation; | ||
| Scale = baseEye.Scale; | ||
| DrawFov = baseEye.DrawFov; | ||
| DrawLight = baseEye.DrawLight; | ||
|
|
||
| _eyeRef = eyeRef; | ||
| _entityManager = entityManager; | ||
| _transformSystem = transformSystem; | ||
| } | ||
|
|
||
| [ViewVariables(VVAccess.ReadOnly)] | ||
| public MapCoordinates Position { | ||
| get { | ||
| switch (_eyeRef.Type) { | ||
| case ClientObjectReference.RefType.Entity: | ||
| var ent = _entityManager.GetEntity(_eyeRef.Entity); | ||
| if (_entityManager.TryGetComponent<TransformComponent>(ent, out var pos)) { | ||
| return _transformSystem.GetMapCoordinates(pos); | ||
| } | ||
|
|
||
| break; | ||
|
||
|
|
||
| case ClientObjectReference.RefType.Turf: | ||
| return new(new(_eyeRef.TurfX, _eyeRef.TurfY), new(_eyeRef.TurfZ)); | ||
| } | ||
|
|
||
| // Nullspace position stops all rendering but we still want to render certain screen space objects... | ||
| //return MapCoordinates.Nullspace; | ||
| return new(0, 0, new(1)); | ||
| } | ||
| } | ||
|
|
||
| public void GetViewMatrix(out Matrix3x2 viewMatrix, Vector2 renderScale) { | ||
| var pos = Position; | ||
| viewMatrix = Matrix3Helpers.CreateInverseTransform( | ||
| pos.X + Offset.X, | ||
| pos.Y + Offset.Y, | ||
| (float)-Rotation.Theta, | ||
| 1 / (Scale.X * renderScale.X), | ||
| 1 / (Scale.Y * renderScale.Y)); | ||
| } | ||
|
|
||
| public void GetViewMatrixNoOffset(out Matrix3x2 viewMatrix, Vector2 renderScale) { | ||
| var pos = Position; | ||
| viewMatrix = Matrix3Helpers.CreateInverseTransform( | ||
| pos.X, | ||
| pos.Y, | ||
| (float)-Rotation.Theta, | ||
| 1 / (Scale.X * renderScale.X), | ||
| 1 / (Scale.Y * renderScale.Y)); | ||
| } | ||
|
|
||
| public void GetViewMatrixInv(out Matrix3x2 viewMatrixInv, Vector2 renderScale) { | ||
| var pos = Position; | ||
| viewMatrixInv = Matrix3Helpers.CreateTransform( | ||
| pos.X + Offset.X, | ||
| pos.Y + Offset.Y, | ||
| (float)-Rotation.Theta, | ||
| 1 / (Scale.X * renderScale.X), | ||
| 1 / (Scale.Y * renderScale.Y)); | ||
| } | ||
|
|
||
| private Vector2 _scale = Vector2.One / 2f; | ||
|
|
||
| [ViewVariables(VVAccess.ReadWrite)] | ||
| public bool DrawFov { get; set; } | ||
|
|
||
| [ViewVariables] | ||
| public bool DrawLight { get; set; } | ||
|
|
||
| [ViewVariables(VVAccess.ReadWrite)] | ||
| public Vector2 Offset { get; set; } | ||
|
|
||
| [ViewVariables(VVAccess.ReadWrite)] | ||
| public Angle Rotation { get; set; } | ||
|
|
||
| [ViewVariables(VVAccess.ReadWrite)] | ||
| public Vector2 Zoom { | ||
| get => new(1 / _scale.X, 1 / _scale.Y); | ||
| set => _scale = new Vector2(1 / value.X, 1 / value.Y); | ||
| } | ||
|
|
||
| [ViewVariables(VVAccess.ReadWrite)] | ||
| public Vector2 Scale { | ||
| get => _scale; | ||
| set => _scale = value; | ||
| } | ||
| } | ||
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.