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:
Diffstat (limited to 'source/blender/blenkernel/intern/lamp.c')
-rw-r--r--source/blender/blenkernel/intern/lamp.c108
1 files changed, 54 insertions, 54 deletions
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index e7206af3a0f..20e3edc7044 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -55,30 +55,30 @@ void *BKE_lamp_add(const char *name)
{
Lamp *la;
- la= BKE_libblock_alloc(&G.main->lamp, ID_LA, name);
-
- la->r= la->g= la->b= la->k= 1.0f;
- la->haint= la->energy= 1.0f;
- la->dist= 25.0f;
- la->spotsize= 45.0f;
- la->spotblend= 0.15f;
- la->att2= 1.0f;
- la->mode= LA_SHAD_BUF;
- la->bufsize= 512;
- la->clipsta= 0.5f;
- la->clipend= 40.0f;
- la->shadspotsize= 45.0f;
- la->samp= 3;
- la->bias= 1.0f;
- la->soft= 3.0f;
- la->compressthresh= 0.05f;
- la->ray_samp= la->ray_sampy= la->ray_sampz= 1;
- la->area_size=la->area_sizey=la->area_sizez= 1.0f;
- la->buffers= 1;
- la->buftype= LA_SHADBUF_HALFWAY;
+ la = BKE_libblock_alloc(&G.main->lamp, ID_LA, name);
+
+ la->r = la->g = la->b = la->k = 1.0f;
+ la->haint = la->energy = 1.0f;
+ la->dist = 25.0f;
+ la->spotsize = 45.0f;
+ la->spotblend = 0.15f;
+ la->att2 = 1.0f;
+ la->mode = LA_SHAD_BUF;
+ la->bufsize = 512;
+ la->clipsta = 0.5f;
+ la->clipend = 40.0f;
+ la->shadspotsize = 45.0f;
+ la->samp = 3;
+ la->bias = 1.0f;
+ la->soft = 3.0f;
+ la->compressthresh = 0.05f;
+ la->ray_samp = la->ray_sampy = la->ray_sampz = 1;
+ la->area_size = la->area_sizey = la->area_sizez = 1.0f;
+ la->buffers = 1;
+ la->buftype = LA_SHADBUF_HALFWAY;
la->ray_samp_method = LA_SAMP_HALTON;
la->adapt_thresh = 0.001f;
- la->preview=NULL;
+ la->preview = NULL;
la->falloff_type = LA_FALLOFF_INVSQUARE;
la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
la->sun_effect_type = 0;
@@ -92,11 +92,11 @@ void *BKE_lamp_add(const char *name)
la->atm_extinction_factor = 1.0f;
la->atm_distance_factor = 1.0f;
la->sun_intensity = 1.0f;
- la->skyblendtype= MA_RAMP_ADD;
- la->skyblendfac= 1.0f;
- la->sky_colorspace= BLI_XYZ_CIE;
- la->sky_exposure= 1.0f;
- la->shadow_frustum_size= 10.0f;
+ la->skyblendtype = MA_RAMP_ADD;
+ la->skyblendfac = 1.0f;
+ la->sky_colorspace = BLI_XYZ_CIE;
+ la->sky_exposure = 1.0f;
+ la->shadow_frustum_size = 10.0f;
curvemapping_initialize(la->curfalloff);
return la;
@@ -107,11 +107,11 @@ Lamp *BKE_lamp_copy(Lamp *la)
Lamp *lan;
int a;
- lan= BKE_libblock_copy(&la->id);
+ lan = BKE_libblock_copy(&la->id);
- for (a=0; a<MAX_MTEX; a++) {
+ for (a = 0; a < MAX_MTEX; a++) {
if (lan->mtex[a]) {
- lan->mtex[a]= MEM_mallocN(sizeof(MTex), "copylamptex");
+ lan->mtex[a] = MEM_mallocN(sizeof(MTex), "copylamptex");
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
id_us_plus((ID *)lan->mtex[a]->tex);
}
@@ -120,7 +120,7 @@ Lamp *BKE_lamp_copy(Lamp *la)
lan->curfalloff = curvemapping_copy(la->curfalloff);
if (la->nodetree)
- lan->nodetree= ntreeCopyTree(la->nodetree);
+ lan->nodetree = ntreeCopyTree(la->nodetree);
if (la->preview)
lan->preview = BKE_previewimg_copy(la->preview);
@@ -133,12 +133,12 @@ Lamp *localize_lamp(Lamp *la)
Lamp *lan;
int a;
- lan= BKE_libblock_copy(&la->id);
+ lan = BKE_libblock_copy(&la->id);
BLI_remlink(&G.main->lamp, lan);
- for (a=0; a<MAX_MTEX; a++) {
+ for (a = 0; a < MAX_MTEX; a++) {
if (lan->mtex[a]) {
- lan->mtex[a]= MEM_mallocN(sizeof(MTex), "localize_lamp");
+ lan->mtex[a] = MEM_mallocN(sizeof(MTex), "localize_lamp");
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
/* free lamp decrements */
id_us_plus((ID *)lan->mtex[a]->tex);
@@ -148,60 +148,60 @@ Lamp *localize_lamp(Lamp *la)
lan->curfalloff = curvemapping_copy(la->curfalloff);
if (la->nodetree)
- lan->nodetree= ntreeLocalize(la->nodetree);
+ lan->nodetree = ntreeLocalize(la->nodetree);
- lan->preview= NULL;
+ lan->preview = NULL;
return lan;
}
void BKE_lamp_make_local(Lamp *la)
{
- Main *bmain= G.main;
+ Main *bmain = G.main;
Object *ob;
- int is_local= FALSE, is_lib= FALSE;
+ int is_local = FALSE, is_lib = FALSE;
/* - only lib users: do nothing
* - only local users: set flag
* - mixed: make copy
*/
- if (la->id.lib==NULL) return;
- if (la->id.us==1) {
+ if (la->id.lib == NULL) return;
+ if (la->id.us == 1) {
id_clear_lib_data(bmain, &la->id);
return;
}
- ob= bmain->object.first;
+ ob = bmain->object.first;
while (ob) {
- if (ob->data==la) {
- if (ob->id.lib) is_lib= TRUE;
- else is_local= TRUE;
+ if (ob->data == la) {
+ if (ob->id.lib) is_lib = TRUE;
+ else is_local = TRUE;
}
- ob= ob->id.next;
+ ob = ob->id.next;
}
if (is_local && is_lib == FALSE) {
id_clear_lib_data(bmain, &la->id);
}
else if (is_local && is_lib) {
- Lamp *la_new= BKE_lamp_copy(la);
- la_new->id.us= 0;
+ Lamp *la_new = BKE_lamp_copy(la);
+ la_new->id.us = 0;
/* Remap paths of new ID using old library as base. */
BKE_id_lib_local_paths(bmain, la->id.lib, &la_new->id);
- ob= bmain->object.first;
+ ob = bmain->object.first;
while (ob) {
- if (ob->data==la) {
+ if (ob->data == la) {
- if (ob->id.lib==NULL) {
- ob->data= la_new;
+ if (ob->id.lib == NULL) {
+ ob->data = la_new;
la_new->id.us++;
la->id.us--;
}
}
- ob= ob->id.next;
+ ob = ob->id.next;
}
}
}
@@ -211,8 +211,8 @@ void BKE_lamp_free(Lamp *la)
MTex *mtex;
int a;
- for (a=0; a<MAX_MTEX; a++) {
- mtex= la->mtex[a];
+ for (a = 0; a < MAX_MTEX; a++) {
+ mtex = la->mtex[a];
if (mtex && mtex->tex) mtex->tex->id.us--;
if (mtex) MEM_freeN(mtex);
}