1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
|
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributor(s): Blender Foundation (2008).
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <stdlib.h>
#include "RNA_define.h"
#include "RNA_types.h"
#include "rna_internal.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
#include "WM_types.h"
#ifdef RNA_RUNTIME
static void rna_Lamp_buffer_size_set(PointerRNA *ptr, int value)
{
Lamp *la= (Lamp*)ptr->data;
CLAMP(value, 512, 10240);
la->bufsize= value;
la->bufsize &= (~15); /* round to multiple of 16 */
}
static PointerRNA rna_Lamp_sky_settings_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_LampSkySettings, ptr->id.data);
}
static void rna_Lamp_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Lamp *la= (Lamp*)ptr->data;
rna_iterator_array_begin(iter, (void*)la->mtex, sizeof(MTex*), MAX_MTEX, NULL);
}
static PointerRNA rna_Lamp_active_texture_get(PointerRNA *ptr)
{
Lamp *la= (Lamp*)ptr->data;
return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, la->mtex[(int)la->texact]);
}
static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
{
Lamp *la= (Lamp*)ptr->data;
switch(la->type) {
case LA_LOCAL:
return &RNA_LocalLamp;
case LA_SUN:
return &RNA_SunLamp;
case LA_SPOT:
return &RNA_SpotLamp;
case LA_HEMI:
return &RNA_HemiLamp;
case LA_AREA:
return &RNA_AreaLamp;
default:
return &RNA_Lamp;
}
}
#else
static void rna_def_lamp_mtex(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem prop_texture_coordinates_items[] = {
{TEXCO_GLOB, "GLOBAL", "Global", "Uses global coordinates for the texture coordinates."},
{TEXCO_VIEW, "VIEW", "View", "Uses view coordinates for the texture coordinates."},
{TEXCO_OBJECT, "OBJECT", "Object", "Uses linked object's coordinates for texture coordinates."},
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "LampTextureSlot", "TextureSlot");
RNA_def_struct_sdna(srna, "MTex");
RNA_def_struct_ui_text(srna, "Lamp Texture Slot", "Texture slot for textures in a Lamp datablock.");
prop= RNA_def_property(srna, "texture_coordinates", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "texco");
RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
RNA_def_property_ui_text(prop, "Texture Coordinates", "");
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "object");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates.");
prop= RNA_def_property(srna, "map_to_color", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_COL);
RNA_def_property_ui_text(prop, "Map To Color", "Lets the texture affect the basic color of the lamp.");
prop= RNA_def_property(srna, "map_to_shadow", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_SHAD);
RNA_def_property_ui_text(prop, "Map To Shadow", "Lets the texture affect the shadow color of the lamp.");
}
static void rna_def_lamp_sky_settings(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem prop_skycolorspace_items[] = {
{0, "SMPTE", "SMPTE", ""},
{1, "REC709", "REC709", ""},
{2, "CIE", "CIE", ""},
{0, NULL, NULL, NULL}};
static EnumPropertyItem prop_blendmode_items[] = {
{0, "MIX", "Mix", ""},
{1, "ADD", "Add", ""},
{2, "MULTIPLY", "Multiply", ""},
{3, "SUBTRACT", "Subtract", ""},
{4, "SCREEN", "Screen", ""},
{5, "DIVIDE", "Divide", ""},
{6, "DIFFERENCE", "Difference", ""},
{7, "DARKEN", "Darken", ""},
{8, "LIGHTEN", "Lighten", ""},
{9, "OVERLAY", "Overlay", ""},
{10, "DODGE", "Dodge", ""},
{11, "BURN", "Burn", ""},
{12, "HUE", "Hue", ""},
{13, "SATURATION", "Saturation", ""},
{14, "VALUE", "Value", ""},
{15, "COLOR", "Color", ""},
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "LampSkySettings", NULL);
RNA_def_struct_sdna(srna, "Lamp");
RNA_def_struct_nested(brna, srna, "SunLamp");
RNA_def_struct_ui_text(srna, "Lamp Sky Settings", "Sky related settings for a sun lamp.");
prop= RNA_def_property(srna, "sky_color_space", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "sky_colorspace");
RNA_def_property_enum_items(prop, prop_skycolorspace_items);
RNA_def_property_ui_text(prop, "Sky Color Space", "Color space to use for internal XYZ->RGB color conversion.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "sky_blend_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "skyblendtype");
RNA_def_property_enum_items(prop, prop_blendmode_items);
RNA_def_property_ui_text(prop, "Sky Blend Mode", "Blend mode for combining sun sky with world sky.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
/* Number values */
prop= RNA_def_property(srna, "horizon_brightness", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 20.0f);
RNA_def_property_ui_text(prop, "Horizon Brightness", "Horizon brightness.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "spread", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Horizon Spread", "Horizon Spread.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "sun_brightness", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Sun Brightness", "Sun brightness.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Sun Size", "Sun size.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "backscattered_light", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Backscattered Light", "Backscattered light.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Sun Intensity", "Sun intensity.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "atmosphere_turbidity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "atm_turbidity");
RNA_def_property_range(prop, 0.0f, 30.0f);
RNA_def_property_ui_text(prop, "Atmosphere Turbidity", "Sky turbidity.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "atmosphere_inscattering", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "atm_inscattering_factor");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Atmosphere Inscatter", "Scatter contribution factor.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "atmosphere_extinction", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "atm_extinction_factor");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Atmosphere Extinction", "Extinction scattering contribution factor.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "atmosphere_distance_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "atm_distance_factor");
RNA_def_property_range(prop, 0.0f, 500.0f);
RNA_def_property_ui_text(prop, "Atmosphere Distance Factor", "Multiplier to convert blender units to physical distance.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "sky_blend", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "skyblendfac");
RNA_def_property_range(prop, 0.0f, 2.0f);
RNA_def_property_ui_text(prop, "Sky Blend", "Blend factor with sky.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "sky_exposure", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 20.0f);
RNA_def_property_ui_text(prop, "Sky Exposure", "Strength of sky shading exponential exposure correction.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
/* boolean */
prop= RNA_def_property(srna, "sky", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_SKY);
RNA_def_property_ui_text(prop, "Sky", "Apply sun effect on sky.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
prop= RNA_def_property(srna, "atmosphere", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_AP);
RNA_def_property_ui_text(prop, "Atmosphere", "Apply sun effect on atmosphere.");
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
}
static void rna_def_lamp(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem prop_type_items[] = {
{LA_LOCAL, "LOCAL", "Local", "Omnidirectional point light source."},
{LA_SUN, "SUN", "Sun", "Constant direction parallel ray light source."},
{LA_SPOT, "SPOT", "Spot", "Directional cone light source."},
{LA_HEMI, "HEMI", "Hemi", "180 degree constant light source."},
{LA_AREA, "AREA", "Area", "Directional area light source."},
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "Lamp", "ID");
RNA_def_struct_refine_func(srna, "rna_Lamp_refine");
RNA_def_struct_ui_text(srna, "Lamp", "Lamp datablock for lighting a scene.");
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_type_items);
RNA_def_property_ui_text(prop, "Type", "Type of Lamp.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_range(prop, 0.0f, 9999.0f);
RNA_def_property_ui_text(prop, "Distance", "Falloff distance - the light is at half the original intensity at this point.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Energy", "Amount of light that the lamp emits.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "r");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Color", "Light color.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_LAYER);
RNA_def_property_ui_text(prop, "Layer", "Illuminates objects only on the same layer the lamp is on.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "negative", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_NEG);
RNA_def_property_ui_text(prop, "Negative", "Lamp casts negative light.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "specular", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_SPEC);
RNA_def_property_ui_text(prop, "Specular", "Lamp creates specular highlights.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "diffuse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_DIFF);
RNA_def_property_ui_text(prop, "Diffuse", "Lamp does diffuse shading.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
/* textures */
rna_def_mtex_common(srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get", "LampTextureSlot");
/* script link */
prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "scriptlink");
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this lamp.");
}
static void rna_def_lamp_falloff(StructRNA *srna)
{
PropertyRNA *prop;
static EnumPropertyItem prop_fallofftype_items[] = {
{LA_FALLOFF_CONSTANT, "CONSTANT", "Constant", ""},
{LA_FALLOFF_INVLINEAR, "INVERSE_LINEAR", "Inverse Linear", ""},
{LA_FALLOFF_INVSQUARE, "INVERSE_SQUARE", "Inverse Square", ""},
{LA_FALLOFF_CURVE, "CUSTOM_CURVE", "Custom Curve", ""},
{LA_FALLOFF_SLIDERS, "LINEAR_QUADRATIC_WEIGHTED", "Lin/Quad Weighted", ""},
{0, NULL, NULL, NULL}};
prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* needs to be able to create curve mapping */
RNA_def_property_enum_items(prop, prop_fallofftype_items);
RNA_def_property_ui_text(prop, "Falloff Type", "Intensity Decay with distance.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "sphere", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SPHERE);
RNA_def_property_ui_text(prop, "Sphere", "Sets light intensity to zero beyond lamp distance.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "att1");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Linear Attenuation", "Linear distance attentuation.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "att2");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Quadratic Attenuation", "Quadratic distance attentuation.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
}
static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
{
PropertyRNA *prop;
static EnumPropertyItem prop_shadow_items[] = {
{0, "NOSHADOW", "No Shadow", ""},
{LA_SHAD_RAY, "RAY_SHADOW", "Ray Shadow", "Use ray tracing for shadow."},
{0, NULL, NULL, NULL}};
static EnumPropertyItem prop_spot_shadow_items[] = {
{0, "NOSHADOW", "No Shadow", ""},
{LA_SHAD_BUF, "BUFFER_SHADOW", "Buffer Shadow", "Lets spotlight produce shadows using shadow buffer."},
{LA_SHAD_RAY, "RAY_SHADOW", "Ray Shadow", "Use ray tracing for shadow."},
{0, NULL, NULL, NULL}};
static EnumPropertyItem prop_ray_sampling_method_items[] = {
{LA_SAMP_CONSTANT, "CONSTANT_JITTERED", "Constant Jittered", ""},
{LA_SAMP_HALTON, "ADAPTIVE_QMC", "Adaptive QMC", ""},
{LA_SAMP_HAMMERSLEY, "CONSTANT_QMC", "Constant QMC", ""},
{0, NULL, NULL, NULL}};
prop= RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
RNA_def_property_enum_items(prop, (spot)? prop_spot_shadow_items: prop_shadow_items);
RNA_def_property_ui_text(prop, "Shadow Method", "Method to compute lamp shadow with.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "shdwr");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Shadow Color", "Color of shadows casted by the lamp.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "only_shadow", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_ONLYSHADOW);
RNA_def_property_ui_text(prop, "Only Shadow", "Causes light to cast shadows only without illuminating objects.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_ray_sampling_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "ray_samp_method");
RNA_def_property_enum_items(prop, prop_ray_sampling_method_items);
RNA_def_property_ui_text(prop, "Shadow Ray Sampling Method", "Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, (area)? "shadow_ray_samples_x": "shadow_ray_samples", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ray_samp");
RNA_def_property_range(prop, 1, 16);
RNA_def_property_ui_text(prop, (area)? "Shadow Ray Samples": "Shadow Ray Samples X","Amount of samples taken extra (samples x samples).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
if(area) {
prop= RNA_def_property(srna, "shadow_ray_samples_y", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ray_sampy");
RNA_def_property_range(prop, 1, 16);
RNA_def_property_ui_text(prop, "Shadow Ray Samples Y", "Amount of samples taken extra (samples x samples).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
}
prop= RNA_def_property(srna, "shadow_adaptive_threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "adapt_thresh");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Shadow Adaptive Threshold", "Threshold for Adaptive Sampling (Raytraced shadows).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "soft");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_LAYER_SHADOW);
RNA_def_property_ui_text(prop, "Shadow Layer", "Causes only objects on the same layer to cast shadows.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
}
static void rna_def_local_lamp(BlenderRNA *brna)
{
StructRNA *srna;
srna= RNA_def_struct(brna, "LocalLamp", "Lamp");
RNA_def_struct_sdna(srna, "Lamp");
RNA_def_struct_ui_text(srna, "Local Lamp", "Omnidirectional point lamp.");
rna_def_lamp_falloff(srna);
rna_def_lamp_shadow(srna, 0, 0);
}
static void rna_def_area_lamp(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem prop_areashape_items[] = {
{LA_AREA_SQUARE, "SQUARE", "Square", ""},
{LA_AREA_RECT, "RECTANGLE", "Rectangle", ""},
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "AreaLamp", "Lamp");
RNA_def_struct_sdna(srna, "Lamp");
RNA_def_struct_ui_text(srna, "Area Lamp", "Directional area lamp.");
rna_def_lamp_shadow(srna, 0, 1);
prop= RNA_def_property(srna, "umbra", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_UMBRA);
RNA_def_property_ui_text(prop, "Umbra", "Emphasize parts that are fully shadowed (Constant Jittered sampling).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "dither", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_DITHER);
RNA_def_property_ui_text(prop, "Dither", "Use 2x2 dithering for sampling (Constant Jittered sampling).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "jitter", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_JITTER);
RNA_def_property_ui_text(prop, "Jitter", "Use noise for sampling (Constant Jittered sampling).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "area_shape");
RNA_def_property_enum_items(prop, prop_areashape_items);
RNA_def_property_ui_text(prop, "Shape", "Shape of the area lamp.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "area_size");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Size", "Size of the area of the area Lamp, X direction size for Rectangle shapes.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "area_sizey");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Size Y", "Size of the area of the area Lamp in the Y direction for Rectangle shapes.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "k");
RNA_def_property_range(prop, 0.001f, 2.0f);
RNA_def_property_ui_text(prop, "Gamma", "Light gamma correction value.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
}
static void rna_def_spot_lamp(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem prop_shadbuftype_items[] = {
{LA_SHADBUF_REGULAR , "REGULAR", "Classical", "Classic shadow buffer."},
{LA_SHADBUF_IRREGULAR, "IRREGULAR", "Irregular", "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing."},
{LA_SHADBUF_HALFWAY, "HALFWAY", "Classic-Halfway", "Regular buffer, averaging the closest and 2nd closest Z value to reducing bias artifaces."},
{0, NULL, NULL, NULL}};
static EnumPropertyItem prop_shadbuffiltertype_items[] = {
{LA_SHADBUF_BOX , "BOX", "Box", "Apply the Box filter to shadow buffer samples."},
{LA_SHADBUF_TENT, "TENT", "Tent", "Apply the Tent Filter to shadow buffer samples."},
{LA_SHADBUF_GAUSS, "GAUSS", "Gauss", "Apply the Gauss filter to shadow buffer samples."},
{0, NULL, NULL, NULL}};
static EnumPropertyItem prop_numbuffer_items[] = {
{1, "BUFFERS_1", "1", "Only one buffer rendered."},
{4, "BUFFERS_4", "4", "Renders 4 buffers for better AA, this quadruples memory usage."},
{9, "BUFFERS_9", "9", "Renders 9 buffers for better AA, this uses nine times more memory."},
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "SpotLamp", "Lamp");
RNA_def_struct_sdna(srna, "Lamp");
RNA_def_struct_ui_text(srna, "Spot Lamp", "Directional cone lamp.");
rna_def_lamp_falloff(srna);
rna_def_lamp_shadow(srna, 1, 0);
prop= RNA_def_property(srna, "square", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SQUARE);
RNA_def_property_ui_text(prop, "Square", "Casts a square spot light shape.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "halo", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_HALO);
RNA_def_property_ui_text(prop, "Halo", "Renders spotlight with a volumetric halo (Buffer Shadows).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "halo_intensity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "haint");
RNA_def_property_range(prop, 0.0f, 5.0f);
RNA_def_property_ui_text(prop, "Halo Intensity", "Brightness of the spotlight's halo cone (Buffer Shadows).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "halo_step", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "shadhalostep");
RNA_def_property_range(prop, 0, 12);
RNA_def_property_ui_text(prop, "Halo Step", "Volumetric halo sampling frequency.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "bufsize");
RNA_def_property_range(prop, 512, 10240);
RNA_def_property_ui_text(prop, "Shadow Buffer Size", "Resolution of the shadow buffer, higher values give crisper shadows but use more memory");
RNA_def_property_int_funcs(prop, NULL, "rna_Lamp_buffer_size_set", NULL);
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_filter_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "filtertype");
RNA_def_property_enum_items(prop, prop_shadbuffiltertype_items);
RNA_def_property_ui_text(prop, "Shadow Filter Type", "Type of shadow filter (Buffer Shadows).");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_sample_buffers", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "buffers");
RNA_def_property_enum_items(prop, prop_numbuffer_items);
RNA_def_property_ui_text(prop, "Shadow Sample Buffers", "Number of shadow buffers to render for better AA, this increases memory usage.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spotblend");
RNA_def_property_range(prop, 0.0f ,1.0f);
RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spotsize");
RNA_def_property_range(prop, 1.0f ,180.0f);
RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam in degrees.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "clipsta");
RNA_def_property_range(prop, 0.0f, 9999.0f);
RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start", "Shadow map clip start: objects closer will not generate shadows");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "clipend");
RNA_def_property_range(prop, 0.0f, 9999.0f);
RNA_def_property_ui_text(prop, "Shadow Buffer Clip End", "Shadow map clip end beyond which objects will not generate shadows.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "bias");
RNA_def_property_range(prop, 0.0f, 5.0f);
RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Shadow buffer sampling bias.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_buffer_soft", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "soft");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Shadow Buffer Soft", "Size of shadow buffer sampling area.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "samp");
RNA_def_property_range(prop, 1, 16);
RNA_def_property_ui_text(prop, "Samples", "Number of shadow buffer samples.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "shadow_buffer_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "buftype");
RNA_def_property_enum_items(prop, prop_shadbuftype_items);
RNA_def_property_ui_text(prop, "Shadow Buffer Type", "Type of shadow buffer.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
prop= RNA_def_property(srna, "auto_clip_start", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_START);
RNA_def_property_ui_text(prop, "Autoclip Start", "Automatic calculation of clipping-start, based on visible vertices.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
prop= RNA_def_property(srna, "auto_clip_end", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_END);
RNA_def_property_ui_text(prop, "Autoclip End", "Automatic calculation of clipping-end, based on visible vertices.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
}
static void rna_def_sun_lamp(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna= RNA_def_struct(brna, "SunLamp", "Lamp");
RNA_def_struct_sdna(srna, "Lamp");
RNA_def_struct_ui_text(srna, "Sun Lamp", "Constant direction parallel ray lamp.");
rna_def_lamp_shadow(srna, 0, 0);
/* sky */
prop= RNA_def_property(srna, "sky", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_struct_type(prop, "LampSkySettings");
RNA_def_property_pointer_funcs(prop, "rna_Lamp_sky_settings_get", NULL);
RNA_def_property_ui_text(prop, "Sky Settings", "Sky related settings for sun lamps.");
}
static void rna_def_hemi_lamp(BlenderRNA *brna)
{
StructRNA *srna;
srna= RNA_def_struct(brna, "HemiLamp", "Lamp");
RNA_def_struct_sdna(srna, "Lamp");
RNA_def_struct_ui_text(srna, "Hemi Lamp", "180 degree constant lamp.");
}
void RNA_def_lamp(BlenderRNA *brna)
{
rna_def_lamp(brna);
rna_def_local_lamp(brna);
rna_def_area_lamp(brna);
rna_def_spot_lamp(brna);
rna_def_sun_lamp(brna);
rna_def_hemi_lamp(brna);
rna_def_lamp_sky_settings(brna);
rna_def_lamp_mtex(brna);
}
#endif
|