MIX(3G)

๐Ÿ“ฆ
version 1.0~svn33624 ยท 4 versions
, in ubuntu jammy, ubuntu noble

๐Ÿ’– NAME ๐Ÿ’–

okay so bestie, welcome to mix โ€” she linearly interpolates between two values. that's it. that's the whole gig. โœจ

she lives in section 3G of the manual, so if you ever need to cite her, it's MIX(3G). ๐ŸŽ€


๐ŸŒธ DECLARATION ๐ŸŒธ

here's every single flavor she comes in, no skips, no cuts, all nine of them:

genType mix(genType x, genType y, genType a);

genType mix(genType x, genType y, float a);

genDType mix(genDType x, genDType y, genDType a);

genDType mix(genDType x, genDType y, double a);

genType mix(genType x, genType y, genBType a);

genDType mix(genDType x, genDType y, genBType a);

genIType mix(genIType x, genIType y, genBType a);

genUType mix(genUType x, genUType y, genBType a);

genBType mix(genBType x, genBType y, genBType a);

like yes she has range ๐Ÿ’…


๐Ÿซถ PARAMETERS ๐Ÿซถ

  • x โ€” the start of the range you're interpolating inside. where the journey begins, lowkey.
  • y โ€” the end of that range. the destination, the finale, the other end of the vibe. ๐ŸŒˆ
  • a โ€” the value you use to interpolate between x and y. she's the weight, she's the deciding factor, she's giving main character energy ngl.

โœจ DESCRIPTION โœจ

so mix does a linear interpolation between x and y, using a to weight between them. the return value is computed as:

$x \times (1 - a) + y \times a$

periodt. that's the math, that's the formula, don't come for me. ๐Ÿงฎ๐Ÿ’–

now here's the fun part โ€” the variants of mix where a is genBType select which vector each returned component comes from:

  • if a component of a is false, the corresponding component of x is returned.
  • if a component of a is true, the corresponding component of y is returned.

and the tea โ˜•: components of x and y that are not selected are allowed to be invalid floating-point values, and they will have no effect on the results. so like, they're just there, existing, unbothered, not influencing anything. iconic honestly. ๐Ÿ’€โœจ


๐Ÿ‘‘ VERSION SUPPORT ๐Ÿ‘‘

here's the whole glow-up timeline, every OpenGL Shading Language version, all spelled out (the original ships this as a table and i am NOT about to make you squint at box-drawing characters, so here it is as a list ๐ŸŽ€):

  • mix(genType) โ€” slaying since 1.10. โœ” in 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, and 4.50. she was there from day one, no cap.
  • mix(genDType) โ€” not invited until later. - in 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, and 4.00... wait, scratch that, she arrives at 4.00 โ€” โœ” in 4.00, 4.10, 4.20, 4.30, 4.40, and 4.50, and - in everything before 4.00 (1.10, 1.20, 1.30, 1.40, 1.50, 3.30). ๐Ÿฆ‹
  • mix(genIType), mix(genUType), mix(genBType) โ€” the late bloomers fr fr. - in 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, and 4.40. then โœ” in 4.50 only. they waited SO long and then showed up flawless. ๐Ÿ’…

๐ŸŒŸ SEE ALSO ๐ŸŒŸ

go say hi to her besties:

  • min()
  • max()

Copyright ยฉ 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

Copyright ยฉ 2011-2014 Khronos Group


and that's the whole page, bestie ๐Ÿซถ this one came from [FIXME: source] and she's dated 01/03/2018, filed under MIX(3G) โ€” go forth and interpolate responsibly, mwah ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from