[Bf-blender-cvs] [80d0911] cycles-ptex-49: Consistently use "ptex_rects" instead of "ptex_regions"
Nicholas Bishop
noreply at git.blender.org
Thu Feb 12 20:31:47 CET 2015
Commit: 80d0911bfe1833acf17cad766d4a384396c64525
Author: Nicholas Bishop
Date: Thu Feb 12 20:30:55 2015 +0100
Branches: cycles-ptex-49
https://developer.blender.org/rB80d0911bfe1833acf17cad766d4a384396c64525
Consistently use "ptex_rects" instead of "ptex_regions"
===================================================================
M intern/cycles/blender/blender_session.cpp
M intern/cycles/blender/blender_session.h
M intern/cycles/render/image.cpp
M intern/cycles/render/image.h
M source/blender/blenkernel/intern/bke_ptex.c
M source/blender/editors/sculpt_paint/paint_image.c
M source/blender/editors/sculpt_paint/paint_image_proj.c
M source/blender/gpu/intern/gpu_draw.c
M source/blender/gpu/intern/gpu_extensions.c
M source/blender/imbuf/IMB_imbuf_types.h
M source/blender/imbuf/intern/allocimbuf.c
M source/blender/imbuf/intern/imb_ptex.c
M source/blender/makesrna/intern/rna_image.c
M source/blender/nodes/shader/nodes/node_shader_tex_image.c
===================================================================
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index db70bad..4fd7e51 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -927,7 +927,7 @@ int BlenderSession::builtin_image_frame(const string &builtin_name)
return atoi(builtin_name.substr(last + 1, builtin_name.size() - last - 1).c_str());
}
-void BlenderSession::builtin_image_info(const string &builtin_name, void *builtin_data, bool &is_float, int &width, int &height, int &depth, int &channels, int &num_ptex_regions)
+void BlenderSession::builtin_image_info(const string &builtin_name, void *builtin_data, bool &is_float, int &width, int &height, int &depth, int &channels, int &num_ptex_rects)
{
/* empty image */
is_float = false;
@@ -956,7 +956,7 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
// TODO: ptex
is_float = false;
- num_ptex_regions = b_image.ptex_regions().length;
+ num_ptex_rects = b_image.ptex_rects().length;
}
else if(b_id.is_a(&RNA_Object)) {
/* smoke volume data */
@@ -986,7 +986,7 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
}
bool BlenderSession::builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels,
- PtexRegions ptex_regions, const int num_ptex_regions)
+ PtexRegions ptex_rects, const int num_ptex_rects)
{
if(!builtin_data)
return false;
@@ -1026,10 +1026,10 @@ bool BlenderSession::builtin_image_pixels(const string &builtin_name, void *buil
{
// TODO
- BL::DynamicArray<int> regions = b_image.ptex_regions();
- assert(num_ptex_regions == regions.length);
- memcpy(ptex_regions, regions.data,
- sizeof(**ptex_regions) * num_ptex_regions);
+ BL::DynamicArray<int> regions = b_image.ptex_rects();
+ assert(num_ptex_rects == regions.length);
+ memcpy(ptex_rects, regions.data,
+ sizeof(**ptex_rects) * num_ptex_rects);
}
/* premultiply, byte images are always straight for blender */
diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h
index 0eeabda..3dac192 100644
--- a/intern/cycles/blender/blender_session.h
+++ b/intern/cycles/blender/blender_session.h
@@ -104,9 +104,9 @@ protected:
void do_write_update_render_tile(RenderTile& rtile, bool do_update_only);
int builtin_image_frame(const string &builtin_name);
- void builtin_image_info(const string &builtin_name, void *builtin_data, bool &is_float, int &width, int &height, int &depth, int &channels, int &num_ptex_regions);
+ void builtin_image_info(const string &builtin_name, void *builtin_data, bool &is_float, int &width, int &height, int &depth, int &channels, int &num_ptex_rects);
bool builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels,
- PtexRegions ptex_regions, int num_ptex_regions);
+ PtexRegions ptex_rects, int num_ptex_rects);
bool builtin_image_float_pixels(const string &builtin_name, void *builtin_data, float *pixels);
};
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 4cd2124..7275574 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -100,8 +100,8 @@ bool ImageManager::is_float_image(const string& filename, void *builtin_data, bo
if(builtin_data) {
if(builtin_image_info_cb) {
int width, height, depth, channels;
- int num_ptex_regions;
- builtin_image_info_cb(filename, builtin_data, is_float, width, height, depth, channels, num_ptex_regions);
+ int num_ptex_rects;
+ builtin_image_info_cb(filename, builtin_data, is_float, width, height, depth, channels, num_ptex_rects);
}
if(is_float)
@@ -359,7 +359,7 @@ static PtexRegions ptex_table_reserve(DeviceScene *dscene,
const int texture_slot,
const int texture_width,
const int texture_height,
- const int num_ptex_regions)
+ const int num_ptex_rects)
{
// Simple encoding (not necessarily a good one):
//
@@ -374,7 +374,7 @@ static PtexRegions ptex_table_reserve(DeviceScene *dscene,
uint offset = dscene->ptex_table.size();
uint *table_data = dscene->ptex_table.resize(offset +
2 +
- num_ptex_regions);
+ num_ptex_rects);
table_data[texture_slot] = offset;
table_data[offset] = texture_width;
offset++;
@@ -427,7 +427,7 @@ static PtexRegions ptex_table_reserve(DeviceScene *dscene,
const int texture_slot,
const int texture_width,
const int texture_height,
- const int num_ptex_regions)
+ const int num_ptex_rects)
{
return NULL;
}
@@ -443,7 +443,7 @@ bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img,
int width, height, depth, components;
bool use_ptex_file = false;
- int num_ptex_regions = 0;
+ int num_ptex_rects = 0;
if(!img->builtin_data) {
/* load image from file through OIIO */
in = ImageInput::create(img->filename);
@@ -479,7 +479,7 @@ bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img,
return false;
bool is_float;
- builtin_image_info_cb(img->filename, img->builtin_data, is_float, width, height, depth, components, num_ptex_regions);
+ builtin_image_info_cb(img->filename, img->builtin_data, is_float, width, height, depth, components, num_ptex_rects);
}
/* we only handle certain number of components */
@@ -540,15 +540,15 @@ bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img,
delete in;
}
else if (!use_ptex_file) {
- PtexRegions ptex_regions;
+ PtexRegions ptex_rects;
thread_scoped_lock device_lock(device_mutex);
- ptex_regions = ptex_table_reserve(dscene, slot - 1024, width,
- height, num_ptex_regions);
+ ptex_rects = ptex_table_reserve(dscene, slot - 1024, width,
+ height, num_ptex_rects);
builtin_image_pixels_cb(img->filename, img->builtin_data, pixels,
- ptex_regions, num_ptex_regions);
+ ptex_rects, num_ptex_rects);
}
if(cmyk) {
@@ -635,8 +635,8 @@ bool ImageManager::file_load_float_image(Image *img, device_vector<float4>& tex_
return false;
bool is_float;
- int num_ptex_regions;
- builtin_image_info_cb(img->filename, img->builtin_data, is_float, width, height, depth, components, num_ptex_regions);
+ int num_ptex_rects;
+ builtin_image_info_cb(img->filename, img->builtin_data, is_float, width, height, depth, components, num_ptex_rects);
}
if(components < 1 || width == 0 || height == 0) {
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 4462862..9eddf00 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -73,8 +73,8 @@ public:
bool need_update;
- boost::function<void(const string &filename, void *data, bool &is_float, int &width, int &height, int &depth, int &channels, int &num_ptex_regions)> builtin_image_info_cb;
- boost::function<bool(const string &filename, void *data, unsigned char *pixels, PtexRegions ptex_regions, int num_ptex_regions)> builtin_image_pixels_cb;
+ boost::function<void(const string &filename, void *data, bool &is_float, int &width, int &height, int &depth, int &channels, int &num_ptex_rects)> builtin_image_info_cb;
+ boost::function<bool(const string &filename, void *data, unsigned char *pixels, PtexRegions ptex_rects, int num_ptex_rects)> builtin_image_pixels_cb;
boost::function<bool(const string &filename, void *data, float *pixels)> builtin_image_float_pixels_cb;
struct Image {
diff --git a/source/blender/blenkernel/intern/bke_ptex.c b/source/blender/blenkernel/intern/bke_ptex.c
index b56c97c..2ce2efc 100644
--- a/source/blender/blenkernel/intern/bke_ptex.c
+++ b/source/blender/blenkernel/intern/bke_ptex.c
@@ -581,8 +581,8 @@ static bool bke_ptex_imbuf_filter_borders_update(ImBuf *ibuf, GSet *rects)
return false;
}
- all_rects = ibuf->ptex_regions;
- rects_stride = sizeof(*ibuf->ptex_regions);
+ all_rects = ibuf->ptex_rects;
+ rects_stride = sizeof(*ibuf->ptex_rects);
if (rects) {
/* TODO(nicholasbishop): this is not a great
@@ -624,8 +624,8 @@ static bool bke_ptex_imbuf_filter_borders_update(ImBuf *ibuf, GSet *rects)
}
else {
int i;
- for (i = 0; i < ibuf->num_ptex_regions; i++) {
- const BPXRect *rect = &ibuf->ptex_regions[i];
+ for (i = 0; i < ibuf->num_ptex_rects; i++) {
+ const BPXRect *rect = &ibuf->ptex_rects[i];
if (!BPX_rect_borders_update(bpx_buf, rect, all_rects,
rects_stride))
{
@@ -694,7 +694,7 @@ static bool ptex_pack_loops(Image **image_r, Mesh *me, MLoopPtex *loop_ptex,
for (i = 0; i < num_loops; i++) {
MLoopPtex *lp = &loop_ptex[i];
BPXImageBuf *bpx_src = bpx_image_buf_wrap_loop_ptex(lp);
- const BPXRect *rect = &ibuf->ptex_regions[i];
+ const BPXRect *rect = &ibuf->ptex_rects[i];
bool r;
BLI_assert(bpx_src);
@@ -1121,8 +1121,8 @@ bool BKE_ptex_update_from_image(MLoopPtex *loop_ptex, const int totloop)
// TODO
BLI_assert(ibuf->rect);
- BLI_assert(ibuf->num_ptex_regions == totloop);
- BLI_assert(ibuf->ptex_regions);
+ BLI_assert(ibuf->num_ptex_rects == totloop);
+ BLI_assert(ibuf->ptex_rects);
bpx_src = IMB_imbuf_as_bpx_image_buf(ibuf);
if (!bpx_src) {
@@ -1132,7 +1132,7 @@ bool BKE_ptex_update_from_image(MLoopPtex *loop_ptex, const int totloop)
for (i = 0; i < totloop; i++) {
MLoopPtex *lp = &loop_ptex[i];
BPXImageBuf *bpx_dst = bpx_image_buf_wrap_loop_ptex(lp);
- const BPXRect *src_rect = &ibuf->ptex_regions[i];
+ const BPXRect *src_rect = &ibuf->ptex_rects[i];
BLI_assert(bpx_dst);
if (!bpx_dst) {
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index a2dcec6..4e92b7f 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -279,7 +279,7 @@ void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int x_tile,
if (full_ptex) {
tile->ptex = MEM_callocN(sizeof(*tile->ptex), "tile->ptex");
- tile->ptex->rects = MEM_dupallocN(ibuf->ptex_regions);
+ tile->ptex->rects = MEM_dupalloc
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list