From d56308e585e056038dca8a32cc79d131015581de Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 17 Nov 2021 09:55:01 +0800 Subject: *misc --- .../Libraries/GameLab/Engine/Math/Matrix44.lua | 16 ++++++++++++ .../Libraries/GameLab/Engine/Math/Vector2.lua | 29 +++++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) (limited to 'Data') diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/Math/Matrix44.lua b/Data/BuiltIn/Libraries/GameLab/Engine/Math/Matrix44.lua index 9386daf..4e833a1 100644 --- a/Data/BuiltIn/Libraries/GameLab/Engine/Math/Matrix44.lua +++ b/Data/BuiltIn/Libraries/GameLab/Engine/Math/Matrix44.lua @@ -8,6 +8,22 @@ Matrix44.Ctor = function(self) end end +Matrix44.get_colum1 = function(self) + +end + +Matrix44.get_colum2 = function(self) + +end + +Matrix44.get_colum3 = function(self) + +end + +Matrix44.get_colum4 = function(self) + +end + Matrix44.Clear = function(self) for r = 0, 3 do for c = 0, 3 do diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/Math/Vector2.lua b/Data/BuiltIn/Libraries/GameLab/Engine/Math/Vector2.lua index 8aeb30a..24aa233 100644 --- a/Data/BuiltIn/Libraries/GameLab/Engine/Math/Vector2.lua +++ b/Data/BuiltIn/Libraries/GameLab/Engine/Math/Vector2.lua @@ -1,14 +1,29 @@ local Vector2 = GameLab.GlobalClass("GameLab.Engine.Math.Vector2") +local Vector4 = GameLab.Include("GameLab.Engine.Math.Vector4") function Vector2:Ctor(x, y) self.x = x or 0 self.y = y or 0 end -function Vector2:__add(other) - self.x = self.x + other.x - self.y = self.y + other.y - return self +function Vector2:get_xyxy() + local v = Vector4(self.x, self.y, self.x, self.y) + return v +end + +function Vector2:get_xx() + local v = Vector2(self.x, self.x) + return v +end + +function Vector2:get_yy() + local v = Vector2(self.y, self.y) + return v +end + +function Vector2:get_yx() + local v = Vector2(self.y, self.x) + return v end function Vector2:Set(other) @@ -22,6 +37,12 @@ function Vector2:Add(other) return self end +function Vector2:__add(other) + self.x = self.x + other.x + self.y = self.y + other.y + return self +end + function Vector2:__tostring() return string.format("%0.3f,%0.3f", self.x, self.y) end -- cgit v1.1-26-g67d0