Differences From Artifact [37363ee709]:
- File
src/OFMatrix4x4.m
— part of check-in
[975a812f36]
at
2023-02-19 13:37:44
on branch trunk
— OFMatrix4x4: Use 2D arrays in row-major format
This allows writing matrices more naturally, without having to transpose
them in the source. (user: js, size: 5526) [annotate] [blame] [check-ins using]
To Artifact [77a89afbe5]:
- File src/OFMatrix4x4.m — part of check-in [d377e8819e] at 2023-02-19 17:40:53 on branch trunk — Make GCC happy again (user: js, size: 5559) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
43 44 45 46 47 48 49 | self = [super init]; memcpy(_values, values, sizeof(_values)); return self; } | | | | > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | self = [super init]; memcpy(_values, values, sizeof(_values)); return self; } - (float (*)[4])values { return _values; } - (instancetype)copy { return [[OFMatrix4x4 alloc] initWithValues: (const float (*)[4])_values]; } - (bool)isEqual: (OFMatrix4x4 *)matrix { if (![matrix isKindOfClass: [OFMatrix4x4 class]]) return false; |
︙ | ︙ | |||
123 124 125 126 127 128 129 | left[3][2] * right[2][3] + left[3][3] * right[3][3]; #undef left } - (void)translateWithVector: (OFVector3D)vector { OFMatrix4x4 *translation = [[OFMatrix4x4 alloc] initWithValues: | | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | left[3][2] * right[2][3] + left[3][3] * right[3][3]; #undef left } - (void)translateWithVector: (OFVector3D)vector { OFMatrix4x4 *translation = [[OFMatrix4x4 alloc] initWithValues: (const float [4][4]){ { 1, 0, 0, vector.x }, { 0, 1, 0, vector.y }, { 0, 0, 1, vector.z }, { 0, 0, 0, 1 } }]; [self multiplyWithMatrix: translation]; [translation release]; } - (void)scaleWithVector: (OFVector3D)vector { OFMatrix4x4 *scale = [[OFMatrix4x4 alloc] initWithValues: (const float [4][4]){ { vector.x, 0, 0, 0 }, { 0, vector.y, 0, 0 }, { 0, 0, vector.z, 0 }, { 0, 0, 0, 1 } }]; [self multiplyWithMatrix: scale]; [scale release]; |
︙ | ︙ |