File: reference-libobs-graphics-vec4.rst

package info (click to toggle)
obs-studio 30.2.3%2Bdfsg-3.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,928 kB
  • sloc: ansic: 202,137; cpp: 112,403; makefile: 868; python: 599; sh: 275; javascript: 19
file content (282 lines) | stat: -rw-r--r-- 6,125 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
4-Component Vector
==================

.. code:: cpp

   #include <graphics/vec4.h>

.. struct:: vec4

   Two component vector structure.

.. member:: float vec4.x

   X component

.. member:: float vec4.y

   Y component

.. member:: float vec4.z

   Z component

.. member:: float vec4.w

   W component

.. member:: float vec4.ptr[4]

   Unioned array of all components

---------------------

.. function:: void vec4_zero(struct vec4 *dst)

   Zeroes a vector

   :param dst: Destination

---------------------

.. function:: void vec4_set(struct vec4 *dst, float x, float y, float z, float w)

   Sets the individual components of a 4-component vector.

   :param dst: Destination
   :param x:   X component
   :param y:   Y component
   :param z:   Z component
   :param w:   W component

---------------------

.. function:: void vec4_copy(struct vec4 *dst, const struct vec4 *v)

   Copies a vector

   :param dst: Destination
   :param v:   Vector to copy

---------------------

.. function:: void vec4_from_vec3(struct vec4 *dst, const struct vec3 *v)

   Creates a 4-component vector from a 3-component vector

   :param dst: 4-component vector destination
   :param v:   3-component vector

---------------------

.. function:: void vec4_add(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)

   Adds two vectors

   :param dst: Destination
   :param v1:  Vector 1
   :param v2:  Vector 2

---------------------

.. function:: void vec4_sub(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)

   Subtracts two vectors

   :param dst: Destination
   :param v1:  Vector being subtracted from
   :param v2:  Vector being subtracted

---------------------

.. function:: void vec4_mul(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)

   Multiplies two vectors

   :param dst: Destination
   :param v1:  Vector 1
   :param v2:  Vector 2

---------------------

.. function:: void vec4_div(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)

   Divides two vectors

   :param dst: Destination
   :param v1:  Dividend
   :param v2:  Divisor

---------------------

.. function:: void vec4_addf(struct vec4 *dst, const struct vec4 *v, float f)

   Adds a floating point to all components

   :param dst: Destination
   :param dst: Vector
   :param f:   Floating point

---------------------

.. function:: void vec4_subf(struct vec4 *dst, const struct vec4 *v, float f)

   Subtracts a floating point from all components

   :param dst: Destination
   :param v:   Vector being subtracted from
   :param f:   Floating point being subtracted

---------------------

.. function:: void vec4_mulf(struct vec4 *dst, const struct vec4 *v, float f)

   Multiplies a floating point with all components

   :param dst: Destination
   :param dst: Vector
   :param f:   Floating point

---------------------

.. function:: void vec4_divf(struct vec4 *dst, const struct vec4 *v, float f)

   Divides a floating point from all components

   :param dst: Destination
   :param v:   Vector (dividend)
   :param f:   Floating point (divisor)

---------------------

.. function:: void vec4_neg(struct vec4 *dst, const struct vec4 *v)

   Negates a vector

   :param dst: Destination
   :param v:   Vector to negate

---------------------

.. function:: float vec4_dot(const struct vec4 *v1, const struct vec4 *v2)

   Performs a dot product between two vectors

   :param v1: Vector 1
   :param v2: Vector 2
   :return:   Result of the dot product

---------------------

.. function:: float vec4_len(const struct vec4 *v)

   Gets the length of a vector

   :param v: Vector
   :return:  The vector's length

---------------------

.. function:: float vec4_dist(const struct vec4 *v1, const struct vec4 *v2)

   Gets the distance between two vectors

   :param v1: Vector 1
   :param v2: Vector 2
   :return:   Distance between the two vectors

---------------------

.. function:: void vec4_minf(struct vec4 *dst, const struct vec4 *v, float val)

   Gets the minimum values between a vector's components and a floating point

   :param dst: Destination
   :param v:   Vector
   :param val: Floating point

---------------------

.. function:: void vec4_min(struct vec4 *dst, const struct vec4 *v, const struct vec4 *min_v)

   Gets the minimum values between two vectors

   :param dst:   Destination
   :param v:     Vector 1
   :param min_v: Vector 2

---------------------

.. function:: void vec4_maxf(struct vec4 *dst, const struct vec4 *v, float val)

   Gets the maximum values between a vector's components and a floating point

   :param dst: Destination
   :param v:   Vector
   :param val: Floating point

---------------------

.. function:: void vec4_max(struct vec4 *dst, const struct vec4 *v, const struct vec4 *max_v)

   Gets the maximum values between two vectors

   :param dst:   Destination
   :param v:     Vector 1
   :param max_v: Vector 2

---------------------

.. function:: void vec4_abs(struct vec4 *dst, const struct vec4 *v)

   Gets the absolute values of each component

   :param dst: Destination
   :param v:   Vector

---------------------

.. function:: void vec4_floor(struct vec4 *dst, const struct vec4 *v)

   Gets the floor values of each component

   :param dst: Destination
   :param v:   Vector

---------------------

.. function:: void vec4_ceil(struct vec4 *dst, const struct vec4 *v)

   Gets the ceiling values of each component

   :param dst: Destination
   :param v:   Vector

---------------------

.. function:: int vec4_close(const struct vec4 *v1, const struct vec4 *v2, float epsilon)

   Compares two vectors

   :param v1:      Vector 1
   :param v2:      Vector 2
   :param epsilon: Maximum precision for comparison

---------------------

.. function:: void vec4_norm(struct vec4 *dst, const struct vec4 *v)

   Normalizes a vector

   :param dst: Destination
   :param v:   Vector to normalize

---------------------

.. function:: void vec4_transform(struct vec4 *dst, const struct vec4 *v, const struct matrix4 *m)

   Transforms a vector

   :param dst: Destination
   :param v:   Vector
   :param m:   Matrix