24 : bitmap(
std::move(bitmap))
25 , filtering(filtering) {}
28 : filtering(
std::move(filtering)) {
35 return this->evalNearestNeighbour(uvw);
37 return this->evalBilinear(uvw);
45 cloned.filtering = filtering;
47 for (
int y = 0; y < bitmap.
size().y; ++y) {
48 for (
int x = 0; x < bitmap.
size().x; ++x) {
49 cloned.bitmap[
Pixel(x, y)] = bitmap[
Pixel(x, y)];
56 return bitmap.
empty();
60 Rgba evalNearestNeighbour(
const Vector& uvw)
const {
62 const Size u =
clamp(
int(uvw[
X] * size.
x), 0, size.
x - 1);
63 const Size v =
clamp(
int(uvw[
Y] * size.
y), 0, size.
y - 1);
72 const Size u1 = int(textureUvw[
X]);
73 const Size v1 = int(textureUvw[
Y]);
74 const Size u2 = u1 + 1;
75 const Size v2 = v1 + 1;
76 const float a = float(textureUvw[
X] - u1);
77 const float b = float(textureUvw[
Y] - v1);
81 return Rgba(bitmap[
Pixel(u1, v1)]) * (1.f - a) * (1.f - b) +
82 Rgba(bitmap[
Pixel(u2, v1)]) * a * (1.f - b) +
83 Rgba(bitmap[
Pixel(u1, v2)]) * (1.f - a) * b +
#define SPH_ASSERT(x,...)
#define NOT_IMPLEMENTED
Helper macro marking missing implementation.
Bitmap< Rgba > loadBitmapFromFile(const Path &path)
Wrapper of wxBitmap, will be possibly replaced by custom implementation.
uint32_t Size
Integral type used to index arrays (by default).
Base class for all particle materials.
constexpr INLINE T clamp(const T &f, const T &f1, const T &f2)
#define NAMESPACE_SPH_END
Holder of quantity values and their temporal derivatives.
Container for storing particle quantities and materials.
BasicVector< Float > Vector
Object representing a path on a filesystem.
Rgba eval(const Vector &uvw) const
Texture(Bitmap< Rgba > &&bitmap, const TextureFiltering filtering)
Texture(const Path &path, const TextureFiltering filtering)
Overload of std::swap for Sph::Array.
Object with deleted copy constructor and copy operator.