diff options
author | Diego Borghetti <bdiego@gmail.com> | 2010-12-09 07:36:58 +0300 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2010-12-09 07:36:58 +0300 |
commit | b25c32393d42c314c073ef2244cde1fabb7b64af (patch) | |
tree | a295abf9b556d1fdc8ed2d8d555f602bc1f874ce /source/blender/blenfont/BLF_api.h | |
parent | 36175f37c9d3ea128cfdcebd1c1b438494b34433 (diff) |
Add the possibility to set a 4x4 matrix to be used on blf.
This option allow the user to set a 4x4 matrix to be
multiplied before draw the text, for example:
double *m;
/* Get the matrix or build it! */
BLF_matrix(m);
BLF_enable(BLF_MATRIX);
/* set color, size, etc and draw! */
BLF_disable(BLF_MATRIX);
You don't need the last line (disable), but remember
that if you use the font to draw in any other place,
the matrix will be used!.
The GL code is:
glPushMatrix();
glMultMatrixd(m);
glTranslatef();
glScalef();
glRotatef();
glPopMatrix();
Let's Dalai test this!!! :D
Diffstat (limited to 'source/blender/blenfont/BLF_api.h')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index d32922f2429..84086742b15 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -49,6 +49,20 @@ void BLF_aspect(int fontid, float aspect); void BLF_position(int fontid, float x, float y, float z); void BLF_size(int fontid, int size, int dpi); +/* Set a 4x4 matrix to be multiplied before draw the text. + * Remember that you need call BLF_enable(BLF_MATRIX) + * to enable this. + * + * The order of the matrix is like GL: + + | m[0] m[4] m[8] m[12] | + | m[1] m[5] m[9] m[13] | + | m[2] m[6] m[10] m[14] | + | m[3] m[7] m[11] m[15] | + + */ +void BLF_matrix(int fontid, double *m); + /* Draw the string using the default font, size and dpi. */ void BLF_draw_default(float x, float y, float z, const char *str, size_t len); void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t len); @@ -180,6 +194,7 @@ void BLF_dir_free(char **dirs, int count); #define BLF_CLIPPING (1<<1) #define BLF_SHADOW (1<<2) #define BLF_KERNING_DEFAULT (1<<3) +#define BLF_MATRIX (1<<4) // XXX, bad design extern int blf_mono_font; |