style cleanup: whitespace / commas
This commit is contained in:
@@ -525,13 +525,13 @@ typedef struct LampRen {
|
||||
float shdwr, shdwg, shdwb;
|
||||
float energy, haint;
|
||||
int lay;
|
||||
float spotsi,spotbl;
|
||||
float spotsi, spotbl;
|
||||
float vec[3];
|
||||
float xsp, ysp, distkw, inpr;
|
||||
float halokw, halo;
|
||||
|
||||
short falloff_type;
|
||||
float ld1,ld2;
|
||||
float ld1, ld2;
|
||||
struct CurveMapping *curfalloff;
|
||||
|
||||
/* copied from Lamp, to decouple more rendering stuff */
|
||||
|
||||
@@ -73,7 +73,7 @@ typedef struct SunSky
|
||||
} SunSky;
|
||||
|
||||
void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness,
|
||||
float spread,float sun_brightness, float sun_size, float back_scatter,
|
||||
float spread, float sun_brightness, float sun_size, float back_scatter,
|
||||
float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace);
|
||||
|
||||
void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float color_out[3]);
|
||||
|
||||
@@ -153,7 +153,7 @@ static inline void bvh_node_merge_bb(Node *node, float *min, float *max)
|
||||
RE_rayobject_merge_bb( (RayObject*)node, min, max);
|
||||
}
|
||||
else {
|
||||
DO_MIN(node->bb , min);
|
||||
DO_MIN(node->bb, min);
|
||||
DO_MAX(node->bb+3, max);
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ static inline void bvh_node_merge_bb(Node *node, float *min, float *max)
|
||||
*/
|
||||
template<class Node> static inline void bvh_node_push_childs(Node *node, Isect *isec, Node **stack, int &stack_pos);
|
||||
|
||||
template<class Node,int MAX_STACK_SIZE,bool TEST_ROOT,bool SHADOW>
|
||||
template<class Node, int MAX_STACK_SIZE, bool TEST_ROOT, bool SHADOW>
|
||||
static int bvh_node_stack_raycast(Node *root, Isect *isec)
|
||||
{
|
||||
Node *stack[MAX_STACK_SIZE];
|
||||
@@ -179,7 +179,7 @@ static int bvh_node_stack_raycast(Node *root, Isect *isec)
|
||||
while (stack_pos) {
|
||||
Node *node = stack[--stack_pos];
|
||||
if (!is_leaf(node)) {
|
||||
if (bvh_node_hit_test(node,isec)) {
|
||||
if (bvh_node_hit_test(node, isec)) {
|
||||
bvh_node_push_childs(node, isec, stack, stack_pos);
|
||||
assert(stack_pos <= MAX_STACK_SIZE);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ static int bvh_node_stack_raycast(Node *root, Isect *isec)
|
||||
* this was created to be able to use any simd (with the cost of some memmoves)
|
||||
* it can take advantage of any SIMD width and doens't needs any special tree care
|
||||
*/
|
||||
template<class Node,int MAX_STACK_SIZE,bool TEST_ROOT>
|
||||
template<class Node, int MAX_STACK_SIZE, bool TEST_ROOT>
|
||||
static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
|
||||
{
|
||||
Node *stack[MAX_STACK_SIZE];
|
||||
@@ -242,20 +242,20 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
|
||||
const float *bb2 = stack[stack_pos+2]->bb;
|
||||
const float *bb3 = stack[stack_pos+3]->bb;
|
||||
|
||||
const __m128 x0y0x1y1 = _mm_shuffle_ps( _mm_load_ps(bb0), _mm_load_ps(bb1), _MM_SHUFFLE(1,0,1,0) );
|
||||
const __m128 x2y2x3y3 = _mm_shuffle_ps( _mm_load_ps(bb2), _mm_load_ps(bb3), _MM_SHUFFLE(1,0,1,0) );
|
||||
t_bb[0] = _mm_shuffle_ps( x0y0x1y1, x2y2x3y3, _MM_SHUFFLE(2,0,2,0) );
|
||||
t_bb[1] = _mm_shuffle_ps( x0y0x1y1, x2y2x3y3, _MM_SHUFFLE(3,1,3,1) );
|
||||
const __m128 x0y0x1y1 = _mm_shuffle_ps( _mm_load_ps(bb0), _mm_load_ps(bb1), _MM_SHUFFLE(1, 0, 1, 0) );
|
||||
const __m128 x2y2x3y3 = _mm_shuffle_ps( _mm_load_ps(bb2), _mm_load_ps(bb3), _MM_SHUFFLE(1, 0, 1, 0) );
|
||||
t_bb[0] = _mm_shuffle_ps( x0y0x1y1, x2y2x3y3, _MM_SHUFFLE(2, 0, 2, 0) );
|
||||
t_bb[1] = _mm_shuffle_ps( x0y0x1y1, x2y2x3y3, _MM_SHUFFLE(3, 1, 3, 1) );
|
||||
|
||||
const __m128 z0X0z1X1 = _mm_shuffle_ps( _mm_load_ps(bb0), _mm_load_ps(bb1), _MM_SHUFFLE(3,2,3,2) );
|
||||
const __m128 z2X2z3X3 = _mm_shuffle_ps( _mm_load_ps(bb2), _mm_load_ps(bb3), _MM_SHUFFLE(3,2,3,2) );
|
||||
t_bb[2] = _mm_shuffle_ps( z0X0z1X1, z2X2z3X3, _MM_SHUFFLE(2,0,2,0) );
|
||||
t_bb[3] = _mm_shuffle_ps( z0X0z1X1, z2X2z3X3, _MM_SHUFFLE(3,1,3,1) );
|
||||
const __m128 z0X0z1X1 = _mm_shuffle_ps( _mm_load_ps(bb0), _mm_load_ps(bb1), _MM_SHUFFLE(3, 2, 3, 2) );
|
||||
const __m128 z2X2z3X3 = _mm_shuffle_ps( _mm_load_ps(bb2), _mm_load_ps(bb3), _MM_SHUFFLE(3, 2, 3, 2) );
|
||||
t_bb[2] = _mm_shuffle_ps( z0X0z1X1, z2X2z3X3, _MM_SHUFFLE(2, 0, 2, 0) );
|
||||
t_bb[3] = _mm_shuffle_ps( z0X0z1X1, z2X2z3X3, _MM_SHUFFLE(3, 1, 3, 1) );
|
||||
|
||||
const __m128 Y0Z0Y1Z1 = _mm_shuffle_ps( _mm_load_ps(bb0+4), _mm_load_ps(bb1+4), _MM_SHUFFLE(1,0,1,0) );
|
||||
const __m128 Y2Z2Y3Z3 = _mm_shuffle_ps( _mm_load_ps(bb2+4), _mm_load_ps(bb3+4), _MM_SHUFFLE(1,0,1,0) );
|
||||
t_bb[4] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(2,0,2,0) );
|
||||
t_bb[5] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(3,1,3,1) );
|
||||
const __m128 Y0Z0Y1Z1 = _mm_shuffle_ps( _mm_load_ps(bb0+4), _mm_load_ps(bb1+4), _MM_SHUFFLE(1, 0, 1, 0) );
|
||||
const __m128 Y2Z2Y3Z3 = _mm_shuffle_ps( _mm_load_ps(bb2+4), _mm_load_ps(bb3+4), _MM_SHUFFLE(1, 0, 1, 0) );
|
||||
t_bb[4] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(2, 0, 2, 0) );
|
||||
t_bb[5] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(3, 1, 3, 1) );
|
||||
#if 0
|
||||
for(int i=0; i<4; i++)
|
||||
{
|
||||
@@ -294,7 +294,7 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
|
||||
Node *node = stack[--stack_pos];
|
||||
assert(!is_leaf(node));
|
||||
|
||||
if (bvh_node_hit_test(node,isec)) {
|
||||
if (bvh_node_hit_test(node, isec)) {
|
||||
if (!is_leaf(node->child)) {
|
||||
bvh_node_push_childs(node, isec, stack, stack_pos);
|
||||
assert(stack_pos <= MAX_STACK_SIZE);
|
||||
@@ -361,7 +361,7 @@ static int bvh_node_raycast(Node *node, Isect *isec)
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Node,class HintObject>
|
||||
template<class Node, class HintObject>
|
||||
void bvh_dfs_make_hint(Node *node, LCTSHint *hint, int reserve_space, HintObject *hintObject)
|
||||
{
|
||||
assert( hint->size + reserve_space + 1 <= RE_RAY_LCTS_MAX_SIZE );
|
||||
|
||||
@@ -136,8 +136,8 @@ static void RE_rayobject_blibvh_add(RayObject *o, RayObject *ob)
|
||||
INIT_MINMAX(min_max, min_max+3);
|
||||
RE_rayobject_merge_bb(ob, min_max, min_max+3);
|
||||
|
||||
DO_MIN(min_max , obj->bb[0]);
|
||||
DO_MAX(min_max+3, obj->bb[1]);
|
||||
DO_MIN(min_max, obj->bb[0]);
|
||||
DO_MAX(min_max + 3, obj->bb[1]);
|
||||
|
||||
BLI_bvhtree_insert(obj->bvh, obj->next_leaf - obj->leafs, min_max, 2);
|
||||
*(obj->next_leaf++) = ob;
|
||||
|
||||
@@ -74,7 +74,7 @@ typedef struct Octree {
|
||||
struct Branch **adrbranch;
|
||||
struct Node **adrnode;
|
||||
float ocsize; /* ocsize: mult factor, max size octree */
|
||||
float ocfacx,ocfacy,ocfacz;
|
||||
float ocfacx, ocfacy, ocfacz;
|
||||
float min[3], max[3];
|
||||
int ocres;
|
||||
int branchcount, nodecount;
|
||||
@@ -216,7 +216,7 @@ static Node *addnode(Octree *oc)
|
||||
index= oc->nodecount>>12;
|
||||
|
||||
if (oc->adrnode[index]==NULL)
|
||||
oc->adrnode[index]= (Node*)MEM_callocN(4096*sizeof(Node),"addnode");
|
||||
oc->adrnode[index]= (Node*)MEM_callocN(4096*sizeof(Node), "addnode");
|
||||
|
||||
if (oc->nodecount> NODE_ARRAY*NODE_ARRAY) {
|
||||
printf("error; octree nodes full\n");
|
||||
@@ -233,7 +233,7 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3]
|
||||
|
||||
// init static vars
|
||||
if (face) {
|
||||
normal_tri_v3( nor,rtf[0], rtf[1], rtf[2]);
|
||||
normal_tri_v3(nor, rtf[0], rtf[1], rtf[2]);
|
||||
d= -nor[0]*rtf[0][0] - nor[1]*rtf[0][1] - nor[2]*rtf[0][2];
|
||||
return 0;
|
||||
}
|
||||
@@ -297,11 +297,11 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
|
||||
oc4= ((x & 8)+(y & 4)+(z & 2))>>1;
|
||||
oc5= ((x & 4)+(y & 2)+(z & 1));
|
||||
|
||||
br= addbranch(oc, br,oc0);
|
||||
br= addbranch(oc, br,oc1);
|
||||
br= addbranch(oc, br,oc2);
|
||||
br= addbranch(oc, br,oc3);
|
||||
br= addbranch(oc, br,oc4);
|
||||
br= addbranch(oc, br, oc0);
|
||||
br= addbranch(oc, br, oc1);
|
||||
br= addbranch(oc, br, oc2);
|
||||
br= addbranch(oc, br, oc3);
|
||||
br= addbranch(oc, br, oc4);
|
||||
no= (Node *)br->b[oc5];
|
||||
if (no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc));
|
||||
|
||||
@@ -326,10 +326,10 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
|
||||
|
||||
static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocface, short rts[][3], float rtf[][3])
|
||||
{
|
||||
int ocx1,ocx2,ocy1,ocy2;
|
||||
int x,y,dx=0,dy=0;
|
||||
float ox1,ox2,oy1,oy2;
|
||||
float labda,labdao,labdax,labday,ldx,ldy;
|
||||
int ocx1, ocx2, ocy1, ocy2;
|
||||
int x, y, dx=0, dy=0;
|
||||
float ox1, ox2, oy1, oy2;
|
||||
float labda, labdao, labdax, labday, ldx, ldy;
|
||||
|
||||
ocx1= rts[b1][c1];
|
||||
ocy1= rts[b1][c2];
|
||||
@@ -405,7 +405,7 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
|
||||
y+=dy;
|
||||
}
|
||||
}
|
||||
labda=MIN2(labdax,labday);
|
||||
labda=MIN2(labdax, labday);
|
||||
if (labda==labdao) break;
|
||||
if (labda>=1.0f) break;
|
||||
}
|
||||
@@ -541,13 +541,13 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
|
||||
oc2= rts[1][c];
|
||||
oc3= rts[2][c];
|
||||
if (!RE_rayface_isQuad(face)) {
|
||||
ocmin[c]= MIN3(oc1,oc2,oc3);
|
||||
ocmax[c]= MAX3(oc1,oc2,oc3);
|
||||
ocmin[c]= MIN3(oc1, oc2, oc3);
|
||||
ocmax[c]= MAX3(oc1, oc2, oc3);
|
||||
}
|
||||
else {
|
||||
oc4= rts[3][c];
|
||||
ocmin[c]= MIN4(oc1,oc2,oc3,oc4);
|
||||
ocmax[c]= MAX4(oc1,oc2,oc3,oc4);
|
||||
ocmin[c]= MIN4(oc1, oc2, oc3, oc4);
|
||||
ocmax[c]= MAX4(oc1, oc2, oc3, oc4);
|
||||
}
|
||||
if (ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1;
|
||||
if (ocmin[c]<0) ocmin[c]=0;
|
||||
@@ -558,32 +558,32 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
|
||||
}
|
||||
else {
|
||||
|
||||
d2dda(oc, 0,1,0,1,ocface+ocres2,rts,rtf);
|
||||
d2dda(oc, 0,1,0,2,ocface,rts,rtf);
|
||||
d2dda(oc, 0,1,1,2,ocface+2*ocres2,rts,rtf);
|
||||
d2dda(oc, 1,2,0,1,ocface+ocres2,rts,rtf);
|
||||
d2dda(oc, 1,2,0,2,ocface,rts,rtf);
|
||||
d2dda(oc, 1,2,1,2,ocface+2*ocres2,rts,rtf);
|
||||
d2dda(oc, 0, 1, 0, 1, ocface+ocres2, rts, rtf);
|
||||
d2dda(oc, 0, 1, 0, 2, ocface, rts, rtf);
|
||||
d2dda(oc, 0, 1, 1, 2, ocface+2*ocres2, rts, rtf);
|
||||
d2dda(oc, 1, 2, 0, 1, ocface+ocres2, rts, rtf);
|
||||
d2dda(oc, 1, 2, 0, 2, ocface, rts, rtf);
|
||||
d2dda(oc, 1, 2, 1, 2, ocface+2*ocres2, rts, rtf);
|
||||
if (!RE_rayface_isQuad(face)) {
|
||||
d2dda(oc, 2,0,0,1,ocface+ocres2,rts,rtf);
|
||||
d2dda(oc, 2,0,0,2,ocface,rts,rtf);
|
||||
d2dda(oc, 2,0,1,2,ocface+2*ocres2,rts,rtf);
|
||||
d2dda(oc, 2, 0, 0, 1, ocface+ocres2, rts, rtf);
|
||||
d2dda(oc, 2, 0, 0, 2, ocface, rts, rtf);
|
||||
d2dda(oc, 2, 0, 1, 2, ocface+2*ocres2, rts, rtf);
|
||||
}
|
||||
else {
|
||||
d2dda(oc, 2,3,0,1,ocface+ocres2,rts,rtf);
|
||||
d2dda(oc, 2,3,0,2,ocface,rts,rtf);
|
||||
d2dda(oc, 2,3,1,2,ocface+2*ocres2,rts,rtf);
|
||||
d2dda(oc, 3,0,0,1,ocface+ocres2,rts,rtf);
|
||||
d2dda(oc, 3,0,0,2,ocface,rts,rtf);
|
||||
d2dda(oc, 3,0,1,2,ocface+2*ocres2,rts,rtf);
|
||||
d2dda(oc, 2, 3, 0, 1, ocface+ocres2, rts, rtf);
|
||||
d2dda(oc, 2, 3, 0, 2, ocface, rts, rtf);
|
||||
d2dda(oc, 2, 3, 1, 2, ocface+2*ocres2, rts, rtf);
|
||||
d2dda(oc, 3, 0, 0, 1, ocface+ocres2, rts, rtf);
|
||||
d2dda(oc, 3, 0, 0, 2, ocface, rts, rtf);
|
||||
d2dda(oc, 3, 0, 1, 2, ocface+2*ocres2, rts, rtf);
|
||||
}
|
||||
/* nothing todo with triangle..., just fills :) */
|
||||
filltriangle(oc, 0,1,ocface+ocres2,ocmin,ocmax);
|
||||
filltriangle(oc, 0,2,ocface,ocmin,ocmax);
|
||||
filltriangle(oc, 1,2,ocface+2*ocres2,ocmin,ocmax);
|
||||
filltriangle(oc, 0, 1, ocface+ocres2, ocmin, ocmax);
|
||||
filltriangle(oc, 0, 2, ocface, ocmin, ocmax);
|
||||
filltriangle(oc, 1, 2, ocface+2*ocres2, ocmin, ocmax);
|
||||
|
||||
/* init static vars here */
|
||||
face_in_node(face, 0,0,0, rtf);
|
||||
face_in_node(face, 0, 0, 0, rtf);
|
||||
|
||||
for (x=ocmin[0];x<=ocmax[0];x++) {
|
||||
a= oc->ocres*x;
|
||||
@@ -593,7 +593,7 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
|
||||
for (z=ocmin[2];z<=ocmax[2];z++) {
|
||||
if (ocface[b+z] && ocface[a+z]) {
|
||||
if (face_in_node(NULL, x, y, z, rtf))
|
||||
ocwrite(oc, face, RE_rayface_isQuad(face), x,y,z, rtf);
|
||||
ocwrite(oc, face, RE_rayface_isQuad(face), x, y, z, rtf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -695,7 +695,7 @@ static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval)
|
||||
if (!face) break;
|
||||
|
||||
if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) {
|
||||
if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
|
||||
if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face), is) )
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -713,7 +713,7 @@ static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval)
|
||||
if (!face) break;
|
||||
|
||||
if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) {
|
||||
if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) ) {
|
||||
if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face), is) ) {
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
@@ -849,12 +849,12 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
|
||||
Node *no;
|
||||
OcVal ocval;
|
||||
float vec1[3], vec2[3], start[3], end[3];
|
||||
float u1,u2,ox1,ox2,oy1,oy2,oz1,oz2;
|
||||
float labdao,labdax,ldx,labday,ldy,labdaz,ldz, ddalabda;
|
||||
float u1, u2, ox1, ox2, oy1, oy2, oz1, oz2;
|
||||
float labdao, labdax, ldx, labday, ldy, labdaz, ldz, ddalabda;
|
||||
float olabda = 0;
|
||||
int dx,dy,dz;
|
||||
int xo,yo,zo,c1=0;
|
||||
int ocx1,ocx2,ocy1, ocy2,ocz1,ocz2;
|
||||
int dx, dy, dz;
|
||||
int xo, yo, zo, c1=0;
|
||||
int ocx1, ocx2, ocy1, ocy2, ocz1, ocz2;
|
||||
|
||||
/* clip with octree */
|
||||
if (oc->branchcount==0) return 0;
|
||||
@@ -875,14 +875,14 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
|
||||
u2= 1.0f;
|
||||
|
||||
/* clip with octree cube */
|
||||
if (cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) {
|
||||
if (cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) {
|
||||
if (cliptest(-ldx, start[0]-oc->min[0], &u1, &u2)) {
|
||||
if (cliptest(ldx, oc->max[0]-start[0], &u1, &u2)) {
|
||||
ldy= is->dir[1]*is->dist;
|
||||
if (cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) {
|
||||
if (cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) {
|
||||
if (cliptest(-ldy, start[1]-oc->min[1], &u1, &u2)) {
|
||||
if (cliptest(ldy, oc->max[1]-start[1], &u1, &u2)) {
|
||||
ldz = is->dir[2]*is->dist;
|
||||
if (cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) {
|
||||
if (cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) {
|
||||
if (cliptest(-ldz, start[2]-oc->min[2], &u1, &u2)) {
|
||||
if (cliptest(ldz, oc->max[2]-start[2], &u1, &u2)) {
|
||||
c1=1;
|
||||
if (u2<1.0f) {
|
||||
end[0] = start[0]+u2*ldx;
|
||||
@@ -934,7 +934,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
|
||||
}
|
||||
else {
|
||||
int found = 0;
|
||||
//static int coh_ocx1,coh_ocx2,coh_ocy1, coh_ocy2,coh_ocz1,coh_ocz2;
|
||||
//static int coh_ocx1, coh_ocx2, coh_ocy1, coh_ocy2, coh_ocz1, coh_ocz2;
|
||||
float dox, doy, doz;
|
||||
int eqval;
|
||||
|
||||
@@ -992,7 +992,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
|
||||
}
|
||||
|
||||
xo=ocx1; yo=ocy1; zo=ocz1;
|
||||
ddalabda= MIN3(labdax,labday,labdaz);
|
||||
ddalabda= MIN3(labdax, labday, labdaz);
|
||||
|
||||
vec2[0]= ox1;
|
||||
vec2[1]= oy1;
|
||||
@@ -1008,7 +1008,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
|
||||
|
||||
/* calculate ray intersection with octree node */
|
||||
copy_v3_v3(vec1, vec2);
|
||||
// dox,y,z is negative
|
||||
// dox, y, z is negative
|
||||
vec2[0]= ox1-ddalabda*dox;
|
||||
vec2[1]= oy1-ddalabda*doy;
|
||||
vec2[2]= oz1-ddalabda*doz;
|
||||
@@ -1082,7 +1082,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
|
||||
|
||||
}
|
||||
|
||||
ddalabda=MIN3(labdax,labday,labdaz);
|
||||
ddalabda=MIN3(labdax, labday, labdaz);
|
||||
if (ddalabda==labdao) break;
|
||||
/* to make sure the last node is always checked */
|
||||
if (labdao>=1.0f) break;
|
||||
|
||||
@@ -78,7 +78,7 @@ void bvh_done<QBVHTree>(QBVHTree *obj)
|
||||
}
|
||||
|
||||
if (root) {
|
||||
pushup_simd<VBVHNode,4>(root);
|
||||
pushup_simd<VBVHNode, 4>(root);
|
||||
obj->root = Reorganize_SVBVH<VBVHNode>(arena2).transform(root);
|
||||
}
|
||||
else
|
||||
@@ -100,9 +100,9 @@ int intersect(QBVHTree *obj, Isect* isec)
|
||||
//TODO renable hint support
|
||||
if (RE_rayobject_isAligned(obj->root)) {
|
||||
if (isec->mode == RE_RAY_SHADOW)
|
||||
return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec);
|
||||
return svbvh_node_stack_raycast<StackSize, true>(obj->root, isec);
|
||||
else
|
||||
return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec);
|
||||
return svbvh_node_stack_raycast<StackSize, false>(obj->root, isec);
|
||||
}
|
||||
else
|
||||
return RE_rayobject_intersect((RayObject*)obj->root, isec);
|
||||
@@ -123,13 +123,13 @@ RayObjectAPI make_api()
|
||||
{
|
||||
static RayObjectAPI api =
|
||||
{
|
||||
(RE_rayobject_raycast_callback) ((int(*)(Tree*,Isect*)) &intersect<STACK_SIZE>),
|
||||
(RE_rayobject_add_callback) ((void(*)(Tree*,RayObject*)) &bvh_add<Tree>),
|
||||
(RE_rayobject_raycast_callback) ((int(*)(Tree*, Isect*)) &intersect<STACK_SIZE>),
|
||||
(RE_rayobject_add_callback) ((void(*)(Tree*, RayObject*)) &bvh_add<Tree>),
|
||||
(RE_rayobject_done_callback) ((void(*)(Tree*)) &bvh_done<Tree>),
|
||||
(RE_rayobject_free_callback) ((void(*)(Tree*)) &bvh_free<Tree>),
|
||||
(RE_rayobject_merge_bb_callback)((void(*)(Tree*,float*,float*)) &bvh_bb<Tree>),
|
||||
(RE_rayobject_merge_bb_callback)((void(*)(Tree*, float*, float*)) &bvh_bb<Tree>),
|
||||
(RE_rayobject_cost_callback) ((float(*)(Tree*)) &bvh_cost<Tree>),
|
||||
(RE_rayobject_hint_bb_callback) ((void(*)(Tree*,LCTSHint*,float*,float*)) &bvh_hint_bb<Tree>)
|
||||
(RE_rayobject_hint_bb_callback) ((void(*)(Tree*, LCTSHint*, float*, float*)) &bvh_hint_bb<Tree>)
|
||||
};
|
||||
|
||||
return api;
|
||||
@@ -138,7 +138,7 @@ RayObjectAPI make_api()
|
||||
template<class Tree>
|
||||
RayObjectAPI* bvh_get_api(int maxstacksize)
|
||||
{
|
||||
static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
|
||||
static RayObjectAPI bvh_api256 = make_api<Tree, 1024>();
|
||||
|
||||
if (maxstacksize <= 1024) return &bvh_api256;
|
||||
assert(maxstacksize <= 256);
|
||||
@@ -147,7 +147,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
|
||||
|
||||
RayObject *RE_rayobject_qbvh_create(int size)
|
||||
{
|
||||
return bvh_create_tree<QBVHTree,DFS_STACK_SIZE>(size);
|
||||
return bvh_create_tree<QBVHTree, DFS_STACK_SIZE>(size);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -66,7 +66,7 @@ static void rtbuild_init(RTBuilder *b)
|
||||
RTBuilder* rtbuild_create(int size)
|
||||
{
|
||||
RTBuilder *builder = (RTBuilder*) MEM_mallocN( sizeof(RTBuilder), "RTBuilder" );
|
||||
RTBuilder::Object *memblock= (RTBuilder::Object*)MEM_mallocN( sizeof(RTBuilder::Object)*size,"RTBuilder.objects");
|
||||
RTBuilder::Object *memblock= (RTBuilder::Object*)MEM_mallocN( sizeof(RTBuilder::Object)*size, "RTBuilder.objects");
|
||||
|
||||
|
||||
rtbuild_init(builder);
|
||||
@@ -75,7 +75,7 @@ RTBuilder* rtbuild_create(int size)
|
||||
builder->primitives.maxsize = size;
|
||||
|
||||
for (int i=0; i<3; i++) {
|
||||
builder->sorted_begin[i] = (RTBuilder::Object**)MEM_mallocN( sizeof(RTBuilder::Object*)*size,"RTBuilder.sorted_objects");
|
||||
builder->sorted_begin[i] = (RTBuilder::Object**)MEM_mallocN( sizeof(RTBuilder::Object*)*size, "RTBuilder.sorted_objects");
|
||||
builder->sorted_end[i] = builder->sorted_begin[i];
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ int rtbuild_size(RTBuilder *b)
|
||||
}
|
||||
|
||||
|
||||
template<class Obj,int Axis>
|
||||
template<class Obj, int Axis>
|
||||
static bool obj_bb_compare(const Obj &a, const Obj &b)
|
||||
{
|
||||
if (a->bb[Axis] != b->bb[Axis])
|
||||
@@ -147,9 +147,9 @@ static bool obj_bb_compare(const Obj &a, const Obj &b)
|
||||
template<class Item>
|
||||
static void object_sort(Item *begin, Item *end, int axis)
|
||||
{
|
||||
if (axis == 0) return std::sort(begin, end, obj_bb_compare<Item,0> );
|
||||
if (axis == 1) return std::sort(begin, end, obj_bb_compare<Item,1> );
|
||||
if (axis == 2) return std::sort(begin, end, obj_bb_compare<Item,2> );
|
||||
if (axis == 0) return std::sort(begin, end, obj_bb_compare<Item, 0> );
|
||||
if (axis == 1) return std::sort(begin, end, obj_bb_compare<Item, 1> );
|
||||
if (axis == 2) return std::sort(begin, end, obj_bb_compare<Item, 2> );
|
||||
assert(false);
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ void rtbuild_calc_bb(RTBuilder *b)
|
||||
{
|
||||
if (b->bb[0] == 1.0e30f) {
|
||||
for (RTBuilder::Object **index = b->sorted_begin[0]; index != b->sorted_end[0]; index++)
|
||||
RE_rayobject_merge_bb( (*index)->obj , b->bb, b->bb+3);
|
||||
RE_rayobject_merge_bb( (*index)->obj, b->bb, b->bb+3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds)
|
||||
|
||||
rtbuild_calc_bb(b);
|
||||
|
||||
la = bb_largest_axis(b->bb,b->bb+3);
|
||||
la = bb_largest_axis(b->bb, b->bb+3);
|
||||
for (i=1; i<nchilds; i++)
|
||||
separators[i-1] = (b->bb[la+3]-b->bb[la])*i / nchilds;
|
||||
|
||||
@@ -449,9 +449,9 @@ static void split_leafs(RTBuilder *b, int *nth, int partitions, int split_axis)
|
||||
{
|
||||
assert(nth[i] < nth[i+1] && nth[i+1] < nth[partitions]);
|
||||
|
||||
if (split_axis == 0) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,0>);
|
||||
if (split_axis == 1) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,1>);
|
||||
if (split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>);
|
||||
if (split_axis == 0) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object, 0>);
|
||||
if (split_axis == 1) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object, 1>);
|
||||
if (split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object, 2>);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -94,14 +94,14 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
|
||||
|
||||
pushup(root);
|
||||
pushdown(root);
|
||||
pushup_simd<VBVHNode,4>(root);
|
||||
pushup_simd<VBVHNode, 4>(root);
|
||||
|
||||
obj->root = Reorganize_SVBVH<VBVHNode>(arena2).transform(root);
|
||||
}
|
||||
else {
|
||||
//Finds the optimal packing of this tree using a given cost model
|
||||
//TODO this uses quite a lot of memory, find ways to reduce memory usage during building
|
||||
OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena1,&obj->rayobj.control).transform(obj->builder);
|
||||
OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
|
||||
|
||||
if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) {
|
||||
BLI_memarena_free(arena1);
|
||||
@@ -110,7 +110,7 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
|
||||
}
|
||||
|
||||
if (root) {
|
||||
VBVH_optimalPackSIMD<OVBVHNode,PackCost>(PackCost()).transform(root);
|
||||
VBVH_optimalPackSIMD<OVBVHNode, PackCost>(PackCost()).transform(root);
|
||||
obj->root = Reorganize_SVBVH<OVBVHNode>(arena2).transform(root);
|
||||
}
|
||||
else
|
||||
@@ -133,9 +133,9 @@ int intersect(SVBVHTree *obj, Isect* isec)
|
||||
//TODO renable hint support
|
||||
if (RE_rayobject_isAligned(obj->root)) {
|
||||
if (isec->mode == RE_RAY_SHADOW)
|
||||
return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec);
|
||||
return svbvh_node_stack_raycast<StackSize, true>(obj->root, isec);
|
||||
else
|
||||
return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec);
|
||||
return svbvh_node_stack_raycast<StackSize, false>(obj->root, isec);
|
||||
}
|
||||
else
|
||||
return RE_rayobject_intersect( (RayObject*) obj->root, isec );
|
||||
@@ -156,13 +156,13 @@ RayObjectAPI make_api()
|
||||
{
|
||||
static RayObjectAPI api =
|
||||
{
|
||||
(RE_rayobject_raycast_callback) ((int(*)(Tree*,Isect*)) &intersect<STACK_SIZE>),
|
||||
(RE_rayobject_add_callback) ((void(*)(Tree*,RayObject*)) &bvh_add<Tree>),
|
||||
(RE_rayobject_raycast_callback) ((int(*)(Tree*, Isect*)) &intersect<STACK_SIZE>),
|
||||
(RE_rayobject_add_callback) ((void(*)(Tree*, RayObject*)) &bvh_add<Tree>),
|
||||
(RE_rayobject_done_callback) ((void(*)(Tree*)) &bvh_done<Tree>),
|
||||
(RE_rayobject_free_callback) ((void(*)(Tree*)) &bvh_free<Tree>),
|
||||
(RE_rayobject_merge_bb_callback)((void(*)(Tree*,float*,float*)) &bvh_bb<Tree>),
|
||||
(RE_rayobject_merge_bb_callback)((void(*)(Tree*, float*, float*)) &bvh_bb<Tree>),
|
||||
(RE_rayobject_cost_callback) ((float(*)(Tree*)) &bvh_cost<Tree>),
|
||||
(RE_rayobject_hint_bb_callback) ((void(*)(Tree*,LCTSHint*,float*,float*)) &bvh_hint_bb<Tree>)
|
||||
(RE_rayobject_hint_bb_callback) ((void(*)(Tree*, LCTSHint*, float*, float*)) &bvh_hint_bb<Tree>)
|
||||
};
|
||||
|
||||
return api;
|
||||
@@ -171,7 +171,7 @@ RayObjectAPI make_api()
|
||||
template<class Tree>
|
||||
RayObjectAPI* bvh_get_api(int maxstacksize)
|
||||
{
|
||||
static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
|
||||
static RayObjectAPI bvh_api256 = make_api<Tree, 1024>();
|
||||
|
||||
if (maxstacksize <= 1024) return &bvh_api256;
|
||||
assert(maxstacksize <= 256);
|
||||
@@ -180,7 +180,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
|
||||
|
||||
RayObject *RE_rayobject_svbvh_create(int size)
|
||||
{
|
||||
return bvh_create_tree<SVBVHTree,DFS_STACK_SIZE>(size);
|
||||
return bvh_create_tree<SVBVHTree, DFS_STACK_SIZE>(size);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -88,7 +88,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
|
||||
|
||||
//Build and optimize the tree
|
||||
if (1) {
|
||||
VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1,&obj->rayobj.control).transform(obj->builder);
|
||||
VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
|
||||
if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) {
|
||||
BLI_memarena_free(arena1);
|
||||
return;
|
||||
@@ -115,7 +115,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
|
||||
//Finds the optimal packing of this tree using a given cost model
|
||||
//TODO this uses quite a lot of memory, find ways to reduce memory usage during building
|
||||
OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena2).transform(obj->builder);
|
||||
VBVH_optimalPackSIMD<OVBVHNode,PackCost>(PackCost()).transform(root);
|
||||
VBVH_optimalPackSIMD<OVBVHNode, PackCost>(PackCost()).transform(root);
|
||||
obj->root = Reorganize_VBVH<OVBVHNode>(arena1).transform(root);
|
||||
|
||||
BLI_memarena_free(arena2);
|
||||
@@ -136,9 +136,9 @@ int intersect(VBVHTree *obj, Isect* isec)
|
||||
//TODO renable hint support
|
||||
if (RE_rayobject_isAligned(obj->root)) {
|
||||
if (isec->mode == RE_RAY_SHADOW)
|
||||
return bvh_node_stack_raycast<VBVHNode,StackSize,false,true>( obj->root, isec);
|
||||
return bvh_node_stack_raycast<VBVHNode, StackSize, false, true>( obj->root, isec);
|
||||
else
|
||||
return bvh_node_stack_raycast<VBVHNode,StackSize,false,false>( obj->root, isec);
|
||||
return bvh_node_stack_raycast<VBVHNode, StackSize, false, false>( obj->root, isec);
|
||||
}
|
||||
else
|
||||
return RE_rayobject_intersect( (RayObject*) obj->root, isec );
|
||||
@@ -178,13 +178,13 @@ RayObjectAPI make_api()
|
||||
{
|
||||
static RayObjectAPI api =
|
||||
{
|
||||
(RE_rayobject_raycast_callback) ((int(*)(Tree*,Isect*)) &intersect<STACK_SIZE>),
|
||||
(RE_rayobject_add_callback) ((void(*)(Tree*,RayObject*)) &bvh_add<Tree>),
|
||||
(RE_rayobject_raycast_callback) ((int(*)(Tree*, Isect*)) &intersect<STACK_SIZE>),
|
||||
(RE_rayobject_add_callback) ((void(*)(Tree*, RayObject*)) &bvh_add<Tree>),
|
||||
(RE_rayobject_done_callback) ((void(*)(Tree*)) &bvh_done<Tree>),
|
||||
(RE_rayobject_free_callback) ((void(*)(Tree*)) &bvh_free<Tree>),
|
||||
(RE_rayobject_merge_bb_callback)((void(*)(Tree*,float*,float*)) &bvh_bb<Tree>),
|
||||
(RE_rayobject_merge_bb_callback)((void(*)(Tree*, float*, float*)) &bvh_bb<Tree>),
|
||||
(RE_rayobject_cost_callback) ((float(*)(Tree*)) &bvh_cost<Tree>),
|
||||
(RE_rayobject_hint_bb_callback) ((void(*)(Tree*,LCTSHint*,float*,float*)) &bvh_hint_bb<Tree>)
|
||||
(RE_rayobject_hint_bb_callback) ((void(*)(Tree*, LCTSHint*, float*, float*)) &bvh_hint_bb<Tree>)
|
||||
};
|
||||
|
||||
return api;
|
||||
@@ -193,7 +193,7 @@ RayObjectAPI make_api()
|
||||
template<class Tree>
|
||||
RayObjectAPI* bvh_get_api(int maxstacksize)
|
||||
{
|
||||
static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
|
||||
static RayObjectAPI bvh_api256 = make_api<Tree, 1024>();
|
||||
|
||||
if (maxstacksize <= 1024) return &bvh_api256;
|
||||
assert(maxstacksize <= 256);
|
||||
@@ -202,5 +202,5 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
|
||||
|
||||
RayObject *RE_rayobject_vbvh_create(int size)
|
||||
{
|
||||
return bvh_create_tree<VBVHTree,DFS_STACK_SIZE>(size);
|
||||
return bvh_create_tree<VBVHTree, DFS_STACK_SIZE>(size);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ bool node_fits_inside(Node *a, Node *b)
|
||||
}
|
||||
|
||||
template<class Node>
|
||||
void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair<float,Node*> &cost)
|
||||
void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair<float, Node*> &cost)
|
||||
{
|
||||
std::queue<Node*> q;
|
||||
q.push(tree);
|
||||
@@ -73,7 +73,7 @@ void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair<float,Node
|
||||
if (parent == node) continue;
|
||||
if (node_fits_inside(node, parent) && RE_rayobject_isAligned(parent->child) ) {
|
||||
float pcost = bb_area(parent->bb, parent->bb+3);
|
||||
cost = std::min( cost, std::make_pair(pcost,parent) );
|
||||
cost = std::min( cost, std::make_pair(pcost, parent) );
|
||||
for (Node *child = parent->child; child; child = child->sibling)
|
||||
q.push(child);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ void reorganize(Node *root)
|
||||
assert( RE_rayobject_isAligned(*prev) );
|
||||
q.push(*prev);
|
||||
|
||||
std::pair<float,Node*> best(FLT_MAX, root);
|
||||
std::pair<float, Node*> best(FLT_MAX, root);
|
||||
reorganize_find_fittest_parent( root, *prev, best );
|
||||
|
||||
if (best.second == node) {
|
||||
@@ -215,7 +215,7 @@ void pushup_simd(Node *parent)
|
||||
}
|
||||
|
||||
for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
|
||||
pushup_simd<Node,SSize>(child);
|
||||
pushup_simd<Node, SSize>(child);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -469,11 +469,11 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
|
||||
}
|
||||
else if (v1->orco) {
|
||||
uv1= uv[0]; uv2= uv[1]; uv3= uv[2]; uv4= uv[3];
|
||||
map_to_sphere( &uv[0][0], &uv[0][1],v1->orco[0], v1->orco[1], v1->orco[2]);
|
||||
map_to_sphere( &uv[1][0], &uv[1][1],v2->orco[0], v2->orco[1], v2->orco[2]);
|
||||
map_to_sphere( &uv[2][0], &uv[2][1],v3->orco[0], v3->orco[1], v3->orco[2]);
|
||||
map_to_sphere( &uv[0][0], &uv[0][1], v1->orco[0], v1->orco[1], v1->orco[2]);
|
||||
map_to_sphere( &uv[1][0], &uv[1][1], v2->orco[0], v2->orco[1], v2->orco[2]);
|
||||
map_to_sphere( &uv[2][0], &uv[2][1], v3->orco[0], v3->orco[1], v3->orco[2]);
|
||||
if (v4)
|
||||
map_to_sphere( &uv[3][0], &uv[3][1],v4->orco[0], v4->orco[1], v4->orco[2]);
|
||||
map_to_sphere( &uv[3][0], &uv[3][1], v4->orco[0], v4->orco[1], v4->orco[2]);
|
||||
}
|
||||
else return;
|
||||
|
||||
@@ -886,9 +886,9 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
|
||||
/* skip wire faces */
|
||||
if (vlr->v2 != vlr->v3) {
|
||||
if (vlr->v4)
|
||||
normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
else
|
||||
normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1061,7 +1061,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
width= w;
|
||||
|
||||
/*cross is the radius of the strand so we want it to be half of full width */
|
||||
mul_v3_fl(cross,0.5f/crosslen);
|
||||
mul_v3_fl(cross, 0.5f/crosslen);
|
||||
}
|
||||
else
|
||||
width/=w;
|
||||
@@ -1111,7 +1111,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
vlr->v3->orco= sd->orco;
|
||||
vlr->v3->accum= vlr->v4->accum;
|
||||
|
||||
normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
|
||||
vlr->mat= ma;
|
||||
vlr->ec= ME_V2V3;
|
||||
@@ -1124,7 +1124,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
if (sd->uvco) {
|
||||
for (i=0; i<sd->totuv; i++) {
|
||||
MTFace *mtf;
|
||||
mtf=RE_vlakren_get_tface(obr,vlr,i,NULL,1);
|
||||
mtf=RE_vlakren_get_tface(obr, vlr, i, NULL, 1);
|
||||
mtf->uv[0][0]=mtf->uv[1][0]=
|
||||
mtf->uv[2][0]=mtf->uv[3][0]=(sd->uvco+2*i)[0];
|
||||
mtf->uv[0][1]=mtf->uv[1][1]=
|
||||
@@ -1132,7 +1132,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
}
|
||||
if (sd->override_uv>=0) {
|
||||
MTFace *mtf;
|
||||
mtf=RE_vlakren_get_tface(obr,vlr,sd->override_uv,NULL,0);
|
||||
mtf=RE_vlakren_get_tface(obr, vlr, sd->override_uv, NULL, 0);
|
||||
|
||||
mtf->uv[0][0]=mtf->uv[3][0]=0.0f;
|
||||
mtf->uv[1][0]=mtf->uv[2][0]=1.0f;
|
||||
@@ -1144,7 +1144,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
if (sd->mcol) {
|
||||
for (i=0; i<sd->totcol; i++) {
|
||||
MCol *mc;
|
||||
mc=RE_vlakren_get_mcol(obr,vlr,i,NULL,1);
|
||||
mc=RE_vlakren_get_mcol(obr, vlr, i, NULL, 1);
|
||||
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
|
||||
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
|
||||
}
|
||||
@@ -1189,22 +1189,22 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
|
||||
if (sd->adapt) {
|
||||
second=0;
|
||||
copy_v3_v3(anor,nor);
|
||||
copy_v3_v3(avec,vec);
|
||||
copy_v3_v3(anor, nor);
|
||||
copy_v3_v3(avec, vec);
|
||||
}
|
||||
|
||||
}
|
||||
else if (sd->adapt) {
|
||||
float dvec[3],pvec[3];
|
||||
sub_v3_v3v3(dvec,avec,vec);
|
||||
project_v3_v3v3(pvec,dvec,vec);
|
||||
sub_v3_v3v3(dvec,dvec,pvec);
|
||||
float dvec[3], pvec[3];
|
||||
sub_v3_v3v3(dvec, avec, vec);
|
||||
project_v3_v3v3(pvec, dvec, vec);
|
||||
sub_v3_v3v3(dvec, dvec, pvec);
|
||||
|
||||
w= vec[2]*re->winmat[2][3] + re->winmat[3][3];
|
||||
dx= re->winx*dvec[0]*re->winmat[0][0]/w;
|
||||
dy= re->winy*dvec[1]*re->winmat[1][1]/w;
|
||||
w= sqrt(dx*dx + dy*dy);
|
||||
if (dot_v3v3(anor,nor)<sd->adapt_angle && w>sd->adapt_pix) {
|
||||
if (dot_v3v3(anor, nor)<sd->adapt_angle && w>sd->adapt_pix) {
|
||||
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
|
||||
vlr->flag= flag;
|
||||
vlr->v1= v1;
|
||||
@@ -1215,8 +1215,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
v1= vlr->v4; // cycle
|
||||
v2= vlr->v3; // cycle
|
||||
|
||||
copy_v3_v3(anor,nor);
|
||||
copy_v3_v3(avec,vec);
|
||||
copy_v3_v3(anor, nor);
|
||||
copy_v3_v3(avec, vec);
|
||||
}
|
||||
else {
|
||||
vlr= RE_findOrAddVlak(obr, obr->totvlak-1);
|
||||
@@ -1235,7 +1235,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
vlr->v3->orco= sd->orco;
|
||||
vlr->v3->accum= vlr->v4->accum;
|
||||
|
||||
normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
|
||||
vlr->mat= ma;
|
||||
vlr->ec= ME_V2V3;
|
||||
@@ -1248,7 +1248,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
if (sd->uvco) {
|
||||
for (i=0; i<sd->totuv; i++) {
|
||||
MTFace *mtf;
|
||||
mtf=RE_vlakren_get_tface(obr,vlr,i,NULL,1);
|
||||
mtf=RE_vlakren_get_tface(obr, vlr, i, NULL, 1);
|
||||
mtf->uv[0][0]=mtf->uv[1][0]=
|
||||
mtf->uv[2][0]=mtf->uv[3][0]=(sd->uvco+2*i)[0];
|
||||
mtf->uv[0][1]=mtf->uv[1][1]=
|
||||
@@ -1256,7 +1256,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
}
|
||||
if (sd->override_uv>=0) {
|
||||
MTFace *mtf;
|
||||
mtf=RE_vlakren_get_tface(obr,vlr,sd->override_uv,NULL,0);
|
||||
mtf=RE_vlakren_get_tface(obr, vlr, sd->override_uv, NULL, 0);
|
||||
|
||||
mtf->uv[0][0]=mtf->uv[3][0]=0.0f;
|
||||
mtf->uv[1][0]=mtf->uv[2][0]=1.0f;
|
||||
@@ -1268,7 +1268,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
|
||||
if (sd->mcol) {
|
||||
for (i=0; i<sd->totcol; i++) {
|
||||
MCol *mc;
|
||||
mc=RE_vlakren_get_mcol(obr,vlr,i,NULL,1);
|
||||
mc=RE_vlakren_get_mcol(obr, vlr, i, NULL, 1);
|
||||
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
|
||||
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
|
||||
}
|
||||
@@ -1372,11 +1372,11 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
|
||||
sub_v3_v3(vlr->v4->co, yvec);
|
||||
mul_m4_v3(re->viewmat, vlr->v4->co);
|
||||
|
||||
normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
copy_v3_v3(vlr->v1->n,vlr->n);
|
||||
copy_v3_v3(vlr->v2->n,vlr->n);
|
||||
copy_v3_v3(vlr->v3->n,vlr->n);
|
||||
copy_v3_v3(vlr->v4->n,vlr->n);
|
||||
normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
copy_v3_v3(vlr->v1->n, vlr->n);
|
||||
copy_v3_v3(vlr->v2->n, vlr->n);
|
||||
copy_v3_v3(vlr->v3->n, vlr->n);
|
||||
copy_v3_v3(vlr->v4->n, vlr->n);
|
||||
|
||||
vlr->mat= ma;
|
||||
vlr->ec= ME_V2V3;
|
||||
@@ -1395,8 +1395,8 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
|
||||
time = (float)fmod((bb->tilt + 1.0f) / 2.0f, 1.0);
|
||||
}
|
||||
else {
|
||||
float axis1[3] = {0.0f,0.0f,0.0f};
|
||||
float axis2[3] = {0.0f,0.0f,0.0f};
|
||||
float axis1[3] = {0.0f, 0.0f, 0.0f};
|
||||
float axis2[3] = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
axis1[(bb->align + 1) % 3] = 1.0f;
|
||||
axis2[(bb->align + 2) % 3] = 1.0f;
|
||||
@@ -1518,7 +1518,7 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int
|
||||
int i;
|
||||
|
||||
/* get uvco */
|
||||
if (sd->uvco && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
|
||||
if (sd->uvco && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
|
||||
for (i=0; i<sd->totuv; i++) {
|
||||
if (num != DMCACHE_NOTFOUND) {
|
||||
MFace *mface = dm->getTessFaceData(dm, num, CD_MFACE);
|
||||
@@ -1535,7 +1535,7 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int
|
||||
}
|
||||
|
||||
/* get mcol */
|
||||
if (sd->mcol && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
|
||||
if (sd->mcol && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
|
||||
for (i=0; i<sd->totcol; i++) {
|
||||
if (num != DMCACHE_NOTFOUND) {
|
||||
MFace *mface = dm->getTessFaceData(dm, num, CD_MFACE);
|
||||
@@ -1557,7 +1557,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
ParticleSystemModifierData *psmd;
|
||||
ParticleSystem *tpsys=0;
|
||||
ParticleSettings *part, *tpart=0;
|
||||
ParticleData *pars, *pa=0,*tpa=0;
|
||||
ParticleData *pars, *pa=0, *tpa=0;
|
||||
ParticleKey *states=0;
|
||||
ParticleKey state;
|
||||
ParticleCacheKey *cache=0;
|
||||
@@ -1569,7 +1569,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
StrandBound *sbound= 0;
|
||||
StrandRen *strand=0;
|
||||
RNG *rng= 0;
|
||||
float loc[3],loc1[3],loc0[3],mat[4][4],nmat[3][3],co[3],nor[3],duplimat[4][4];
|
||||
float loc[3], loc1[3], loc0[3], mat[4][4], nmat[3][3], co[3], nor[3], duplimat[4][4];
|
||||
float strandlen=0.0f, curlen=0.0f;
|
||||
float hasize, pa_size, r_tilt, r_length;
|
||||
float pa_time, pa_birthtime, pa_dietime;
|
||||
@@ -1597,7 +1597,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
/* 2. start initializing things */
|
||||
|
||||
/* last possibility to bail out! */
|
||||
psmd = psys_get_modifier(ob,psys);
|
||||
psmd = psys_get_modifier(ob, psys);
|
||||
if (!(psmd->modifier.mode & eModifierMode_Render))
|
||||
return 0;
|
||||
|
||||
@@ -1702,7 +1702,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
|
||||
/* 2.6 setup strand rendering */
|
||||
if (part->ren_as == PART_DRAW_PATH && psys->pathcache) {
|
||||
path_nbr=(int)pow(2.0,(double) part->ren_step);
|
||||
path_nbr=(int)pow(2.0, (double) part->ren_step);
|
||||
|
||||
if (path_nbr) {
|
||||
if (!ELEM(ma->material_type, MA_TYPE_HALO, MA_TYPE_WIRE)) {
|
||||
@@ -1770,7 +1770,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
psys->lattice = psys_get_lattice(&sim);
|
||||
|
||||
/* 3. start creating renderable things */
|
||||
for (a=0,pa=pars; a<totpart+totchild; a++, pa++, seed++) {
|
||||
for (a=0, pa=pars; a<totpart+totchild; a++, pa++, seed++) {
|
||||
random = rng_getFloat(rng);
|
||||
/* setup per particle individual stuff */
|
||||
if (a<totpart) {
|
||||
@@ -1786,10 +1786,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
/* get orco */
|
||||
if (tpsys && part->phystype == PART_PHYS_NO) {
|
||||
tpa = tpsys->particles + pa->num;
|
||||
psys_particle_on_emitter(psmd,tpart->from,tpa->num,pa->num_dmcache,tpa->fuv,tpa->foffset,co,nor,0,0,sd.orco,0);
|
||||
psys_particle_on_emitter(psmd, tpart->from, tpa->num, pa->num_dmcache, tpa->fuv, tpa->foffset, co, nor, 0, 0, sd.orco, 0);
|
||||
}
|
||||
else
|
||||
psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,sd.orco,0);
|
||||
psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);
|
||||
|
||||
/* get uvco & mcol */
|
||||
num= pa->num_dmcache;
|
||||
@@ -1835,14 +1835,14 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
/* get orco */
|
||||
if (part->childtype == PART_CHILD_FACES) {
|
||||
psys_particle_on_emitter(psmd,
|
||||
PART_FROM_FACE, cpa->num,DMCACHE_ISCHILD,
|
||||
cpa->fuv,cpa->foffset,co,nor,0,0,sd.orco,0);
|
||||
PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD,
|
||||
cpa->fuv, cpa->foffset, co, nor, 0, 0, sd.orco, 0);
|
||||
}
|
||||
else {
|
||||
ParticleData *par = psys->particles + cpa->parent;
|
||||
psys_particle_on_emitter(psmd, part->from,
|
||||
par->num,DMCACHE_ISCHILD,par->fuv,
|
||||
par->foffset,co,nor,0,0,sd.orco,0);
|
||||
par->num, DMCACHE_ISCHILD, par->fuv,
|
||||
par->foffset, co, nor, 0, 0, sd.orco, 0);
|
||||
}
|
||||
|
||||
/* get uvco & mcol */
|
||||
@@ -1943,8 +1943,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
float time;
|
||||
|
||||
if (k<=max_k) {
|
||||
copy_v3_v3(state.co,(cache+k)->co);
|
||||
copy_v3_v3(state.vel,(cache+k)->vel);
|
||||
copy_v3_v3(state.co, (cache+k)->co);
|
||||
copy_v3_v3(state.vel, (cache+k)->vel);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
@@ -1953,8 +1953,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
curlen += len_v3v3((cache+k-1)->co, (cache+k)->co);
|
||||
time= curlen/strandlen;
|
||||
|
||||
copy_v3_v3(loc,state.co);
|
||||
mul_m4_v3(re->viewmat,loc);
|
||||
copy_v3_v3(loc, state.co);
|
||||
mul_m4_v3(re->viewmat, loc);
|
||||
|
||||
if (strandbuf) {
|
||||
copy_v3_v3(svert->co, loc);
|
||||
@@ -1968,8 +1968,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
if (k==1) {
|
||||
sd.first = 1;
|
||||
sd.time = 0.0f;
|
||||
sub_v3_v3v3(loc0,loc1,loc);
|
||||
add_v3_v3v3(loc0,loc1,loc0);
|
||||
sub_v3_v3v3(loc0, loc1, loc);
|
||||
add_v3_v3v3(loc0, loc1, loc0);
|
||||
|
||||
particle_curve(re, obr, psmd->dm, ma, &sd, loc1, loc0, seed, pa_co);
|
||||
}
|
||||
@@ -1980,7 +1980,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
if (k)
|
||||
particle_curve(re, obr, psmd->dm, ma, &sd, loc, loc1, seed, pa_co);
|
||||
|
||||
copy_v3_v3(loc1,loc);
|
||||
copy_v3_v3(loc1, loc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2005,7 +2005,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
continue;
|
||||
|
||||
state.time = (part->draw & PART_ABS_PATH_TIME) ? -ct : ct;
|
||||
psys_get_particle_on_path(&sim,a,&state,1);
|
||||
psys_get_particle_on_path(&sim, a, &state, 1);
|
||||
|
||||
if (psys->parent)
|
||||
mul_m4_v3(psys->parent->obmat, state.co);
|
||||
@@ -2042,7 +2042,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
}
|
||||
else {
|
||||
state.time=cfra;
|
||||
if (psys_get_particle_state(&sim,a,&state,0)==0)
|
||||
if (psys_get_particle_state(&sim, a, &state, 0)==0)
|
||||
continue;
|
||||
|
||||
if (psys->parent)
|
||||
@@ -2363,7 +2363,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
|
||||
|
||||
/* Displace the verts, flag is set when done */
|
||||
if (!vlr->v1->flag)
|
||||
displace_render_vert(re, obr, &shi, vlr->v1,0, scale, mat, imat);
|
||||
displace_render_vert(re, obr, &shi, vlr->v1, 0, scale, mat, imat);
|
||||
|
||||
if (!vlr->v2->flag)
|
||||
displace_render_vert(re, obr, &shi, vlr->v2, 1, scale, mat, imat);
|
||||
@@ -2383,10 +2383,10 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
|
||||
|
||||
/* Recalculate the face normal - if flipped before, flip now */
|
||||
if (vlr->v4) {
|
||||
normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
}
|
||||
else {
|
||||
normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2502,9 +2502,9 @@ static void init_render_mball(Render *re, ObjectRen *obr)
|
||||
vlr->v4= 0;
|
||||
|
||||
if (negative_scale)
|
||||
normal_tri_v3( vlr->n,vlr->v1->co, vlr->v2->co, vlr->v3->co);
|
||||
normal_tri_v3(vlr->n, vlr->v1->co, vlr->v2->co, vlr->v3->co);
|
||||
else
|
||||
normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
|
||||
vlr->mat= ma;
|
||||
vlr->flag= ME_SMOOTH;
|
||||
@@ -2519,9 +2519,9 @@ static void init_render_mball(Render *re, ObjectRen *obr)
|
||||
vlr1->v2= vlr1->v3;
|
||||
vlr1->v3= RE_findOrAddVert(obr, index[3]);
|
||||
if (negative_scale)
|
||||
normal_tri_v3( vlr1->n,vlr1->v1->co, vlr1->v2->co, vlr1->v3->co);
|
||||
normal_tri_v3(vlr1->n, vlr1->v1->co, vlr1->v2->co, vlr1->v3->co);
|
||||
else
|
||||
normal_tri_v3( vlr1->n,vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
|
||||
normal_tri_v3(vlr1->n, vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2610,7 +2610,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
|
||||
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
|
||||
vlr->v1= v1; vlr->v2= v2; vlr->v3= v3; vlr->v4= v4;
|
||||
|
||||
normal_quad_v3( n1,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_quad_v3(n1, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
|
||||
copy_v3_v3(vlr->n, n1);
|
||||
|
||||
@@ -2671,12 +2671,12 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
|
||||
*/
|
||||
|
||||
if ((dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)) {
|
||||
vlr= RE_findOrAddVlak(obr, UVTOINDEX(sizeu - 1, sizev - 1)); /* (m,n) */
|
||||
vlr1= RE_findOrAddVlak(obr, UVTOINDEX(0,0)); /* (0,0) */
|
||||
vlr= RE_findOrAddVlak(obr, UVTOINDEX(sizeu - 1, sizev - 1)); /* (m, n) */
|
||||
vlr1= RE_findOrAddVlak(obr, UVTOINDEX(0, 0)); /* (0, 0) */
|
||||
add_v3_v3v3(n1, vlr->n, vlr1->n);
|
||||
vlr2= RE_findOrAddVlak(obr, UVTOINDEX(0, sizev-1)); /* (0,n) */
|
||||
vlr2= RE_findOrAddVlak(obr, UVTOINDEX(0, sizev-1)); /* (0, n) */
|
||||
add_v3_v3(n1, vlr2->n);
|
||||
vlr3= RE_findOrAddVlak(obr, UVTOINDEX(sizeu-1, 0)); /* (m,0) */
|
||||
vlr3= RE_findOrAddVlak(obr, UVTOINDEX(sizeu-1, 0)); /* (m, 0) */
|
||||
add_v3_v3(n1, vlr3->n);
|
||||
copy_v3_v3(vlr->v3->n, n1);
|
||||
copy_v3_v3(vlr1->v1->n, n1);
|
||||
@@ -2754,9 +2754,9 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
|
||||
|
||||
/* render normals are inverted in render */
|
||||
if (vlr->v4)
|
||||
len= normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
len= normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
else
|
||||
len= normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
len= normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
|
||||
vlr->mat= ma;
|
||||
vlr->flag= flag;
|
||||
@@ -2981,7 +2981,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
|
||||
orco+= 3*dl_surf_to_renderdata(obr, dl, matar, orco, mat);
|
||||
}
|
||||
else {
|
||||
int p1,p2,p3,p4;
|
||||
int p1, p2, p3, p4;
|
||||
|
||||
fp= dl->verts;
|
||||
startvert= obr->totvert;
|
||||
@@ -3437,15 +3437,15 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
|
||||
MVert *mv= me->mvert;
|
||||
|
||||
if (vlr->v4)
|
||||
len= normal_quad_v3( vlr->n, mv[mf->v4].co, mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
|
||||
len= normal_quad_v3(vlr->n, mv[mf->v4].co, mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
|
||||
else
|
||||
len= normal_tri_v3( vlr->n,mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
|
||||
len= normal_tri_v3(vlr->n, mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
|
||||
}
|
||||
else {
|
||||
if (vlr->v4)
|
||||
len= normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
len= normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
else
|
||||
len= normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
len= normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
}
|
||||
|
||||
vlr->mat= ma;
|
||||
@@ -3584,7 +3584,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4])
|
||||
/* if (la->spsi<16) return; */
|
||||
|
||||
/* memory alloc */
|
||||
shb= (struct ShadBuf *)MEM_callocN( sizeof(struct ShadBuf),"initshadbuf");
|
||||
shb= (struct ShadBuf *)MEM_callocN( sizeof(struct ShadBuf), "initshadbuf");
|
||||
lar->shb= shb;
|
||||
|
||||
if (shb==NULL) return;
|
||||
@@ -3683,7 +3683,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
|
||||
BLI_addtail(&re->lights, go);
|
||||
go->ob= ob;
|
||||
/* lamprens are in own list, for freeing */
|
||||
lar= (LampRen *)MEM_callocN(sizeof(LampRen),"lampren");
|
||||
lar= (LampRen *)MEM_callocN(sizeof(LampRen), "lampren");
|
||||
BLI_addtail(&re->lampren, lar);
|
||||
go->lampren= lar;
|
||||
|
||||
@@ -3794,7 +3794,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
|
||||
lar->sunsky = (struct SunSky*)MEM_callocN(sizeof(struct SunSky), "sunskyren");
|
||||
lar->sunsky->effect_type = la->sun_effect_type;
|
||||
|
||||
copy_v3_v3(vec,ob->obmat[2]);
|
||||
copy_v3_v3(vec, ob->obmat[2]);
|
||||
normalize_v3(vec);
|
||||
|
||||
InitSunSky(lar->sunsky, la->atm_turbidity, vec, la->horizon_brightness,
|
||||
@@ -3844,7 +3844,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
|
||||
if (la->haint>0.0f) {
|
||||
re->flag |= R_LAMPHALO;
|
||||
|
||||
/* camera position (0,0,0) rotate around lamp */
|
||||
/* camera position (0, 0, 0) rotate around lamp */
|
||||
lar->sh_invcampos[0]= -lar->co[0];
|
||||
lar->sh_invcampos[1]= -lar->co[1];
|
||||
lar->sh_invcampos[2]= -lar->co[2];
|
||||
@@ -4133,7 +4133,7 @@ static void set_fullsample_trace_flag(Render *re, ObjectRen *obr)
|
||||
}
|
||||
|
||||
/* split quads for predictable baking
|
||||
* dir 1 == (0,1,2) (0,2,3), 2 == (1,3,0) (1,2,3)
|
||||
* dir 1 == (0, 1, 2) (0, 2, 3), 2 == (1, 3, 0) (1, 2, 3)
|
||||
*/
|
||||
static void split_quads(ObjectRen *obr, int dir)
|
||||
{
|
||||
@@ -4174,8 +4174,8 @@ static void split_quads(ObjectRen *obr, int dir)
|
||||
vlr->v4 = vlr1->v4 = NULL;
|
||||
|
||||
/* new normals */
|
||||
normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_tri_v3( vlr1->n,vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
|
||||
normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_tri_v3(vlr1->n, vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
|
||||
}
|
||||
/* clear the flag when not divided */
|
||||
else vlr->flag &= ~R_DIVIDE_24;
|
||||
@@ -4239,8 +4239,8 @@ static void check_non_flat_quads(ObjectRen *obr)
|
||||
/* 1---2 1---2 0 = orig face, 1 = new face */
|
||||
|
||||
/* render normals are inverted in render! we calculate normal of single tria here */
|
||||
flen= normal_tri_v3( nor,vlr->v4->co, vlr->v3->co, vlr->v1->co);
|
||||
if (flen==0.0f) normal_tri_v3( nor,vlr->v4->co, vlr->v2->co, vlr->v1->co);
|
||||
flen= normal_tri_v3(nor, vlr->v4->co, vlr->v3->co, vlr->v1->co);
|
||||
if (flen==0.0f) normal_tri_v3(nor, vlr->v4->co, vlr->v2->co, vlr->v1->co);
|
||||
|
||||
xn = dot_v3v3(nor, vlr->n);
|
||||
|
||||
@@ -4252,10 +4252,10 @@ static void check_non_flat_quads(ObjectRen *obr)
|
||||
vlr1->flag |= R_FACE_SPLIT;
|
||||
|
||||
/* split direction based on vnorms */
|
||||
normal_tri_v3( nor,vlr->v1->co, vlr->v2->co, vlr->v3->co);
|
||||
normal_tri_v3(nor, vlr->v1->co, vlr->v2->co, vlr->v3->co);
|
||||
d1 = dot_v3v3(nor, vlr->v1->n);
|
||||
|
||||
normal_tri_v3( nor,vlr->v2->co, vlr->v3->co, vlr->v4->co);
|
||||
normal_tri_v3(nor, vlr->v2->co, vlr->v3->co, vlr->v4->co);
|
||||
d2 = dot_v3v3(nor, vlr->v2->n);
|
||||
|
||||
if ( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
|
||||
@@ -4281,8 +4281,8 @@ static void check_non_flat_quads(ObjectRen *obr)
|
||||
vlr->v4 = vlr1->v4 = NULL;
|
||||
|
||||
/* new normals */
|
||||
normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_tri_v3( vlr1->n,vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
|
||||
normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
|
||||
normal_tri_v3(vlr1->n, vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
|
||||
}
|
||||
/* clear the flag when not divided */
|
||||
else vlr->flag &= ~R_DIVIDE_24;
|
||||
@@ -5260,7 +5260,7 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
|
||||
/* use cylinder projection */
|
||||
if (pano) {
|
||||
float vec[3], ang;
|
||||
/* angle between (0,0,-1) and (co) */
|
||||
/* angle between (0, 0, -1) and (co) */
|
||||
copy_v3_v3(vec, co);
|
||||
|
||||
ang= saacos(-vec[2]/sqrtf(vec[0]*vec[0] + vec[2]*vec[2]));
|
||||
@@ -5398,7 +5398,7 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
|
||||
co3= mesh->co[face[2]];
|
||||
co4= (face[3])? mesh->co[face[3]]: NULL;
|
||||
|
||||
interp_weights_face_v3( w,co1, co2, co3, co4, strand->vert->co);
|
||||
interp_weights_face_v3(w, co1, co2, co3, co4, strand->vert->co);
|
||||
|
||||
zero_v4(speed);
|
||||
madd_v4_v4fl(speed, winspeed[face[0]], w[0]);
|
||||
@@ -5649,7 +5649,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
|
||||
// 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
|
||||
// use preloaded per vertex simulation data, only does calculation for step=1
|
||||
// NOTE/FIXME - velocities and meshes loaded unnecessarily often during the database_fromscene_vectors calls...
|
||||
load_fluidsimspeedvectors(re, obi, oldobi->vectors, step);
|
||||
}
|
||||
|
||||
@@ -239,10 +239,10 @@ static void envmap_transmatrix(float mat[][4], int part)
|
||||
}
|
||||
|
||||
copy_m4_m4(tmat, mat);
|
||||
eul_to_mat4( rotmat,eul);
|
||||
eul_to_mat4(rotmat, eul);
|
||||
mul_serie_m4(mat, tmat, rotmat,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -1482,10 +1482,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
|
||||
|
||||
/* pixel coordinates */
|
||||
|
||||
minx= MIN3(dxt[0],dyt[0],dxt[0]+dyt[0] );
|
||||
maxx= MAX3(dxt[0],dyt[0],dxt[0]+dyt[0] );
|
||||
miny= MIN3(dxt[1],dyt[1],dxt[1]+dyt[1] );
|
||||
maxy= MAX3(dxt[1],dyt[1],dxt[1]+dyt[1] );
|
||||
minx = MIN3(dxt[0], dyt[0], dxt[0] + dyt[0]);
|
||||
maxx = MAX3(dxt[0], dyt[0], dxt[0] + dyt[0]);
|
||||
miny = MIN3(dxt[1], dyt[1], dxt[1] + dyt[1]);
|
||||
maxy = MAX3(dxt[1], dyt[1], dxt[1] + dyt[1]);
|
||||
|
||||
/* tex_sharper has been removed */
|
||||
minx= (maxx-minx)/2.0f;
|
||||
|
||||
@@ -1627,11 +1627,11 @@ static void *exec_strandsurface_sample(void *data)
|
||||
co4= mesh->co[face[3]];
|
||||
|
||||
mid_v3_v3v3(co, co1, co3);
|
||||
normal_quad_v3( n,co1, co2, co3, co4);
|
||||
normal_quad_v3(n, co1, co2, co3, co4);
|
||||
}
|
||||
else {
|
||||
cent_tri_v3(co, co1, co2, co3);
|
||||
normal_tri_v3( n,co1, co2, co3);
|
||||
normal_tri_v3(n, co1, co2, co3);
|
||||
}
|
||||
negate_v3(n);
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ void RE_SetWindow(Render *re, rctf *viewplane, float clipsta, float clipend)
|
||||
re->clipend= clipend;
|
||||
re->r.mode &= ~R_ORTHO;
|
||||
|
||||
perspective_m4( re->winmat,re->viewplane.xmin, re->viewplane.xmax, re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
|
||||
perspective_m4( re->winmat, re->viewplane.xmin, re->viewplane.xmax, re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
|
||||
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ void RE_SetOrtho(Render *re, rctf *viewplane, float clipsta, float clipend)
|
||||
re->clipend= clipend;
|
||||
re->r.mode |= R_ORTHO;
|
||||
|
||||
orthographic_m4( re->winmat,re->viewplane.xmin, re->viewplane.xmax, re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
|
||||
orthographic_m4( re->winmat, re->viewplane.xmin, re->viewplane.xmax, re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
|
||||
}
|
||||
|
||||
void RE_SetView(Render *re, float mat[][4])
|
||||
@@ -2375,7 +2375,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char
|
||||
|
||||
ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat);
|
||||
if (ibuf_clip) {
|
||||
IMB_rectcpy(ibuf_clip, ibuf, 0,0, x,y, layer->rectx, layer->recty);
|
||||
IMB_rectcpy(ibuf_clip, ibuf, 0, 0, x, y, layer->rectx, layer->recty);
|
||||
|
||||
memcpy(layer->rectf, ibuf_clip->rect_float, sizeof(float)*4*layer->rectx*layer->recty);
|
||||
IMB_freeImBuf(ibuf_clip);
|
||||
@@ -2404,7 +2404,7 @@ void RE_result_load_from_file(RenderResult *result, ReportList *reports, const c
|
||||
}
|
||||
}
|
||||
|
||||
const float default_envmap_layout[] = { 0,0, 1,0, 2,0, 0,1, 1,1, 2,1 };
|
||||
const float default_envmap_layout[] = { 0, 0, 1, 0, 2, 0, 0, 1, 1, 1, 2, 1 };
|
||||
|
||||
int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env, const char *relpath, const char imtype, float layout[12])
|
||||
{
|
||||
@@ -2412,7 +2412,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
|
||||
ImBuf *ibuf=NULL;
|
||||
int ok;
|
||||
int dx;
|
||||
int maxX=0,maxY=0,i=0;
|
||||
int maxX=0, maxY=0, i=0;
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
if (env->cube[1]==NULL) {
|
||||
@@ -2427,8 +2427,8 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
|
||||
|
||||
if (env->type == ENV_CUBE) {
|
||||
for (i=0; i < 12; i+=2) {
|
||||
maxX = MAX2(maxX,layout[i] + 1);
|
||||
maxY = MAX2(maxY,layout[i+1] + 1);
|
||||
maxX = MAX2(maxX, layout[i] + 1);
|
||||
maxY = MAX2(maxY, layout[i+1] + 1);
|
||||
}
|
||||
|
||||
ibuf = IMB_allocImBuf(maxX*dx, maxY*dx, 24, IB_rectfloat);
|
||||
|
||||
@@ -121,7 +121,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
|
||||
/* Just to create a valid rendering context for particles */
|
||||
psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, 0);
|
||||
|
||||
dm = mesh_create_derived_render(re->scene, ob,CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
|
||||
dm = mesh_create_derived_render(re->scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
|
||||
|
||||
if ( !psys_check_enabled(ob, psys)) {
|
||||
psys_render_restore(ob, psys);
|
||||
|
||||
@@ -1314,7 +1314,7 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
|
||||
/* get a quasi-random vector from a phong-weighted disc */
|
||||
QMC_samplePhong(samp3d, qsa, shi->thread, samples, blur);
|
||||
|
||||
ortho_basis_v3v3_v3( orthx, orthy,v_refract);
|
||||
ortho_basis_v3v3_v3(orthx, orthy, v_refract);
|
||||
mul_v3_fl(orthx, samp3d[0]);
|
||||
mul_v3_fl(orthy, samp3d[1]);
|
||||
|
||||
@@ -1410,7 +1410,7 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
|
||||
mul_v3_fl(orthy, samp3d[1]*aniso);
|
||||
}
|
||||
else {
|
||||
ortho_basis_v3v3_v3( orthx, orthy,shi->vn);
|
||||
ortho_basis_v3v3_v3(orthx, orthy, shi->vn);
|
||||
mul_v3_fl(orthx, samp3d[0]);
|
||||
mul_v3_fl(orthy, samp3d[1]);
|
||||
}
|
||||
@@ -1913,7 +1913,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
|
||||
copy_v3_v3(nrm, shi->facenor);
|
||||
}
|
||||
|
||||
ortho_basis_v3v3_v3( up, side,nrm);
|
||||
ortho_basis_v3v3_v3(up, side, nrm);
|
||||
|
||||
/* sampling init */
|
||||
if (R.wrld.ao_samp_method==WO_AOSAMP_HALTON) {
|
||||
@@ -2262,10 +2262,10 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
|
||||
/* calc tangent plane vectors */
|
||||
sub_v3_v3v3(v, co, lampco);
|
||||
normalize_v3(v);
|
||||
ortho_basis_v3v3_v3( ru, rv,v);
|
||||
ortho_basis_v3v3_v3(ru, rv, v);
|
||||
|
||||
/* sampling, returns quasi-random vector in area_size disc */
|
||||
QMC_sampleDisc(samp3d, qsa, shi->thread, samples,lar->area_size);
|
||||
QMC_sampleDisc(samp3d, qsa, shi->thread, samples, lar->area_size);
|
||||
|
||||
/* distribute disc samples across the tangent plane */
|
||||
s[0] = samp3d[0]*ru[0] + samp3d[1]*rv[0];
|
||||
|
||||
@@ -227,7 +227,7 @@ static int blend(Tex *tex, float *texvec, TexResult *texres)
|
||||
texres->tin= (2.0f+x+y)/4.0f;
|
||||
}
|
||||
else if (tex->stype==TEX_RAD) { /* radial */
|
||||
texres->tin= (atan2(y,x) / (2*M_PI) + 0.5);
|
||||
texres->tin= (atan2(y, x) / (2*M_PI) + 0.5);
|
||||
}
|
||||
else { /* sphere TEX_SPHERE */
|
||||
texres->tin= 1.0-sqrt(x*x+ y*y+texvec[2]*texvec[2]);
|
||||
@@ -870,7 +870,7 @@ static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z
|
||||
/* test for v1, vlr can be faked for baking */
|
||||
if (vlr->v1 && vlr->v1->orco) {
|
||||
float nor[3];
|
||||
normal_tri_v3( nor,vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
|
||||
normal_tri_v3(nor, vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
|
||||
|
||||
if ( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
|
||||
else if ( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
|
||||
@@ -969,8 +969,8 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
|
||||
fx = (t[0] + 1.0f) / 2.0f;
|
||||
fy = (t[1] + 1.0f) / 2.0f;
|
||||
}
|
||||
else if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
|
||||
else if (wrap==MTEX_SPHERE) map_to_sphere( &fx, &fy,t[0], t[1], t[2]);
|
||||
else if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy, t[0], t[1], t[2]);
|
||||
else if (wrap==MTEX_SPHERE) map_to_sphere( &fx, &fy, t[0], t[1], t[2]);
|
||||
else {
|
||||
if (texco==TEXCO_OBJECT) cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
|
||||
else if (texco==TEXCO_GLOB) cubemap_glob(n, t[0], t[1], t[2], &fx, &fy);
|
||||
@@ -1041,20 +1041,20 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
|
||||
}
|
||||
if (ok) {
|
||||
if (wrap==MTEX_TUBE) {
|
||||
map_to_tube( area, area+1,t[0], t[1], t[2]);
|
||||
map_to_tube( area+2, area+3,t[0]+dxt[0], t[1]+dxt[1], t[2]+dxt[2]);
|
||||
map_to_tube( area+4, area+5,t[0]+dyt[0], t[1]+dyt[1], t[2]+dyt[2]);
|
||||
map_to_tube( area, area+1, t[0], t[1], t[2]);
|
||||
map_to_tube( area+2, area+3, t[0]+dxt[0], t[1]+dxt[1], t[2]+dxt[2]);
|
||||
map_to_tube( area+4, area+5, t[0]+dyt[0], t[1]+dyt[1], t[2]+dyt[2]);
|
||||
}
|
||||
else {
|
||||
map_to_sphere(area,area+1,t[0], t[1], t[2]);
|
||||
map_to_sphere( area+2, area+3,t[0]+dxt[0], t[1]+dxt[1], t[2]+dxt[2]);
|
||||
map_to_sphere( area+4, area+5,t[0]+dyt[0], t[1]+dyt[1], t[2]+dyt[2]);
|
||||
map_to_sphere(area, area+1, t[0], t[1], t[2]);
|
||||
map_to_sphere( area+2, area+3, t[0]+dxt[0], t[1]+dxt[1], t[2]+dxt[2]);
|
||||
map_to_sphere( area+4, area+5, t[0]+dyt[0], t[1]+dyt[1], t[2]+dyt[2]);
|
||||
}
|
||||
areaflag= 1;
|
||||
}
|
||||
else {
|
||||
if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
|
||||
else map_to_sphere( &fx, &fy,t[0], t[1], t[2]);
|
||||
if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy, t[0], t[1], t[2]);
|
||||
else map_to_sphere( &fx, &fy, t[0], t[1], t[2]);
|
||||
dxt[0]/= 2.0f;
|
||||
dxt[1]/= 2.0f;
|
||||
dyt[0]/= 2.0f;
|
||||
@@ -3077,8 +3077,8 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
|
||||
case TEXCO_H_SPHEREMAP:
|
||||
case TEXCO_H_TUBEMAP:
|
||||
if (skyflag & WO_ZENUP) {
|
||||
if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
|
||||
else map_to_sphere( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
|
||||
if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1, lo[0], lo[2], lo[1]);
|
||||
else map_to_sphere( tempvec, tempvec+1, lo[0], lo[2], lo[1]);
|
||||
/* tube/spheremap maps for outside view, not inside */
|
||||
tempvec[0]= 1.0f-tempvec[0];
|
||||
/* only top half */
|
||||
@@ -3683,7 +3683,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
|
||||
if (!mvert || !mface || !mat) return;
|
||||
v1=mface[face_index].v1, v2=mface[face_index].v2, v3=mface[face_index].v3;
|
||||
if (hit_quad) {v2=mface[face_index].v3; v3=mface[face_index].v4;}
|
||||
normal_tri_v3( normal, mvert[v1].co, mvert[v2].co, mvert[v3].co);
|
||||
normal_tri_v3(normal, mvert[v1].co, mvert[v2].co, mvert[v3].co);
|
||||
|
||||
/* generate shadeinput with data required */
|
||||
shi.mat = mat;
|
||||
@@ -3737,7 +3737,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
|
||||
}
|
||||
}
|
||||
/* active uv map */
|
||||
shi.actuv = CustomData_get_active_layer_index(&orcoDm->faceData,CD_MTFACE) - layer_index;
|
||||
shi.actuv = CustomData_get_active_layer_index(&orcoDm->faceData, CD_MTFACE) - layer_index;
|
||||
shi.totuv = layers;
|
||||
}
|
||||
|
||||
|
||||
@@ -889,10 +889,10 @@ static PixStrMain *addpsmain(ListBase *lb)
|
||||
{
|
||||
PixStrMain *psm;
|
||||
|
||||
psm= (PixStrMain *)MEM_mallocN(sizeof(PixStrMain),"pixstrMain");
|
||||
psm= (PixStrMain *)MEM_mallocN(sizeof(PixStrMain), "pixstrMain");
|
||||
BLI_addtail(lb, psm);
|
||||
|
||||
psm->ps= (PixStr *)MEM_mallocN(4096*sizeof(PixStr),"pixstr");
|
||||
psm->ps= (PixStr *)MEM_mallocN(4096*sizeof(PixStr), "pixstr");
|
||||
psm->counter= 0;
|
||||
|
||||
return psm;
|
||||
|
||||
@@ -254,7 +254,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
|
||||
int a;
|
||||
|
||||
if (nr<0) {
|
||||
printf("error in findOrAddVert: %d\n",nr);
|
||||
printf("error in findOrAddVert: %d\n", nr);
|
||||
return NULL;
|
||||
}
|
||||
a= nr>>8;
|
||||
@@ -262,7 +262,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
|
||||
if (a>=obr->vertnodeslen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
|
||||
temp= obr->vertnodes;
|
||||
|
||||
obr->vertnodes= MEM_mallocN(sizeof(VertTableNode)*(obr->vertnodeslen+TABLEINITSIZE) , "vertnodes");
|
||||
obr->vertnodes= MEM_mallocN(sizeof(VertTableNode)*(obr->vertnodeslen+TABLEINITSIZE), "vertnodes");
|
||||
if (temp) memcpy(obr->vertnodes, temp, obr->vertnodeslen*sizeof(VertTableNode));
|
||||
memset(obr->vertnodes+obr->vertnodeslen, 0, TABLEINITSIZE*sizeof(VertTableNode));
|
||||
|
||||
@@ -274,7 +274,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
|
||||
if (v==NULL) {
|
||||
int i;
|
||||
|
||||
v= (VertRen *)MEM_callocN(256*sizeof(VertRen),"findOrAddVert");
|
||||
v= (VertRen *)MEM_callocN(256*sizeof(VertRen), "findOrAddVert");
|
||||
obr->vertnodes[a].vert= v;
|
||||
|
||||
for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++) {
|
||||
@@ -497,7 +497,7 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
|
||||
int a;
|
||||
|
||||
if (nr<0) {
|
||||
printf("error in findOrAddVlak: %d\n",nr);
|
||||
printf("error in findOrAddVlak: %d\n", nr);
|
||||
return obr->vlaknodes[0].vlak;
|
||||
}
|
||||
a= nr>>8;
|
||||
@@ -505,7 +505,7 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
|
||||
if (a>=obr->vlaknodeslen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
|
||||
temp= obr->vlaknodes;
|
||||
|
||||
obr->vlaknodes= MEM_mallocN(sizeof(VlakTableNode)*(obr->vlaknodeslen+TABLEINITSIZE) , "vlaknodes");
|
||||
obr->vlaknodes= MEM_mallocN(sizeof(VlakTableNode)*(obr->vlaknodeslen+TABLEINITSIZE), "vlaknodes");
|
||||
if (temp) memcpy(obr->vlaknodes, temp, obr->vlaknodeslen*sizeof(VlakTableNode));
|
||||
memset(obr->vlaknodes+obr->vlaknodeslen, 0, TABLEINITSIZE*sizeof(VlakTableNode));
|
||||
|
||||
@@ -518,7 +518,7 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
|
||||
if (v==NULL) {
|
||||
int i;
|
||||
|
||||
v= (VlakRen *)MEM_callocN(256*sizeof(VlakRen),"findOrAddVlak");
|
||||
v= (VlakRen *)MEM_callocN(256*sizeof(VlakRen), "findOrAddVlak");
|
||||
obr->vlaknodes[a].vlak= v;
|
||||
|
||||
for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
|
||||
@@ -668,7 +668,7 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
|
||||
int a;
|
||||
|
||||
if (nr<0) {
|
||||
printf("error in findOrAddStrand: %d\n",nr);
|
||||
printf("error in findOrAddStrand: %d\n", nr);
|
||||
return obr->strandnodes[0].strand;
|
||||
}
|
||||
a= nr>>8;
|
||||
@@ -676,7 +676,7 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
|
||||
if (a>=obr->strandnodeslen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
|
||||
temp= obr->strandnodes;
|
||||
|
||||
obr->strandnodes= MEM_mallocN(sizeof(StrandTableNode)*(obr->strandnodeslen+TABLEINITSIZE) , "strandnodes");
|
||||
obr->strandnodes= MEM_mallocN(sizeof(StrandTableNode)*(obr->strandnodeslen+TABLEINITSIZE), "strandnodes");
|
||||
if (temp) memcpy(obr->strandnodes, temp, obr->strandnodeslen*sizeof(StrandTableNode));
|
||||
memset(obr->strandnodes+obr->strandnodeslen, 0, TABLEINITSIZE*sizeof(StrandTableNode));
|
||||
|
||||
@@ -689,7 +689,7 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
|
||||
if (v==NULL) {
|
||||
int i;
|
||||
|
||||
v= (StrandRen *)MEM_callocN(256*sizeof(StrandRen),"findOrAddStrand");
|
||||
v= (StrandRen *)MEM_callocN(256*sizeof(StrandRen), "findOrAddStrand");
|
||||
obr->strandnodes[a].strand= v;
|
||||
|
||||
for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
|
||||
@@ -903,7 +903,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
|
||||
int a;
|
||||
|
||||
if (nr<0) {
|
||||
printf("error in findOrAddHalo: %d\n",nr);
|
||||
printf("error in findOrAddHalo: %d\n", nr);
|
||||
return NULL;
|
||||
}
|
||||
a= nr>>8;
|
||||
@@ -913,7 +913,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
|
||||
// TABLEINITSIZE, obr->blohalen+TABLEINITSIZE );
|
||||
temp=obr->bloha;
|
||||
|
||||
obr->bloha=(HaloRen**)MEM_callocN(sizeof(void*)*(obr->blohalen+TABLEINITSIZE) , "Bloha");
|
||||
obr->bloha=(HaloRen**)MEM_callocN(sizeof(void*)*(obr->blohalen+TABLEINITSIZE), "Bloha");
|
||||
if (temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void*));
|
||||
memset(&(obr->bloha[obr->blohalen]), 0, TABLEINITSIZE*sizeof(void*));
|
||||
obr->blohalen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/
|
||||
@@ -922,7 +922,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
|
||||
|
||||
h= obr->bloha[a];
|
||||
if (h==NULL) {
|
||||
h= (HaloRen *)MEM_callocN(256*sizeof(HaloRen),"findOrAdHalo");
|
||||
h= (HaloRen *)MEM_callocN(256*sizeof(HaloRen), "findOrAdHalo");
|
||||
obr->bloha[a]= h;
|
||||
}
|
||||
h+= (nr & 255);
|
||||
@@ -1050,7 +1050,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
||||
HaloRen *har;
|
||||
MTex *mtex;
|
||||
float tin, tr, tg, tb, ta;
|
||||
float xn, yn, zn, texvec[3], hoco[4], hoco1[4], in[3],tex[3],out[3];
|
||||
float xn, yn, zn, texvec[3], hoco[4], hoco1[4], in[3], tex[3], out[3];
|
||||
int i, hasrgb;
|
||||
|
||||
if (hasize==0.0f) return NULL;
|
||||
@@ -1124,24 +1124,24 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
||||
}
|
||||
else if (mtex->texco & TEXCO_OBJECT) {
|
||||
if (mtex->object)
|
||||
mul_m4_v3(mtex->object->imat_ren,texvec);
|
||||
mul_m4_v3(mtex->object->imat_ren, texvec);
|
||||
}
|
||||
else if (mtex->texco & TEXCO_GLOB) {
|
||||
copy_v3_v3(texvec,vec);
|
||||
copy_v3_v3(texvec, vec);
|
||||
}
|
||||
else if (mtex->texco & TEXCO_UV && uvco) {
|
||||
int uv_index=CustomData_get_named_layer_index(&dm->faceData,CD_MTFACE,mtex->uvname);
|
||||
int uv_index=CustomData_get_named_layer_index(&dm->faceData, CD_MTFACE, mtex->uvname);
|
||||
if (uv_index<0)
|
||||
uv_index=CustomData_get_active_layer_index(&dm->faceData,CD_MTFACE);
|
||||
uv_index=CustomData_get_active_layer_index(&dm->faceData, CD_MTFACE);
|
||||
|
||||
uv_index-=CustomData_get_layer_index(&dm->faceData,CD_MTFACE);
|
||||
uv_index-=CustomData_get_layer_index(&dm->faceData, CD_MTFACE);
|
||||
|
||||
texvec[0]=2.0f*uvco[2*uv_index]-1.0f;
|
||||
texvec[1]=2.0f*uvco[2*uv_index+1]-1.0f;
|
||||
texvec[2]=0.0f;
|
||||
}
|
||||
else if (mtex->texco & TEXCO_PARTICLE) {
|
||||
/* particle coordinates in range [0,1] */
|
||||
/* particle coordinates in range [0, 1] */
|
||||
texvec[0] = 2.f * pa_co[0] - 1.f;
|
||||
texvec[1] = 2.f * pa_co[1] - 1.f;
|
||||
texvec[2] = pa_co[2];
|
||||
@@ -1162,7 +1162,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
||||
out[1]=har->g;
|
||||
out[2]=har->b;
|
||||
|
||||
texture_rgb_blend(in,tex,out,tin,mtex->colfac,mtex->blendtype);
|
||||
texture_rgb_blend(in, tex, out, tin, mtex->colfac, mtex->blendtype);
|
||||
// zn= 1.0-yn;
|
||||
//har->r= (yn*tr+ zn*ma->r);
|
||||
//har->g= (yn*tg+ zn*ma->g);
|
||||
@@ -1177,13 +1177,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
||||
tin = ta;
|
||||
|
||||
if (mtex->mapto & MAP_ALPHA)
|
||||
har->alfa = texture_value_blend(mtex->def_var,har->alfa,tin,mtex->alphafac,mtex->blendtype);
|
||||
har->alfa = texture_value_blend(mtex->def_var, har->alfa, tin, mtex->alphafac, mtex->blendtype);
|
||||
if (mtex->mapto & MAP_HAR)
|
||||
har->hard = 1.0f+126.0f*texture_value_blend(mtex->def_var,((float)har->hard)/127.0f,tin,mtex->hardfac,mtex->blendtype);
|
||||
har->hard = 1.0f+126.0f*texture_value_blend(mtex->def_var, ((float)har->hard)/127.0f, tin, mtex->hardfac, mtex->blendtype);
|
||||
if (mtex->mapto & MAP_RAYMIRR)
|
||||
har->hasize = 100.0f*texture_value_blend(mtex->def_var,har->hasize/100.0f,tin,mtex->raymirrfac,mtex->blendtype);
|
||||
har->hasize = 100.0f*texture_value_blend(mtex->def_var, har->hasize/100.0f, tin, mtex->raymirrfac, mtex->blendtype);
|
||||
if (mtex->mapto & MAP_TRANSLU) {
|
||||
float add = texture_value_blend(mtex->def_var,(float)har->add/255.0f,tin,mtex->translfac,mtex->blendtype);
|
||||
float add = texture_value_blend(mtex->def_var, (float)har->add/255.0f, tin, mtex->translfac, mtex->blendtype);
|
||||
CLAMP(add, 0.f, 1.f);
|
||||
har->add = 255.0f*add;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ static void copy_to_ztile(int *rectz, int size, int x1, int y1, int tile, char *
|
||||
#if 0
|
||||
static int sizeoflampbuf(ShadBuf *shb)
|
||||
{
|
||||
int num,count=0;
|
||||
int num, count=0;
|
||||
char *cp;
|
||||
|
||||
cp= shb->cbuf;
|
||||
@@ -193,7 +193,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
|
||||
#if 0
|
||||
if (print) {
|
||||
for (a=0, ds=dsample; a<tot; a++, ds++)
|
||||
printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v);
|
||||
printf("%lf, %f ", ds->z/(double)0x7FFFFFFF, ds->v);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
@@ -278,7 +278,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
|
||||
#if 0
|
||||
if (print) {
|
||||
for (a=0, ds=dsample; a<newtot; a++, ds++)
|
||||
printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v);
|
||||
printf("%lf, %f ", ds->z/(double)0x7FFFFFFF, ds->v);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
@@ -546,7 +546,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
|
||||
|
||||
verg= (*rz1 & 0xFFFFFF00);
|
||||
|
||||
for (a=0;a<256;a++,rz1++) {
|
||||
for (a=0;a<256;a++, rz1++) {
|
||||
if ( (*rz1 & 0xFFFFFF00) !=verg) break;
|
||||
}
|
||||
}
|
||||
@@ -564,7 +564,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
|
||||
verg1= rc[BCOMP];
|
||||
rc+= 4;
|
||||
byt1= 1; byt2= 1;
|
||||
for (a=1;a<256;a++,rc+=4) {
|
||||
for (a=1;a<256;a++, rc+=4) {
|
||||
byt1 &= (verg==rc[ACOMP]);
|
||||
byt2 &= (verg1==rc[BCOMP]);
|
||||
|
||||
@@ -582,7 +582,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
|
||||
}
|
||||
else if (byt1) { /* only store short */
|
||||
*ctile= 2;
|
||||
*ztile= (uintptr_t)MEM_mallocN(2*256+4,"Tile2");
|
||||
*ztile= (uintptr_t)MEM_mallocN(2*256+4, "Tile2");
|
||||
rz= (int *)*ztile;
|
||||
*rz= *rz1;
|
||||
|
||||
@@ -595,7 +595,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
|
||||
}
|
||||
else { /* store triple */
|
||||
*ctile= 3;
|
||||
*ztile= (uintptr_t)MEM_mallocN(3*256,"Tile3");
|
||||
*ztile= (uintptr_t)MEM_mallocN(3*256, "Tile3");
|
||||
|
||||
zt= (char *)*ztile;
|
||||
rc= rcline;
|
||||
@@ -779,7 +779,7 @@ void makeshadowbuf(Render *re, LampRen *lar)
|
||||
shb->pixsize= (shb->d)/temp;
|
||||
wsize= shb->pixsize*(shb->size/2.0f);
|
||||
|
||||
perspective_m4( shb->winmat,-wsize, wsize, -wsize, wsize, shb->d, shb->clipend);
|
||||
perspective_m4( shb->winmat, -wsize, wsize, -wsize, wsize, shb->d, shb->clipend);
|
||||
mult_m4_m4m4(shb->persmat, shb->winmat, shb->viewmat);
|
||||
|
||||
if (ELEM3(lar->buftype, LA_SHADBUF_REGULAR, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP)) {
|
||||
@@ -1192,7 +1192,7 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
|
||||
if (firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)ys1, 1)) {
|
||||
if (firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)(ys1+yres), 1)) {
|
||||
if (firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)(ys1+yres), 1)) {
|
||||
return readshadowbuf(shb, shsample, bias,(int)xs1, (int)ys1, zs);
|
||||
return readshadowbuf(shb, shsample, bias, (int)xs1, (int)ys1, zs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2074,7 +2074,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
|
||||
dface = dot_v3v3(v1, nor);
|
||||
hoco[3]= 1.0f;
|
||||
|
||||
/* ortho viewplane cannot intersect using view vector originating in (0,0,0) */
|
||||
/* ortho viewplane cannot intersect using view vector originating in (0, 0, 0) */
|
||||
if (R.r.mode & R_ORTHO) {
|
||||
/* x and y 3d coordinate can be derived from pixel coord and winmat */
|
||||
float fx= 2.0f/(R.winx*R.winmat[0][0]);
|
||||
|
||||
@@ -176,7 +176,7 @@ static float compute_reduced_albedo(ScatterSettings *ss)
|
||||
{
|
||||
const float tolerance= 1e-8;
|
||||
const int max_iteration_count= 20;
|
||||
float d, fsub, xn_1= 0.0f , xn= 1.0f, fxn, fxn_1;
|
||||
float d, fsub, xn_1= 0.0f, xn= 1.0f, fxn, fxn_1;
|
||||
int i;
|
||||
|
||||
/* use secant method to compute reduced albedo using Rd function inverse
|
||||
|
||||
@@ -485,7 +485,7 @@ static APixstrand *addpsmainAstrand(ListBase *lb)
|
||||
|
||||
psm= MEM_mallocN(sizeof(APixstrMain), "addpsmainA");
|
||||
BLI_addtail(lb, psm);
|
||||
psm->ps= MEM_callocN(4096*sizeof(APixstrand),"pixstr");
|
||||
psm->ps = MEM_callocN(4096 * sizeof(APixstrand), "pixstr");
|
||||
|
||||
return psm->ps;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
/**
|
||||
* ClipColor:
|
||||
* clip a color to range [0,1];
|
||||
* clip a color to range [0, 1];
|
||||
* */
|
||||
void ClipColor(float c[3])
|
||||
{
|
||||
@@ -146,7 +146,7 @@ static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta,
|
||||
* back_scatter, controls back scatter light
|
||||
* */
|
||||
void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness,
|
||||
float spread,float sun_brightness, float sun_size, float back_scatter,
|
||||
float spread, float sun_brightness, float sun_size, float back_scatter,
|
||||
float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace)
|
||||
{
|
||||
float theta2;
|
||||
@@ -251,7 +251,7 @@ void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_b
|
||||
void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float color_out[3])
|
||||
{
|
||||
float gamma;
|
||||
float x,y,Y,X,Z;
|
||||
float x, y, Y, X, Z;
|
||||
float hfade=1, nfade=1;
|
||||
|
||||
|
||||
@@ -336,7 +336,7 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
|
||||
fAlpha = 1.3f;
|
||||
fBeta = 0.04608365822050f * turbidity - 0.04586025928522f;
|
||||
|
||||
m = 1.0f/(cosf(theta) + 0.15f*powf(93.885f-theta/(float)M_PI*180.0f,-1.253f));
|
||||
m = 1.0f/(cosf(theta) + 0.15f*powf(93.885f-theta/(float)M_PI*180.0f, -1.253f));
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
// Rayleigh Scattering
|
||||
@@ -374,7 +374,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
|
||||
float K[3] = {0.685f, 0.679f, 0.670f};
|
||||
float vBetaMieTemp[3];
|
||||
|
||||
float fLambda[3],fLambda2[3], fLambda4[3];
|
||||
float fLambda[3], fLambda2[3], fLambda4[3];
|
||||
float vLambda2[3];
|
||||
float vLambda4[3];
|
||||
|
||||
@@ -411,7 +411,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
|
||||
|
||||
VEC3OPF(sunSky->atm_BetaRay, vLambda4, *, fBeta);
|
||||
fBetaDash = fTemp/2;
|
||||
VEC3OPF(sunSky->atm_BetaDashRay, vLambda4,*, fBetaDash);
|
||||
VEC3OPF(sunSky->atm_BetaDashRay, vLambda4, *, fBetaDash);
|
||||
|
||||
|
||||
// Mie scattering constants.
|
||||
@@ -421,7 +421,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
|
||||
fTemp3 = 0.434f*c*pi*(2*pi)*(2*pi);
|
||||
|
||||
VEC3OPV(vBetaMieTemp, K, *, fLambda);
|
||||
VEC3OPF(sunSky->atm_BetaMie, vBetaMieTemp,*, fTemp3);
|
||||
VEC3OPF(sunSky->atm_BetaMie, vBetaMieTemp, *, fTemp3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset
|
||||
static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co)
|
||||
{
|
||||
Isect isect= {{0}};
|
||||
float dir[3] = {0.0f,0.0f,1.0f};
|
||||
float dir[3] = {0.0f, 0.0f, 1.0f};
|
||||
int final_depth=0, depth=0, limit=20;
|
||||
|
||||
/* set up the isect */
|
||||
@@ -313,7 +313,7 @@ static float total_ms_energy(Render *re, int do_test_break, float *sr, float *sg
|
||||
for (z=1;z<=res[2];z++) {
|
||||
for (y=1;y<=res[1];y++) {
|
||||
for (x=1;x<=res[0];x++) {
|
||||
const int i = ms_I(x,y,z,res);
|
||||
const int i = ms_I(x, y, z, res);
|
||||
|
||||
if (sr[i] > 0.f) energy += sr[i];
|
||||
if (sg[i] > 0.f) energy += sg[i];
|
||||
@@ -338,8 +338,8 @@ static void ms_diffuse(Render *re, int do_test_break, float *x0, float *x, float
|
||||
for (k=1; k<=n[2]; k++) {
|
||||
for (j=1; j<=n[1]; j++) {
|
||||
for (i=1; i<=n[0]; i++) {
|
||||
x[v_I_pad(i,j,k,n)] = (x0[v_I_pad(i,j,k,n)]) + a*( x0[v_I_pad(i-1,j,k,n)]+ x0[v_I_pad(i+1,j,k,n)]+ x0[v_I_pad(i,j-1,k,n)]+
|
||||
x0[v_I_pad(i,j+1,k,n)]+ x0[v_I_pad(i,j,k-1,n)]+x0[v_I_pad(i,j,k+1,n)]
|
||||
x[v_I_pad(i, j, k, n)] = (x0[v_I_pad(i, j, k, n)]) + a*( x0[v_I_pad(i-1, j, k, n)]+ x0[v_I_pad(i+1, j, k, n)]+ x0[v_I_pad(i, j-1, k, n)]+
|
||||
x0[v_I_pad(i, j+1, k, n)]+ x0[v_I_pad(i, j, k-1, n)]+x0[v_I_pad(i, j, k+1, n)]
|
||||
) / (1+6*a);
|
||||
}
|
||||
}
|
||||
@@ -385,7 +385,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
|
||||
for (z=1; z<=n[2]; z++) {
|
||||
for (y=1; y<=n[1]; y++) {
|
||||
for (x=1; x<=n[0]; x++) {
|
||||
const int i = lc_to_ms_I(x, y ,z, n); //lc index
|
||||
const int i = lc_to_ms_I(x, y, z, n); //lc index
|
||||
const int j = ms_I(x, y, z, n); //ms index
|
||||
|
||||
time= PIL_check_seconds_timer();
|
||||
@@ -414,9 +414,9 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
|
||||
|
||||
if (re->test_break(re->tbh)) break;
|
||||
|
||||
SWAP(float *,sr,sr0);
|
||||
SWAP(float *,sg,sg0);
|
||||
SWAP(float *,sb,sb0);
|
||||
SWAP(float *, sr, sr0);
|
||||
SWAP(float *, sg, sg0);
|
||||
SWAP(float *, sb, sb0);
|
||||
|
||||
/* main diffusion simulation */
|
||||
ms_diffuse(re, do_test_break, sr0, sr, diff, n);
|
||||
@@ -443,7 +443,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
|
||||
for (z=1;z<=n[2];z++) {
|
||||
for (y=1;y<=n[1];y++) {
|
||||
for (x=1;x<=n[0];x++) {
|
||||
const int i = lc_to_ms_I(x, y ,z, n); //lc index
|
||||
const int i = lc_to_ms_I(x, y, z, n); //lc index
|
||||
const int j = ms_I(x, y, z, n); //ms index
|
||||
|
||||
vp->data_r[i] = origf * vp->data_r[i] + fac * sr[j];
|
||||
|
||||
@@ -113,7 +113,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
|
||||
is.orig.face = NULL;
|
||||
is.last_hit = lar->last_hit[shi->thread];
|
||||
|
||||
if (RE_rayobject_raycast(R.raytree,&is)) {
|
||||
if (RE_rayobject_raycast(R.raytree, &is)) {
|
||||
visibility = 0.f;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ static float metadensity(Object* ob, const float co[3])
|
||||
|
||||
/* element rotation transform */
|
||||
float tp[3] = {ml->x - tco[0], ml->y - tco[1], ml->z - tco[2]};
|
||||
quat_to_mat3( bmat,ml->quat);
|
||||
quat_to_mat3(bmat, ml->quat);
|
||||
transpose_m3(bmat); // rot.only, so inverse == transpose
|
||||
mul_m3_v3(bmat, tp);
|
||||
|
||||
@@ -471,7 +471,7 @@ static void vol_get_transmittance(ShadeInput *shi, float tr[3], const float co[3
|
||||
static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const float view[3], LampRen *lar, float lacol[3])
|
||||
{
|
||||
float visifac, lv[3], lampdist;
|
||||
float tr[3]={1.0,1.0,1.0};
|
||||
float tr[3]={1.0, 1.0, 1.0};
|
||||
float hitco[3], *atten_co;
|
||||
float p, ref_col[3];
|
||||
|
||||
@@ -653,7 +653,7 @@ static void volumeintegrate(struct ShadeInput *shi, float col[4], const float co
|
||||
/* the main entry point for volume shading */
|
||||
static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int inside_volume)
|
||||
{
|
||||
float hitco[3], col[4] = {0.f,0.f,0.f,0.f};
|
||||
float hitco[3], col[4] = {0.f, 0.f, 0.f, 0.f};
|
||||
float *startco, *endco;
|
||||
int trace_behind = 1;
|
||||
const int ztransp= ((shi->depth==0) && (shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_ZTRANSP));
|
||||
@@ -748,7 +748,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
|
||||
void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct Isect *last_is)
|
||||
{
|
||||
float hitco[3];
|
||||
float tr[3] = {1.0,1.0,1.0};
|
||||
float tr[3] = {1.0, 1.0, 1.0};
|
||||
Isect is= {{0}};
|
||||
float *startco, *endco;
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ static int load_frame_raw8(VoxelData *vd, FILE *fp, int frame)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fseek(fp,(frame-1)*size*sizeof(char),0) == -1) {
|
||||
if (fseek(fp, (frame-1)*size*sizeof(char), 0) == -1) {
|
||||
MEM_freeN(data_c);
|
||||
MEM_freeN(vd->dataset);
|
||||
vd->dataset= NULL;
|
||||
@@ -201,7 +201,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
|
||||
VoxelDataHeader *h=(VoxelDataHeader *)MEM_mallocN(sizeof(VoxelDataHeader), "voxel data header");
|
||||
|
||||
rewind(fp);
|
||||
if (fread(h,sizeof(VoxelDataHeader),1,fp) != 1) {
|
||||
if (fread(h, sizeof(VoxelDataHeader), 1, fp) != 1) {
|
||||
MEM_freeN(h);
|
||||
return 0;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ void cache_voxeldata(Tex *tex, int scene_frame)
|
||||
case TEX_VD_BLENDERVOXEL:
|
||||
BLI_path_abs(path, G.main->name);
|
||||
if (!BLI_exists(path)) return;
|
||||
fp = BLI_fopen(path,"rb");
|
||||
fp = BLI_fopen(path, "rb");
|
||||
if (!fp) return;
|
||||
|
||||
if (read_voxeldata_header(fp, vd))
|
||||
@@ -349,7 +349,7 @@ void cache_voxeldata(Tex *tex, int scene_frame)
|
||||
case TEX_VD_RAW_8BIT:
|
||||
BLI_path_abs(path, G.main->name);
|
||||
if (!BLI_exists(path)) return;
|
||||
fp = BLI_fopen(path,"rb");
|
||||
fp = BLI_fopen(path, "rb");
|
||||
if (!fp) return;
|
||||
|
||||
load_frame_raw8(vd, fp, curframe);
|
||||
|
||||
@@ -149,7 +149,7 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
|
||||
}
|
||||
else {
|
||||
dx0= 0.0f;
|
||||
xs0= MIN2(minv[0],maxv[0]);
|
||||
xs0= MIN2(minv[0], maxv[0]);
|
||||
}
|
||||
|
||||
/* empty span */
|
||||
@@ -270,7 +270,7 @@ static APixstr *addpsmainA(ListBase *lb)
|
||||
|
||||
psm= MEM_mallocN(sizeof(APixstrMain), "addpsmainA");
|
||||
BLI_addtail(lb, psm);
|
||||
psm->ps= MEM_callocN(4096*sizeof(APixstr),"pixstr");
|
||||
psm->ps= MEM_callocN(4096*sizeof(APixstr), "pixstr");
|
||||
|
||||
return psm->ps;
|
||||
}
|
||||
@@ -305,8 +305,8 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
|
||||
{
|
||||
APixstr *ap, *apofs, *apn;
|
||||
double zxd, zyd, zy0, zverg;
|
||||
float x0,y0,z0;
|
||||
float x1,y1,z1,x2,y2,z2,xx1;
|
||||
float x0, y0, z0;
|
||||
float x1, y1, z1, x2, y2, z2, xx1;
|
||||
float *span1, *span2;
|
||||
int *rz, *rm, x, y;
|
||||
int sn1, sn2, rectx, *rectzofs, *rectmaskofs, my0, my2, mask;
|
||||
@@ -844,7 +844,7 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
|
||||
|
||||
static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */
|
||||
{
|
||||
float dz,dw, u1=0.0, u2=1.0;
|
||||
float dz, dw, u1=0.0, u2=1.0;
|
||||
float dx, dy, v13;
|
||||
|
||||
dz= v2[2]-v1[2];
|
||||
@@ -854,20 +854,20 @@ static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */
|
||||
* filled in with zbufwire correctly when rendering in parts. otherwise
|
||||
* you see line endings at edges... */
|
||||
|
||||
if (cliptestf(-dz, -dw, v1[3], v1[2], &u1,&u2)) {
|
||||
if (cliptestf(dz, -dw, v1[3], -v1[2], &u1,&u2)) {
|
||||
if (cliptestf(-dz, -dw, v1[3], v1[2], &u1, &u2)) {
|
||||
if (cliptestf(dz, -dw, v1[3], -v1[2], &u1, &u2)) {
|
||||
|
||||
dx= v2[0]-v1[0];
|
||||
dz= 1.01f*(v2[3]-v1[3]);
|
||||
v13= 1.01f*v1[3];
|
||||
|
||||
if (cliptestf(-dx, -dz, v1[0], v13, &u1,&u2)) {
|
||||
if (cliptestf(dx, -dz, v13, -v1[0], &u1,&u2)) {
|
||||
if (cliptestf(-dx, -dz, v1[0], v13, &u1, &u2)) {
|
||||
if (cliptestf(dx, -dz, v13, -v1[0], &u1, &u2)) {
|
||||
|
||||
dy= v2[1]-v1[1];
|
||||
|
||||
if (cliptestf(-dy, -dz, v1[1], v13, &u1,&u2)) {
|
||||
if (cliptestf(dy, -dz, v13, -v1[1], &u1,&u2)) {
|
||||
if (cliptestf(-dy, -dz, v1[1], v13, &u1, &u2)) {
|
||||
if (cliptestf(dy, -dz, v13, -v1[1], &u1, &u2)) {
|
||||
|
||||
if (u2<1.0f) {
|
||||
v2[0]= v1[0]+u2*dx;
|
||||
@@ -1042,8 +1042,8 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
|
||||
static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
|
||||
{
|
||||
double zxd, zyd, zy0, zverg;
|
||||
float x0,y0,z0;
|
||||
float x1,y1,z1,x2,y2,z2,xx1;
|
||||
float x0, y0, z0;
|
||||
float x1, y1, z1, x2, y2, z2, xx1;
|
||||
float *span1, *span2;
|
||||
int *rectoofs, *ro;
|
||||
int *rectpofs, *rp;
|
||||
@@ -1164,8 +1164,8 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
|
||||
static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
|
||||
{
|
||||
double zxd, zyd, zy0, zverg;
|
||||
float x0,y0,z0;
|
||||
float x1,y1,z1,x2,y2,z2,xx1;
|
||||
float x0, y0, z0;
|
||||
float x1, y1, z1, x2, y2, z2, xx1;
|
||||
float *span1, *span2;
|
||||
int *rectoofs, *ro;
|
||||
int *rectpofs, *rp;
|
||||
@@ -1294,8 +1294,8 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
|
||||
static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), float *v1, float *v2, float *v3, float *v4)
|
||||
{
|
||||
double zxd, zyd, zy0, zverg;
|
||||
float x0,y0,z0;
|
||||
float x1,y1,z1,x2,y2,z2,xx1;
|
||||
float x0, y0, z0;
|
||||
float x1, y1, z1, x2, y2, z2, xx1;
|
||||
float *span1, *span2;
|
||||
int *rz, *rz1, x, y;
|
||||
int sn1, sn2, rectx, *rectzofs, *rectzofs1= NULL, my0, my2;
|
||||
@@ -1399,7 +1399,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
|
||||
}
|
||||
}
|
||||
|
||||
/* 2d scanconvert for tria, calls func for each x,y coordinate and gives UV barycentrics */
|
||||
/* 2d scanconvert for tria, calls func for each x, y coordinate and gives UV barycentrics */
|
||||
void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float, float) )
|
||||
{
|
||||
float x0, y0, x1, y1, x2, y2, z0, z1, z2, z;
|
||||
@@ -1498,7 +1498,7 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
|
||||
}
|
||||
}
|
||||
|
||||
/* scanconvert for strand triangles, calls func for each x,y coordinate and gives UV barycentrics and z */
|
||||
/* scanconvert for strand triangles, calls func for each x, y coordinate and gives UV barycentrics and z */
|
||||
|
||||
void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float) )
|
||||
{
|
||||
@@ -1603,7 +1603,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
|
||||
|
||||
static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a, float clipcrop)
|
||||
{
|
||||
float da,dw,u1=0.0,u2=1.0;
|
||||
float da, dw, u1=0.0, u2=1.0;
|
||||
float v13;
|
||||
|
||||
labda[0]= -1.0;
|
||||
@@ -1627,8 +1627,8 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
|
||||
* who would have thought that of L&B!
|
||||
*/
|
||||
|
||||
if (cliptestf(-da, -dw, v13, v1[a], &u1,&u2)) {
|
||||
if (cliptestf(da, -dw, v13, -v1[a], &u1,&u2)) {
|
||||
if (cliptestf(-da, -dw, v13, v1[a], &u1, &u2)) {
|
||||
if (cliptestf(da, -dw, v13, -v1[a], &u1, &u2)) {
|
||||
*b3=1;
|
||||
if (u2<1.0f) {
|
||||
labda[1]= u2;
|
||||
@@ -1701,7 +1701,7 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo
|
||||
void projectverto(const float v1[3], float winmat[][4], float adr[4])
|
||||
{
|
||||
/* calcs homogenic coord of vertex v1 */
|
||||
float x,y,z;
|
||||
float x, y, z;
|
||||
|
||||
x= v1[0];
|
||||
y= v1[1];
|
||||
@@ -1719,7 +1719,7 @@ void projectverto(const float v1[3], float winmat[][4], float adr[4])
|
||||
void projectvert(const float v1[3], float winmat[][4], float adr[4])
|
||||
{
|
||||
/* calcs homogenic coord of vertex v1 */
|
||||
float x,y,z;
|
||||
float x, y, z;
|
||||
|
||||
x= v1[0];
|
||||
y= v1[1];
|
||||
@@ -1877,9 +1877,9 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
|
||||
else if (b==1) arg= 0;
|
||||
else arg= 1;
|
||||
|
||||
clippyra(labda[0], vlzp[v][0],vlzp[v][1], &b2,&b3, arg, zspan->clipcrop);
|
||||
clippyra(labda[1], vlzp[v][1],vlzp[v][2], &b2,&b3, arg, zspan->clipcrop);
|
||||
clippyra(labda[2], vlzp[v][2],vlzp[v][0], &b2,&b3, arg, zspan->clipcrop);
|
||||
clippyra(labda[0], vlzp[v][0], vlzp[v][1], &b2, &b3, arg, zspan->clipcrop);
|
||||
clippyra(labda[1], vlzp[v][1], vlzp[v][2], &b2, &b3, arg, zspan->clipcrop);
|
||||
clippyra(labda[2], vlzp[v][2], vlzp[v][0], &b2, &b3, arg, zspan->clipcrop);
|
||||
|
||||
if (b2==0 && b3==1) {
|
||||
/* completely 'in', but we copy because of last for () loop in this section */;
|
||||
@@ -1895,9 +1895,9 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
|
||||
}
|
||||
else {
|
||||
b1=0;
|
||||
makevertpyra(vez, labda[0], trias, vlzp[v][0],vlzp[v][1], &b1,&clve);
|
||||
makevertpyra(vez, labda[1], trias, vlzp[v][1],vlzp[v][2], &b1,&clve);
|
||||
makevertpyra(vez, labda[2], trias, vlzp[v][2],vlzp[v][0], &b1,&clve);
|
||||
makevertpyra(vez, labda[0], trias, vlzp[v][0], vlzp[v][1], &b1, &clve);
|
||||
makevertpyra(vez, labda[1], trias, vlzp[v][1], vlzp[v][2], &b1, &clve);
|
||||
makevertpyra(vez, labda[2], trias, vlzp[v][2], vlzp[v][0], &b1, &clve);
|
||||
|
||||
/* after front clip done: now set clip flags */
|
||||
if (b==0) {
|
||||
@@ -1927,7 +1927,7 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
|
||||
}
|
||||
|
||||
/* warning, this should never happen! */
|
||||
if (clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n",clve,clvl);
|
||||
if (clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n", clve, clvl);
|
||||
|
||||
/* perspective division */
|
||||
f1=vez;
|
||||
@@ -1937,7 +1937,7 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
|
||||
}
|
||||
for (b=1;b<clvl;b++) {
|
||||
if (vlzp[b][0]) {
|
||||
zspan->zbuffunc(zspan, obi, zvlnr, vlzp[b][0],vlzp[b][1],vlzp[b][2], NULL);
|
||||
zspan->zbuffunc(zspan, obi, zvlnr, vlzp[b][0], vlzp[b][1], vlzp[b][2], NULL);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1948,7 +1948,7 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
|
||||
hoco_to_zco(zspan, vez, f1);
|
||||
hoco_to_zco(zspan, vez+4, f2);
|
||||
hoco_to_zco(zspan, vez+8, f3);
|
||||
zspan->zbuffunc(zspan, obi, zvlnr, vez,vez+4,vez+8, NULL);
|
||||
zspan->zbuffunc(zspan, obi, zvlnr, vez, vez+4, vez+8, NULL);
|
||||
}
|
||||
|
||||
void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4)
|
||||
@@ -2648,8 +2648,8 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
|
||||
{
|
||||
DrawBufPixel *rectpofs, *rp;
|
||||
double zxd, zyd, zy0, zverg;
|
||||
float x0,y0,z0;
|
||||
float x1,y1,z1,x2,y2,z2,xx1;
|
||||
float x0, y0, z0;
|
||||
float x1, y1, z1, x2, y2, z2, xx1;
|
||||
float *span1, *span2;
|
||||
float *rectzofs, *rz;
|
||||
int x, y;
|
||||
@@ -2839,7 +2839,7 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
|
||||
}
|
||||
|
||||
/* in: two vectors, first vector points from origin back in time, 2nd vector points to future */
|
||||
/* we make this into 3 points, center point is (0,0) */
|
||||
/* we make this into 3 points, center point is (0, 0) */
|
||||
/* and offset the center point just enough to make curve go through midpoint */
|
||||
|
||||
static void quad_bezier_2d(float *result, float *v1, float *v2, float *ipodata)
|
||||
@@ -3772,7 +3772,7 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
|
||||
|
||||
for (samp=0; samp<R.osa; samp++) {
|
||||
if (curmask & (1<<samp)) {
|
||||
xs= (float)x + R.jit[samp][0] + 0.5f; /* zbuffer has this inverse corrected, ensures xs,ys are inside pixel */
|
||||
xs= (float)x + R.jit[samp][0] + 0.5f; /* zbuffer has this inverse corrected, ensures (xs, ys) are inside pixel */
|
||||
ys= (float)y + R.jit[samp][1] + 0.5f;
|
||||
|
||||
if (shi_inc) {
|
||||
|
||||
Reference in New Issue
Block a user