769 |
""" |
""" |
770 |
}, |
}, |
771 |
|
|
772 |
|
# Draw horizontal text with origin from one coordsys and |
773 |
|
# text aspect ratio from another |
774 |
|
{ |
775 |
|
"Type": "2", |
776 |
|
"Name": "HorizText2", |
777 |
|
"Data": """ |
778 |
|
TextRenderer *r; |
779 |
|
unistring txt; |
780 |
|
ZPt origin; |
781 |
|
float scale; |
782 |
|
""", |
783 |
|
"Params" : """ |
784 |
|
Font f, |
785 |
|
String text, float x, float y, float z, |
786 |
|
float scale |
787 |
|
""", |
788 |
|
"ParamCode" : """ |
789 |
|
r = f; |
790 |
|
txt = text; origin.x = x; origin.y = y; origin.z = z; |
791 |
|
this->scale = scale; |
792 |
|
""", |
793 |
|
"ExtraClass" : """ |
794 |
|
template<class Coords> struct Vertexer { |
795 |
|
const Coords &c; |
796 |
|
float scale; |
797 |
|
float z; |
798 |
|
Vertexer(Coords &c, float scale, float z) : c(c), scale(scale), z(z) { } |
799 |
|
template<class T> void operator()(const T &x, const T &y) { |
800 |
|
ZPt tmp(x * scale, y * scale, 0); |
801 |
|
c.vertex(tmp); |
802 |
|
} |
803 |
|
}; |
804 |
|
""", |
805 |
|
"RenderCode" : """ |
806 |
|
Coords *coords2inv = coords2.getInverse(); |
807 |
|
ZPt orig = coords2inv->transform(coords1.transform(origin)); |
808 |
|
Vertexer<Coords> v(coords2, scale, orig.z); |
809 |
|
glPushAttrib(GL_ENABLE_BIT); |
810 |
|
glEnable(GL_BLEND); |
811 |
|
Text::renderIter(*r, txt.begin(), txt.end(), |
812 |
|
orig.x,orig.y, |
813 |
|
v |
814 |
|
); |
815 |
|
glPopAttrib(); |
816 |
|
""" |
817 |
|
}, |
818 |
|
|
819 |
|
|
820 |
{ |
{ |
821 |
"Type": "1", |
"Type": "1", |
822 |
"Name": "HorizText_Squished", |
"Name": "HorizText_Squished", |