As promised, here is a BlitzMax module based on my LZMA module that handles automatic compression of streams. By using it reading and writing compressed files is as easy as using "lzma::" as a prefix to OpenStream.
It should also work fine with other types of streams, eg. IncBin streams (using "lzma::incbin::"). It requires that the stream supports seeking, so it won't work with network streams as is.
It requires the LZMA module. Here are source and win32 versions with and without the LZMA module:
To install, unpack the zip to BlitzMax/mod. See test.bmx for a simple example.
I wrapped together a BlitzMax module for LZMA compression. It is based on LZMA SDK (version 4.62) and only has a BlitzMax wrapper written by me - the rest is someone else's work. It is completely in the public domain.
There are two releases for this. The source only version requires building modules whereas the Windows build does not (but obviously only work on Windows).
To install, simply unpack the zip to BlitzMax/mod. The test.bmx file included can be used to test it works and shows how to use it. The interface is like that of Pub.Zlib which comes with BlitzMax by default.
Coming up next: LZMA streams...
I'm writing a small raytracer to familiarize myself with Java. Obviously many of the main algorithms need to be as fast as possible in order to eventually get to real time speeds.
Here's my optimized version of a ray-sphere intersect check. It can probably be tweaked further: 9 additions, 7 multiplications best case; and 12 additions, 7 multiplications and a square root worst case is the current speed/complexity.
The method only calculates t - the coefficient of the ray direction vector. That's because there is no use calculating the actual intersect position before the smallest t has been found.
Feel free to use however you like.
public double intersectRay(double[] ro, double[] rd, double minDist) { double px = ro[0]-position[0]; double py = ro[1]-position[1]; double pz = ro[2]-position[2]; double b0 = rd[0]*px + rd[1]*py + rd[2]*pz; double d0 = b0*b0 + size - px*px - py*py - pz*pz;
// No intersect if (d0<0) return 0;
b0 = -b0; d0 = Math.sqrt(d0); double t = b0 - d0; if (t > EPSILON) { // t0
// Too far if (t > minDist) return 0; } else { // t1 t = b0 + d0;
// Behind or too far if (t <= EPSILON || t > minDist) return 0; }
// Valid intersect return t; }</code>
My first impressions after using Windows Vista extensively are somewhat positive. The only major problem that remains is that I'm completely unable to have Windows Network work between the Vista machine and another desktop with XP. However, there were other problems, one of which had to do with "limited network connectivity".
The way to solve that came up after some major Googling (major because the help in question wouldn't come up without the term 'DHCP'): Vista uses a broadcast DHCP flag that wasn't used by XP and some routers cannot handle that properly. So I appliedthe suggested registry tweaks and it started working.
In my case the default setting was DhcpConnForceBroadcastFlag set to 1
Weird how everything in Windows needs a reboot: I also had a printer problem which magically disappeared after a system reboot. One really hopes they'll come up with another way to sort problems in some future version of Windows...
I've pulled together a first alpha release of MaxPre - a preprocessor for BlitzMax.
It should support most syntax, but may well throw many random looking errors. It has a simple support for properties, like those in the .NET languages, through the new keyword Property. the test file will show how they work.
The zip contains maxpre.exe, which is the executable. It can be run from the command line or by drag&dropping a source file on it. Dragging the testfile.bmx on it will create testfile.pp.bmx. For it to work one of the following is needed: an environment variable BMXPATH pointing to BlitzMax or the same in bmxpath.txt.
Download: MaxPre Alpha (50KB zip)