MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / floatToByte

Function floatToByte

source/core/StarMathCommon.hpp:297–301  ·  view source on GitHub ↗

Used in color conversion from floating point to uint8_t

Source from the content-addressed store, hash-verified

295
296// Used in color conversion from floating point to uint8_t
297inline uint8_t floatToByte(float val, bool doClamp = false) {
298 if (doClamp)
299 val = clamp(val, 0.0f, 1.0f);
300 return (uint8_t)(val * 255.0f);
301}
302
303// Used in color conversion from uint8_t to normalized float.
304inline float byteToFloat(uint8_t val) {

Callers 7

renderMethod · 0.85
renderCollisionDebugMethod · 0.85
netUpdateMethod · 0.85
updateMethod · 0.85
v3fToByteMethod · 0.85
v4fToByteMethod · 0.85
doRenderGlyphMethod · 0.85

Calls 1

clampFunction · 0.85

Tested by

no test coverage detected