Home | History | Annotate | Download | only in detail
      1 ///////////////////////////////////////////////////////////////////////////////////
      2 /// OpenGL Mathematics (glm.g-truc.net)
      3 ///
      4 /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
      5 /// Permission is hereby granted, free of charge, to any person obtaining a copy
      6 /// of this software and associated documentation files (the "Software"), to deal
      7 /// in the Software without restriction, including without limitation the rights
      8 /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      9 /// copies of the Software, and to permit persons to whom the Software is
     10 /// furnished to do so, subject to the following conditions:
     11 /// 
     12 /// The above copyright notice and this permission notice shall be included in
     13 /// all copies or substantial portions of the Software.
     14 /// 
     15 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     18 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     21 /// THE SOFTWARE.
     22 ///
     23 /// @ref core
     24 /// @file glm/core/type_tvec3.inl
     25 /// @date 2008-08-22 / 2011-06-15
     26 /// @author Christophe Riccio
     27 ///////////////////////////////////////////////////////////////////////////////////
     28 
     29 namespace glm{
     30 namespace detail
     31 {
     32 	template <typename T, precision P>
     33 	GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec3<T, P>::length() const
     34 	{
     35 		return 3;
     36 	}
     37 
     38 	//////////////////////////////////////
     39 	// Accesses
     40 
     41 	template <typename T, precision P>
     42 	GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](length_t i)
     43 	{
     44 		assert(i >= 0 && i < this->length());
     45 		return (&x)[i];
     46 	}
     47 
     48 	template <typename T, precision P>
     49 	GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](length_t i) const
     50 	{
     51 		assert(i >= 0 && i < this->length());
     52 		return (&x)[i];
     53 	}
     54 
     55 	//////////////////////////////////////
     56 	// Implicit basic constructors
     57 
     58 	template <typename T, precision P>
     59 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3() :
     60 		x(0),
     61 		y(0),
     62 		z(0)
     63 	{}
     64 
     65 	template <typename T, precision P>
     66 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec3<T, P> const & v) :
     67 		x(v.x),
     68 		y(v.y),
     69 		z(v.z)
     70 	{}
     71 
     72 	template <typename T, precision P>
     73 	template <precision Q>
     74 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec3<T, Q> const & v) :
     75 		x(v.x),
     76 		y(v.y),
     77 		z(v.z)
     78 	{}
     79 
     80 	//////////////////////////////////////
     81 	// Explicit basic constructors
     82 
     83 	template <typename T, precision P>
     84 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(ctor)
     85 	{}
     86 
     87 	template <typename T, precision P>
     88 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(T const & s) :
     89 		x(s),
     90 		y(s),
     91 		z(s)
     92 	{}
     93 
     94 	template <typename T, precision P>
     95 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
     96 	(
     97 		T const & s0,
     98 		T const & s1,
     99 		T const & s2
    100 	) :
    101 		x(s0),
    102 		y(s1),
    103 		z(s2)
    104 	{}
    105 
    106 	//////////////////////////////////////
    107 	// Conversion scalar constructors
    108 
    109 	template <typename T, precision P>
    110 	template <typename A, typename B, typename C>
    111 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
    112 	(
    113 		A const & x,
    114 		B const & y,
    115 		C const & z
    116 	) :
    117 		x(static_cast<T>(x)),
    118 		y(static_cast<T>(y)),
    119 		z(static_cast<T>(z))
    120 	{}
    121 
    122 	//////////////////////////////////////
    123 	// Conversion vector constructors
    124 
    125 	template <typename T, precision P>
    126 	template <typename A, typename B, precision Q>
    127 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
    128 	(
    129 		tvec2<A, Q> const & v,
    130 		B const & s
    131 	) :
    132 		x(static_cast<T>(v.x)),
    133 		y(static_cast<T>(v.y)),
    134 		z(static_cast<T>(s))
    135 	{}
    136 
    137 	template <typename T, precision P>
    138 	template <typename A, typename B, precision Q>
    139 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
    140 	(	
    141 		A const & s,
    142 		tvec2<B, Q> const & v
    143 	) :
    144 		x(static_cast<T>(s)),
    145 		y(static_cast<T>(v.x)),
    146 		z(static_cast<T>(v.y))
    147 	{}
    148 
    149 	template <typename T, precision P>
    150 	template <typename U, precision Q>
    151 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
    152 	(
    153 		tvec3<U, Q> const & v
    154 	) :
    155 		x(static_cast<T>(v.x)),
    156 		y(static_cast<T>(v.y)),
    157 		z(static_cast<T>(v.z))
    158 	{}
    159 
    160 	template <typename T, precision P>
    161 	template <typename U, precision Q>
    162 	GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
    163 	(
    164 		tvec4<U, Q> const & v
    165 	) :
    166 		x(static_cast<T>(v.x)),
    167 		y(static_cast<T>(v.y)),
    168 		z(static_cast<T>(v.z))
    169 	{}
    170 
    171 	//////////////////////////////////////
    172 	// Unary arithmetic operators
    173 
    174 	template <typename T, precision P>
    175 	GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator= (tvec3<T, P> const & v)
    176 	{
    177 		this->x = v.x;
    178 		this->y = v.y;
    179 		this->z = v.z;
    180 		return *this;
    181 	}
    182 
    183 	template <typename T, precision P>
    184 	template <typename U>
    185 	GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator= (tvec3<U, P> const & v)
    186 	{
    187 		this->x = static_cast<T>(v.x);
    188 		this->y = static_cast<T>(v.y);
    189 		this->z = static_cast<T>(v.z);
    190 		return *this;
    191 	}
    192 
    193 	template <typename T, precision P>
    194 	template <typename U>
    195 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+= (U s)
    196 	{
    197 		this->x += static_cast<T>(s);
    198 		this->y += static_cast<T>(s);
    199 		this->z += static_cast<T>(s);
    200 		return *this;
    201 	}
    202 
    203 	template <typename T, precision P>
    204 	template <typename U>
    205 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+= (tvec3<U, P> const & v)
    206 	{
    207 		this->x += static_cast<T>(v.x);
    208 		this->y += static_cast<T>(v.y);
    209 		this->z += static_cast<T>(v.z);
    210 		return *this;
    211 	}
    212 
    213 	template <typename T, precision P>
    214 	template <typename U>
    215 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-= (U s)
    216 	{
    217 		this->x -= static_cast<T>(s);
    218 		this->y -= static_cast<T>(s);
    219 		this->z -= static_cast<T>(s);
    220 		return *this;
    221 	}
    222 
    223 	template <typename T, precision P>
    224 	template <typename U>
    225 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-= (tvec3<U, P> const & v)
    226 	{
    227 		this->x -= static_cast<T>(v.x);
    228 		this->y -= static_cast<T>(v.y);
    229 		this->z -= static_cast<T>(v.z);
    230 		return *this;
    231 	}
    232 
    233 	template <typename T, precision P>
    234 	template <typename U>
    235 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*= (U s)
    236 	{
    237 		this->x *= static_cast<T>(s);
    238 		this->y *= static_cast<T>(s);
    239 		this->z *= static_cast<T>(s);
    240 		return *this;
    241 	}
    242 
    243 	template <typename T, precision P>
    244 	template <typename U>
    245 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*= (tvec3<U, P> const & v)
    246 	{
    247 		this->x *= static_cast<T>(v.x);
    248 		this->y *= static_cast<T>(v.y);
    249 		this->z *= static_cast<T>(v.z);
    250 		return *this;
    251 	}
    252 
    253 	template <typename T, precision P>
    254 	template <typename U>
    255 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/= (U s)
    256 	{
    257 		this->x /= static_cast<T>(s);
    258 		this->y /= static_cast<T>(s);
    259 		this->z /= static_cast<T>(s);
    260 		return *this;
    261 	}
    262 
    263 	template <typename T, precision P>
    264 	template <typename U>
    265 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/= (tvec3<U, P> const & v)
    266 	{
    267 		this->x /= static_cast<T>(v.x);
    268 		this->y /= static_cast<T>(v.y);
    269 		this->z /= static_cast<T>(v.z);
    270 		return *this;
    271 	}
    272 
    273 	//////////////////////////////////////
    274 	// Increment and decrement operators
    275 
    276 	template <typename T, precision P>
    277 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator++()
    278 	{
    279 		++this->x;
    280 		++this->y;
    281 		++this->z;
    282 		return *this;
    283 	}
    284 
    285 	template <typename T, precision P>
    286 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator--()
    287 	{
    288 		--this->x;
    289 		--this->y;
    290 		--this->z;
    291 		return *this;
    292 	}
    293 
    294 	template <typename T, precision P> 
    295 	GLM_FUNC_QUALIFIER tvec3<T, P> tvec3<T, P>::operator++(int)
    296 	{
    297 		tvec3<T, P> Result(*this);
    298 		++*this;
    299 		return Result;
    300 	}
    301 
    302 	template <typename T, precision P> 
    303 	GLM_FUNC_QUALIFIER tvec3<T, P> tvec3<T, P>::operator--(int)
    304 	{
    305 		tvec3<T, P> Result(*this);
    306 		--*this;
    307 		return Result;
    308 	}
    309 
    310 	//////////////////////////////////////
    311 	// Boolean operators
    312 
    313 	template <typename T, precision P>
    314 	GLM_FUNC_QUALIFIER bool operator==
    315 	(
    316 		tvec3<T, P> const & v1,
    317 		tvec3<T, P> const & v2
    318 	)
    319 	{
    320 		return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z);
    321 	}
    322 
    323 	template <typename T, precision P>
    324 	GLM_FUNC_QUALIFIER bool operator!=
    325 	(
    326 		tvec3<T, P> const & v1,
    327 		tvec3<T, P> const & v2
    328 	)
    329 	{
    330 		return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z);
    331 	}
    332 
    333 	//////////////////////////////////////
    334 	// Unary bit operators
    335 
    336 	template <typename T, precision P>
    337 	template <typename U>
    338 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%= (U s)
    339 	{
    340 		this->x %= s;
    341 		this->y %= s;
    342 		this->z %= s;
    343 		return *this;
    344 	}
    345 
    346 	template <typename T, precision P>
    347 	template <typename U>
    348 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%= (tvec3<U, P> const & v)
    349 	{
    350 		this->x %= v.x;
    351 		this->y %= v.y;
    352 		this->z %= v.z;
    353 		return *this;
    354 	}
    355 
    356 	template <typename T, precision P>
    357 	template <typename U>
    358 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&= (U s)
    359 	{
    360 		this->x &= s;
    361 		this->y &= s;
    362 		this->z &= s;
    363 		return *this;
    364 	}
    365 
    366 	template <typename T, precision P>
    367 	template <typename U>
    368 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&= (tvec3<U, P> const & v)
    369 	{
    370 		this->x &= v.x;
    371 		this->y &= v.y;
    372 		this->z &= v.z;
    373 		return *this;
    374 	}
    375 
    376 	template <typename T, precision P>
    377 	template <typename U>
    378 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|= (U s)
    379 	{
    380 		this->x |= s;
    381 		this->y |= s;
    382 		this->z |= s;
    383 		return *this;
    384 	}
    385 
    386 	template <typename T, precision P>
    387 	template <typename U> 
    388 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|= (tvec3<U, P> const & v)
    389 	{
    390 		this->x |= v.x;
    391 		this->y |= v.y;
    392 		this->z |= v.z;
    393 		return *this;
    394 	}
    395 
    396 	template <typename T, precision P>
    397 	template <typename U> 
    398 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^= (U s)
    399 	{
    400 		this->x ^= s;
    401 		this->y ^= s;
    402 		this->z ^= s;
    403 		return *this;
    404 	}
    405 
    406 	template <typename T, precision P>
    407 	template <typename U> 
    408 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^= (tvec3<U, P> const & v)
    409 	{
    410 		this->x ^= v.x;
    411 		this->y ^= v.y;
    412 		this->z ^= v.z;
    413 		return *this;
    414 	}
    415 
    416 	template <typename T, precision P>
    417 	template <typename U> 
    418 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<= (U s)
    419 	{
    420 		this->x <<= s;
    421 		this->y <<= s;
    422 		this->z <<= s;
    423 		return *this;
    424 	}
    425 
    426 	template <typename T, precision P>
    427 	template <typename U> 
    428 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<= (tvec3<U, P> const & v)
    429 	{
    430 		this->x <<= static_cast<T>(v.x);
    431 		this->y <<= static_cast<T>(v.y);
    432 		this->z <<= static_cast<T>(v.z);
    433 		return *this;
    434 	}
    435 
    436 	template <typename T, precision P>
    437 	template <typename U> 
    438 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>= (U s)
    439 	{
    440 		this->x >>= static_cast<T>(s);
    441 		this->y >>= static_cast<T>(s);
    442 		this->z >>= static_cast<T>(s);
    443 		return *this;
    444 	}
    445 
    446 	template <typename T, precision P>
    447 	template <typename U> 
    448 	GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>= (tvec3<U, P> const & v)
    449 	{
    450 		this->x >>= static_cast<T>(v.x);
    451 		this->y >>= static_cast<T>(v.y);
    452 		this->z >>= static_cast<T>(v.z);
    453 		return *this;
    454 	}
    455 
    456 	//////////////////////////////////////
    457 	// Binary arithmetic operators
    458 
    459 	template <typename T, precision P> 
    460 	GLM_FUNC_QUALIFIER tvec3<T, P> operator+
    461 	(
    462 		tvec3<T, P> const & v, 
    463 		T const & s
    464 	)
    465 	{
    466 		return tvec3<T, P>(
    467 			v.x + s,
    468 			v.y + s,
    469 			v.z + s);
    470 	}
    471 
    472 	template <typename T, precision P> 
    473 	GLM_FUNC_QUALIFIER tvec3<T, P> operator+ 
    474 	(
    475 		T const & s, 
    476 		tvec3<T, P> const & v
    477 	)
    478 	{
    479 		return tvec3<T, P>(
    480 			s + v.x,
    481 			s + v.y,
    482 			s + v.z);
    483 	}
    484 
    485 	template <typename T, precision P> 
    486 	GLM_FUNC_QUALIFIER tvec3<T, P> operator+ 
    487 	(
    488 		tvec3<T, P> const & v1, 
    489 		tvec3<T, P> const & v2
    490 	)
    491 	{
    492 		return tvec3<T, P>(
    493 			v1.x + v2.x,
    494 			v1.y + v2.y,
    495 			v1.z + v2.z);
    496 	}
    497 
    498 	//operator-
    499 	template <typename T, precision P> 
    500 	GLM_FUNC_QUALIFIER tvec3<T, P> operator- 
    501 	(
    502 		tvec3<T, P> const & v, 
    503 		T const & s
    504 	)
    505 	{
    506 		return tvec3<T, P>(
    507 			v.x - s,
    508 			v.y - s,
    509 			v.z - s);
    510 	}
    511 
    512 	template <typename T, precision P> 
    513 	GLM_FUNC_QUALIFIER tvec3<T, P> operator- 
    514 	(
    515 		T const & s, 
    516 		tvec3<T, P> const & v
    517 	)
    518 	{
    519 		return tvec3<T, P>(
    520 			s - v.x,
    521 			s - v.y,
    522 			s - v.z);
    523 	}
    524 
    525 	template <typename T, precision P> 
    526 	GLM_FUNC_QUALIFIER tvec3<T, P> operator- 
    527 	(
    528 		tvec3<T, P> const & v1, 
    529 		tvec3<T, P> const & v2
    530 	)
    531 	{
    532 		return tvec3<T, P>(
    533 			v1.x - v2.x,
    534 			v1.y - v2.y,
    535 			v1.z - v2.z);
    536 	}
    537 
    538 	//operator*
    539 	template <typename T, precision P> 
    540 	GLM_FUNC_QUALIFIER tvec3<T, P> operator*
    541 	(
    542 		tvec3<T, P> const & v, 
    543 		T const & s
    544 	)
    545 	{
    546 		return tvec3<T, P>(
    547 			v.x * s,
    548 			v.y * s,
    549 			v.z * s);
    550 	}
    551 
    552 	template <typename T, precision P> 
    553 	GLM_FUNC_QUALIFIER tvec3<T, P> operator* 
    554 	(
    555 		T const & s, 
    556 		tvec3<T, P> const & v
    557 	)
    558 	{
    559 		return tvec3<T, P>(
    560 			s * v.x,
    561 			s * v.y,
    562 			s * v.z);
    563 	}
    564 
    565 	template <typename T, precision P> 
    566 	GLM_FUNC_QUALIFIER tvec3<T, P> operator* 
    567 	(
    568 		tvec3<T, P> const & v1, 
    569 		tvec3<T, P> const & v2
    570 	)
    571 	{
    572 		return tvec3<T, P>(
    573 			v1.x * v2.x,
    574 			v1.y * v2.y,
    575 			v1.z * v2.z);
    576 	}
    577 
    578 	//operator/
    579 	template <typename T, precision P> 
    580 	GLM_FUNC_QUALIFIER tvec3<T, P> operator/
    581 	(
    582 		tvec3<T, P> const & v, 
    583 		T const & s
    584 	)
    585 	{
    586 		return tvec3<T, P>(
    587 			v.x / s,
    588 			v.y / s,
    589 			v.z / s);
    590 	}
    591 
    592 	template <typename T, precision P> 
    593 	GLM_FUNC_QUALIFIER tvec3<T, P> operator/ 
    594 	(
    595 		T const & s, 
    596 		tvec3<T, P> const & v
    597 	)
    598 	{
    599 		return tvec3<T, P>(
    600 			s / v.x,
    601 			s / v.y,
    602 			s / v.z);
    603 	}
    604 
    605 	template <typename T, precision P> 
    606 	GLM_FUNC_QUALIFIER tvec3<T, P> operator/ 
    607 	(
    608 		tvec3<T, P> const & v1, 
    609 		tvec3<T, P> const & v2
    610 	)
    611 	{
    612 		return tvec3<T, P>(
    613 			v1.x / v2.x,
    614 			v1.y / v2.y,
    615 			v1.z / v2.z);
    616 	}
    617 
    618 	// Unary constant operators
    619 	template <typename T, precision P> 
    620 	GLM_FUNC_QUALIFIER tvec3<T, P> operator- 
    621 	(
    622 		tvec3<T, P> const & v
    623 	)
    624 	{
    625 		return tvec3<T, P>(
    626 			-v.x, 
    627 			-v.y, 
    628 			-v.z);
    629 	}
    630 
    631 	//////////////////////////////////////
    632 	// Binary bit operators
    633 
    634 	template <typename T, precision P>
    635 	GLM_FUNC_QUALIFIER tvec3<T, P> operator% 
    636 	(
    637 		tvec3<T, P> const & v, 
    638 		T const & s
    639 	)
    640 	{
    641 		return tvec3<T, P>(
    642 			v.x % s,
    643 			v.y % s,
    644 			v.z % s);
    645 	}
    646 
    647 	template <typename T, precision P>
    648 	GLM_FUNC_QUALIFIER tvec3<T, P> operator%
    649 	(
    650 		T const & s, 
    651 		tvec3<T, P> const & v
    652 	)
    653 	{
    654 		return tvec3<T, P>(
    655 			s % v.x,
    656 			s % v.y,
    657 			s % v.z);
    658 	}
    659 
    660 	template <typename T, precision P>
    661 	GLM_FUNC_QUALIFIER tvec3<T, P> operator% 
    662 	(
    663 		tvec3<T, P> const & v1, 
    664 		tvec3<T, P> const & v2
    665 	)
    666 	{
    667 		return tvec3<T, P>(
    668 			v1.x % v2.x,
    669 			v1.y % v2.y,
    670 			v1.z % v2.z);
    671 	}
    672 
    673 	template <typename T, precision P>
    674 	GLM_FUNC_QUALIFIER tvec3<T, P> operator& 
    675 	(
    676 		tvec3<T, P> const & v, 
    677 		T const & s
    678 	)
    679 	{
    680 		return tvec3<T, P>(
    681 			v.x & s,
    682 			v.y & s,
    683 			v.z & s);
    684 	}
    685 
    686 	template <typename T, precision P>
    687 	GLM_FUNC_QUALIFIER tvec3<T, P> operator& 
    688 	(
    689 		T const & s, 
    690 		tvec3<T, P> const & v
    691 	)
    692 	{
    693 		return tvec3<T, P>(
    694 			s & v.x,
    695 			s & v.y,
    696 			s & v.z);
    697 	}
    698 
    699 	template <typename T, precision P>
    700 	GLM_FUNC_QUALIFIER tvec3<T, P> operator& 
    701 	(
    702 		tvec3<T, P> const & v1, 
    703 		tvec3<T, P> const & v2
    704 	)
    705 	{
    706 		return tvec3<T, P>(
    707 			v1.x & v2.x,
    708 			v1.y & v2.y,
    709 			v1.z & v2.z);
    710 	}
    711 
    712 	template <typename T, precision P>
    713 	GLM_FUNC_QUALIFIER tvec3<T, P> operator| 
    714 	(
    715 		tvec3<T, P> const & v, 
    716 		T const & s
    717 	)
    718 	{
    719 		return tvec3<T, P>(
    720 			v.x | s,
    721 			v.y | s,
    722 			v.z | s);
    723 	}
    724 
    725 	template <typename T, precision P>
    726 	GLM_FUNC_QUALIFIER tvec3<T, P> operator| 
    727 	(
    728 		T const & s, 
    729 		tvec3<T, P> const & v
    730 	)
    731 	{
    732 		return tvec3<T, P>(
    733 			s | v.x,
    734 			s | v.y,
    735 			s | v.z);
    736 	}
    737 
    738 	template <typename T, precision P>
    739 	GLM_FUNC_QUALIFIER tvec3<T, P> operator| 
    740 	(
    741 		tvec3<T, P> const & v1, 
    742 		tvec3<T, P> const & v2
    743 	)
    744 	{
    745 		return tvec3<T, P>(
    746 			v1.x | v2.x,
    747 			v1.y | v2.y,
    748 			v1.z | v2.z);
    749 	}
    750 		
    751 	template <typename T, precision P>
    752 	GLM_FUNC_QUALIFIER tvec3<T, P> operator^ 
    753 	(
    754 		tvec3<T, P> const & v, 
    755 		T const & s
    756 	)
    757 	{
    758 		return tvec3<T, P>(
    759 			v.x ^ s,
    760 			v.y ^ s,
    761 			v.z ^ s);
    762 	}
    763 
    764 	template <typename T, precision P>
    765 	GLM_FUNC_QUALIFIER tvec3<T, P> operator^ 
    766 	(
    767 		T const & s, 
    768 		tvec3<T, P> const & v
    769 	)
    770 	{
    771 		return tvec3<T, P>(
    772 			T(s) ^ v.x,
    773 			T(s) ^ v.y,
    774 			T(s) ^ v.z);
    775 	}
    776 
    777 	template <typename T, precision P>
    778 	GLM_FUNC_QUALIFIER tvec3<T, P> operator^ 
    779 	(
    780 		tvec3<T, P> const & v1, 
    781 		tvec3<T, P> const & v2
    782 	)
    783 	{
    784 		return tvec3<T, P>(
    785 			v1.x ^ T(v2.x),
    786 			v1.y ^ T(v2.y),
    787 			v1.z ^ T(v2.z));
    788 	}
    789 
    790 	template <typename T, precision P>
    791 	GLM_FUNC_QUALIFIER tvec3<T, P> operator<< 
    792 	(
    793 		tvec3<T, P> const & v, 
    794 		T const & s
    795 	)
    796 	{
    797 		return tvec3<T, P>(
    798 			v.x << T(s),
    799 			v.y << T(s),
    800 			v.z << T(s));
    801 	}
    802 
    803 	template <typename T, precision P>
    804 	GLM_FUNC_QUALIFIER tvec3<T, P> operator<< 
    805 	(
    806 		T const & s, 
    807 		tvec3<T, P> const & v
    808 	)
    809 	{
    810 		return tvec3<T, P>(
    811 			T(s) << v.x,
    812 			T(s) << v.y,
    813 			T(s) << v.z);
    814 	}
    815 
    816 	template <typename T, precision P>
    817 	GLM_FUNC_QUALIFIER tvec3<T, P> operator<< 
    818 	(
    819 		tvec3<T, P> const & v1, 
    820 		tvec3<T, P> const & v2
    821 	)
    822 	{
    823 		return tvec3<T, P>(
    824 			v1.x << T(v2.x),
    825 			v1.y << T(v2.y),
    826 			v1.z << T(v2.z));
    827 	}
    828 
    829 	template <typename T, precision P>
    830 	GLM_FUNC_QUALIFIER tvec3<T, P> operator>> 
    831 	(
    832 		tvec3<T, P> const & v, 
    833 		T const & s
    834 	)
    835 	{
    836 		return tvec3<T, P>(
    837 			v.x >> T(s),
    838 			v.y >> T(s),
    839 			v.z >> T(s));
    840 	}
    841 
    842 	template <typename T, precision P>
    843 	GLM_FUNC_QUALIFIER tvec3<T, P> operator>> 
    844 	(
    845 		T const & s, 
    846 		tvec3<T, P> const & v
    847 	)
    848 	{
    849 		return tvec3<T, P>(
    850 			s >> T(v.x),
    851 			s >> T(v.y),
    852 			s >> T(v.z));
    853 	}
    854 
    855 	template <typename T, precision P>
    856 	GLM_FUNC_QUALIFIER tvec3<T, P> operator>> 
    857 	(
    858 		tvec3<T, P> const & v1, 
    859 		tvec3<T, P> const & v2
    860 	)
    861 	{
    862 		return tvec3<T, P>(
    863 			v1.x >> T(v2.x),
    864 			v1.y >> T(v2.y),
    865 			v1.z >> T(v2.z));
    866 	}
    867 
    868 	template <typename T, precision P> 
    869 	GLM_FUNC_QUALIFIER tvec3<T, P> operator~ 
    870 	(
    871 		tvec3<T, P> const & v
    872 	)
    873 	{
    874 		return tvec3<T, P>(
    875 			~v.x,
    876 			~v.y,
    877 			~v.z);
    878 	}
    879 
    880 }//namespace detail
    881 }//namespace glm
    882