Skip to content

Commit

Permalink
preview 55
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Dec 18, 2019
1 parent 4beb9d0 commit cc39742
Show file tree
Hide file tree
Showing 11 changed files with 454 additions and 439 deletions.
24 changes: 12 additions & 12 deletions IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_Gizmos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace IndustrialPark
public partial class ArchiveEditorFunctions
{
private static PositionGizmo[] positionGizmos;
private static PositionGizmo[] triggerPositionGizmos;
private static BoxTrigPositionGizmo[] triggerPositionGizmos;
private static RotationGizmo[] rotationGizmos;
private static ScaleGizmo[] scaleGizmos;
private static PositionLocalGizmo[] positionLocalGizmos;
Expand All @@ -18,13 +18,13 @@ public static void SetUpGizmos()
new PositionGizmo(GizmoType.Y),
new PositionGizmo(GizmoType.Z)};

triggerPositionGizmos = new PositionGizmo[6]{
new PositionGizmo(GizmoType.X),
new PositionGizmo(GizmoType.Y),
new PositionGizmo(GizmoType.Z),
new PositionGizmo(GizmoType.TrigX1),
new PositionGizmo(GizmoType.TrigY1),
new PositionGizmo(GizmoType.TrigZ1)};
triggerPositionGizmos = new BoxTrigPositionGizmo[6]{
new BoxTrigPositionGizmo(GizmoType.X),
new BoxTrigPositionGizmo(GizmoType.Y),
new BoxTrigPositionGizmo(GizmoType.Z),
new BoxTrigPositionGizmo(GizmoType.TrigX1),
new BoxTrigPositionGizmo(GizmoType.TrigY1),
new BoxTrigPositionGizmo(GizmoType.TrigZ1)};

