Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-04 15:48:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-04 15:48:42 +0400
commit16e6b7b867778fb041dd7cbe10cb83e8b3de0920 (patch)
tree99b2f929af5f1bb609cc9a26ab0da61da6f6df01
parent778999cbbf6d6430f6c8d75d8d9e2ea49fa8ace6 (diff)
cycles changes:
- images that can't be loaded because of the limit are printed in the console. - textures that can't be found show up as pink (so we know somethings wrong).
-rw-r--r--intern/cycles/render/image.cpp30
-rw-r--r--intern/cycles/render/image.h6
-rw-r--r--intern/cycles/render/nodes.cpp12
3 files changed, 32 insertions, 16 deletions
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index dc20dbdbea2..1af0972ecf9 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -109,8 +109,11 @@ int ImageManager::add_image(const string& filename, bool& is_float)
if(slot == float_images.size()) {
/* max images limit reached */
- if(float_images.size() == TEX_NUM_FLOAT_IMAGES)
+ if(float_images.size() == TEX_NUM_FLOAT_IMAGES) {
+ printf("ImageManager::add_image: byte image limit reached %d, skipping '%s'\n",
+ TEX_NUM_IMAGES, filename.c_str());
return -1;
+ }
float_images.resize(float_images.size() + 1);
}
@@ -141,8 +144,11 @@ int ImageManager::add_image(const string& filename, bool& is_float)
if(slot == images.size()) {
/* max images limit reached */
- if(images.size() == TEX_NUM_IMAGES)
+ if(images.size() == TEX_NUM_IMAGES) {
+ printf("ImageManager::add_image: byte image limit reached %d, skipping '%s'\n",
+ TEX_NUM_IMAGES, filename.c_str());
return -1;
+ }
images.resize(images.size() + 1);
}
@@ -353,13 +359,13 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
device->tex_free(tex_img);
if(!file_load_float_image(img, tex_img)) {
- /* on failure to load, we set a 1x1 pixels black image */
+ /* on failure to load, we set a 1x1 pixels pink image */
float *pixels = (float*)tex_img.resize(1, 1);
- pixels[0] = 0.0f;
- pixels[1] = 0.0f;
- pixels[2] = 0.0f;
- pixels[3] = 0.0f;
+ pixels[0] = TEX_IMAGE_MISSING_R;
+ pixels[1] = TEX_IMAGE_MISSING_G;
+ pixels[2] = TEX_IMAGE_MISSING_B;
+ pixels[3] = TEX_IMAGE_MISSING_A;
}
string name;
@@ -380,13 +386,13 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
device->tex_free(tex_img);
if(!file_load_image(img, tex_img)) {
- /* on failure to load, we set a 1x1 pixels black image */
+ /* on failure to load, we set a 1x1 pixels pink image */
uchar *pixels = (uchar*)tex_img.resize(1, 1);
- pixels[0] = 0;
- pixels[1] = 0;
- pixels[2] = 0;
- pixels[3] = 0;
+ pixels[0] = (TEX_IMAGE_MISSING_R * 255);
+ pixels[1] = (TEX_IMAGE_MISSING_G * 255);
+ pixels[2] = (TEX_IMAGE_MISSING_B * 255);
+ pixels[3] = (TEX_IMAGE_MISSING_A * 255);
}
string name;
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 2b5e53cabe1..ef046cfcafb 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -31,6 +31,12 @@ CCL_NAMESPACE_BEGIN
#define TEX_IMAGE_MAX (TEX_NUM_IMAGES + TEX_NUM_FLOAT_IMAGES)
#define TEX_IMAGE_FLOAT_START TEX_NUM_IMAGES
+/* color to use when textures are not found */
+#define TEX_IMAGE_MISSING_R 1
+#define TEX_IMAGE_MISSING_G 0
+#define TEX_IMAGE_MISSING_B 1
+#define TEX_IMAGE_MISSING_A 1
+
class Device;
class DeviceScene;
class Progress;
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 0f64d858de0..e4a4b874964 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -184,10 +184,12 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
/* image not found */
if(!color_out->links.empty()) {
compiler.add_node(NODE_VALUE_V, color_out->stack_offset);
- compiler.add_node(NODE_VALUE_V, make_float3(0, 0, 0));
+ compiler.add_node(NODE_VALUE_V, make_float3(TEX_IMAGE_MISSING_R,
+ TEX_IMAGE_MISSING_G,
+ TEX_IMAGE_MISSING_B));
}
if(!alpha_out->links.empty())
- compiler.add_node(NODE_VALUE_F, __float_as_int(0.0f), alpha_out->stack_offset);
+ compiler.add_node(NODE_VALUE_F, __float_as_int(TEX_IMAGE_MISSING_A), alpha_out->stack_offset);
}
}
@@ -288,10 +290,12 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
/* image not found */
if(!color_out->links.empty()) {
compiler.add_node(NODE_VALUE_V, color_out->stack_offset);
- compiler.add_node(NODE_VALUE_V, make_float3(0, 0, 0));
+ compiler.add_node(NODE_VALUE_V, make_float3(TEX_IMAGE_MISSING_R,
+ TEX_IMAGE_MISSING_G,
+ TEX_IMAGE_MISSING_B));
}
if(!alpha_out->links.empty())
- compiler.add_node(NODE_VALUE_F, __float_as_int(0.0f), alpha_out->stack_offset);
+ compiler.add_node(NODE_VALUE_F, __float_as_int(TEX_IMAGE_MISSING_A), alpha_out->stack_offset);
}
}