Author Topic: [Lua] Make3D  (Read 40525 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 #45 on: July 03, 2011, 11:02:40 pm »
Ok, back !

I passed my exams \o/ \o/ \o/

So, today I re-installed my ubuntu to v11.04 and continued Make3D development !

I updated the entire source code with my Sudoku one. It was really simple, everything is extensible and modular =p
http://levak.free.fr/ftp/nspire/Make3D/

I added a basic Transformation Screen overlay so that I can use it for any future transformations. For now I support the rotation transformation. It works exactly the same way as on Blender :

Pressing R gives the opportunity to rotate the selected objects in any directions (x, y, z)
Pressing R, then (or later) X, or, Y, or Z, lets us rotate along the X or Y or Z axis
Pressing R, then (or later) Shift+X or Shift+Y or Shift+Z, lets us lock X or Y or Z axis during rotation (thus it is a Y and Z or X and Z or X and Y rotation)
Pressing R, then a number (like 42) lets us rotate of a certain value. We can use (-) symbol

I'm working on the mouse handle for this concept.



For now, I'm working in degrees. Why ? only because I work with a trig table that I initialize only once at the beginning. I'm sure that for educational purpose it is a problem, because we have to use values like pi over 2, over 4, over 3 etc ... and there are not rational values. This is why, for now again, we can't enter values like 0.5 or so. The current architecture of Make3D lets me to use it in a different way.

Make3D renders a scene.
A scene is a basic list of several objects
Each objects has properties (like points, faces, color, origin, position, rotation, scale)

The render engine, every time, rotates the model along its origin, scales it, and grabs it then, rotates the entire resulting points list using the camera rotation. I'm sure you're thinking "he's mad ! he rotates 2 times the model !" >> I've no choice ! look :

When we rotate a model, we rotate it along one 3D point. It is, most of the time the {0, 0, 0} point. But, in fact it could also be the origin of the model !
Now, let's move the model, let's say {1, 0, 0}.
Now, let's rotate the model. Hum ? problem ? What is the rotation center point tho ? {0, 0, 0} ? or {1, 0, 0} ?
Here is the answer to the previous inb4 question :p

So, this way of mind let's me cheat with non integer values of rotation keeping the big optimization of a trig table !
Why ? Because I can store those values as a property, but, when I'm gonna render the model, I will approximate this value as an integer between 0 and 360 degrees. I think I will also take care about the document mode (radiant or degrees).
« Last Edit: July 03, 2011, 11:06:33 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 Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #46 on: July 04, 2011, 10:32:08 pm »
Made the same to Grab and Scale transform tools



The performance limit can be felt here : I duplicated 26 times the basic cube I had which contains 27 points, thus, 24 faces

This results in 702 dots and 624 faces. Who will reach this limit ? :p

For those who want to test (same link) ;
http://levak.free.fr/ftp/nspire/Make3D/Make3D.tns

Basic shortcuts :
  • Space : invoke context menu
  • Shift+D : duplicate
  • Shift+X : delete
  • R : invoke Rotation tool
  • G : invoke Grab tool
  • S : invoke Scaling tool
  • Tab/Shift+Tab : target an object
  • Enter : add targeted object to selection

When we invoke a tool :
  • X : use the tool along the X axis
  • Y : || Y axis
  • Z : || Z axis
  • Shift+X : use the tool along all axis except X axis
  • Shift+Y : || except Y axis
  • Shift+Z : || except Z axis
  • - : negative value
« Last Edit: July 04, 2011, 10:42:32 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 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 #47 on: July 05, 2011, 04:30:37 am »
Congratulations Levak (with your exams)!

And nice work on Make3D!

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #48 on: July 06, 2011, 12:45:50 am »
Hi !

Updated today many little things (I guess they can't be felt)
  • Fixed a bug when we delete multiple objects
  • Changed the global axis orientation to a right-hand rule (it was a left-hand one before)
  • Optimization on the trig table when operate the rotation
  • Fixed the rotation bug (the rotation matrix was wrong)
  • Clever rename routine based on Blender one when we duplicate objects
  • Duplicate an object invoke Grab tool (like in Blender)
  • Many many many little bug fix, sometimes I can't bear how stupid I can be
« Last Edit: July 06, 2011, 12:51:53 am 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 Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #49 on: July 07, 2011, 02:34:24 pm »


Translation : mouse handle is done for Grab, Scale and Rotate Tools, have fun !
(as the picture show, it is compatible with Nspire-player)
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 #50 on: July 08, 2011, 08:55:24 pm »
I'm lasy, so a picture will be better :


                                                                                                                                otherwise
« Last Edit: July 08, 2011, 08:57:25 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 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 #51 on: July 09, 2011, 03:52:00 pm »
That looks real impressive!

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #52 on: July 09, 2011, 04:32:43 pm »
thanks =)

I'm going on holidays during 3 weeks (FuRoBalEx, I've made videos for it and =P ), so I have to let Make3D down for this moment, to make robots and gain skills =D

Hope you'll understand ^^
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 #53 on: August 01, 2011, 09:28:52 pm »
Back !
Today I had a wonderful idea about a completly modular script.

First of all, it uses the widgets framework display. You know, when you split the screen with Doc > 5 > 1, or when you group widgets with Ctrl+4 ?
Imagine what we can do if we join that with Lua scripts.

I imagined it for you :

It was first a proof of concept, but I finally managed to get it working !

For now I have a completly-realtime-multi-threading interface. On one widget, I've got the animation playing, and in the other one I can duplicate objects, rotate them ect ... and all screens got refreshed ! (like in Blender !)

This will let me develop other modes, like Blender's interface : outliner, properties panel, etc ... in only one script duplicable !



In another part I managed to support RADIANS and DEGREES modes for rotations.
« Last Edit: August 01, 2011, 09:40:18 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 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: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #54 on: August 01, 2011, 09:56:40 pm »
THis is very great! ALso I saw that screenshot where you draw outside the screen area, it's a nice discovery ^^

Offline coolrudski

  • LV3 Member (Next: 100)
  • ***
  • Posts: 85
  • Rating: +1/-5
    • View Profile
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #55 on: August 01, 2011, 10:02:37 pm »
wow, this is great. i really like the UI. I can't wait to see what you come up with next with it.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #56 on: August 01, 2011, 10:59:55 pm »
Holy cow that is a great idea. Nice job Levak!

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 #57 on: August 02, 2011, 12:47:51 am »
yep, awesome ...

share the code for that specific part ?
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

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 #58 on: August 02, 2011, 01:32:43 am »
Wow, looks really neat! This also means that you have 3 timers \o/

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [TI-Nspire] Make3D - TI-Basic to Lua
« Reply #59 on: August 02, 2011, 09:13:43 am »
Thanks a lot !

yep, awesome ...

share the code for that specific part ?

There is no specific source code for this concept, because the TI Nspire framework does the job. The only thing to know is to share vars between scripts. This means that you must save them to the problem's vars (the doc's vars if you want).

I used a lot of var.store(), var.monitor() and var.unmonitor() to get this working. Even if it could work with a fully shared ressource, I kept the old object list buffer and, when a specified object updates, I update it in the buffer.

All sources are, for a while, already shared on my website : http://levak.free.fr/ftp/nspire/Make3D/
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua