This repository has been archived by the owner on Jun 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
403f521
commit 4477df2
Showing
11 changed files
with
170 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
namespace FastMDX { | ||
public struct CollisionShape : IDataRW { | ||
public Node Node; | ||
public uint Type; | ||
public ShapeType Type; | ||
public Vec3 Vertices1, Vertices2; | ||
public float Radius; | ||
|
||
void IDataRW.ReadFrom(DataStream ds) { | ||
ds.ReadData(ref Node); | ||
ds.ReadStruct(ref Type); | ||
|
||
if(Type > 3) | ||
if((uint)Type > 3) | ||
throw new ParsingException(); | ||
|
||
ds.ReadStruct(ref Vertices1); | ||
|
||
if(Type != 2) | ||
if(Type != ShapeType.Sphere) | ||
ds.ReadStruct(ref Vertices2); | ||
|
||
if(Type > 1) | ||
if((Type == ShapeType.Sphere) || (Type == ShapeType.Cylinder)) | ||
ds.ReadStruct(ref Radius); | ||
} | ||
|
||
void IDataRW.WriteTo(DataStream ds) { | ||
if(Type > 3) | ||
throw new ParsingException(); | ||
|
||
ds.WriteData(ref Node); | ||
ds.WriteStruct(Type); | ||
ds.WriteStruct(ref Vertices1); | ||
|
||
if(Type != 2) | ||
if(Type != ShapeType.Sphere) | ||
ds.WriteStruct(ref Vertices2); | ||
|
||
if(Type > 1) | ||
if((Type == ShapeType.Sphere) || (Type == ShapeType.Cylinder)) | ||
ds.WriteStruct(Radius); | ||
} | ||
|
||
public enum ShapeType : uint { | ||
Box, | ||
Plane, | ||
Sphere, | ||
Cylinder, | ||
} | ||
} | ||
} |
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
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
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
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