forked from TheCherno/Hazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added Vector4 and some script utils
- Loading branch information
Showing
6 changed files
with
258 additions
and
6 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
namespace Hazel | ||
{ | ||
public struct Vector4 | ||
{ | ||
public float X, Y, Z, W; | ||
|
||
public static Vector4 Zero => new Vector4(0.0f); | ||
|
||
public Vector4(float scalar) | ||
{ | ||
X = scalar; | ||
Y = scalar; | ||
Z = scalar; | ||
W = scalar; | ||
} | ||
|
||
public Vector4(float x, float y, float z, float w) | ||
{ | ||
X = x; | ||
Y = y; | ||
Z = z; | ||
W = w; | ||
} | ||
|
||
public Vector4(Vector3 xyz, float w) | ||
{ | ||
X = xyz.X; | ||
Y = xyz.Y; | ||
Z = xyz.Z; | ||
W = w; | ||
} | ||
|
||
public Vector2 XY | ||
{ | ||
get => new Vector2(X, Y); | ||
set | ||
{ | ||
X = value.X; | ||
Y = value.Y; | ||
} | ||
} | ||
|
||
public Vector3 XYZ | ||
{ | ||
get => new Vector3(X, Y, Z); | ||
set | ||
{ | ||
X = value.X; | ||
Y = value.Y; | ||
Z = value.Z; | ||
} | ||
} | ||
|
||
public static Vector4 operator +(Vector4 a, Vector4 b) | ||
{ | ||
return new Vector4(a.X + b.X, a.Y + b.Y, a.Z + b.Z, a.W + b.W); | ||
} | ||
|
||
public static Vector4 operator *(Vector4 vector, float scalar) | ||
{ | ||
return new Vector4(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar); | ||
} | ||
|
||
} | ||
} |
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