/[libvob]/libvob/test/vob/gl/glvobcoorder.test
ViewVC logotype

Diff of /libvob/test/vob/gl/glvobcoorder.test

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

revision 1.4 by tjl, Wed Mar 12 16:17:20 2003 UTC revision 1.5 by humppake, Thu Mar 13 17:41:39 2003 UTC
# Line 166  def testInterpolateTranslation(): Line 166  def testInterpolateTranslation():
166    
167  def testCulling():  def testCulling():
168      """Test culling.      """Test culling.
     FAILURE: Fonts...  
   
     fail: *  
169      """      """
170    
171      def putThings():      def putThings():
172          vs.map.clear()          vs.map.clear()
173          vs.map.put(gzz.vob.vobs.SolidBgVob(Color.red))          vs.map.put(vob.vobs.SolidBackdropVob(Color.red))
174          vs.map.put(renderable, cs_cull, 0)          vs.map.put(renderable, cs_cull)
175          render(vs)          render(vs)
176    
177  #test cull-clip interface      renderable = vob.gl.GLRen.createCallListBoxCoorded(
178      font = GL.createFont("gfx/fonts/a010013l.pfb", 16)          "PushAttrib CURRENT_BIT ENABLE_BIT\n"+
179      renderable = GLRen.createHorizText2(font, "FOO", 1, 1, 1, 1)          "Disable TEXTURE_2D\n"+
180                "Color 0 0 0 1\n" +
181      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)          "Begin QUAD_STRIP\n"+
182      cs_clip = c.affine(0, 0, 0, 0, 200, 0, 0, 200)          "Vertex 1 1\nVertex 1 0\n"+
183      cs_cull = c.cull(cs, cs_clip)          "Vertex 0 1\nVertex 0 0\n"+
184            "End\n"+
185      putThings()          "PopAttrib\n"
186            )
     checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)  
   
     pap = ThePaperMill().getPaper(0, passmask=[1,1,1,1])  
     renderable = GLRen.createPaperQuad(pap, 0, 0, 1, 1, 1)  
       
     putThings()  
     checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)  
