Foliage not foilage. Embarrassing.

This commit is contained in:
UnknownShadow200 2017-02-03 09:57:17 +11:00
parent 6fca2f1b3a
commit c3e76fafb8
12 changed files with 81 additions and 51 deletions

View File

@ -16,7 +16,7 @@
permissions and limitations under the Licenses. permissions and limitations under the Licenses.
*/ */
using System; using System;
using MCGalaxy.Generator.Foilage; using MCGalaxy.Generator.Foliage;
namespace MCGalaxy.Blocks.Physics { namespace MCGalaxy.Blocks.Physics {

View File

@ -18,7 +18,7 @@
using System; using System;
using MCGalaxy.Drawing.Brushes; using MCGalaxy.Drawing.Brushes;
using MCGalaxy.Drawing.Ops; using MCGalaxy.Drawing.Ops;
using MCGalaxy.Generator.Foilage; using MCGalaxy.Generator.Foliage;
namespace MCGalaxy.Commands.Building { namespace MCGalaxy.Commands.Building {
public sealed class CmdTree : Command { public sealed class CmdTree : Command {

View File

@ -27,7 +27,7 @@ Ideas, concepts, and code were used from the following two sources:
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MCGalaxy.Drawing.Brushes; using MCGalaxy.Drawing.Brushes;
using MCGalaxy.Generator.Foilage; using MCGalaxy.Generator.Foliage;
namespace MCGalaxy.Drawing.Ops { namespace MCGalaxy.Drawing.Ops {
public class TreeDrawOp : DrawOp { public class TreeDrawOp : DrawOp {

View File

@ -20,7 +20,7 @@ using System.Collections.Generic;
using MCGalaxy.Drawing.Brushes; using MCGalaxy.Drawing.Brushes;
using MCGalaxy.Drawing.Ops; using MCGalaxy.Drawing.Ops;
namespace MCGalaxy.Generator.Foilage { namespace MCGalaxy.Generator.Foliage {
public sealed class AshTree : Tree { public sealed class AshTree : Tree {
int branchBaseHeight, branchAmount; int branchBaseHeight, branchAmount;

View File

@ -20,8 +20,9 @@
permissions and limitations under the Licenses. permissions and limitations under the Licenses.
*/ */
using System; using System;
using System.Collections.Generic;
namespace MCGalaxy.Generator.Foilage { namespace MCGalaxy.Generator.Foliage {
public sealed class BambooTree : Tree { public sealed class BambooTree : Tree {

View File

@ -19,7 +19,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using MCGalaxy.Drawing.Ops; using MCGalaxy.Drawing.Ops;
namespace MCGalaxy.Generator.Foilage { namespace MCGalaxy.Generator.Foliage {
public sealed class OakTree : Tree { public sealed class OakTree : Tree {
int numBranches, maxExtent, maxBranchHeight, trunkHeight; int numBranches, maxExtent, maxBranchHeight, trunkHeight;

View File

@ -26,7 +26,7 @@ Ideas, concepts, and code were used from the following two sources:
*/ */
using System; using System;
namespace MCGalaxy.Generator.Foilage { namespace MCGalaxy.Generator.Foliage {
public sealed class CactusTree : Tree { public sealed class CactusTree : Tree {
public override int DefaultValue(Random rnd) { return rnd.Next(3, 6); } public override int DefaultValue(Random rnd) { return rnd.Next(3, 6); }

View File

@ -19,7 +19,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using MCGalaxy.Drawing.Brushes; using MCGalaxy.Drawing.Brushes;
namespace MCGalaxy.Generator.Foilage { namespace MCGalaxy.Generator.Foliage {
public delegate void TreeOutput(ushort x, ushort y, ushort z, byte block); public delegate void TreeOutput(ushort x, ushort y, ushort z, byte block);

View File

@ -27,7 +27,7 @@ Ideas, concepts, and code were used from the following two sources:
using System; using System;
using MCGalaxy.Drawing; using MCGalaxy.Drawing;
using MCGalaxy.Drawing.Ops; using MCGalaxy.Drawing.Ops;
using MCGalaxy.Generator.Foilage; using MCGalaxy.Generator.Foliage;
namespace MCGalaxy.Generator { namespace MCGalaxy.Generator {
public sealed class RealisticMapGen { public sealed class RealisticMapGen {

View File

@ -17,7 +17,7 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MCGalaxy.Generator.Foilage; using MCGalaxy.Generator.Foliage;
namespace MCGalaxy { namespace MCGalaxy {

View File

@ -496,11 +496,11 @@
<Compile Include="Generator\fCraft\MapGenerator.cs" /> <Compile Include="Generator\fCraft\MapGenerator.cs" />
<Compile Include="Generator\fCraft\MapGeneratorArgs.cs" /> <Compile Include="Generator\fCraft\MapGeneratorArgs.cs" />
<Compile Include="Generator\fCraft\Noise.cs" /> <Compile Include="Generator\fCraft\Noise.cs" />
<Compile Include="Generator\Foilage\AshTree.cs" /> <Compile Include="Generator\Foliage\AshTree.cs" />
<Compile Include="Generator\Foilage\OakTree.cs" /> <Compile Include="Generator\Foliage\OakTree.cs" />
<Compile Include="Generator\Foilage\ForesterTrees.cs" /> <Compile Include="Generator\Foliage\ForesterTrees.cs" />
<Compile Include="Generator\Foilage\StandardTrees.cs" /> <Compile Include="Generator\Foliage\StandardTrees.cs" />
<Compile Include="Generator\Foilage\Tree.cs" /> <Compile Include="Generator\Foliage\Tree.cs" />
<Compile Include="Generator\HeightmapGen.cs" /> <Compile Include="Generator\HeightmapGen.cs" />
<Compile Include="Generator\ImprovedNoise.cs" /> <Compile Include="Generator\ImprovedNoise.cs" />
<Compile Include="Generator\MapGen.cs" /> <Compile Include="Generator\MapGen.cs" />

View File

@ -32,26 +32,16 @@ namespace MCGalaxy {
X = value; Y = value; Z = value; X = value; Y = value; Z = value;
} }
public override bool Equals(object obj) {
return (obj is Vec3U16) && Equals((Vec3U16)obj);
}
public bool Equals(Vec3U16 other) { public static explicit operator Vec3U16(Vec3S32 a) {
return X == other.X & Y == other.Y && Z == other.Z; return new Vec3U16((ushort)a.X, (ushort)a.Y, (ushort)a.Z);
}
public override int GetHashCode() {
int hashCode = 0;
hashCode += 1000000007 * X;
hashCode += 1000000009 * Y;
hashCode += 1000000021 * Z;
return hashCode;
} }
public int LengthSquared { get { return X * X + Y * Y + Z * Z; } } public int LengthSquared { get { return X * X + Y * Y + Z * Z; } }
public float Length { get { return (float)Math.Sqrt( X * X + Y * Y + Z * Z ); } } public float Length { get { return (float)Math.Sqrt( X * X + Y * Y + Z * Z ); } }
/// <summary> Clamps the given block coordinates to inside the map. </summary> /// <summary> Clamps the given block coordinates to inside the map. </summary>
public static Vec3U16 Clamp(ushort x, ushort y, ushort z, Level lvl) { public static Vec3U16 Clamp(ushort x, ushort y, ushort z, Level lvl) {
Vec3U16 P = new Vec3U16(x, y, z); Vec3U16 P = new Vec3U16(x, y, z);
@ -78,6 +68,23 @@ namespace MCGalaxy {
return P; return P;
} }
public override bool Equals(object obj) {
return (obj is Vec3U16) && Equals((Vec3U16)obj);
}
public bool Equals(Vec3U16 other) {
return X == other.X & Y == other.Y && Z == other.Z;
}
public override int GetHashCode() {
int hashCode = 0;
hashCode += 1000000007 * X;
hashCode += 1000000009 * Y;
hashCode += 1000000021 * Z;
return hashCode;
}
public static bool operator == (Vec3U16 a, Vec3U16 b) { public static bool operator == (Vec3U16 a, Vec3U16 b) {
return a.X == b.X && a.Y == b.Y && a.Z == b.Z; return a.X == b.X && a.Y == b.Y && a.Z == b.Z;
} }
@ -86,9 +93,6 @@ namespace MCGalaxy {
return a.X != b.X || a.Y != b.Y || a.Z != b.Z; return a.X != b.X || a.Y != b.Y || a.Z != b.Z;
} }
public static explicit operator Vec3U16(Vec3S32 a) {
return new Vec3U16((ushort)a.X, (ushort)a.Y, (ushort)a.Z);
}
public override string ToString() { public override string ToString() {
return X + "," + Y + "," + Z; return X + "," + Y + "," + Z;
@ -110,21 +114,6 @@ namespace MCGalaxy {
X = value; Y = value; Z = value; X = value; Y = value; Z = value;
} }
public override bool Equals(object obj) {
return (obj is Vec3S32) && Equals((Vec3S32)obj);
}
public bool Equals(Vec3S32 other) {
return X == other.X & Y == other.Y && Z == other.Z;
}
public override int GetHashCode() {
int hashCode = 0;
hashCode += 1000000007 * X;
hashCode += 1000000009 * Y;
hashCode += 1000000021 * Z;
return hashCode;
}
public int LengthSquared { get { return X * X + Y * Y + Z * Z; } } public int LengthSquared { get { return X * X + Y * Y + Z * Z; } }
@ -132,6 +121,22 @@ namespace MCGalaxy {
public float Dot(Vec3S32 b) { return X * b.X + Y * b.Y + Z * b.Z; } public float Dot(Vec3S32 b) { return X * b.X + Y * b.Y + Z * b.Z; }
public int this[int index] {
get {
if (index == 0) return X;
else if (index == 1) return Y;
else if (index == 2) return Z;
return 0;
}
set {
if (index == 0) { X = value; }
else if (index == 1) { Y = value; }
else if (index == 2) { Z = value; }
}
}
public static Vec3S32 Max(Vec3S32 a, Vec3S32 b) { public static Vec3S32 Max(Vec3S32 a, Vec3S32 b) {
return new Vec3S32(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y), Math.Max(a.Z, b.Z)); return new Vec3S32(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y), Math.Max(a.Z, b.Z));
} }
@ -144,6 +149,7 @@ namespace MCGalaxy {
return new Vec3S32(a.X, a.Y, a.Z); return new Vec3S32(a.X, a.Y, a.Z);
} }
public static Vec3S32 operator + (Vec3S32 a, Vec3S32 b) { public static Vec3S32 operator + (Vec3S32 a, Vec3S32 b) {
return new Vec3S32(a.X + b.X, a.Y + b.Y, a.Z + b.Z); return new Vec3S32(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
} }
@ -160,6 +166,23 @@ namespace MCGalaxy {
return new Vec3S32(a.X / b, a.Y / b, a.Z / b); return new Vec3S32(a.X / b, a.Y / b, a.Z / b);
} }
public override bool Equals(object obj) {
return (obj is Vec3S32) && Equals((Vec3S32)obj);
}
public bool Equals(Vec3S32 other) {
return X == other.X & Y == other.Y && Z == other.Z;
}
public override int GetHashCode() {
int hashCode = 0;
hashCode += 1000000007 * X;
hashCode += 1000000009 * Y;
hashCode += 1000000021 * Z;
return hashCode;
}
public static bool operator == (Vec3S32 a, Vec3S32 b) { public static bool operator == (Vec3S32 a, Vec3S32 b) {
return a.X == b.X && a.Y == b.Y && a.Z == b.Z; return a.X == b.X && a.Y == b.Y && a.Z == b.Z;
} }
@ -168,6 +191,7 @@ namespace MCGalaxy {
return a.X != b.X || a.Y != b.Y || a.Z != b.Z; return a.X != b.X || a.Y != b.Y || a.Z != b.Z;
} }
public override string ToString() { public override string ToString() {
return X + "," + Y + "," + Z; return X + "," + Y + "," + Z;
} }
@ -184,6 +208,7 @@ namespace MCGalaxy {
X = x; Y = y; Z = z; X = x; Y = y; Z = z;
} }
public float LengthSquared { public float LengthSquared {
get { return X * X + Y * Y + Z * Z; } get { return X * X + Y * Y + Z * Z; }
} }
@ -196,6 +221,7 @@ namespace MCGalaxy {
return a.X * b.X + a.Y * b.Y + a.Z * b.Z; return a.X * b.X + a.Y * b.Y + a.Z * b.Z;
} }
public static Vec3F32 Cross(Vec3F32 a, Vec3F32 b) { public static Vec3F32 Cross(Vec3F32 a, Vec3F32 b) {
return new Vec3F32(a.Y * b.Z - a.Z * b.Y, return new Vec3F32(a.Y * b.Z - a.Z * b.Y,
a.Z * b.X - a.X * b.Z, a.Z * b.X - a.X * b.Z,
@ -208,6 +234,7 @@ namespace MCGalaxy {
return a; return a;
} }
public static Vec3F32 operator * (float a, Vec3F32 b) { public static Vec3F32 operator * (float a, Vec3F32 b) {
return new Vec3F32(a * b.X, a * b.Y, a * b.Z); return new Vec3F32(a * b.X, a * b.Y, a * b.Z);
} }
@ -224,6 +251,7 @@ namespace MCGalaxy {
return new Vec3F32(a.X, a.Y, a.Z); return new Vec3F32(a.X, a.Y, a.Z);
} }
public override bool Equals(object obj) { public override bool Equals(object obj) {
return (obj is Vec3F32) && Equals((Vec3F32)obj); return (obj is Vec3F32) && Equals((Vec3F32)obj);
} }
@ -248,6 +276,7 @@ namespace MCGalaxy {
return a.X != b.X || a.Y != b.Y || a.Z != b.Z; return a.X != b.X || a.Y != b.Y || a.Z != b.Z;
} }
public override string ToString() { public override string ToString() {
return X + "," + Y + "," + Z; return X + "," + Y + "," + Z;
} }