Merged changes in the trunk up to revision 48893.
[blender.git] / source / blender / render / intern / source / convertblender.c
index 19a474df342e34fb8459dd4c2f82d3a386b0b491..2dcd0f7c70a59d0162f11970208847e26652f10b 100644 (file)
@@ -526,7 +526,7 @@ typedef struct {
 
 } SRenderMeshToTangent;
 
-// interface
+/* interface */
 #include "mikktspace.h"
 
 static int GetNumFaces(const SMikkTSpaceContext * pContext)
@@ -1030,7 +1030,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
        static int second=0;
        
        sub_v3_v3v3(nor, vec, vec1);
-       normalize_v3(nor);              // nor needed as tangent 
+       normalize_v3(nor);  /* nor needed as tangent */
        cross_v3_v3v3(cross, vec, nor);
 
        /* turn cross in pixelsize */
@@ -1090,7 +1090,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
                add_v3_v3(vlr->v1->co, cross);
                copy_v3_v3(vlr->v1->n, nor);
                vlr->v1->orco= sd->orco;
-               vlr->v1->accum= -1.0f;  // accum abuse for strand texco
+               vlr->v1->accum = -1.0f;  /* accum abuse for strand texco */
                
                copy_v3_v3(vlr->v2->co, vec);
                sub_v3_v3v3(vlr->v2->co, vlr->v2->co, cross);
@@ -1102,8 +1102,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
                add_v3_v3(vlr->v4->co, cross);
                copy_v3_v3(vlr->v4->n, nor);
                vlr->v4->orco= sd->orco;
-               vlr->v4->accum= 1.0f;   // accum abuse for strand texco
-               
+               vlr->v4->accum = 1.0f;  /* accum abuse for strand texco */
+
                copy_v3_v3(vlr->v3->co, vec1);
                sub_v3_v3v3(vlr->v3->co, vlr->v3->co, cross);
                copy_v3_v3(vlr->v3->n, nor);
@@ -1164,7 +1164,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
                add_v3_v3(v1->co, cross);
                copy_v3_v3(v1->n, nor);
                v1->orco= sd->orco;
-               v1->accum= -1.0f;       // accum abuse for strand texco
+               v1->accum = -1.0f;  /* accum abuse for strand texco */
                
                copy_v3_v3(v2->co, vec);
                sub_v3_v3v3(v2->co, v2->co, cross);
@@ -1181,11 +1181,11 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
                        vlr->v2= v2;
                        vlr->v3= RE_findOrAddVert(obr, obr->totvert++);
                        vlr->v4= RE_findOrAddVert(obr, obr->totvert++);
-                       
-                       v1= vlr->v4; // cycle
-                       v2= vlr->v3; // cycle
 
-                       
+                       v1= vlr->v4; /* cycle */
+                       v2= vlr->v3; /* cycle */
+
+
                        if (sd->adapt) {
                                second=0;
                                copy_v3_v3(anor, nor);
@@ -1210,9 +1210,9 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
                                vlr->v2= v2;
                                vlr->v3= RE_findOrAddVert(obr, obr->totvert++);
                                vlr->v4= RE_findOrAddVert(obr, obr->totvert++);
-                               
-                               v1= vlr->v4; // cycle
-                               v2= vlr->v3; // cycle
+
+                               v1= vlr->v4; /* cycle */
+                               v2= vlr->v3; /* cycle */
 
                                copy_v3_v3(anor, nor);
                                copy_v3_v3(avec, vec);
@@ -1226,8 +1226,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
                add_v3_v3(vlr->v4->co, cross);
                copy_v3_v3(vlr->v4->n, nor);
                vlr->v4->orco= sd->orco;
-               vlr->v4->accum= -1.0f + 2.0f*sd->time;  // accum abuse for strand texco
-               
+               vlr->v4->accum= -1.0f + 2.0f * sd->time;  /* accum abuse for strand texco */
+
                copy_v3_v3(vlr->v3->co, vec);
                sub_v3_v3v3(vlr->v3->co, vlr->v3->co, cross);
                copy_v3_v3(vlr->v3->n, nor);
@@ -1310,7 +1310,7 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3
                vlr->v3= vlr->v2;
                vlr->v4= NULL;
                
-               v1= vlr->v2; // cycle
+               v1= vlr->v2; /* cycle */
                copy_v3_v3(v1->co, vec);
                
                sub_v3_v3v3(vlr->n, vec, vec1);
@@ -1631,12 +1631,12 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 /* 2.1 setup material stff */
        ma= give_render_material(re, ob, part->omat);
        
-#if 0 // XXX old animation system
+#if 0  /* XXX old animation system */
        if (ma->ipo) {
                calc_ipo(ma->ipo, cfra);
                execute_ipo((ID *)ma, ma->ipo);
        }
-#endif // XXX old animation system
+#endif  /* XXX old animation system */
 
        hasize = ma->hasize;
        seed = ma->seed1;
@@ -2088,10 +2088,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
                strandbuf->surface= cache_strand_surface(re, obr, psmd->dm, mat, timeoffset);
 
 /* 4. clean up */
-#if 0 // XXX old animation system
+#if 0  /* XXX old animation system */
        if (ma) do_mat_ipo(re->scene, ma);
-#endif // XXX old animation system
-       
+#endif  /* XXX old animation system */
+
        if (orco1)
                MEM_freeN(sd.orco);
 
@@ -3286,7 +3286,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
        int a, a1, ok, vertofs;
        int end, do_autosmooth = FALSE, totvert = 0;
        int use_original_normals = FALSE;
-       int recalc_normals = 0; // false by default
+       int recalc_normals = 0; /* false by default */
        int negative_scale;
 
        me= ob->data;
@@ -3511,7 +3511,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
                                                                                int t;
                                                                                mtf= RE_vlakren_get_tface(obr, vlr, mtfn++, &name, 1);
                                                                                mtface= (MTFace*)layer->data;
-                                                                               *mtf= mtface[a];        // copy face info
+                                                                               *mtf = mtface[a];  /* copy face info */
                                                                                for (vindex=0; vindex<nr_verts; vindex++)
                                                                                        for (t=0; t<2; t++)
                                                                                                mtf->uv[vindex][t]=mtface[a].uv[rev_tab[vindex]][t];
@@ -3776,7 +3776,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
        lar->shdwb= la->shdwb;
        lar->k= la->k;
 
-       // area
+       /* area */
        lar->ray_samp= la->ray_samp;
        lar->ray_sampy= la->ray_sampy;
        lar->ray_sampz= la->ray_sampz;
@@ -3827,7 +3827,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
                }
 
                area_lamp_vectors(lar);
