I just read over calcCropMatrix and although I have not completely thought about its working, I find the following lines a bit irregular:
Code:
float minX = clamp( maxf( frustMinX, bbMinX ), -1, 1 );
float minY = clamp( maxf( frustMinY, bbMinY ), -1, 1 );
float minZ = clamp( minf( frustMinZ, bbMinZ ), -1, 1 ); <--- !!!
float maxX = clamp( minf( frustMaxX, bbMaxX ), -1, 1 );
float maxY = clamp( minf( frustMaxY, bbMaxY ), -1, 1 );
float maxZ = clamp( minf( frustMaxZ, bbMaxZ ), -1, 1 );
If this is right, forgive my stupid post, but it seems a bit irregular, that you use min for the z coordinate and max for the others.