Jump to content

Vec3 vs vec3


Canardia
 Share

Recommended Posts

When using vec3, the coordinates should be noted with small letters (x,y,z), like GLSL does, and also NASA.

When using Vec3, the coordinates should be noted with capital letters (X,Y,Z), like in the C/C++ headers, or Panda3D (although it's a pure C++ API, so it uses getX() and setX() instead).

I find it a bit confusing, and hard to port code between LUA and C/C++, when LUA uses Vec3.x, and not vec3.x or Vec3.X.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I think lower-case vec3() feels nicer, but what is the rule that makes it so? All other commands are capitalized. Should math constructors be lower-case?

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I think it's more a general programming language convention, where either everything is lowercase, or everything starting with a capital letter (and in the middle also, seperating words). Sometimes there are also lowercase beginning letters, and then capital letters in the middle, but that's very ugly, like in Java and JavaScript.

 

Normally in C everything is lowercase, and underscore is used as word seperator, but as nobody has a pure C compiler anymore, but a C/C++ compiler, and C has also developed a bit (to C99, which is almost like C++), where I think it's OK to use commands starting with capital letters, just like in C++, where it is the standard.

 

I would use in LUA the same convention as in the C headers, which means everything starts with capital letters, and has them also as word seperators. It would mean that Vec3.X should be used.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...