xoreos
0.0.5
|
#include <portrait.h>
Classes | |
struct | Quad |
Public Types | |
enum | Size { kSizeHuge = 0, kSizeLarge, kSizeMedium, kSizeSmall, kSizeTiny, kSizeIcon, kSizeMAX } |
Public Types inherited from Graphics::GUIElement | |
enum | GUIElementType { kGUIElementFront = kRenderableTypeGUIFront, kGUIElementBack = kRenderableTypeGUIBack, kGUIElementConsole = kRenderableTypeConsole } |
Public Member Functions | |
Portrait (const Common::UString &name, Size size, float border=0.0f, float bR=1.0f, float bG=1.0f, float bB=1.0f, float bA=1.0f) | |
~Portrait () | |
float | getWidth () const |
Get the scrollbar's width. More... | |
float | getHeight () const |
Get the scrollbar's height. More... | |
void | setPortrait (const Common::UString &name) |
Set the current portrait. More... | |
void | setBorderColor (float bR, float bG, float bB, float bA) |
Set border color. More... | |
void | setPosition (float x, float y, float z) |
Set the current position of the portrait. More... | |
void | getPosition (float &x, float &y, float &z) const |
Get the current position of the portrait. More... | |
bool | isIn (float x, float y) const |
Is the point within the portrait? More... | |
void | calculateDistance () |
Calculate the object's distance. More... | |
void | render (Graphics::RenderPass pass) |
Render the object. More... | |
void | renderImmediate (const glm::mat4 &parentTransform) |
For shader based systems, don't sort anything, render this right_now. More... | |
Public Member Functions inherited from Graphics::GUIElement | |
GUIElement (GUIElementType type) | |
~GUIElement () | |
Public Member Functions inherited from Graphics::Renderable | |
Renderable (RenderableType type) | |
~Renderable () | |
bool | operator< (const Queueable &q) const |
virtual void | advanceTime (float dt) |
Advance time (used by renderables with animations). More... | |
virtual void | queueRender (const glm::mat4 &parentTransform) |
Queue the object for later rendering. More... | |
double | getDistance () const |
Get the distance of the object from the viewer. More... | |
uint32 | getID () const |
Get the object's unique ID. More... | |
bool | isClickable () const |
Is the object clickable? More... | |
void | setClickable (bool clickable) |
Set the object's clickable state. More... | |
const Common::UString & | getTag () const |
Get the object's tag. More... | |
void | setTag (const Common::UString &tag) |
Set the object's tag. More... | |
bool | isVisible () const |
Is the object visible? More... | |
virtual void | show () |
Show the object. More... | |
virtual void | hide () |
Hide the object. More... | |
virtual bool | isIn (float x, float y, float z) const |
Is that point within the object? More... | |
virtual bool | isIn (float x1, float y1, float z1, float x2, float y2, float z2) const |
Does the line from x1.y1.z1 to x2.y2.z2 intersect with the object? More... | |
Public Member Functions inherited from Graphics::Queueable | |
Queueable () | |
virtual | ~Queueable () |
Private Member Functions | |
void | setSize () |
void | createBorder () |
Private Attributes | |
Graphics::Aurora::TextureHandle | _texture |
Size | _size |
float | _border |
float | _x |
float | _y |
float | _width |
float | _height |
float | _bR |
float | _bG |
float | _bB |
float | _bA |
Quad | _qPortrait |
std::vector< Quad > | _qBorder |
Common::ScopedPtr< Graphics::Shader::ShaderSurface > | _surface |
Common::ScopedPtr< Graphics::Shader::ShaderMaterial > | _material |
Common::ScopedPtr< Graphics::Shader::ShaderMaterial > | _borderMaterial |
Common::ScopedPtr< Graphics::Shader::ShaderRenderable > | _renderable |
Common::ScopedPtr< Graphics::Shader::ShaderRenderable > | _borderRenderable |
Additional Inherited Members | |
Protected Member Functions inherited from Graphics::Renderable | |
void | resort () |
void | lockFrame () |
void | unlockFrame () |
void | lockFrameIfVisible () |
void | unlockFrameIfVisible () |
Protected Member Functions inherited from Graphics::Queueable | |
bool | isInQueue (QueueType queue) const |
void | addToQueue (QueueType queue) |
void | removeFromQueue (QueueType queue) |
void | lockQueue (QueueType queue) |
void | unlockQueue (QueueType queue) |
void | sortQueue (QueueType queue) |
Protected Attributes inherited from Graphics::Renderable | |
QueueType | _queueExists |
QueueType | _queueVisible |
uint32 | _id |
bool | _clickable |
Common::UString | _tag |
double | _distance |
The distance of the object from the viewer. More... | |
A NWN portrait model.
Definition at line 47 of file portrait.h.
Enumerator | |
---|---|
kSizeHuge | |
kSizeLarge | |
kSizeMedium | |
kSizeSmall | |
kSizeTiny | |
kSizeIcon | |
kSizeMAX |
Definition at line 49 of file portrait.h.
Engines::NWN::Portrait::Portrait | ( | const Common::UString & | name, |
Size | size, | ||
float | border = 0.0f , |
||
float | bR = 1.0f , |
||
float | bG = 1.0f , |
||
float | bB = 1.0f , |
||
float | bA = 1.0f |
||
) |
Definition at line 51 of file portrait.cpp.
References _borderMaterial, _borderRenderable, _material, _renderable, _size, _surface, FLT_MAX, Common::ScopedPtrBase< T, Deallocator >::get(), GfxMan, kSizeHuge, kSizeMAX, MeshMan, Common::ScopedPtrBase< T, Deallocator >::reset(), setPortrait(), setPosition(), setSize(), Graphics::Shader::SHADER_FRAGMENT, Graphics::Shader::SHADER_VERTEX, ShaderMan, and SurfaceMan.
Engines::NWN::Portrait::~Portrait | ( | ) |
Definition at line 82 of file portrait.cpp.
|
virtual |
Calculate the object's distance.
Implements Graphics::Renderable.
Definition at line 160 of file portrait.cpp.
|
private |
Definition at line 85 of file portrait.cpp.
References _border, _height, _qBorder, _width, _x, and _y.
Referenced by setPosition().
float Engines::NWN::Portrait::getHeight | ( | ) | const |
Get the scrollbar's height.
Definition at line 117 of file portrait.cpp.
References _border, and _height.
Referenced by Engines::NWN::PortraitWidget::getHeight(), and isIn().
void Engines::NWN::Portrait::getPosition | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const |
Get the current position of the portrait.
Definition at line 140 of file portrait.cpp.
References Graphics::Renderable::_distance, _x, and _y.
float Engines::NWN::Portrait::getWidth | ( | ) | const |
Get the scrollbar's width.
Definition at line 113 of file portrait.cpp.
References _border, and _width.
Referenced by Engines::NWN::PortraitWidget::getWidth(), and isIn().
|
virtual |
Is the point within the portrait?
Reimplemented from Graphics::Renderable.
Definition at line 146 of file portrait.cpp.
References _x, _y, getHeight(), and getWidth().
|
virtual |
Render the object.
Implements Graphics::Renderable.
Definition at line 163 of file portrait.cpp.
References _bA, _bB, _bG, _bR, _qBorder, _qPortrait, _texture, Graphics::Aurora::TextureHandle::empty(), Graphics::Aurora::TextureHandle::getTexture(), Graphics::Aurora::Texture::hasAlpha(), Graphics::kRenderPassOpaque, Graphics::kRenderPassTransparent, pass, TextureMan, Engines::NWN::Portrait::Quad::tX, Engines::NWN::Portrait::Quad::tY, Engines::NWN::Portrait::Quad::vX, and Engines::NWN::Portrait::Quad::vY.
|
virtual |
For shader based systems, don't sort anything, render this right_now.
The "border" in this case is rendered first. The portrait itself is overlaid on top afterwards - because depth testing is disabled it would seem. This is unfortunate, because there's a few pixels rendered there for absolutely no reason. Could try to sort by depth - but then some widgets might actually have to rely on this. So for now, just deal with the inefficiency. It's not going to have that great of an impact probably, as borders don't seem to be used in many places other than the menu system.
Reimplemented from Graphics::Renderable.
Definition at line 196 of file portrait.cpp.
References _bA, _bB, _bG, _border, _borderMaterial, _borderRenderable, _bR, _height, _renderable, _width, _x, and _y.
void Engines::NWN::Portrait::setBorderColor | ( | float | bR, |
float | bG, | ||
float | bB, | ||
float | bA | ||
) |
Set border color.
Definition at line 254 of file portrait.cpp.
References _bA, _bB, _bG, _bR, and GfxMan.
Referenced by Engines::NWN::PortraitWidget::setBorderColor().
void Engines::NWN::Portrait::setPortrait | ( | const Common::UString & | name | ) |
Set the current portrait.
Definition at line 225 of file portrait.cpp.
References _material, _size, _texture, Graphics::Aurora::TextureHandle::clear(), Graphics::Aurora::TextureHandle::empty(), GfxMan, Graphics::Shader::ShaderSampler::handle, kSizeMAX, kSuffix, and TextureMan.
Referenced by Portrait(), and Engines::NWN::PortraitWidget::setPortrait().
void Engines::NWN::Portrait::setPosition | ( | float | x, |
float | y, | ||
float | z | ||
) |
Set the current position of the portrait.
Definition at line 121 of file portrait.cpp.
References _border, Graphics::Renderable::_distance, _height, _qPortrait, _width, _x, _y, createBorder(), GfxMan, Graphics::Renderable::resort(), Engines::NWN::Portrait::Quad::vX, and Engines::NWN::Portrait::Quad::vY.
Referenced by Portrait(), and Engines::NWN::PortraitWidget::setPosition().
|
private |
Definition at line 263 of file portrait.cpp.
References _height, _qPortrait, _size, _surface, _width, GfxMan, kHeight, kSizeIcon, kWidth, Engines::NWN::Portrait::Quad::tX, Engines::NWN::Portrait::Quad::tY, Engines::NWN::Portrait::Quad::vX, and Engines::NWN::Portrait::Quad::vY.
Referenced by Portrait().
|
private |
Definition at line 105 of file portrait.h.
Referenced by render(), renderImmediate(), and setBorderColor().
|
private |
Definition at line 104 of file portrait.h.
Referenced by render(), renderImmediate(), and setBorderColor().
|
private |
Definition at line 103 of file portrait.h.
Referenced by render(), renderImmediate(), and setBorderColor().
|
private |
Definition at line 96 of file portrait.h.
Referenced by createBorder(), getHeight(), getWidth(), renderImmediate(), and setPosition().
|
private |
Definition at line 112 of file portrait.h.
Referenced by Portrait(), and renderImmediate().
|
private |
Definition at line 114 of file portrait.h.
Referenced by Portrait(), and renderImmediate().
|
private |
Definition at line 102 of file portrait.h.
Referenced by render(), renderImmediate(), and setBorderColor().
|
private |
Definition at line 100 of file portrait.h.
Referenced by createBorder(), getHeight(), renderImmediate(), setPosition(), and setSize().
|
private |
Definition at line 111 of file portrait.h.
Referenced by Portrait(), and setPortrait().
|
private |
Definition at line 108 of file portrait.h.
Referenced by createBorder(), and render().
|
private |
Definition at line 107 of file portrait.h.
Referenced by render(), setPosition(), and setSize().
|
private |
Definition at line 113 of file portrait.h.
Referenced by Portrait(), and renderImmediate().
|
private |
Definition at line 94 of file portrait.h.
Referenced by Portrait(), setPortrait(), and setSize().
|
private |
Definition at line 110 of file portrait.h.
Referenced by Portrait(), and setSize().
|
private |
Definition at line 92 of file portrait.h.
Referenced by render(), and setPortrait().
|
private |
Definition at line 99 of file portrait.h.
Referenced by createBorder(), getWidth(), renderImmediate(), setPosition(), and setSize().
|
private |
Definition at line 97 of file portrait.h.
Referenced by createBorder(), getPosition(), isIn(), renderImmediate(), and setPosition().
|
private |
Definition at line 98 of file portrait.h.
Referenced by createBorder(), getPosition(), isIn(), renderImmediate(), and setPosition().