Author Topic: [Lua] Make3D  (Read 40359 times)

0 Members and 3 Guests are viewing this topic.

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #75 on: August 09, 2011, 12:50:45 pm »
ProjectPoint(obj[i ], obj[i+1], obj[i+2], zoffset)
I see, it's just {x,y,z}... Just what i thought first. i will study it. Thanks!
Is anything i must know to understand it?

Use setPixel() or equivalent in C, since in the TI-Nspire Lua API we don't have this.
And I think that you may use a Z-buffering instead of my Z-sorting (I wish do one if I had getPixel() and setPixel() )

And one more thing, for a the faces correlation : It is a table of undetermined size tables (2, 3, 4 etc ..). Each element refers to an index in the point list. The order is important, like if you draw yourself the face with lines point by points.

Good Luck =)
« Last Edit: August 09, 2011, 12:51:29 pm by Levak »
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #76 on: August 09, 2011, 12:52:58 pm »
I want to start with a wireframe, after blanks face with black contour. So, Z-buffer... Ow...

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #77 on: August 09, 2011, 12:55:33 pm »
I want to start with a wireframe, after blanks face with black contour. So, Z-buffer... Ow...

Don't be afraid about a Z-buffering. There are many tutorials on the internet. It is a really simple and powerfull algorithm, but, for performance, you should implement your own face filling algorithm. It is a really interesting experience.
« Last Edit: August 09, 2011, 12:56:06 pm by Levak »
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #78 on: August 09, 2011, 01:44:59 pm »
Z-buffering is actually quite simple. You create an array with an entry for every pixel on the screen. In each "pixel" of the array is the depth of the object that was drawn there. Before drawing each pixel, you check the corresponding depth, and if it is closer than what you would draw, then that pixel does not get drawn. If the pixel does get drawn, then the z buffer is updated with the depth of that pixel.

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #79 on: August 10, 2011, 09:28:50 pm »
Ok, nothing really special during the past 3 days, so I rewrote the menu engine to make it compatible with the built-in  toolpalette.

Now, I've a dual menu. Why ? It lets me now make it compatible either with the Nspire-viewer and the TI Nspire Computer Software (with my personal menu) or with the TI-Nspire handheld.
So ... why keep the built-in toolpalette ? Because I'm sure it will be enhanced in future updates of the TI-Nspire API (if you see what I mean ;) )



Here is a comparison with the built-in toolpalette :

« Last Edit: August 10, 2011, 09:45:48 pm by Levak »
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #80 on: August 10, 2011, 09:34:38 pm »
Awesome, really :)
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #81 on: August 11, 2011, 07:58:36 am »
I have missed something: does it mean the built-in tool palette cannot be used with the player and the Computer Software?
Ndless.me with the finest TI-Nspire programs

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #82 on: August 11, 2011, 09:32:26 am »
There is no "menu" key...

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #83 on: August 11, 2011, 06:18:51 pm »
There is. It is to the right of the click/touch pad.

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #84 on: August 11, 2011, 06:37:36 pm »
I have missed something: does it mean the built-in tool palette cannot be used with the player and the Computer Software?

Actually I was half-wrong. Yes the TI-Nspire-online-Viewer doesn't include the toolpalette support. On the other hand, the TI-Nspire Computer Software manages the user's toolpalette. I was used to have this toolpalette on the top of the interface, like on the version 1.6 to 2.1 of the software, but they changed its place on the side panel, where I wasn't enabled to see !





On the other way, here a demo of my menu in TINCS :

I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #85 on: August 12, 2011, 05:31:15 am »



What's new :
 - Modes demo, using the same code for each widget (saved)
 - Properties mode displaying the lastest selected properties
 - Text input (related to the properties mode)
 - Display objects's label
 - bugs fixed

From the Properties panel we can change directly object's data, except its name. Why ? because I store each object as : cube.[datas], cube2.[datas]

If we change the object's name, we have to :
 1) Change its name (obviously)
 2) Duplicate the object and monitor it
 3) Delete the old object

only to change its name. The name will be choosen at the object's creation.
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #86 on: August 12, 2011, 05:39:57 am »
Very good work Levak :)

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #87 on: August 12, 2011, 08:31:58 am »
Can we move the camera? (related with the motor...)

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #88 on: August 12, 2011, 08:37:41 am »
Can we move the camera?
For now we can rotate the camera, but a move is planed

Quote
(related with the motor...)

A what ?
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #89 on: August 12, 2011, 08:44:23 am »
Related with my motor prject.
How the motor works? I dunno how directly adpat these engine in C...