Renamed exported functions from render to have the RE_ prefix
RayObject_* => RE_rayobject_*
This commit is contained in:
@@ -401,7 +401,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
|
||||
MFace *mface;
|
||||
int a;
|
||||
|
||||
sys->heat.raytree = RayObject_mesh_create(me, me);
|
||||
sys->heat.raytree = RE_rayobject_mesh_create(me, me);
|
||||
|
||||
sys->heat.vface = MEM_callocN(sizeof(MFace*)*me->totvert, "HeatVFaces");
|
||||
for(a=0, mface=me->mface; a<me->totface; a++, mface++) {
|
||||
@@ -445,7 +445,7 @@ static int heat_ray_bone_visible(LaplacianSystem *sys, int vertex, int bone)
|
||||
VecMulf(dir, 1e-5);
|
||||
VecAddf(isec.start, isec.start, dir);
|
||||
#endif
|
||||
visible= !RayObject_raycast(sys->heat.raytree, &isec);
|
||||
visible= !RE_rayobject_raycast(sys->heat.raytree, &isec);
|
||||
|
||||
return visible;
|
||||
}
|
||||
@@ -709,7 +709,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numbones,
|
||||
/* free */
|
||||
if(vertsflipped) MEM_freeN(vertsflipped);
|
||||
|
||||
RayObject_free(sys->heat.raytree);
|
||||
RE_rayobject_free(sys->heat.raytree);
|
||||
MEM_freeN(sys->heat.vface);
|
||||
|
||||
MEM_freeN(sys->heat.mindist);
|
||||
|
@@ -38,16 +38,16 @@ typedef struct Isect Isect;
|
||||
struct DerivedMesh;
|
||||
struct Mesh;
|
||||
|
||||
int RayObject_raycast(RayObject *r, Isect *i);
|
||||
void RayObject_add (RayObject *r, RayObject *);
|
||||
void RayObject_done(RayObject *r);
|
||||
void RayObject_free(RayObject *r);
|
||||
int RE_rayobject_raycast(RayObject *r, Isect *i);
|
||||
void RE_rayobject_add (RayObject *r, RayObject *);
|
||||
void RE_rayobject_done(RayObject *r);
|
||||
void RE_rayobject_free(RayObject *r);
|
||||
|
||||
/* RayObject constructors */
|
||||
RayObject* RayObject_octree_create(int ocres, int size);
|
||||
RayObject* RE_rayobject_octree_create(int ocres, int size);
|
||||
|
||||
//RayObject* RayObject_derivedmesh_create(struct DerivedMesh*, void *ob);
|
||||
RayObject* RayObject_mesh_create(struct Mesh*, void *ob);
|
||||
RayObject* RE_rayobject_mesh_create(struct Mesh*, void *ob);
|
||||
|
||||
/* Ray Intersection */
|
||||
struct Isect
|
||||
|
@@ -84,19 +84,19 @@ struct RayObject
|
||||
|
||||
};
|
||||
|
||||
typedef int (*RayObject_raycast_callback)(RayObject *, Isect *);
|
||||
typedef void (*RayObject_add_callback)(RayObject *, RayObject *);
|
||||
typedef void (*RayObject_done_callback)(RayObject *);
|
||||
typedef void (*RayObject_free_callback)(RayObject *);
|
||||
typedef void (*RayObject_bb_callback)(RayObject *, float *min, float *max);
|
||||
typedef int (*RE_rayobject_raycast_callback)(RayObject *, Isect *);
|
||||
typedef void (*RE_rayobject_add_callback)(RayObject *, RayObject *);
|
||||
typedef void (*RE_rayobject_done_callback)(RayObject *);
|
||||
typedef void (*RE_rayobject_free_callback)(RayObject *);
|
||||
typedef void (*RE_rayobject_merge_bb_callback)(RayObject *, float *min, float *max);
|
||||
|
||||
typedef struct RayObjectAPI
|
||||
{
|
||||
RayObject_raycast_callback raycast;
|
||||
RayObject_add_callback add;
|
||||
RayObject_done_callback done;
|
||||
RayObject_free_callback free;
|
||||
RayObject_bb_callback bb;
|
||||
RE_rayobject_raycast_callback raycast;
|
||||
RE_rayobject_add_callback add;
|
||||
RE_rayobject_done_callback done;
|
||||
RE_rayobject_free_callback free;
|
||||
RE_rayobject_merge_bb_callback bb;
|
||||
|
||||
} RayObjectAPI;
|
||||
|
||||
@@ -104,18 +104,19 @@ typedef struct RayObjectAPI
|
||||
#define RayObject_align(o) ((RayObject*)(((int)o)&(~3)))
|
||||
#define RayObject_unalign(o) ((RayObject*)(((int)o)|1))
|
||||
#define RayObject_isFace(o) ((((int)o)&3) == 0)
|
||||
#define RayObject_isAligned(o) ((((int)o)&3) == 0)
|
||||
|
||||
/*
|
||||
* Extend min/max coords so that the rayobject is inside them
|
||||
*/
|
||||
void RayObject_merge_bb(RayObject *ob, float *min, float *max);
|
||||
void RE_rayobject_merge_bb(RayObject *ob, float *min, float *max);
|
||||
|
||||
/*
|
||||
* This function differs from RayObject_raycast
|
||||
* RayObject_intersect does NOT perform last-hit optimization
|
||||
* This function differs from RE_rayobject_raycast
|
||||
* RE_rayobject_intersect does NOT perform last-hit optimization
|
||||
* So this is probably a function to call inside raytrace structures
|
||||
*/
|
||||
int RayObject_intersect(RayObject *r, Isect *i);
|
||||
int RE_rayobject_intersect(RayObject *r, Isect *i);
|
||||
|
||||
#define ISECT_EPSILON ((float)FLT_EPSILON)
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#include "assert.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
@@ -270,15 +270,15 @@ static int intersect_rayface(RayFace *face, Isect *is)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RayObject_raycast(RayObject *r, Isect *i)
|
||||
int RE_rayobject_raycast(RayObject *r, Isect *i)
|
||||
{
|
||||
if(i->mode==RE_RAY_SHADOW && i->last_hit && RayObject_intersect(i->last_hit, i))
|
||||
if(i->mode==RE_RAY_SHADOW && i->last_hit && RE_rayobject_intersect(i->last_hit, i))
|
||||
return 1;
|
||||
|
||||
return RayObject_intersect(r, i);
|
||||
return RE_rayobject_intersect(r, i);
|
||||
}
|
||||
|
||||
int RayObject_intersect(RayObject *r, Isect *i)
|
||||
int RE_rayobject_intersect(RayObject *r, Isect *i)
|
||||
{
|
||||
assert(i->mode==RE_RAY_SHADOW);
|
||||
if(RayObject_isFace(r))
|
||||
@@ -304,25 +304,25 @@ int RayObject_intersect(RayObject *r, Isect *i)
|
||||
}
|
||||
}
|
||||
|
||||
void RayObject_add(RayObject *r, RayObject *o)
|
||||
void RE_rayobject_add(RayObject *r, RayObject *o)
|
||||
{
|
||||
r = RayObject_align( r );
|
||||
return r->api->add( r, o );
|
||||
}
|
||||
|
||||
void RayObject_done(RayObject *r)
|
||||
void RE_rayobject_done(RayObject *r)
|
||||
{
|
||||
r = RayObject_align( r );
|
||||
r->api->done( r );
|
||||
}
|
||||
|
||||
void RayObject_free(RayObject *r)
|
||||
void RE_rayobject_free(RayObject *r)
|
||||
{
|
||||
r = RayObject_align( r );
|
||||
r->api->free( r );
|
||||
}
|
||||
|
||||
void RayObject_merge_bb(RayObject *r, float *min, float *max)
|
||||
void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
|
||||
{
|
||||
if(RayObject_isFace(r))
|
||||
{
|
||||
|
@@ -26,6 +26,8 @@
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
#include <assert.h>
|
||||
|
||||
#include "rayobject.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
@@ -66,7 +68,7 @@ static int RayObject_mesh_intersect(RayObject *o, Isect *isec)
|
||||
RayMesh *rm= (RayMesh*)o;
|
||||
int i, hit = 0;
|
||||
for(i = 0; i<rm->num_faces; i++)
|
||||
if(RayObject_raycast( (RayObject*)rm->faces+i, isec ))
|
||||
if(RE_rayobject_raycast( (RayObject*)rm->faces+i, isec ))
|
||||
{
|
||||
hit = 1;
|
||||
if(isec->mode == RE_RAY_SHADOW)
|
||||
@@ -99,13 +101,15 @@ static void RayObject_mesh_bb(RayObject *o, float *min, float *max)
|
||||
DO_MINMAX( rm->mesh->mvert[i].co, min, max);
|
||||
}
|
||||
|
||||
RayObject* RayObject_mesh_create(Mesh *mesh, void *ob)
|
||||
RayObject* RE_rayobject_mesh_create(Mesh *mesh, void *ob)
|
||||
{
|
||||
RayMesh *rm= MEM_callocN(sizeof(RayMesh), "Octree");
|
||||
int i;
|
||||
RayFace *face;
|
||||
MFace *mface;
|
||||
|
||||
assert( RayObject_isAligned(rm) ); /* RayObject API assumes real data to be 4-byte aligned */
|
||||
|
||||
rm->rayobj.api = &mesh_api;
|
||||
rm->mesh = mesh;
|
||||
rm->faces = MEM_callocN(sizeof(RayFace)*mesh->totface, "octree rayobject nodes");
|
||||
|
@@ -447,9 +447,10 @@ static void RayObject_octree_free(RayObject *tree)
|
||||
}
|
||||
|
||||
|
||||
RayObject *RayObject_octree_create(int ocres, int size)
|
||||
RayObject *RE_rayobject_octree_create(int ocres, int size)
|
||||
{
|
||||
Octree *oc= MEM_callocN(sizeof(Octree), "Octree");
|
||||
assert( RayObject_isAligned(oc) ); /* RayObject API assumes real data to be 4-byte aligned */
|
||||
|
||||
oc->rayobj.api = &octree_api;
|
||||
|
||||
@@ -600,7 +601,7 @@ static void RayObject_octree_done(RayObject *tree)
|
||||
|
||||
/* Calculate Bounding Box */
|
||||
for(c=0; c<oc->ro_nodes_used; c++)
|
||||
RayObject_merge_bb(oc->ro_nodes[c], oc->min, oc->max);
|
||||
RE_rayobject_merge_bb(oc->ro_nodes[c], oc->min, oc->max);
|
||||
|
||||
/* Alloc memory */
|
||||
oc->adrbranch= MEM_callocN(sizeof(void *)*BRANCH_ARRAY, "octree branches");
|
||||
@@ -667,7 +668,7 @@ static int testnode(Octree *oc, Isect *is, Node *no, OcVal ocval)
|
||||
|
||||
if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
|
||||
{
|
||||
if( RayObject_intersect(face,is) )
|
||||
if( RE_rayobject_intersect(face,is) )
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -693,7 +694,7 @@ static int testnode(Octree *oc, Isect *is, Node *no, OcVal ocval)
|
||||
if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
|
||||
{
|
||||
|
||||
if( RayObject_raycast(face,is) )
|
||||
if( RE_rayobject_raycast(face,is) )
|
||||
if(isect.labda<is->labda) {
|
||||
*is= isect;
|
||||
found= 1;
|
||||
|
@@ -109,7 +109,7 @@ static float *vlr_get_transform(void *userdata, int i)
|
||||
void freeraytree(Render *re)
|
||||
{
|
||||
if(re->raytree) {
|
||||
RayObject_free(re->raytree);
|
||||
RE_rayobject_free(re->raytree);
|
||||
re->raytree= NULL;
|
||||
MEM_freeN( re->rayfaces );
|
||||
}
|
||||
@@ -144,7 +144,7 @@ void makeraytree(Render *re)
|
||||
}
|
||||
}
|
||||
|
||||
re->raytree = RayObject_octree_create( re->r.ocres, totface );
|
||||
re->raytree = RE_rayobject_octree_create( re->r.ocres, totface );
|
||||
|
||||
//Fill rayfaces
|
||||
re->rayfaces = (RayObject*)MEM_callocN(totface*sizeof(RayFace), "render faces");
|
||||
@@ -187,14 +187,14 @@ void makeraytree(Render *re)
|
||||
cur_face->ob = (void*)obi;
|
||||
cur_face->face = vlr;
|
||||
|
||||
RayObject_add( re->raytree, (RayObject*) cur_face );
|
||||
RE_rayobject_add( re->raytree, (RayObject*) cur_face );
|
||||
cur_face++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RayObject_done( re->raytree );
|
||||
RE_rayobject_done( re->raytree );
|
||||
//TODO vlr_face_coords, vlr_check_intersect, vlr_get_transform, re);
|
||||
|
||||
re->i.infostr= NULL;
|
||||
@@ -434,7 +434,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
|
||||
isec.orig.ob = obi;
|
||||
isec.orig.face = vlr;
|
||||
|
||||
if(RayObject_raycast(R.raytree, &isec)) {
|
||||
if(RE_rayobject_raycast(R.raytree, &isec)) {
|
||||
float d= 1.0f;
|
||||
|
||||
shi.mask= origshi->mask;
|
||||
@@ -1274,7 +1274,7 @@ static void ray_trace_shadow_tra(Isect *is, int depth, int traflag)
|
||||
|
||||
assert(0);
|
||||
|
||||
if(RayObject_raycast(R.raytree, is)) {
|
||||
if(RE_rayobject_raycast(R.raytree, is)) {
|
||||
float d= 1.0f;
|
||||
/* we got a face */
|
||||
|
||||
@@ -1354,7 +1354,7 @@ int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr)
|
||||
VECCOPY(isec.vec, vec );
|
||||
isec.labda = RE_RAYTRACE_MAXDIST;
|
||||
|
||||
if(RayObject_raycast(R.raytree, &isec)) {
|
||||
if(RE_rayobject_raycast(R.raytree, &isec)) {
|
||||
float fac;
|
||||
|
||||
/* Warning, This is not that nice, and possibly a bit slow for every ray,
|
||||
@@ -1611,7 +1611,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *shadfac)
|
||||
|
||||
prev = fac;
|
||||
|
||||
if(RayObject_raycast(R.raytree, &isec)) {
|
||||
if(RE_rayobject_raycast(R.raytree, &isec)) {
|
||||
if (R.wrld.aomode & WO_AODIST) fac+= exp(-isec.labda*R.wrld.aodistfac);
|
||||
else fac+= 1.0f;
|
||||
}
|
||||
@@ -1743,7 +1743,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *shadfac)
|
||||
isec.labda = maxdist;
|
||||
|
||||
/* do the trace */
|
||||
if(RayObject_raycast(R.raytree, &isec)) {
|
||||
if(RE_rayobject_raycast(R.raytree, &isec)) {
|
||||
if (R.wrld.aomode & WO_AODIST) sh+= exp(-isec.labda*R.wrld.aodistfac);
|
||||
else sh+= 1.0f;
|
||||
}
|
||||
@@ -1974,7 +1974,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float *
|
||||
colsq[2] += isec->col[2]*isec->col[2];
|
||||
}
|
||||
else {
|
||||
if( RayObject_raycast(R.raytree, isec) ) fac+= 1.0f;
|
||||
if( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
|
||||
}
|
||||
|
||||
samples++;
|
||||
@@ -2068,7 +2068,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, floa
|
||||
shadfac[2] += isec->col[2];
|
||||
shadfac[3] += isec->col[3];
|
||||
}
|
||||
else if( RayObject_raycast(R.raytree, isec) ) fac+= 1.0f;
|
||||
else if( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
|
||||
|
||||
div+= 1.0f;
|
||||
jitlamp+= 2;
|
||||
@@ -2148,7 +2148,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac)
|
||||
else
|
||||
{
|
||||
assert(0);
|
||||
if(RayObject_raycast(R.raytree, &isec)) shadfac[3]= 0.0f;
|
||||
if(RE_rayobject_raycast(R.raytree, &isec)) shadfac[3]= 0.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2193,7 +2193,7 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float
|
||||
VECCOPY(isec.start, shi->co);
|
||||
VECCOPY(isec.end, lampco);
|
||||
|
||||
if(RayObject_raycast(R.raytree, &isec)) {
|
||||
if(RE_rayobject_raycast(R.raytree, &isec)) {
|
||||
/* we got a face */
|
||||
|
||||
/* render co */
|
||||
|
@@ -2268,7 +2268,7 @@ static int bake_intersect_tree(RayObject* raytree, Isect* isect, float *start, f
|
||||
isect->dir[2] = dir[2]*sign;
|
||||
isect->labda = maxdist;
|
||||
|
||||
hit = RayObject_raycast(raytree, isect);
|
||||
hit = RE_rayobject_raycast(raytree, isect);
|
||||
//TODO bake_check_intersect
|
||||
if(hit) {
|
||||
hitco[0] = isect->start[0] + isect->labda*isect->vec[0];
|
||||
|
Reference in New Issue
Block a user