add PhysX SDK and some tweaks
This commit is contained in:
15
Prism-ScriptCore/Src/Prism/Math/Mathf.cs
Normal file
15
Prism-ScriptCore/Src/Prism/Math/Mathf.cs
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
namespace Prism
|
||||
{
|
||||
public static class Mathf
|
||||
{
|
||||
public static float Clamp(float value, float min, float max)
|
||||
{
|
||||
if (value < min)
|
||||
return min;
|
||||
if (value > max)
|
||||
return max;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,23 @@ namespace Prism
|
||||
Z = vec.Z;
|
||||
}
|
||||
|
||||
public void Clamp(Vec3 min, Vec3 max)
|
||||
{
|
||||
X = Mathf.Clamp(X, min.X, max.X);
|
||||
Y = Mathf.Clamp(Y, min.Y, max.Y);
|
||||
Z = Mathf.Clamp(Z, min.Z, max.Z);
|
||||
}
|
||||
|
||||
public static Vec3 operator *(Vec3 left, float scalar)
|
||||
{
|
||||
return new Vec3(left.X * scalar, left.Y * scalar, left.Z * scalar);
|
||||
}
|
||||
|
||||
public static Vec3 operator *(float scalar, Vec3 right)
|
||||
{
|
||||
return new Vec3(scalar * right.X, scalar * right.Y, scalar * right.Z);
|
||||
}
|
||||
|
||||
public Vec2 XY {
|
||||
get { return new Vec2(X, Y); }
|
||||
set { X = value.X; Y = value.Y; }
|
||||
|
||||
Reference in New Issue
Block a user