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.
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user