Beispiel #1
0
static void AS_UpdateTime(TimeNode *st)
{
	Double time;
	M_AnimationStream *as = (M_AnimationStream *)st->obj;
	AnimationStreamStack *stack = Node_GetPrivate(st->obj);
	
	/*not active, store start time and speed*/
	if ( ! as->isActive) {
		stack->start_time = as->startTime;
	}
	time = Node_GetSceneTime(st->obj);

	if ((time < stack->start_time) || (stack->start_time < 0)) return;

	if (AS_GetSpeed(stack, as) && as->isActive) {
		//if stoptime is reached (>startTime) deactivate	
		if ((as->stopTime > stack->start_time) && (time >= as->stopTime) ) {
			AS_Deactivate(stack, as);
			return;
		}
		if (MO_IsFinished(stack->stream)) {
			if (AS_GetLoop(stack, as)) {
				MO_Restart(stack->stream);
			} else if (MO_ShouldDeactivate(stack->stream)) {
				AS_Deactivate(stack, as);
			}
		}
	}

	/*we're (about to be) active: VRML:
	"A time-dependent node is inactive until its startTime is reached. When time now becomes greater than or 
	equal to startTime, an isActive TRUE event is generated and the time-dependent node becomes active 	*/

	if (! as->isActive) AS_Activate(stack, as);
}
Beispiel #2
0
static void AS_UpdateTime(GF_TimeNode *st)
{
    Double time;
    M_AnimationStream *as = (M_AnimationStream *)st->obj;
    AnimationStreamStack *stack = (AnimationStreamStack *)gf_node_get_private(st->obj);

    /*not active, store start time and speed*/
    if ( ! as->isActive) {
        stack->start_time = as->startTime;
    }
    time = gf_node_get_scene_time(st->obj);

    if ((time < stack->start_time) || (stack->start_time < 0)) return;

    if (AS_GetSpeed(stack, as) && as->isActive) {
        //if stoptime is reached (>startTime) deactivate
        if ((as->stopTime > stack->start_time) && (time >= as->stopTime) ) {
            AS_Deactivate(stack, as);
            return;
        }
        if (gf_mo_is_done(stack->stream)) {
            if (AS_GetLoop(stack, as)) {
                gf_mo_restart(stack->stream);
            } else if (gf_mo_should_deactivate(stack->stream)) {
                AS_Deactivate(stack, as);
            }
        }
    }

    /*we're (about to be) active: VRML:
    "A time-dependent node is inactive until its startTime is reached. When time now becomes greater than or
    equal to startTime, an isActive TRUE event is generated and the time-dependent node becomes active 	*/
    if (!as->isActive && !st->needs_unregister) AS_Activate(stack, as);
}