Scalar

From ENIGMA
Jump to navigation Jump to search

ENIGMA implements scalar types for all of its major systems to make it easy to switch between double and floating point precision or other data types for coordinate spaces. Most graphics hardware do not support double point precision for rendering even by emulation, really only a few Nvidia cards do. Double point precision for graphics or physics is only recommended for simulations on planetary scales.

enigmafolder/ENIGMASystem/SHELL/Universal_System/scalar.h is where the scalar definitions can be found and toggled or replaced with other data types.

The following are the built in scalar types...

  • as_scalar : default audio system scalar mainly used for coordinate space and fall off calculations
  • gs_scalar : graphics system scalar mainly used for rendering parameters like coordinate space, texture repitition, and other things
  • cs_scalar : collision system scalar mainly used for coordinate space, angles remain as double because of that being the default C and C++ implementation

To switch from default float to double precision, simply add the following code before the definitions in the aforementioned header. You can also add other data types.

#define AS_SCALAR_64
#define CS_SCALAR_64
#define GS_SCALAR_64

There is also angular unit functions which allow you to switch the angular unit of major systems between degrees and radians. To switch all major systems to radians, simply add the following code before the definitions in the aforementioned header.

#define AS_ANGULAR_UNIT_RADIANS
#define CS_ANGULAR_UNIT_RADIANS
#define GS_ANGULAR_UNIT_RADIANS