public Vec3 GetColor(ShadeRec sr) { int row = 0, column = 0; if (mapping != null) { mapping.GetTexelCoordinates(sr.LocalHitPoint, hres, vres, ref row, ref column); } else { row = (int)(sr.V * (vres - 1)); column = (int)(sr.U * (hres - 1)); } return(image.GetColor(row, column)); }