diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-08 23:52:58 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-08 23:52:58 +0400 |
commit | 9b8dae71a5e0f5cccb4031dbe5f07aae01744c82 (patch) | |
tree | 8a575ab4a9e6835eef2175209ee323df883fd0ac /intern/cycles/render/svm.cpp | |
parent | 0f3e1821eae40c7cebfcf199b58370971b57fa35 (diff) |
Cycles: support for environment texture "Mirror Ball" projection mode, next to
existing "Equirectangular". This projection is useful to create light probes
from a chrome ball placed in a real scene. It expects as input a photograph of
the chrome ball, cropped so the ball just fits inside the image boundaries.
Example setup with panorama camera and mixing two (poor quality) photographs
from different viewpoints to avoid stretching and hide the photographer:
http://www.pasteall.org/pic/28036
Diffstat (limited to 'intern/cycles/render/svm.cpp')
-rw-r--r-- | intern/cycles/render/svm.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index ae666ddfe68..46c6149ab32 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -161,6 +161,14 @@ int SVMCompiler::stack_find_offset(ShaderSocketType type) return offset; } +void SVMCompiler::stack_clear_offset(ShaderSocketType type, int offset) +{ + int size = stack_size(type); + + for(int i = 0; i < size; i++) + active_stack.users[offset + i]--; +} + void SVMCompiler::stack_backup(StackBackup& backup, set<ShaderNode*>& done) { backup.done = done; @@ -261,11 +269,7 @@ void SVMCompiler::stack_clear_users(ShaderNode *node, set<ShaderNode*>& done) all_done = false; if(all_done) { - int size = stack_size(output->type); - - for(int i = 0; i < size; i++) - active_stack.users[output->stack_offset + i]--; - + stack_clear_offset(output->type, output->stack_offset); output->stack_offset = SVM_STACK_INVALID; foreach(ShaderInput *in, output->links) @@ -279,11 +283,7 @@ void SVMCompiler::stack_clear_temporary(ShaderNode *node) { foreach(ShaderInput *input, node->inputs) { if(!input->link && input->stack_offset != SVM_STACK_INVALID) { - int size = stack_size(input->type); - - for(int i = 0; i < size; i++) - active_stack.users[input->stack_offset + i]--; - + stack_clear_offset(input->type, input->stack_offset); input->stack_offset = SVM_STACK_INVALID; } } @@ -514,14 +514,14 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& don generate_multi_closure(cl1in->link->parent, done, out1_offset); if(fin) - active_stack.users[out1_offset]--; + stack_clear_offset(SHADER_SOCKET_FLOAT, out1_offset); } if(cl2in->link) { generate_multi_closure(cl2in->link->parent, done, out2_offset); if(fin) - active_stack.users[out2_offset]--; + stack_clear_offset(SHADER_SOCKET_FLOAT, out2_offset); } } else { |