mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-14 23:32:41 +08:00
added grass painting
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using SharpDX;
|
||||
|
||||
namespace CodeWalker.Core.Utils
|
||||
{
|
||||
public static class BoundingBoxExtensions
|
||||
{
|
||||
public static Vector3 Size(this BoundingBox bounds)
|
||||
{
|
||||
return new Vector3(
|
||||
Math.Abs(bounds.Maximum.X - bounds.Minimum.X),
|
||||
Math.Abs(bounds.Maximum.Y - bounds.Minimum.Y),
|
||||
Math.Abs(bounds.Maximum.Z - bounds.Minimum.Z));
|
||||
}
|
||||
|
||||
public static Vector3 Center(this BoundingBox bounds)
|
||||
{
|
||||
return (bounds.Minimum + bounds.Maximum) * 0.5F;
|
||||
}
|
||||
|
||||
public static BoundingBox Encapsulate(this BoundingBox box, BoundingBox bounds)
|
||||
{
|
||||
box.Minimum = Vector3.Min(box.Minimum, bounds.Minimum);
|
||||
box.Maximum = Vector3.Max(box.Maximum, bounds.Maximum);
|
||||
return box;
|
||||
}
|
||||
|
||||
public static float Radius(this BoundingBox box)
|
||||
{
|
||||
var extents = (box.Maximum - box.Minimum) * 0.5F;
|
||||
return extents.Length();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,18 +4,17 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CodeWalker.GameFiles;
|
||||
|
||||
namespace CodeWalker
|
||||
{
|
||||
public static class Vectors
|
||||
{
|
||||
|
||||
public static Vector3 XYZ(this Vector4 v)
|
||||
{
|
||||
return new Vector3(v.X, v.Y, v.Z);
|
||||
}
|
||||
|
||||
|
||||
public static Vector3 Round(this Vector3 v)
|
||||
{
|
||||
return new Vector3((float)Math.Round(v.X), (float)Math.Round(v.Y), (float)Math.Round(v.Z));
|
||||
@@ -25,7 +24,6 @@ namespace CodeWalker
|
||||
{
|
||||
return new Vector4((float)Math.Floor(v.X), (float)Math.Floor(v.Y), (float)Math.Floor(v.Z), (float)Math.Floor(v.W));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user