Subversion Repositories gelsvn

Rev

Rev 595 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
595 jab 1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors and DTU Informatics
4
 * For license and list of authors, see ../../doc/intro.pdf
5
 * ----------------------------------------------------------------------- */
6
 
7
/**
8
 * @file   Vec4uc.h
9
 * @brief 4D unsigned char vector
10
 */
11
 
2 bj 12
#ifndef __CGLA_VEC4UC_H__
13
#define __CGLA_VEC4UC_H__
14
 
15
#include "Vec4f.h"
16
 
17
namespace CGLA {
18
	typedef unsigned char UChar;
19
 
89 jab 20
	/** \brief 4D unsigned char vector. */
2 bj 21
	class Vec4uc: public ArithVec<UChar,Vec4uc,4>
22
	{
23
 
24
	public:
25
 
26
		/// Construct 0 vector
27
		Vec4uc() {}
28
 
29
		/// Construct 0 vector
30
		Vec4uc(unsigned char a): ArithVec<UChar,Vec4uc,4>(a,a,a,a) {}
31
 
32
		/// Construct 4D uchar vector
33
		Vec4uc(UChar _a, UChar _b, UChar _c,UChar _d): 
34
			ArithVec<UChar,Vec4uc,4>(_a,_b,_c,_d) {}
35
 
36
		/// Convert from float vector. 
37
		explicit Vec4uc(const Vec4f& v): 
38
			ArithVec<UChar,Vec4uc,4>(UChar(v[0]), UChar(v[1]), 
39
															 UChar(v[2]), UChar(v[3])) {}
40
 
41
		operator Vec4f() const
42
		{
43
			return  Vec4f((*this)[0],(*this)[1],(*this)[2],(*this)[3]);
44
		}
45
 
46
	};
47
 
48
 
49
}
50
#endif
51