comparison stageviewer.py @ 9:668b808b73ef

Fix texture coords handling
author Thibaut Girka <thib@sitedethib.com>
date Tue, 02 Aug 2011 14:26:19 +0200
parents f3ff96192476
children 059ea0ea8d38
comparison
equal deleted inserted replaced
8:f3ff96192476 9:668b808b73ef
107 transform = Matrix.get_translation_matrix(width / 2., height / 2., 0.).mult(transform) 107 transform = Matrix.get_translation_matrix(width / 2., height / 2., 0.).mult(transform)
108 108
109 transform = Matrix.get_translation_matrix(x, y, z).mult(transform) 109 transform = Matrix.get_translation_matrix(x, y, z).mult(transform)
110 vertmat = transform.mult(vertmat) 110 vertmat = transform.mult(vertmat)
111 111
112 uvs = [(tx / 256., 1. - (ty / 256.)), 112 uvs = [(tx / anim.size[0], 1. - (ty / anim.size[1])),
113 ((tx + tw) / 256., 1. - (ty / 256.)), 113 ((tx + tw) / anim.size[0], 1. - (ty / anim.size[1])),
114 ((tx + tw) / 256., 1. - ((ty + th) / 256.)), 114 ((tx + tw) / anim.size[0], 1. - ((ty + th) / anim.size[1])),
115 (tx / 256., 1. - ((ty + th) / 256.))] 115 (tx / anim.size[0], 1. - ((ty + th) / anim.size[1]))]
116 116
117 for i in xrange(4): 117 for i in xrange(4):
118 w = vertmat.data[3][i] 118 w = vertmat.data[3][i]
119 vertices.append((vertmat.data[0][i] / w, vertmat.data[1][i] / w, vertmat.data[2][i] / w)) 119 vertices.append((vertmat.data[0][i] / w, vertmat.data[1][i] / w, vertmat.data[2][i] / w))
120 faces.append((vertices, uvs)) 120 faces.append((vertices, uvs))