/[gzz]/gzz/test/gzz/gfx/gl/glvobcoorder.test
ViewVC logotype

Diff of /gzz/test/gzz/gfx/gl/glvobcoorder.test

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by humppake, Tue Oct 29 10:29:57 2002 UTC revision 1.16 by tjl, Tue Oct 29 14:09:32 2002 UTC
# Line 5  from java.awt import Color Line 5  from java.awt import Color
5    
6  from gzz.gfx.gl import GLVobCoorder, GL  from gzz.gfx.gl import GLVobCoorder, GL
7  from gzz.gfx.gl import GL, GLRen, GLCache, PaperMill  from gzz.gfx.gl import GL, GLRen, GLCache, PaperMill
 from jarray import array, zeros  
8  from test.tools.gfx import *  from test.tools.gfx import *
9    
10  vs = getvs()  vs = getvs()
# Line 18  c1 = vs1.coords Line 17  c1 = vs1.coords
17  vs2 = getvs()  vs2 = getvs()
18  c2 = vs2.coords  c2 = vs2.coords
19    
20  def checkTrans(vs, cs, srclist, dstlist, delta=0, alsoGL = 1):      
     src = array(srclist, 'f')  
     dst = zeros(len(src), 'f')  
     vs.coords.transformPoints3(cs, src, dst)  
     for i in range(0, len(src)):  
         failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, dst[i], dstlist[i]]))  
     if alsoGL:  
         for i in range(0, len(src), 3):  
             vs.map.clear()  
             vs.map.put(SolidBgVob(Color.red))  
             d = """  
                 Disable TEXTURE_2D  
                 Disable BLEND  
                 PointSize 3  
                 Color 1 1 1  
                 Begin POINTS  
                 Vertex %s %s %s  
                 End  
             """ % (src[i], src[i+1], src[i+2])  
             # print "TEST: ",d  
             vs.map.put(GLCache.getCallListCoorded(d), cs)  
             render(vs)  
             checkNotAvgColor(  
                 int(dstlist[i])-1, int(dstlist[i+1])-1,  
                 3, 3, (255, 0, 0), delta=50)  
   
               
   
 def checkInterp(vs1, vs2, i, fract, cs, srclist, dstlist, delta=0):  
     src = array(srclist, 'f')  
     dst = zeros(len(src), 'f')  
     failUnless(vs1.coords.transformPoints3_interp(i, vs2.coords,  
                     fract, 0, cs, src, dst))  
     for i in range(0, len(src)):  
         failIf(abs(dst[i]-dstlist[i]) > delta, str([srclist, dstlist, dst, i, dst[i], dstlist[i]]))  
   
21    
22  def testTransform():  def testTransform():
23    
24      cs1 = c.ortho(0, 5, 10, 15, 0.5, 1)      cs1 = c.ortho(0, 5, 10, 15, 0.5, 1)
     checkTrans(vs, cs1, [0, 0, 0, 1, 1, 1], [10, 15, 5, 10.5, 16, 6])  
   
25      cs2 = c.scale(0, 2, 3, 4)      cs2 = c.scale(0, 2, 3, 4)
26      checkTrans(vs, cs2, [0, 0, 0, 1, 1, 1], [0, 0, 0, 2, 3, 4])      cs = c.concat(cs1, cs2)
27        checkTrans(vs, cs, [0, 0, 0, 1, 1, 1, 2, 2, 2], [10, 15, 5, 11, 18, 9, 12, 21, 13])
28    
29    
30      cs3 = c.distort(0, 0, 0, 0.1, 0.1, 20, 5)      cs3 = c.distort(0, 0, 0, 0.1, 0.1, 20, 5)
31      checkTrans(vs, cs3, [0, 0, 0, 0.001, 0.001, 1], [0, 0, 0, 0.02, 0.02, 1], delta=0.00001, alsoGL = 0)      checkTrans(vs, cs3, [0, 0, 0, 0.001, 0.001, 1], [0, 0, 0, 0.02, 0.02, 1], delta=0.00001, alsoGL = 0)
32    
33      cs = c.concat(cs1, cs2)  
     checkTrans(vs, cs, [0, 0, 0, 1, 1, 1, 2, 2, 2], [10, 15, 5, 11, 18, 9, 12, 21, 13])  
34    
35      t = c.translate(0, 100, 100)      t = c.translate(0, 100, 100)
36      r = c.rotate(t, 0)      r = c.rotate(t, 0)
# Line 78  def testTransform(): Line 41  def testTransform():
41    
42      cs4 = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)      cs4 = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)
43      cs4clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)      cs4clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)
44    
45      cs4cull = c.cull(cs4, cs4clip)      cs4cull = c.cull(cs4, cs4clip)
46      checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 1, 200, 200, 2])      checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 1, 200, 200, 2])
47    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26