/[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.14 by tjl, Sun Oct 20 11:55:00 2002 UTC revision 1.15 by humppake, Tue Oct 29 10:29:57 2002 UTC
# Line 76  def testTransform(): Line 76  def testTransform():
76      c.setRotateParams(r, 90)      c.setRotateParams(r, 90)
77      checkTrans(vs, r, [0, 0, 0, 0, 50, 0], [100, 100, 0, 50, 100, 0])      checkTrans(vs, r, [0, 0, 0, 0, 50, 0], [100, 100, 0, 50, 100, 0])
78    
79        cs4 = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)
80        cs4clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)
81        cs4cull = c.cull(cs4, cs4clip)
82        checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 1, 200, 200, 2])
83    
84  def checkInverse(c, cs):  def checkInverse(c, cs):
85      # unit cube      # unit cube
# Line 135  def testInverses(): Line 139  def testInverses():
139    
140          checkInverse(c, cs_dist)          checkInverse(c, cs_dist)
141    
142            cs_affine = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)
143            cs_affine_clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)
144            cs_cull = c.cull(cs_affine, cs_affine_clip)
145            checkInverse(c, cs_cull)
146    
147  def testInterpolateTranslation():  def testInterpolateTranslation():
148    
149      cs_trans1 = c1.translate(0, 10, 10)      cs_trans1 = c1.translate(0, 10, 10)
# Line 182  def testNadir(): Line 191  def testNadir():
191          [20, 100, 0, 30, 100, 0],          [20, 100, 0, 30, 100, 0],
192          .1)          .1)
193    
194    import gfx.libpaper.papermill
195    from gfx.libpaper.papermill import ThePaperMill
196    
197    def testCulling():
198    #test cull-clip interface
199        font = GL.createFont("gfx/fonts/a010013l.pfb", 16)
200        renderable = GLRen.createHorizText2(font, "FOO", 1, 1, 1, 1)
201        
202        cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
203        cs_clip = c.affineCoordsys(0, 0, 0, 0, 200, 0, 0, 200)
204        cs_cull = c.cull(cs, cs_clip)
205    
206        vs.map.clear()
207        vs.map.put(SolidBgVob(Color.red))
208        vs.map.put(renderable, cs_cull)
209        render(vs)
210    
211        checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
212    
213        pap = ThePaperMill().getPaper(0, passmask=[1,1,1,1])
214        renderable = GLRen.createPaperQuad(pap, 0, 0, 1, 1, 1)
215        
216        vs.map.clear()
217        vs.map.put(SolidBgVob(Color.red))
218        vs.map.put(renderable, cs_cull)
219        render(vs)
220        checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
221    
222    #test same area
223        cs_clip = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
224        cs_cull = c.cull(cs, cs_clip)
225    
226        vs.map.clear()
227        vs.map.put(SolidBgVob(Color.red))
228        vs.map.put(gzz.vob.RectBgVob(), cs_cull)
229        render(vs)
230        checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
231    
232    #test normal intersection
233        cs_clip = c.affineCoordsys(0, 0, 60, 60, 100, 0, 0, 100)
234        cs_cull = c.cull(cs, cs_clip)
235    
236        vs.map.clear()
237        vs.map.put(SolidBgVob(Color.red))
238        vs.map.put(gzz.vob.RectBgVob(), cs_cull)
239        render(vs)
240        checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
241    
242    #test clip inside
243        cs_clip = c.affineCoordsys(0, 0, 60, 60, 10, 0, 0, 10)
244        cs_cull = c.cull(cs, cs_clip)
245    
246        vs.map.clear()
247        vs.map.put(SolidBgVob(Color.red))
248        vs.map.put(gzz.vob.RectBgVob(), cs_cull)
249        render(vs)
250        checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
251    
252    #test side touch (should not be drawn)
253        cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
254        cs_clip = c.affineCoordsys(0, 0, 110, 60, 10, 0, 0, 10)
255        cs_cull = c.cull(cs, cs_clip)
256    
257        vs.map.clear()
258        vs.map.put(SolidBgVob(Color.red))
259        vs.map.put(gzz.vob.RectBgVob(), cs_cull)
260        render(vs)
261        checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
262    
263    #test corner-touch (should not be drawn)
264        cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
265        cs_clip = c.affineCoordsys(0, 0, 110, 110, 10, 0, 0, 10)
266        cs_cull = c.cull(cs, cs_clip)
267    
268        vs.map.clear()
269        vs.map.put(SolidBgVob(Color.red))
270        vs.map.put(gzz.vob.RectBgVob(), cs_cull)
271        render(vs)
272        checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
273    
274    #test clip outside (should not be drawn)
275        cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
276        cs_clip = c.affineCoordsys(0, 0, 120, 60, 10, 0, 0, 10)
277        cs_cull = c.cull(cs, cs_clip)
278    
279        vs.map.clear()
280        vs.map.put(SolidBgVob(Color.red))
281        vs.map.put(gzz.vob.RectBgVob(), cs_cull)
282        render(vs)
283        checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
284    
285    #test distorted inside (should be drawn)
286        cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
287        cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)
288        cs_clip = c.affineCoordsys(0, 0, 10, 90, 100, 0, 0, 100)
289        cs_cull = c.cull(cs_d, cs_clip)
290    
291        vs.map.clear()
292        vs.map.put(SolidBgVob(Color.red))
293        vs.map.put(renderable, cs_cull)
294        render(vs)
295        checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
296    
297    #test distorted outside (should not be drawn)
298        cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
299        cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)
300        #normally without distortion this should be drawn
301        cs_clip = c.affineCoordsys(0, 0, 10, 100, 100, 0, 0, 100)
302        cs_cull = c.cull(cs_d, cs_clip)
303    
304        vs.map.clear()
305        vs.map.put(SolidBgVob(Color.red))
306        vs.map.put(renderable, cs_cull)
307        render(vs)
308        checkAvgColor(10, 10, 80, 80, (255, 0, 0), delta=50)
309    
310    # : vim: set syntax=python :
311    
312    
313    
314    
315    
 # : vim: set syntax=python :  

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

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