Changeset 49

Show
Ignore:
Timestamp:
05/03/08 07:40:36 (7 months ago)
Author:
kaarna
Message:

Slow clipping working with a hack.Should be made better.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pihlaja/src/shiraz/canvas/Draw.d

    r48 r49  
    122122            glColor3f(1.0f, 1.0f, 1.0f); 
    123123         
    124             /* 
     124             
    125125            //This doesn't work anymore with GL_CCW?... 
    126             glRectf(ix1, 
    127                       iy1, 
    128                       ix2, 
    129                       iy2); 
    130             */ 
     126            //glRectf(ix1, 
     127            //            iy1, 
     128            //            ix2, 
     129            //            iy2); 
     130             
    131131            glBegin(GL_QUADS); 
    132132                glNormal3f(0.0f, 0.0f, 1.0f); 
     
    205205    void pushClipping(float ix1, float iy1, float ix2, float iy2, float iz = 0.0f) 
    206206    { 
     207        debug(clipping)  
     208        { 
     209            Trace.formatln("Draw.pushClipping() START."); 
     210         
     211            Trace.format("ix1:{}, ", cast(double) ix1 ); 
     212            Trace.format("iy1:{}, ", cast(double) iy1 ); 
     213            Trace.format("ix2:{}, ", cast(double) ix2 ); 
     214            Trace.format("iy2:{}, ", cast(double) iy2 ); 
     215        } 
     216     
    207217        ClippingInfo clipinfo = new ClippingInfo(ix1, iy1, ix2, iy2, iz); 
    208         if( clipStack.length > 0 ) 
     218        /*if( clipStack.length > 0 ) 
    209219        { 
    210220            clipStack.tail.clip( clipinfo );//Wow! We clip it with the old clip. 
    211         } 
     221        }*/ 
    212222        clipStack.push( clipinfo ); 
     223        debug(clipping) Trace.formatln("Draw.pushClipping() push. size: {}", clipStack.length ); 
    213224        clipinfo.startClipping(); 
    214225    } 
     
    216227    void popClipping() 
    217228    { 
     229        debug(clipping) Trace.formatln("Draw.popClipping() START."); 
     230     
    218231        scope ClippingInfo clipinfo = clipStack.pop(); 
     232         
     233        debug(clipping) Trace.formatln("Draw.popClipping() pop. size: {}", clipStack.length ); 
     234         
     235        clipinfo.endClipping(); 
     236         
    219237        if( clipStack.length > 0 ) 
    220238        { 
    221239            clipStack.tail.startClipping(); 
    222240        } 
    223         else clipinfo.endClipping(); 
     241        //else clipinfo.endClipping(); 
    224242    } 
    225243     
  • trunk/pihlaja/src/shiraz/canvas/PlainRectangle.d

    r48 r49  
    10421042    } 
    10431043     
     1044    //Maybe remove this. It's just 
     1045    //for debug in render(). 
     1046    public char[] fullName(char[] recursive = "") 
     1047    { 
     1048        return name ~ "." ~ recursive;  
     1049    } 
     1050     
     1051    public bool isClipping() { return m_isClipping; } 
     1052    public bool isClipping(bool set) { return m_isClipping = set; } 
     1053    protected bool m_isClipping = false; 
     1054     
    10441055    void render( Draw draw ) 
    10451056    { 
     1057        debug(clipping) Trace.formatln("PlainRectangle.render() START. name: {}", fullName() ); 
     1058     
    10461059        beginRender(draw); 
    10471060         
     
    10501063                //draw.colour(); 
    10511064                //draw.gradient( gradient ); 
     1065                 
     1066                //TODO 
     1067                glColor4f(r, g, b, a); 
    10521068                 
    10531069                shape.bounds(ix1, iy1, ix2, iy2, iz); 
     
    10621078                } 
    10631079             
    1064             //if( isClipping == true ) 
     1080            if( isClipping == true ) 
    10651081                draw.pushClipping(ix1, iy1, ix2, iy2, iz); 
    10661082                     
    10671083                    renderChildren(draw); 
    10681084                     
    1069             //if( isClipping == true ) 
     1085        endRender(draw);//TEMP hack... 
     1086                     
     1087            if( isClipping == true ) 
    10701088                draw.popClipping(); 
    10711089             
    10721090             
    1073         endRender(draw); 
     1091         
    10741092    } 
    10751093     
  • trunk/pihlaja/src/shiraz/canvas/Rectangle.d

    r48 r49  
    30403040    } 
    30413041     
    3042     public bool isClipping() { return m_isClipping; } 
    3043     public bool isClipping(bool set) { return m_isClipping = set; } 
    3044     protected bool m_isClipping = false; 
    3045      
    30463042    public double tempclip = 0.0f; 
    30473043    public double tempclip2 = 0.0f;