Naming Conventions
The following page describes spectras naming conventions.
Generic
Usually, abbreviations are not used unless they are extremely common and obvious, and the words they replace are substantially longer than the abbreviation.
Example:
calcDerivative()
evalExpression()This is a fairly rare occurrence in the engines source however, so its recommended to keep the use of abbreviations to a minimum.
In addition, variables are almost always written in full. The only exception for this is in for loops.
Example:
int i; // Instead of: int indexKeep in mind that even though letters like these are extremely common in for loops, it is still recommended to use a more descriptive name, like x or y for coordinates, or “name” when iterating over an array of names.
Classes
Classes start with an uppercase letter and remain lowercase until another word follows.
Example:
class RenderUtils {
// Some code
}Functions
Both function names as well as arguments follow the same convention as Variables although they remain the same when a function is a constexpr.
Example:
Variables
Variables start with a lowercase word. Any subsequent words start with an uppercase letter.
Example:
An exception to this convention are constant values. Constants are all uppercase and words are separated by underscores.
Example:
Enums
Enums are fully uppercase and prefixed with ST.
Example:
One important thing to note is that spectra has some enums that it solely uses internally that should not be used outside of the engines own codebase unless specified otherwise. They should only be used if you want to modify the engines source or want to log some internal state of the engine.
These enums are prefixed with IST (Internal Spectra).
Structs
Structs follow a similar convention as Variables although they remain the same when a function is a constexpr. They are always prefixed with a lowercase "st" and suffixed with "Info". Like this:
Last updated