Author Topic: A Cube3D  (Read 265 times)

HSE

  • Member
  • ****
  • Posts: 533
  • <AMD>< 7-32>
A Cube3D
« on: August 02, 2017, 10:58:11 PM »
Hi all!

Just expecting AVCaballero's codes ( :biggrin: ), I found some very interesting masm32 simple cube  codes from Tom-Art tutorials 1 and 2.

With very little modificactions I increase the options. The minimum binary have 7k but here I added resources preventing someone could have AV problems.     

  --------------------------------
      Updated 3 August 2017
   ---------------------------------
« Last Edit: August 04, 2017, 12:25:09 PM by HSE »

caballero

  • Member
  • ****
  • Posts: 760
    • Abre Ojos Ensamblador
Re: A Cube3D
« Reply #1 on: August 03, 2017, 12:07:13 AM »
Very nice! :t
En un lugar de la Mancha de cuyo nombre no quiero acordarme

jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: A Cube3D
« Reply #2 on: August 03, 2017, 12:13:55 AM »
Tom-Art tutorials 1

Très jolis, ces cubes :t

Mais les tutoriels sont tous en français. Qu'est-ce qu'il se passe? Meme Erol écrit en français maintenant ::)

HSE

  • Member
  • ****
  • Posts: 533
  • <AMD>< 7-32>
Re: A Cube3D
« Reply #3 on: August 03, 2017, 12:33:38 AM »
Mais les tutoriels sont tous en français. Qu'est-ce qu'il se passe? Meme Erol écrit en français maintenant ::)

Je ne se pá. Je ne comprend pá. Fortunatelly the code is masm32.

Yesterday I saw "Crocodile Dundee 3 (2001)"... and everybody speak Italian!! Even when escaping from Hutch friends (australian crocodiles)  :shock:

jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: A Cube3D
« Reply #4 on: August 03, 2017, 12:35:46 AM »
Yesterday I saw "Crocodile Dundee 3 (2001)"... and everybody speak Italian!!

Are you sure it wasn't Austritalian?

Siekmanski

  • Member
  • *****
  • Posts: 1094
Re: A Cube3D
« Reply #5 on: August 03, 2017, 12:36:25 AM »
Nice, but the Z-Axis needs to be inverted to get perspective 3D rotation.
The back side of the cube is now larger as the front side, this should be the other way around.

HSE

  • Member
  • ****
  • Posts: 533
  • <AMD>< 7-32>
Re: A Cube3D
« Reply #6 on: August 03, 2017, 01:41:21 AM »
Are you sure it wasn't Austritalian?
Apparently was an italian production. The titles of the movie are italian, and the italian voices fit so well that perhaps actors say the lines in italian. 

Nice, but the Z-Axis needs to be inverted to get perspective 3D rotation.
The back side of the cube is now larger as the front side, this should be the other way around.
Something don`t look very well. I will see. But scene is not really an scene, just a replication of the same cube that is easy with OOP.

caballero

  • Member
  • ****
  • Posts: 760
    • Abre Ojos Ensamblador
Re: A Cube3D
« Reply #7 on: August 03, 2017, 03:31:11 AM »
You have first to define your axis. Everyone is a world  :icon_rolleyes:

Usually:
Code: [Select]
         ^ y+
         |
         |
         |  / z+
         | /
  ---------------> x+
        /|
       / |
If you are in your position, z increases inside your monitor and it is usually what you want to paint.

But there are other people that considers
Code: [Select]
         ^ y+
         |
         |
         |  / z-
         | /
  ---------------> x+
        /|
       / |
That means that z increases pointing to you that maybe is what you'd like to paint.

But other people exchanges y and z axis, I think that is common in the USA.

When you paint the solid cube, there are many ways to do it in such a way that the faces that are in the backwards are not painted, just those that are closer to you, only those that your eyes can reach.

I haven't seen your code, but maybe this can help. :t
En un lugar de la Mancha de cuyo nombre no quiero acordarme

TWell

  • Member
  • ****
  • Posts: 748
Re: A Cube3D
« Reply #8 on: August 03, 2017, 03:43:13 AM »
But that is Z buffer and tree finger rule, look your thumb where it points. :icon14:
Z is positive from object to watcher.

HSE

  • Member
  • ****
  • Posts: 533
  • <AMD>< 7-32>
Re: A Cube3D
« Reply #9 on: August 03, 2017, 05:06:00 AM »
Z is positive from object to watcher.
I think in that way, apparently also Tom-Art.  :t

Siekmanski

  • Member
  • *****
  • Posts: 1094
Re: A Cube3D
« Reply #10 on: August 03, 2017, 05:22:38 AM »
3-D Coordinate Systems

Typically 3-D graphics applications use two types of Cartesian coordinate systems: left-handed and right-handed. In both coordinate systems, the positive x-axis points to the right, and the positive y-axis points up. You can remember which direction the positive z-axis points by pointing the fingers of either your left or right hand in the positive x-direction and curling them into the positive y-direction. The direction your thumb points, either toward or away from you, is the direction that the positive z-axis points for that coordinate system. The following illustration shows these two coordinate systems.



If you use a left-handed coordinate system and you are porting an application that is based on a right-handed coordinate system, you must make two changes to the data.

Flip the order of triangle vertices so that the system traverses them clockwise from the front. In other words, if the vertices are v0, v1, v2, pass them as v0, v2, v1.

Although left-handed and right-handed coordinates are the most common systems, there is a variety of other coordinate systems used in 3-D software. For example, it is not unusual for 3-D modeling applications to use a coordinate system in which the y-axis points toward or away from the viewer, and the z-axis points up. In this case, right-handedness is defined as any positive axis (x, y, or z) pointing toward the viewer. Left-handedness is defined as any positive axis (x, y, or z) pointing away from the viewer. If you are porting a left-handed modeling application where the z-axis points up, you must do a rotation on all the vertex data in addition to the previous steps.

Here an example that shows that the backside of the cube is smaller than the front, it uses a left-handed coordinate system.

HSE

  • Member
  • ****
  • Posts: 533
  • <AMD>< 7-32>
Re: A Cube3D
« Reply #11 on: August 03, 2017, 06:54:02 AM »
 :t 

HSE

  • Member
  • ****
  • Posts: 533
  • <AMD>< 7-32>
Re: A Cube3D
« Reply #12 on: August 04, 2017, 12:29:32 PM »
Corrected perspective (Tom-Art forgot it totally) in first post.

Now, after reversion, is failing face selection  :biggrin: