My Project
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Enumerations
Pages
vertex.h
Go to the documentation of this file.
1
/**************************************************************************/
2
/* Copyright 2009 Tim Day */
3
/* */
4
/* This file is part of Fracplanet */
5
/* */
6
/* Fracplanet is free software: you can redistribute it and/or modify */
7
/* it under the terms of the GNU General Public License as published by */
8
/* the Free Software Foundation, either version 3 of the License, or */
9
/* (at your option) any later version. */
10
/* */
11
/* Fracplanet is distributed in the hope that it will be useful, */
12
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14
/* GNU General Public License for more details. */
15
/* */
16
/* You should have received a copy of the GNU General Public License */
17
/* along with Fracplanet. If not, see <http://www.gnu.org/licenses/>. */
18
/**************************************************************************/
19
24
#ifndef _vertex_h_
25
#define _vertex_h_
26
27
#include "
rgb.h
"
28
#include "
xyz.h
"
29
31
35
class
Vertex
36
{
37
public
:
38
40
Vertex
()
41
{}
42
44
Vertex
(
const
Vertex
& v)
45
:_position(v._position)
46
,_normal(v._normal)
47
{
48
_colour[0]=v._colour[0];
49
_colour[1]=v._colour[1];
50
}
51
53
explicit
Vertex
(
const
XYZ
& p)
54
:_position(p)
55
,_normal(0.0,0.0,0.0)
56
{
57
_colour[0]=
ByteRGBA
(0,0,0,255);
58
_colour[1]=
ByteRGBA
(0,0,0,255);
59
}
60
62
const
XYZ
&
position
()
const
63
{
64
return
_position;
65
}
66
68
const
XYZ
&
normal
()
const
69
{
70
return
_normal;
71
}
72
74
const
ByteRGBA
&
colour
(uint c)
const
75
{
76
assert(c<2);
77
return
_colour[c];
78
}
79
81
void
position
(
const
XYZ
& p)
82
{
83
_position=p;
84
}
85
87
void
normal
(
const
XYZ
& n)
88
{
89
_normal=n;
90
}
91
93
void
colour
(uint c,
const
ByteRGBA
& col)
94
{
95
assert(c<2);
96
_colour[c]=col;
97
}
98
100
void
colour
(uint c,
const
FloatRGBA
& col)
101
{
102
assert(c<2);
103
_colour[c]=
ByteRGBA
(col);
104
}
105
106
private
:
107
109
XYZ
_position;
110
112
XYZ
_normal;
113
115
119
ByteRGBA
_colour[2];
120
};
121
122
#endif
Generated on Sat Oct 5 2013 17:39:13 for My Project by
1.8.3.1