rotationGizmos = new RotationGizmo[3]{
new RotationGizmo(GizmoType.Yaw),
Expand Down Expand Up @@ -62,7 +62,7 @@ public static void RenderGizmos(SharpRenderer renderer)
GizmoCenterPosition = TRIG.Position;
float distance = Vector3.Distance(renderer.Camera.Position, TRIG.GetBoundingBox().Center) / 5f;

foreach (PositionGizmo g in triggerPositionGizmos)
foreach (BoxTrigPositionGizmo g in triggerPositionGizmos)
{
g.SetPosition(TRIG.GetBoundingBox(), distance);
g.Draw(renderer);
Expand Down Expand Up @@ -292,7 +292,7 @@ public static void ScreenUnclicked()
{
foreach (PositionGizmo g in positionGizmos)
g.isSelected = false;
foreach (PositionGizmo g in triggerPositionGizmos)
foreach (BoxTrigPositionGizmo g in triggerPositionGizmos)
g.isSelected = false;
foreach (RotationGizmo g in rotationGizmos)
g.isSelected = false;
Expand Down Expand Up @@ -380,7 +380,7 @@ public void MouseMoveForPosition(Matrix viewProjection, int distanceX, int dista
direction.Z = 0;
direction.Normalize();

ra.Position0Y += (distanceX * direction.X - distanceY * direction.Y) / 10;
ra.Position1Y += (distanceX * direction.X - distanceY * direction.Y) / 10;
}
else if (triggerPositionGizmos[2].isSelected)
{
Expand All @@ -407,7 +407,7 @@ public void MouseMoveForPosition(Matrix viewProjection, int distanceX, int dista
direction.Z = 0;
direction.Normalize();

ra.Position1Y += (distanceX * direction.X - distanceY * direction.Y) / 10;
ra.Position0Y += (distanceX * direction.X - distanceY * direction.Y) / 10;
}
else if (triggerPositionGizmos[5].isSelected)
{
Expand Down
54 changes: 54 additions & 0 deletions IndustrialPark/ArchiveEditor/Gizmos/BoxTrigPositionGizmo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using SharpDX;
using System.Collections.Generic;

namespace IndustrialPark
{
public class BoxTrigPositionGizmo : GizmoBase
{
public BoxTrigPositionGizmo(GizmoType type) : base(type)
{
vertices = new Vector3[SharpRenderer.pyramidVertices.Count];
}

public void SetPosition(BoundingBox boundingBox, float Distance)
{
Vector3 Position = boundingBox.Center;
switch (type)
{
case GizmoType.X:
Position.X = boundingBox.Maximum.X + Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationY(MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.Y:
Position.Y = boundingBox.Maximum.Y + Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationX(-MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.Z:
Position.Z = boundingBox.Maximum.Z + Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.Translation(Position);
break;

case GizmoType.TrigX1:
Position.X = boundingBox.Minimum.X - Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationY(-MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.TrigY1:
Position.Y = boundingBox.Minimum.Y - Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationX(MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.TrigZ1:
Position.Z = boundingBox.Minimum.Z - Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationX(MathUtil.Pi) * Matrix.Translation(Position);
break;
}

for (int i = 0; i < SharpRenderer.pyramidVertices.Count; i++)
vertices[i] = (Vector3)Vector3.Transform(SharpRenderer.pyramidVertices[i], transformMatrix);
base.boundingBox = BoundingBox.FromPoints(vertices);
}

public override SharpMesh Mesh => SharpRenderer.Pyramid;

protected override List<Models.Triangle> triangleList => SharpRenderer.pyramidTriangles;
}
}
12 changes: 9 additions & 3 deletions IndustrialPark/ArchiveEditor/Gizmos/GizmoBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,30 @@ public GizmoBase(GizmoType type)
case GizmoType.X:
case GizmoType.Yaw:
case GizmoType.ScaleX:
case GizmoType.TrigX1:
renderData.Color = new Vector4(1f, 0f, 0f, 0.4f);
break;
case GizmoType.Y:
case GizmoType.Pitch:
case GizmoType.ScaleY:
case GizmoType.TrigY1:
renderData.Color = new Vector4(0f, 1f, 0f, 0.4f);
break;
case GizmoType.Z:
case GizmoType.Roll:
case GizmoType.ScaleZ:
case GizmoType.TrigZ1:
renderData.Color = new Vector4(0f, 0f, 1f, 0.4f);
break;
case GizmoType.ScaleAll:
renderData.Color = new Vector4(0.6f, 0.5f, 0.5f, 0.4f);
break;
case GizmoType.TrigX1:
renderData.Color = new Vector4(0f, 1f, 1f, 0.4f);
break;
case GizmoType.TrigY1:
renderData.Color = new Vector4(1f, 0f, 1f, 0.4f);
break;
case GizmoType.TrigZ1:
renderData.Color = new Vector4(1f, 1f, 0f, 0.4f);
break;
}
isSelected = false;
}
Expand Down
52 changes: 1 addition & 51 deletions IndustrialPark/ArchiveEditor/Gizmos/PositionGizmo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,63 +26,13 @@ public void SetPosition(Vector3 Position, float Radius)
Position.Z += Radius;
transformMatrix = Matrix.Scaling(Radius / 2f) * Matrix.Translation(Position);
break;

case GizmoType.TrigX1:
Position.X -= Radius;
transformMatrix = Matrix.Scaling(Radius / 2f) * Matrix.RotationY(-MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.TrigY1:
Position.Y -= Radius;
transformMatrix = Matrix.Scaling(Radius / 2f) * Matrix.RotationX(MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.TrigZ1:
Position.Z -= Radius;
transformMatrix = Matrix.Scaling(Radius / 2f) * Matrix.RotationX(MathUtil.Pi) * Matrix.Translation(Position);
break;
}

for (int i = 0; i < SharpRenderer.pyramidVertices.Count; i++)
vertices[i] = (Vector3)Vector3.Transform(SharpRenderer.pyramidVertices[i], transformMatrix);
boundingBox = BoundingBox.FromPoints(vertices);
}

public void SetPosition(BoundingBox boundingBox, float Distance)
{
Vector3 Position = boundingBox.Center;
switch (type)
{
case GizmoType.X:
Position.X = boundingBox.Maximum.X + Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationY(MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.Y:
Position.Y = boundingBox.Minimum.Y - Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationX(MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.Z:
Position.Z = boundingBox.Maximum.Z + Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.Translation(Position);
break;

case GizmoType.TrigX1:
Position.X = boundingBox.Minimum.X - Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationY(-MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.TrigY1:
Position.Y = boundingBox.Maximum.Y + Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationX(-MathUtil.Pi / 2) * Matrix.Translation(Position);
break;
case GizmoType.TrigZ1:
Position.Z = boundingBox.Minimum.Z - Distance;
transformMatrix = Matrix.Scaling(Distance) * Matrix.RotationX(MathUtil.Pi) * Matrix.Translation(Position);
break;
}

for (int i = 0; i < SharpRenderer.pyramidVertices.Count; i++)
vertices[i] = (Vector3)Vector3.Transform(SharpRenderer.pyramidVertices[i], transformMatrix);
base.boundingBox = BoundingBox.FromPoints(vertices);
}


public override SharpMesh Mesh => SharpRenderer.Pyramid;

protected override List<Models.Triangle> triangleList => SharpRenderer.pyramidTriangles;
Expand Down
6 changes: 2 additions & 4 deletions IndustrialPark/IndustrialPark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
<ItemGroup>
<Compile Include="ArchiveEditor\ArchiveEditorFunctions_IO.cs" />
<Compile Include="ArchiveEditor\ArchiveEditorFunctions_Sounds.cs" />
<Compile Include="ArchiveEditor\Gizmos\BoxTrigPositionGizmo.cs" />
<Compile Include="ArchiveEditor\Other\TextureIOHelper.cs" />
<Compile Include="ArchiveEditor\ArchiveEditorFunctions_Textures.cs" />
<Compile Include="ArchiveEditor\ArchiveEditorFunctions_Gizmos.cs" />
Expand Down Expand Up @@ -599,10 +600,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Resources\Scripts\ANIM_asset_importer_gcn.ms">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\Scripts\ANIM_asset_importer_xbox.ms">
<None Include="Resources\Scripts\BFBBAnimTools.ms">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\Scripts\importvcolorobj_v1.3.9.ms">
Expand Down
4 changes: 2 additions & 2 deletions IndustrialPark/Other/IPversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public class IPversion
{
public string version = "preview54.2";
public string versionName = "Preview 54.2";
public string version = "preview55";
public string versionName = "Preview 55";
}
}
Loading

0 comments on commit cc39742

Please sign in to comment.