-               init_jitter_plane(lar); // subsamples
+               init_jitter_plane(lar);  /* subsamples */
        }
        else if (lar->type==LA_SUN) {
                lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
@@ -3862,7 +3862,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 
        memcpy(lar->mtex, la->mtex, MAX_MTEX*sizeof(void *));
 
-       lar->lay= ob->lay & 0xFFFFFF;   // higher 8 bits are localview layers
+       lar->lay = ob->lay & 0xFFFFFF;  /* higher 8 bits are localview layers */
 
        lar->falloff_type = la->falloff_type;
        lar->ld1= la->att1;
@@ -3947,7 +3947,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
                                /* Per lamp, one shadow buffer is made. */
                                lar->bufflag= la->bufflag;
                                copy_m4_m4(mat, ob->obmat);
-                               initshadowbuf(re, lar, mat);    // mat is altered
+                               initshadowbuf(re, lar, mat);  /* mat is altered */
                        }
                        
                        
@@ -4290,8 +4290,8 @@ static void check_non_flat_quads(ObjectRen *obr)
                                
                                xn = dot_v3v3(nor, vlr->n);
 
-                               if (ABS(xn) < 0.999995f ) {     // checked on noisy fractal grid
-                                       
+                               if (ABS(xn) < 0.999995f ) {  /* checked on noisy fractal grid */
+
                                        float d1, d2;
 
                                        vlr1= RE_vlakren_copy(obr, vlr);
@@ -5098,7 +5098,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
        /* per second, per object, stats print this */
        re->i.infostr= "Preparing Scene data";
        re->i.cfra= scene->r.cfra;
-       BLI_strncpy(re->i.scenename, scene->id.name+2, sizeof(re->i.scenename));
+       BLI_strncpy(re->i.scene_name, scene->id.name + 2, sizeof(re->i.scene_name));
        
        /* XXX add test if dbase was filled already? */
        
@@ -5538,7 +5538,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
                else
                        ver++;
 
-               // get fluid velocity
+               /* get fluid velocity */
                fsvec[3] = 0.0f;
                //fsvec[0] = fsvec[1] = fsvec[2] = fsvec[3] = 0.0; fsvec[2] = 2.0f; // NT fixed test
                for (j=0;j<3;j++) fsvec[j] = velarray[a].vel[j];
@@ -5550,31 +5550,31 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
                        fsvec[2] = avgvel[2];
                }
                
-               // transform (=rotate) to cam space
+               /* transform (=rotate) to cam space */
                camco[0] = dot_v3v3(imat[0], fsvec);
                camco[1] = dot_v3v3(imat[1], fsvec);
                camco[2] = dot_v3v3(imat[2], fsvec);
 
-               // get homogenous coordinates
+               /* get homogenous coordinates */
                projectvert(camco, winmat, hoco);
                projectvert(ver->co, winmat, ho);
                
                /* now map hocos to screenspace, uses very primitive clip still */
-               // use ho[3] of original vertex, xy component of vel. direction
+               /* use ho[3] of original vertex, xy component of vel. direction */
                if (ho[3]<0.1f) div= 10.0f;
                else div= 1.0f/ho[3];
                zco[0]= zmulx*hoco[0]*div;
                zco[1]= zmuly*hoco[1]*div;
                
-               // maximize speed as usual
+               /* maximize speed as usual */
                len= zco[0]*zco[0] + zco[1]*zco[1];
                if (len > winsq) {
                        len= winroot/sqrtf(len);
                        zco[0]*= len; zco[1]*= len;
                }
-               
+
                speed= RE_vertren_get_winspeed(obi, ver, 1);
-               // set both to the same value
+               /* set both to the same value */
                speed[0]= speed[2]= zco[0];
                speed[1]= speed[3]= zco[1];
                //if (a < 20) fprintf(stderr,"speed %d %f,%f | camco %f,%f,%f | hoco %f,%f,%f,%f\n", a, speed[0], speed[1], camco[0],camco[1], camco[2], hoco[0],hoco[1], hoco[2],hoco[3]); // NT DEBUG
@@ -5711,7 +5711,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
                                        continue;
                                }
 
-                               // NT check for fluidsim special treatment
+                               /* NT check for fluidsim special treatment */
                                fluidmd = (FluidsimModifierData *)modifiers_findByType(obi->ob, eModifierType_Fluidsim);
                                if (fluidmd && fluidmd->fss && (fluidmd->fss->type & OB_FLUIDSIM_DOMAIN)) {
                                        /* use preloaded per vertex simulation data, only does calculation for step=1 */
@@ -5724,7 +5724,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
                                                calculate_speedvectors(re, obi, oldobi->vectors, step);
                                        else
                                                printf("Warning: object %s has different amount of vertices or strands on other frame\n", obi->ob->id.name+2);
-                               } // not fluidsim
+                               }  /* not fluidsim */
 
                                oldobi= oldobi->next;
                        }