Skip to content

Latest commit

 

History

History
64 lines (35 loc) · 3.06 KB

contributing.md

File metadata and controls

64 lines (35 loc) · 3.06 KB

Contributing Guidelines

Your contributions to the dmri-explorer project are very much welcomed!

Feature Requests or Bug Reporting

Please feel free to open an issue to discuss future enhancements or to report any problem you might encounter during the installation or execution of the software. Even better, you can open a pull request to address an issue.

Coding Standards

The source code is written in C++ and OpenGL shading language (glsl).

C++ code

Indentation and line length

The code is indented with 4 space characters instead of tabs. Use indentation everywhere except for namespaces. Also avoid too long lines. Maximum line length should be around 80 characters. If possible, split excessively long lines on multiple lines.

Const correctness

The code should be const-correct, that is every variable that will not change during its lifetime should be marked as const. Refer to this link for more details on const correctness.

Class members

Classes should be defined in header files. Instead of setting default values in the header files, do so in the constructor. Whenever possible, initialize member variables in member initializer lists.

Class access modifiers

Always use the most restrictive access modifier possible for class members and functions. Always prefer getters and setters to friend classes, or public class members.

Curly braces

Always put curly braces on their own line. Always use curly braces, even for oneline if and for statements.

Pointers and reference

When declaring pointers (*) and reference (&) arguments, put the appropriate symbol right next to the type. For example, prefer const type* myArg to const type *myArg.

Documentation

Please write documentation in header files using the doxygen standard. A doxyfile is available for generating the doxygen documentation locally.

GLSL Shaders

Shader file naming convention

OpenGL shaders are written in the OpenGL shading language (glsl) version 4.60. Shaders are stored in the Engine/shaders/ directory and should follow the naming convention {name}_{type}.glsl. For example:

  • *_frag.glsl for fragment shaders;
  • *_vert.glsl for vertex shaders;
  • *_comp.glsl for compute shaders.

If you use a different shader type, please propose a suffix following this convention.

Shader #include directives are supported. Utilities files should be located under the Engine/shaders/include/ directory and end with _util.glsl.

Variable name style

In shader code, we distinguish between variables shared between shaders (in and out keywords) and local variables by using a different style:

  • Use snake_case for in and out variables;
  • Use camelCase for local variables.

Third-party libraries

Third-party libraries should be included under the deps folder, in their own folder identified by their name. Make sure to include the license notice with the library you wish to add.