Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bwang

Pages: 1 ... 18 19 [20] 21 22 ... 44
286
Other Calc-Related Projects and Ideas / Re: Floorcaster
« on: July 24, 2010, 06:40:08 pm »
I converted everything to fixed point, and now I can draw twice the number of pixels and still get a 25% speed gain :)
Fixed point is amazing; I think my next project will be converting Ncaster to fixed point.

287
Other Calc-Related Projects and Ideas / Re: Floorcaster
« on: July 24, 2010, 04:04:15 pm »
I only draw half the screen right now.
What are the differences between mode7 and floorcaster (raytracer)?
Mode 7 takes a sprite, translates and rotates it, and then scales each horizontal line appropriately to give an illusion of perspective.
Floorcasting does a calculation for each pixel that determines the intersection between a ray and a plane.
They are completely different algorithms which give the same results.

288
Other Calc-Related Projects and Ideas / Re: TILP: beta-testing...
« on: July 24, 2010, 03:19:21 am »
The file changes size when VBA uses it. Maybe that causes troubles?

289
Portal X / Re: Portal X
« on: July 24, 2010, 03:09:03 am »
Oh darn, Axe really has changed since I last checked. I should probably pick up Z80 coding again :)
Curse you OS 1.1 power bug!

290
Portal X / Re: Portal X
« on: July 24, 2010, 03:06:40 am »
Have you solved the out-of-memory issues? Last time I asked you, you had something like 800 bytes left.
Sorry if you posted this already, but I haven't been following this thread and I don't feel like browsing through 25 pages to find out :(

291
Other Calc-Related Projects and Ideas / Re: Floorcaster
« on: July 24, 2010, 03:03:31 am »
Yeah, I'll probably do that, even if I have to sacrifice screen area.
2x1 looks sooooo much better than 2x2.

292
Other Calc-Related Projects and Ideas / Re: Floorcaster
« on: July 24, 2010, 02:45:49 am »
Here's a still.
Really quite boring, but I think there's potential.
I need to figure out how to handle the ugliness that occurs when rendering far-away areas.
The checkerboard is not procedural; I'm actually scaling a 64x64 sprite up to a huge area. Yay giant pixels! :)
I think I have little enough code here so I can convert everything to fixed point without causing myself a debugging nightmare.

293
Other Calc-Related Projects and Ideas / Re: Floorcaster
« on: July 24, 2010, 02:36:53 am »
Sadly, my computer is not up to the task of running the emulator and encoding an AVI screen capture at the same time, and CalcCapture doesn't support Linux. I'll post some screenies when I get on Windows.
It doesn't look very exciting because I'm too lazy to make a good tilemap, so its just a checkboard right now.

294
Other Calc-Related Projects and Ideas / Re: Floorcaster
« on: July 24, 2010, 02:02:40 am »
2x2 pixels.

295
Other Calc-Related Projects and Ideas / Re: Floorcaster
« on: July 24, 2010, 01:49:14 am »
20-30 at the moment.
This one does with minimal code changes.

296
Other Calc-Related Projects and Ideas / Re: Floorcaster
« on: July 24, 2010, 01:29:37 am »
It does the linear algebra for every pixel.
Here's are the loop contents:
Code: [Select]
float y1 = h - y;
float y2 = y - h/2;
float c = 1 + y1 / y2;
int floorX = (int) ((raydx * c) + px);
int floorY = (int) ((raydy * c) + py);
5 adds, 2 multiplies, and 2 divides.
If I did the pre-calculated method, I think it would be 4 adds and 4 multiplies. Definitely faster :)
However, that method does not easily allow vertical motion :(
If I draw every 4th pixel like I do now, I actually get quite a decent framerate. I wonder if this is worth continuing, or should I try to figure out how to do proper mode 7?

297
Other Calc-Related Projects and Ideas / Floorcaster
« on: July 23, 2010, 10:50:04 pm »
In case anyone is interested, here is the old floor casting code from Ncaster. Its rather rudimentary, but with a bit of modding you can cast a tilemap.
It might be useful for a racer or something.
To compile, drop main.c and rayheader.c/h into an standard Nspire dev directory, modify the Makefile appropriately, and compile as usual.
It is interesting to note that this is technically a real-time raytracer, albeit a very, very, very limited one. Madness! :)

298
Calculator C / Re: Post your Nspire routines here!
« on: July 23, 2010, 09:06:09 pm »
Fixed in the first post :) Thanks for the bugfix!
Can someone verify whether the Linux and Windows versions of the tools can coexist in the same directory? That way I can merge the two skeletons.

299
Other Calc-Related Projects and Ideas / Re: TILP: beta-testing...
« on: July 23, 2010, 09:00:28 pm »
Lionel Debroux, did you ever fix the problem of files created by Visual Boy Advance not sending?

300
Math and Science / Re: New RSA Algorithm discussion
« on: July 23, 2010, 08:57:59 pm »
@graphmastur: I will try to explain the algorithm:

Shanks-Tonelli modular square root algorithm:
The problem: given n and p, with p prime, find x such that x^2 = n (mod p)
First, a digression. The Legendre symbol (n|p) (actually written in a different manner, but the forum does not support typesetting) is defined as follows: (n|p) = 1 if such an x exists, 0 if p divides n, and -1 otherwise. It can be computed as n^((p-1)/2) mod p.
Now we return to the algorithm:
Step 1: Let p - 1 = 2^s * q , with q odd. This can be done by dividing powers of 2 out of p - 1 until we cannot do so any further.
Step 2: Select z such that (z|p) = -1. We do this simply by randomly selecting z in the set {1, 2, ... p - 1} and computing (z|p) as described above.
Step 3: Let:
                    c = z^q mod p
                    r = n^((q + 1) / 2) mod p
                    t = n^q mod p
                    m = s
Note that all of these values can be computed rapidly using the repeated squaring algorithm.
Step 4: We execute the following loop:
                    While t != 1
                       i = 0
                       tmp = t mod p
                       While tmp != 1
                         tmp = tmp * tmp mod p
                         i = i + 1
                       EndWhile
                       b = c
                       For k = 1 to m - i - 1
                         b  = b * b mod p
                       EndFor
                       r = r * b mod p
                       t = t * b^2 mod p
                       c = b^2 mod p
                       m = i
                    EndWhile
Step 5: Return r

Pages: 1 ... 18 19 [20] 21 22 ... 44