示例#1
0
 def testCanvasBackface(self):
     root = self.loadEmptyScene()
     canvas = player.createCanvas(id="testcanvas", size=(80, 120))
     avg.ImageNode(parent=root, pos=(80, 0), href="canvas:testcanvas")
     for parentNode in canvas.getRootNode(), root:
         avg.MeshNode(vertexcoords=((0, 0), (80, 0), (80, 120), (0, 120)),
                      texcoords=((0, 0), (1, 0), (1, 1), (0, 1)),
                      triangles=((1, 0, 3), (1, 2, 3)),
                      parent=parentNode,
                      backfacecull=True)
     self.start(False, (lambda: self.compareImage("testCanvasBackface"), ))
示例#2
0
 def addMesh():
     div = avg.DivNode()
     mesh = avg.MeshNode(
             texhref="rgb24-64x64.png",
             vertexcoords=((0,0), (64,0), (0,64), (64, 64),(32, 32)),
             texcoords=((0,0),(1,0),(0,1),(1,1),(0.5,0.5)),
             triangles=((0,1,4),(1,3,4),(3,2,4),(2,0,4)))
     div.appendChild(mesh)
     div.x = 50
     div.y = 30
     canvas.appendChild(div)
     return mesh
示例#3
0
文件: mesh.py 项目: yueyihua/libavg
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from libavg import avg, player

canvas = player.createMainCanvas(size=(160,120))
avg.MeshNode(texhref="rgb24-64x64.png", 
        vertexcoords=((0,0), (64,0), (0,64), (64, 64), (32, 32)),
        texcoords=((0,0), (1,0), (0,1), (1,1), (0.5,0.5)),
        triangles=((0,1,4), (1,3,4), (3,2,4), (2,0,4)),
        parent=player.getRootNode())
player.play()