needGL() from gzz.vob import * from java.awt import Color from gzz.gfx.gl import GL, GLRen, GLCache, PaperMill from test.tools.gfx import * red = (255,0,0) blue = (0,0,255) def testSimply(): vs = getvs() vs.map.put(SolidBgVob(Color.red)) tr = vs.coords.translate(0, 100, 100) nad = vs.coords.translate(0, 100, 300) nrot = vs.coords.nadirOrigin(tr, nad) north = vs.coords.ortho(nrot, 0, -50, 0, 100, 10) # Hang downwards vs.map.put(GLCache.getCallListCoorded(""" Disable TEXTURE_2D Color 0 0 1 Begin QUAD_STRIP Vertex 0 0 Vertex 0 1 Vertex 1 0 Vertex 1 1 End """), north) # Now, start making sure the coordsys points the right way. render(vs) checkAvgColor(100, 97, 1, 1, red) checkAvgColor(100, 105, 1, 1, blue) checkAvgColor(100, 113, 1, 1, red) vs.coords.setTranslateParams(nad, 300, 100) render(vs) checkAvgColor(97, 97, 1, 1, red) checkAvgColor(97, 105, 1, 1, red) checkAvgColor(97, 113, 1, 1, red) checkAvgColor(97, 100, 1, 1, red) checkAvgColor(105, 100, 1, 1, blue) checkAvgColor(113, 100, 1, 1, red) vs.coords.setTranslateParams(nad, -100, 100) render(vs) checkAvgColor(103, 97, 1, 1, red) checkAvgColor(103, 105, 1, 1, red) checkAvgColor(103, 113, 1, 1, red) checkAvgColor(103, 100, 1, 1, red) checkAvgColor(95, 100, 1, 1, blue) checkAvgColor(87, 100, 1, 1, red) # XXX Oblique angles! def testInterp(): """XXX NOT WRITTEN. Test that interpolation between nadir and an affine transformation works. """ # XXX # : vim: set syntax=python :