187    
188  #test box forwarding  #test box forwarding
189        cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
190      cs_box = c.orthoBox(cs, 0, 0, 0, 1, 1, 10, 10)      cs_box = c.orthoBox(cs, 0, 0, 0, 1, 1, 10, 10)
191        cs_clip = c.affine(0, 0, 0, 0, 200, 0, 0, 200)
192      cs_cull = c.cull(cs_box, cs_clip)      cs_cull = c.cull(cs_box, cs_clip)
193      boxwh = zeros(2, 'f')      boxwh = zeros(2, 'f')
194      c.getSqSize(cs_cull, boxwh)      c.getSqSize(cs_cull, boxwh)
# Line 204  def testCulling(): Line 196  def testCulling():
196      failIf(boxwh[0] != 10.0, "%s != 10.0" % (boxwh[0]))      failIf(boxwh[0] != 10.0, "%s != 10.0" % (boxwh[0]))
197      failIf(boxwh[1] != 10.0, "%s != 10.0" % (boxwh[1]))      failIf(boxwh[1] != 10.0, "%s != 10.0" % (boxwh[1]))
198    
199  #test findBoundingBox bugfix  #test translation forward
200      cs_box = c.orthoBox(0, 0, 0, 0, 200, 100, 1, 2)  #    cs4 = c.affine(0, 0, 0, 0, 100, 0, 0, 100)
201      cs_clip = c.orthoBox(0, 0,100, 0, 100, 100, 1, 1)  #    cs4clip = c.affine(0, 0, 50, 50, 10, 0, 0, 10)
202      cs_cull = c.cull(cs_box, cs_clip)  
203      putThings()  #    cs4cull = c.cull(cs4, cs4clip)
204      checkNotAvgColor(0, 0, 200, 200, (255, 0, 0), delta=50)  #    checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 1, 200, 200, 2])
205            
206  #test same area  #Why is that? Culling hasn't ever affected translation.
207      cs_clip = c.affine(0, 0, 10, 10, 100, 0, 0, 100)  #    c.setAffineParams(cs4clip, 0, 1500, 1500, 10, 0, 0, 10)
208    #    checkNoTrans(vs, cs4cull)
209    
210    #test side touch (should not be drawn)
211        cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
212        cs_clip = c.affine(0, 0, 111, 60, 10, 0, 0, 10)
213      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
214    
215      putThings()      putThings()
216      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
217    
218  #test normal intersection  #test corner-touch (should not be drawn)
219      cs_clip = c.affine(0, 0, 60, 60, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
220        cs_clip = c.affine(0, 0, 110, 110, 10, 0, 0, 10)
221      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
222    
223      putThings()      putThings()
224      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
225    
226  #test clip inside  #test clip outside (should not be drawn)
227      cs_clip = c.affine(0, 0, 60, 60, 10, 0, 0, 10)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
228        cs_clip = c.affine(0, 0, 120, 60, 10, 0, 0, 10)
229      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
230    
231      putThings()      putThings()
232      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
233    
234  #test side touch (should not be drawn)  #test distorted outside (should not be drawn)
235    #normally without distortion this should be drawn
236    #    cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
237    #    cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)
238    #    cs_clip = c.affine(0, 0, 10, 100, 100, 0, 0, 100)
239    #    cs_cull = c.cull(cs_d, cs_clip)
240    #    putThings()
241    #    checkAvgColor(10, 10, 80, 80, (255, 0, 0), delta=50)
242    
243    #test same area (should be drawn)
244      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
245      cs_clip = c.affine(0, 0, 110, 60, 10, 0, 0, 10)      cs_clip = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
246      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
247    
248      putThings()      putThings()
249      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
250    
251  #test corner-touch (should not be drawn)  #test normal intersection (should be drawn)
252      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
253      cs_clip = c.affine(0, 0, 110, 110, 10, 0, 0, 10)      cs_clip = c.affine(0, 0, 60, 60, 100, 0, 0, 100)
254      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
255    
256      putThings()      putThings()
257      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
258    
259  #test clip outside (should not be drawn)  #test clip inside (should be drawn)
260      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
261      cs_clip = c.affine(0, 0, 120, 60, 10, 0, 0, 10)      cs_clip = c.affine(0, 0, 60, 60, 10, 0, 0, 10)
262      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
263    
264      putThings()      putThings()
265      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
266    
267  #test distorted inside (should be drawn)  #test distorted inside (should be drawn)
268      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
# Line 265  def testCulling(): Line 273  def testCulling():
273      putThings()      putThings()
274      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
275    
276  #test distorted outside (should not be drawn)  #test findBoundingBox bugfix (should be drawn)
277      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)      cs_box = c.orthoBox(0, 0, 0, 0, 200, 100, 1, 2)
278      cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)      cs_clip = c.orthoBox(0, 0, 100, 0, 100, 100, 1, 1)
279      #normally without distortion this should be drawn      cs_cull = c.cull(cs_box, cs_clip)
     cs_clip = c.affine(0, 0, 10, 100, 100, 0, 0, 100)  
     cs_cull = c.cull(cs_d, cs_clip)  
280    
281      putThings()      putThings()
282      checkAvgColor(10, 10, 80, 80, (255, 0, 0), delta=50)      checkNotAvgColor(0, 0, 200, 200, (255, 0, 0), delta=50)
283            
     cs4 = c.affine(0, 0, 0, 0, 100, 0, 0, 100)  
     cs4clip = c.affine(0, 0, 50, 50, 10, 0, 0, 10)  
   
     cs4cull = c.cull(cs4, cs4clip)  
     checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 1, 200, 200, 2])  
   
     c.setAffineParams(cs4clip, 0, 1500, 1500, 10, 0, 0, 10)  
     checkNoTrans(vs, cs4cull)  
   
   
284  def testInterpolateType():  def testInterpolateType():
285      """Test that cses of different types get interpolated      """Test that cses of different types get interpolated
286      """      """

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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