D3DXVECTOR3 Interpolator::update()
{
	// move to next frame
	m_frame += m_speed;

	// Calculate the percentage we are at
	float t = m_frame / m_totalFrames;

	// Calculate the distance before we reach the target
	float DistanceLeft = distance(m_current, m_finish);

	// round to 1 decimal place to stop e numbers
	roundFloat(DistanceLeft, 1);

	// Check if we have reached the target
	if (DistanceLeft == 0)
		m_finished = true;

	// Interpolate towards target
	m_current = m_finish*t + m_current*(1.0f - t);

	return m_current;
}
Example #2
0
// ------------------------------------------------------------
// this version of frequency() (with an argument) is used to set the
// frequency of the timer in terms of hertz (1 cycle per second).
// for 48 MHz bus, range is about 12 mHz (0.012) to 75 kHz (75000)
// ------------------------------------------------------------
void PITimer::frequency(float newFrequency) {
    uint32_t newValue = roundFloat(F_BUS / newFrequency) - 1;
    value(newValue);
}
Example #3
0
Stop Stop::fromAperture(float a)
{
    return fromSixthStops(roundFloat(log2(a) * 12.));
}
Example #4
0
// ------------------------------------------------------------
// this version of period() (with an argument) is used to set the
// period of the timer in terms of units of time (seconds).
// for 48 MHz bus, range is about 14 ns (0.000014) to 89 s (89.0)
// ------------------------------------------------------------
void PITimer::period(float newPeriod) {
    uint32_t newValue = roundFloat(F_BUS * newPeriod) - 1;
    value(newValue);
}
Example #5
0
int Stop::asInt() const
{
    return roundFloat(asExposureCompensation());
}
Example #6
0
Stop Stop::fromExposureCompensation(float ec)
{
    return fromSixthStops(roundFloat(ec * 6.));
}
Example #7
0
Stop Stop::fromISO(int i)
{
    return fromSixthStops(roundFloat(log2(float(i) / 100.f) * 6.));
}
Example #8
0
Stop Stop::fromShutterspeed(float s)
{
    return fromSixthStops(roundFloat(log2(s) * -6.));
}
Example #9
0
Stop Stop::fromShuttertime(float t)
{
    return fromSixthStops(roundFloat(log2(t) * 6.));
}