gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx librenderables/renderables.py libtext/T...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gfx librenderables/renderables.py libtext/T...
Date: Sat, 28 Sep 2002 05:16:46 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/09/28 05:16:46

Modified files:
        gfx/librenderables: renderables.py 
        gfx/libtext    : Text.hxx 

Log message:
        Try a 2cs text

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.74&tr2=1.75&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtext/Text.hxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.74 
gzz/gfx/librenderables/renderables.py:1.75
*** gzz/gfx/librenderables/renderables.py:1.74  Fri Sep 27 15:34:48 2002
--- gzz/gfx/librenderables/renderables.py       Sat Sep 28 05:16:46 2002
***************
*** 769,774 ****
--- 769,822 ----
      """       
  }, 
  
+ # Draw horizontal text with origin from one coordsys and 
+ # text aspect ratio from another
+ {
+     "Type": "2",
+     "Name": "HorizText2",
+     "Data": """
+       TextRenderer *r;
+       unistring txt;
+       ZPt origin;
+       float scale;
+       """,
+     "Params" : """
+       Font f,
+       String text, float x, float y, float z,
+       float scale
+       """,
+     "ParamCode" : """
+       r = f;
+       txt = text; origin.x = x; origin.y = y; origin.z = z;
+       this->scale = scale;
+       """,
+     "ExtraClass" : """
+       template<class Coords> struct Vertexer {
+           const Coords &c;
+           float scale;
+           float z;
+           Vertexer(Coords &c, float scale, float z) : c(c), scale(scale), 
z(z) { }
+           template<class T> void operator()(const T &x, const T &y) {
+               ZPt tmp(x * scale, y * scale, 0);
+               c.vertex(tmp);
+           }
+       };
+       """,
+     "RenderCode" : """
+           Coords *coords2inv = coords2.getInverse();
+           ZPt orig = coords2inv->transform(coords1.transform(origin));
+           Vertexer<Coords> v(coords2, scale, orig.z);
+           glPushAttrib(GL_ENABLE_BIT);
+           glEnable(GL_BLEND);
+           Text::renderIter(*r, txt.begin(), txt.end(), 
+                   orig.x,orig.y,
+                   v
+                   );
+           glPopAttrib();
+     """       
+ }, 
+ 
+ 
  {
      "Type": "1",
      "Name": "HorizText_Squished",
Index: gzz/gfx/libtext/Text.hxx
diff -c gzz/gfx/libtext/Text.hxx:1.7 gzz/gfx/libtext/Text.hxx:1.8
*** gzz/gfx/libtext/Text.hxx:1.7        Thu Sep 12 11:30:04 2002
--- gzz/gfx/libtext/Text.hxx    Sat Sep 28 05:16:46 2002
***************
*** 156,167 ****
        QuadGlyph() {}
        QuadGlyph(Glyph glyph, Rect &rect) : glyph(glyph), rect(rect) { }
        bool valid() { return rect.tex.isGood() ; }
!       template<class Vertex> void draw(int &cx, int &cy, Vertex &vertex) {
            if(glyph.extents.width != 0) {
!               int cx1 = cx + glyph.extents.left;
!               int cy1 = cy + glyph.extents.top;
!               int cx2 = cx1 + glyph.extents.width;
!               int cy2 = cy1 + glyph.extents.height;
                rect.texcoord(0, 0);
                vertex(cx1, cy1);
                rect.texcoord(0, 1);
--- 156,167 ----
        QuadGlyph() {}
        QuadGlyph(Glyph glyph, Rect &rect) : glyph(glyph), rect(rect) { }
        bool valid() { return rect.tex.isGood() ; }
!       template<class Vertex> void draw(float &cx, float &cy, Vertex &vertex) {
            if(glyph.extents.width != 0) {
!               float cx1 = cx + glyph.extents.left;
!               float cy1 = cy + glyph.extents.top;
!               float cx2 = cx1 + glyph.extents.width;
!               float cy2 = cy1 + glyph.extents.height;
                rect.texcoord(0, 0);
                vertex(cx1, cy1);
                rect.texcoord(0, 1);
***************
*** 247,253 ****
        /** Render a single character.
         * @return New x position.
         */
!       template<class Vertex> int renderChar(Char c, int x, int y, Vertex 
&vertex) 
        { // returns new x pos
            QuadGlyph &glyph = g[(unsigned)c];
            if(!glyph.valid()) return x;
--- 247,253 ----
        /** Render a single character.
         * @return New x position.
         */
!       template<class Vertex> float renderChar(Char c, float x, float y, 
Vertex &vertex) 
        { // returns new x pos
            QuadGlyph &glyph = g[(unsigned)c];
            if(!glyph.valid()) return x;
***************
*** 273,282 ****
       * all vertex commands are routed through the Vertex object.
       */
      template<class Iterator, class RandomRenderer, class Vertex> 
!       int renderIter(
                RandomRenderer &r, 
                Iterator begin, Iterator end, 
!               int x, int y,
                Vertex &vertex) {
        r.startRendering();
        while(begin != end) {
--- 273,282 ----
       * all vertex commands are routed through the Vertex object.
       */
      template<class Iterator, class RandomRenderer, class Vertex> 
!       float renderIter(
                RandomRenderer &r, 
                Iterator begin, Iterator end, 
!               float x, float y,
                Vertex &vertex) {
        r.startRendering();
        while(begin != end) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]