diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-12 14:59:13 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-12 14:59:13 +0400 |
commit | 7a90af7b5a50bac5bb9fa6bf8ec785dac145a90c (patch) | |
tree | 661f808af738e2d06ee5a436fe4e59b3daa67797 /intern/cycles/render/image.h | |
parent | 5e6917a18e288b06cc8130aa8311453c9893dd0b (diff) |
Packed and generated images support for Cycles
This commit adds support of packed and generated images
for Cycles when using SVM backend. Movies are still not
supported. This changes also doesn't touch OSL which is
much less trivial to adopt for any images which are not
saved to disk.
Implementation details:
- When adding images to Image Manager is now possible
to mark image as builtin. Builtin images will bypass
OIIO loader and will use special loading callbacks.
- Callbacks are set by Blender Session and they're
using C++ RNA interface to obtain needed data (pixels,
dimensions, is_float flag).
- Image Manager assumes file path is used as reference
to a builtin images, but in fact currently image
datablock name is used for reference. This makes it
easy to find an image in BlendData database.
- Added some extra properties to Image RNA:
* channels, which denotes actual number of channels
in ImBuf. This is needed to treat image's pixels
correct (before it wasn't possible because API
used internal number of channels for pixels which
is in fact doesn't correlate with image depth)
* is_float, which is truth if image is stored in
float buffer of ImBuf.
- Implemented string lookup for C++ RNA collections
for cases there's no manual lookup function.
OSL is not supported because it used own image loading
and filtering routines and there's seems to be no API
to feed pre-loaded pixels directly to the library.
Think we'll either need to add some API to support
such kind of feeding or consider OSL does not have
support of packed images at all.
Movies are not supported at this moment because of lack
of RNA API to load specified frame. It's not difficult
to solve, just need to consider what to best here:
* Either write some general python interface for ImBuf
and use it via C++ API, or
* Write a PY API function which will return pixels for
given frame, or
* Use bad-level BKE_* call
Anyway, small steps, further improvements later.
Reviewed by Brecht, thanks!
Diffstat (limited to 'intern/cycles/render/image.h')
-rw-r--r-- | intern/cycles/render/image.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 4d177174971..e39ac14b60f 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -51,9 +51,9 @@ public: ImageManager(); ~ImageManager(); - int add_image(const string& filename, bool animated, bool& is_float); - void remove_image(const string& filename); - bool is_float_image(const string& filename); + int add_image(const string& filename, bool is_builtin, bool animated, bool& is_float); + void remove_image(const string& filename, bool is_builtin); + bool is_float_image(const string& filename, bool is_builtin); void device_update(Device *device, DeviceScene *dscene, Progress& progress); void device_free(Device *device, DeviceScene *dscene); @@ -65,6 +65,9 @@ public: bool need_update; + boost::function<void(const string &filename, bool &is_float, int &width, int &height, int &channels)> builtin_image_info_cb; + boost::function<bool(const string &filename, unsigned char *pixels)> builtin_image_pixels_cb; + boost::function<bool(const string &filename, float *pixels)> builtin_image_float_pixels_cb; private: int tex_num_images; int tex_num_float_images; @@ -74,6 +77,7 @@ private: struct Image { string filename; + bool is_builtin; bool need_load; bool animated; |