Oolite
Loading...
Searching...
No Matches
OOFastArithmetic.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

OOINLINE float OOClamp_0_1_f (float value) INLINE_CONST_FUNC
OOINLINE float OOClamp_n1_1_f (float value) INLINE_CONST_FUNC
OOINLINE double OOClamp_0_1_d (double value) INLINE_CONST_FUNC
OOINLINE float OOClamp_0_max_f (float value, float max) INLINE_CONST_FUNC
OOINLINE double OOClamp_0_max_d (double value, double max) INLINE_CONST_FUNC
OOINLINE float OOLerp (float v0, float v1, float fraction) INLINE_CONST_FUNC
OOINLINE double OOLerpd (double v0, double v1, double fraction) INLINE_CONST_FUNC
OOINLINE INLINE_CONST_FUNC uint32_t OORoundUpToPowerOf2_32 (uint32_t value)
OOINLINE INLINE_CONST_FUNC uint64_t OORoundUpToPowerOf2_64 (uint64_t value)

Function Documentation

◆ OOClamp_0_1_d()

OOINLINE double OOClamp_0_1_d ( double value)

Definition at line 75 of file OOFastArithmetic.h.

76{
77 return fmax(0.0f, fmin(value, 1.0f));
78}

References OOINLINE.

Referenced by OOJoystickSplineAxisProfile::moveControl:point:, OOJoystickSplineAxisProfile::rawValue:, OOJoystickStandardAxisProfile::rawValue:, OOJoystickStandardAxisProfile::setParameter:, and OOECMBlastEntity::update:.

Here is the caller graph for this function:

◆ OOClamp_0_1_f()

OOINLINE float OOClamp_0_1_f ( float value)

Definition at line 65 of file OOFastArithmetic.h.

66{
67 return fmax(0.0f, fmin(value, 1.0f));
68}

References OOINLINE.

Referenced by OOTextureSprite::blitToX:Y:Z:alpha:, OOSunEntity::changeSunProperty:withDictionary:, OOTexture::checkExtensions, PlayerEntity::dialAftShield, PlayerEntity::dialAltitude, PlayerEntity::dialEnergy, PlayerEntity::dialForwardShield, PlayerEntity::dialSpeed, HeadUpDisplay(Private)::drawCustomBar:, HeadUpDisplay(Private)::drawDirectionCue:, OOSunEntity::drawDirectVisionSunGlare, DustEntity::drawImmediate:translucent:, OOParticleSystem::drawImmediate:translucent:, OORingEffectEntity::drawImmediate:translucent:, Universe::drawUniverse, ShipEntity::hullHeatLevel, MyOpenGLView::init, PlanetEntity(OOPrivate)::initAsAtmosphereForPlanet:dictionary:, OOSunEntity::initSunWithColor:andDictionary:, OOConcreteTexture::initWithLoader:key:options:anisotropy:lodBias:, PlayerEntity::laserHeatLevel, ShipEntity::laserHeatLevel, PlayerEntity::laserHeatLevelAft, ShipEntity::laserHeatLevelAft, PlayerEntity::laserHeatLevelForward, ShipEntity::laserHeatLevelForward, PlayerEntity::laserHeatLevelPort, ShipEntity::laserHeatLevelPort, PlayerEntity::laserHeatLevelStarboard, ShipEntity::laserHeatLevelStarboard, NSDictionary(OOMateralProperties)::oo_gloss, OOSparkEntity(Private)::performUpdate:, ShipEntity::randomEjectaTemperatureWithMaxFactor:, SkyEntity(OOPrivate)::readColor1:andColor2:andColor3:andColor4:fromDictionary:, Universe::setAirResistanceFactor:, OOVisualEffectEntity::setHullHeatLevel:, OOSound::setMasterVolume:, HeadUpDisplay::setOverallAlpha:, ShipEntity::setSunGlareFilter:, Universe::setSystemDataForGalaxy:planet:key:value:fromManifest:forLayer:, ShipEntity(PureAI)::setThrustFactorTo:, OOCrosshairs(Private)::setUpDataForOnePoint:scale:colorComps:overallAlpha:data:, OOBigFragmentBurstEntity::update:, OOPlasmaBurstEntity::update:, OOPlasmaShotEntity::update:, OOQuiriumCascadeEntity::update:, OOSmallFragmentBurstEntity::update:, and ShipEntity::weaponRecoveryTime.

