xoreos  0.0.5
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Engines::NWN::Portrait Class Reference

A NWN portrait model. More...

#include <portrait.h>

Inheritance diagram for Engines::NWN::Portrait:
Inheritance graph
[legend]
Collaboration diagram for Engines::NWN::Portrait:
Collaboration graph
[legend]

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::UStringgetTag () 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...
 

Detailed Description

A NWN portrait model.

Definition at line 47 of file portrait.h.

Member Enumeration Documentation

◆ Size

Enumerator
kSizeHuge 
kSizeLarge 
kSizeMedium 
kSizeSmall 
kSizeTiny 
kSizeIcon 
kSizeMAX 

Definition at line 49 of file portrait.h.

Constructor & Destructor Documentation

◆ Portrait()

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 
)

◆ ~Portrait()

Engines::NWN::Portrait::~Portrait ( )

Definition at line 82 of file portrait.cpp.

Member Function Documentation

◆ calculateDistance()

void Engines::NWN::Portrait::calculateDistance ( )
virtual

Calculate the object's distance.

Implements Graphics::Renderable.

Definition at line 160 of file portrait.cpp.

◆ createBorder()

void Engines::NWN::Portrait::createBorder ( )
private

Definition at line 85 of file portrait.cpp.

References _border, _height, _qBorder, _width, _x, and _y.

Referenced by setPosition().

Here is the caller graph for this function:

◆ getHeight()

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().

Here is the caller graph for this function:

◆ getPosition()

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.

◆ getWidth()

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().

Here is the caller graph for this function:

◆ isIn()

bool Engines::NWN::Portrait::isIn ( float  x,
float  y 
) const
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().

Here is the call graph for this function:

◆ render()

void Engines::NWN::Portrait::render ( Graphics::RenderPass  pass)
virtual

◆ renderImmediate()

void Engines::NWN::Portrait::renderImmediate ( const glm::mat4 &  parentTransform)
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.

◆ setBorderColor()

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().

Here is the caller graph for this function:

◆ setPortrait()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPosition()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSize()

void Engines::NWN::Portrait::setSize ( )
private

Member Data Documentation

◆ _bA

float Engines::NWN::Portrait::_bA
private

Definition at line 105 of file portrait.h.

Referenced by render(), renderImmediate(), and setBorderColor().

◆ _bB

float Engines::NWN::Portrait::_bB
private

Definition at line 104 of file portrait.h.

Referenced by render(), renderImmediate(), and setBorderColor().

◆ _bG

float Engines::NWN::Portrait::_bG
private

Definition at line 103 of file portrait.h.

Referenced by render(), renderImmediate(), and setBorderColor().

◆ _border

float Engines::NWN::Portrait::_border
private

Definition at line 96 of file portrait.h.

Referenced by createBorder(), getHeight(), getWidth(), renderImmediate(), and setPosition().

◆ _borderMaterial

Common::ScopedPtr<Graphics::Shader::ShaderMaterial> Engines::NWN::Portrait::_borderMaterial
private

Definition at line 112 of file portrait.h.

Referenced by Portrait(), and renderImmediate().

◆ _borderRenderable

Common::ScopedPtr<Graphics::Shader::ShaderRenderable> Engines::NWN::Portrait::_borderRenderable
private

Definition at line 114 of file portrait.h.

Referenced by Portrait(), and renderImmediate().

◆ _bR

float Engines::NWN::Portrait::_bR
private

Definition at line 102 of file portrait.h.

Referenced by render(), renderImmediate(), and setBorderColor().

◆ _height

float Engines::NWN::Portrait::_height
private

Definition at line 100 of file portrait.h.

Referenced by createBorder(), getHeight(), renderImmediate(), setPosition(), and setSize().

◆ _material

Common::ScopedPtr<Graphics::Shader::ShaderMaterial> Engines::NWN::Portrait::_material
private

Definition at line 111 of file portrait.h.

Referenced by Portrait(), and setPortrait().

◆ _qBorder

std::vector<Quad> Engines::NWN::Portrait::_qBorder
private

Definition at line 108 of file portrait.h.

Referenced by createBorder(), and render().

◆ _qPortrait

Quad Engines::NWN::Portrait::_qPortrait
private

Definition at line 107 of file portrait.h.

Referenced by render(), setPosition(), and setSize().

◆ _renderable

Common::ScopedPtr<Graphics::Shader::ShaderRenderable> Engines::NWN::Portrait::_renderable
private

Definition at line 113 of file portrait.h.

Referenced by Portrait(), and renderImmediate().

◆ _size

Size Engines::NWN::Portrait::_size
private

Definition at line 94 of file portrait.h.

Referenced by Portrait(), setPortrait(), and setSize().

◆ _surface

Common::ScopedPtr<Graphics::Shader::ShaderSurface> Engines::NWN::Portrait::_surface
private

Definition at line 110 of file portrait.h.

Referenced by Portrait(), and setSize().

◆ _texture

Graphics::Aurora::TextureHandle Engines::NWN::Portrait::_texture
private

Definition at line 92 of file portrait.h.

Referenced by render(), and setPortrait().

◆ _width

float Engines::NWN::Portrait::_width
private

Definition at line 99 of file portrait.h.

Referenced by createBorder(), getWidth(), renderImmediate(), setPosition(), and setSize().

◆ _x

float Engines::NWN::Portrait::_x
private

Definition at line 97 of file portrait.h.

Referenced by createBorder(), getPosition(), isIn(), renderImmediate(), and setPosition().

◆ _y

float Engines::NWN::Portrait::_y
private

Definition at line 98 of file portrait.h.

Referenced by createBorder(), getPosition(), isIn(), renderImmediate(), and setPosition().


The documentation for this class was generated from the following files: