diff options
author | Andre Susano Pinto <andresusanopinto@gmail.com> | 2009-06-30 18:05:33 +0400 |
---|---|---|
committer | Andre Susano Pinto <andresusanopinto@gmail.com> | 2009-06-30 18:05:33 +0400 |
commit | 021e0cc53f5169a92e06eafa321bc53b305f002f (patch) | |
tree | ba43f07710d879a413c0011c002e1ca4b4e49804 /source/blender/render/intern/include/rayobject.h | |
parent | e0cfafa6292cbcec5d49817583204a418308aac7 (diff) |
*reserved RayObject align offset 0 for private usage inside each structure
point is that other structures like trees can then distiguish between other nodes or rayobject primitives
withouth needing any other variable.
(Note yet used but will reduce memory by a nice factor (linear to the number of primitives))
Diffstat (limited to 'source/blender/render/intern/include/rayobject.h')
-rw-r--r-- | source/blender/render/intern/include/rayobject.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/render/intern/include/rayobject.h b/source/blender/render/intern/include/rayobject.h index 53d96d6331f..d516c122bcc 100644 --- a/source/blender/render/intern/include/rayobject.h +++ b/source/blender/render/intern/include/rayobject.h @@ -58,13 +58,15 @@ only 2 are used: addr&2 - type of object - 0 RayFace - 1 RayObject (generic with API callbacks) - 2 unused + 0 Self (reserved for each structure) + 1 RayFace + 2 RayObject (generic with API callbacks) 3 unused - 0 was choosed to RayFace because thats the one where speed will be needed. - + 0 means it's reserved and has it own meaning inside each ray acceleration structure + (this way each structure can use the allign offset to determine if a node represents a + RayObject primitive, which can be used to save memory) + You actually don't need to care about this if you are only using the API described on RE_raytrace.h */ @@ -101,10 +103,13 @@ typedef struct RayObjectAPI } RayObjectAPI; //TODO use intptr_t -#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_align(o) ((RayObject*)(((int)o)&(~3))) +#define RayObject_unalignRayFace(o) ((RayObject*)(((int)o)|1)) +#define RayObject_unalignRayAPI(o) ((RayObject*)(((int)o)|2)) + #define RayObject_isAligned(o) ((((int)o)&3) == 0) +#define RayObject_isRayFace(o) ((((int)o)&3) == 1) +#define RayObject_isRayAPI(o) ((((int)o)&3) == 2) /* * Extend min/max coords so that the rayobject is inside them |