Last change
on this file since 1489 was
934,
checked in by gah, 17 years ago
|
Makefile cleanup: add library for transfer-function, no longer compile Socket.o, etc.
|
File size:
1.7 KB
|
Line | |
---|
1 | #ifndef __RENDER_CONTEXT_H__ |
---|
2 | #define __RENDER_CONTEXT_H__ |
---|
3 | |
---|
4 | #include <GL/gl.h> |
---|
5 | |
---|
6 | namespace graphics { |
---|
7 | |
---|
8 | class RenderContext { |
---|
9 | public : |
---|
10 | enum ShadingModel { |
---|
11 | FLAT = GL_FLAT , //!< Flat Shading |
---|
12 | SMOOTH = GL_SMOOTH //!< Smooth shading (Goraud shading model) |
---|
13 | }; |
---|
14 | |
---|
15 | enum PolygonMode { |
---|
16 | LINE = GL_LINE, |
---|
17 | FILL = GL_FILL |
---|
18 | }; |
---|
19 | |
---|
20 | enum CullMode { |
---|
21 | NO_CULL, //!< No culling |
---|
22 | BACK= GL_BACK, //!< Back face culling |
---|
23 | FRONT= GL_FRONT //!< Front face culling |
---|
24 | }; |
---|
25 | |
---|
26 | private : |
---|
27 | CullMode _cullMode; |
---|
28 | PolygonMode _fillMode; |
---|
29 | ShadingModel _shadingModel; |
---|
30 | |
---|
31 | public : |
---|
32 | /** |
---|
33 | *@brief constructor |
---|
34 | */ |
---|
35 | RenderContext(); |
---|
36 | |
---|
37 | /** |
---|
38 | *@brief Destructor |
---|
39 | */ |
---|
40 | ~RenderContext(); |
---|
41 | |
---|
42 | public : |
---|
43 | /** |
---|
44 | *@brief Set the shading model such as flat, smooth |
---|
45 | */ |
---|
46 | void setShadingModel(const ShadingModel shadeModel); |
---|
47 | ShadingModel getShadingModel() const; |
---|
48 | |
---|
49 | void setCullMode(const CullMode cullMode); |
---|
50 | CullMode getCullMode() const; |
---|
51 | |
---|
52 | void setPolygonMode(const PolygonMode fillMode); |
---|
53 | PolygonMode getPolygonMode() const; |
---|
54 | |
---|
55 | }; |
---|
56 | |
---|
57 | inline void RenderContext::setShadingModel(const RenderContext::ShadingModel shadeModel) |
---|
58 | { |
---|
59 | _shadingModel = shadeModel; |
---|
60 | } |
---|
61 | |
---|
62 | inline RenderContext::ShadingModel RenderContext::getShadingModel() const |
---|
63 | { |
---|
64 | return _shadingModel; |
---|
65 | } |
---|
66 | |
---|
67 | inline void RenderContext::setCullMode(const RenderContext::CullMode cullMode) |
---|
68 | { |
---|
69 | _cullMode = cullMode; |
---|
70 | } |
---|
71 | |
---|
72 | inline RenderContext::CullMode RenderContext::getCullMode() const |
---|
73 | { |
---|
74 | return _cullMode; |
---|
75 | } |
---|
76 | |
---|
77 | inline void RenderContext::setPolygonMode(const RenderContext::PolygonMode fillMode) |
---|
78 | { |
---|
79 | _fillMode = fillMode; |
---|
80 | } |
---|
81 | |
---|
82 | inline RenderContext::PolygonMode RenderContext::getPolygonMode() const |
---|
83 | { |
---|
84 | return _fillMode; |
---|
85 | } |
---|
86 | |
---|
87 | } |
---|
88 | |
---|
89 | #endif // |
---|
Note: See
TracBrowser
for help on using the repository browser.