Esempio n. 1
0
void Renderer::update()
{
	ofPushMatrix();

	if(isActiveLightDirectional)
	{
		// transformer la lumière directionnelle
		orientationDirectional->makeRotate(int(ofGetElapsedTimeMillis() * 0.1f) % 360, 0, 1, 0);

		lightDirectional->setPosition(xCenter, yCenter + 60, cameraOffset * 0.75f);
		lightDirectional->setOrientation(*orientationDirectional);
	}

	if(isActiveLightPoint)
	{
		// transformer la lumière ponctuelle
		lightPoint->setPosition(ofGetMouseX(), ofGetMouseY(), cameraOffset * 0.75f);
	}

	if(isActiveLightSpot)
	{
		// transformer la lumière projecteur
		oscillation = oscillate(ofGetElapsedTimeMillis(), 45, speedOscillation, 0, 0);

		orientationSpot->makeRotate(30, ofVec3f(1, 0, 0), oscillation, ofVec3f(0, 1, 0), 0, ofVec3f(0, 0, 1));

		lightSpot->setOrientation(*orientationSpot);

		lightSpot->setPosition (xCenter, yCenter - 75, cameraOffset * 0.75f);
	}

	ofPopMatrix();
}
Esempio n. 2
0
void upDown(int steps, int T){
    int A[8]= {25, 25, 0, 0, 0, 0, 35, 35};
    int O[8] = {-25, 25, 0, 0, -60, 60, 0, 0};
    double phase_diff[8] = {DEG2RAD(0), DEG2RAD(180), 0, 0,
                            0, 0, DEG2RAD(0), DEG2RAD(180)};

    for(int i=0;i<steps;i++)oscillate(A,O, T, phase_diff);
}
Esempio n. 3
0
void moonWalkR(int steps, int T){
    int A[8]= {25, 25, 0, 0, 0, 0, 10, 10};
    int O[8] = {-15, 15, 0, 0, 60, -60, -30, 30};
    double phase_diff[8] = {DEG2RAD(0), DEG2RAD(180 + 120), DEG2RAD(90), DEG2RAD(90),
                            DEG2RAD(180), DEG2RAD(180), DEG2RAD(0), DEG2RAD(0)};

    for(int i=0;i<steps;i++)oscillate(A,O, T, phase_diff);
}
Esempio n. 4
0
void backward(int steps, int T){
    int A[8]= {15, 15, 25, 25, 20, 20, 15, 15};
    int O[8] = {0, 0, 0, 0, -60, 60, -30, 30};
    double phase_diff[8] = {DEG2RAD(180), DEG2RAD(180), DEG2RAD(90), DEG2RAD(90),
                            DEG2RAD(90), DEG2RAD(90), DEG2RAD(0), DEG2RAD(0)};

    for(int i=0;i<steps;i++) oscillate(A,O, T, phase_diff);
}
Esempio n. 5
0
void walk(int steps, int T){
    int A[8]= {18, 18, 20, 20, 20, 20, 15, 15};
    int O[8] = {0, 0, 0, 0, -60, 60, -30, 30};
    double phase_diff[8] = {DEG2RAD(0), DEG2RAD(0), DEG2RAD(90), DEG2RAD(90),
                            DEG2RAD(270), DEG2RAD(270), DEG2RAD(0), DEG2RAD(0)};

    for(int i=0;i<steps;i++) oscillate(A,O, T, phase_diff);
}
Esempio n. 6
0
/**
 * This method will generate a pulse of startingValue, starting immediately and of
 * length period. The pin will be left in the !startingValue state
 */
int8_t Timer::pulseImmediate(uint8_t pin, unsigned long period, uint8_t pulseValue)
{
	int8_t id(oscillate(pin, period, pulseValue, 1));
	// now fix the repeat count
	if (id >= 0 && id < MAX_NUMBER_OF_EVENTS) {
		_events[id].repeatCount = 1;
	}
	return id;
}
Esempio n. 7
0
void Moids::tickGenerateSoundState()
{
	if (m_needOscillation)
	{
		oscillate();
		return;
	}

	m_relayOnTimeCounter++;

	if (m_relayOnTime > m_relayOnTimeCounter)
	{
		return;
	}

	toNop();
}
Esempio n. 8
0
/**
 * This method will generate a pulse of !startingValue, occuring period after the
 * call of this method and lasting for period. The Pin will be left in !startingValue.
 */
int8_t Timer::pulse(uint8_t pin, unsigned long period, uint8_t startingValue)
{
	return oscillate(pin, period, startingValue, 1); // once
}
Esempio n. 9
0
int8_t Timer::oscillate(uint8_t pin, unsigned long period, uint8_t startingValue)
{
	return oscillate(pin, period, startingValue, -1); // forever
}
Esempio n. 10
0
	return i;
}

int8_t Timer::every(unsigned long period, void (*callback)())
{
	return every(period, callback, -1); // - means forever
}

int8_t Timer::after(unsigned long period, void (*callback)())
{
	return every(period, callback, 1);
}

int8_t Timer::oscillate(uint8_t pin, unsigned long period, uint8_t startingValue, int repeatCount)
{
	oscillate(pin, 0, period, startingValue, repeatCount)
}

int8_t Timer::oscillate(uint8_t pin, uint32_t delay, unsigned long period, uint8_t startingValue, int repeatCount)
{
	int8_t i = findFreeEventIndex();
	if (i == NO_TIMER_AVAILABLE) return NO_TIMER_AVAILABLE;

	_events[i].eventType = EVENT_OSCILLATE;
	_events[i].pin = pin;
	_events[i].period = period;
	_events[i].pinState = startingValue;
	_events[i].repeatCount = repeatCount * 2; // full cycles not transitions
	_events[i].lastEventTime = millis();
	_events[i].count = -1;
	_events[i].delay = delay;