~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to intern/cycles/blender/blender_object.cpp

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright 2011, Blender Foundation.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU General Public License
6
 
 * as published by the Free Software Foundation; either version 2
7
 
 * of the License, or (at your option) any later version.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 * GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software Foundation,
16
 
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
2
 * Copyright 2011-2013 Blender Foundation
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 * http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License
17
15
 */
18
16
 
19
17
#include "camera.h"
154
152
        light->shader = used_shaders[0];
155
153
 
156
154
        /* shadow */
 
155
        PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
157
156
        PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
158
157
        light->cast_shadow = get_boolean(clamp, "cast_shadow");
159
158
        light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
160
 
        light->samples = get_int(clamp, "samples");
 
159
        
 
160
        int samples = get_int(clamp, "samples");
 
161
        if(get_boolean(cscene, "use_square_samples"))
 
162
                light->samples = samples * samples;
 
163
        else
 
164
                light->samples = samples;
161
165
 
162
166
        /* visibility */
163
167
        uint visibility = object_ray_visibility(b_ob);
174
178
        BL::World b_world = b_scene.world();
175
179
 
176
180
        if(b_world) {
 
181
                PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
177
182
                PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
178
183
                bool sample_as_light = get_boolean(cworld, "sample_as_light");
179
184
 
188
193
                        {
189
194
                                light->type = LIGHT_BACKGROUND;
190
195
                                light->map_resolution  = get_int(cworld, "sample_map_resolution");
191
 
                                light->samples  = get_int(cworld, "samples");
192
196
                                light->shader = scene->default_background;
 
197
                                
 
198
                                int samples = get_int(cworld, "samples");
 
199
                                if(get_boolean(cscene, "use_square_samples"))
 
200
                                        light->samples = samples * samples;
 
201
                                else
 
202
                                        light->samples = samples;
193
203
 
194
204
                                light->tag_update(scene);
195
205
                                light_map.set_recalc(b_world);
286
296
                        object->random_id = hash_int_2d(object->random_id, 0);
287
297
 
288
298
                /* visibility flags for both parent */
289
 
                object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL;
 
299
                object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY;
290
300
                if(b_parent.ptr.data != b_ob.ptr.data) {
291
301
                        object->visibility &= object_ray_visibility(b_parent);
292
302
                        object->random_id ^= hash_int(hash_string(b_parent.name().c_str()));
294
304
 
295
305
                /* make holdout objects on excluded layer invisible for non-camera rays */
296
306
                if(use_holdout && (layer_flag & render_layer.exclude_layer))
297
 
                        object->visibility &= ~(PATH_RAY_ALL - PATH_RAY_CAMERA);
 
307
                        object->visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA);
298
308
 
299
309
                /* camera flag is not actually used, instead is tested
300
310
                 * against render layer flags */
336
346
 
337
347
        bool hair_present = false;
338
348
        bool show_emitter = false;
339
 
        bool hide = false;
 
349
        bool hide_as_dupli_parent = false;
 
350
        bool hide_as_dupli_child_original = false;
340
351
 
341
352
        for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) {
342
353
                if((b_psys->settings().render_type() == BL::ParticleSettings::render_type_PATH) &&
343
354
                   (b_psys->settings().type()==BL::ParticleSettings::type_HAIR))
344
355
                        hair_present = true;
345
356
 
346
 
                if(b_psys->settings().use_render_emitter()) {
347
 
                        hide = false;
 
357
                if(b_psys->settings().use_render_emitter())
348
358
                        show_emitter = true;
349
 
                }
350
359
        }
351
360
 
352
361
        /* duplicators hidden by default, except dupliframes which duplicate self */
353
362
        if(b_ob.is_duplicator())
354
363
                if(top_level || b_ob.dupli_type() != BL::Object::dupli_type_FRAMES)
355
 
                        hide = true;
 
364
                        hide_as_dupli_parent = true;
356
365
 
357
366
        /* hide original object for duplis */
358
367
        BL::Object parent = b_ob.parent();
359
368
        if(parent && object_render_hide_original(b_ob.type(), parent.dupli_type()))
360
369
                if(parent_hide)
361
 
                        hide = true;
362
 
 
363
 
        hide_triangles = (hair_present && !show_emitter);
364
 
        return hide && !show_emitter;
 
370
                        hide_as_dupli_child_original = true;
 
371
        
 
372
        if(show_emitter) {
 
373
                hide_triangles = false;
 
374
                return false;
 
375
        }
 
376
        else if(hair_present) {
 
377
                hide_triangles = true;
 
378
                return hide_as_dupli_child_original;
 
379
        }
 
380
        else {
 
381
                hide_triangles = false;
 
382
                return (hide_as_dupli_parent || hide_as_dupli_child_original);
 
383
        }
365
384
}
366
385
 
367
386
static bool object_render_hide_duplis(BL::Object b_ob)