Here is the caller graph for this function:

◆ OOClamp_0_max_d()

OOINLINE double OOClamp_0_max_d ( double value,
double max )

Definition at line 85 of file OOFastArithmetic.h.

86{
87 return fmax(0.0, fmin(value, max));
88}

References OOINLINE.

Referenced by EntitySetProperty(), EntitySetProperty(), Universe::nearbyDestinationsWithinRange:, PlayerEntity(OOControlsPrivate)::pollFlightControls:, OOJoystickAxisProfile::setDeadzone:, ShipSetProperty(), ShipSetProperty(), SoundSourceSetProperty(), and SoundSourceSetProperty().

Here is the caller graph for this function:

◆ OOClamp_0_max_f()

OOINLINE float OOClamp_0_max_f ( float value,
float max )

Definition at line 80 of file OOFastArithmetic.h.

81{
82 return fmax(0.0f, fmin(value, max));
83}

References OOINLINE.

Referenced by MyOpenGLView::adjustColorSaturation:, PlayerEntity::doBookkeeping:, PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity::setAftShieldLevel:, Universe::setAmbientLightLevel:, PlayerEntity::setForwardShieldLevel:, and ShipEntity::setUpShipFromDictionary:.

Here is the caller graph for this function:

◆ OOClamp_n1_1_f()

OOINLINE float OOClamp_n1_1_f ( float value)

Definition at line 70 of file OOFastArithmetic.h.

71{
72 return fmax(-1.0f, fmin(value, 1.0f));
73}

References OOINLINE.

Referenced by HeadUpDisplay(Private)::drawCustomIndicator:.

Here is the caller graph for this function:

◆ OOLerp()

OOINLINE float OOLerp ( float v0,
float v1,
float fraction )

Definition at line 90 of file OOFastArithmetic.h.

91{
92 // Linear interpolation - equivalent to v0 * (1.0f - fraction) + v1 * fraction.
93 return v0 + fraction * (v1 - v0);
94}

References OOINLINE.

Referenced by addNoise(), Blend(), GuiDisplayGen(Internal)::drawAdvancedNavArrayAtX:y:z:alpha:usingRoute:optimizedBy:zoom:, OOVectorInterpolate(), and ShipEntity::randomEjectaTemperatureWithMaxFactor:.

Here is the caller graph for this function:

◆ OOLerpd()

OOINLINE double OOLerpd ( double v0,
double v1,
double fraction )

Definition at line 96 of file OOFastArithmetic.h.

97{
98 // Linear interpolation - equivalent to v0 * (1.0 - fraction) + v1 * fraction.
99 return v0 + fraction * (v1 - v0);
100}

References OOINLINE.

Referenced by OOHPVectorInterpolate().

Here is the caller graph for this function:

◆ OORoundUpToPowerOf2_32()

OOINLINE INLINE_CONST_FUNC uint32_t OORoundUpToPowerOf2_32 ( uint32_t value)

Definition at line 41 of file OOFastArithmetic.h.

42{
43 return 0x80000000U >> (__builtin_clz(value - 1) - 1);
44}

References INLINE_CONST_FUNC, and OOINLINE.

Referenced by OOTextureLoader::setUp.

Here is the caller graph for this function:

◆ OORoundUpToPowerOf2_64()

OOINLINE INLINE_CONST_FUNC uint64_t OORoundUpToPowerOf2_64 ( uint64_t value)

Definition at line 46 of file OOFastArithmetic.h.

47{
48 return 0x8000000000000000ULL >> (__builtin_clzll(value - 1) - 1);
49}

References INLINE_CONST_FUNC, and OOINLINE.