DIE Engine
Loading...
Searching...
No Matches
colors.h File Reference
#include <smmintrin.h>
#include <stdint.h>

Go to the source code of this file.

Functions

uint32_t colorsScaleSSE4 (uint32_t color, uint16_t scale)
 Scale a packed ARGB color by a fixed-point factor.
uint32_t colorsMultiplySSE4 (uint32_t color1, uint32_t color2)
 Multiply two packed ARGB colors component-wise.
uint32_t colorsLinearSSE4 (uint32_t color1, uint32_t color2, uint16_t t)
 Linearly interpolate between two packed ARGB colors.
uint32_t colorsScaleAccumulateSSE4 (uint32_t color1, uint32_t color2, uint16_t scale)
 Scale a packed ARGB color and accumulate it on another one.
__m128 vectorLinearSSE4 (__m128 color1, __m128 color2, float t)
 Linearly interpolate between two color vectors.
__m128 unpackColorToVectorSSE4 (uint32_t color)
 Unpack a packed ARGB color into a normalised 4-float vector.
__m128 unpackColorToVectorScaledSSE4 (uint32_t color, float scale)
 Unpack a packed ARGB color into a scaled 4-float vector.
uint32_t packVectorToColorSSE4 (__m128 color)
 Pack a normalised 4-float color vector into a packed ARGB color.

Function Documentation

◆ colorsLinearSSE4()

uint32_t colorsLinearSSE4 ( uint32_t color1,
uint32_t color2,
uint16_t t )
inline

Linearly interpolate between two packed ARGB colors.

Parameters
color1packed 8-bit ARGB color (t = 0)
color2packed 8-bit ARGB color (t = 256)
tQ8.8 interpolation factor (0 .. 256 = 0.0 .. 1.0)
Returns
interpolated packed ARGB color

◆ colorsMultiplySSE4()

uint32_t colorsMultiplySSE4 ( uint32_t color1,
uint32_t color2 )
inline

Multiply two packed ARGB colors component-wise.

Parameters
color1packed 8-bit ARGB color
color2packed 8-bit ARGB color
Returns
product packed ARGB color (components scaled by 1/256)

◆ colorsScaleAccumulateSSE4()

uint32_t colorsScaleAccumulateSSE4 ( uint32_t color1,
uint32_t color2,
uint16_t scale )
inline

Scale a packed ARGB color and accumulate it on another one.

Parameters
color1packed 8-bit ARGB color (accumulator)
color2packed 8-bit ARGB color (to be scaled)
scaleQ8.8 scale factor (0 .. 256 = 0.0 .. 1.0)
Returns
color1 + color2 * scale, packed ARGB color (saturated)

◆ colorsScaleSSE4()

uint32_t colorsScaleSSE4 ( uint32_t color,
uint16_t scale )
inline

Scale a packed ARGB color by a fixed-point factor.

DIE ENGINE Depth Integration Engine / A modern ray-caster (c) Fred's Lab 2024-2026 Frédéric Meslin / info@.nosp@m.fred.nosp@m.slab..nosp@m.net SPDX-License-Identifier: MIT If used commercially, contributions, donations are highly appreciated.

color functions

Parameters
colorpacked 8-bit ARGB color
scaleQ0.16 scale factor (0 .. 65535 = 0.0 .. ~1.0)
Returns
scaled packed ARGB color

◆ packVectorToColorSSE4()

uint32_t packVectorToColorSSE4 ( __m128 color)
inline

Pack a normalised 4-float color vector into a packed ARGB color.

Parameters
colorcolor vector (components in 0.0 .. 1.0)
Returns
packed 8-bit ARGB color (saturated)

◆ unpackColorToVectorScaledSSE4()

__m128 unpackColorToVectorScaledSSE4 ( uint32_t color,
float scale )
inline

Unpack a packed ARGB color into a scaled 4-float vector.

Parameters
colorpacked 8-bit ARGB color
scalescale factor applied to all components
Returns
color vector (components in 0.0 .. ~scale)

◆ unpackColorToVectorSSE4()

__m128 unpackColorToVectorSSE4 ( uint32_t color)
inline

Unpack a packed ARGB color into a normalised 4-float vector.

Parameters
colorpacked 8-bit ARGB color
Returns
color vector (components in 0.0 .. ~1.0, scaled by 1/256)

◆ vectorLinearSSE4()

__m128 vectorLinearSSE4 ( __m128 color1,
__m128 color2,
float t )
inline

Linearly interpolate between two color vectors.

Parameters
color14-float color vector (t = 0.0)
color24-float color vector (t = 1.0)
tinterpolation factor (0.0 .. 1.0)
Returns
interpolated color vector