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

0 Members and 11 Guests are viewing this topic.

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 #30 on: June 21, 2013, 02:09:58 pm »
Good to hear about extra bitmap format support! Now we can use custom graphics to try the demo :D (For example if someone wants to see how the engine looks like with Unreal Tournament textures). Keep up the good work! :)

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 #31 on: June 21, 2013, 02:16:55 pm »
If you want to do that, you'll have to load a bitmap which is made out of 64*64 tiles and which has the exact same size than the currently used bitmap ! Also, the 64*64 white square is the area used to draw the plasma texture.
« Last Edit: June 21, 2013, 02:17:17 pm by Matrefeytontias »

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 #32 on: June 21, 2013, 02:51:32 pm »
I'm fine with that. :P Now I just need to rip Illusiat 6 graphics. :P

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 #33 on: June 21, 2013, 05:20:30 pm »
Be sure to post a screenshot, or even better the textures file :D

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #34 on: June 21, 2013, 06:43:36 pm »
I was wondering if for some textures, you could actually generate some programmatically (especially for geometric ones), maybe it would take less size ?
« Last Edit: June 21, 2013, 06:43:49 pm by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

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 #35 on: June 21, 2013, 11:48:34 pm »
Be sure to post a screenshot, or even better the textures file :D
I can't, because I never figured out how to install Ndless 3.1 on the emulator. It would have to be  a camera pic or video.

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 #36 on: June 22, 2013, 03:25:57 am »
With Ndless 3.1 it's actually not really different than installing it on real HW. Create the folder ndless/, transfer ndless_resources to it, then ndless_installer as an OS update (there's an nspire_emu command for this in the link menu). it's a matter of seconds :)
Ndless.me with the finest TI-Nspire programs

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 #37 on: June 22, 2013, 03:34:32 am »
Ah ok I didn't realize we could send OS updates to the emu. I thought I had to do some strange manipulation via command line and maybe even with Boot1/2 files or something. Thanks :)

Offline Spenceboy98

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 547
  • Rating: +59/-2
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #38 on: June 22, 2013, 12:47:00 pm »
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 ;D

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 :)

Yay! I will try to start porting when I can(I also have to work on my cemetech contest entry). Could I use your loading BMP routine for my Prizm Paint?
I like milk.

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 #39 on: June 22, 2013, 12:52:39 pm »
Yeah, please do, but please give me credits for it :) also good luck for your port !

I was wondering if for some textures, you could actually generate some programmatically (especially for geometric ones), maybe it would take less size ?
Yeah of course, but then you won't be able to add a generated texture to an array of already loaded ones unless you planned a blank 64*64 spot in the texture file to store it (that's what I did to store my plasma in the demo).

But of course you can still produce an array only made out of generated textures. But once again you won't be able to load textures from files and put them in the same array.
« Last Edit: June 22, 2013, 12:55:22 pm by Matrefeytontias »

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 #40 on: June 22, 2013, 01:12:43 pm »
With custom texture support, it was only a matter of time before this happen:
« Last Edit: June 22, 2013, 01:14:03 pm 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 #41 on: June 22, 2013, 01:24:40 pm »
You see ? It works well :P
* Matrefeytontias lost (thanks DJ)
« Last Edit: June 22, 2013, 01:26:06 pm by Matrefeytontias »

Offline Spenceboy98

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 547
  • Rating: +59/-2
    • View Profile
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #42 on: June 22, 2013, 04:07:37 pm »
Okay. It looks messed up, but here's Prizm screenshots:

When you enter the game:


Later in the game:


In the same spot:


At the end(the plasma doesn't work right :/ ):


I think the reason it isn't rendering right is because of my sqrt routine. The Prizm SDK doesn't have one, so I had to find one online. Here it is:

Code: [Select]
double sqrt1(double x){
    if(x<0) return 1;
    double a = 1;
    double b = x;
    while (abs(a-b)>1){
        a = (a+b)/2;
        b = x/a;
    }
    return a;
}

Maybe one of you knows a better way for sqrt(sorry to ask in this topic, but I don't have another)?
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 #43 on: June 22, 2013, 05:00:19 pm »
Okay. It looks messed up, but here's Prizm screenshots:

When you enter the game:

You don't lose? O.O

Looks kinda cool so far despite not rendering well. How high is the frame rate on a real calculator?

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« Reply #44 on: June 22, 2013, 05:13:50 pm »
Take a look here: http://www.codeproject.com/Articles/570700/SquareplusRootplusalgorithmplusforplusC

It's more complex, but I think it will be faster (better algorithm).
« Last Edit: June 22, 2013, 05:14:44 pm by Jim Bauwens »