2
* Copyright 2011, Blender Foundation.
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.
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.
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
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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
19
17
#include "camera.h"
154
152
light->shader = used_shaders[0];
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");
160
int samples = get_int(clamp, "samples");
161
if(get_boolean(cscene, "use_square_samples"))
162
light->samples = samples * samples;
164
light->samples = samples;
163
167
uint visibility = object_ray_visibility(b_ob);
174
178
BL::World b_world = b_scene.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");
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;
198
int samples = get_int(cworld, "samples");
199
if(get_boolean(cscene, "use_square_samples"))
200
light->samples = samples * samples;
202
light->samples = samples;
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);
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()));
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);
299
309
/* camera flag is not actually used, instead is tested
300
310
* against render layer flags */
337
347
bool hair_present = false;
338
348
bool show_emitter = false;
349
bool hide_as_dupli_parent = false;
350
bool hide_as_dupli_child_original = false;
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;
346
if(b_psys->settings().use_render_emitter()) {
357
if(b_psys->settings().use_render_emitter())
348
358
show_emitter = true;
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)
364
hide_as_dupli_parent = true;
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()))
363
hide_triangles = (hair_present && !show_emitter);
364
return hide && !show_emitter;
370
hide_as_dupli_child_original = true;
373
hide_triangles = false;
376
else if(hair_present) {
377
hide_triangles = true;
378
return hide_as_dupli_child_original;
381
hide_triangles = false;
382
return (hide_as_dupli_parent || hide_as_dupli_child_original);
367
386
static bool object_render_hide_duplis(BL::Object b_ob)