Subversion Repositories gelsvn

Rev

Rev 89 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89 Rev 595
-
 
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
 
1
#ifndef __CGLA_VEC4UC_H__
12
#ifndef __CGLA_VEC4UC_H__
2
#define __CGLA_VEC4UC_H__
13
#define __CGLA_VEC4UC_H__
3
 
14
 
4
#include "Vec4f.h"
15
#include "Vec4f.h"
5
 
16
 
6
namespace CGLA {
17
namespace CGLA {
7
	typedef unsigned char UChar;
18
	typedef unsigned char UChar;
8
 
19
 
9
	/** \brief 4D unsigned char vector. */
20
	/** \brief 4D unsigned char vector. */
10
	class Vec4uc: public ArithVec<UChar,Vec4uc,4>
21
	class Vec4uc: public ArithVec<UChar,Vec4uc,4>
11
	{
22
	{
12
 
23
 
13
	public:
24
	public:
14
		
25
		
15
		/// Construct 0 vector
26
		/// Construct 0 vector
16
		Vec4uc() {}
27
		Vec4uc() {}
17
 
28
 
18
		/// Construct 0 vector
29
		/// Construct 0 vector
19
		Vec4uc(unsigned char a): ArithVec<UChar,Vec4uc,4>(a,a,a,a) {}
30
		Vec4uc(unsigned char a): ArithVec<UChar,Vec4uc,4>(a,a,a,a) {}
20
 
31
 
21
		/// Construct 4D uchar vector
32
		/// Construct 4D uchar vector
22
		Vec4uc(UChar _a, UChar _b, UChar _c,UChar _d): 
33
		Vec4uc(UChar _a, UChar _b, UChar _c,UChar _d): 
23
			ArithVec<UChar,Vec4uc,4>(_a,_b,_c,_d) {}
34
			ArithVec<UChar,Vec4uc,4>(_a,_b,_c,_d) {}
24
 
35
 
25
		/// Convert from float vector. 
36
		/// Convert from float vector. 
26
		explicit Vec4uc(const Vec4f& v): 
37
		explicit Vec4uc(const Vec4f& v): 
27
			ArithVec<UChar,Vec4uc,4>(UChar(v[0]), UChar(v[1]), 
38
			ArithVec<UChar,Vec4uc,4>(UChar(v[0]), UChar(v[1]), 
28
															 UChar(v[2]), UChar(v[3])) {}
39
															 UChar(v[2]), UChar(v[3])) {}
29
 
40
 
30
		operator Vec4f() const
41
		operator Vec4f() const
31
		{
42
		{
32
			return  Vec4f((*this)[0],(*this)[1],(*this)[2],(*this)[3]);
43
			return  Vec4f((*this)[0],(*this)[1],(*this)[2],(*this)[3]);
33
		}
44
		}
34
 
45
 
35
	};
46
	};
36
 
47
 
37
 
48
 
38
}
49
}
39
#endif
50
#endif
40
 
51
 
41
 
52