Esempio n. 1
0
void CloudsIntroSequence::selfMouseMoved(ofMouseEventArgs& data){
    // use CloudsInput directly to get the z value too.
    cursor.set(GetCloudsInput()->getPosition());
	mouseLastMovedTime = ofGetElapsedTimef();
#ifdef MOUSE_INPUT
	if(!clickTextActive && startQuestions.size() > 0){
		clickTextActive = true;
		clickTextActiveTime = mouseLastMovedTime;
	}
#endif
}
Esempio n. 2
0
void CloudsIntroSequence::selfPostDraw(){
	
	CloudsVisualSystem::selfPostDraw();
#ifdef KINECT_INPUT
	//TODO: Move this to the general system drawing
	if(kinectHelperAlpha > 0.0){
		kinectHelperAlpha += (kinectHelperTargetAlpha-kinectHelperAlpha)*.05;
		ofPushStyle();
		ofSetColor(255,kinectHelperAlpha);
		((CloudsInputKinectOSC*) GetCloudsInput().get() )->debug(0,0, 200, 100);
	}
#endif

}
void CloudsVisualSystemYellowTail::selfDrawCursor(ofVec3f& pos, bool bDragged, CloudsCursorMode mode, float focus){
    
#ifdef OCULUS_RIFT
    GetCloudsInput()->drawCursorDefault(mode, pos, bDragged, focus);
    return;
    
#else
    ofPushStyle();
    
    float cursorSize;

#ifdef KINECT_INPUT
    ofPtr<CloudsInputKinectOSC> kinectOscInput = dynamic_pointer_cast<CloudsInputKinectOSC>(GetCloudsInput());
    if (bDragged)
        cursorSize = ofMap(pos.z, 2, -2, kinectOscInput->cursorDownSizeMin, kinectOscInput->cursorDownSizeMax, true);
    else
        cursorSize = ofMap(pos.z, 2, -2, kinectOscInput->cursorUpSizeMin, kinectOscInput->cursorUpSizeMax, true);
#else
    ofPtr<CloudsInputMouse> mouseInput = dynamic_pointer_cast<CloudsInputMouse>(GetCloudsInput());
    if (bDragged)
        cursorSize = mouseInput->cursorDownSize;
    else
        cursorSize = mouseInput->cursorUpSize;
#endif
    
    ofSetLineWidth(2);
    ofNoFill();
    if (bDragged)
        ofSetColor(62, 69, 213, 192 * focus);
    else  // !bDragged
        ofSetColor(255, 255, 255, 192 * focus);
    ofCircle(pos, cursorSize);
    
    ofPopStyle();
    
#endif
}
Esempio n. 4
0
void CloudsIntroSequence::drawIntroNodes(){

	ofPushStyle();
    float extraAttenuate = 1.0;
    
#ifdef KINECT_INPUT
	k4w::ViewerState viewerState = ((CloudsInputKinectOSC*)GetCloudsInput().get())->viewerState;
    if(viewerState < k4w::ViewerState_PresentIdle && introNodesShown){
        introNodesShown = false;
        introNodeChangeTime = ofGetElapsedTimef();
    }
	if(viewerState >= k4w::ViewerState_PresentIdle && !introNodesShown){
        introNodesShown = true;
        introNodeChangeTime = ofGetElapsedTimef();
    }
    
    extraAttenuate = ofMap(ofGetElapsedTimef(),
                           introNodeChangeTime, introNodeChangeTime+.5,
                           0.0, 1.0, true);
    //if(!introNodesShown) 1.0 - extraAttenuate;
    
    //cout << "show nodes " << introNodesShown << " attenuate " << endl;
    if(!introNodesShown){
        return;
    }
    
#endif
    
	for(int i = 0; i < introNodes.size(); i++){
		introNodes[i]->nodeAlphaAttenuate = nodeAlphaAttenuate;
		introNodes[i]->nodeBaseSize = introNodeSize;
		introNodes[i]->tint = ofFloatColor::fromHsb(tint.r, tint.g, tint.b);
		introNodes[i]->tint.a = 200*nodeAlphaAttenuate*extraAttenuate;
		
		introNodes[i]->draw();
		
		if(!introNodes[i]->finished){
			break;
		}

	}
	
	ofPopStyle();
	
}
void SetBleedPixels(int bleed){
    GetCloudsInput()->setBleedPixels(bleed);
}
ofVec3f GetCloudsPreviousInputPosition(){
	return GetCloudsInput()->getPreviousPosition();
}
map<int, CloudsInteractionEventArgs>& GetCloudsInputPoints(){
    return GetCloudsInput()->getInputPoints();
}
float GetCloudsInputZ(){
	return GetCloudsInput()->getPosition().z;
}
float GetCloudsInputY(){
	return GetCloudsInput()->getPosition().y;
}
float GetCloudsInputX(){
	return GetCloudsInput()->getPosition().x;
}
//global accessors
bool GetCloudsInputPressed(){
	return GetCloudsInput()->isDragging();
}
Esempio n. 12
0
void CloudsIntroSequence::updateWaiting(){
	
    // Trigger start manually
    if (startedOnclick) {
		nodeAlphaAttenuate = MAX(0,nodeAlphaAttenuate-0.02);
		clickToBeginAlpha *= .99;
		clickToBeginAlpha -= .001;
		clickToBeginAlpha = MAX(0,clickToBeginAlpha);
		return;
	}

	for(int i = 0; i < introNodes.size(); i++){
		updateIntroNodePosition(*introNodes[i]);
	}
	
	for(int i = 0; i < introNodes.size(); i++){
		updateIntroNodeInteraction(*introNodes[i]);
		//bail if we haven't completed this part of the sequence
		if(!introNodes[i]->finished){
			break;
		}
	}
	
	if(introNodeThree.finished){
		startedOnclick = true;
		timeline->play();
	}

	#ifdef OCULUS_RIFT
	
	#elif defined(KINECT_INPUT)
	k4w::ViewerState viewerState = ((CloudsInputKinectOSC*)GetCloudsInput().get())->viewerState;
	if(startQuestions.size() > 0 && viewerState != k4w::ViewerState_None){
		if(!promptShown && ofGetElapsedTimef() - timeSinceLastPrompt > 8){
			if(viewerState == k4w::ViewerState_OutOfRange){
//				CloudsPortalEventArgs args("MOVE CLOSER TO THE DISPLAY");
//				ofNotifyEvent(events.portalHoverBegan, args);
			}
			else if(viewerState == k4w::ViewerState_PresentIdle){
//				CloudsPortalEventArgs args("EXTEND YOUR HAND TO BEGIN");
//				ofNotifyEvent(events.portalHoverBegan, args);
			}
			timeSinceLastPrompt = ofGetElapsedTimef();
			promptShown = true;
			kinectHelperTargetAlpha = 1.0;
		}
		else if(promptShown && ofGetElapsedTimef() - timeSinceLastPrompt > 4){
			CloudsPortalEventArgs args("");
			ofNotifyEvent(events.portalHoverEnded, args);
			timeSinceLastPrompt = ofGetElapsedTimef();
			promptShown = false;
			kinectHelperTargetAlpha = 0.0;
		}
	}
	 
	#else
	if(startQuestions.size() > 0){
		if(!promptShown && ofGetElapsedTimef() - timeSinceLastPrompt > 10){
//			CloudsPortalEventArgs args("CLICK TO BEGIN");
//			ofNotifyEvent(events.portalHoverBegan, args);
			timeSinceLastPrompt = ofGetElapsedTimef();
			promptShown = true;

		}
		else if(promptShown && ofGetElapsedTimef() - timeSinceLastPrompt > 4){
			CloudsPortalEventArgs args("");
			ofNotifyEvent(events.portalHoverEnded, args);
			timeSinceLastPrompt = ofGetElapsedTimef();
			promptShown = false;
		}
	}
	#endif
	
	#ifdef MOUSE_INPUT
	if(clickTextActive){
		float timeSinceActive = ofGetElapsedTimef() - clickTextActiveTime;
		float timeSinceMouse = ofGetElapsedTimef() - mouseLastMovedTime;
		clickToBeginAlpha = ofMap(timeSinceActive,
								  .5,1.5,
								  0.0,1.0,true) *
								  ofMap(currentTitleOpacity,titleTypeOpacity,.9,0.3,.7,true);
        #ifdef TARGET_WIN32
        if(timeSinceMouse > 4.){
			clickToBeginAlpha *= ofMap(timeSinceMouse, 4.0, 5.0, 1.0, 0.0,true);
			if(timeSinceMouse > 5.0){
				clickTextActive = false;
				glfwSetCursorPos( ofAppGLFWWindow::windowP, getCanvasWidth()/2, getCanvasHeight()/2);
			}
		}
        #endif
	}
	#endif
}
Esempio n. 13
0
void CloudsIntroSequence::selfMouseDragged(ofMouseEventArgs& data){
    // use CloudsInput directly to get the z value too.
    cursor.set(GetCloudsInput()->getPosition());
}
Esempio n. 14
0
void CloudsIntroSequence::updateWaiting(){
	
    // Trigger start manually
    if (startedOnclick) {
		nodeAlphaAttenuate = MAX(0,nodeAlphaAttenuate-0.02);
		return;
	}

	for(int i = 0; i < introNodes.size(); i++){
		updateIntroNodePosition(*introNodes[i]);
	}
	
	for(int i = 0; i < introNodes.size(); i++){
		updateIntroNodeInteraction(*introNodes[i]);
		//bail if we haven't completed this part of the sequence
		if(!introNodes[i]->finished){
			break;
		}
	}
	
	if(introNodeThree.finished){
		startedOnclick = true;
		timeline->play();
	}

	#ifdef OCULUS_RIFT
	
	#elif defined(KINECT_INPUT)
	k4w::ViewerState viewerState = ((CloudsInputKinectOSC*)GetCloudsInput().get())->viewerState;
	if(startQuestions.size() > 0 && viewerState != k4w::ViewerState_None){
		if(!promptShown && ofGetElapsedTimef() - timeSinceLastPrompt > 8){
			if(viewerState == k4w::ViewerState_OutOfRange){
//				CloudsPortalEventArgs args("MOVE CLOSER TO THE DISPLAY");
//				ofNotifyEvent(events.portalHoverBegan, args);
			}
			else if(viewerState == k4w::ViewerState_PresentIdle){
//				CloudsPortalEventArgs args("EXTEND YOUR HAND TO BEGIN");
//				ofNotifyEvent(events.portalHoverBegan, args);
			}
			timeSinceLastPrompt = ofGetElapsedTimef();
			promptShown = true;
			kinectHelperTargetAlpha = 1.0;
		}
		else if(promptShown && ofGetElapsedTimef() - timeSinceLastPrompt > 4){
			CloudsPortalEventArgs args("");
			ofNotifyEvent(events.portalHoverEnded, args);
			timeSinceLastPrompt = ofGetElapsedTimef();
			promptShown = false;
			kinectHelperTargetAlpha = 0.0;
		}
	}
	 
	#else
	if(startQuestions.size() > 0){
		if(!promptShown && ofGetElapsedTimef() - timeSinceLastPrompt > 10){
//			CloudsPortalEventArgs args("CLICK TO BEGIN");
//			ofNotifyEvent(events.portalHoverBegan, args);
			timeSinceLastPrompt = ofGetElapsedTimef();
			promptShown = true;

		}
		else if(promptShown && ofGetElapsedTimef() - timeSinceLastPrompt > 4){
			CloudsPortalEventArgs args("");
			ofNotifyEvent(events.portalHoverEnded, args);
			timeSinceLastPrompt = ofGetElapsedTimef();
			promptShown = false;
		}
	}
	#endif
}