Skip to content

Commit

Permalink
added Mat4 Mat3 CpoyFrom methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Randall C. O'Reilly committed May 16, 2020
1 parent f305cac commit ef9e6ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions matrix3.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ func (m *Mat3) SetZero() {
)
}

// CopyFrom copies from source matrix into this matrix
// (a regular = assign does not copy data, just the pointer!)
func (m *Mat3) CopyFrom(src *Mat3) {
copy(m[:], src[:])
}

// MulMatrices sets ths matrix as matrix multiplication a by b (i.e., b*a).
func (m *Mat3) MulMatrices(a, b *Mat3) {
a11 := a[0]
Expand Down
6 changes: 6 additions & 0 deletions matrix4.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ func (m *Mat4) SetZero() {
)
}

// CopyFrom copies from source matrix into this matrix
// (a regular = assign does not copy data, just the pointer!)
func (m *Mat4) CopyFrom(src *Mat4) {
copy(m[:], src[:])
}

// CopyPos copies the position elements of the src matrix into this one.
func (m *Mat4) CopyPos(src *Mat4) {
m[12] = src[12]
Expand Down

0 comments on commit ef9e6ec

Please sign in to comment.