BALL
1.5.0
include
BALL
VIEW
RENDERING
renderWindow.h
Go to the documentation of this file.
1
// -*- Mode: C++; tab-width: 2; -*-
2
// vi: set ts=2:
3
//
4
5
#ifndef BALL_VIEW_RENDERING_RENDERINGWINDOW_H
6
#define BALL_VIEW_RENDERING_RENDERINGWINDOW_H
7
8
#include <
BALL/COMMON/global.h
>
9
#include <
BALL/VIEW/RENDERING/renderTarget.h
>
10
11
#include <boost/static_assert.hpp>
12
#include <boost/type_traits/is_same.hpp>
13
15
#define BALLVIEW_IS_SAME_TYPE(aTypeA, aTypeB) (boost::is_same<aTypeA, aTypeB>::value)
16
18
#define BALLVIEW_STATIC_ASSERT_TYPE_IS_CHAR_OR_FLOAT(aType) \
19
BOOST_STATIC_ASSERT(BALLVIEW_IS_SAME_TYPE(aType, char) || BALLVIEW_IS_SAME_TYPE(aType, float))
20
21
#define BALL_DEFAULT_PIXEL_TYPE float
22
23
namespace
BALL
24
{
25
namespace
VIEW
26
{
32
template
<
typename
taPixelDatatype>
33
class
BALL_VIEW_EXPORT
TRenderWindow
:
public
RenderTarget
34
{
35
// only int or floats are allowed as template parameters
36
BALLVIEW_STATIC_ASSERT_TYPE_IS_CHAR_OR_FLOAT
(taPixelDatatype);
37
38
// type of the pixel buffer pointer
39
typedef
boost::shared_array<taPixelDatatype> t_PixelPtr;
40
41
public
:
42
43
TRenderWindow
();
44
45
virtual
~
TRenderWindow
();
46
47
/* Initialize window internals. After that call, window is ready to receive \link resize \endlink call
48
* returns false if the initialization fails
49
*/
50
virtual
bool
init();
51
58
virtual
bool
resize(
const
unsigned
int
width,
const
unsigned
int
height);
59
68
virtual
void
refresh();
69
70
71
/* =====================
72
* RenderTarget methods
73
* ===================== */
74
75
/*
76
* See \link RenderTarget \endlink for general description.
77
* In addition there is a precondition that \link init \endlink must be called before
78
* getBuffer. If not, \link NoBufferAvailable \endlink exception is thrown.
79
* @throws BALL::Exception::NoBufferAvailable
80
*/
81
virtual
FrameBufferPtr
getBuffer();
82
83
/*
84
* See \link RenderTarget \endlink for description.
85
*/
86
virtual
FrameBufferFormat
getFormat()
const
;
87
88
/*
89
* See \link RenderTarget \endlink for description.
90
*/
91
virtual
void
releaseBuffer(
FrameBufferPtr
buffer);
92
93
/* Prepare the window for rendering, e.g., make it current if necessary.
94
*/
95
virtual
void
prepareRendering
() {};
96
99
virtual
bool
doNotResize
()
const
{
return
do_not_resize_; }
100
101
virtual
void
setDoNotResize
(
bool
do_not_resize) { do_not_resize_ = do_not_resize; }
102
103
104
protected
:
105
t_PixelPtr
m_pixels
;
// raw pixel buffer
106
FrameBufferPtr
m_framebuffer
;
// frame buffer given out to the wild by getBuffer method
107
FrameBufferFormat
m_fmt
;
// description of the buffer format
108
const
PixelFormat
m_pfm
;
// pixel format of the window
109
bool
m_bufferLocked
;
// pixel buffer is being accessed by another object?
110
const
Size
m_minimalWidth
;
// minimum with the window can have
111
const
Size
m_minimalHeight
;
// minimum height the window can have
112
bool
do_not_resize_
;
113
};
114
115
typedef
TRenderWindow<BALL_DEFAULT_PIXEL_TYPE>
RenderWindow
;
116
117
}
// namespace VIEW
118
119
}
// namespace BALL
120
121
#endif // BALL_VIEW_RENDERING_RENDERINGWINDOW_H
BALL::VIEW::TRenderWindow::do_not_resize_
bool do_not_resize_
Definition:
renderWindow.h:112
BALL::VIEW::TRenderWindow::prepareRendering
virtual void prepareRendering()
Definition:
renderWindow.h:95
BALL::VIEW::TRenderWindow::m_framebuffer
FrameBufferPtr m_framebuffer
Definition:
renderWindow.h:106
BALL
Definition:
constants.h:12
BALL::VIEW::TRenderWindow::m_fmt
FrameBufferFormat m_fmt
Definition:
renderWindow.h:107
BALL::VIEW::FrameBufferPtr
boost::shared_ptr< FrameBuffer > FrameBufferPtr
Definition:
renderTarget.h:222
BALL::VIEW::RenderTarget
Definition:
renderTarget.h:226
BALL::VIEW::PixelFormat
Definition:
pixelFormat.h:61
BALL_SIZE_TYPE
global.h
BALL::VIEW::TRenderWindow::m_pixels
t_PixelPtr m_pixels
Definition:
renderWindow.h:105
BALLVIEW_STATIC_ASSERT_TYPE_IS_CHAR_OR_FLOAT
#define BALLVIEW_STATIC_ASSERT_TYPE_IS_CHAR_OR_FLOAT(aType)
Macro checks at compile time, whether aType is int or float.
Definition:
renderWindow.h:18
BALL::VIEW::TRenderWindow::setDoNotResize
virtual void setDoNotResize(bool do_not_resize)
Definition:
renderWindow.h:101
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition:
COMMON/global.h:52
BALL::VIEW::RenderWindow
TRenderWindow< BALL_DEFAULT_PIXEL_TYPE > RenderWindow
Definition:
renderWindow.h:115
BALL::VIEW::FrameBufferFormat
Definition:
renderTarget.h:44
BALL::VIEW::TRenderWindow::m_minimalHeight
const Size m_minimalHeight
Definition:
renderWindow.h:111
BALL::VIEW::TRenderWindow::doNotResize
virtual bool doNotResize() const
Definition:
renderWindow.h:99
BALL::VIEW::TRenderWindow
Definition:
renderWindow.h:33
BALL::VIEW::TRenderWindow::m_minimalWidth
const Size m_minimalWidth
Definition:
renderWindow.h:110
BALL::VIEW::TRenderWindow::m_bufferLocked
bool m_bufferLocked
Definition:
renderWindow.h:109
renderTarget.h
BALL::VIEW::TRenderWindow::m_pfm
const PixelFormat m_pfm
Definition:
renderWindow.h:108
Generated by
1.8.17