Jump to content

Vec3 vs vec3

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.

Share this post

Link to post

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?

Share this post

Link to post

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.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

  • Create New...