diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-03-20 10:23:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-03-20 10:23:09 +0300 |
commit | a51477093b93fdbca69b47165012c762c46c7e34 (patch) | |
tree | 2f6d626a46c3c2825d8991373a61f977d2d47c63 /source/blender/python/api2_2x/Geometry.h | |
parent | 1ebc28bead0c28a505cc972b355b5515c0394b4e (diff) |
Geometry.c - rewrote my python box-packer algo in C,
packing 2400 rectanges is about 38x faster.
Use the C implimentation in uvcalc_lightmap and uvcalc_smart_project
Blender.c - filename returning None raises errors with existing scripts, just return "" so string functions on the filename dont raise an error.
Diffstat (limited to 'source/blender/python/api2_2x/Geometry.h')
-rw-r--r-- | source/blender/python/api2_2x/Geometry.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Geometry.h b/source/blender/python/api2_2x/Geometry.h index 4de3e8ef0e1..a601d39f274 100644 --- a/source/blender/python/api2_2x/Geometry.h +++ b/source/blender/python/api2_2x/Geometry.h @@ -39,4 +39,37 @@ PyObject *Geometry_Init( void ); + +/* Box Packer */ +typedef struct boxVert { + float x; + float y; + short free; + + struct boxPack *trb; /* top right box */ + struct boxPack *blb; /* bottom left box */ + struct boxPack *brb; /* bottom right box */ + struct boxPack *tlb; /* top left box */ + + /* Store last intersecting boxes here + * speedup intersection testing */ + struct boxPack *isect_cache[4]; + + int index; +} boxVert; + + +typedef struct boxPack { + float x; + float y; + float w; + float h; + int index; + + /* Verts this box uses + * (BL,TR,TL,BR) / 0,1,2,3 */ + boxVert *v[4]; +} boxPack; + + #endif /* EXPP_Geometry_H */ |