2.2. General Advice¶
2.2.1. Further Reading¶
You should make yourself familiar with the Unity engine and some of its packages as well as libigl.
2.2.2. How to start developing¶
Find a good IDE and learn how to do basic things such as:
Go to definition (!)
Refactor names
Collapse all comments, #regions
Syntax highlighting and intellisense
Display quick documentation,
Crl
+Q
in JetBrains
Setup your debugger so you can set a breakpoint
Set up/find out some keyboard shortcuts
In C++ use the
LOG
macrosHave a look at the existing functionality and use it as an example
2.2.3. C# Features¶
Use LINQ for manipulating arrays and lists
Follow some of the advice from the Refactoring Guru
Mainly, keep files small and separate independent features.
2.2.4. Use of Bitmasks¶
Bitmasks are used often in this project for compact/efficient boolean storage. A common example is the selection vector. We have one 32-bit integer for each vertex, equivalent to 32 booleans per vertex. Each bit represents if the vertex is in that selection or not. There are some common operations with bitwise operators you may want to do. Please consider operator precedence.
Check if i-th bit is set
(flags & 1 << i) > 0
Set i-th bit
flags |= 1 << i;
Unset i-th bit
flags &= ~(1 << i);
Note that 1 << i
can also be a mask of several bits or a predefined constant.
2.2.5. VR Hands¶
Anything that is related to the controllers always has a left L and right R. This means lots of parameters are essentially duplicated.
Functions that are independent of these variables are often made and named
*Generic()
For booleans:
Left = false
,Right = true
2.2.6. Advanced¶
Be aware of the ‘Enter Play Mode Settings’ in
Project Settings > Editor
Reload Domain is expensive but ensures that things such as static variables are properly reset when pressing play. This can cause issues not present in a Build, make sure you clean up during OnDestroy.