The MASM Forum

Projects => ObjAsm => Topic started by: HSE on August 02, 2017, 10:58:11 PM

Title: A Cube3D
Post by: HSE 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 (http://codes-sources.commentcamarche.net/source/browse/40071/TOM-FPU_SAMPLE) and 2 (http://codes-sources.commentcamarche.net/source/40316-fpu-sample-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
   ---------------------------------
Title: Re: A Cube3D
Post by: avcaballero on August 03, 2017, 12:07:13 AM
Very nice! :t
Title: Re: A Cube3D
Post by: jj2007 on August 03, 2017, 12:13:55 AM
Quote from: HSE on August 02, 2017, 10:58:11 PMTom-Art tutorials 1 (http://codes-sources.commentcamarche.net/source/browse/40071/TOM-FPU_SAMPLE)

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 (http://forum.pellesc.de/index.php?topic=7177.msg27233#msg27233) ::)
Title: Re: A Cube3D
Post by: HSE on August 03, 2017, 12:33:38 AM
Quote from: jj2007 on August 03, 2017, 12:13:55 AM
Mais les tutoriels sont tous en français. Qu'est-ce qu'il se passe? Meme Erol écrit en français maintenant (http://forum.pellesc.de/index.php?topic=7177.msg27233#msg27233) ::)

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:
Title: Re: A Cube3D
Post by: jj2007 on August 03, 2017, 12:35:46 AM
Quote from: HSE on August 03, 2017, 12:33:38 AMYesterday I saw "Crocodile Dundee 3 (2001)"... and everybody speak Italian!!

Are you sure it wasn't Austritalian?
Title: Re: A Cube3D
Post by: Siekmanski 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.
Title: Re: A Cube3D
Post by: HSE on August 03, 2017, 01:41:21 AM
Quote from: jj2007 on August 03, 2017, 12:35:46 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. 

Quote from: Siekmanski 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.
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.
Title: Re: A Cube3D
Post by: avcaballero on August 03, 2017, 03:31:11 AM
You have first to define your axis. Everyone is a world  :icon_rolleyes:

Usually:

         ^ 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

         ^ 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
Title: Re: A Cube3D
Post by: TWell 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.
Title: Re: A Cube3D
Post by: HSE on August 03, 2017, 05:06:00 AM
Quote from: TWell on August 03, 2017, 03:43:13 AM
Z is positive from object to watcher.
I think in that way, apparently also Tom-Art.  :t
Title: Re: A Cube3D
Post by: Siekmanski 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.

(http://members.home.nl/siekmanski/LH%20coord%20system.png)

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.
Title: Re: A Cube3D
Post by: HSE on August 03, 2017, 06:54:02 AM
 :t 
Title: Re: A Cube3D
Post by: HSE 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: