~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/cycles/render/image.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "device_memory.h"
23
23
 
24
24
#include "util_string.h"
 
25
#include "util_thread.h"
25
26
#include "util_vector.h"
26
27
 
 
28
#include "kernel_types.h"  /* for TEX_NUM_FLOAT_IMAGES */
 
29
 
27
30
CCL_NAMESPACE_BEGIN
28
31
 
29
 
#define TEX_NUM_FLOAT_IMAGES    5
30
32
#define TEX_NUM_IMAGES                  95
31
 
#define TEX_IMAGE_MAX                   (TEX_NUM_IMAGES + TEX_NUM_FLOAT_IMAGES)
32
 
#define TEX_IMAGE_FLOAT_START   TEX_NUM_IMAGES
 
33
#define TEX_IMAGE_BYTE_START    TEX_NUM_FLOAT_IMAGES
 
34
 
 
35
#define TEX_EXTENDED_NUM_FLOAT_IMAGES   5
 
36
#define TEX_EXTENDED_NUM_IMAGES                 512
 
37
#define TEX_EXTENDED_IMAGE_BYTE_START   TEX_EXTENDED_NUM_FLOAT_IMAGES
 
38
 
 
39
/* color to use when textures are not found */
 
40
#define TEX_IMAGE_MISSING_R 1
 
41
#define TEX_IMAGE_MISSING_G 0
 
42
#define TEX_IMAGE_MISSING_B 1
 
43
#define TEX_IMAGE_MISSING_A 1
33
44
 
34
45
class Device;
35
46
class DeviceScene;
40
51
        ImageManager();
41
52
        ~ImageManager();
42
53
 
43
 
        int add_image(const string& filename, bool& is_float);
44
 
        void remove_image(const string& filename);
 
54
        int add_image(const string& filename, void *builtin_data, bool animated, bool& is_float, bool& is_linear);
 
55
        void remove_image(const string& filename, void *builtin_data);
 
56
        bool is_float_image(const string& filename, void *builtin_data, bool& is_linear);
45
57
 
46
58
        void device_update(Device *device, DeviceScene *dscene, Progress& progress);
47
59
        void device_free(Device *device, DeviceScene *dscene);
48
60
 
49
61
        void set_osl_texture_system(void *texture_system);
 
62
        void set_pack_images(bool pack_images_);
 
63
        void set_extended_image_limits(void);
 
64
        bool set_animation_frame_update(int frame);
50
65
 
51
66
        bool need_update;
52
67
 
 
68
        boost::function<void(const string &filename, void *data, bool &is_float, int &width, int &height, int &channels)> builtin_image_info_cb;
 
69
        boost::function<bool(const string &filename, void *data, unsigned char *pixels)> builtin_image_pixels_cb;
 
70
        boost::function<bool(const string &filename, void *data, float *pixels)> builtin_image_float_pixels_cb;
53
71
private:
 
72
        int tex_num_images;
 
73
        int tex_num_float_images;
 
74
        int tex_image_byte_start;
 
75
        thread_mutex device_mutex;
 
76
        int animation_frame;
 
77
 
54
78
        struct Image {
55
79
                string filename;
 
80
                void *builtin_data;
56
81
 
57
82
                bool need_load;
 
83
                bool animated;
58
84
                int users;
59
85
        };
60
86
 
61
87
        vector<Image*> images;
62
88
        vector<Image*> float_images;
63
89
        void *osl_texture_system;
 
90
        bool pack_images;
64
91
 
65
92
        bool file_load_image(Image *img, device_vector<uchar4>& tex_img);
66
93
        bool file_load_float_image(Image *img, device_vector<float4>& tex_img);
67
94
 
68
 
        void device_load_image(Device *device, DeviceScene *dscene, int slot);
 
95
        void device_load_image(Device *device, DeviceScene *dscene, int slot, Progress *progess);
69
96
        void device_free_image(Device *device, DeviceScene *dscene, int slot);
 
97
 
 
98
        void device_pack_images(Device *device, DeviceScene *dscene, Progress& progess);
70
99
};
71
100
 
72
101
CCL_NAMESPACE_END