|
HikoGUI
A low latency retained GUI
|
The numeric_array is an array of numbers, with many mathematical operations on the array of numbers. The numeric_array is designed to be useable in constexpr and easily to vectorize by the optimizer.
The f32x4 is an numeric_array<float,4>.
Many of the operations on a f32x4 are hand optimized using the intel intrinsics on SSE registers.
A vector is a direction and distance.
When transforming a vector, only scale, rotation and shear have effect.
Both vector2 and vector3 are implemented as a f32x4 homogeneous 4D coordinate with w = 0.0.
A point is a location in space.
A point can be transformed in the same way as a vector and also be translated.
Both point2 and point3 are implemented as a f32x4 homogeneous 4D coordinate with w = 1.0.
An extent is a width, height and depth.
An extent can be transformed like a vector.
Both extent2 and extent3 are implemented as a f32x4 homogeneous 4D coordinate with w = 0.0.
Corner shapes are 4 floating point numbers, one for the corner in the left-bottom, right-bottom, left-top and right-top corner. Each number has the following meaning:
0.0 Sharp corner,>0.0 Radius of a rounded corner,<0.0 Radius of a cut corner.A 4D red, green, blue and alpha value. A color can be transformed like a vector3. In this case, the alpha value is ignored and copied into the result.
For more information, see: color.
A rectangle is a closed plane in three dimensions.
A rectangle can be transformed like a point3.
It should be implemented as a point3 in the left-bottom corner and two vector3s to the upper and right corners. However, it is currently implemented as 4 points, one for each corner.
The axis_aligned_rectangle class is a 2D axis-aligned rectangle.
When transforming an axis aligned rectangle in 3D or with rotation, the result will be a normal rectangle. A rectangle can be converted back to an axis_aligned_rectangle, as a bounding rectangle around the transformed rectangle.
An axis_aligned_rectangle is implemented as a f32x4 where:
x: left-bottom point xy: left-bottom point yz: right-top point xw: right-top point yThe mat class is a 4x4 homogeneous transformation matrix in column-major order. Internally, this a vec for each column.
Vector * matrix multiplications are performed as if the vector is a column.
All origins (0, 0, 0) are at the bottom-left-far corner. With the x-axis pointing right, y-axis pointing up, z-axis pointing near.
This is true for:
The coordinates in a window and widgets are in pixels.
With the center of the left bottom pixel having the coordinates (0.5, 0.5).
The alignment of borders to pixels is the responsibility of the widget that draws itself. The widget has access to the draw_context::draw_box_including_border() function to position the border's edge to the edge of the given rectangle, if the rectangle is rounded to integer coordinates; the rectangle, border and pixel will share the same edge.
Z-coordinate for a window is between 0.0 (far) to 100.0 (near).
For better precision we use a reverse-z method, to combine 1/z together with float with linear precision.
0.0.1.0 nearer.25.0 nearer.The coordinates in an image are in pixels. With the center of the left bottom pixel having the coordinates (0.5, 0.5).
The coordinates in a path are free from scale and origin, when rendering a path to an image, the path should be first be transformed to image coordinates.
Glyph coordinates are in the number of Em units. X-axis pointing right, Y-axis pointing up. The origin (0,0) is on the crossing of the base line and left side bearing. Vertices of front faces are specified in counter clockwise order.
Corners are enumerated as follows:
0: near bottom left1: near bottom right2: near top left3: near top right4: far bottom left5: far bottom right6: far top left7: far top rightWhen corners are packed in a 4D vector:
x: bottom-lefty: bottom-rightz: top-leftw: top-rightWhen edges are packed in a 4D vector:
x: bottom-edgey: left-edgez: top-edgew: right-edgeA front facing triangle has the vertex ordered in counter-clockwise direction.
Quads are defined as two front facing triangles.
The vertex index order is: 0, 1, 2, 2, 1, 3.
As illustrated below: