diff --git a/models.py b/models.py index 58f6a1b..25f64eb 100755 --- a/models.py +++ b/models.py @@ -184,10 +184,10 @@ class Texture(object): def texcoords_subset(self, u, v): tf = mgr.texture_ids[self.texid] - dest_x = float(self.x) / float(tf.w) - dest_w = (float(self.x + self.w) / float(tf.w)) - dest_x - dest_y = float(self.y) / float(tf.h) - dest_h = (float(self.y + self.h) / float(tf.h)) - dest_y + dest_x = (float(self.x)-0.0) / float(tf.w) + dest_w = ((float(self.x + self.w)+0.3) / float(tf.w)) - dest_x + dest_y = (float(self.y)-0.3) / float(tf.h) + dest_h = ((float(self.y + self.h)+0.0) / float(tf.h)) - dest_y return (dest_x + (u * dest_w), dest_y + (v * dest_h)) def texcoords_direct(self, u, v): @@ -218,6 +218,7 @@ class Texture(object): self.w = tf.w self.h = tf.h self.texcoords = self.texcoords_direct + self.texcoords = self.texcoords_subset def bind(self): glBindTexture(GL_TEXTURE_2D, self.texid) @@ -359,30 +360,6 @@ class RenderLayer(object): self.mesh.draw(self.material.texcoords) glPopMatrix() - -class Sprite(object): - def __init__(self): - Model.__init__(self) - vl = [Vertex() for x in xrange(4)] - - normal = vect(0.0, 0.0, 1.0) - white = (1.0, 1.0, 1.0) - for v in vl: - v.n = normal - v.c = white - - tl, bl, tr, br = vl - - tl.v = vect(-0.5, -0.5, 0.0); tl.t = (0.0, 0.0) - bl.v = vect(-0.5, 0.5, 0.0); bl.t = (0.0, 1.0) - tr.v = vect( 0.5, -0.5, 0.0); tr.t = (1.0, 0.0) - br.v = vect( 0.5, 0.5, 0.0); br.t = (1.0, 1.0) - - self.corners = vl - self.vertexes = [tl, bl, tr, bl, tr, br] - - def set_texture(self): - pass def init(): global mgr