-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added buildings, trees and persistence to the Virtual World Scene
- Loading branch information
Showing
37 changed files
with
974 additions
and
159 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
Large diffs are not rendered by default.
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,3 @@ | ||
{ | ||
"modelFilename": "tree1.dae" | ||
} |
9 changes: 9 additions & 0 deletions
9
Samples/05 AISamples/SceneCWRVirtualWorld/Content/BuildingFile.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,9 @@ | ||
| ||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct BuildingFile | ||
{ | ||
public PolygonFile Polygon { get; set; } | ||
public float Height { get; set; } | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Samples/05 AISamples/SceneCWRVirtualWorld/Content/CrossingFile.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,29 @@ | ||
using AISamples.SceneCWRVirtualWorld.Markings; | ||
using System; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct CrossingFile : IMarkingFile | ||
{ | ||
public string Type { get; set; } | ||
public Vector2File Position { get; set; } | ||
public Vector2File Direction { get; set; } | ||
public float Width { get; set; } | ||
public float Height { get; set; } | ||
public bool Is3D { get; set; } | ||
|
||
public readonly Marking FromMarkingFile() | ||
{ | ||
if (Type != nameof(Crossing)) | ||
{ | ||
throw new ArgumentException("Invalid marking file type"); | ||
} | ||
|
||
return new Crossing( | ||
Vector2File.FromVector2File(Position), | ||
Vector2File.FromVector2File(Direction), | ||
Width, | ||
Height); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Samples/05 AISamples/SceneCWRVirtualWorld/Content/EnvelopeFile.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,11 @@ | ||
| ||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct EnvelopeFile | ||
{ | ||
public Segment2File Skeleton { get; set; } | ||
public float Width { get; set; } | ||
public int Roundness { get; set; } | ||
public PolygonFile Polygon { get; set; } | ||
} | ||
} |
23 changes: 1 addition & 22 deletions
23
Samples/05 AISamples/SceneCWRVirtualWorld/Content/GraphFile.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 |
---|---|---|
@@ -1,30 +1,9 @@ | ||
using System.Linq; | ||
|
||
| ||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct GraphFile | ||
{ | ||
public Vector2File[] Points { get; set; } | ||
public Segment2File[] Segments { get; set; } | ||
|
||
public static GraphFile FromGraph(Graph graph) | ||
{ | ||
var points = graph.GetPoints().Select(Vector2File.FromVector2).ToArray(); | ||
var segments = graph.GetSegments().Select(Segment2File.FromSegment).ToArray(); | ||
|
||
return new() | ||
{ | ||
Points = points, | ||
Segments = segments, | ||
}; | ||
} | ||
|
||
public static Graph FromGraphFile(GraphFile graph) | ||
{ | ||
var points = graph.Points.Select(Vector2File.FromVector2File).ToArray(); | ||
var segments = graph.Segments.Select(Segment2File.FromSegmentFile).ToArray(); | ||
|
||
return new(points, segments); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Samples/05 AISamples/SceneCWRVirtualWorld/Content/IMarkingFile.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,16 @@ | ||
using AISamples.SceneCWRVirtualWorld.Markings; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
interface IMarkingFile | ||
{ | ||
string Type { get; set; } | ||
Vector2File Position { get; set; } | ||
Vector2File Direction { get; set; } | ||
float Width { get; set; } | ||
float Height { get; set; } | ||
bool Is3D { get; set; } | ||
|
||
Marking FromMarkingFile(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Samples/05 AISamples/SceneCWRVirtualWorld/Content/LightFile.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,35 @@ | ||
using AISamples.SceneCWRVirtualWorld.Markings; | ||
using System; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct LightFile : IMarkingFile | ||
{ | ||
public string Type { get; set; } | ||
public Vector2File Position { get; set; } | ||
public Vector2File Direction { get; set; } | ||
public float Width { get; set; } | ||
public float Height { get; set; } | ||
public bool Is3D { get; set; } | ||
public LightState LightState { get; set; } | ||
public float RedDuration { get; set; } | ||
public float YellowDuration { get; set; } | ||
public float GreenDuration { get; set; } | ||
|
||
public readonly Marking FromMarkingFile() | ||
{ | ||
if (Type != nameof(Light)) | ||
{ | ||
throw new ArgumentException("Invalid marking file type"); | ||
} | ||
|
||
return new Light(Vector2File.FromVector2File(Position), Vector2File.FromVector2File(Direction), Width, Height) | ||
{ | ||
LightState = LightState, | ||
RedDuration = RedDuration, | ||
YellowDuration = YellowDuration, | ||
GreenDuration = GreenDuration | ||
}; | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Samples/05 AISamples/SceneCWRVirtualWorld/Content/ParkingFile.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,29 @@ | ||
using AISamples.SceneCWRVirtualWorld.Markings; | ||
using System; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct ParkingFile : IMarkingFile | ||
{ | ||
public string Type { get; set; } | ||
public Vector2File Position { get; set; } | ||
public Vector2File Direction { get; set; } | ||
public float Width { get; set; } | ||
public float Height { get; set; } | ||
public bool Is3D { get; set; } | ||
|
||
public readonly Marking FromMarkingFile() | ||
{ | ||
if (Type != nameof(Parking)) | ||
{ | ||
throw new ArgumentException("Invalid marking file type"); | ||
} | ||
|
||
return new Parking( | ||
Vector2File.FromVector2File(Position), | ||
Vector2File.FromVector2File(Direction), | ||
Width, | ||
Height); | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
Samples/05 AISamples/SceneCWRVirtualWorld/Content/PolygonFile.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,9 @@ | ||
| ||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct PolygonFile | ||
{ | ||
public Vector2File[] Vertices { get; set; } | ||
public Segment2File[] Segments { get; set; } | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
Samples/05 AISamples/SceneCWRVirtualWorld/Content/Segment2File.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 |
---|---|---|
@@ -1,25 +1,9 @@ | ||
| ||
using AISamples.SceneCWRVirtualWorld.Primitives; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct Segment2File | ||
{ | ||
public Vector2File P1 { get; set; } | ||
public Vector2File P2 { get; set; } | ||
|
||
public static Segment2File FromSegment(Segment2 segment) | ||
{ | ||
return new() | ||
{ | ||
P1 = Vector2File.FromVector2(segment.P1), | ||
P2 = Vector2File.FromVector2(segment.P2), | ||
}; | ||
} | ||
|
||
public static Segment2 FromSegmentFile(Segment2File segment) | ||
{ | ||
return new(Vector2File.FromVector2File(segment.P1), Vector2File.FromVector2File(segment.P2)); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Samples/05 AISamples/SceneCWRVirtualWorld/Content/StartFile.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,29 @@ | ||
using AISamples.SceneCWRVirtualWorld.Markings; | ||
using System; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct StartFile : IMarkingFile | ||
{ | ||
public string Type { get; set; } | ||
public Vector2File Position { get; set; } | ||
public Vector2File Direction { get; set; } | ||
public float Width { get; set; } | ||
public float Height { get; set; } | ||
public bool Is3D { get; set; } | ||
|
||
public readonly Marking FromMarkingFile() | ||
{ | ||
if (Type != nameof(Start)) | ||
{ | ||
throw new ArgumentException("Invalid marking file type"); | ||
} | ||
|
||
return new Start( | ||
Vector2File.FromVector2File(Position), | ||
Vector2File.FromVector2File(Direction), | ||
Width, | ||
Height); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Samples/05 AISamples/SceneCWRVirtualWorld/Content/StopFile.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,29 @@ | ||
using AISamples.SceneCWRVirtualWorld.Markings; | ||
using System; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct StopFile : IMarkingFile | ||
{ | ||
public string Type { get; set; } | ||
public Vector2File Position { get; set; } | ||
public Vector2File Direction { get; set; } | ||
public float Width { get; set; } | ||
public float Height { get; set; } | ||
public bool Is3D { get; set; } | ||
|
||
public readonly Marking FromMarkingFile() | ||
{ | ||
if (Type != nameof(Stop)) | ||
{ | ||
throw new ArgumentException("Invalid marking file type"); | ||
} | ||
|
||
return new Stop( | ||
Vector2File.FromVector2File(Position), | ||
Vector2File.FromVector2File(Direction), | ||
Width, | ||
Height); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Samples/05 AISamples/SceneCWRVirtualWorld/Content/TargetFile.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,29 @@ | ||
using AISamples.SceneCWRVirtualWorld.Markings; | ||
using System; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct TargetFile : IMarkingFile | ||
{ | ||
public string Type { get; set; } | ||
public Vector2File Position { get; set; } | ||
public Vector2File Direction { get; set; } | ||
public float Width { get; set; } | ||
public float Height { get; set; } | ||
public bool Is3D { get; set; } | ||
|
||
public readonly Marking FromMarkingFile() | ||
{ | ||
if (Type != nameof(Target)) | ||
{ | ||
throw new ArgumentException("Invalid marking file type"); | ||
} | ||
|
||
return new Target( | ||
Vector2File.FromVector2File(Position), | ||
Vector2File.FromVector2File(Direction), | ||
Width, | ||
Height); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Samples/05 AISamples/SceneCWRVirtualWorld/Content/TreeFile.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,10 @@ | ||
| ||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct TreeFile | ||
{ | ||
public Vector3File Position { get; set; } | ||
public float Radius { get; set; } | ||
public float Height { get; set; } | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Samples/05 AISamples/SceneCWRVirtualWorld/Content/Vector3File.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,26 @@ | ||
using SharpDX; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct Vector3File | ||
{ | ||
public float X { get; set; } | ||
public float Y { get; set; } | ||
public float Z { get; set; } | ||
|
||
public static Vector3File FromVector3(Vector3 vector) | ||
{ | ||
return new() | ||
{ | ||
X = vector.X, | ||
Y = vector.Y, | ||
Z = vector.Z | ||
}; | ||
} | ||
|
||
public static Vector3 FromVector3File(Vector3File vector) | ||
{ | ||
return new(vector.X, vector.Y, vector.Z); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Samples/05 AISamples/SceneCWRVirtualWorld/Content/WorldFile.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,18 @@ | ||
using System; | ||
|
||
namespace AISamples.SceneCWRVirtualWorld.Content | ||
{ | ||
struct WorldFile | ||
{ | ||
public GraphFile Graph { get; set; } | ||
public float Height { get; set; } | ||
public Guid Version { get; set; } | ||
public EnvelopeFile[] Envelopes { get; set; } | ||
public EnvelopeFile[] RoadEnvelopes { get; set; } | ||
public Segment2File[] RoadBorders { get; set; } | ||
public BuildingFile[] Buildings { get; set; } | ||
public TreeFile[] Trees { get; set; } | ||
public Segment2File[] LaneGuides { get; set; } | ||
public IMarkingFile[] Markings { get; set; } | ||
} | ||
} |
Oops, something went wrong.