Subversion Repositories gelsvn

Rev

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

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