31 #include "glm/gtc/matrix_transform.hpp" 43 static const char *
const kSuffix[] = {
"h" ,
"l" ,
"m" ,
"s" ,
"t" ,
"i" };
44 static const float kWidth [] = {256.0f, 128.0f, 64.0f, 32.0f, 16.0f, 32.0f};
45 static const float kHeight[] = {400.0f, 200.0f, 100.0f, 50.0f, 25.0f, 32.0f};
52 float border,
float bR,
float bG,
float bB,
float bA) :
54 _size(size), _border(border), _bR(bR), _bG(bG), _bB(bB), _bA(bA) {
58 if (
GfxMan.isRendererExperimental()) {
152 if ((x < x1) || (x > x2))
154 if ((y < y1) || (y > y2))
164 bool isTransparent = (
_bA < 1.0f) ||
177 for (std::vector<Quad>::const_iterator b =
_qBorder.begin(); b !=
_qBorder.end(); ++b)
178 for (
int i = 0; i < 4; i++)
179 glVertex2f(b->vX[i], b->vY[i]);
186 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
189 for (
int i = 0; i < 4; i++) {
207 float *color =
static_cast<float *
>(
_borderMaterial->getVariableData(
"_colour"));
213 glm::mat4 btform = glm::translate(glm::mat4(), glm::vec3(
_x -
_border,
_y -
_border, -10.0f));
214 btform = glm::scale(btform, glm::vec3(
_width + 2.0f *
_border,
220 glm::mat4 tform = glm::translate(glm::mat4(), glm::vec3(
_x,
_y, -10.0f));
222 _renderable->renderImmediate(parentTransform * tform);
236 curSize = (
Size) (curSize + 1);
247 if (
GfxMan.isRendererExperimental()) {
273 float portraitCutRatio;
275 portraitCutRatio = 112.0f / 512.0f;
277 portraitCutRatio = 0.0f;
285 if (
GfxMan.isRendererExperimental()) {
286 glm::mat4 tmatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, portraitCutRatio, 0.0f));
287 tmatrix = glm::scale(tmatrix, glm::vec3(1.0f, 1.0f - portraitCutRatio, 1.0f));
288 memcpy(
_surface->getVariableData(
"_uv0Matrix"), &tmatrix[0], 16 *
sizeof(float));
295 float bR,
float bG,
float bB,
float bA) :
NWNWidget(gui, tag),
296 _portrait(name, size, border, bR, bG, bB, bA) {
Graphics::Aurora::TextureHandle _texture
virtual void show()
Show the object.
Only render transparent parts.
The global graphics manager.
Texture & getTexture() const
virtual void hide()
Hide the object.
A class holding an UTF-8 string.
#define TextureMan
Shortcut for accessing the texture manager.
void reset(PointerType o=0)
Resets the pointer with the new value.
double _distance
The distance of the object from the viewer.
#define SurfaceMan
Shortcut for accessing the shader manager.
The Aurora texture manager.
float getWidth() const
Get the scrollbar's width.
static const char *const kSuffix[]
Common::ScopedPtr< Graphics::Shader::ShaderRenderable > _borderRenderable
void calculateDistance()
Calculate the object's distance.
std::vector< Quad > _qBorder
void getPosition(float &x, float &y, float &z) const
Get the current position of the 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)
void renderImmediate(const glm::mat4 &parentTransform)
For shader based systems, don't sort anything, render this right_now.
Common::ScopedPtr< Graphics::Shader::ShaderMaterial > _borderMaterial
void setClickable(bool clickable)
Set the object's clickable state.
Graphics::Aurora::TextureHandle handle
Utility templates and functions.
void setPosition(float x, float y, float z)
Set the current position of the portrait.
static const float kHeight[]
Common::ScopedPtr< Graphics::Shader::ShaderRenderable > _renderable
The global shader material manager.
The global shader surface manager.
void render(Graphics::RenderPass pass)
Render the object.
float getHeight() const
Get the scrollbar's height.
#define MeshMan
Shortcut for accessing the shader manager.
PointerType get() const
Returns the plain pointer value.
Shader sampler is used to bind a texture to a texture unit.
void setBorderColor(float bR, float bG, float bB, float bA)
Set border color.
Common::ScopedPtr< Graphics::Shader::ShaderMaterial > _material
A texture as used in the Aurora engines.
#define ShaderMan
Shortcut for accessing the shader manager.
void setTag(const Common::UString &tag)
Set the object's tag.
A portrait model and widget.
void setPortrait(const Common::UString &name)
Set the current portrait.
static const float kWidth[]
bool isIn(float x, float y) const
Is the point within the portrait?
Common::ScopedPtr< Graphics::Shader::ShaderSurface > _surface
#define GfxMan
Shortcut for accessing the graphics manager.
Only render opaque parts.