Move source into /Source rather than /src. Some documentation cleanup.

This commit is contained in:
Will
2015-11-02 21:48:07 -07:00
parent 3a2a493154
commit d66a5fa91b
50 changed files with 77 additions and 68 deletions

View File

@@ -13,7 +13,7 @@ namespace LibBSP {
public string lumpName;
/// <summary>
/// Constructs a new instance of an <c>CountAttribute</c> object. The member this Attribute
/// Constructs a new instance of an <see cref="LibBSP.CountAttribute"/> object. The member this Attribute
/// is applied to will be used as a count of objects in the lump referenced by <paramref name="lumpName"/>.
/// </summary>
/// <param name="lumpName">The lump the member is an count for. Corresponds to the public properties in the <c>BSP</c> class.</param>

View File

@@ -13,7 +13,7 @@ namespace LibBSP {
public string lumpName;
/// <summary>
/// Constructs a new instance of an <c>IndexAttribute</c> object. The member this Attribute
/// Constructs a new instance of an <see cref="IndexAttribute"/> object. The member this Attribute
/// is applied to will be used as an index into the lump referenced by <paramref name="lumpName"/>.
/// </summary>
/// <param name="lumpName">The lump the member is an index into. Corresponds to the public properties in the <c>BSP</c> class.</param>

View File

@@ -13,18 +13,18 @@ namespace LibBSP {
using Color32 = Color;
#endif
/// <summary>
/// Static class containing helper methods for <c>Color32</c> objects.
/// Static class containing helper methods for <see cref="UnityEngine.Color32"/> objects.
/// </summary>
public static class Color32Extensions {
/// <summary>
/// Constructs a new <c>Color32</c> from the passed values.
/// Constructs a new <see cref="UnityEngine.Color32"/> from the passed values.
/// </summary>
/// <param name="a">A component</param>
/// <param name="r">R component</param>
/// <param name="g">G component</param>
/// <param name="b">B component</param>
/// <returns>The resulting <c>Color32</c> object</returns>
/// <param name="a">A component.</param>
/// <param name="r">R component.</param>
/// <param name="g">G component.</param>
/// <param name="b">B component.</param>
/// <returns>The resulting <see cref="UnityEngine.Color32"/> object.</returns>
public static Color32 FromArgb(int a, int r, int g, int b) {
#if UNITY
return new Color32((byte)r, (byte)g, (byte)b, (byte)a);

View File

@@ -0,0 +1,25 @@
//#if (UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5)
using System;
using System.Reflection;
namespace LibBSP {
/// <summary>
/// Contains static methods for retrieving custom attributes.
/// </summary>
public static class CustomAttributeExtensions {
/// <summary>
/// Retrieves a custom attribute of a specified type that is applied to a specified member.
/// </summary>
/// <param name="element">The member to inspect.</param>
/// <returns>A custom attribute that matches T, or null if no such attribute is found.</returns>
/// <typeparam name="T">The type of attribute to search for.</typeparam>
public static T GetCustomAttribute<T>(this MemberInfo element) where T : Attribute {
return Attribute.GetCustomAttribute(element, typeof(T)) as T;
}
}
}
//#endif

View File

@@ -13,16 +13,16 @@ namespace LibBSP {
using Vector3 = Vector3d;
#endif
/// <summary>
/// Static class containing helper methods for <c>Plane</c> objects.
/// Static class containing helper methods for <see cref="Plane"/> objects.
/// </summary>
public static class PlaneExtensions {
/// <summary>
/// Intersects three <c>Plane</c>s at a <c>Vector3</c>. Returns NaN for all components if two or more <c>Plane</c>s are parallel.
/// Intersects three <see cref="Plane"/>s at a <see cref="Vector3"/>. Returns NaN for all components if two or more <see cref="Plane"/>s are parallel.
/// </summary>
/// <param name="p1"><c>Plane</c> to intersect</param>
/// <param name="p2"><c>Plane</c> to intersect</param>
/// <param name="p3"><c>Plane</c> to intersect</param>
/// <returns>Point of intersection if all three <c>Plane</c>s meet at a point, (NaN, NaN, NaN) otherwise</returns>
/// <param name="p1"><see cref="Plane"/> to intersect.</param>
/// <param name="p2"><see cref="Plane"/> to intersect.</param>
/// <param name="p3"><see cref="Plane"/> to intersect.</param>
/// <returns>Point of intersection if all three <see cref="Plane"/>s meet at a point, (NaN, NaN, NaN) otherwise.</returns>
public static Vector3 Intersection(Plane p1, Plane p2, Plane p3) {
Vector3 aN = p1.normal;
Vector3 bN = p2.normal;
@@ -49,22 +49,22 @@ namespace LibBSP {
}
/// <summary>
/// Intersects this <c>Plane</c> with two other <c>Plane</c>s at a <c>Vector3</c>. Returns NaN for all components if two or more <c>Plane</c>s are parallel.
/// Intersects this <see cref="Plane"/> with two other <see cref="Plane"/>s at a <see cref="Vector3"/>. Returns NaN for all components if two or more <see cref="Plane"/>s are parallel.
/// </summary>
/// <param name="p1">This <c>Plane</c></param>
/// <param name="p2"><c>Plane</c> to intersect</param>
/// <param name="p3"><c>Plane</c> to intersect</param>
/// <returns>Point of intersection if all three <c>Plane</c>s meet at a point, (NaN, NaN, NaN) otherwise</returns>
/// <param name="p1">This <see cref="Plane"/>.</param>
/// <param name="p2"><see cref="Plane"/> to intersect</param>
/// <param name="p3"><see cref="Plane"/> to intersect</param>
/// <returns>Point of intersection if all three <see cref="Plane"/>s meet at a point, (NaN, NaN, NaN) otherwise</returns>
public static Vector3 Intersect(this Plane p1, Plane p2, Plane p3) {
return Intersection(p1, p2, p3);
}
/// <summary>
/// Intersects a <c>Plane</c> "<paramref name="p" />" with a <c>Ray</c> "<paramref name="r" />" at a <c>Vector3</c>. Returns NaN for all components if they do not intersect.
/// Intersects a <see cref="Plane"/> "<paramref name="p" />" with a <see cref="Ray"/> "<paramref name="r" />" at a <see cref="Vector3"/>. Returns NaN for all components if they do not intersect.
/// </summary>
/// <param name="p"><c>Plane</c> to intersect with</param>
/// <param name="r"><c>Ray</c> to intersect</param>
/// <returns>Point of intersection if "<paramref name="r" />" intersects "<paramref name="p" />", (NaN, NaN, NaN) otherwise</returns>
/// <param name="p"><see cref="Plane"/> to intersect with.</param>
/// <param name="r"><see cref="Ray"/> to intersect.</param>
/// <returns>Point of intersection if "<paramref name="r" />" intersects "<paramref name="p" />", (NaN, NaN, NaN) otherwise.</returns>
public static Vector3 Intersection(Plane p, Ray r) {
#if UNITY
float enter;
@@ -80,31 +80,31 @@ namespace LibBSP {
}
/// <summary>
/// Intersects this <c>Plane</c> with a <c>Ray</c> "<paramref name="r" />" at a <c>Vector3</c>. Returns NaN for all components if they do not intersect.
/// Intersects this <see cref="Plane"/> with a <see cref="Ray"/> "<paramref name="r" />" at a <see cref="Vector3"/>. Returns NaN for all components if they do not intersect.
/// </summary>
/// <param name="p">This <c>Plane</c></param>
/// <param name="r"><c>Ray</c> to intersect</param>
/// <returns>Point of intersection if "<paramref name="r" />" intersects this <c>Plane</c>, (NaN, NaN, NaN) otherwise</returns>
/// <param name="p">This <see cref="Plane"/>.</param>
/// <param name="r"><see cref="Ray"/> to intersect.</param>
/// <returns>Point of intersection if "<paramref name="r" />" intersects this <see cref="Plane"/>, (NaN, NaN, NaN) otherwise.</returns>
public static Vector3 Intersect(this Plane p, Ray r) {
return Intersection(p, r);
}
/// <summary>
/// Intersects a <c>Plane</c> "<paramref name="p" />" with this <c>Ray</c> at a <c>Vector3</c>. Returns NaN for all components if they do not intersect.
/// Intersects a <see cref="Plane"/> "<paramref name="p" />" with this <see cref="Ray"/> at a <see cref="Vector3"/>. Returns NaN for all components if they do not intersect.
/// </summary>
/// <param name="r">This <c>Ray</c></param>
/// <param name="p"><c>Plane</c> to intersect with</param>
/// <returns>Point of intersection if this <c>Ray</c> intersects "<paramref name="p" />", (NaN, NaN, NaN) otherwise</returns>
/// <param name="r">This <see cref="Ray"/>.</param>
/// <param name="p"><see cref="Plane"/> to intersect with.</param>
/// <returns>Point of intersection if this <see cref="Ray"/> intersects "<paramref name="p" />", (NaN, NaN, NaN) otherwise.</returns>
public static Vector3 Intersect(this Ray r, Plane p) {
return Intersection(p, r);
}
/// <summary>
/// Intersects two <c>Plane</c>s at a <c>Ray</c>. Returns NaN for all components of both <c>Vector3</c>s of the <c>Ray</c> if the <c>Plane</c>s are parallel.
/// Intersects two <see cref="Plane"/>s at a <see cref="Ray"/>. Returns NaN for all components of both <see cref="Vector3"/>s of the <see cref="Ray"/> if the <see cref="Plane"/>s are parallel.
/// </summary>
/// <param name="p1"><c>Plane</c> to intersect</param>
/// <param name="p2"><c>Plane</c> to intersect</param>
/// <returns>Line of intersection where "<paramref name="p1" />" intersects "<paramref name="p2" />", ((NaN, NaN, NaN) + p(NaN, NaN, NaN)) otherwise</returns>
/// <param name="p1"><see cref="Plane"/> to intersect.</param>
/// <param name="p2"><see cref="Plane"/> to intersect.</param>
/// <returns>Line of intersection where "<paramref name="p1" />" intersects "<paramref name="p2" />", ((NaN, NaN, NaN) + p(NaN, NaN, NaN)) otherwise.</returns>
public static Ray Intersection(Plane p1, Plane p2) {
Vector3 direction = Vector3.Cross(p1.normal, p2.normal);
if (direction == Vector3.zero) {
@@ -148,21 +148,21 @@ namespace LibBSP {
}
/// <summary>
/// Intersects this <c>Plane</c> with another <c>Plane</c> at a <c>Ray</c>. Returns NaN for all components of both <c>Vector3</c>s of the <c>Ray</c> if the <c>Plane</c>s are parallel.
/// Intersects this <see cref="Plane"/> with another <see cref="Plane"/> at a <see cref="Ray"/>. Returns NaN for all components of both <see cref="Vector3"/>s of the <see cref="Ray"/> if the <see cref="Plane"/>s are parallel.
/// </summary>
/// <param name="p1">This <c>Plane</c></param>
/// <param name="p2"><c>Plane</c> to intersect</param>
/// <returns>Line of intersection where this <c>Plane</c> intersects "<paramref name="p2" />", ((NaN, NaN, NaN) + p(NaN, NaN, NaN)) otherwise</returns>
/// <param name="p1">This <see cref="Plane"/>.</param>
/// <param name="p2"><see cref="Plane"/> to intersect.</param>
/// <returns>Line of intersection where this <see cref="Plane"/> intersects "<paramref name="p2" />", ((NaN, NaN, NaN) + p(NaN, NaN, NaN)) otherwise.</returns>
public static Ray Intersect(this Plane p1, Plane p2) {
return Intersection(p1, p2);
}
/// <summary>
/// Generates three points which can be used to define this <c>Plane</c>.
/// Generates three points which can be used to define this <see cref="Plane"/>.
/// </summary>
/// <param name="p">This <c>Plane</c>.</param>
/// <param name="planePointCoef">Scale of distance between the generated points. The points will define the same <c>Plane</c> but will be farther apart the larger this value is. May not be zero.</param>
/// <returns>Three points which define this <c>Plane</c>.</returns>
/// <param name="p">This <see cref="Plane"/>.</param>
/// <param name="planePointCoef">Scale of distance between the generated points. The points will define the same <see cref="Plane"/> but will be farther apart the larger this value is. May not be zero.</param>
/// <returns>Three points which define this <see cref="Plane"/>.</returns>
public static Vector3[] GenerateThreePoints(this Plane p, float planePointCoef = 16) {
Vector3[] points = new Vector3[3];
// Figure out if the plane is parallel to two of the axes. If so it can be reproduced easily
@@ -228,13 +228,13 @@ namespace LibBSP {
}
/// <summary>
/// Factory method to parse a <c>byte</c> array into a <c>List</c> of <c>Plane</c> objects.
/// Factory method to parse a <c>byte</c> array into a <see cref="List"/> of <see cref="Plane"/> objects.
/// </summary>
/// <param name="data">The data to parse</param>
/// <param name="type">The map type</param>
/// <returns>A <c>List</c> of <c>Plane</c> objects</returns>
/// <exception cref="ArgumentNullException"><paramref name="data" /> was null</exception>
/// <exception cref="ArgumentException">This structure is not implemented for the given maptype</exception>
/// <param name="data">The data to parse.</param>
/// <param name="type">The map type.</param>
/// <returns>A <see cref="List"/> of <see cref="Plane"/> objects.</returns>
/// <exception cref="ArgumentNullException"><paramref name="data" /> was null.</exception>
/// <exception cref="ArgumentException">This structure is not implemented for the given maptype.</exception>
/// <remarks>This function goes here since it can't go into Unity's Plane class, and so can't depend
/// on having a constructor taking a byte array.</remarks>
public static List<Plane> LumpFactory(byte[] data, MapType type) {
@@ -291,8 +291,8 @@ namespace LibBSP {
/// <summary>
/// Gets the index for this lump in the BSP file for a specific map format.
/// </summary>
/// <param name="type">The map type</param>
/// <returns>Index for this lump, or -1 if the format doesn't have this lump or it's not implemented</returns>
/// <param name="type">The map type.</param>
/// <returns>Index for this lump, or -1 if the format doesn't have this lump or it's not implemented.</returns>
public static int GetIndexForLump(MapType type) {
switch (type) {
case MapType.FAKK:

View File

@@ -1,16 +0,0 @@
#if (UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5)
using System;
using System.Reflection;
namespace LibBSP {
public static class CustomAttributeExtensions {
public static T GetCustomAttribute<T>(this MemberInfo element) where T : Attribute {
return Attribute.GetCustomAttribute(element, typeof(T)) as T;
}
}
}
#endif