From c50095cab023e91ba2a4fec8dcb290e6d817124b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 6 Dec 2010 21:33:34 +0000 Subject: Re-enabled environment mapping with the skybox as cubemap. --- src/render/image.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/render/image.h') diff --git a/src/render/image.h b/src/render/image.h index 244948e..3182fc8 100644 --- a/src/render/image.h +++ b/src/render/image.h @@ -20,7 +20,7 @@ public: ~Image(); /// pointer to the raw image data - inline unsigned char *data() { + inline unsigned char *ptr() { return image_data; } @@ -28,6 +28,10 @@ public: inline unsigned char *operator[](size_t index) { return &image_data[index]; } + + inline unsigned char *pixel(size_t x, size_t y) { + return &image_data[(y * image_width + x) * image_channels]; + } /// width of the image in pixels inline unsigned int width() const { @@ -61,10 +65,16 @@ public: void swap_channels(); /// flip upside-down - void flip(); + void flip_vertical(); + + /// flip left-right + void flip_horizontal(); /// pad width and height up to 8 bytes void pad(); + + /// load an image + static Image *load(const std::string & name); private: unsigned char *image_data; -- cgit v1.2.3