From efaac8f365deb75d14b41dbd1b89427a3b718fa2 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 18 Feb 2009 23:58:16 +0000 Subject: [PATCH] fix offset --- panda/src/gobj/texturePeeker.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/panda/src/gobj/texturePeeker.cxx b/panda/src/gobj/texturePeeker.cxx index 1c63703bc5..f560e431cf 100644 --- a/panda/src/gobj/texturePeeker.cxx +++ b/panda/src/gobj/texturePeeker.cxx @@ -160,8 +160,8 @@ TexturePeeker(Texture *tex) { //////////////////////////////////////////////////////////////////// void TexturePeeker:: lookup(Colorf &color, float u, float v) const { - int x = int((u - cfloor(u)) * (float)_x_size + 0.5f) % _x_size; - int y = int((v - cfloor(v)) * (float)_y_size + 0.5f) % _y_size; + int x = int((u - cfloor(u)) * (float)_x_size) % _x_size; + int y = int((v - cfloor(v)) * (float)_y_size) % _y_size; nassertv(x >= 0 && x < _x_size && y >= 0 && y < _y_size); const unsigned char *p = _image.p() + (y * _x_size + x) * _pixel_width; @@ -183,9 +183,9 @@ lookup(Colorf &color, float u, float v) const { //////////////////////////////////////////////////////////////////// void TexturePeeker:: lookup(Colorf &color, float u, float v, float w) const { - int x = int((u - cfloor(u)) * (float)_x_size + 0.5f) % _x_size; - int y = int((v - cfloor(v)) * (float)_y_size + 0.5f) % _y_size; - int z = int((w - cfloor(w)) * (float)_z_size + 0.5f) % _z_size; + int x = int((u - cfloor(u)) * (float)_x_size) % _x_size; + int y = int((v - cfloor(v)) * (float)_y_size) % _y_size; + int z = int((w - cfloor(w)) * (float)_z_size) % _z_size; nassertv(x >= 0 && x < _x_size && y >= 0 && y < _y_size && z >= 0 && z < _z_size);