Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: Jens_K on April 14, 2014, 11:34:20 am
-
Hi, I've been working on this little shadow engine for the Nspire the last 2 days:
It dynamically calculates and renders the shadows of a variable number of objects, relative to the position of the light source and draws their illuminated sides.
With 6 objects, it runs smoothly with 12-16 frames per second on the handheld.
Controls:
- click to enable/disable mouse control
- press m to change the render mode
- press r to enable/disable the illuminated rims
- in the upper left corner, there's a little fps counter
Note: There are some bugs, if objects are too close to each other or if the light source is too close to an object (but I didn't encounter a crash yet)
I made this engine just for fun, I don't think I'll do something with it or improve it soon; so you can do anything you want with it (but giving credit would be nice ;) )
-
Oh wow that looks real sexy ! :D
/me thinks you'd do great stuff if you programmed for Ndless ;)
-
Looks super nice :D
-
Indeed, it sure looks very nice :)
-
Blinded by the Dark Nspire port soon? :D http://www.ticalc.org/archives/files/fileinfo/226/22637.html
This looks pretty nice. I wonder how fast is it on a real calc?
-
Oh wow that looks real sexy ! :D
/me thinks you'd do great stuff if you programmed for Ndless ;)
Thanks, but I like lua! :-[ I'm kind of afraid of native programming; I have no experience with any C language yet... Are there some good tutorials out there?
Indeed, it sure looks very nice :)
Thanks! And thanks to your optimization tips, it runs great! :)
Blinded by the Dark Nspire port soon? :D http://www.ticalc.org/archives/files/fileinfo/226/22637.html (http://www.ticalc.org/archives/files/fileinfo/226/22637.html)
This looks pretty nice. I wonder how fast is it on a real calc?
I don't know this game, but I looks like it would be possible to port with this engine! But you'd have to make a seperate algorithm to check if an object like an enemie is in the shadow or not; the engine only proviedes the vertices of the shadow polygons.
On my Nspire CX with OS 3.2 (don't ask me why I'm to lazy to update :P) it runs with ~14 FPS, which is pretty fast for Nspire lua ;)
-
Seems quite nice. I bet it might be slower on 3.1, but thankfully, 3.6 can run Ndless so many people have switched. 14 FPS seems pretty fine IMHO (and higher would be problematic on the Click/Touchpad models anyway since motion blur would be too intense)
-
I don't know of any C tutorials in English, only French sorry. I'm sure someone else does. There is something to keep in mind, that you will not have event based programming in Ndless (unless you use particular libs which I doubt they would run on the Nspire).
-
@Jens :
I only quickly went through the code, but I believe that it can still be optimized. (Making math stuff in on.timer local, not redefining the gc-using function inside each on.paint call, etc.)
I'll go through it more in depth when I have some time, though, these days are pretty busy for me....