-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
951a845
commit 383e17f
Showing
6 changed files
with
536 additions
and
54 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
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,144 @@ | ||
using Dalamud.Game.ClientState.Objects.Types; | ||
using Dalamud.Logging; | ||
using ImGuiNET; | ||
using System; | ||
using System.Collections.Generic; | ||
using Vector2 = System.Numerics.Vector2; | ||
using Vector3 = System.Numerics.Vector3; | ||
|
||
namespace Telesto.Doodles | ||
{ | ||
|
||
internal class Cone : Doodle | ||
{ | ||
|
||
internal enum CoordSystemEnum | ||
{ | ||
Screen, | ||
World | ||
} | ||
|
||
internal CoordSystemEnum csys { get; set; } | ||
internal Coordinate position { get; set; } | ||
internal Coordinate target { get; set; } | ||
internal float radiuschonk { get; set; } | ||
internal float linechonk { get; set; } | ||
internal float anglechonk { get; set; } | ||
internal float headingchonk { get; set; } | ||
internal string Radius { get; set; } | ||
internal string Thickness { get; set; } | ||
internal string Angle { get; set; } | ||
internal string Heading { get; set; } | ||
internal bool filled { get; set; } | ||
internal bool targeted { get; set; } | ||
|
||
internal override Coordinate GetCoordinateByName(string id) | ||
{ | ||
switch (id.ToLower()) | ||
{ | ||
default: | ||
case "position": return position; | ||
} | ||
} | ||
|
||
internal override void Initialize(Dictionary<string, object> d) | ||
{ | ||
base.Initialize(d); | ||
Radius = (d.ContainsKey("radius") == true) ? d["radius"].ToString() : "10"; | ||
Thickness = (d.ContainsKey("thickness") == true) ? d["thickness"].ToString() : "1"; | ||
Angle = (d.ContainsKey("angle") == true) ? d["angle"].ToString() : "pi05"; | ||
Heading = (d.ContainsKey("heading") == true) ? d["heading"].ToString() : "0"; | ||
string fill = (d.ContainsKey("filled") == true) ? d["filled"].ToString() : "false"; | ||
filled = false; | ||
bool.TryParse(fill, out bool filledtemp); | ||
filled = filledtemp; | ||
position = new Coordinate() { doo = this }; | ||
if (d.ContainsKey("position") == true) | ||
{ | ||
position.Initialize((Dictionary<string, object>)d["position"]); | ||
} | ||
if (d.ContainsKey("target") == true) | ||
{ | ||
target = new Coordinate() { doo = this }; | ||
target.Initialize((Dictionary<string, object>)d["target"]); | ||
targeted = true; | ||
} | ||
string csystem = (d.ContainsKey("system") == true) ? d["system"].ToString() : "screen"; | ||
switch (csystem.ToLower()) | ||
{ | ||
case "world": | ||
csys = CoordSystemEnum.World; | ||
break; | ||
default: | ||
csys = CoordSystemEnum.Screen; | ||
break; | ||
} | ||
} | ||
|
||
internal override bool Update() | ||
{ | ||
if (base.Update() == false) | ||
{ | ||
return false; | ||
} | ||
position.RefreshVector(p); | ||
radiuschonk = (float)p.EvaluateNumericExpression(this, Radius); | ||
linechonk = (float)p.EvaluateNumericExpression(this, Thickness); | ||
anglechonk = (float)p.EvaluateNumericExpression(this, Angle); | ||
if (targeted == true) | ||
{ | ||
Vector3 temp1 = position.UntranslatedPosition(p); | ||
Vector3 temp2 = target.UntranslatedPosition(p); | ||
headingchonk = -1.0f * (float)Math.Atan2(temp1.Z - temp2.Z, temp1.X - temp2.X) - (float)(Math.PI / 2.0f); | ||
} | ||
else | ||
{ | ||
headingchonk = (float)p.EvaluateNumericExpression(this, Heading); | ||
} | ||
return true; | ||
} | ||
|
||
internal override void Draw() | ||
{ | ||
if (csys == CoordSystemEnum.Screen) | ||
{ | ||
} | ||
else | ||
{ | ||
Vector3 temp = position.UntranslatedPosition(p); | ||
int segments = (int)Math.Ceiling(48.0 / Math.PI * 2.0 * anglechonk); | ||
segments = segments < 2 ? 2 : segments; | ||
float segangle = anglechonk / (float)segments; | ||
Vector3 mid = p.TranslateToScreen(temp.X, temp.Y, temp.Z); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(mid.X, mid.Y)); | ||
float baseangle = headingchonk - (anglechonk / 2.0f); | ||
for (int i = 0; i < segments; i++) | ||
{ | ||
Vector3 mauw = p.TranslateToScreen( | ||
temp.X + (radiuschonk * Math.Sin(baseangle + (segangle * i))), | ||
temp.Y, | ||
temp.Z + (radiuschonk * Math.Cos(baseangle + (segangle * i))) | ||
); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(mauw.X, mauw.Y)); | ||
} | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(mid.X, mid.Y)); | ||
if (filled == true) | ||
{ | ||
ImGui.GetWindowDrawList().PathFillConvex( | ||
ImGui.GetColorU32(col) | ||
); | ||
} | ||
else | ||
{ | ||
ImGui.GetWindowDrawList().PathStroke( | ||
ImGui.GetColorU32(col), | ||
ImDrawFlags.None, | ||
linechonk | ||
); | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
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,160 @@ | ||
using Dalamud.Interface.Style; | ||
using ImGuiNET; | ||
using System; | ||
using System.Collections.Generic; | ||
using Vector2 = System.Numerics.Vector2; | ||
using Vector3 = System.Numerics.Vector3; | ||
|
||
namespace Telesto.Doodles | ||
{ | ||
|
||
internal class Donut : Doodle | ||
{ | ||
|
||
internal enum CoordSystemEnum | ||
{ | ||
Screen, | ||
World | ||
} | ||
|
||
internal CoordSystemEnum csys { get; set; } | ||
internal Coordinate position { get; set; } | ||
internal float innerradiuschonk { get; set; } | ||
internal float outerradiuschonk { get; set; } | ||
internal float linechonk { get; set; } | ||
internal string InnerRadius { get; set; } | ||
internal string OuterRadius { get; set; } | ||
internal string Thickness { get; set; } | ||
internal bool filled { get; set; } | ||
|
||
internal override Coordinate GetCoordinateByName(string id) | ||
{ | ||
switch (id.ToLower()) | ||
{ | ||
default: | ||
case "position": return position; | ||
} | ||
} | ||
|
||
internal override void Initialize(Dictionary<string, object> d) | ||
{ | ||
base.Initialize(d); | ||
InnerRadius = (d.ContainsKey("innerradius") == true) ? d["innerradius"].ToString() : "10"; | ||
OuterRadius = (d.ContainsKey("outerradius") == true) ? d["outerradius"].ToString() : "15"; | ||
Thickness = (d.ContainsKey("thickness") == true) ? d["thickness"].ToString() : "1"; | ||
string fill = (d.ContainsKey("filled") == true) ? d["filled"].ToString() : "false"; | ||
filled = false; | ||
bool.TryParse(fill, out bool filledtemp); | ||
filled = filledtemp; | ||
position = new Coordinate() { doo = this }; | ||
if (d.ContainsKey("position") == true) | ||
{ | ||
position.Initialize((Dictionary<string, object>)d["position"]); | ||
} | ||
string csystem = (d.ContainsKey("system") == true) ? d["system"].ToString() : "screen"; | ||
switch (csystem.ToLower()) | ||
{ | ||
case "world": | ||
csys = CoordSystemEnum.World; | ||
break; | ||
default: | ||
csys = CoordSystemEnum.Screen; | ||
break; | ||
} | ||
} | ||
|
||
internal override bool Update() | ||
{ | ||
if (base.Update() == false) | ||
{ | ||
return false; | ||
} | ||
position.RefreshVector(p); | ||
innerradiuschonk = (float)p.EvaluateNumericExpression(this, InnerRadius); | ||
outerradiuschonk = (float)p.EvaluateNumericExpression(this, OuterRadius); | ||
linechonk = (float)p.EvaluateNumericExpression(this, Thickness); | ||
return true; | ||
} | ||
|
||
internal override void Draw() | ||
{ | ||
if (csys == CoordSystemEnum.Screen) | ||
{ | ||
} | ||
else | ||
{ | ||
Vector3 temp = position.UntranslatedPosition(p); | ||
if (filled == false) | ||
{ | ||
for (int i = 0; i <= 48; i++) | ||
{ | ||
Vector3 mauw = p.TranslateToScreen( | ||
temp.X + (innerradiuschonk * Math.Sin((Math.PI / 24.0) * i)), | ||
temp.Y, | ||
temp.Z + (innerradiuschonk * Math.Cos((Math.PI / 24.0) * i)) | ||
); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(mauw.X, mauw.Y)); | ||
} | ||
ImGui.GetWindowDrawList().PathStroke( | ||
ImGui.GetColorU32(col), | ||
ImDrawFlags.None, | ||
linechonk | ||
); | ||
for (int i = 0; i <= 48; i++) | ||
{ | ||
Vector3 mauw = p.TranslateToScreen( | ||
temp.X + (outerradiuschonk * Math.Sin((Math.PI / 24.0) * i)), | ||
temp.Y, | ||
temp.Z + (outerradiuschonk * Math.Cos((Math.PI / 24.0) * i)) | ||
); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(mauw.X, mauw.Y)); | ||
} | ||
ImGui.GetWindowDrawList().PathStroke( | ||
ImGui.GetColorU32(col), | ||
ImDrawFlags.None, | ||
linechonk | ||
); | ||
} | ||
else | ||
{ | ||
Vector3 v1, v2, v3, v4; | ||
v1 = p.TranslateToScreen( | ||
temp.X + (innerradiuschonk * Math.Sin((Math.PI / 23.0) * 0)), | ||
temp.Y, | ||
temp.Z + (innerradiuschonk * Math.Cos((Math.PI / 24.0) * 0)) | ||
); | ||
v4 = p.TranslateToScreen( | ||
temp.X + (outerradiuschonk * Math.Sin((Math.PI / 24.0) * 0)), | ||
temp.Y, | ||
temp.Z + (outerradiuschonk * Math.Cos((Math.PI / 24.0) * 0)) | ||
); | ||
for (int i = 0; i <= 47; i++) | ||
{ | ||
v2 = p.TranslateToScreen( | ||
temp.X + (innerradiuschonk * Math.Sin((Math.PI / 24.0) * (i + 1))), | ||
temp.Y, | ||
temp.Z + (innerradiuschonk * Math.Cos((Math.PI / 24.0) * (i + 1))) | ||
); | ||
v3 = p.TranslateToScreen( | ||
temp.X + (outerradiuschonk * Math.Sin((Math.PI / 24.0) * (i + 1))), | ||
temp.Y, | ||
temp.Z + (outerradiuschonk * Math.Cos((Math.PI / 24.0) * (i + 1))) | ||
); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(v1.X, v1.Y)); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(v2.X, v2.Y)); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(v3.X, v3.Y)); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(v4.X, v4.Y)); | ||
ImGui.GetWindowDrawList().PathLineTo(new Vector2(v1.X, v1.Y)); | ||
ImGui.GetWindowDrawList().PathFillConvex( | ||
ImGui.GetColorU32(col) | ||
); | ||
v1 = v2; | ||
v4 = v3; | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
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.