MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / vec3

Class vec3

tests/loadtests/common/vecmath.hpp:36–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34};
35
36struct vec3 {
37 union {
38 float x;
39 float r;
40 };
41 union {
42 float y;
43 float g;
44 };
45 union {
46 float z;
47 float b;
48 };
49
50 vec3() { }
51
52 vec3(float x, float y, float z) : x(x), y(y), z(z) { }
53
54 vec3(const vec3& value)
55 : x(value.x), y(value.y), z(value.z) { }
56
57 vec3 operator-() const
58 {
59 return vec3(-x, -y, -z);
60 }
61
62 vec3 operator-(const vec3& value) const
63 {
64 return vec3(this->x - value.x, this->y - value.y, this->z - value.z);
65 }
66
67 vec3 operator/(float divisor) const
68 {
69 return vec3(x / divisor, y / divisor, z / divisor);
70 }
71
72 vec3& operator/=(float divisor)
73 {
74 x /= divisor;
75 y /= divisor;
76 z /= divisor;
77 return *this;
78 }
79
80 vec3& operator=(const vec3& value)
81 {
82 x = value.x;
83 y = value.y;
84 z = value.z;
85 return *this;
86 }
87
88 float operator[](int i) const
89 {
90 switch (i) {
91 case 0: return x;
92 case 1: return y;
93 case 2: return z;

Callers 15

operator-Method · 0.70
operator/Method · 0.70
crossMethod · 0.70
mat3Method · 0.70
transposeMethod · 0.70
lookAtMethod · 0.70
DimensionClass · 0.50
InitMeshMethod · 0.50
resizeMethod · 0.50
TextureCubemapMethod · 0.50
updateUniformBuffersMethod · 0.50
DrawTextureMethod · 0.50

Calls 2

lengthMethod · 0.95
assertFunction · 0.85

Tested by

no test coverage detected