Blender V2.61 - r43446
|
#include <GPC_Canvas.h>
Classes | |
struct | CanvasRenderState |
struct | TBannerData |
Public Types | |
enum | TBannerAlignment { alignTopLeft, alignBottomRight } |
typedef int | TBannerId |
Public Member Functions | |
GPC_Canvas (int width, int height) | |
virtual | ~GPC_Canvas () |
void | Resize (int width, int height) |
int | GetWidth () const |
int | GetHeight () const |
const RAS_Rect & | GetDisplayArea () const |
void | SetDisplayArea (RAS_Rect *rect) |
RAS_Rect & | GetWindowArea () |
void | BeginFrame () |
void | EndFrame () |
void | SetViewPort (int x1, int y1, int x2, int y2) |
void | ClearColor (float r, float g, float b, float a) |
void | SetMouseState (RAS_MouseState mousestate) |
void | SetMousePosition (int x, int y) |
virtual void | MakeScreenShot (const char *filename) |
void | ClearBuffer (int type) |
TBannerId | AddBanner (unsigned int bannerWidth, unsigned int bannerHeight, unsigned int imageWidth, unsigned int imageHeight, unsigned char *imageData, TBannerAlignment alignment=alignTopLeft, bool enabled=true) |
void | DisposeBanner (TBannerId id) |
void | DisposeAllBanners () |
void | SetBannerEnabled (TBannerId id, bool enabled=true) |
void | SetBannerDisplayEnabled (bool enabled=true) |
Protected Types | |
typedef std::map< TBannerId, TBannerData > | TBannerMap |
Protected Member Functions | |
void | DisposeBanner (TBannerData &banner) |
void | DrawAllBanners (void) |
void | DrawBanner (TBannerData &banner) |
void | PushRenderState (CanvasRenderState &render_state) |
void | PopRenderState (const CanvasRenderState &render_state) |
void | SetOrthoProjection () |
Protected Attributes | |
int | m_width |
int | m_height |
RAS_Rect | m_displayarea |
TBannerMap | m_banners |
bool | m_bannersEnabled |
Static Protected Attributes | |
static TBannerId | s_bannerId = 0 |
Definition at line 48 of file GPC_Canvas.h.
typedef int GPC_Canvas::TBannerId |
Definition at line 59 of file GPC_Canvas.h.
typedef std::map<TBannerId, TBannerData> GPC_Canvas::TBannerMap [protected] |
Definition at line 83 of file GPC_Canvas.h.
Used to position banners in the canvas.
Definition at line 54 of file GPC_Canvas.h.
GPC_Canvas::GPC_Canvas | ( | int | width, |
int | height | ||
) |
Definition at line 47 of file GPC_Canvas.cpp.
GPC_Canvas::~GPC_Canvas | ( | ) | [virtual] |
Definition at line 58 of file GPC_Canvas.cpp.
References DisposeAllBanners().
GPC_Canvas::TBannerId GPC_Canvas::AddBanner | ( | unsigned int | bannerWidth, |
unsigned int | bannerHeight, | ||
unsigned int | imageWidth, | ||
unsigned int | imageHeight, | ||
unsigned char * | imageData, | ||
TBannerAlignment | alignment = alignTopLeft , |
||
bool | enabled = true |
||
) |
Enables display of a banner. The image data is copied inside.
bannerWidth | Display width of the banner. |
bannerHeight | Display height of the banner. |
imageWidth | Width of the banner image in pixels. |
imageHeight | Height of the banner image in pixels. |
imageData | Pointer to the pixels of the image to display. |
alignement | Where the banner will be positioned on the canvas. |
enabled | Whether the banner will be displayed intiallly. |
Definition at line 133 of file GPC_Canvas.cpp.
References GPC_Canvas::TBannerData::alignment, GPC_Canvas::TBannerData::displayHeight, GPC_Canvas::TBannerData::displayWidth, GPC_Canvas::TBannerData::enabled, GPC_Canvas::TBannerData::imageData, GPC_Canvas::TBannerData::imageHeight, GPC_Canvas::TBannerData::imageWidth, m_banners, s_bannerId, and GPC_Canvas::TBannerData::textureName.
void GPC_Canvas::BeginFrame | ( | ) | [inline, virtual] |
Implements RAS_ICanvas.
Definition at line 144 of file GPC_Canvas.h.
void GPC_Canvas::ClearBuffer | ( | int | type | ) | [virtual] |
Implements RAS_ICanvas.
Definition at line 119 of file GPC_Canvas.cpp.
References RAS_ICanvas::COLOR_BUFFER, and RAS_ICanvas::DEPTH_BUFFER.
void GPC_Canvas::ClearColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) | [virtual] |
void GPC_Canvas::DisposeAllBanners | ( | ) |
Disposes all the banners.
Definition at line 166 of file GPC_Canvas.cpp.
References DisposeBanner(), and m_banners.
Referenced by ~GPC_Canvas().
void GPC_Canvas::DisposeBanner | ( | TBannerId | id | ) |
Disposes a banner.
id | Bannner to be disposed. |
Definition at line 157 of file GPC_Canvas.cpp.
References m_banners.
Referenced by DisposeAllBanners().
void GPC_Canvas::DisposeBanner | ( | TBannerData & | banner | ) | [protected] |
Disposes a banner.
it | Bannner to be disposed. |
Definition at line 190 of file GPC_Canvas.cpp.
References GPC_Canvas::TBannerData::imageData, and GPC_Canvas::TBannerData::textureName.
void GPC_Canvas::DrawAllBanners | ( | void | ) | [protected] |
Draws all the banners enabled.
Definition at line 201 of file GPC_Canvas.cpp.
References DrawBanner(), m_banners, m_bannersEnabled, PopRenderState(), PushRenderState(), and SetOrthoProjection().
Referenced by EndFrame().
void GPC_Canvas::DrawBanner | ( | TBannerData & | banner | ) | [protected] |
Draws a banner.
Definition at line 235 of file GPC_Canvas.cpp.
References GPC_Canvas::TBannerData::alignment, alignTopLeft, GPC_Canvas::TBannerData::displayHeight, GPC_Canvas::TBannerData::displayWidth, GPC_Canvas::TBannerData::enabled, GPC_Canvas::TBannerData::imageData, GPC_Canvas::TBannerData::imageWidth, m_height, m_width, and GPC_Canvas::TBannerData::textureName.
Referenced by DrawAllBanners().
void GPC_Canvas::EndFrame | ( | ) | [virtual] |
Draws overlay banners and progress bars.
Implements RAS_ICanvas.
Definition at line 88 of file GPC_Canvas.cpp.
References DrawAllBanners(), and m_bannersEnabled.
const RAS_Rect& GPC_Canvas::GetDisplayArea | ( | ) | const [inline, virtual] |
int GPC_Canvas::GetHeight | ( | ) | const [inline, virtual] |
Implements RAS_ICanvas.
Definition at line 118 of file GPC_Canvas.h.
References m_height.
Referenced by GPG_Canvas::GetMouseNormalizedY(), and MakeScreenShot().
int GPC_Canvas::GetWidth | ( | ) | const [inline, virtual] |
Implements RAS_ICanvas.
Definition at line 112 of file GPC_Canvas.h.
References m_width.
Referenced by GPG_Canvas::GetMouseNormalizedX(), and MakeScreenShot().
RAS_Rect& GPC_Canvas::GetWindowArea | ( | ) | [inline, virtual] |
Used to get canvas area within blender.
Implements RAS_ICanvas.
Definition at line 138 of file GPC_Canvas.h.
References m_displayarea.
void GPC_Canvas::MakeScreenShot | ( | const char * | filename | ) | [virtual] |
Implements RAS_ICanvas.
Definition at line 384 of file GPC_Canvas.cpp.
References GetHeight(), GetWidth(), i, and NULL.
void GPC_Canvas::PopRenderState | ( | const CanvasRenderState & | render_state | ) | [protected] |
Definition at line 338 of file GPC_Canvas.cpp.
References GPC_Canvas::CanvasRenderState::oldBlend, GPC_Canvas::CanvasRenderState::oldBlendDst, GPC_Canvas::CanvasRenderState::oldBlendSrc, GPC_Canvas::CanvasRenderState::oldColor, GPC_Canvas::CanvasRenderState::oldDepthTest, GPC_Canvas::CanvasRenderState::oldFog, GPC_Canvas::CanvasRenderState::oldLighting, GPC_Canvas::CanvasRenderState::oldTexture2D, and GPC_Canvas::CanvasRenderState::oldWriteMask.
Referenced by DrawAllBanners().
void GPC_Canvas::PushRenderState | ( | CanvasRenderState & | render_state | ) | [protected] |
Definition at line 308 of file GPC_Canvas.cpp.
References GPC_Canvas::CanvasRenderState::oldBlend, GPC_Canvas::CanvasRenderState::oldBlendDst, GPC_Canvas::CanvasRenderState::oldBlendSrc, GPC_Canvas::CanvasRenderState::oldColor, GPC_Canvas::CanvasRenderState::oldDepthTest, GPC_Canvas::CanvasRenderState::oldFog, GPC_Canvas::CanvasRenderState::oldLighting, GPC_Canvas::CanvasRenderState::oldTexture2D, and GPC_Canvas::CanvasRenderState::oldWriteMask.
Referenced by DrawAllBanners().
void GPC_Canvas::Resize | ( | int | width, |
int | height | ||
) |
Definition at line 82 of file GPC_Canvas.cpp.
References m_height, and m_width.
Referenced by GPG_Canvas::GPG_Canvas(), and GPG_Application::processEvent().
void GPC_Canvas::SetBannerDisplayEnabled | ( | bool | enabled = true | ) |
Enables or disables display of all banners.
enabled | New state of the banners. |
Definition at line 184 of file GPC_Canvas.cpp.
References m_bannersEnabled.
Referenced by GPC_Engine::Start().
void GPC_Canvas::SetBannerEnabled | ( | TBannerId | id, |
bool | enabled = true |
||
) |
Enables or disables display of a banner.
id | Banner id of the banner to be enabled/disabled. |
enabled | New state of the banner. |
Definition at line 175 of file GPC_Canvas.cpp.
References m_banners.
void GPC_Canvas::SetDisplayArea | ( | RAS_Rect * | rect | ) | [inline, virtual] |
void GPC_Canvas::SetMousePosition | ( | int | x, |
int | y | ||
) | [inline, virtual] |
void GPC_Canvas::SetMouseState | ( | RAS_MouseState | mousestate | ) | [inline, virtual] |
Semantics are not yet honoured.
Implements RAS_ICanvas.
Reimplemented in GPG_Canvas.
Definition at line 163 of file GPC_Canvas.h.
void GPC_Canvas::SetOrthoProjection | ( | ) | [protected] |
Set up an orthogonal viewing,model and texture matrix for banners and progress bars.
Definition at line 368 of file GPC_Canvas.cpp.
References m_height, and m_width.
Referenced by DrawAllBanners().
void GPC_Canvas::SetViewPort | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) | [virtual] |
TBannerMap GPC_Canvas::m_banners [protected] |
Storage for the banners to display.
Definition at line 94 of file GPC_Canvas.h.
Referenced by AddBanner(), DisposeAllBanners(), DisposeBanner(), DrawAllBanners(), and SetBannerEnabled().
bool GPC_Canvas::m_bannersEnabled [protected] |
State of banner display.
Definition at line 96 of file GPC_Canvas.h.
Referenced by DrawAllBanners(), EndFrame(), and SetBannerDisplayEnabled().
RAS_Rect GPC_Canvas::m_displayarea [protected] |
Rect that defines the area used for rendering, relative to the context
Definition at line 91 of file GPC_Canvas.h.
Referenced by GetDisplayArea(), GetWindowArea(), and SetDisplayArea().
int GPC_Canvas::m_height [protected] |
Height of the context.
Definition at line 88 of file GPC_Canvas.h.
Referenced by DrawBanner(), GetHeight(), Resize(), and SetOrthoProjection().
int GPC_Canvas::m_width [protected] |
Width of the context.
Definition at line 86 of file GPC_Canvas.h.
Referenced by DrawBanner(), GetWidth(), Resize(), and SetOrthoProjection().
GPC_Canvas::TBannerId GPC_Canvas::s_bannerId = 0 [static, protected] |
Definition at line 269 of file GPC_Canvas.h.
Referenced by AddBanner().