Author Topic: [Ndless C] nRayC, a raycasting library for TI-Nspire  (Read 33768 times)

0 Members and 1 Guest are viewing this topic.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #15 on: June 14, 2013, 05:01:36 pm »
Cool :)
But why don't you use a relative path so we could put the textures.bmp.tns in the same directory as the game?
Because they are not automatically handled by the Nspire, and because I was too lazy to write a function to do it at the time I wrote the demo :P but it's something planned for the engine.
Also beware : the program is much, MUCH slower on an emulator than on-calc. At least on my PC :P
That's strange, all programs I've seen so far were a bit faster on an emulator than in reality. Also, it's quite fast in nspire_emu on my PC. Faster would be too fast :P
As I said, maybe it's only my PC :P

Offline lkj

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +58/-1
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #16 on: June 14, 2013, 05:18:56 pm »
Not sure what you mean ???
Code: [Select]
fopen("textures.bmp.tns", "r")The above code would open a file in the same directory as the executable? I'm almost sure I've used such code and it worked.

Edit: Sorry, you're right, doesn't work. I was sure I'd used it before, but apparently it really assumes "/documents/" as the folder if one doesn't use an explicit folder.
« Last Edit: June 14, 2013, 05:33:23 pm by lkj »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #17 on: June 14, 2013, 08:54:54 pm »
Did you put textures.bmp.tns in “/documents/ndless/“ ?
Oh I forgot to do that, I actually put it in the same folder as the test program lol.

By the way, will this program support 4, 8 and 24 bits textures? It would be nice for people who don't want to install GIMP, because no other image editor that is freeware can save in 16-bit format.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #18 on: June 15, 2013, 01:00:30 am »
Yeah of course I planned that. But like many other things, it'll come later.

Offline Spenceboy98

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 547
  • Rating: +59/-2
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #19 on: June 15, 2013, 01:47:55 am »
Could I please port this to Prizm?

This is great. Keep up the good work! :D
I like milk.

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #20 on: June 15, 2013, 04:26:15 am »
Nice Matrefeytontias :)
I suppose that cross-platform compatibility would require SDL, if it's now available on PRIZM.
Ndless.me with the finest TI-Nspire programs

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #21 on: June 15, 2013, 05:43:23 am »
@Spenceboy98 no problem, but you'd prefer to wait a little until I put in the lib some things to make its use easier (I have some defines in mind).

@ExtendeD Why that ? I didn't use any other library than the one I wrote ... <and fdlibm>
« Last Edit: June 15, 2013, 05:45:37 am by Matrefeytontias »

Offline excale

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 103
  • Rating: +19/-1
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #22 on: June 15, 2013, 07:15:19 am »
Cool :)
But why don't you use a relative path so we could put the textures.bmp.tns in the same directory as the game?
Because they are not automatically handled by the Nspire, and because I was too lazy to write a function to do it at the time I wrote the demo :P but it's something planned for the engine.

Use argv[0]. :)

Offline hoffa

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #23 on: June 15, 2013, 07:20:50 am »
Here's the code used in nSDL to use relative paths:

Code: [Select]
int nSDL_EnableRelativePaths(char **argv) {
    char buf[256], *p;
    strcpy(buf, argv[0]);
    p = strrchr(buf, '/');
    if (!p)
        return -1;
    *p = '\0';
    return NU_Set_Current_Dir(buf) ? -1 : 0;
}
« Last Edit: June 15, 2013, 07:22:33 am by hoffa »

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #24 on: June 15, 2013, 09:13:59 am »
Thanks hoffa, I'll use this one :)

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #25 on: June 15, 2013, 09:46:40 am »
Thanks hoffa, I've added it to Ndless/libndls.
Ndless.me with the finest TI-Nspire programs

Offline Spenceboy98

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 547
  • Rating: +59/-2
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #26 on: June 15, 2013, 01:39:41 pm »
@Spenceboy98 no problem, but you'd prefer to wait a little until I put in the lib some things to make its use easier (I have some defines in mind).

I actually got the most recent version to work(though there are some weird display errors :/ ). :P But I'll wait for updates.
I like milk.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #27 on: June 18, 2013, 01:58:17 am »
If you ever decided to use nSDL for the Nspire version, for a PRIZM port you could always ask Ruler501 if he ever released pSDL, since he was working on that PRIZM port of nSDL a few years ago.
« Last Edit: June 18, 2013, 01:58:48 am by DJ Omnimaga »

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #28 on: June 18, 2013, 05:52:43 am »
My goal is to write a stand-alone lib, so there's no chance that I'd use any other lib.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #29 on: June 21, 2013, 11:43:35 am »
Bump,

nRC_loadBMP now automatically detects and handles :
  • 1-bit monochrome bitmaps (B/W)
  • 4-bits grayscales bitmaps (16 colours)
  • 16-bits R5G6B5 bitmaps (65,536 colours)
  • 24-bits R8G8B8 bitmaps (16,777,216 colours, but they are scaled down to the Nspire screen, so either 16 or 65,536 colours)
They're the most common types of bitmaps :) I planned the support for paletted bitmaps for later, since it's pretty complicated.

Also, I added some constants to make porting the engine easier, so this should make your life easier Spenceboy98 :)

Also, the new build of the demo now uses relative paths, so you just have to put textures.bmp.tns in the same directory :thumbsup:

I also formatted the whole directory in a logical way x) documentation will be included in the next release (I hope :P)

EDIT : of course, if you have any wish for this engine, please share your ideas, I'll be happy to add them to my TODO list :)
« Last Edit: June 21, 2013, 11:46:22 am by Matrefeytontias »